@innovastudio/contentbox 1.6.54 → 1.6.55

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbox",
3
3
  "type": "module",
4
- "version": "1.6.54",
4
+ "version": "1.6.55",
5
5
  "description": "",
6
6
  "main": "public/contentbox/contentbox.esm.js",
7
7
  "files": [
@@ -52,7 +52,7 @@
52
52
  "ws": "^8.13.0"
53
53
  },
54
54
  "dependencies": {
55
- "@innovastudio/contentbuilder": "^1.5.38",
55
+ "@innovastudio/contentbuilder": "^1.5.40",
56
56
  "js-beautify": "^1.14.0"
57
57
  }
58
58
  }
@@ -43567,8 +43567,11 @@ const renderSnippetPanel = (builder, snippetOpen) => {
43567
43567
  // return false;
43568
43568
  // }
43569
43569
 
43570
- const wrapper = builder.doc.querySelector(builder.page);
43571
- if (wrapper) wrapper.style.marginLeft = '';
43570
+ // to prevent flicker caused by snippet panel above wrapper (see contentbuilder.js sectionDropSetup)
43571
+ if (builder.page && builder.page === '.is-wrapper') {
43572
+ const wrapper = builder.doc.querySelector(builder.page);
43573
+ if (wrapper) wrapper.style.marginLeft = '';
43574
+ }
43572
43575
  },
43573
43576
  onSort: evt => {
43574
43577
  if (!builder.canvas) return;
@@ -43585,12 +43588,6 @@ const renderSnippetPanel = (builder, snippetOpen) => {
43585
43588
  block.style.left = x + '%';
43586
43589
  block.removeAttribute('data-new-dummy');
43587
43590
  }
43588
-
43589
- // to prevent flicker caused by snippet panel above wrapper (see contentbuilder.js sectionDropSetup)
43590
- if (builder.page && builder.page === '.is-wrapper') {
43591
- const wrapper = builder.doc.querySelector(builder.page);
43592
- if (wrapper) wrapper.style.marginLeft = '';
43593
- }
43594
43591
  },
