/*! rulez.js 2019-09-18 */ !function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("rulez.js requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=function(b){"use strict";function c(b){var d,e=b.cloneNode(!1);if(b instanceof Element){var f=a.getComputedStyle(b);if(f)for(d=0;dR&&(R=a.pixelGap)}),I=J-J%R+R*L,H=-R*L}function e(a,b){G.divisions.forEach(function(c){f(a,b,c)});var c=0;G.texts.forEach(function(d){var e=m(a,b,d);N[c]?N[c]=N[c].concat(e):N.push(e),c++})}function f(a,b,c){for(var d=a;dj?(m=Math.sign(k)*(G.guideSnapInterval-l),b.position=Math.round(b.position+m)):b.position=Math.round(b.position-m)}else b.position=Math.round(b.position);n(e),i(a,b)},p=function(a){document.body.classList.remove(g),document.body.removeChild(m),document.removeEventListener("mousemove",o),document.removeEventListener("mouseup",p)};a.addEventListener("mousedown",function(a){a.stopPropagation(),document.body.classList.add(g),c=a[f],d=b.position,n(a),document.body.appendChild(m),document.addEventListener("mouseup",p),document.addEventListener("mousemove",o)},!0),a.addEventListener("dblclick",function(){k(a,b)})}function k(a,b){O=O.filter(function(b){return b!==a}),G.guides=G.guides.filter(function(a){return a!==b}),a.parentNode.removeChild(a)}function l(a){return o(a)}function m(a,b,c){for(var d=[],e=a;eb);else{J=b;var c=I;d(),e(c,I),this.scrollTo(P,!1)}},this.getGuideConfigs=function(){return JSON.parse(JSON.stringify(G.guides))},this.saveAsImage=function(b){var d=c(G.element);d.setAttribute("width",G.width),d.setAttribute("height",G.height);var e=a.document.createElement("canvas");e.setAttribute("width",G.width),e.setAttribute("height",G.height);var f=e.getContext("2d"),g=a.URL||a.webkitURL,h=new Image;h.style.position="absolute",h.style.top="-100000px",h.style.left="-100000px",h.style.zIndex=-1e5,h.setAttribute("width",G.width),h.setAttribute("height",G.height);var i=new Blob([d.outerHTML],{type:"image/svg+xml;charset=utf-8"}),j=g.createObjectURL(i);h.onload=function(){setTimeout(function(){f.drawImage(h,0,0),g.revokeObjectURL(j),a.document.body.removeChild(h),b(e.toDataURL())},1e3)},a.document.body.appendChild(h),h.src=j},this.getUnitConversionRate=function(){return A()}};return b||(a.Rulez=c),c});