@innovastudio/contentbuilder 1.5.39 → 1.5.40

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/contentbuilder",
3
3
  "type": "module",
4
- "version": "1.5.39",
4
+ "version": "1.5.40",
5
5
  "description": "",
6
6
  "main": "public/contentbuilder/contentbuilder.esm.js",
7
7
  "files": [
@@ -17299,12 +17299,6 @@ const renderSnippetPanel = (builder, snippetOpen) => {
17299
17299
  block.style.left = x + '%';
17300
17300
  block.removeAttribute('data-new-dummy');
17301
17301
  }
17302
-
17303
- // to prevent flicker caused by snippet panel above wrapper (see contentbuilder.js sectionDropSetup)
17304
- if (builder.page && builder.page === '.is-wrapper') {
17305
- const wrapper = builder.doc.querySelector(builder.page);
17306
- if (wrapper) wrapper.style.marginLeft = '';
17307
- }
17308
17302
  },
17309
17303
  onStart: () => {
17310
17304
  // Remove .builder-active during dragging (because this class makes rows have border-right/left 120px)
@@ -26,7 +26,7 @@ function Ti(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Obj
26
26
  * Released under the MIT license
27
27
  *
28
28
  * Date: 2021-06-12T08:00:17.411Z
29
- */(t)}},!1));const b=document.querySelector(".is-design-list");let h=t.opts.snippetPath,p=t.opts.snippetJSON.snippets,m=t.opts.slider;if(null!=m)if("slick"===m){const e=t=>"glide"!==t.type;t.opts.snippetJSON.snippets=p.filter(e)}else if("glide"===m){const e=t=>"slick"!==t.type;t.opts.snippetJSON.snippets=p.filter(e)}else if("all"===m);else{const e=t=>"glide"!==t.type&&"slick"!==t.type;t.opts.snippetJSON.snippets=p.filter(e)}else{var g=!0;if(t.win.jQuery&&t.win.jQuery.fn.slick&&(g=!1),g){const t=p.filter((t=>"slick"!==t.type));p=[...t]}if(!t.win.Glide){const t=p.filter((t=>!(t.glide||"glide"===t.type)));p=[...t]}t.opts.snippetJSON.snippets=[...p]}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="'+h+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="'+h+e.thumbnail+'"><span class="is-overlay"></span></div>'),y++})),new po(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")}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",(()=>{No(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(){No(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 No(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 Do(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 Po(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Do(Object(i),!0).forEach((function(e){Fo(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Do(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function $o(t){return $o="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},$o(t)}function Ho(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 Fo(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function jo(t){return function(t){if(Array.isArray(t))return Uo(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 Uo(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 Uo(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 Uo(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 Wo="undefined"!=typeof window&&void 0!==window.document,Go=Wo?window:{},Vo=!(!Wo||!Go.document.documentElement)&&"ontouchstart"in Go.document.documentElement,Yo=!!Wo&&"PointerEvent"in Go,Xo="cropper",Zo="all",Ko="crop",Qo="move",Jo="zoom",ts="e",es="w",is="s",ns="n",os="ne",ss="nw",ls="se",as="sw",rs="".concat(Xo,"-crop"),cs="".concat(Xo,"-disabled"),us="".concat(Xo,"-hidden"),ds="".concat(Xo,"-hide"),bs="".concat(Xo,"-invisible"),hs="".concat(Xo,"-modal"),ps="".concat(Xo,"-move"),ms="".concat(Xo,"Action"),gs="".concat(Xo,"Preview"),fs="crop",vs="move",ys="none",xs="crop",ws="cropend",Ss="cropmove",ks="cropstart",_s="dblclick",Cs=Yo?"pointerdown":Vo?"touchstart":"mousedown",Es=Yo?"pointermove":Vo?"touchmove":"mousemove",Ls=Yo?"pointerup pointercancel":Vo?"touchend touchcancel":"mouseup",As="ready",qs="resize",Ts="wheel",Ms="zoom",Rs="image/jpeg",Os=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,zs=/^data:/,Is=/^data:image\/jpeg;base64,/,Bs=/^img|canvas$/i,Ns={viewMode:0,dragMode:fs,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},Ds=Number.isNaN||Go.isNaN;function Ps(t){return"number"==typeof t&&!Ds(t)}var $s=function(t){return t>0&&t<1/0};function Hs(t){return void 0===t}function Fs(t){return"object"===$o(t)&&null!==t}var js=Object.prototype.hasOwnProperty;function Us(t){if(!Fs(t))return!1;try{var e=t.constructor,i=e.prototype;return e&&i&&js.call(i,"isPrototypeOf")}catch(t){return!1}}function Ws(t){return"function"==typeof t}var Gs=Array.prototype.slice;function Vs(t){return Array.from?Array.from(t):Gs.call(t)}function Ys(t,e){return t&&Ws(e)&&(Array.isArray(t)||Ps(t.length)?Vs(t).forEach((function(i,n){e.call(t,i,n,t)})):Fs(t)&&Object.keys(t).forEach((function(i){e.call(t,t[i],i,t)}))),t}var Xs=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 Fs(t)&&i.length>0&&i.forEach((function(e){Fs(e)&&Object.keys(e).forEach((function(i){t[i]=e[i]}))})),t},Zs=/\.\d*(?:0|9){12}\d*$/;function Ks(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return Zs.test(t)?Math.round(t*e)/e:t}var Qs=/^width|height|left|top|marginLeft|marginTop$/;function Js(t,e){var i=t.style;Ys(e,(function(t,e){Qs.test(e)&&Ps(t)&&(t="".concat(t,"px")),i[e]=t}))}function tl(t,e){if(e)if(Ps(t.length))Ys(t,(function(t){tl(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 el(t,e){e&&(Ps(t.length)?Ys(t,(function(t){el(t,e)})):t.classList?t.classList.remove(e):t.className.indexOf(e)>=0&&(t.className=t.className.replace(e,"")))}function il(t,e,i){e&&(Ps(t.length)?Ys(t,(function(t){il(t,e,i)})):i?tl(t,e):el(t,e))}var nl=/([a-z\d])([A-Z])/g;function ol(t){return t.replace(nl,"$1-$2").toLowerCase()}function sl(t,e){return Fs(t[e])?t[e]:t.dataset?t.dataset[e]:t.getAttribute("data-".concat(ol(e)))}function ll(t,e,i){Fs(i)?t[e]=i:t.dataset?t.dataset[e]=i:t.setAttribute("data-".concat(ol(e)),i)}var al=/\s\s*/,rl=function(){var t=!1;if(Wo){var e=!1,i=function(){},n=Object.defineProperty({},"once",{get:function(){return t=!0,e},set:function(t){e=t}});Go.addEventListener("test",i,n),Go.removeEventListener("test",i,n)}return t}();function cl(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i;e.trim().split(al).forEach((function(e){if(!rl){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 ul(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i;e.trim().split(al).forEach((function(e){if(n.once&&!rl){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 dl(t,e,i){var n;return Ws(Event)&&Ws(CustomEvent)?n=new CustomEvent(e,{detail:i,bubbles:!0,cancelable:!0}):(n=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,i),t.dispatchEvent(n)}function bl(t){var e=t.getBoundingClientRect();return{left:e.left+(window.pageXOffset-document.documentElement.clientLeft),top:e.top+(window.pageYOffset-document.documentElement.clientTop)}}var hl=Go.location,pl=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function ml(t){var e=t.match(pl);return null!==e&&(e[1]!==hl.protocol||e[2]!==hl.hostname||e[3]!==hl.port)}function gl(t){var e="timestamp=".concat((new Date).getTime());return t+(-1===t.indexOf("?")?"?":"&")+e}function fl(t){var e=t.rotate,i=t.scaleX,n=t.scaleY,o=t.translateX,s=t.translateY,l=[];Ps(o)&&0!==o&&l.push("translateX(".concat(o,"px)")),Ps(s)&&0!==s&&l.push("translateY(".concat(s,"px)")),Ps(e)&&0!==e&&l.push("rotate(".concat(e,"deg)")),Ps(i)&&1!==i&&l.push("scaleX(".concat(i,")")),Ps(n)&&1!==n&&l.push("scaleY(".concat(n,")"));var a=l.length?l.join(" "):"none";return{WebkitTransform:a,msTransform:a,transform:a}}function vl(t,e){var i=t.pageX,n=t.pageY,o={endX:i,endY:n};return e?o:Po({startX:i,startY:n},o)}function yl(t){var e=t.aspectRatio,i=t.height,n=t.width,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"contain",s=$s(n),l=$s(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}}var xl=String.fromCharCode;var wl=/^data:.*,/;function Sl(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+=xl(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,h=i.getUint16(s,n);for(b=0;b<h;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 kl={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);tl(n,us),el(t,us);var l={width:Math.max(i.offsetWidth,o>=0?o:200),height:Math.max(i.offsetHeight,s>=0?s:100)};this.containerData=l,Js(n,{width:l.width,height:l.height}),tl(t,us),el(n,us)},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=Xs({},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=yl({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,h=n.height-o.height;o.minLeft=Math.min(0,b),o.minTop=Math.min(0,h),o.maxLeft=Math.max(0,b),o.maxTop=Math.max(0,h),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,h),o.maxTop=Math.max(0,h))))}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,Js(this.canvas,Xs({width:i.width,height:i.height},fl({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);Xs(i,{width:n,height:o,left:(e.width-n)/2,top:(e.height-o)/2}),Js(this.image,Xs({width:i.width,height:i.height},fl(Xs({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=Xs({},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&&ll(this.face,ms,i.width>=e.width&&i.height>=e.height?Qo:Zo),Js(this.cropBox,Xs({width:i.width,height:i.height},fl({translateX:i.left,translateY:i.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),dl(this.element,xs,this.getData())}},_l={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,Ys(l,(function(t){var i=document.createElement("img");ll(t,gs,{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(){Ys(this.previews,(function(t){var e=sl(t,gs);Js(t,{width:e.width,height:e.height}),t.innerHTML=e.html,function(t,e){if(Fs(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(ol(e)))}(t,gs)}))},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&&(Js(this.viewBoxImage,Xs({width:s,height:l},fl(Xs({translateX:-a,translateY:-r},t)))),Ys(this.previews,(function(e){var i=sl(e,gs),c=i.width,u=i.height,d=c,b=u,h=1;n&&(b=o*(h=c/n)),o&&b>u&&(d=n*(h=u/o),b=u),Js(e,{width:d,height:b}),Js(e.getElementsByTagName("img")[0],Xs({width:s*h,height:l*h},fl(Xs({translateX:-a*h,translateY:-r*h},t))))})))}},Cl={bind:function(){var t=this.element,e=this.options,i=this.cropper;Ws(e.cropstart)&&ul(t,ks,e.cropstart),Ws(e.cropmove)&&ul(t,Ss,e.cropmove),Ws(e.cropend)&&ul(t,ws,e.cropend),Ws(e.crop)&&ul(t,xs,e.crop),Ws(e.zoom)&&ul(t,Ms,e.zoom),ul(i,Cs,this.onCropStart=this.cropStart.bind(this)),e.zoomable&&e.zoomOnWheel&&ul(i,Ts,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&ul(i,_s,this.onDblclick=this.dblclick.bind(this)),ul(t.ownerDocument,Es,this.onCropMove=this.cropMove.bind(this)),ul(t.ownerDocument,Ls,this.onCropEnd=this.cropEnd.bind(this)),e.responsive&&ul(window,qs,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,e=this.options,i=this.cropper;Ws(e.cropstart)&&cl(t,ks,e.cropstart),Ws(e.cropmove)&&cl(t,Ss,e.cropmove),Ws(e.cropend)&&cl(t,ws,e.cropend),Ws(e.crop)&&cl(t,xs,e.crop),Ws(e.zoom)&&cl(t,Ms,e.zoom),cl(i,Cs,this.onCropStart),e.zoomable&&e.zoomOnWheel&&cl(i,Ts,this.onWheel,{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&cl(i,_s,this.onDblclick),cl(t.ownerDocument,Es,this.onCropMove),cl(t.ownerDocument,Ls,this.onCropEnd),e.responsive&&cl(window,qs,this.onResize)}},El={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(Ys(t,(function(e,i){t[i]=e*a}))),this.setCropBoxData(Ys(e,(function(t,i){e[i]=t*a}))))}},dblclick:function(){var t,e;this.disabled||this.options.dragMode===ys||this.setDragMode((t=this.dragBox,e=rs,(t.classList?t.classList.contains(e):t.className.indexOf(e)>-1)?vs:fs))},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)&&(Ps(e)&&1!==e||Ps(i)&&0!==i||t.ctrlKey))){var n,o=this.options,s=this.pointers;t.changedTouches?Ys(t.changedTouches,(function(t){s[t.identifier]=vl(t)})):s[t.pointerId||0]=vl(t),n=Object.keys(s).length>1&&o.zoomable&&o.zoomOnTouch?Jo:sl(t.target,ms),Os.test(n)&&!1!==dl(this.element,ks,{originalEvent:t,action:n})&&(t.preventDefault(),this.action=n,this.cropping=!1,n===Ko&&(this.cropping=!0,tl(this.dragBox,hs)))}},cropMove:function(t){var e=this.action;if(!this.disabled&&e){var i=this.pointers;t.preventDefault(),!1!==dl(this.element,Ss,{originalEvent:t,action:e})&&(t.changedTouches?Ys(t.changedTouches,(function(t){Xs(i[t.identifier]||{},vl(t,!0))})):Xs(i[t.pointerId||0]||{},vl(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var e=this.action,i=this.pointers;t.changedTouches?Ys(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,il(this.dragBox,hs,this.cropped&&this.options.modal)),dl(this.element,ws,{originalEvent:t,action:e}))}}},Ll={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,h=c+d,p=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 ts:h+w.x>f&&(w.x=f-h);break;case es:c+w.x<m&&(w.x=m-c);break;case ns:u+w.y<g&&(w.y=g-u);break;case is:p+w.y>v&&(w.y=v-p)}};switch(a){case Zo:c+=w.x,u+=w.y;break;case ts:if(w.x>=0&&(h>=f||r&&(u<=g||p>=v))){y=!1;break}S(ts),(d+=w.x)<0&&(a=es,c-=d=-d),r&&(b=d/r,u+=(s.height-b)/2);break;case ns:if(w.y<=0&&(u<=g||r&&(c<=m||h>=f))){y=!1;break}S(ns),b-=w.y,u+=w.y,b<0&&(a=is,u-=b=-b),r&&(d=b*r,c+=(s.width-d)/2);break;case es:if(w.x<=0&&(c<=m||r&&(u<=g||p>=v))){y=!1;break}S(es),d-=w.x,c+=w.x,d<0&&(a=ts,c-=d=-d),r&&(b=d/r,u+=(s.height-b)/2);break;case is:if(w.y>=0&&(p>=v||r&&(c<=m||h>=f))){y=!1;break}S(is),(b+=w.y)<0&&(a=ns,u-=b=-b),r&&(d=b*r,c+=(s.width-d)/2);break;case os:if(r){if(w.y<=0&&(u<=g||h>=f)){y=!1;break}S(ns),b-=w.y,u+=w.y,d=b*r}else S(ns),S(ts),w.x>=0?h<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=as,u-=b=-b,c-=d=-d):d<0?(a=ss,c-=d=-d):b<0&&(a=ls,u-=b=-b);break;case ss:if(r){if(w.y<=0&&(u<=g||c<=m)){y=!1;break}S(ns),b-=w.y,u+=w.y,d=b*r,c+=s.width-d}else S(ns),S(es),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=ls,u-=b=-b,c-=d=-d):d<0?(a=os,c-=d=-d):b<0&&(a=as,u-=b=-b);break;case as:if(r){if(w.x<=0&&(c<=m||p>=v)){y=!1;break}S(es),d-=w.x,c+=w.x,b=d/r}else S(is),S(es),w.x<=0?c>m?(d-=w.x,c+=w.x):w.y>=0&&p>=v&&(y=!1):(d-=w.x,c+=w.x),w.y>=0?p<v&&(b+=w.y):b+=w.y;d<0&&b<0?(a=os,u-=b=-b,c-=d=-d):d<0?(a=ls,c-=d=-d):b<0&&(a=ss,u-=b=-b);break;case ls:if(r){if(w.x>=0&&(h>=f||p>=v)){y=!1;break}S(ts),b=(d+=w.x)/r}else S(is),S(ts),w.x>=0?h<f?d+=w.x:w.y>=0&&p>=v&&(y=!1):d+=w.x,w.y>=0?p<v&&(b+=w.y):b+=w.y;d<0&&b<0?(a=ss,u-=b=-b,c-=d=-d):d<0?(a=as,c-=d=-d):b<0&&(a=os,u-=b=-b);break;case Qo:this.move(w.x,w.y),y=!1;break;case Jo:this.zoom(function(t){var e=Po({},t),i=0;return Ys(t,(function(t,n){delete e[n],Ys(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 Ko:if(!w.x||!w.y){y=!1;break}e=bl(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?ls:os:w.x<0&&(c-=d,a=w.y>0?as:ss),w.y<0&&(u-=b),this.cropped||(el(this.cropBox,us),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()),Ys(l,(function(t){t.startX=t.endX,t.startY=t.endY}))}},Al={crop:function(){return!this.ready||this.cropped||this.disabled||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&tl(this.dragBox,hs),el(this.cropBox,us),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=Xs({},this.initialImageData),this.canvasData=Xs({},this.initialCanvasData),this.cropBoxData=Xs({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(Xs(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),el(this.dragBox,hs),tl(this.cropBox,us)),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,Ys(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,el(this.cropper,cs)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,tl(this.cropper,cs)),this},destroy:function(){var t=this.element;return t[Xo]?(t[Xo]=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(Hs(t)?t:n+Number(t),Hs(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&&(Ps(t)&&(i.left=t,n=!0),Ps(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===dl(this.element,Ms,{ratio:t,oldRatio:s/a,originalEvent:i}))return this;if(i){var d=this.pointers,b=bl(this.cropper),h=d&&Object.keys(d).length?function(t){var e=0,i=0,n=0;return Ys(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)*((h.pageX-b.left-o.left)/s),o.top-=(u-l)*((h.pageY-b.top-o.top)/l)}else Us(e)&&Ps(e.x)&&Ps(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 Ps(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,Ps(e)?e:1)},scaleY:function(t){var e=this.imageData.scaleX;return this.scale(Ps(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&&(Ps(t)&&(i.scaleX=t,n=!0),Ps(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(Ys(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&&Us(t)){var s=!1;e.rotatable&&Ps(t.rotate)&&t.rotate!==i.rotate&&(i.rotate=t.rotate,s=!0),e.scalable&&(Ps(t.scaleX)&&t.scaleX!==i.scaleX&&(i.scaleX=t.scaleX,s=!0),Ps(t.scaleY)&&t.scaleY!==i.scaleY&&(i.scaleY=t.scaleY,s=!0)),s&&this.renderCanvas(!0,!0);var l=i.width/i.naturalWidth;Ps(t.x)&&(o.left=t.x*l+n.left),Ps(t.y)&&(o.top=t.y*l+n.top),Ps(t.width)&&(o.width=t.width*l),Ps(t.height)&&(o.height=t.height*l),this.setCropBoxData(o)}return this},getContainerData:function(){return this.ready?Xs({},this.containerData):{}},getImageData:function(){return this.sized?Xs({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,e={};return this.ready&&Ys(["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&&Us(t)&&(Ps(t.left)&&(e.left=t.left),Ps(t.top)&&(e.top=t.top),Ps(t.width)?(e.width=t.width,e.height=t.width/i):Ps(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&&Us(t)&&(Ps(t.left)&&(n.left=t.left),Ps(t.top)&&(n.top=t.top),Ps(t.width)&&t.width!==n.width&&(e=!0,n.width=t.width),Ps(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=function(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,h=i.aspectRatio,p=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,k=void 0===S?1/0:S,_=n.maxHeight,C=void 0===_?1/0:_,E=n.minWidth,L=void 0===E?0:E,A=n.minHeight,q=void 0===A?0:A,T=document.createElement("canvas"),M=T.getContext("2d"),R=yl({aspectRatio:h,width:k,height:C}),O=yl({aspectRatio:h,width:L,height:q},"cover"),z=Math.min(R.width,Math.max(O.width,p)),I=Math.min(R.height,Math.max(O.height,m)),B=yl({aspectRatio:o,width:k,height:C}),N=yl({aspectRatio:o,width:L,height:q},"cover"),D=Math.min(B.width,Math.max(N.width,s)),P=Math.min(B.height,Math.max(N.height,l)),$=[-D/2,-P/2,D,P];return T.width=Ks(z),T.height=Ks(I),M.fillStyle=f,M.fillRect(0,0,z,I),M.save(),M.translate(z/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(jo($.map((function(t){return Math.floor(Ks(t))}))))),M.restore(),T}(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=yl({aspectRatio:c,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),d=yl({aspectRatio:c,width:t.minWidth||0,height:t.minHeight||0},"cover"),b=yl({aspectRatio:c,width:t.width||(1!==r?i.width:l),height:t.height||(1!==r?i.height:a)}),h=b.width,p=b.height;h=Math.min(u.width,Math.max(d.width,h)),p=Math.min(u.height,Math.max(d.height,p));var m=document.createElement("canvas"),g=m.getContext("2d");m.width=Ks(h),m.height=Ks(p),g.fillStyle=t.fillColor||"transparent",g.fillRect(0,0,h,p);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,E=i.width,L=i.height,A=o,q=s;A<=-l||A>E?(A=0,x=0,S=0,_=0):A<=0?(S=-A,A=0,_=x=Math.min(E,l+A)):A<=E&&(S=0,_=x=Math.min(l,E-A)),x<=0||q<=-a||q>L?(q=0,w=0,k=0,C=0):q<=0?(k=-q,q=0,C=w=Math.min(L,a+q)):q<=L&&(k=0,C=w=Math.min(a,L-q));var T=[A,q,x,w];if(_>0&&C>0){var M=h/l;T.push(S*M,k*M,_*M,C*M)}return g.drawImage.apply(g,[i].concat(jo(T.map((function(t){return Math.floor(Ks(t))}))))),m},setAspectRatio:function(t){var e=this.options;return this.disabled||Hs(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===fs,s=e.movable&&t===vs;t=o||s?t:ys,e.dragMode=t,ll(i,ms,t),il(i,rs,o),il(i,ps,s),e.cropBoxMovable||(ll(n,ms,t),il(n,rs,o),il(n,ps,s))}return this}},ql=Go.Cropper,Tl=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e||!Bs.test(e.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=e,this.options=Xs({},Ns,Us(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[Xo]){if(e[Xo]=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(zs.test(t))Is.test(t)?this.read((o=t.replace(wl,""),s=atob(o),l=new ArrayBuffer(s.length),Ys(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")!==Rs&&r.abort()},r.onload=function(){e.read(r.response)},r.onloadend=function(){e.reloading=!1,e.xhr=null},n.checkCrossOrigin&&ml(t)&&i.crossOrigin&&(t=gl(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=Sl(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(xl.apply(null,Vs(n.subarray(0,8192)))),n=n.subarray(8192);return"data:".concat(e,";base64,").concat(btoa(i.join("")))}(t,Rs);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&&ml(e)&&(i||(i="anonymous"),n=gl(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),tl(o,ds),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=Go.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(Go.navigator.userAgent),n=function(e,i){Xs(t.imageData,{naturalWidth:e,naturalHeight:i,aspectRatio:e/i}),t.initialImageData=Xs({},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(Xo,"-container")),l=s.querySelector(".".concat(Xo,"-canvas")),a=s.querySelector(".".concat(Xo,"-drag-box")),r=s.querySelector(".".concat(Xo,"-crop-box")),c=r.querySelector(".".concat(Xo,"-face"));this.container=n,this.cropper=s,this.canvas=l,this.dragBox=a,this.cropBox=r,this.viewBox=s.querySelector(".".concat(Xo,"-view-box")),this.face=c,l.appendChild(i),tl(t,us),n.insertBefore(s,t.nextSibling),this.isImg||el(i,ds),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,tl(r,us),e.guides||tl(r.getElementsByClassName("".concat(Xo,"-dashed")),us),e.center||tl(r.getElementsByClassName("".concat(Xo,"-center")),us),e.background&&tl(s,"".concat(Xo,"-bg")),e.highlight||tl(c,bs),e.cropBoxMovable&&(tl(c,ps),ll(c,ms,Zo)),e.cropBoxResizable||(tl(r.getElementsByClassName("".concat(Xo,"-line")),us),tl(r.getElementsByClassName("".concat(Xo,"-point")),us)),this.render(),this.ready=!0,this.setDragMode(e.dragMode),e.autoCrop&&this.crop(),this.setData(e.data),Ws(e.ready)&&ul(t,As,e.ready,{once:!0}),dl(t,As)}}},{key:"unbuild",value:function(){this.ready&&(this.ready=!1,this.unbind(),this.resetPreview(),this.cropper.parentNode.removeChild(this.cropper),el(this.element,us))}},{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=ql,t}},{key:"setDefaults",value:function(t){Xs(Ns,Us(t)&&t)}}],i&&Ho(e.prototype,i),n&&Ho(e,n),t}();function Ml(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 Rl(t,e){return function(i){i&&(t[e]=i)}}function Ol(t,e,i){return function(n){n&&(t[e][i]=n)}}function zl(t,e){return function(i){var n=i.prototype;t.forEach((function(t){e(n,t)}))}}function Il(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})}))}}Xs(Tl.prototype,kl,_l,Cl,El,Ll,Al);var Bl=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}(),Nl=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}(),Dl="function"==typeof Map,Pl=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 $l=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 Pl;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 Hl(t,e,i){var n=Dl?Map:i?Nl:Bl,o=i||function(t){return t},s=[],l=[],a=[],r=t.map(o),c=e.map(o),u=new n,d=new n,b=[],h=[],p={},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)):p[i]=f})),c.forEach((function(t,e){var i=u.get(t);void 0===i?(s.push(e),++g):(a.push([i,e]),f=p[e]||0,b.push([i-f,e-g]),h.push(e===i),i!==e&&m.push([i,e]))})),l.reverse(),new $l(t,e,s,l,m,a,b,h)}var Fl=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=Hl(this.list,e,this.findKeyCallback);return this.list=e,i},t}(),jl="function",Ul="object",Wl="string",Gl="number",Vl="undefined",Yl=typeof window!==Vl,Xl=[{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:'\\"',close:'\\"'},{open:"\\'",close:"\\'"}],Zl=1e-7,Kl={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 Ql(t){return typeof t===Vl}function Jl(t){return t&&typeof t===Ul}function ta(t){return Array.isArray(t)}function ea(t){return typeof t===Wl}function ia(t){return typeof t===Gl}function na(t){return typeof t===jl}function oa(t,e,i,n,o){return sa(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&&!sa(t,e,i))return{value:i};var a=i,r=pa(o,(function(t){return t.open===l}));if(r&&(a=oa(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 sa(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 la(t,e){var i=ea(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?Xl: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"),h=t.split(b).filter(Boolean),p=h.length,m=[],g=[];function f(){return!!g.length&&(m.push(g.join("")),g=[],!0)}for(var v,y=function(t){var e=h[t].trim(),i=t,n=pa(u,(function(t){return t.open===e})),a=pa(u,(function(t){return t.close===e}));if(n){if(-1!==(i=oa(n,h,t,p,u))&&r)return f()&&s?(v=t,"break"):(m.push(h.slice(t,i+1).join("")),t=i,s?(v=t,"break"):(v=t,"continue"))}else{if(a&&!sa(a,h,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=p-1),g.push(h.slice(t,i+1).join("")),v=t=i},x=0;x<p;++x){var w=y(x);if(x=v,"break"===w)break}return g.length&&m.push(g.join("")),m}function aa(t){return la(t,"")}function ra(t){return la(t,",")}function ca(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 ua(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 da(t,e){return void 0===e&&(e="-"),t.replace(/([a-z])([A-Z])/g,(function(t,i,n){return""+i+e+n.toLowerCase()}))}function ba(){return Date.now?Date.now():(new Date).getTime()}function ha(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 pa(t,e,i){var n=ha(t,e);return n>-1?t[n]:i}var ma=function(){var t=ba(),e=Yl&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame);return e?e.bind(window):function(e){var i=ba();return window.setTimeout((function(){e(i-t)}),1e3/60)}}(),ga=function(){var t=Yl&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame);return t?t.bind(window):function(t){clearTimeout(t)}}();function fa(t){if(Object.keys)return Object.keys(t);var e=[];for(var i in e)e.push(i);return e}function va(t,e){var i=ua(t),n=i.value,o=i.unit;if(Jl(e)){var s=e[o];if(s){if(na(s))return s(n);if(Kl[o])return Kl[o](n,s)}}else if("%"===o)return n*e/100;return Kl[o]?Kl[o](n):n}function ya(t,e,i,n){return void 0===n&&(n=t[0]/t[1]),[[Ca(e[0],Zl),Ca(e[0]/n,Zl)],[Ca(e[1]*n,Zl),Ca(e[1],Zl)]].filter((function(t){return t.every((function(t,n){var o=e[n],s=Ca(o,Zl);return i?t<=o||t<=s:t>=o||t>=s}))}))[0]||t}function xa(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=ya(t,e,!1,l),r=a[0],c=a[1],u=ya(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 wa(t){for(var e=t.length,i=0,n=e-1;n>=0;--n)i+=t[n];return e?i/e:0}function Sa(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 ka(t){var e=function(t){return[0,1].map((function(e){return wa(t.map((function(t){return t[e]})))}))}(t),i=Sa(e,t[0]),n=Sa(e,t[1]);return i<n&&n-i<Math.PI||i>n&&n-i<-Math.PI?1:-1}function _a(t,e){return Math.sqrt(Math.pow((e?e[0]:0)-t[0],2)+Math.pow((e?e[1]:0)-t[1],2))}function Ca(t,e){if(!e)return t;var i=1/e;return Math.round(t/e)/i}function Ea(t,e){return t.forEach((function(i,n){t[n]=Ca(t[n],e)})),t}function La(t,e){return t.classList?t.classList.contains(e):!!t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))}function Aa(t,e,i,n){t.addEventListener(e,i,n)}function qa(t,e,i,n){t.removeEventListener(e,i,n)}
29
+ */(t)}},!1));const b=document.querySelector(".is-design-list");let h=t.opts.snippetPath,p=t.opts.snippetJSON.snippets,m=t.opts.slider;if(null!=m)if("slick"===m){const e=t=>"glide"!==t.type;t.opts.snippetJSON.snippets=p.filter(e)}else if("glide"===m){const e=t=>"slick"!==t.type;t.opts.snippetJSON.snippets=p.filter(e)}else if("all"===m);else{const e=t=>"glide"!==t.type&&"slick"!==t.type;t.opts.snippetJSON.snippets=p.filter(e)}else{var g=!0;if(t.win.jQuery&&t.win.jQuery.fn.slick&&(g=!1),g){const t=p.filter((t=>"slick"!==t.type));p=[...t]}if(!t.win.Glide){const t=p.filter((t=>!(t.glide||"glide"===t.type)));p=[...t]}t.opts.snippetJSON.snippets=[...p]}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="'+h+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="'+h+e.thumbnail+'"><span class="is-overlay"></span></div>'),y++})),new po(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",(()=>{No(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(){No(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 No(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 Do(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 Po(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Do(Object(i),!0).forEach((function(e){Fo(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Do(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function $o(t){return $o="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},$o(t)}function Ho(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 Fo(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function jo(t){return function(t){if(Array.isArray(t))return Uo(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 Uo(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 Uo(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 Uo(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 Wo="undefined"!=typeof window&&void 0!==window.document,Go=Wo?window:{},Vo=!(!Wo||!Go.document.documentElement)&&"ontouchstart"in Go.document.documentElement,Yo=!!Wo&&"PointerEvent"in Go,Xo="cropper",Zo="all",Ko="crop",Qo="move",Jo="zoom",ts="e",es="w",is="s",ns="n",os="ne",ss="nw",ls="se",as="sw",rs="".concat(Xo,"-crop"),cs="".concat(Xo,"-disabled"),us="".concat(Xo,"-hidden"),ds="".concat(Xo,"-hide"),bs="".concat(Xo,"-invisible"),hs="".concat(Xo,"-modal"),ps="".concat(Xo,"-move"),ms="".concat(Xo,"Action"),gs="".concat(Xo,"Preview"),fs="crop",vs="move",ys="none",xs="crop",ws="cropend",Ss="cropmove",ks="cropstart",_s="dblclick",Cs=Yo?"pointerdown":Vo?"touchstart":"mousedown",Es=Yo?"pointermove":Vo?"touchmove":"mousemove",Ls=Yo?"pointerup pointercancel":Vo?"touchend touchcancel":"mouseup",As="ready",qs="resize",Ts="wheel",Ms="zoom",Rs="image/jpeg",Os=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,zs=/^data:/,Is=/^data:image\/jpeg;base64,/,Bs=/^img|canvas$/i,Ns={viewMode:0,dragMode:fs,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},Ds=Number.isNaN||Go.isNaN;function Ps(t){return"number"==typeof t&&!Ds(t)}var $s=function(t){return t>0&&t<1/0};function Hs(t){return void 0===t}function Fs(t){return"object"===$o(t)&&null!==t}var js=Object.prototype.hasOwnProperty;function Us(t){if(!Fs(t))return!1;try{var e=t.constructor,i=e.prototype;return e&&i&&js.call(i,"isPrototypeOf")}catch(t){return!1}}function Ws(t){return"function"==typeof t}var Gs=Array.prototype.slice;function Vs(t){return Array.from?Array.from(t):Gs.call(t)}function Ys(t,e){return t&&Ws(e)&&(Array.isArray(t)||Ps(t.length)?Vs(t).forEach((function(i,n){e.call(t,i,n,t)})):Fs(t)&&Object.keys(t).forEach((function(i){e.call(t,t[i],i,t)}))),t}var Xs=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 Fs(t)&&i.length>0&&i.forEach((function(e){Fs(e)&&Object.keys(e).forEach((function(i){t[i]=e[i]}))})),t},Zs=/\.\d*(?:0|9){12}\d*$/;function Ks(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return Zs.test(t)?Math.round(t*e)/e:t}var Qs=/^width|height|left|top|marginLeft|marginTop$/;function Js(t,e){var i=t.style;Ys(e,(function(t,e){Qs.test(e)&&Ps(t)&&(t="".concat(t,"px")),i[e]=t}))}function tl(t,e){if(e)if(Ps(t.length))Ys(t,(function(t){tl(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 el(t,e){e&&(Ps(t.length)?Ys(t,(function(t){el(t,e)})):t.classList?t.classList.remove(e):t.className.indexOf(e)>=0&&(t.className=t.className.replace(e,"")))}function il(t,e,i){e&&(Ps(t.length)?Ys(t,(function(t){il(t,e,i)})):i?tl(t,e):el(t,e))}var nl=/([a-z\d])([A-Z])/g;function ol(t){return t.replace(nl,"$1-$2").toLowerCase()}function sl(t,e){return Fs(t[e])?t[e]:t.dataset?t.dataset[e]:t.getAttribute("data-".concat(ol(e)))}function ll(t,e,i){Fs(i)?t[e]=i:t.dataset?t.dataset[e]=i:t.setAttribute("data-".concat(ol(e)),i)}var al=/\s\s*/,rl=function(){var t=!1;if(Wo){var e=!1,i=function(){},n=Object.defineProperty({},"once",{get:function(){return t=!0,e},set:function(t){e=t}});Go.addEventListener("test",i,n),Go.removeEventListener("test",i,n)}return t}();function cl(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i;e.trim().split(al).forEach((function(e){if(!rl){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 ul(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=i;e.trim().split(al).forEach((function(e){if(n.once&&!rl){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 dl(t,e,i){var n;return Ws(Event)&&Ws(CustomEvent)?n=new CustomEvent(e,{detail:i,bubbles:!0,cancelable:!0}):(n=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,i),t.dispatchEvent(n)}function bl(t){var e=t.getBoundingClientRect();return{left:e.left+(window.pageXOffset-document.documentElement.clientLeft),top:e.top+(window.pageYOffset-document.documentElement.clientTop)}}var hl=Go.location,pl=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function ml(t){var e=t.match(pl);return null!==e&&(e[1]!==hl.protocol||e[2]!==hl.hostname||e[3]!==hl.port)}function gl(t){var e="timestamp=".concat((new Date).getTime());return t+(-1===t.indexOf("?")?"?":"&")+e}function fl(t){var e=t.rotate,i=t.scaleX,n=t.scaleY,o=t.translateX,s=t.translateY,l=[];Ps(o)&&0!==o&&l.push("translateX(".concat(o,"px)")),Ps(s)&&0!==s&&l.push("translateY(".concat(s,"px)")),Ps(e)&&0!==e&&l.push("rotate(".concat(e,"deg)")),Ps(i)&&1!==i&&l.push("scaleX(".concat(i,")")),Ps(n)&&1!==n&&l.push("scaleY(".concat(n,")"));var a=l.length?l.join(" "):"none";return{WebkitTransform:a,msTransform:a,transform:a}}function vl(t,e){var i=t.pageX,n=t.pageY,o={endX:i,endY:n};return e?o:Po({startX:i,startY:n},o)}function yl(t){var e=t.aspectRatio,i=t.height,n=t.width,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"contain",s=$s(n),l=$s(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}}var xl=String.fromCharCode;var wl=/^data:.*,/;function Sl(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+=xl(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,h=i.getUint16(s,n);for(b=0;b<h;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 kl={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);tl(n,us),el(t,us);var l={width:Math.max(i.offsetWidth,o>=0?o:200),height:Math.max(i.offsetHeight,s>=0?s:100)};this.containerData=l,Js(n,{width:l.width,height:l.height}),tl(t,us),el(n,us)},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=Xs({},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=yl({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,h=n.height-o.height;o.minLeft=Math.min(0,b),o.minTop=Math.min(0,h),o.maxLeft=Math.max(0,b),o.maxTop=Math.max(0,h),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,h),o.maxTop=Math.max(0,h))))}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,Js(this.canvas,Xs({width:i.width,height:i.height},fl({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);Xs(i,{width:n,height:o,left:(e.width-n)/2,top:(e.height-o)/2}),Js(this.image,Xs({width:i.width,height:i.height},fl(Xs({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=Xs({},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&&ll(this.face,ms,i.width>=e.width&&i.height>=e.height?Qo:Zo),Js(this.cropBox,Xs({width:i.width,height:i.height},fl({translateX:i.left,translateY:i.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),dl(this.element,xs,this.getData())}},_l={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,Ys(l,(function(t){var i=document.createElement("img");ll(t,gs,{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(){Ys(this.previews,(function(t){var e=sl(t,gs);Js(t,{width:e.width,height:e.height}),t.innerHTML=e.html,function(t,e){if(Fs(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(ol(e)))}(t,gs)}))},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&&(Js(this.viewBoxImage,Xs({width:s,height:l},fl(Xs({translateX:-a,translateY:-r},t)))),Ys(this.previews,(function(e){var i=sl(e,gs),c=i.width,u=i.height,d=c,b=u,h=1;n&&(b=o*(h=c/n)),o&&b>u&&(d=n*(h=u/o),b=u),Js(e,{width:d,height:b}),Js(e.getElementsByTagName("img")[0],Xs({width:s*h,height:l*h},fl(Xs({translateX:-a*h,translateY:-r*h},t))))})))}},Cl={bind:function(){var t=this.element,e=this.options,i=this.cropper;Ws(e.cropstart)&&ul(t,ks,e.cropstart),Ws(e.cropmove)&&ul(t,Ss,e.cropmove),Ws(e.cropend)&&ul(t,ws,e.cropend),Ws(e.crop)&&ul(t,xs,e.crop),Ws(e.zoom)&&ul(t,Ms,e.zoom),ul(i,Cs,this.onCropStart=this.cropStart.bind(this)),e.zoomable&&e.zoomOnWheel&&ul(i,Ts,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&ul(i,_s,this.onDblclick=this.dblclick.bind(this)),ul(t.ownerDocument,Es,this.onCropMove=this.cropMove.bind(this)),ul(t.ownerDocument,Ls,this.onCropEnd=this.cropEnd.bind(this)),e.responsive&&ul(window,qs,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,e=this.options,i=this.cropper;Ws(e.cropstart)&&cl(t,ks,e.cropstart),Ws(e.cropmove)&&cl(t,Ss,e.cropmove),Ws(e.cropend)&&cl(t,ws,e.cropend),Ws(e.crop)&&cl(t,xs,e.crop),Ws(e.zoom)&&cl(t,Ms,e.zoom),cl(i,Cs,this.onCropStart),e.zoomable&&e.zoomOnWheel&&cl(i,Ts,this.onWheel,{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&cl(i,_s,this.onDblclick),cl(t.ownerDocument,Es,this.onCropMove),cl(t.ownerDocument,Ls,this.onCropEnd),e.responsive&&cl(window,qs,this.onResize)}},El={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(Ys(t,(function(e,i){t[i]=e*a}))),this.setCropBoxData(Ys(e,(function(t,i){e[i]=t*a}))))}},dblclick:function(){var t,e;this.disabled||this.options.dragMode===ys||this.setDragMode((t=this.dragBox,e=rs,(t.classList?t.classList.contains(e):t.className.indexOf(e)>-1)?vs:fs))},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)&&(Ps(e)&&1!==e||Ps(i)&&0!==i||t.ctrlKey))){var n,o=this.options,s=this.pointers;t.changedTouches?Ys(t.changedTouches,(function(t){s[t.identifier]=vl(t)})):s[t.pointerId||0]=vl(t),n=Object.keys(s).length>1&&o.zoomable&&o.zoomOnTouch?Jo:sl(t.target,ms),Os.test(n)&&!1!==dl(this.element,ks,{originalEvent:t,action:n})&&(t.preventDefault(),this.action=n,this.cropping=!1,n===Ko&&(this.cropping=!0,tl(this.dragBox,hs)))}},cropMove:function(t){var e=this.action;if(!this.disabled&&e){var i=this.pointers;t.preventDefault(),!1!==dl(this.element,Ss,{originalEvent:t,action:e})&&(t.changedTouches?Ys(t.changedTouches,(function(t){Xs(i[t.identifier]||{},vl(t,!0))})):Xs(i[t.pointerId||0]||{},vl(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var e=this.action,i=this.pointers;t.changedTouches?Ys(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,il(this.dragBox,hs,this.cropped&&this.options.modal)),dl(this.element,ws,{originalEvent:t,action:e}))}}},Ll={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,h=c+d,p=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 ts:h+w.x>f&&(w.x=f-h);break;case es:c+w.x<m&&(w.x=m-c);break;case ns:u+w.y<g&&(w.y=g-u);break;case is:p+w.y>v&&(w.y=v-p)}};switch(a){case Zo:c+=w.x,u+=w.y;break;case ts:if(w.x>=0&&(h>=f||r&&(u<=g||p>=v))){y=!1;break}S(ts),(d+=w.x)<0&&(a=es,c-=d=-d),r&&(b=d/r,u+=(s.height-b)/2);break;case ns:if(w.y<=0&&(u<=g||r&&(c<=m||h>=f))){y=!1;break}S(ns),b-=w.y,u+=w.y,b<0&&(a=is,u-=b=-b),r&&(d=b*r,c+=(s.width-d)/2);break;case es:if(w.x<=0&&(c<=m||r&&(u<=g||p>=v))){y=!1;break}S(es),d-=w.x,c+=w.x,d<0&&(a=ts,c-=d=-d),r&&(b=d/r,u+=(s.height-b)/2);break;case is:if(w.y>=0&&(p>=v||r&&(c<=m||h>=f))){y=!1;break}S(is),(b+=w.y)<0&&(a=ns,u-=b=-b),r&&(d=b*r,c+=(s.width-d)/2);break;case os:if(r){if(w.y<=0&&(u<=g||h>=f)){y=!1;break}S(ns),b-=w.y,u+=w.y,d=b*r}else S(ns),S(ts),w.x>=0?h<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=as,u-=b=-b,c-=d=-d):d<0?(a=ss,c-=d=-d):b<0&&(a=ls,u-=b=-b);break;case ss:if(r){if(w.y<=0&&(u<=g||c<=m)){y=!1;break}S(ns),b-=w.y,u+=w.y,d=b*r,c+=s.width-d}else S(ns),S(es),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=ls,u-=b=-b,c-=d=-d):d<0?(a=os,c-=d=-d):b<0&&(a=as,u-=b=-b);break;case as:if(r){if(w.x<=0&&(c<=m||p>=v)){y=!1;break}S(es),d-=w.x,c+=w.x,b=d/r}else S(is),S(es),w.x<=0?c>m?(d-=w.x,c+=w.x):w.y>=0&&p>=v&&(y=!1):(d-=w.x,c+=w.x),w.y>=0?p<v&&(b+=w.y):b+=w.y;d<0&&b<0?(a=os,u-=b=-b,c-=d=-d):d<0?(a=ls,c-=d=-d):b<0&&(a=ss,u-=b=-b);break;case ls:if(r){if(w.x>=0&&(h>=f||p>=v)){y=!1;break}S(ts),b=(d+=w.x)/r}else S(is),S(ts),w.x>=0?h<f?d+=w.x:w.y>=0&&p>=v&&(y=!1):d+=w.x,w.y>=0?p<v&&(b+=w.y):b+=w.y;d<0&&b<0?(a=ss,u-=b=-b,c-=d=-d):d<0?(a=as,c-=d=-d):b<0&&(a=os,u-=b=-b);break;case Qo:this.move(w.x,w.y),y=!1;break;case Jo:this.zoom(function(t){var e=Po({},t),i=0;return Ys(t,(function(t,n){delete e[n],Ys(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 Ko:if(!w.x||!w.y){y=!1;break}e=bl(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?ls:os:w.x<0&&(c-=d,a=w.y>0?as:ss),w.y<0&&(u-=b),this.cropped||(el(this.cropBox,us),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()),Ys(l,(function(t){t.startX=t.endX,t.startY=t.endY}))}},Al={crop:function(){return!this.ready||this.cropped||this.disabled||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&tl(this.dragBox,hs),el(this.cropBox,us),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=Xs({},this.initialImageData),this.canvasData=Xs({},this.initialCanvasData),this.cropBoxData=Xs({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(Xs(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),el(this.dragBox,hs),tl(this.cropBox,us)),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,Ys(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,el(this.cropper,cs)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,tl(this.cropper,cs)),this},destroy:function(){var t=this.element;return t[Xo]?(t[Xo]=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(Hs(t)?t:n+Number(t),Hs(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&&(Ps(t)&&(i.left=t,n=!0),Ps(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===dl(this.element,Ms,{ratio:t,oldRatio:s/a,originalEvent:i}))return this;if(i){var d=this.pointers,b=bl(this.cropper),h=d&&Object.keys(d).length?function(t){var e=0,i=0,n=0;return Ys(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)*((h.pageX-b.left-o.left)/s),o.top-=(u-l)*((h.pageY-b.top-o.top)/l)}else Us(e)&&Ps(e.x)&&Ps(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 Ps(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,Ps(e)?e:1)},scaleY:function(t){var e=this.imageData.scaleX;return this.scale(Ps(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&&(Ps(t)&&(i.scaleX=t,n=!0),Ps(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(Ys(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&&Us(t)){var s=!1;e.rotatable&&Ps(t.rotate)&&t.rotate!==i.rotate&&(i.rotate=t.rotate,s=!0),e.scalable&&(Ps(t.scaleX)&&t.scaleX!==i.scaleX&&(i.scaleX=t.scaleX,s=!0),Ps(t.scaleY)&&t.scaleY!==i.scaleY&&(i.scaleY=t.scaleY,s=!0)),s&&this.renderCanvas(!0,!0);var l=i.width/i.naturalWidth;Ps(t.x)&&(o.left=t.x*l+n.left),Ps(t.y)&&(o.top=t.y*l+n.top),Ps(t.width)&&(o.width=t.width*l),Ps(t.height)&&(o.height=t.height*l),this.setCropBoxData(o)}return this},getContainerData:function(){return this.ready?Xs({},this.containerData):{}},getImageData:function(){return this.sized?Xs({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,e={};return this.ready&&Ys(["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&&Us(t)&&(Ps(t.left)&&(e.left=t.left),Ps(t.top)&&(e.top=t.top),Ps(t.width)?(e.width=t.width,e.height=t.width/i):Ps(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&&Us(t)&&(Ps(t.left)&&(n.left=t.left),Ps(t.top)&&(n.top=t.top),Ps(t.width)&&t.width!==n.width&&(e=!0,n.width=t.width),Ps(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=function(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,h=i.aspectRatio,p=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,k=void 0===S?1/0:S,_=n.maxHeight,C=void 0===_?1/0:_,E=n.minWidth,L=void 0===E?0:E,A=n.minHeight,q=void 0===A?0:A,T=document.createElement("canvas"),M=T.getContext("2d"),R=yl({aspectRatio:h,width:k,height:C}),O=yl({aspectRatio:h,width:L,height:q},"cover"),z=Math.min(R.width,Math.max(O.width,p)),I=Math.min(R.height,Math.max(O.height,m)),B=yl({aspectRatio:o,width:k,height:C}),N=yl({aspectRatio:o,width:L,height:q},"cover"),D=Math.min(B.width,Math.max(N.width,s)),P=Math.min(B.height,Math.max(N.height,l)),$=[-D/2,-P/2,D,P];return T.width=Ks(z),T.height=Ks(I),M.fillStyle=f,M.fillRect(0,0,z,I),M.save(),M.translate(z/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(jo($.map((function(t){return Math.floor(Ks(t))}))))),M.restore(),T}(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=yl({aspectRatio:c,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),d=yl({aspectRatio:c,width:t.minWidth||0,height:t.minHeight||0},"cover"),b=yl({aspectRatio:c,width:t.width||(1!==r?i.width:l),height:t.height||(1!==r?i.height:a)}),h=b.width,p=b.height;h=Math.min(u.width,Math.max(d.width,h)),p=Math.min(u.height,Math.max(d.height,p));var m=document.createElement("canvas"),g=m.getContext("2d");m.width=Ks(h),m.height=Ks(p),g.fillStyle=t.fillColor||"transparent",g.fillRect(0,0,h,p);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,E=i.width,L=i.height,A=o,q=s;A<=-l||A>E?(A=0,x=0,S=0,_=0):A<=0?(S=-A,A=0,_=x=Math.min(E,l+A)):A<=E&&(S=0,_=x=Math.min(l,E-A)),x<=0||q<=-a||q>L?(q=0,w=0,k=0,C=0):q<=0?(k=-q,q=0,C=w=Math.min(L,a+q)):q<=L&&(k=0,C=w=Math.min(a,L-q));var T=[A,q,x,w];if(_>0&&C>0){var M=h/l;T.push(S*M,k*M,_*M,C*M)}return g.drawImage.apply(g,[i].concat(jo(T.map((function(t){return Math.floor(Ks(t))}))))),m},setAspectRatio:function(t){var e=this.options;return this.disabled||Hs(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===fs,s=e.movable&&t===vs;t=o||s?t:ys,e.dragMode=t,ll(i,ms,t),il(i,rs,o),il(i,ps,s),e.cropBoxMovable||(ll(n,ms,t),il(n,rs,o),il(n,ps,s))}return this}},ql=Go.Cropper,Tl=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),!e||!Bs.test(e.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=e,this.options=Xs({},Ns,Us(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[Xo]){if(e[Xo]=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(zs.test(t))Is.test(t)?this.read((o=t.replace(wl,""),s=atob(o),l=new ArrayBuffer(s.length),Ys(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")!==Rs&&r.abort()},r.onload=function(){e.read(r.response)},r.onloadend=function(){e.reloading=!1,e.xhr=null},n.checkCrossOrigin&&ml(t)&&i.crossOrigin&&(t=gl(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=Sl(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(xl.apply(null,Vs(n.subarray(0,8192)))),n=n.subarray(8192);return"data:".concat(e,";base64,").concat(btoa(i.join("")))}(t,Rs);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&&ml(e)&&(i||(i="anonymous"),n=gl(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),tl(o,ds),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=Go.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(Go.navigator.userAgent),n=function(e,i){Xs(t.imageData,{naturalWidth:e,naturalHeight:i,aspectRatio:e/i}),t.initialImageData=Xs({},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(Xo,"-container")),l=s.querySelector(".".concat(Xo,"-canvas")),a=s.querySelector(".".concat(Xo,"-drag-box")),r=s.querySelector(".".concat(Xo,"-crop-box")),c=r.querySelector(".".concat(Xo,"-face"));this.container=n,this.cropper=s,this.canvas=l,this.dragBox=a,this.cropBox=r,this.viewBox=s.querySelector(".".concat(Xo,"-view-box")),this.face=c,l.appendChild(i),tl(t,us),n.insertBefore(s,t.nextSibling),this.isImg||el(i,ds),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,tl(r,us),e.guides||tl(r.getElementsByClassName("".concat(Xo,"-dashed")),us),e.center||tl(r.getElementsByClassName("".concat(Xo,"-center")),us),e.background&&tl(s,"".concat(Xo,"-bg")),e.highlight||tl(c,bs),e.cropBoxMovable&&(tl(c,ps),ll(c,ms,Zo)),e.cropBoxResizable||(tl(r.getElementsByClassName("".concat(Xo,"-line")),us),tl(r.getElementsByClassName("".concat(Xo,"-point")),us)),this.render(),this.ready=!0,this.setDragMode(e.dragMode),e.autoCrop&&this.crop(),this.setData(e.data),Ws(e.ready)&&ul(t,As,e.ready,{once:!0}),dl(t,As)}}},{key:"unbuild",value:function(){this.ready&&(this.ready=!1,this.unbind(),this.resetPreview(),this.cropper.parentNode.removeChild(this.cropper),el(this.element,us))}},{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=ql,t}},{key:"setDefaults",value:function(t){Xs(Ns,Us(t)&&t)}}],i&&Ho(e.prototype,i),n&&Ho(e,n),t}();function Ml(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 Rl(t,e){return function(i){i&&(t[e]=i)}}function Ol(t,e,i){return function(n){n&&(t[e][i]=n)}}function zl(t,e){return function(i){var n=i.prototype;t.forEach((function(t){e(n,t)}))}}function Il(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})}))}}Xs(Tl.prototype,kl,_l,Cl,El,Ll,Al);var Bl=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}(),Nl=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}(),Dl="function"==typeof Map,Pl=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 $l=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 Pl;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 Hl(t,e,i){var n=Dl?Map:i?Nl:Bl,o=i||function(t){return t},s=[],l=[],a=[],r=t.map(o),c=e.map(o),u=new n,d=new n,b=[],h=[],p={},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)):p[i]=f})),c.forEach((function(t,e){var i=u.get(t);void 0===i?(s.push(e),++g):(a.push([i,e]),f=p[e]||0,b.push([i-f,e-g]),h.push(e===i),i!==e&&m.push([i,e]))})),l.reverse(),new $l(t,e,s,l,m,a,b,h)}var Fl=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=Hl(this.list,e,this.findKeyCallback);return this.list=e,i},t}(),jl="function",Ul="object",Wl="string",Gl="number",Vl="undefined",Yl=typeof window!==Vl,Xl=[{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:'\\"',close:'\\"'},{open:"\\'",close:"\\'"}],Zl=1e-7,Kl={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 Ql(t){return typeof t===Vl}function Jl(t){return t&&typeof t===Ul}function ta(t){return Array.isArray(t)}function ea(t){return typeof t===Wl}function ia(t){return typeof t===Gl}function na(t){return typeof t===jl}function oa(t,e,i,n,o){return sa(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&&!sa(t,e,i))return{value:i};var a=i,r=pa(o,(function(t){return t.open===l}));if(r&&(a=oa(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 sa(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 la(t,e){var i=ea(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?Xl: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"),h=t.split(b).filter(Boolean),p=h.length,m=[],g=[];function f(){return!!g.length&&(m.push(g.join("")),g=[],!0)}for(var v,y=function(t){var e=h[t].trim(),i=t,n=pa(u,(function(t){return t.open===e})),a=pa(u,(function(t){return t.close===e}));if(n){if(-1!==(i=oa(n,h,t,p,u))&&r)return f()&&s?(v=t,"break"):(m.push(h.slice(t,i+1).join("")),t=i,s?(v=t,"break"):(v=t,"continue"))}else{if(a&&!sa(a,h,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=p-1),g.push(h.slice(t,i+1).join("")),v=t=i},x=0;x<p;++x){var w=y(x);if(x=v,"break"===w)break}return g.length&&m.push(g.join("")),m}function aa(t){return la(t,"")}function ra(t){return la(t,",")}function ca(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 ua(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 da(t,e){return void 0===e&&(e="-"),t.replace(/([a-z])([A-Z])/g,(function(t,i,n){return""+i+e+n.toLowerCase()}))}function ba(){return Date.now?Date.now():(new Date).getTime()}function ha(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 pa(t,e,i){var n=ha(t,e);return n>-1?t[n]:i}var ma=function(){var t=ba(),e=Yl&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame);return e?e.bind(window):function(e){var i=ba();return window.setTimeout((function(){e(i-t)}),1e3/60)}}(),ga=function(){var t=Yl&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame);return t?t.bind(window):function(t){clearTimeout(t)}}();function fa(t){if(Object.keys)return Object.keys(t);var e=[];for(var i in e)e.push(i);return e}function va(t,e){var i=ua(t),n=i.value,o=i.unit;if(Jl(e)){var s=e[o];if(s){if(na(s))return s(n);if(Kl[o])return Kl[o](n,s)}}else if("%"===o)return n*e/100;return Kl[o]?Kl[o](n):n}function ya(t,e,i,n){return void 0===n&&(n=t[0]/t[1]),[[Ca(e[0],Zl),Ca(e[0]/n,Zl)],[Ca(e[1]*n,Zl),Ca(e[1],Zl)]].filter((function(t){return t.every((function(t,n){var o=e[n],s=Ca(o,Zl);return i?t<=o||t<=s:t>=o||t>=s}))}))[0]||t}function xa(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=ya(t,e,!1,l),r=a[0],c=a[1],u=ya(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 wa(t){for(var e=t.length,i=0,n=e-1;n>=0;--n)i+=t[n];return e?i/e:0}function Sa(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 ka(t){var e=function(t){return[0,1].map((function(e){return wa(t.map((function(t){return t[e]})))}))}(t),i=Sa(e,t[0]),n=Sa(e,t[1]);return i<n&&n-i<Math.PI||i>n&&n-i<-Math.PI?1:-1}function _a(t,e){return Math.sqrt(Math.pow((e?e[0]:0)-t[0],2)+Math.pow((e?e[1]:0)-t[1],2))}function Ca(t,e){if(!e)return t;var i=1/e;return Math.round(t/e)/i}function Ea(t,e){return t.forEach((function(i,n){t[n]=Ca(t[n],e)})),t}function La(t,e){return t.classList?t.classList.contains(e):!!t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))}function Aa(t,e,i,n){t.addEventListener(e,i,n)}function qa(t,e,i,n){t.removeEventListener(e,i,n)}
30
30
  /*! *****************************************************************************
31
31
  Copyright (c) Microsoft Corporation. All rights reserved.
32
32
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use