43595
43592
  onStart: () => {
43596
43593
  // Remove .builder-active during dragging (because this class makes rows have border-right/left 120px)
@@ -38,7 +38,7 @@ function wn(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Obj
38
38
  * Released under the MIT license
39
39
  *
40
40
  * Date: 2021-06-12T08:00:17.411Z
41
- */(t)}},!1));const b=document.querySelector(".is-design-list");let p=t.opts.snippetPath,h=t.opts.snippetJSON.snippets,m=t.opts.slider;if(null!=m)if("slick"===m){const e=t=>"glide"!==t.type;t.opts.snippetJSON.snippets=h.filter(e)}else if("glide"===m){const e=t=>"slick"!==t.type;t.opts.snippetJSON.snippets=h.filter(e)}else if("all"===m);else{const e=t=>"glide"!==t.type&&"slick"!==t.type;t.opts.snippetJSON.snippets=h.filter(e)}else{var g=!0;if(t.win.jQuery&&t.win.jQuery.fn.slick&&(g=!1),g){const t=h.filter((t=>"slick"!==t.type));h=[...t]}if(!t.win.Glide){const t=h.filter((t=>!(t.glide||"glide"===t.type)));h=[...t]}t.opts.snippetJSON.snippets=[...h]}let f,v,y=1;if(t.opts.emailMode?t.opts.snippetJSON.snippets.forEach((e=>{e.id=y,e.category===t.opts.defaultEmailSnippetCategory+""&&o.appendHtml(b,'<div class="snippet-item" data-id="'+e.id+'" data-cat="'+e.category+'"><img alt="'+i.out("Snippet")+'" src="'+p+e.thumbnail+'"><span class="is-overlay"></span></div>'),y++})):t.opts.snippetJSON.snippets.forEach((e=>{e.id=y,e.category===t.opts.defaultSnippetCategory+""&&o.appendHtml(b,'<div class="snippet-item" data-id="'+e.id+'" data-cat="'+e.category+'"><img alt="'+i.out("Snippet")+'" src="'+p+e.thumbnail+'"><span class="is-overlay"></span></div>'),y++})),new os(b,{group:{name:"shared",pull:"clone",put:!1},sort:!1,animation:150,onChoose:e=>{const i='\n <style id="css-scale">\n .sortable-ghost {\n height: 50px;\n }\n .sortable-ghost * {\n display: none\n }\n </style>\n ';if(v=e.item.offsetHeight,t.iframe){const e=t.contentStuff.querySelector("#css-scale");e&&e.parentNode.removeChild(e),t.contentStuff.insertAdjacentHTML("afterbegin",i)}else{const e=t.builderStuff.querySelector("#css-scale");e&&e.parentNode.removeChild(e),t.builderStuff.insertAdjacentHTML("afterbegin",i)}t.uo.saveForUndo(!0),t.sectionDropSetup(),t.util.clearPops(),t.hideElementTools()},onClone:t=>{var e=t.clone;let i=e.querySelector("img");i.style.opacity=1e-4,e.style.height=v+"px";let n=(new Date).getTime();i.src=i.src+"?"+n,i.style.opacity=""},onMove:()=>{let e=t.doc.querySelector(".row-add-initial");e&&(e.style.display="none");const i=t.doc.querySelector(t.page);i&&(i.style.marginLeft="")},onSort:e=>{if(!t.canvas)return;let i=e.originalEvent.clientX,n=e.originalEvent.clientY;const o=t.doc.querySelector("[data-new-dummy]");if(o){const t=o.parentNode,e=t.getBoundingClientRect();o.offsetWidth;let s=(i-o.offsetWidth/2-e.left)/t.offsetWidth*100,l=(n-o.offsetHeight/2-e.top)/t.offsetHeight*100;o.style.top=l+"%",o.style.left=s+"%",o.removeAttribute("data-new-dummy")}if(t.page&&".is-wrapper"===t.page){const e=t.doc.querySelector(t.page);e&&(e.style.marginLeft="")}},onStart:()=>{f=null;const e=t.doc.querySelector(".builder-active");e&&(f=e,o.removeClass(f,"builder-active"));let i=document.querySelector(".is-sidebar-overlay");i&&(i.style.display="none")},onEnd:()=>{let e=document.querySelector(".is-sidebar-overlay");e&&(e.style.display="block"),i.checkEmpty();let n=t.doc.querySelector(".row-add-initial");n&&(n.style.display=""),f&&o.addClass(f,"builder-active")},onUnchoose:()=>{setTimeout((()=>{if(t.sortableOnCanvas&&(t.sortableOnCanvas.forEach((t=>{t&&t.destroy()})),t.sortableOnCanvas=[]),t.sortableOnPage&&(t.sortableOnPage.destroy(),t.sortableOnPage=null),t.doc.querySelectorAll(".block-dummy").forEach((t=>t.parentNode.removeChild(t))),t.page&&".is-wrapper"===t.page){const e=t.doc.querySelector(t.page);e&&(e.style.marginLeft="")}}),10)}}),"#divSnippetList"===t.opts.snippetList){const n=c.querySelector("#divSnippetHandle");o.addEventListener(n,"click",(()=>{As(t),i.clearActiveCell(),i.clearControls()}));const s=window.innerWidth;(t.opts.snippetOpen||e)&&s>=960&&(c.style.cssText="transition: all ease 0.8s;",setTimeout((function(){As(t)}),100),setTimeout((function(){c.style.cssText=""}),1300))}let x=c.querySelector("#divSnippetScrollUp"),w=c.querySelector("#divSnippetScrollDown");x.style.display="none",w.style.display="none"};function As(t){const e=t.dom;let i=document.querySelector("#divSnippetList");const n=i.querySelector("#divSnippetHandle");e.hasClass(i,"active")?(e.removeClass(i,"active"),"right"===t.opts.sidePanel?n.innerHTML='<svg class="is-icon-flex" style="width:17px;height:17px;"><use xlink:href="#ion-ios-arrow-left"></use></svg>':n.innerHTML='<svg class="is-icon-flex" style="width:17px;height:17px;"><use xlink:href="#ion-ios-arrow-right"></use></svg>',setTimeout((()=>{i.querySelector(".is-design-list").style.display="none"}),300)):(i.querySelector(".is-design-list").style.display="block",setTimeout((()=>{e.addClass(i,"active"),"right"===t.opts.sidePanel?n.innerHTML='<svg class="is-icon-flex" style="width:17px;height:17px;"><use xlink:href="#ion-ios-arrow-right"></use></svg>':n.innerHTML='<svg class="is-icon-flex" style="width:17px;height:17px;"><use xlink:href="#ion-ios-arrow-left"></use></svg>'}),10))}function Es(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function qs(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Es(Object(i),!0).forEach((function(e){Os(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Es(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function Ts(t){return Ts="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ts(t)}function Ms(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function zs(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Os(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Rs(t){return function(t){if(Array.isArray(t))return Is(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Is(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Is(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Is(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var $s="undefined"!=typeof window&&void 0!==window.document,Bs=$s?window:{},Ns=!(!$s||!Bs.document.documentElement)&&"ontouchstart"in Bs.document.documentElement,Ps=!!$s&&"PointerEvent"in Bs,Ds="cropper",js="all",Hs="crop",Fs="move",Us="zoom",Ws="e",Gs="w",Ys="s",Xs="n",Vs="ne",Ks="nw",Zs="se",Qs="sw",Js="".concat(Ds,"-crop"),tl="".concat(Ds,"-disabled"),el="".concat(Ds,"-hidden"),il="".concat(Ds,"-hide"),nl="".concat(Ds,"-invisible"),ol="".concat(Ds,"-modal"),sl="".concat(Ds,"-move"),ll="".concat(Ds,"Action"),al="".concat(Ds,"Preview"),rl="crop",cl="move",ul="none",dl="crop",bl="cropend",pl="cropmove",hl="cropstart",ml="dblclick",gl=Ps?"pointerdown":Ns?"touchstart":"mousedown",fl=Ps?"pointermove":Ns?"touchmove":"mousemove",vl=Ps?"pointerup pointercancel":Ns?"touchend touchcancel":"mouseup",yl="ready",xl="resize",wl="wheel",Sl="zoom",_l="image/jpeg",kl=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,Cl=/^data:/,Ll=/^data:image\/jpeg;base64,/,Al=/^img|canvas$/i,El={viewMode:0,dragMode:rl,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:200,minContainerHeight:100,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},ql=Number.isNaN||Bs.isNaN;function Tl(t){return"number"==typeof t&&!ql(t)}var Ml=function(t){return t>0&&t<1/0};function zl(t){return void 0===t}function Ol(t){return"object"===Ts(t)&&null!==t}var Rl=Object.prototype.hasOwnProperty;function Il(t){if(!Ol(t))return!1;try{var e=t.constructor,i=e.prototype;return e&&i&&Rl.call(i,"isPrototypeOf")}catch(t){return!1}}function $l(t){return"function"==typeof t}var Bl=Array.prototype.slice;function Nl(t){return Array.from?Array.from(t):Bl.call(t)}function Pl(t,e){return t&&$l(e)&&(Array.isArray(t)||Tl(t.length)?Nl(t).forEach((function(i,n){e.call(t,i,n,t)})):Ol(t)&&Object.keys(t).forEach((function(i){e.call(t,t[i],i,t)}))),t}var Dl=Object.assign||function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return Ol(t)&&i.length>0&&i.forEach((function(e){Ol(e)&&Object.keys(e).forEach((function(i){t[i]=e[i]}))})),t},jl=/\.\d*(?:0|9){12}\d*$/;function Hl(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return jl.test(t)?Math.round(t*e)/e:t}var Fl=/^width|height|left|top|marginLeft|marginTop$/;function Ul(t,e){var i=t.style;Pl(e,(function(t,e){Fl.test(e)&&Tl(t)&&(t="".concat(t,"px")),i[e]=t}))}function Wl(t,e){if(e)if(Tl(t.length))Pl(t,(function(t){Wl(t,e)}));else if(t.classList)t.classList.add(e);else{var i=t.className.trim();i?i.indexOf(e)<0&&(t.className="".concat(i," ").concat(e)):t.className=e}}function Gl(t,e){e&&(Tl(t.length)?Pl(t,(function(t){Gl(t,e)})):t.classList?t.classList.remove(e):t.className.indexOf(e)>=0&&(t.className=t.className.replace(e,"")))}function Yl(t,e,i){e&&(Tl(t.length)?Pl(t,(function(t){Yl(t,e,i)})):i?Wl(t,e):Gl(t,e))}var Xl=/([a-z\d])([A-Z])/g;function Vl(t){return t.replace(Xl,"$1-$2").toLowerCase()}function Kl(t,e){return Ol(t[e])?t[e]:t.dataset?t.dataset[e]:t.getAttribute("data-".concat(Vl(e)))}function Zl(t,e,i){Ol(i)?t[e]=i:t.dataset?t.dataset[e]=i:t.setAttribute("data-".concat(Vl(e)),i)}var Ql=/\s\s*/,Jl=function(){var t=!1;if($s){var e=!1,i=function(){},n=Object.defineProperty({},"once",{get:function(){return t=!0,e},set:function(t){e=t}});Bs.addEventListener("test",i,n),Bs.removeEventListener("test",i,n)}return t}();function ta(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i;e.trim().split(Ql).forEach((function(e){if(!Jl){var s=t.listeners;s&&s[e]&&s[e][i]&&(o=s[e][i],delete s[e][i],0===Object.keys(s[e]).length&&delete s[e],0===Object.keys(s).length&&delete t.listeners)}t.removeEventListener(e,o,n)}))}function ea(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i;e.trim().split(Ql).forEach((function(e){if(n.once&&!Jl){var s=t.listeners,l=void 0===s?{}:s;o=function(){delete l[e][i],t.removeEventListener(e,o,n);for(var s=arguments.length,a=new Array(s),r=0;r<s;r++)a[r]=arguments[r];i.apply(t,a)},l[e]||(l[e]={}),l[e][i]&&t.removeEventListener(e,l[e][i],n),l[e][i]=o,t.listeners=l}t.addEventListener(e,o,n)}))}function ia(t,e,i){var n;return $l(Event)&&$l(CustomEvent)?n=new CustomEvent(e,{detail:i,bubbles:!0,cancelable:!0}):(n=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,i),t.dispatchEvent(n)}function na(t){var e=t.getBoundingClientRect();return{left:e.left+(window.pageXOffset-document.documentElement.clientLeft),top:e.top+(window.pageYOffset-document.documentElement.clientTop)}}var oa=Bs.location,sa=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function la(t){var e=t.match(sa);return null!==e&&(e[1]!==oa.protocol||e[2]!==oa.hostname||e[3]!==oa.port)}function aa(t){var e="timestamp=".concat((new Date).getTime());return t+(-1===t.indexOf("?")?"?":"&")+e}function ra(t){var e=t.rotate,i=t.scaleX,n=t.scaleY,o=t.translateX,s=t.translateY,l=[];Tl(o)&&0!==o&&l.push("translateX(".concat(o,"px)")),Tl(s)&&0!==s&&l.push("translateY(".concat(s,"px)")),Tl(e)&&0!==e&&l.push("rotate(".concat(e,"deg)")),Tl(i)&&1!==i&&l.push("scaleX(".concat(i,")")),Tl(n)&&1!==n&&l.push("scaleY(".concat(n,")"));var a=l.length?l.join(" "):"none";return{WebkitTransform:a,msTransform:a,transform:a}}function ca(t,e){var i=t.pageX,n=t.pageY,o={endX:i,endY:n};return e?o:qs({startX:i,startY:n},o)}function ua(t){var e=t.aspectRatio,i=t.height,n=t.width,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"contain",s=Ml(n),l=Ml(i);if(s&&l){var a=i*e;"contain"===o&&a>n||"cover"===o&&a<n?i=n/e:n=i*e}else s?i=n/e:l&&(n=i*e);return{width:n,height:i}}function da(t,e,i,n){var o=e.aspectRatio,s=e.naturalWidth,l=e.naturalHeight,a=e.rotate,r=void 0===a?0:a,c=e.scaleX,u=void 0===c?1:c,d=e.scaleY,b=void 0===d?1:d,p=i.aspectRatio,h=i.naturalWidth,m=i.naturalHeight,g=n.fillColor,f=void 0===g?"transparent":g,v=n.imageSmoothingEnabled,y=void 0===v||v,x=n.imageSmoothingQuality,w=void 0===x?"low":x,S=n.maxWidth,_=void 0===S?1/0:S,k=n.maxHeight,C=void 0===k?1/0:k,L=n.minWidth,A=void 0===L?0:L,E=n.minHeight,q=void 0===E?0:E,T=document.createElement("canvas"),M=T.getContext("2d"),z=ua({aspectRatio:p,width:_,height:C}),O=ua({aspectRatio:p,width:A,height:q},"cover"),R=Math.min(z.width,Math.max(O.width,h)),I=Math.min(z.height,Math.max(O.height,m)),$=ua({aspectRatio:o,width:_,height:C}),B=ua({aspectRatio:o,width:A,height:q},"cover"),N=Math.min($.width,Math.max(B.width,s)),P=Math.min($.height,Math.max(B.height,l)),D=[-N/2,-P/2,N,P];return T.width=Hl(R),T.height=Hl(I),M.fillStyle=f,M.fillRect(0,0,R,I),M.save(),M.translate(R/2,I/2),M.rotate(r*Math.PI/180),M.scale(u,b),M.imageSmoothingEnabled=y,M.imageSmoothingQuality=w,M.drawImage.apply(M,[t].concat(Rs(D.map((function(t){return Math.floor(Hl(t))}))))),M.restore(),T}var ba=String.fromCharCode;var pa=/^data:.*,/;function ha(t){var e,i=new DataView(t);try{var n,o,s;if(255===i.getUint8(0)&&216===i.getUint8(1))for(var l=i.byteLength,a=2;a+1<l;){if(255===i.getUint8(a)&&225===i.getUint8(a+1)){o=a;break}a+=1}if(o){var r=o+10;if("Exif"===function(t,e,i){var n="";i+=e;for(var o=e;o<i;o+=1)n+=ba(t.getUint8(o));return n}(i,o+4,4)){var c=i.getUint16(r);if(((n=18761===c)||19789===c)&&42===i.getUint16(r+2,n)){var u=i.getUint32(r+4,n);u>=8&&(s=r+u)}}}if(s){var d,b,p=i.getUint16(s,n);for(b=0;b<p;b+=1)if(d=s+12*b+2,274===i.getUint16(d,n)){d+=8,e=i.getUint16(d,n),i.setUint16(d,1,n);break}}}catch(t){e=1}return e}var ma={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var t=this.element,e=this.options,i=this.container,n=this.cropper,o=Number(e.minContainerWidth),s=Number(e.minContainerHeight);Wl(n,el),Gl(t,el);var l={width:Math.max(i.offsetWidth,o>=0?o:200),height:Math.max(i.offsetHeight,s>=0?s:100)};this.containerData=l,Ul(n,{width:l.width,height:l.height}),Wl(t,el),Gl(n,el)},initCanvas:function(){var t=this.containerData,e=this.imageData,i=this.options.viewMode,n=Math.abs(e.rotate)%180==90,o=n?e.naturalHeight:e.naturalWidth,s=n?e.naturalWidth:e.naturalHeight,l=o/s,a=t.width,r=t.height;t.height*l>t.width?3===i?a=t.height*l:r=t.width/l:3===i?r=t.width/l:a=t.height*l;var c={aspectRatio:l,naturalWidth:o,naturalHeight:s,width:a,height:r};this.canvasData=c,this.limited=1===i||2===i,this.limitCanvas(!0,!0),c.width=Math.min(Math.max(c.width,c.minWidth),c.maxWidth),c.height=Math.min(Math.max(c.height,c.minHeight),c.maxHeight),c.left=(t.width-c.width)/2,c.top=(t.height-c.height)/2,c.oldLeft=c.left,c.oldTop=c.top,this.initialCanvasData=Dl({},c)},limitCanvas:function(t,e){var i=this.options,n=this.containerData,o=this.canvasData,s=this.cropBoxData,l=i.viewMode,a=o.aspectRatio,r=this.cropped&&s;if(t){var c=Number(i.minCanvasWidth)||0,u=Number(i.minCanvasHeight)||0;l>1?(c=Math.max(c,n.width),u=Math.max(u,n.height),3===l&&(u*a>c?c=u*a:u=c/a)):l>0&&(c?c=Math.max(c,r?s.width:0):u?u=Math.max(u,r?s.height:0):r&&(c=s.width,(u=s.height)*a>c?c=u*a:u=c/a));var d=ua({aspectRatio:a,width:c,height:u});c=d.width,u=d.height,o.minWidth=c,o.minHeight=u,o.maxWidth=1/0,o.maxHeight=1/0}if(e)if(l>(r?0:1)){var b=n.width-o.width,p=n.height-o.height;o.minLeft=Math.min(0,b),o.minTop=Math.min(0,p),o.maxLeft=Math.max(0,b),o.maxTop=Math.max(0,p),r&&this.limited&&(o.minLeft=Math.min(s.left,s.left+(s.width-o.width)),o.minTop=Math.min(s.top,s.top+(s.height-o.height)),o.maxLeft=s.left,o.maxTop=s.top,2===l&&(o.width>=n.width&&(o.minLeft=Math.min(0,b),o.maxLeft=Math.max(0,b)),o.height>=n.height&&(o.minTop=Math.min(0,p),o.maxTop=Math.max(0,p))))}else o.minLeft=-o.width,o.minTop=-o.height,o.maxLeft=n.width,o.maxTop=n.height},renderCanvas:function(t,e){var i=this.canvasData,n=this.imageData;if(e){var o=function(t){var e=t.width,i=t.height,n=t.degree;if(90==(n=Math.abs(n)%180))return{width:i,height:e};var o=n%90*Math.PI/180,s=Math.sin(o),l=Math.cos(o),a=e*l+i*s,r=e*s+i*l;return n>90?{width:r,height:a}:{width:a,height:r}}({width:n.naturalWidth*Math.abs(n.scaleX||1),height:n.naturalHeight*Math.abs(n.scaleY||1),degree:n.rotate||0}),s=o.width,l=o.height,a=i.width*(s/i.naturalWidth),r=i.height*(l/i.naturalHeight);i.left-=(a-i.width)/2,i.top-=(r-i.height)/2,i.width=a,i.height=r,i.aspectRatio=s/l,i.naturalWidth=s,i.naturalHeight=l,this.limitCanvas(!0,!1)}(i.width>i.maxWidth||i.width<i.minWidth)&&(i.left=i.oldLeft),(i.height>i.maxHeight||i.height<i.minHeight)&&(i.top=i.oldTop),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),this.limitCanvas(!1,!0),i.left=Math.min(Math.max(i.left,i.minLeft),i.maxLeft),i.top=Math.min(Math.max(i.top,i.minTop),i.maxTop),i.oldLeft=i.left,i.oldTop=i.top,Ul(this.canvas,Dl({width:i.width,height:i.height},ra({translateX:i.left,translateY:i.top}))),this.renderImage(t),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(t){var e=this.canvasData,i=this.imageData,n=i.naturalWidth*(e.width/e.naturalWidth),o=i.naturalHeight*(e.height/e.naturalHeight);Dl(i,{width:n,height:o,left:(e.width-n)/2,top:(e.height-o)/2}),Ul(this.image,Dl({width:i.width,height:i.height},ra(Dl({translateX:i.left,translateY:i.top},i)))),t&&this.output()},initCropBox:function(){var t=this.options,e=this.canvasData,i=t.aspectRatio||t.initialAspectRatio,n=Number(t.autoCropArea)||.8,o={width:e.width,height:e.height};i&&(e.height*i>e.width?o.height=o.width/i:o.width=o.height*i),this.cropBoxData=o,this.limitCropBox(!0,!0),o.width=Math.min(Math.max(o.width,o.minWidth),o.maxWidth),o.height=Math.min(Math.max(o.height,o.minHeight),o.maxHeight),o.width=Math.max(o.minWidth,o.width*n),o.height=Math.max(o.minHeight,o.height*n),o.left=e.left+(e.width-o.width)/2,o.top=e.top+(e.height-o.height)/2,o.oldLeft=o.left,o.oldTop=o.top,this.initialCropBoxData=Dl({},o)},limitCropBox:function(t,e){var i=this.options,n=this.containerData,o=this.canvasData,s=this.cropBoxData,l=this.limited,a=i.aspectRatio;if(t){var r=Number(i.minCropBoxWidth)||0,c=Number(i.minCropBoxHeight)||0,u=l?Math.min(n.width,o.width,o.width+o.left,n.width-o.left):n.width,d=l?Math.min(n.height,o.height,o.height+o.top,n.height-o.top):n.height;r=Math.min(r,n.width),c=Math.min(c,n.height),a&&(r&&c?c*a>r?c=r/a:r=c*a:r?c=r/a:c&&(r=c*a),d*a>u?d=u/a:u=d*a),s.minWidth=Math.min(r,u),s.minHeight=Math.min(c,d),s.maxWidth=u,s.maxHeight=d}e&&(l?(s.minLeft=Math.max(0,o.left),s.minTop=Math.max(0,o.top),s.maxLeft=Math.min(n.width,o.left+o.width)-s.width,s.maxTop=Math.min(n.height,o.top+o.height)-s.height):(s.minLeft=0,s.minTop=0,s.maxLeft=n.width-s.width,s.maxTop=n.height-s.height))},renderCropBox:function(){var t=this.options,e=this.containerData,i=this.cropBoxData;(i.width>i.maxWidth||i.width<i.minWidth)&&(i.left=i.oldLeft),(i.height>i.maxHeight||i.height<i.minHeight)&&(i.top=i.oldTop),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),this.limitCropBox(!1,!0),i.left=Math.min(Math.max(i.left,i.minLeft),i.maxLeft),i.top=Math.min(Math.max(i.top,i.minTop),i.maxTop),i.oldLeft=i.left,i.oldTop=i.top,t.movable&&t.cropBoxMovable&&Zl(this.face,ll,i.width>=e.width&&i.height>=e.height?Fs:js),Ul(this.cropBox,Dl({width:i.width,height:i.height},ra({translateX:i.left,translateY:i.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),ia(this.element,dl,this.getData())}},ga={initPreview:function(){var t=this.element,e=this.crossOrigin,i=this.options.preview,n=e?this.crossOriginUrl:this.url,o=t.alt||"The image to preview",s=document.createElement("img");if(e&&(s.crossOrigin=e),s.src=n,s.alt=o,this.viewBox.appendChild(s),this.viewBoxImage=s,i){var l=i;"string"==typeof i?l=t.ownerDocument.querySelectorAll(i):i.querySelector&&(l=[i]),this.previews=l,Pl(l,(function(t){var i=document.createElement("img");Zl(t,al,{width:t.offsetWidth,height:t.offsetHeight,html:t.innerHTML}),e&&(i.crossOrigin=e),i.src=n,i.alt=o,i.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',t.innerHTML="",t.appendChild(i)}))}},resetPreview:function(){Pl(this.previews,(function(t){var e=Kl(t,al);Ul(t,{width:e.width,height:e.height}),t.innerHTML=e.html,function(t,e){if(Ol(t[e]))try{delete t[e]}catch(i){t[e]=void 0}else if(t.dataset)try{delete t.dataset[e]}catch(i){t.dataset[e]=void 0}else t.removeAttribute("data-".concat(Vl(e)))}(t,al)}))},preview:function(){var t=this.imageData,e=this.canvasData,i=this.cropBoxData,n=i.width,o=i.height,s=t.width,l=t.height,a=i.left-e.left-t.left,r=i.top-e.top-t.top;this.cropped&&!this.disabled&&(Ul(this.viewBoxImage,Dl({width:s,height:l},ra(Dl({translateX:-a,translateY:-r},t)))),Pl(this.previews,(function(e){var i=Kl(e,al),c=i.width,u=i.height,d=c,b=u,p=1;n&&(b=o*(p=c/n)),o&&b>u&&(d=n*(p=u/o),b=u),Ul(e,{width:d,height:b}),Ul(e.getElementsByTagName("img")[0],Dl({width:s*p,height:l*p},ra(Dl({translateX:-a*p,translateY:-r*p},t))))})))}},fa={bind:function(){var t=this.element,e=this.options,i=this.cropper;$l(e.cropstart)&&ea(t,hl,e.cropstart),$l(e.cropmove)&&ea(t,pl,e.cropmove),$l(e.cropend)&&ea(t,bl,e.cropend),$l(e.crop)&&ea(t,dl,e.crop),$l(e.zoom)&&ea(t,Sl,e.zoom),ea(i,gl,this.onCropStart=this.cropStart.bind(this)),e.zoomable&&e.zoomOnWheel&&ea(i,wl,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&ea(i,ml,this.onDblclick=this.dblclick.bind(this)),ea(t.ownerDocument,fl,this.onCropMove=this.cropMove.bind(this)),ea(t.ownerDocument,vl,this.onCropEnd=this.cropEnd.bind(this)),e.responsive&&ea(window,xl,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,e=this.options,i=this.cropper;$l(e.cropstart)&&ta(t,hl,e.cropstart),$l(e.cropmove)&&ta(t,pl,e.cropmove),$l(e.cropend)&&ta(t,bl,e.cropend),$l(e.crop)&&ta(t,dl,e.crop),$l(e.zoom)&&ta(t,Sl,e.zoom),ta(i,gl,this.onCropStart),e.zoomable&&e.zoomOnWheel&&ta(i,wl,this.onWheel,{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&ta(i,ml,this.onDblclick),ta(t.ownerDocument,fl,this.onCropMove),ta(t.ownerDocument,vl,this.onCropEnd),e.responsive&&ta(window,xl,this.onResize)}},va={resize:function(){if(!this.disabled){var t,e,i=this.options,n=this.container,o=this.containerData,s=n.offsetWidth/o.width,l=n.offsetHeight/o.height,a=Math.abs(s-1)>Math.abs(l-1)?s:l;if(1!==a)i.restore&&(t=this.getCanvasData(),e=this.getCropBoxData()),this.render(),i.restore&&(this.setCanvasData(Pl(t,(function(e,i){t[i]=e*a}))),this.setCropBoxData(Pl(e,(function(t,i){e[i]=t*a}))))}},dblclick:function(){var t,e;this.disabled||this.options.dragMode===ul||this.setDragMode((t=this.dragBox,e=Js,(t.classList?t.classList.contains(e):t.className.indexOf(e)>-1)?cl:rl))},wheel:function(t){var e=this,i=Number(this.options.wheelZoomRatio)||.1,n=1;this.disabled||(t.preventDefault(),this.wheeling||(this.wheeling=!0,setTimeout((function(){e.wheeling=!1}),50),t.deltaY?n=t.deltaY>0?1:-1:t.wheelDelta?n=-t.wheelDelta/120:t.detail&&(n=t.detail>0?1:-1),this.zoom(-n*i,t)))},cropStart:function(t){var e=t.buttons,i=t.button;if(!(this.disabled||("mousedown"===t.type||"pointerdown"===t.type&&"mouse"===t.pointerType)&&(Tl(e)&&1!==e||Tl(i)&&0!==i||t.ctrlKey))){var n,o=this.options,s=this.pointers;t.changedTouches?Pl(t.changedTouches,(function(t){s[t.identifier]=ca(t)})):s[t.pointerId||0]=ca(t),n=Object.keys(s).length>1&&o.zoomable&&o.zoomOnTouch?Us:Kl(t.target,ll),kl.test(n)&&!1!==ia(this.element,hl,{originalEvent:t,action:n})&&(t.preventDefault(),this.action=n,this.cropping=!1,n===Hs&&(this.cropping=!0,Wl(this.dragBox,ol)))}},cropMove:function(t){var e=this.action;if(!this.disabled&&e){var i=this.pointers;t.preventDefault(),!1!==ia(this.element,pl,{originalEvent:t,action:e})&&(t.changedTouches?Pl(t.changedTouches,(function(t){Dl(i[t.identifier]||{},ca(t,!0))})):Dl(i[t.pointerId||0]||{},ca(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var e=this.action,i=this.pointers;t.changedTouches?Pl(t.changedTouches,(function(t){delete i[t.identifier]})):delete i[t.pointerId||0],e&&(t.preventDefault(),Object.keys(i).length||(this.action=""),this.cropping&&(this.cropping=!1,Yl(this.dragBox,ol,this.cropped&&this.options.modal)),ia(this.element,bl,{originalEvent:t,action:e}))}}},ya={change:function(t){var e,i=this.options,n=this.canvasData,o=this.containerData,s=this.cropBoxData,l=this.pointers,a=this.action,r=i.aspectRatio,c=s.left,u=s.top,d=s.width,b=s.height,p=c+d,h=u+b,m=0,g=0,f=o.width,v=o.height,y=!0;!r&&t.shiftKey&&(r=d&&b?d/b:1),this.limited&&(m=s.minLeft,g=s.minTop,f=m+Math.min(o.width,n.width,n.left+n.width),v=g+Math.min(o.height,n.height,n.top+n.height));var x=l[Object.keys(l)[0]],w={x:x.endX-x.startX,y:x.endY-x.startY},S=function(t){switch(t){case Ws:p+w.x>f&&(w.x=f-p);break;case Gs:c+w.x<m&&(w.x=m-c);break;case Xs:u+w.y<g&&(w.y=g-u);break;case Ys:h+w.y>v&&(w.y=v-h)}};switch(a){case js:c+=w.x,u+=w.y;break;case Ws:if(w.x>=0&&(p>=f||r&&(u<=g||h>=v))){y=!1;break}S(Ws),(d+=w.x)<0&&(a=Gs,c-=d=-d),r&&(b=d/r,u+=(s.height-b)/2);break;case Xs:if(w.y<=0&&(u<=g||r&&(c<=m||p>=f))){y=!1;break}S(Xs),b-=w.y,u+=w.y,b<0&&(a=Ys,u-=b=-b),r&&(d=b*r,c+=(s.width-d)/2);break;case Gs:if(w.x<=0&&(c<=m||r&&(u<=g||h>=v))){y=!1;break}S(Gs),d-=w.x,c+=w.x,d<0&&(a=Ws,c-=d=-d),r&&(b=d/r,u+=(s.height-b)/2);break;case Ys:if(w.y>=0&&(h>=v||r&&(c<=m||p>=f))){y=!1;break}S(Ys),(b+=w.y)<0&&(a=Xs,u-=b=-b),r&&(d=b*r,c+=(s.width-d)/2);break;case Vs:if(r){if(w.y<=0&&(u<=g||p>=f)){y=!1;break}S(Xs),b-=w.y,u+=w.y,d=b*r}else S(Xs),S(Ws),w.x>=0?p<f?d+=w.x:w.y<=0&&u<=g&&(y=!1):d+=w.x,w.y<=0?u>g&&(b-=w.y,u+=w.y):(b-=w.y,u+=w.y);d<0&&b<0?(a=Qs,u-=b=-b,c-=d=-d):d<0?(a=Ks,c-=d=-d):b<0&&(a=Zs,u-=b=-b);break;case Ks:if(r){if(w.y<=0&&(u<=g||c<=m)){y=!1;break}S(Xs),b-=w.y,u+=w.y,d=b*r,c+=s.width-d}else S(Xs),S(Gs),w.x<=0?c>m?(d-=w.x,c+=w.x):w.y<=0&&u<=g&&(y=!1):(d-=w.x,c+=w.x),w.y<=0?u>g&&(b-=w.y,u+=w.y):(b-=w.y,u+=w.y);d<0&&b<0?(a=Zs,u-=b=-b,c-=d=-d):d<0?(a=Vs,c-=d=-d):b<0&&(a=Qs,u-=b=-b);break;case Qs:if(r){if(w.x<=0&&(c<=m||h>=v)){y=!1;break}S(Gs),d-=w.x,c+=w.x,b=d/r}else S(Ys),S(Gs),w.x<=0?c>m?(d-=w.x,c+=w.x):w.y>=0&&h>=v&&(y=!1):(d-=w.x,c+=w.x),w.y>=0?h<v&&(b+=w.y):b+=w.y;d<0&&b<0?(a=Vs,u-=b=-b,c-=d=-d):d<0?(a=Zs,c-=d=-d):b<0&&(a=Ks,u-=b=-b);break;case Zs:if(r){if(w.x>=0&&(p>=f||h>=v)){y=!1;break}S(Ws),b=(d+=w.x)/r}else S(Ys),S(Ws),w.x>=0?p<f?d+=w.x:w.y>=0&&h>=v&&(y=!1):d+=w.x,w.y>=0?h<v&&(b+=w.y):b+=w.y;d<0&&b<0?(a=Ks,u-=b=-b,c-=d=-d):d<0?(a=Qs,c-=d=-d):b<0&&(a=Vs,u-=b=-b);break;case Fs:this.move(w.x,w.y),y=!1;break;case Us:this.zoom(function(t){var e=qs({},t),i=0;return Pl(t,(function(t,n){delete e[n],Pl(e,(function(e){var n=Math.abs(t.startX-e.startX),o=Math.abs(t.startY-e.startY),s=Math.abs(t.endX-e.endX),l=Math.abs(t.endY-e.endY),a=Math.sqrt(n*n+o*o),r=(Math.sqrt(s*s+l*l)-a)/a;Math.abs(r)>Math.abs(i)&&(i=r)}))})),i}(l),t),y=!1;break;case Hs:if(!w.x||!w.y){y=!1;break}e=na(this.cropper),c=x.startX-e.left,u=x.startY-e.top,d=s.minWidth,b=s.minHeight,w.x>0?a=w.y>0?Zs:Vs:w.x<0&&(c-=d,a=w.y>0?Qs:Ks),w.y<0&&(u-=b),this.cropped||(Gl(this.cropBox,el),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0))}y&&(s.width=d,s.height=b,s.left=c,s.top=u,this.action=a,this.renderCropBox()),Pl(l,(function(t){t.startX=t.endX,t.startY=t.endY}))}},xa={crop:function(){return!this.ready||this.cropped||this.disabled||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&Wl(this.dragBox,ol),Gl(this.cropBox,el),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=Dl({},this.initialImageData),this.canvasData=Dl({},this.initialCanvasData),this.cropBoxData=Dl({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(Dl(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),Gl(this.dragBox,ol),Wl(this.cropBox,el)),this},replace:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!this.disabled&&t&&(this.isImg&&(this.element.src=t),e?(this.url=t,this.image.src=t,this.ready&&(this.viewBoxImage.src=t,Pl(this.previews,(function(e){e.getElementsByTagName("img")[0].src=t})))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(t))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,Gl(this.cropper,tl)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,Wl(this.cropper,tl)),this},destroy:function(){var t=this.element;return t.cropper?(t.cropper=void 0,this.isImg&&this.replaced&&(t.src=this.originalUrl),this.uncreate(),this):this},move:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.canvasData,n=i.left,o=i.top;return this.moveTo(zl(t)?t:n+Number(t),zl(e)?e:o+Number(e))},moveTo:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.canvasData,n=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.movable&&(Tl(t)&&(i.left=t,n=!0),Tl(e)&&(i.top=e,n=!0),n&&this.renderCanvas(!0)),this},zoom:function(t,e){var i=this.canvasData;return t=(t=Number(t))<0?1/(1-t):1+t,this.zoomTo(i.width*t/i.naturalWidth,null,e)},zoomTo:function(t,e,i){var n=this.options,o=this.canvasData,s=o.width,l=o.height,a=o.naturalWidth,r=o.naturalHeight;if((t=Number(t))>=0&&this.ready&&!this.disabled&&n.zoomable){var c=a*t,u=r*t;if(!1===ia(this.element,Sl,{ratio:t,oldRatio:s/a,originalEvent:i}))return this;if(i){var d=this.pointers,b=na(this.cropper),p=d&&Object.keys(d).length?function(t){var e=0,i=0,n=0;return Pl(t,(function(t){var o=t.startX,s=t.startY;e+=o,i+=s,n+=1})),{pageX:e/=n,pageY:i/=n}}(d):{pageX:i.pageX,pageY:i.pageY};o.left-=(c-s)*((p.pageX-b.left-o.left)/s),o.top-=(u-l)*((p.pageY-b.top-o.top)/l)}else Il(e)&&Tl(e.x)&&Tl(e.y)?(o.left-=(c-s)*((e.x-o.left)/s),o.top-=(u-l)*((e.y-o.top)/l)):(o.left-=(c-s)/2,o.top-=(u-l)/2);o.width=c,o.height=u,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return Tl(t=Number(t))&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=t%360,this.renderCanvas(!0,!0)),this},scaleX:function(t){var e=this.imageData.scaleY;return this.scale(t,Tl(e)?e:1)},scaleY:function(t){var e=this.imageData.scaleX;return this.scale(Tl(e)?e:1,t)},scale:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.imageData,n=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.scalable&&(Tl(t)&&(i.scaleX=t,n=!0),Tl(e)&&(i.scaleY=e,n=!0),n&&this.renderCanvas(!0,!0)),this},getData:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=this.options,n=this.imageData,o=this.canvasData,s=this.cropBoxData;if(this.ready&&this.cropped){t={x:s.left-o.left,y:s.top-o.top,width:s.width,height:s.height};var l=n.width/n.naturalWidth;if(Pl(t,(function(e,i){t[i]=e/l})),e){var a=Math.round(t.y+t.height),r=Math.round(t.x+t.width);t.x=Math.round(t.x),t.y=Math.round(t.y),t.width=r-t.x,t.height=a-t.y}}else t={x:0,y:0,width:0,height:0};return i.rotatable&&(t.rotate=n.rotate||0),i.scalable&&(t.scaleX=n.scaleX||1,t.scaleY=n.scaleY||1),t},setData:function(t){var e=this.options,i=this.imageData,n=this.canvasData,o={};if(this.ready&&!this.disabled&&Il(t)){var s=!1;e.rotatable&&Tl(t.rotate)&&t.rotate!==i.rotate&&(i.rotate=t.rotate,s=!0),e.scalable&&(Tl(t.scaleX)&&t.scaleX!==i.scaleX&&(i.scaleX=t.scaleX,s=!0),Tl(t.scaleY)&&t.scaleY!==i.scaleY&&(i.scaleY=t.scaleY,s=!0)),s&&this.renderCanvas(!0,!0);var l=i.width/i.naturalWidth;Tl(t.x)&&(o.left=t.x*l+n.left),Tl(t.y)&&(o.top=t.y*l+n.top),Tl(t.width)&&(o.width=t.width*l),Tl(t.height)&&(o.height=t.height*l),this.setCropBoxData(o)}return this},getContainerData:function(){return this.ready?Dl({},this.containerData):{}},getImageData:function(){return this.sized?Dl({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,e={};return this.ready&&Pl(["left","top","width","height","naturalWidth","naturalHeight"],(function(i){e[i]=t[i]})),e},setCanvasData:function(t){var e=this.canvasData,i=e.aspectRatio;return this.ready&&!this.disabled&&Il(t)&&(Tl(t.left)&&(e.left=t.left),Tl(t.top)&&(e.top=t.top),Tl(t.width)?(e.width=t.width,e.height=t.width/i):Tl(t.height)&&(e.height=t.height,e.width=t.height*i),this.renderCanvas(!0)),this},getCropBoxData:function(){var t,e=this.cropBoxData;return this.ready&&this.cropped&&(t={left:e.left,top:e.top,width:e.width,height:e.height}),t||{}},setCropBoxData:function(t){var e,i,n=this.cropBoxData,o=this.options.aspectRatio;return this.ready&&this.cropped&&!this.disabled&&Il(t)&&(Tl(t.left)&&(n.left=t.left),Tl(t.top)&&(n.top=t.top),Tl(t.width)&&t.width!==n.width&&(e=!0,n.width=t.width),Tl(t.height)&&t.height!==n.height&&(i=!0,n.height=t.height),o&&(e?n.height=n.width/o:i&&(n.width=n.height*o)),this.renderCropBox()),this},getCroppedCanvas:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var e=this.canvasData,i=da(this.image,this.imageData,e,t);if(!this.cropped)return i;var n=this.getData(),o=n.x,s=n.y,l=n.width,a=n.height,r=i.width/Math.floor(e.naturalWidth);1!==r&&(o*=r,s*=r,l*=r,a*=r);var c=l/a,u=ua({aspectRatio:c,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),d=ua({aspectRatio:c,width:t.minWidth||0,height:t.minHeight||0},"cover"),b=ua({aspectRatio:c,width:t.width||(1!==r?i.width:l),height:t.height||(1!==r?i.height:a)}),p=b.width,h=b.height;p=Math.min(u.width,Math.max(d.width,p)),h=Math.min(u.height,Math.max(d.height,h));var m=document.createElement("canvas"),g=m.getContext("2d");m.width=Hl(p),m.height=Hl(h),g.fillStyle=t.fillColor||"transparent",g.fillRect(0,0,p,h);var f=t.imageSmoothingEnabled,v=void 0===f||f,y=t.imageSmoothingQuality;g.imageSmoothingEnabled=v,y&&(g.imageSmoothingQuality=y);var x,w,S,_,k,C,L=i.width,A=i.height,E=o,q=s;E<=-l||E>L?(E=0,x=0,S=0,k=0):E<=0?(S=-E,E=0,k=x=Math.min(L,l+E)):E<=L&&(S=0,k=x=Math.min(l,L-E)),x<=0||q<=-a||q>A?(q=0,w=0,_=0,C=0):q<=0?(_=-q,q=0,C=w=Math.min(A,a+q)):q<=A&&(_=0,C=w=Math.min(a,A-q));var T=[E,q,x,w];if(k>0&&C>0){var M=p/l;T.push(S*M,_*M,k*M,C*M)}return g.drawImage.apply(g,[i].concat(Rs(T.map((function(t){return Math.floor(Hl(t))}))))),m},setAspectRatio:function(t){var e=this.options;return this.disabled||zl(t)||(e.aspectRatio=Math.max(0,t)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(t){var e=this.options,i=this.dragBox,n=this.face;if(this.ready&&!this.disabled){var o=t===rl,s=e.movable&&t===cl;t=o||s?t:ul,e.dragMode=t,Zl(i,ll,t),Yl(i,Js,o),Yl(i,sl,s),e.cropBoxMovable||(Zl(n,ll,t),Yl(n,Js,o),Yl(n,sl,s))}return this}},wa=Bs.Cropper,Sa=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Ms(this,t),!e||!Al.test(e.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=e,this.options=Dl({},El,Il(i)&&i),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}var e,i,n;return e=t,i=[{key:"init",value:function(){var t,e=this.element,i=e.tagName.toLowerCase();if(!e.cropper){if(e.cropper=this,"img"===i){if(this.isImg=!0,t=e.getAttribute("src")||"",this.originalUrl=t,!t)return;t=e.src}else"canvas"===i&&window.HTMLCanvasElement&&(t=e.toDataURL());this.load(t)}}},{key:"load",value:function(t){var e=this;if(t){this.url=t,this.imageData={};var i=this.element,n=this.options;if(n.rotatable||n.scalable||(n.checkOrientation=!1),n.checkOrientation&&window.ArrayBuffer)if(Cl.test(t))Ll.test(t)?this.read((o=t.replace(pa,""),s=atob(o),l=new ArrayBuffer(s.length),Pl(a=new Uint8Array(l),(function(t,e){a[e]=s.charCodeAt(e)})),l)):this.clone();else{var o,s,l,a,r=new XMLHttpRequest,c=this.clone.bind(this);this.reloading=!0,this.xhr=r,r.onabort=c,r.onerror=c,r.ontimeout=c,r.onprogress=function(){r.getResponseHeader("content-type")!==_l&&r.abort()},r.onload=function(){e.read(r.response)},r.onloadend=function(){e.reloading=!1,e.xhr=null},n.checkCrossOrigin&&la(t)&&i.crossOrigin&&(t=aa(t)),r.open("GET",t,!0),r.responseType="arraybuffer",r.withCredentials="use-credentials"===i.crossOrigin,r.send()}else this.clone()}}},{key:"read",value:function(t){var e=this.options,i=this.imageData,n=ha(t),o=0,s=1,l=1;if(n>1){this.url=function(t,e){for(var i=[],n=new Uint8Array(t);n.length>0;)i.push(ba.apply(null,Nl(n.subarray(0,8192)))),n=n.subarray(8192);return"data:".concat(e,";base64,").concat(btoa(i.join("")))}(t,_l);var a=function(t){var e=0,i=1,n=1;switch(t){case 2:i=-1;break;case 3:e=-180;break;case 4:n=-1;break;case 5:e=90,n=-1;break;case 6:e=90;break;case 7:e=90,i=-1;break;case 8:e=-90}return{rotate:e,scaleX:i,scaleY:n}}(n);o=a.rotate,s=a.scaleX,l=a.scaleY}e.rotatable&&(i.rotate=o),e.scalable&&(i.scaleX=s,i.scaleY=l),this.clone()}},{key:"clone",value:function(){var t=this.element,e=this.url,i=t.crossOrigin,n=e;this.options.checkCrossOrigin&&la(e)&&(i||(i="anonymous"),n=aa(e)),this.crossOrigin=i,this.crossOriginUrl=n;var o=document.createElement("img");i&&(o.crossOrigin=i),o.src=n||e,o.alt=t.alt||"The image to crop",this.image=o,o.onload=this.start.bind(this),o.onerror=this.stop.bind(this),Wl(o,il),t.parentNode.insertBefore(o,t.nextSibling)}},{key:"start",value:function(){var t=this,e=this.image;e.onload=null,e.onerror=null,this.sizing=!0;var i=Bs.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(Bs.navigator.userAgent),n=function(e,i){Dl(t.imageData,{naturalWidth:e,naturalHeight:i,aspectRatio:e/i}),t.initialImageData=Dl({},t.imageData),t.sizing=!1,t.sized=!0,t.build()};if(!e.naturalWidth||i){var o=document.createElement("img"),s=document.body||document.documentElement;this.sizingImage=o,o.onload=function(){n(o.width,o.height),i||s.removeChild(o)},o.src=e.src,i||(o.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",s.appendChild(o))}else n(e.naturalWidth,e.naturalHeight)}},{key:"stop",value:function(){var t=this.image;t.onload=null,t.onerror=null,t.parentNode.removeChild(t),this.image=null}},{key:"build",value:function(){if(this.sized&&!this.ready){var t=this.element,e=this.options,i=this.image,n=t.parentNode,o=document.createElement("div");o.innerHTML='<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>';var s=o.querySelector(".".concat(Ds,"-container")),l=s.querySelector(".".concat(Ds,"-canvas")),a=s.querySelector(".".concat(Ds,"-drag-box")),r=s.querySelector(".".concat(Ds,"-crop-box")),c=r.querySelector(".".concat(Ds,"-face"));this.container=n,this.cropper=s,this.canvas=l,this.dragBox=a,this.cropBox=r,this.viewBox=s.querySelector(".".concat(Ds,"-view-box")),this.face=c,l.appendChild(i),Wl(t,el),n.insertBefore(s,t.nextSibling),this.isImg||Gl(i,il),this.initPreview(),this.bind(),e.initialAspectRatio=Math.max(0,e.initialAspectRatio)||NaN,e.aspectRatio=Math.max(0,e.aspectRatio)||NaN,e.viewMode=Math.max(0,Math.min(3,Math.round(e.viewMode)))||0,Wl(r,el),e.guides||Wl(r.getElementsByClassName("".concat(Ds,"-dashed")),el),e.center||Wl(r.getElementsByClassName("".concat(Ds,"-center")),el),e.background&&Wl(s,"".concat(Ds,"-bg")),e.highlight||Wl(c,nl),e.cropBoxMovable&&(Wl(c,sl),Zl(c,ll,js)),e.cropBoxResizable||(Wl(r.getElementsByClassName("".concat(Ds,"-line")),el),Wl(r.getElementsByClassName("".concat(Ds,"-point")),el)),this.render(),this.ready=!0,this.setDragMode(e.dragMode),e.autoCrop&&this.crop(),this.setData(e.data),$l(e.ready)&&ea(t,yl,e.ready,{once:!0}),ia(t,yl)}}},{key:"unbuild",value:function(){this.ready&&(this.ready=!1,this.unbind(),this.resetPreview(),this.cropper.parentNode.removeChild(this.cropper),Gl(this.element,el))}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],n=[{key:"noConflict",value:function(){return window.Cropper=wa,t}},{key:"setDefaults",value:function(t){Dl(El,Il(t)&&t)}}],i&&zs(e.prototype,i),n&&zs(e,n),t}();function _a(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];return e.map((function(e){return e.split(" ").map((function(e){return e?""+t+e:""})).join(" ")})).join(" ")}function ka(t,e){return function(i){i&&(t[e]=i)}}function Ca(t,e,i){return function(n){n&&(t[e][i]=n)}}function La(t,e){return function(i){var n=i.prototype;t.forEach((function(t){e(n,t)}))}}function Aa(t,e){return void 0===e&&(e={}),function(i,n){t.forEach((function(t){var o=e[t]||t;o in i||(i[o]=function(){for(var e,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];var s=(e=this[n])[t].apply(e,i);return s===this[n]?this:s})}))}}Dl(Sa.prototype,ma,ga,fa,va,ya,xa);var Ea=function(){function t(){this.keys=[],this.values=[]}var e=t.prototype;return e.get=function(t){return this.values[this.keys.indexOf(t)]},e.set=function(t,e){var i=this.keys,n=this.values,o=i.indexOf(t),s=-1===o?i.length:o;i[s]=t,n[s]=e},t}(),qa=function(){function t(){this.object={}}var e=t.prototype;return e.get=function(t){return this.object[t]},e.set=function(t,e){this.object[t]=e},t}(),Ta="function"==typeof Map,Ma=function(){function t(){}var e=t.prototype;return e.connect=function(t,e){this.prev=t,this.next=e,t&&(t.next=this),e&&(e.prev=this)},e.disconnect=function(){var t=this.prev,e=this.next;t&&(t.next=e),e&&(e.prev=t)},e.getIndex=function(){for(var t=this,e=-1;t;)t=t.prev,++e;return e},t}();var za=function(){function t(t,e,i,n,o,s,l,a){this.prevList=t,this.list=e,this.added=i,this.removed=n,this.changed=o,this.maintained=s,this.changedBeforeAdded=l,this.fixed=a}var e=t.prototype;return Object.defineProperty(e,"ordered",{get:function(){return this.cacheOrdered||this.caculateOrdered(),this.cacheOrdered},enumerable:!0,configurable:!0}),Object.defineProperty(e,"pureChanged",{get:function(){return this.cachePureChanged||this.caculateOrdered(),this.cachePureChanged},enumerable:!0,configurable:!0}),e.caculateOrdered=function(){var t=function(t,e){var i=[],n=[];return t.forEach((function(t){var e=t[0],o=t[1],s=new Ma;i[e]=s,n[o]=s})),i.forEach((function(t,e){t.connect(i[e-1])})),t.filter((function(t,i){return!e[i]})).map((function(t,e){var o=t[0],s=t[1];if(o===s)return[0,0];var l=i[o],a=n[s-1],r=l.getIndex();return l.disconnect(),a?l.connect(a,a.next):l.connect(void 0,i[0]),[r,l.getIndex()]}))}(this.changedBeforeAdded,this.fixed),e=this.changed,i=[];this.cacheOrdered=t.filter((function(t,n){var o=t[0],s=t[1],l=e[n],a=l[0],r=l[1];if(o!==s)return i.push([a,r]),!0})),this.cachePureChanged=i},t}();function Oa(t,e,i){var n=Ta?Map:i?qa:Ea,o=i||function(t){return t},s=[],l=[],a=[],r=t.map(o),c=e.map(o),u=new n,d=new n,b=[],p=[],h={},m=[],g=0,f=0;return r.forEach((function(t,e){u.set(t,e)})),c.forEach((function(t,e){d.set(t,e)})),r.forEach((function(t,e){var i=d.get(t);void 0===i?(++f,l.push(e)):h[i]=f})),c.forEach((function(t,e){var i=u.get(t);void 0===i?(s.push(e),++g):(a.push([i,e]),f=h[e]||0,b.push([i-f,e-g]),p.push(e===i),i!==e&&m.push([i,e]))})),l.reverse(),new za(t,e,s,l,m,a,b,p)}var Ra=function(){function t(t,e){void 0===t&&(t=[]),this.findKeyCallback=e,this.list=[].slice.call(t)}return t.prototype.update=function(t){var e=[].slice.call(t),i=Oa(this.list,e,this.findKeyCallback);return this.list=e,i},t}(),Ia="undefined",$a=typeof window!==Ia,Ba=[{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:'\\"',close:'\\"'},{open:"\\'",close:"\\'"}],Na=1e-7,Pa={cm:function(t){return 96*t/2.54},mm:function(t){return 96*t/254},in:function(t){return 96*t},pt:function(t){return 96*t/72},pc:function(t){return 96*t/6},"%":function(t,e){return t*e/100},vw:function(t,e){return void 0===e&&(e=window.innerWidth),t/100*e},vh:function(t,e){return void 0===e&&(e=window.innerHeight),t/100*e},vmax:function(t,e){return void 0===e&&(e=Math.max(window.innerWidth,window.innerHeight)),t/100*e},vmin:function(t,e){return void 0===e&&(e=Math.min(window.innerWidth,window.innerHeight)),t/100*e}};function Da(t){return typeof t===Ia}function ja(t){return t&&"object"==typeof t}function Ha(t){return Array.isArray(t)}function Fa(t){return"string"==typeof t}function Ua(t){return"number"==typeof t}function Wa(t){return"function"==typeof t}function Ga(t,e,i,n,o){return Ya(t,e,i)?i:function(t,e,i,n,o){for(var s,l=function(i){var l=e[i].trim();if(l===t.close&&!Ya(t,e,i))return{value:i};var a=i,r=ir(o,(function(t){return t.open===l}));if(r&&(a=Ga(r,e,i,n,o)),-1===a)return s=i,"break";s=i=a},a=i;a<n;++a){var r=l(a);if(a=s,"object"==typeof r)return r.value;if("break"===r)break}return-1}(t,e,i+1,n,o)}function Ya(t,e,i){if(!t.ignore)return null;var n=e.slice(Math.max(i-3,0),i+3).join("");return new RegExp(t.ignore).exec(n)}function Xa(t,e){var i=Fa(e)?{separator:e}:e,n=i.separator,o=void 0===n?",":n,s=i.isSeparateFirst,l=i.isSeparateOnlyOpenClose,a=i.isSeparateOpenClose,r=void 0===a?l:a,c=i.openCloseCharacters,u=void 0===c?Ba:c,d=u.map((function(t){var e=t.open,i=t.close;return e===i?e:e+"|"+i})).join("|"),b=new RegExp("(\\s*"+o+"\\s*|"+d+"|\\s+)","g"),p=t.split(b).filter(Boolean),h=p.length,m=[],g=[];function f(){return!!g.length&&(m.push(g.join("")),g=[],!0)}for(var v,y=function(t){var e=p[t].trim(),i=t,n=ir(u,(function(t){return t.open===e})),a=ir(u,(function(t){return t.close===e}));if(n){if(-1!==(i=Ga(n,p,t,h,u))&&r)return f()&&s?(v=t,"break"):(m.push(p.slice(t,i+1).join("")),t=i,s?(v=t,"break"):(v=t,"continue"))}else{if(a&&!Ya(a,p,t))throw new Error("invalid format: "+a.close);if(function(t,e){return(""===e||" "==e)&&(""===t||" "==t)||t===e}(e,o)&&!l)return f(),s?(v=t,"break"):(v=t,"continue")}-1===i&&(i=h-1),g.push(p.slice(t,i+1).join("")),v=t=i},x=0;x<h;++x){var w=y(x);if(x=v,"break"===w)break}return g.length&&m.push(g.join("")),m}function Va(t){return Xa(t,"")}function Ka(t){return Xa(t,",")}function Za(t){var e=/([^(]*)\(([\s\S]*)\)([\s\S]*)/g.exec(t);return!e||e.length<4?{}:{prefix:e[1],value:e[2],suffix:e[3]}}function Qa(t){var e=/^([^\d|e|\-|\+]*)((?:\d|\.|-|e-|e\+)+)(\S*)$/g.exec(t);if(!e)return{prefix:"",unit:"",value:NaN};var i=e[1],n=e[2];return{prefix:i,unit:e[3],value:parseFloat(n)}}function Ja(t,e){return void 0===e&&(e="-"),t.replace(/([a-z])([A-Z])/g,(function(t,i,n){return""+i+e+n.toLowerCase()}))}function tr(){return Date.now?Date.now():(new Date).getTime()}function er(t,e,i){void 0===i&&(i=-1);for(var n=t.length,o=0;o<n;++o)if(e(t[o],o,t))return o;return i}function ir(t,e,i){var n=er(t,e);return n>-1?t[n]:i}var nr=function(){var t=tr(),e=$a&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame);return e?e.bind(window):function(e){var i=tr();return window.setTimeout((function(){e(i-t)}),1e3/60)}}(),or=function(){var t=$a&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame);return t?t.bind(window):function(t){clearTimeout(t)}}();function sr(t){if(Object.keys)return Object.keys(t);var e=[];for(var i in e)e.push(i);return e}function lr(t,e){var i=Qa(t),n=i.value,o=i.unit;if(ja(e)){var s=e[o];if(s){if(Wa(s))return s(n);if(Pa[o])return Pa[o](n,s)}}else if("%"===o)return n*e/100;return Pa[o]?Pa[o](n):n}function ar(t,e,i,n){return void 0===n&&(n=t[0]/t[1]),[[pr(e[0],Na),pr(e[0]/n,Na)],[pr(e[1]*n,Na),pr(e[1],Na)]].filter((function(t){return t.every((function(t,n){var o=e[n],s=pr(o,Na);return i?t<=o||t<=s:t>=o||t>=s}))}))[0]||t}function rr(t,e,i,n){if(!n)return t.map((function(t,n){return function(t,e,i){return Math.max(e,Math.min(t,i))}(t,e[n],i[n])}));var o=t[0],s=t[1],l=!0===n?o/s:n,a=ar(t,e,!1,l),r=a[0],c=a[1],u=ar(t,i,!0,l),d=u[0],b=u[1];return o<r||s<c?(o=r,s=c):(o>d||s>b)&&(o=d,s=b),[o,s]}function cr(t){for(var e=t.length,i=0,n=e-1;n>=0;--n)i+=t[n];return e?i/e:0}function ur(t,e){var i=e[0]-t[0],n=e[1]-t[1],o=Math.atan2(n,i);return o>=0?o:o+2*Math.PI}function dr(t){var e=function(t){return[0,1].map((function(e){return cr(t.map((function(t){return t[e]})))}))}(t),i=ur(e,t[0]),n=ur(e,t[1]);return i<n&&n-i<Math.PI||i>n&&n-i<-Math.PI?1:-1}function br(t,e){return Math.sqrt(Math.pow((e?e[0]:0)-t[0],2)+Math.pow((e?e[1]:0)-t[1],2))}function pr(t,e){if(!e)return t;var i=1/e;return Math.round(t/e)/i}function hr(t,e){return t.forEach((function(i,n){t[n]=pr(t[n],e)})),t}function mr(t,e){return t.classList?t.classList.contains(e):!!t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))}function gr(t,e,i,n){t.addEventListener(e,i,n)}function fr(t,e,i,n){t.removeEventListener(e,i,n)}
41
+ */(t)}},!1));const b=document.querySelector(".is-design-list");let p=t.opts.snippetPath,h=t.opts.snippetJSON.snippets,m=t.opts.slider;if(null!=m)if("slick"===m){const e=t=>"glide"!==t.type;t.opts.snippetJSON.snippets=h.filter(e)}else if("glide"===m){const e=t=>"slick"!==t.type;t.opts.snippetJSON.snippets=h.filter(e)}else if("all"===m);else{const e=t=>"glide"!==t.type&&"slick"!==t.type;t.opts.snippetJSON.snippets=h.filter(e)}else{var g=!0;if(t.win.jQuery&&t.win.jQuery.fn.slick&&(g=!1),g){const t=h.filter((t=>"slick"!==t.type));h=[...t]}if(!t.win.Glide){const t=h.filter((t=>!(t.glide||"glide"===t.type)));h=[...t]}t.opts.snippetJSON.snippets=[...h]}let f,v,y=1;if(t.opts.emailMode?t.opts.snippetJSON.snippets.forEach((e=>{e.id=y,e.category===t.opts.defaultEmailSnippetCategory+""&&o.appendHtml(b,'<div class="snippet-item" data-id="'+e.id+'" data-cat="'+e.category+'"><img alt="'+i.out("Snippet")+'" src="'+p+e.thumbnail+'"><span class="is-overlay"></span></div>'),y++})):t.opts.snippetJSON.snippets.forEach((e=>{e.id=y,e.category===t.opts.defaultSnippetCategory+""&&o.appendHtml(b,'<div class="snippet-item" data-id="'+e.id+'" data-cat="'+e.category+'"><img alt="'+i.out("Snippet")+'" src="'+p+e.thumbnail+'"><span class="is-overlay"></span></div>'),y++})),new os(b,{group:{name:"shared",pull:"clone",put:!1},sort:!1,animation:150,onChoose:e=>{const i='\n <style id="css-scale">\n .sortable-ghost {\n height: 50px;\n }\n .sortable-ghost * {\n display: none\n }\n </style>\n ';if(v=e.item.offsetHeight,t.iframe){const e=t.contentStuff.querySelector("#css-scale");e&&e.parentNode.removeChild(e),t.contentStuff.insertAdjacentHTML("afterbegin",i)}else{const e=t.builderStuff.querySelector("#css-scale");e&&e.parentNode.removeChild(e),t.builderStuff.insertAdjacentHTML("afterbegin",i)}t.uo.saveForUndo(!0),t.sectionDropSetup(),t.util.clearPops(),t.hideElementTools()},onClone:t=>{var e=t.clone;let i=e.querySelector("img");i.style.opacity=1e-4,e.style.height=v+"px";let n=(new Date).getTime();i.src=i.src+"?"+n,i.style.opacity=""},onMove:()=>{let e=t.doc.querySelector(".row-add-initial");if(e&&(e.style.display="none"),t.page&&".is-wrapper"===t.page){const e=t.doc.querySelector(t.page);e&&(e.style.marginLeft="")}},onSort:e=>{if(!t.canvas)return;let i=e.originalEvent.clientX,n=e.originalEvent.clientY;const o=t.doc.querySelector("[data-new-dummy]");if(o){const t=o.parentNode,e=t.getBoundingClientRect();o.offsetWidth;let s=(i-o.offsetWidth/2-e.left)/t.offsetWidth*100,l=(n-o.offsetHeight/2-e.top)/t.offsetHeight*100;o.style.top=l+"%",o.style.left=s+"%",o.removeAttribute("data-new-dummy")}},onStart:()=>{f=null;const e=t.doc.querySelector(".builder-active");e&&(f=e,o.removeClass(f,"builder-active"));let i=document.querySelector(".is-sidebar-overlay");i&&(i.style.display="none")},onEnd:()=>{let e=document.querySelector(".is-sidebar-overlay");e&&(e.style.display="block"),i.checkEmpty();let n=t.doc.querySelector(".row-add-initial");n&&(n.style.display=""),f&&o.addClass(f,"builder-active")},onUnchoose:()=>{setTimeout((()=>{if(t.sortableOnCanvas&&(t.sortableOnCanvas.forEach((t=>{t&&t.destroy()})),t.sortableOnCanvas=[]),t.sortableOnPage&&(t.sortableOnPage.destroy(),t.sortableOnPage=null),t.doc.querySelectorAll(".block-dummy").forEach((t=>t.parentNode.removeChild(t))),t.page&&".is-wrapper"===t.page){const e=t.doc.querySelector(t.page);e&&(e.style.marginLeft="")}}),10)}}),"#divSnippetList"===t.opts.snippetList){const n=c.querySelector("#divSnippetHandle");o.addEventListener(n,"click",(()=>{As(t),i.clearActiveCell(),i.clearControls()}));const s=window.innerWidth;(t.opts.snippetOpen||e)&&s>=960&&(c.style.cssText="transition: all ease 0.8s;",setTimeout((function(){As(t)}),100),setTimeout((function(){c.style.cssText=""}),1300))}let x=c.querySelector("#divSnippetScrollUp"),w=c.querySelector("#divSnippetScrollDown");x.style.display="none",w.style.display="none"};function As(t){const e=t.dom;let i=document.querySelector("#divSnippetList");const n=i.querySelector("#divSnippetHandle");e.hasClass(i,"active")?(e.removeClass(i,"active"),"right"===t.opts.sidePanel?n.innerHTML='<svg class="is-icon-flex" style="width:17px;height:17px;"><use xlink:href="#ion-ios-arrow-left"></use></svg>':n.innerHTML='<svg class="is-icon-flex" style="width:17px;height:17px;"><use xlink:href="#ion-ios-arrow-right"></use></svg>',setTimeout((()=>{i.querySelector(".is-design-list").style.display="none"}),300)):(i.querySelector(".is-design-list").style.display="block",setTimeout((()=>{e.addClass(i,"active"),"right"===t.opts.sidePanel?n.innerHTML='<svg class="is-icon-flex" style="width:17px;height:17px;"><use xlink:href="#ion-ios-arrow-right"></use></svg>':n.innerHTML='<svg class="is-icon-flex" style="width:17px;height:17px;"><use xlink:href="#ion-ios-arrow-left"></use></svg>'}),10))}function Es(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function qs(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Es(Object(i),!0).forEach((function(e){Os(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Es(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function Ts(t){return Ts="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ts(t)}function Ms(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function zs(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Os(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function Rs(t){return function(t){if(Array.isArray(t))return Is(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Is(t,e);var i=Object.prototype.toString.call(t).slice(8,-1);"Object"===i&&t.constructor&&(i=t.constructor.name);if("Map"===i||"Set"===i)return Array.from(t);if("Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i))return Is(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Is(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,n=new Array(e);i<e;i++)n[i]=t[i];return n}var $s="undefined"!=typeof window&&void 0!==window.document,Bs=$s?window:{},Ns=!(!$s||!Bs.document.documentElement)&&"ontouchstart"in Bs.document.documentElement,Ps=!!$s&&"PointerEvent"in Bs,Ds="cropper",js="all",Hs="crop",Fs="move",Us="zoom",Ws="e",Gs="w",Ys="s",Xs="n",Vs="ne",Ks="nw",Zs="se",Qs="sw",Js="".concat(Ds,"-crop"),tl="".concat(Ds,"-disabled"),el="".concat(Ds,"-hidden"),il="".concat(Ds,"-hide"),nl="".concat(Ds,"-invisible"),ol="".concat(Ds,"-modal"),sl="".concat(Ds,"-move"),ll="".concat(Ds,"Action"),al="".concat(Ds,"Preview"),rl="crop",cl="move",ul="none",dl="crop",bl="cropend",pl="cropmove",hl="cropstart",ml="dblclick",gl=Ps?"pointerdown":Ns?"touchstart":"mousedown",fl=Ps?"pointermove":Ns?"touchmove":"mousemove",vl=Ps?"pointerup pointercancel":Ns?"touchend touchcancel":"mouseup",yl="ready",xl="resize",wl="wheel",Sl="zoom",_l="image/jpeg",kl=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,Cl=/^data:/,Ll=/^data:image\/jpeg;base64,/,Al=/^img|canvas$/i,El={viewMode:0,dragMode:rl,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:200,minContainerHeight:100,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},ql=Number.isNaN||Bs.isNaN;function Tl(t){return"number"==typeof t&&!ql(t)}var Ml=function(t){return t>0&&t<1/0};function zl(t){return void 0===t}function Ol(t){return"object"===Ts(t)&&null!==t}var Rl=Object.prototype.hasOwnProperty;function Il(t){if(!Ol(t))return!1;try{var e=t.constructor,i=e.prototype;return e&&i&&Rl.call(i,"isPrototypeOf")}catch(t){return!1}}function $l(t){return"function"==typeof t}var Bl=Array.prototype.slice;function Nl(t){return Array.from?Array.from(t):Bl.call(t)}function Pl(t,e){return t&&$l(e)&&(Array.isArray(t)||Tl(t.length)?Nl(t).forEach((function(i,n){e.call(t,i,n,t)})):Ol(t)&&Object.keys(t).forEach((function(i){e.call(t,t[i],i,t)}))),t}var Dl=Object.assign||function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return Ol(t)&&i.length>0&&i.forEach((function(e){Ol(e)&&Object.keys(e).forEach((function(i){t[i]=e[i]}))})),t},jl=/\.\d*(?:0|9){12}\d*$/;function Hl(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return jl.test(t)?Math.round(t*e)/e:t}var Fl=/^width|height|left|top|marginLeft|marginTop$/;function Ul(t,e){var i=t.style;Pl(e,(function(t,e){Fl.test(e)&&Tl(t)&&(t="".concat(t,"px")),i[e]=t}))}function Wl(t,e){if(e)if(Tl(t.length))Pl(t,(function(t){Wl(t,e)}));else if(t.classList)t.classList.add(e);else{var i=t.className.trim();i?i.indexOf(e)<0&&(t.className="".concat(i," ").concat(e)):t.className=e}}function Gl(t,e){e&&(Tl(t.length)?Pl(t,(function(t){Gl(t,e)})):t.classList?t.classList.remove(e):t.className.indexOf(e)>=0&&(t.className=t.className.replace(e,"")))}function Yl(t,e,i){e&&(Tl(t.length)?Pl(t,(function(t){Yl(t,e,i)})):i?Wl(t,e):Gl(t,e))}var Xl=/([a-z\d])([A-Z])/g;function Vl(t){return t.replace(Xl,"$1-$2").toLowerCase()}function Kl(t,e){return Ol(t[e])?t[e]:t.dataset?t.dataset[e]:t.getAttribute("data-".concat(Vl(e)))}function Zl(t,e,i){Ol(i)?t[e]=i:t.dataset?t.dataset[e]=i:t.setAttribute("data-".concat(Vl(e)),i)}var Ql=/\s\s*/,Jl=function(){var t=!1;if($s){var e=!1,i=function(){},n=Object.defineProperty({},"once",{get:function(){return t=!0,e},set:function(t){e=t}});Bs.addEventListener("test",i,n),Bs.removeEventListener("test",i,n)}return t}();function ta(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i;e.trim().split(Ql).forEach((function(e){if(!Jl){var s=t.listeners;s&&s[e]&&s[e][i]&&(o=s[e][i],delete s[e][i],0===Object.keys(s[e]).length&&delete s[e],0===Object.keys(s).length&&delete t.listeners)}t.removeEventListener(e,o,n)}))}function ea(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i;e.trim().split(Ql).forEach((function(e){if(n.once&&!Jl){var s=t.listeners,l=void 0===s?{}:s;o=function(){delete l[e][i],t.removeEventListener(e,o,n);for(var s=arguments.length,a=new Array(s),r=0;r<s;r++)a[r]=arguments[r];i.apply(t,a)},l[e]||(l[e]={}),l[e][i]&&t.removeEventListener(e,l[e][i],n),l[e][i]=o,t.listeners=l}t.addEventListener(e,o,n)}))}function ia(t,e,i){var n;return $l(Event)&&$l(CustomEvent)?n=new CustomEvent(e,{detail:i,bubbles:!0,cancelable:!0}):(n=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,i),t.dispatchEvent(n)}function na(t){var e=t.getBoundingClientRect();return{left:e.left+(window.pageXOffset-document.documentElement.clientLeft),top:e.top+(window.pageYOffset-document.documentElement.clientTop)}}var oa=Bs.location,sa=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function la(t){var e=t.match(sa);return null!==e&&(e[1]!==oa.protocol||e[2]!==oa.hostname||e[3]!==oa.port)}function aa(t){var e="timestamp=".concat((new Date).getTime());return t+(-1===t.indexOf("?")?"?":"&")+e}function ra(t){var e=t.rotate,i=t.scaleX,n=t.scaleY,o=t.translateX,s=t.translateY,l=[];Tl(o)&&0!==o&&l.push("translateX(".concat(o,"px)")),Tl(s)&&0!==s&&l.push("translateY(".concat(s,"px)")),Tl(e)&&0!==e&&l.push("rotate(".concat(e,"deg)")),Tl(i)&&1!==i&&l.push("scaleX(".concat(i,")")),Tl(n)&&1!==n&&l.push("scaleY(".concat(n,")"));var a=l.length?l.join(" "):"none";return{WebkitTransform:a,msTransform:a,transform:a}}function ca(t,e){var i=t.pageX,n=t.pageY,o={endX:i,endY:n};return e?o:qs({startX:i,startY:n},o)}function ua(t){var e=t.aspectRatio,i=t.height,n=t.width,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"contain",s=Ml(n),l=Ml(i);if(s&&l){var a=i*e;"contain"===o&&a>n||"cover"===o&&a<n?i=n/e:n=i*e}else s?i=n/e:l&&(n=i*e);return{width:n,height:i}}function da(t,e,i,n){var o=e.aspectRatio,s=e.naturalWidth,l=e.naturalHeight,a=e.rotate,r=void 0===a?0:a,c=e.scaleX,u=void 0===c?1:c,d=e.scaleY,b=void 0===d?1:d,p=i.aspectRatio,h=i.naturalWidth,m=i.naturalHeight,g=n.fillColor,f=void 0===g?"transparent":g,v=n.imageSmoothingEnabled,y=void 0===v||v,x=n.imageSmoothingQuality,w=void 0===x?"low":x,S=n.maxWidth,_=void 0===S?1/0:S,k=n.maxHeight,C=void 0===k?1/0:k,L=n.minWidth,A=void 0===L?0:L,E=n.minHeight,q=void 0===E?0:E,T=document.createElement("canvas"),M=T.getContext("2d"),z=ua({aspectRatio:p,width:_,height:C}),O=ua({aspectRatio:p,width:A,height:q},"cover"),R=Math.min(z.width,Math.max(O.width,h)),I=Math.min(z.height,Math.max(O.height,m)),$=ua({aspectRatio:o,width:_,height:C}),B=ua({aspectRatio:o,width:A,height:q},"cover"),N=Math.min($.width,Math.max(B.width,s)),P=Math.min($.height,Math.max(B.height,l)),D=[-N/2,-P/2,N,P];return T.width=Hl(R),T.height=Hl(I),M.fillStyle=f,M.fillRect(0,0,R,I),M.save(),M.translate(R/2,I/2),M.rotate(r*Math.PI/180),M.scale(u,b),M.imageSmoothingEnabled=y,M.imageSmoothingQuality=w,M.drawImage.apply(M,[t].concat(Rs(D.map((function(t){return Math.floor(Hl(t))}))))),M.restore(),T}var ba=String.fromCharCode;var pa=/^data:.*,/;function ha(t){var e,i=new DataView(t);try{var n,o,s;if(255===i.getUint8(0)&&216===i.getUint8(1))for(var l=i.byteLength,a=2;a+1<l;){if(255===i.getUint8(a)&&225===i.getUint8(a+1)){o=a;break}a+=1}if(o){var r=o+10;if("Exif"===function(t,e,i){var n="";i+=e;for(var o=e;o<i;o+=1)n+=ba(t.getUint8(o));return n}(i,o+4,4)){var c=i.getUint16(r);if(((n=18761===c)||19789===c)&&42===i.getUint16(r+2,n)){var u=i.getUint32(r+4,n);u>=8&&(s=r+u)}}}if(s){var d,b,p=i.getUint16(s,n);for(b=0;b<p;b+=1)if(d=s+12*b+2,274===i.getUint16(d,n)){d+=8,e=i.getUint16(d,n),i.setUint16(d,1,n);break}}}catch(t){e=1}return e}var ma={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var t=this.element,e=this.options,i=this.container,n=this.cropper,o=Number(e.minContainerWidth),s=Number(e.minContainerHeight);Wl(n,el),Gl(t,el);var l={width:Math.max(i.offsetWidth,o>=0?o:200),height:Math.max(i.offsetHeight,s>=0?s:100)};this.containerData=l,Ul(n,{width:l.width,height:l.height}),Wl(t,el),Gl(n,el)},initCanvas:function(){var t=this.containerData,e=this.imageData,i=this.options.viewMode,n=Math.abs(e.rotate)%180==90,o=n?e.naturalHeight:e.naturalWidth,s=n?e.naturalWidth:e.naturalHeight,l=o/s,a=t.width,r=t.height;t.height*l>t.width?3===i?a=t.height*l:r=t.width/l:3===i?r=t.width/l:a=t.height*l;var c={aspectRatio:l,naturalWidth:o,naturalHeight:s,width:a,height:r};this.canvasData=c,this.limited=1===i||2===i,this.limitCanvas(!0,!0),c.width=Math.min(Math.max(c.width,c.minWidth),c.maxWidth),c.height=Math.min(Math.max(c.height,c.minHeight),c.maxHeight),c.left=(t.width-c.width)/2,c.top=(t.height-c.height)/2,c.oldLeft=c.left,c.oldTop=c.top,this.initialCanvasData=Dl({},c)},limitCanvas:function(t,e){var i=this.options,n=this.containerData,o=this.canvasData,s=this.cropBoxData,l=i.viewMode,a=o.aspectRatio,r=this.cropped&&s;if(t){var c=Number(i.minCanvasWidth)||0,u=Number(i.minCanvasHeight)||0;l>1?(c=Math.max(c,n.width),u=Math.max(u,n.height),3===l&&(u*a>c?c=u*a:u=c/a)):l>0&&(c?c=Math.max(c,r?s.width:0):u?u=Math.max(u,r?s.height:0):r&&(c=s.width,(u=s.height)*a>c?c=u*a:u=c/a));var d=ua({aspectRatio:a,width:c,height:u});c=d.width,u=d.height,o.minWidth=c,o.minHeight=u,o.maxWidth=1/0,o.maxHeight=1/0}if(e)if(l>(r?0:1)){var b=n.width-o.width,p=n.height-o.height;o.minLeft=Math.min(0,b),o.minTop=Math.min(0,p),o.maxLeft=Math.max(0,b),o.maxTop=Math.max(0,p),r&&this.limited&&(o.minLeft=Math.min(s.left,s.left+(s.width-o.width)),o.minTop=Math.min(s.top,s.top+(s.height-o.height)),o.maxLeft=s.left,o.maxTop=s.top,2===l&&(o.width>=n.width&&(o.minLeft=Math.min(0,b),o.maxLeft=Math.max(0,b)),o.height>=n.height&&(o.minTop=Math.min(0,p),o.maxTop=Math.max(0,p))))}else o.minLeft=-o.width,o.minTop=-o.height,o.maxLeft=n.width,o.maxTop=n.height},renderCanvas:function(t,e){var i=this.canvasData,n=this.imageData;if(e){var o=function(t){var e=t.width,i=t.height,n=t.degree;if(90==(n=Math.abs(n)%180))return{width:i,height:e};var o=n%90*Math.PI/180,s=Math.sin(o),l=Math.cos(o),a=e*l+i*s,r=e*s+i*l;return n>90?{width:r,height:a}:{width:a,height:r}}({width:n.naturalWidth*Math.abs(n.scaleX||1),height:n.naturalHeight*Math.abs(n.scaleY||1),degree:n.rotate||0}),s=o.width,l=o.height,a=i.width*(s/i.naturalWidth),r=i.height*(l/i.naturalHeight);i.left-=(a-i.width)/2,i.top-=(r-i.height)/2,i.width=a,i.height=r,i.aspectRatio=s/l,i.naturalWidth=s,i.naturalHeight=l,this.limitCanvas(!0,!1)}(i.width>i.maxWidth||i.width<i.minWidth)&&(i.left=i.oldLeft),(i.height>i.maxHeight||i.height<i.minHeight)&&(i.top=i.oldTop),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),this.limitCanvas(!1,!0),i.left=Math.min(Math.max(i.left,i.minLeft),i.maxLeft),i.top=Math.min(Math.max(i.top,i.minTop),i.maxTop),i.oldLeft=i.left,i.oldTop=i.top,Ul(this.canvas,Dl({width:i.width,height:i.height},ra({translateX:i.left,translateY:i.top}))),this.renderImage(t),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(t){var e=this.canvasData,i=this.imageData,n=i.naturalWidth*(e.width/e.naturalWidth),o=i.naturalHeight*(e.height/e.naturalHeight);Dl(i,{width:n,height:o,left:(e.width-n)/2,top:(e.height-o)/2}),Ul(this.image,Dl({width:i.width,height:i.height},ra(Dl({translateX:i.left,translateY:i.top},i)))),t&&this.output()},initCropBox:function(){var t=this.options,e=this.canvasData,i=t.aspectRatio||t.initialAspectRatio,n=Number(t.autoCropArea)||.8,o={width:e.width,height:e.height};i&&(e.height*i>e.width?o.height=o.width/i:o.width=o.height*i),this.cropBoxData=o,this.limitCropBox(!0,!0),o.width=Math.min(Math.max(o.width,o.minWidth),o.maxWidth),o.height=Math.min(Math.max(o.height,o.minHeight),o.maxHeight),o.width=Math.max(o.minWidth,o.width*n),o.height=Math.max(o.minHeight,o.height*n),o.left=e.left+(e.width-o.width)/2,o.top=e.top+(e.height-o.height)/2,o.oldLeft=o.left,o.oldTop=o.top,this.initialCropBoxData=Dl({},o)},limitCropBox:function(t,e){var i=this.options,n=this.containerData,o=this.canvasData,s=this.cropBoxData,l=this.limited,a=i.aspectRatio;if(t){var r=Number(i.minCropBoxWidth)||0,c=Number(i.minCropBoxHeight)||0,u=l?Math.min(n.width,o.width,o.width+o.left,n.width-o.left):n.width,d=l?Math.min(n.height,o.height,o.height+o.top,n.height-o.top):n.height;r=Math.min(r,n.width),c=Math.min(c,n.height),a&&(r&&c?c*a>r?c=r/a:r=c*a:r?c=r/a:c&&(r=c*a),d*a>u?d=u/a:u=d*a),s.minWidth=Math.min(r,u),s.minHeight=Math.min(c,d),s.maxWidth=u,s.maxHeight=d}e&&(l?(s.minLeft=Math.max(0,o.left),s.minTop=Math.max(0,o.top),s.maxLeft=Math.min(n.width,o.left+o.width)-s.width,s.maxTop=Math.min(n.height,o.top+o.height)-s.height):(s.minLeft=0,s.minTop=0,s.maxLeft=n.width-s.width,s.maxTop=n.height-s.height))},renderCropBox:function(){var t=this.options,e=this.containerData,i=this.cropBoxData;(i.width>i.maxWidth||i.width<i.minWidth)&&(i.left=i.oldLeft),(i.height>i.maxHeight||i.height<i.minHeight)&&(i.top=i.oldTop),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),this.limitCropBox(!1,!0),i.left=Math.min(Math.max(i.left,i.minLeft),i.maxLeft),i.top=Math.min(Math.max(i.top,i.minTop),i.maxTop),i.oldLeft=i.left,i.oldTop=i.top,t.movable&&t.cropBoxMovable&&Zl(this.face,ll,i.width>=e.width&&i.height>=e.height?Fs:js),Ul(this.cropBox,Dl({width:i.width,height:i.height},ra({translateX:i.left,translateY:i.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),ia(this.element,dl,this.getData())}},ga={initPreview:function(){var t=this.element,e=this.crossOrigin,i=this.options.preview,n=e?this.crossOriginUrl:this.url,o=t.alt||"The image to preview",s=document.createElement("img");if(e&&(s.crossOrigin=e),s.src=n,s.alt=o,this.viewBox.appendChild(s),this.viewBoxImage=s,i){var l=i;"string"==typeof i?l=t.ownerDocument.querySelectorAll(i):i.querySelector&&(l=[i]),this.previews=l,Pl(l,(function(t){var i=document.createElement("img");Zl(t,al,{width:t.offsetWidth,height:t.offsetHeight,html:t.innerHTML}),e&&(i.crossOrigin=e),i.src=n,i.alt=o,i.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',t.innerHTML="",t.appendChild(i)}))}},resetPreview:function(){Pl(this.previews,(function(t){var e=Kl(t,al);Ul(t,{width:e.width,height:e.height}),t.innerHTML=e.html,function(t,e){if(Ol(t[e]))try{delete t[e]}catch(i){t[e]=void 0}else if(t.dataset)try{delete t.dataset[e]}catch(i){t.dataset[e]=void 0}else t.removeAttribute("data-".concat(Vl(e)))}(t,al)}))},preview:function(){var t=this.imageData,e=this.canvasData,i=this.cropBoxData,n=i.width,o=i.height,s=t.width,l=t.height,a=i.left-e.left-t.left,r=i.top-e.top-t.top;this.cropped&&!this.disabled&&(Ul(this.viewBoxImage,Dl({width:s,height:l},ra(Dl({translateX:-a,translateY:-r},t)))),Pl(this.previews,(function(e){var i=Kl(e,al),c=i.width,u=i.height,d=c,b=u,p=1;n&&(b=o*(p=c/n)),o&&b>u&&(d=n*(p=u/o),b=u),Ul(e,{width:d,height:b}),Ul(e.getElementsByTagName("img")[0],Dl({width:s*p,height:l*p},ra(Dl({translateX:-a*p,translateY:-r*p},t))))})))}},fa={bind:function(){var t=this.element,e=this.options,i=this.cropper;$l(e.cropstart)&&ea(t,hl,e.cropstart),$l(e.cropmove)&&ea(t,pl,e.cropmove),$l(e.cropend)&&ea(t,bl,e.cropend),$l(e.crop)&&ea(t,dl,e.crop),$l(e.zoom)&&ea(t,Sl,e.zoom),ea(i,gl,this.onCropStart=this.cropStart.bind(this)),e.zoomable&&e.zoomOnWheel&&ea(i,wl,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&ea(i,ml,this.onDblclick=this.dblclick.bind(this)),ea(t.ownerDocument,fl,this.onCropMove=this.cropMove.bind(this)),ea(t.ownerDocument,vl,this.onCropEnd=this.cropEnd.bind(this)),e.responsive&&ea(window,xl,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,e=this.options,i=this.cropper;$l(e.cropstart)&&ta(t,hl,e.cropstart),$l(e.cropmove)&&ta(t,pl,e.cropmove),$l(e.cropend)&&ta(t,bl,e.cropend),$l(e.crop)&&ta(t,dl,e.crop),$l(e.zoom)&&ta(t,Sl,e.zoom),ta(i,gl,this.onCropStart),e.zoomable&&e.zoomOnWheel&&ta(i,wl,this.onWheel,{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&ta(i,ml,this.onDblclick),ta(t.ownerDocument,fl,this.onCropMove),ta(t.ownerDocument,vl,this.onCropEnd),e.responsive&&ta(window,xl,this.onResize)}},va={resize:function(){if(!this.disabled){var t,e,i=this.options,n=this.container,o=this.containerData,s=n.offsetWidth/o.width,l=n.offsetHeight/o.height,a=Math.abs(s-1)>Math.abs(l-1)?s:l;if(1!==a)i.restore&&(t=this.getCanvasData(),e=this.getCropBoxData()),this.render(),i.restore&&(this.setCanvasData(Pl(t,(function(e,i){t[i]=e*a}))),this.setCropBoxData(Pl(e,(function(t,i){e[i]=t*a}))))}},dblclick:function(){var t,e;this.disabled||this.options.dragMode===ul||this.setDragMode((t=this.dragBox,e=Js,(t.classList?t.classList.contains(e):t.className.indexOf(e)>-1)?cl:rl))},wheel:function(t){var e=this,i=Number(this.options.wheelZoomRatio)||.1,n=1;this.disabled||(t.preventDefault(),this.wheeling||(this.wheeling=!0,setTimeout((function(){e.wheeling=!1}),50),t.deltaY?n=t.deltaY>0?1:-1:t.wheelDelta?n=-t.wheelDelta/120:t.detail&&(n=t.detail>0?1:-1),this.zoom(-n*i,t)))},cropStart:function(t){var e=t.buttons,i=t.button;if(!(this.disabled||("mousedown"===t.type||"pointerdown"===t.type&&"mouse"===t.pointerType)&&(Tl(e)&&1!==e||Tl(i)&&0!==i||t.ctrlKey))){var n,o=this.options,s=this.pointers;t.changedTouches?Pl(t.changedTouches,(function(t){s[t.identifier]=ca(t)})):s[t.pointerId||0]=ca(t),n=Object.keys(s).length>1&&o.zoomable&&o.zoomOnTouch?Us:Kl(t.target,ll),kl.test(n)&&!1!==ia(this.element,hl,{originalEvent:t,action:n})&&(t.preventDefault(),this.action=n,this.cropping=!1,n===Hs&&(this.cropping=!0,Wl(this.dragBox,ol)))}},cropMove:function(t){var e=this.action;if(!this.disabled&&e){var i=this.pointers;t.preventDefault(),!1!==ia(this.element,pl,{originalEvent:t,action:e})&&(t.changedTouches?Pl(t.changedTouches,(function(t){Dl(i[t.identifier]||{},ca(t,!0))})):Dl(i[t.pointerId||0]||{},ca(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var e=this.action,i=this.pointers;t.changedTouches?Pl(t.changedTouches,(function(t){delete i[t.identifier]})):delete i[t.pointerId||0],e&&(t.preventDefault(),Object.keys(i).length||(this.action=""),this.cropping&&(this.cropping=!1,Yl(this.dragBox,ol,this.cropped&&this.options.modal)),ia(this.element,bl,{originalEvent:t,action:e}))}}},ya={change:function(t){var e,i=this.options,n=this.canvasData,o=this.containerData,s=this.cropBoxData,l=this.pointers,a=this.action,r=i.aspectRatio,c=s.left,u=s.top,d=s.width,b=s.height,p=c+d,h=u+b,m=0,g=0,f=o.width,v=o.height,y=!0;!r&&t.shiftKey&&(r=d&&b?d/b:1),this.limited&&(m=s.minLeft,g=s.minTop,f=m+Math.min(o.width,n.width,n.left+n.width),v=g+Math.min(o.height,n.height,n.top+n.height));var x=l[Object.keys(l)[0]],w={x:x.endX-x.startX,y:x.endY-x.startY},S=function(t){switch(t){case Ws:p+w.x>f&&(w.x=f-p);break;case Gs:c+w.x<m&&(w.x=m-c);break;case Xs:u+w.y<g&&(w.y=g-u);break;case Ys:h+w.y>v&&(w.y=v-h)}};switch(a){case js:c+=w.x,u+=w.y;break;case Ws:if(w.x>=0&&(p>=f||r&&(u<=g||h>=v))){y=!1;break}S(Ws),(d+=w.x)<0&&(a=Gs,c-=d=-d),r&&(b=d/r,u+=(s.height-b)/2);break;case Xs:if(w.y<=0&&(u<=g||r&&(c<=m||p>=f))){y=!1;break}S(Xs),b-=w.y,u+=w.y,b<0&&(a=Ys,u-=b=-b),r&&(d=b*r,c+=(s.width-d)/2);break;case Gs:if(w.x<=0&&(c<=m||r&&(u<=g||h>=v))){y=!1;break}S(Gs),d-=w.x,c+=w.x,d<0&&(a=Ws,c-=d=-d),r&&(b=d/r,u+=(s.height-b)/2);break;case Ys:if(w.y>=0&&(h>=v||r&&(c<=m||p>=f))){y=!1;break}S(Ys),(b+=w.y)<0&&(a=Xs,u-=b=-b),r&&(d=b*r,c+=(s.width-d)/2);break;case Vs:if(r){if(w.y<=0&&(u<=g||p>=f)){y=!1;break}S(Xs),b-=w.y,u+=w.y,d=b*r}else S(Xs),S(Ws),w.x>=0?p<f?d+=w.x:w.y<=0&&u<=g&&(y=!1):d+=w.x,w.y<=0?u>g&&(b-=w.y,u+=w.y):(b-=w.y,u+=w.y);d<0&&b<0?(a=Qs,u-=b=-b,c-=d=-d):d<0?(a=Ks,c-=d=-d):b<0&&(a=Zs,u-=b=-b);break;case Ks:if(r){if(w.y<=0&&(u<=g||c<=m)){y=!1;break}S(Xs),b-=w.y,u+=w.y,d=b*r,c+=s.width-d}else S(Xs),S(Gs),w.x<=0?c>m?(d-=w.x,c+=w.x):w.y<=0&&u<=g&&(y=!1):(d-=w.x,c+=w.x),w.y<=0?u>g&&(b-=w.y,u+=w.y):(b-=w.y,u+=w.y);d<0&&b<0?(a=Zs,u-=b=-b,c-=d=-d):d<0?(a=Vs,c-=d=-d):b<0&&(a=Qs,u-=b=-b);break;case Qs:if(r){if(w.x<=0&&(c<=m||h>=v)){y=!1;break}S(Gs),d-=w.x,c+=w.x,b=d/r}else S(Ys),S(Gs),w.x<=0?c>m?(d-=w.x,c+=w.x):w.y>=0&&h>=v&&(y=!1):(d-=w.x,c+=w.x),w.y>=0?h<v&&(b+=w.y):b+=w.y;d<0&&b<0?(a=Vs,u-=b=-b,c-=d=-d):d<0?(a=Zs,c-=d=-d):b<0&&(a=Ks,u-=b=-b);break;case Zs:if(r){if(w.x>=0&&(p>=f||h>=v)){y=!1;break}S(Ws),b=(d+=w.x)/r}else S(Ys),S(Ws),w.x>=0?p<f?d+=w.x:w.y>=0&&h>=v&&(y=!1):d+=w.x,w.y>=0?h<v&&(b+=w.y):b+=w.y;d<0&&b<0?(a=Ks,u-=b=-b,c-=d=-d):d<0?(a=Qs,c-=d=-d):b<0&&(a=Vs,u-=b=-b);break;case Fs:this.move(w.x,w.y),y=!1;break;case Us:this.zoom(function(t){var e=qs({},t),i=0;return Pl(t,(function(t,n){delete e[n],Pl(e,(function(e){var n=Math.abs(t.startX-e.startX),o=Math.abs(t.startY-e.startY),s=Math.abs(t.endX-e.endX),l=Math.abs(t.endY-e.endY),a=Math.sqrt(n*n+o*o),r=(Math.sqrt(s*s+l*l)-a)/a;Math.abs(r)>Math.abs(i)&&(i=r)}))})),i}(l),t),y=!1;break;case Hs:if(!w.x||!w.y){y=!1;break}e=na(this.cropper),c=x.startX-e.left,u=x.startY-e.top,d=s.minWidth,b=s.minHeight,w.x>0?a=w.y>0?Zs:Vs:w.x<0&&(c-=d,a=w.y>0?Qs:Ks),w.y<0&&(u-=b),this.cropped||(Gl(this.cropBox,el),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0))}y&&(s.width=d,s.height=b,s.left=c,s.top=u,this.action=a,this.renderCropBox()),Pl(l,(function(t){t.startX=t.endX,t.startY=t.endY}))}},xa={crop:function(){return!this.ready||this.cropped||this.disabled||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&Wl(this.dragBox,ol),Gl(this.cropBox,el),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=Dl({},this.initialImageData),this.canvasData=Dl({},this.initialCanvasData),this.cropBoxData=Dl({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(Dl(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),Gl(this.dragBox,ol),Wl(this.cropBox,el)),this},replace:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!this.disabled&&t&&(this.isImg&&(this.element.src=t),e?(this.url=t,this.image.src=t,this.ready&&(this.viewBoxImage.src=t,Pl(this.previews,(function(e){e.getElementsByTagName("img")[0].src=t})))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(t))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,Gl(this.cropper,tl)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,Wl(this.cropper,tl)),this},destroy:function(){var t=this.element;return t.cropper?(t.cropper=void 0,this.isImg&&this.replaced&&(t.src=this.originalUrl),this.uncreate(),this):this},move:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.canvasData,n=i.left,o=i.top;return this.moveTo(zl(t)?t:n+Number(t),zl(e)?e:o+Number(e))},moveTo:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.canvasData,n=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.movable&&(Tl(t)&&(i.left=t,n=!0),Tl(e)&&(i.top=e,n=!0),n&&this.renderCanvas(!0)),this},zoom:function(t,e){var i=this.canvasData;return t=(t=Number(t))<0?1/(1-t):1+t,this.zoomTo(i.width*t/i.naturalWidth,null,e)},zoomTo:function(t,e,i){var n=this.options,o=this.canvasData,s=o.width,l=o.height,a=o.naturalWidth,r=o.naturalHeight;if((t=Number(t))>=0&&this.ready&&!this.disabled&&n.zoomable){var c=a*t,u=r*t;if(!1===ia(this.element,Sl,{ratio:t,oldRatio:s/a,originalEvent:i}))return this;if(i){var d=this.pointers,b=na(this.cropper),p=d&&Object.keys(d).length?function(t){var e=0,i=0,n=0;return Pl(t,(function(t){var o=t.startX,s=t.startY;e+=o,i+=s,n+=1})),{pageX:e/=n,pageY:i/=n}}(d):{pageX:i.pageX,pageY:i.pageY};o.left-=(c-s)*((p.pageX-b.left-o.left)/s),o.top-=(u-l)*((p.pageY-b.top-o.top)/l)}else Il(e)&&Tl(e.x)&&Tl(e.y)?(o.left-=(c-s)*((e.x-o.left)/s),o.top-=(u-l)*((e.y-o.top)/l)):(o.left-=(c-s)/2,o.top-=(u-l)/2);o.width=c,o.height=u,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return Tl(t=Number(t))&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=t%360,this.renderCanvas(!0,!0)),this},scaleX:function(t){var e=this.imageData.scaleY;return this.scale(t,Tl(e)?e:1)},scaleY:function(t){var e=this.imageData.scaleX;return this.scale(Tl(e)?e:1,t)},scale:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.imageData,n=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.scalable&&(Tl(t)&&(i.scaleX=t,n=!0),Tl(e)&&(i.scaleY=e,n=!0),n&&this.renderCanvas(!0,!0)),this},getData:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=this.options,n=this.imageData,o=this.canvasData,s=this.cropBoxData;if(this.ready&&this.cropped){t={x:s.left-o.left,y:s.top-o.top,width:s.width,height:s.height};var l=n.width/n.naturalWidth;if(Pl(t,(function(e,i){t[i]=e/l})),e){var a=Math.round(t.y+t.height),r=Math.round(t.x+t.width);t.x=Math.round(t.x),t.y=Math.round(t.y),t.width=r-t.x,t.height=a-t.y}}else t={x:0,y:0,width:0,height:0};return i.rotatable&&(t.rotate=n.rotate||0),i.scalable&&(t.scaleX=n.scaleX||1,t.scaleY=n.scaleY||1),t},setData:function(t){var e=this.options,i=this.imageData,n=this.canvasData,o={};if(this.ready&&!this.disabled&&Il(t)){var s=!1;e.rotatable&&Tl(t.rotate)&&t.rotate!==i.rotate&&(i.rotate=t.rotate,s=!0),e.scalable&&(Tl(t.scaleX)&&t.scaleX!==i.scaleX&&(i.scaleX=t.scaleX,s=!0),Tl(t.scaleY)&&t.scaleY!==i.scaleY&&(i.scaleY=t.scaleY,s=!0)),s&&this.renderCanvas(!0,!0);var l=i.width/i.naturalWidth;Tl(t.x)&&(o.left=t.x*l+n.left),Tl(t.y)&&(o.top=t.y*l+n.top),Tl(t.width)&&(o.width=t.width*l),Tl(t.height)&&(o.height=t.height*l),this.setCropBoxData(o)}return this},getContainerData:function(){return this.ready?Dl({},this.containerData):{}},getImageData:function(){return this.sized?Dl({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,e={};return this.ready&&Pl(["left","top","width","height","naturalWidth","naturalHeight"],(function(i){e[i]=t[i]})),e},setCanvasData:function(t){var e=this.canvasData,i=e.aspectRatio;return this.ready&&!this.disabled&&Il(t)&&(Tl(t.left)&&(e.left=t.left),Tl(t.top)&&(e.top=t.top),Tl(t.width)?(e.width=t.width,e.height=t.width/i):Tl(t.height)&&(e.height=t.height,e.width=t.height*i),this.renderCanvas(!0)),this},getCropBoxData:function(){var t,e=this.cropBoxData;return this.ready&&this.cropped&&(t={left:e.left,top:e.top,width:e.width,height:e.height}),t||{}},setCropBoxData:function(t){var e,i,n=this.cropBoxData,o=this.options.aspectRatio;return this.ready&&this.cropped&&!this.disabled&&Il(t)&&(Tl(t.left)&&(n.left=t.left),Tl(t.top)&&(n.top=t.top),Tl(t.width)&&t.width!==n.width&&(e=!0,n.width=t.width),Tl(t.height)&&t.height!==n.height&&(i=!0,n.height=t.height),o&&(e?n.height=n.width/o:i&&(n.width=n.height*o)),this.renderCropBox()),this},getCroppedCanvas:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var e=this.canvasData,i=da(this.image,this.imageData,e,t);if(!this.cropped)return i;var n=this.getData(),o=n.x,s=n.y,l=n.width,a=n.height,r=i.width/Math.floor(e.naturalWidth);1!==r&&(o*=r,s*=r,l*=r,a*=r);var c=l/a,u=ua({aspectRatio:c,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),d=ua({aspectRatio:c,width:t.minWidth||0,height:t.minHeight||0},"cover"),b=ua({aspectRatio:c,width:t.width||(1!==r?i.width:l),height:t.height||(1!==r?i.height:a)}),p=b.width,h=b.height;p=Math.min(u.width,Math.max(d.width,p)),h=Math.min(u.height,Math.max(d.height,h));var m=document.createElement("canvas"),g=m.getContext("2d");m.width=Hl(p),m.height=Hl(h),g.fillStyle=t.fillColor||"transparent",g.fillRect(0,0,p,h);var f=t.imageSmoothingEnabled,v=void 0===f||f,y=t.imageSmoothingQuality;g.imageSmoothingEnabled=v,y&&(g.imageSmoothingQuality=y);var x,w,S,_,k,C,L=i.width,A=i.height,E=o,q=s;E<=-l||E>L?(E=0,x=0,S=0,k=0):E<=0?(S=-E,E=0,k=x=Math.min(L,l+E)):E<=L&&(S=0,k=x=Math.min(l,L-E)),x<=0||q<=-a||q>A?(q=0,w=0,_=0,C=0):q<=0?(_=-q,q=0,C=w=Math.min(A,a+q)):q<=A&&(_=0,C=w=Math.min(a,A-q));var T=[E,q,x,w];if(k>0&&C>0){var M=p/l;T.push(S*M,_*M,k*M,C*M)}return g.drawImage.apply(g,[i].concat(Rs(T.map((function(t){return Math.floor(Hl(t))}))))),m},setAspectRatio:function(t){var e=this.options;return this.disabled||zl(t)||(e.aspectRatio=Math.max(0,t)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(t){var e=this.options,i=this.dragBox,n=this.face;if(this.ready&&!this.disabled){var o=t===rl,s=e.movable&&t===cl;t=o||s?t:ul,e.dragMode=t,Zl(i,ll,t),Yl(i,Js,o),Yl(i,sl,s),e.cropBoxMovable||(Zl(n,ll,t),Yl(n,Js,o),Yl(n,sl,s))}return this}},wa=Bs.Cropper,Sa=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Ms(this,t),!e||!Al.test(e.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=e,this.options=Dl({},El,Il(i)&&i),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}var e,i,n;return e=t,i=[{key:"init",value:function(){var t,e=this.element,i=e.tagName.toLowerCase();if(!e.cropper){if(e.cropper=this,"img"===i){if(this.isImg=!0,t=e.getAttribute("src")||"",this.originalUrl=t,!t)return;t=e.src}else"canvas"===i&&window.HTMLCanvasElement&&(t=e.toDataURL());this.load(t)}}},{key:"load",value:function(t){var e=this;if(t){this.url=t,this.imageData={};var i=this.element,n=this.options;if(n.rotatable||n.scalable||(n.checkOrientation=!1),n.checkOrientation&&window.ArrayBuffer)if(Cl.test(t))Ll.test(t)?this.read((o=t.replace(pa,""),s=atob(o),l=new ArrayBuffer(s.length),Pl(a=new Uint8Array(l),(function(t,e){a[e]=s.charCodeAt(e)})),l)):this.clone();else{var o,s,l,a,r=new XMLHttpRequest,c=this.clone.bind(this);this.reloading=!0,this.xhr=r,r.onabort=c,r.onerror=c,r.ontimeout=c,r.onprogress=function(){r.getResponseHeader("content-type")!==_l&&r.abort()},r.onload=function(){e.read(r.response)},r.onloadend=function(){e.reloading=!1,e.xhr=null},n.checkCrossOrigin&&la(t)&&i.crossOrigin&&(t=aa(t)),r.open("GET",t,!0),r.responseType="arraybuffer",r.withCredentials="use-credentials"===i.crossOrigin,r.send()}else this.clone()}}},{key:"read",value:function(t){var e=this.options,i=this.imageData,n=ha(t),o=0,s=1,l=1;if(n>1){this.url=function(t,e){for(var i=[],n=new Uint8Array(t);n.length>0;)i.push(ba.apply(null,Nl(n.subarray(0,8192)))),n=n.subarray(8192);return"data:".concat(e,";base64,").concat(btoa(i.join("")))}(t,_l);var a=function(t){var e=0,i=1,n=1;switch(t){case 2:i=-1;break;case 3:e=-180;break;case 4:n=-1;break;case 5:e=90,n=-1;break;case 6:e=90;break;case 7:e=90,i=-1;break;case 8:e=-90}return{rotate:e,scaleX:i,scaleY:n}}(n);o=a.rotate,s=a.scaleX,l=a.scaleY}e.rotatable&&(i.rotate=o),e.scalable&&(i.scaleX=s,i.scaleY=l),this.clone()}},{key:"clone",value:function(){var t=this.element,e=this.url,i=t.crossOrigin,n=e;this.options.checkCrossOrigin&&la(e)&&(i||(i="anonymous"),n=aa(e)),this.crossOrigin=i,this.crossOriginUrl=n;var o=document.createElement("img");i&&(o.crossOrigin=i),o.src=n||e,o.alt=t.alt||"The image to crop",this.image=o,o.onload=this.start.bind(this),o.onerror=this.stop.bind(this),Wl(o,il),t.parentNode.insertBefore(o,t.nextSibling)}},{key:"start",value:function(){var t=this,e=this.image;e.onload=null,e.onerror=null,this.sizing=!0;var i=Bs.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(Bs.navigator.userAgent),n=function(e,i){Dl(t.imageData,{naturalWidth:e,naturalHeight:i,aspectRatio:e/i}),t.initialImageData=Dl({},t.imageData),t.sizing=!1,t.sized=!0,t.build()};if(!e.naturalWidth||i){var o=document.createElement("img"),s=document.body||document.documentElement;this.sizingImage=o,o.onload=function(){n(o.width,o.height),i||s.removeChild(o)},o.src=e.src,i||(o.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",s.appendChild(o))}else n(e.naturalWidth,e.naturalHeight)}},{key:"stop",value:function(){var t=this.image;t.onload=null,t.onerror=null,t.parentNode.removeChild(t),this.image=null}},{key:"build",value:function(){if(this.sized&&!this.ready){var t=this.element,e=this.options,i=this.image,n=t.parentNode,o=document.createElement("div");o.innerHTML='<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>';var s=o.querySelector(".".concat(Ds,"-container")),l=s.querySelector(".".concat(Ds,"-canvas")),a=s.querySelector(".".concat(Ds,"-drag-box")),r=s.querySelector(".".concat(Ds,"-crop-box")),c=r.querySelector(".".concat(Ds,"-face"));this.container=n,this.cropper=s,this.canvas=l,this.dragBox=a,this.cropBox=r,this.viewBox=s.querySelector(".".concat(Ds,"-view-box")),this.face=c,l.appendChild(i),Wl(t,el),n.insertBefore(s,t.nextSibling),this.isImg||Gl(i,il),this.initPreview(),this.bind(),e.initialAspectRatio=Math.max(0,e.initialAspectRatio)||NaN,e.aspectRatio=Math.max(0,e.aspectRatio)||NaN,e.viewMode=Math.max(0,Math.min(3,Math.round(e.viewMode)))||0,Wl(r,el),e.guides||Wl(r.getElementsByClassName("".concat(Ds,"-dashed")),el),e.center||Wl(r.getElementsByClassName("".concat(Ds,"-center")),el),e.background&&Wl(s,"".concat(Ds,"-bg")),e.highlight||Wl(c,nl),e.cropBoxMovable&&(Wl(c,sl),Zl(c,ll,js)),e.cropBoxResizable||(Wl(r.getElementsByClassName("".concat(Ds,"-line")),el),Wl(r.getElementsByClassName("".concat(Ds,"-point")),el)),this.render(),this.ready=!0,this.setDragMode(e.dragMode),e.autoCrop&&this.crop(),this.setData(e.data),$l(e.ready)&&ea(t,yl,e.ready,{once:!0}),ia(t,yl)}}},{key:"unbuild",value:function(){this.ready&&(this.ready=!1,this.unbind(),this.resetPreview(),this.cropper.parentNode.removeChild(this.cropper),Gl(this.element,el))}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],n=[{key:"noConflict",value:function(){return window.Cropper=wa,t}},{key:"setDefaults",value:function(t){Dl(El,Il(t)&&t)}}],i&&zs(e.prototype,i),n&&zs(e,n),t}();function _a(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];return e.map((function(e){return e.split(" ").map((function(e){return e?""+t+e:""})).join(" ")})).join(" ")}function ka(t,e){return function(i){i&&(t[e]=i)}}function Ca(t,e,i){return function(n){n&&(t[e][i]=n)}}function La(t,e){return function(i){var n=i.prototype;t.forEach((function(t){e(n,t)}))}}function Aa(t,e){return void 0===e&&(e={}),function(i,n){t.forEach((function(t){var o=e[t]||t;o in i||(i[o]=function(){for(var e,i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];var s=(e=this[n])[t].apply(e,i);return s===this[n]?this:s})}))}}Dl(Sa.prototype,ma,ga,fa,va,ya,xa);var Ea=function(){function t(){this.keys=[],this.values=[]}var e=t.prototype;return e.get=function(t){return this.values[this.keys.indexOf(t)]},e.set=function(t,e){var i=this.keys,n=this.values,o=i.indexOf(t),s=-1===o?i.length:o;i[s]=t,n[s]=e},t}(),qa=function(){function t(){this.object={}}var e=t.prototype;return e.get=function(t){return this.object[t]},e.set=function(t,e){this.object[t]=e},t}(),Ta="function"==typeof Map,Ma=function(){function t(){}var e=t.prototype;return e.connect=function(t,e){this.prev=t,this.next=e,t&&(t.next=this),e&&(e.prev=this)},e.disconnect=function(){var t=this.prev,e=this.next;t&&(t.next=e),e&&(e.prev=t)},e.getIndex=function(){for(var t=this,e=-1;t;)t=t.prev,++e;return e},t}();var za=function(){function t(t,e,i,n,o,s,l,a){this.prevList=t,this.list=e,this.added=i,this.removed=n,this.changed=o,this.maintained=s,this.changedBeforeAdded=l,this.fixed=a}var e=t.prototype;return Object.defineProperty(e,"ordered",{get:function(){return this.cacheOrdered||this.caculateOrdered(),this.cacheOrdered},enumerable:!0,configurable:!0}),Object.defineProperty(e,"pureChanged",{get:function(){return this.cachePureChanged||this.caculateOrdered(),this.cachePureChanged},enumerable:!0,configurable:!0}),e.caculateOrdered=function(){var t=function(t,e){var i=[],n=[];return t.forEach((function(t){var e=t[0],o=t[1],s=new Ma;i[e]=s,n[o]=s})),i.forEach((function(t,e){t.connect(i[e-1])})),t.filter((function(t,i){return!e[i]})).map((function(t,e){var o=t[0],s=t[1];if(o===s)return[0,0];var l=i[o],a=n[s-1],r=l.getIndex();return l.disconnect(),a?l.connect(a,a.next):l.connect(void 0,i[0]),[r,l.getIndex()]}))}(this.changedBeforeAdded,this.fixed),e=this.changed,i=[];this.cacheOrdered=t.filter((function(t,n){var o=t[0],s=t[1],l=e[n],a=l[0],r=l[1];if(o!==s)return i.push([a,r]),!0})),this.cachePureChanged=i},t}();function Oa(t,e,i){var n=Ta?Map:i?qa:Ea,o=i||function(t){return t},s=[],l=[],a=[],r=t.map(o),c=e.map(o),u=new n,d=new n,b=[],p=[],h={},m=[],g=0,f=0;return r.forEach((function(t,e){u.set(t,e)})),c.forEach((function(t,e){d.set(t,e)})),r.forEach((function(t,e){var i=d.get(t);void 0===i?(++f,l.push(e)):h[i]=f})),c.forEach((function(t,e){var i=u.get(t);void 0===i?(s.push(e),++g):(a.push([i,e]),f=h[e]||0,b.push([i-f,e-g]),p.push(e===i),i!==e&&m.push([i,e]))})),l.reverse(),new za(t,e,s,l,m,a,b,p)}var Ra=function(){function t(t,e){void 0===t&&(t=[]),this.findKeyCallback=e,this.list=[].slice.call(t)}return t.prototype.update=function(t){var e=[].slice.call(t),i=Oa(this.list,e,this.findKeyCallback);return this.list=e,i},t}(),Ia="undefined",$a=typeof window!==Ia,Ba=[{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:'\\"',close:'\\"'},{open:"\\'",close:"\\'"}],Na=1e-7,Pa={cm:function(t){return 96*t/2.54},mm:function(t){return 96*t/254},in:function(t){return 96*t},pt:function(t){return 96*t/72},pc:function(t){return 96*t/6},"%":function(t,e){return t*e/100},vw:function(t,e){return void 0===e&&(e=window.innerWidth),t/100*e},vh:function(t,e){return void 0===e&&(e=window.innerHeight),t/100*e},vmax:function(t,e){return void 0===e&&(e=Math.max(window.innerWidth,window.innerHeight)),t/100*e},vmin:function(t,e){return void 0===e&&(e=Math.min(window.innerWidth,window.innerHeight)),t/100*e}};function Da(t){return typeof t===Ia}function ja(t){return t&&"object"==typeof t}function Ha(t){return Array.isArray(t)}function Fa(t){return"string"==typeof t}function Ua(t){return"number"==typeof t}function Wa(t){return"function"==typeof t}function Ga(t,e,i,n,o){return Ya(t,e,i)?i:function(t,e,i,n,o){for(var s,l=function(i){var l=e[i].trim();if(l===t.close&&!Ya(t,e,i))return{value:i};var a=i,r=ir(o,(function(t){return t.open===l}));if(r&&(a=Ga(r,e,i,n,o)),-1===a)return s=i,"break";s=i=a},a=i;a<n;++a){var r=l(a);if(a=s,"object"==typeof r)return r.value;if("break"===r)break}return-1}(t,e,i+1,n,o)}function Ya(t,e,i){if(!t.ignore)return null;var n=e.slice(Math.max(i-3,0),i+3).join("");return new RegExp(t.ignore).exec(n)}function Xa(t,e){var i=Fa(e)?{separator:e}:e,n=i.separator,o=void 0===n?",":n,s=i.isSeparateFirst,l=i.isSeparateOnlyOpenClose,a=i.isSeparateOpenClose,r=void 0===a?l:a,c=i.openCloseCharacters,u=void 0===c?Ba:c,d=u.map((function(t){var e=t.open,i=t.close;return e===i?e:e+"|"+i})).join("|"),b=new RegExp("(\\s*"+o+"\\s*|"+d+"|\\s+)","g"),p=t.split(b).filter(Boolean),h=p.length,m=[],g=[];function f(){return!!g.length&&(m.push(g.join("")),g=[],!0)}for(var v,y=function(t){var e=p[t].trim(),i=t,n=ir(u,(function(t){return t.open===e})),a=ir(u,(function(t){return t.close===e}));if(n){if(-1!==(i=Ga(n,p,t,h,u))&&r)return f()&&s?(v=t,"break"):(m.push(p.slice(t,i+1).join("")),t=i,s?(v=t,"break"):(v=t,"continue"))}else{if(a&&!Ya(a,p,t))throw new Error("invalid format: "+a.close);if(function(t,e){return(""===e||" "==e)&&(""===t||" "==t)||t===e}(e,o)&&!l)return f(),s?(v=t,"break"):(v=t,"continue")}-1===i&&(i=h-1),g.push(p.slice(t,i+1).join("")),v=t=i},x=0;x<h;++x){var w=y(x);if(x=v,"break"===w)break}return g.length&&m.push(g.join("")),m}function Va(t){return Xa(t,"")}function Ka(t){return Xa(t,",")}function Za(t){var e=/([^(]*)\(([\s\S]*)\)([\s\S]*)/g.exec(t);return!e||e.length<4?{}:{prefix:e[1],value:e[2],suffix:e[3]}}function Qa(t){var e=/^([^\d|e|\-|\+]*)((?:\d|\.|-|e-|e\+)+)(\S*)$/g.exec(t);if(!e)return{prefix:"",unit:"",value:NaN};var i=e[1],n=e[2];return{prefix:i,unit:e[3],value:parseFloat(n)}}function Ja(t,e){return void 0===e&&(e="-"),t.replace(/([a-z])([A-Z])/g,(function(t,i,n){return""+i+e+n.toLowerCase()}))}function tr(){return Date.now?Date.now():(new Date).getTime()}function er(t,e,i){void 0===i&&(i=-1);for(var n=t.length,o=0;o<n;++o)if(e(t[o],o,t))return o;return i}function ir(t,e,i){var n=er(t,e);return n>-1?t[n]:i}var nr=function(){var t=tr(),e=$a&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame);return e?e.bind(window):function(e){var i=tr();return window.setTimeout((function(){e(i-t)}),1e3/60)}}(),or=function(){var t=$a&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame);return t?t.bind(window):function(t){clearTimeout(t)}}();function sr(t){if(Object.keys)return Object.keys(t);var e=[];for(var i in e)e.push(i);return e}function lr(t,e){var i=Qa(t),n=i.value,o=i.unit;if(ja(e)){var s=e[o];if(s){if(Wa(s))return s(n);if(Pa[o])return Pa[o](n,s)}}else if("%"===o)return n*e/100;return Pa[o]?Pa[o](n):n}function ar(t,e,i,n){return void 0===n&&(n=t[0]/t[1]),[[pr(e[0],Na),pr(e[0]/n,Na)],[pr(e[1]*n,Na),pr(e[1],Na)]].filter((function(t){return t.every((function(t,n){var o=e[n],s=pr(o,Na);return i?t<=o||t<=s:t>=o||t>=s}))}))[0]||t}function rr(t,e,i,n){if(!n)return t.map((function(t,n){return function(t,e,i){return Math.max(e,Math.min(t,i))}(t,e[n],i[n])}));var o=t[0],s=t[1],l=!0===n?o/s:n,a=ar(t,e,!1,l),r=a[0],c=a[1],u=ar(t,i,!0,l),d=u[0],b=u[1];return o<r||s<c?(o=r,s=c):(o>d||s>b)&&(o=d,s=b),[o,s]}function cr(t){for(var e=t.length,i=0,n=e-1;n>=0;--n)i+=t[n];return e?i/e:0}function ur(t,e){var i=e[0]-t[0],n=e[1]-t[1],o=Math.atan2(n,i);return o>=0?o:o+2*Math.PI}function dr(t){var e=function(t){return[0,1].map((function(e){return cr(t.map((function(t){return t[e]})))}))}(t),i=ur(e,t[0]),n=ur(e,t[1]);return i<n&&n-i<Math.PI||i>n&&n-i<-Math.PI?1:-1}function br(t,e){return Math.sqrt(Math.pow((e?e[0]:0)-t[0],2)+Math.pow((e?e[1]:0)-t[1],2))}function pr(t,e){if(!e)return t;var i=1/e;return Math.round(t/e)/i}function hr(t,e){return t.forEach((function(i,n){t[n]=pr(t[n],e)})),t}function mr(t,e){return t.classList?t.classList.contains(e):!!t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))}function gr(t,e,i,n){t.addEventListener(e,i,n)}function fr(t,e,i,n){t.removeEventListener(e,i,n)}
42
42
  /*! *****************************************************************************
43
43
  Copyright (c) Microsoft Corporation. All rights reserved.
44
44
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use