@innovastudio/contentbox 1.6.118 → 1.6.119

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@innovastudio/contentbox",
3
3
  "type": "module",
4
- "version": "1.6.118",
4
+ "version": "1.6.119",
5
5
  "description": "",
6
6
  "main": "public/contentbox/contentbox.esm.js",
7
7
  "types": "index.d.ts",
@@ -59,7 +59,7 @@
59
59
  "ws": "^8.13.0"
60
60
  },
61
61
  "dependencies": {
62
- "@innovastudio/contentbuilder": "^1.5.115",
62
+ "@innovastudio/contentbuilder": "^1.5.116",
63
63
  "js-beautify": "^1.14.0",
64
64
  "sortablejs": "^1.15.2"
65
65
  }
@@ -44496,15 +44496,21 @@ const renderSnippetPanel = (builder, snippetOpen) => {
44496
44496
  if (slider === 'slick') {
44497
44497
  //remove glide
44498
44498
  const predicate = item => item.type !== 'glide';
44499
- builder.opts.snippetJSON.snippets = snippets.filter(predicate);
44499
+ // builder.opts.snippetJSON.snippets = snippets.filter(predicate);
44500
+ snippets = snippets.filter(predicate);
44501
+ builder.opts.snippetJSON.snippets = snippets;
44500
44502
  } else if (slider === 'glide') {
44501
44503
  //remove slick
44502
44504
  const predicate = item => item.type !== 'slick';
44503
- builder.opts.snippetJSON.snippets = snippets.filter(predicate);
44505
+ // builder.opts.snippetJSON.snippets = snippets.filter(predicate);
44506
+ snippets = snippets.filter(predicate);
44507
+ builder.opts.snippetJSON.snippets = snippets;
44504
44508
  } else if (slider === 'all') ; else {
44505
44509
  // remove all slider (if incorrect settings)
44506
44510
  const predicate = item => item.type !== 'glide' && item.type !== 'slick';
44507
- builder.opts.snippetJSON.snippets = snippets.filter(predicate);
44511
+ // builder.opts.snippetJSON.snippets = snippets.filter(predicate);
44512
+ snippets = snippets.filter(predicate);
44513
+ builder.opts.snippetJSON.snippets = snippets;
44508
44514
  }
44509
44515
 
44510
44516
  // for (let i = 0; i < builder.opts.snippetJSON.snippets.length; i++) {
@@ -37,7 +37,7 @@ var ContentBox=function(){"use strict";class t{appendHtml(t,e,i="beforeend"){t.i
37
37
  * Released under the MIT license
38
38
  *
39
39
  * Date: 2021-06-12T08:00:17.411Z
40
- */(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]}if(!t.win.FormViewer){const t=p.filter((t=>!("form"===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+""&&s.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+""&&s.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 Se(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 s=t.doc.querySelector("[data-new-dummy]");if(s){const t=s.parentNode,e=t.getBoundingClientRect();s.offsetWidth;let o=(i-s.offsetWidth/2-e.left)/t.offsetWidth*100,l=(n-s.offsetHeight/2-e.top)/t.offsetHeight*100;l<0&&(l=15),s.style.top=l+"%",s.style.left=o+"%",s.removeAttribute("data-new-dummy")}},onStart:()=>{f=null;const e=t.doc.querySelector(".builder-active");e&&(f=e,s.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&&s.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");s.addEventListener(n,"click",(()=>{Ao(t),i.clearActiveCell(),i.clearControls()}));const o=window.innerWidth;(t.opts.snippetOpen||e)&&o>=960&&(c.style.cssText="transition: all ease 0.8s;",setTimeout((function(){Ao(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 Ao(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 Eo(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 qo(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Eo(Object(i),!0).forEach((function(e){Io(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Eo(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function To(t){return To="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},To(t)}function Mo(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Oo(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 Io(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function zo(t){return function(t){if(Array.isArray(t))return Ro(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 Ro(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 Ro(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 Ro(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 Bo="undefined"!=typeof window&&void 0!==window.document,$o=Bo?window:{},No=!(!Bo||!$o.document.documentElement)&&"ontouchstart"in $o.document.documentElement,Po=!!Bo&&"PointerEvent"in $o,Do="cropper",jo="all",Ho="crop",Fo="move",Uo="zoom",Wo="e",Go="w",Yo="s",Xo="n",Vo="ne",Ko="nw",Zo="se",Qo="sw",Jo="".concat(Do,"-crop"),tl="".concat(Do,"-disabled"),el="".concat(Do,"-hidden"),il="".concat(Do,"-hide"),nl="".concat(Do,"-invisible"),sl="".concat(Do,"-modal"),ol="".concat(Do,"-move"),ll="".concat(Do,"Action"),al="".concat(Do,"Preview"),rl="crop",cl="move",ul="none",dl="crop",bl="cropend",hl="cropmove",pl="cropstart",ml="dblclick",gl=Po?"pointerdown":No?"touchstart":"mousedown",fl=Po?"pointermove":No?"touchmove":"mousemove",vl=Po?"pointerup pointercancel":No?"touchend touchcancel":"mouseup",yl="ready",xl="resize",wl="wheel",Sl="zoom",_l="image/jpeg",kl=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,Cl=/^data:/,Ll=/^data:image\/jpeg;base64,/,Al=/^img|canvas$/i,El={viewMode:0,dragMode:rl,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:200,minContainerHeight:100,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},ql=Number.isNaN||$o.isNaN;function Tl(t){return"number"==typeof t&&!ql(t)}var Ml=function(t){return t>0&&t<1/0};function Ol(t){return void 0===t}function Il(t){return"object"===To(t)&&null!==t}var zl=Object.prototype.hasOwnProperty;function Rl(t){if(!Il(t))return!1;try{var e=t.constructor,i=e.prototype;return e&&i&&zl.call(i,"isPrototypeOf")}catch(t){return!1}}function Bl(t){return"function"==typeof t}var $l=Array.prototype.slice;function Nl(t){return Array.from?Array.from(t):$l.call(t)}function Pl(t,e){return t&&Bl(e)&&(Array.isArray(t)||Tl(t.length)?Nl(t).forEach((function(i,n){e.call(t,i,n,t)})):Il(t)&&Object.keys(t).forEach((function(i){e.call(t,t[i],i,t)}))),t}var Dl=Object.assign||function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return Il(t)&&i.length>0&&i.forEach((function(e){Il(e)&&Object.keys(e).forEach((function(i){t[i]=e[i]}))})),t},jl=/\.\d*(?:0|9){12}\d*$/;function Hl(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return jl.test(t)?Math.round(t*e)/e:t}var Fl=/^width|height|left|top|marginLeft|marginTop$/;function Ul(t,e){var i=t.style;Pl(e,(function(t,e){Fl.test(e)&&Tl(t)&&(t="".concat(t,"px")),i[e]=t}))}function Wl(t,e){if(e)if(Tl(t.length))Pl(t,(function(t){Wl(t,e)}));else if(t.classList)t.classList.add(e);else{var i=t.className.trim();i?i.indexOf(e)<0&&(t.className="".concat(i," ").concat(e)):t.className=e}}function Gl(t,e){e&&(Tl(t.length)?Pl(t,(function(t){Gl(t,e)})):t.classList?t.classList.remove(e):t.className.indexOf(e)>=0&&(t.className=t.className.replace(e,"")))}function Yl(t,e,i){e&&(Tl(t.length)?Pl(t,(function(t){Yl(t,e,i)})):i?Wl(t,e):Gl(t,e))}var Xl=/([a-z\d])([A-Z])/g;function Vl(t){return t.replace(Xl,"$1-$2").toLowerCase()}function Kl(t,e){return Il(t[e])?t[e]:t.dataset?t.dataset[e]:t.getAttribute("data-".concat(Vl(e)))}function Zl(t,e,i){Il(i)?t[e]=i:t.dataset?t.dataset[e]=i:t.setAttribute("data-".concat(Vl(e)),i)}var Ql=/\s\s*/,Jl=function(){var t=!1;if(Bo){var e=!1,i=function(){},n=Object.defineProperty({},"once",{get:function(){return t=!0,e},set:function(t){e=t}});$o.addEventListener("test",i,n),$o.removeEventListener("test",i,n)}return t}();function ta(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=i;e.trim().split(Ql).forEach((function(e){if(!Jl){var o=t.listeners;o&&o[e]&&o[e][i]&&(s=o[e][i],delete o[e][i],0===Object.keys(o[e]).length&&delete o[e],0===Object.keys(o).length&&delete t.listeners)}t.removeEventListener(e,s,n)}))}function ea(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=i;e.trim().split(Ql).forEach((function(e){if(n.once&&!Jl){var o=t.listeners,l=void 0===o?{}:o;s=function(){delete l[e][i],t.removeEventListener(e,s,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;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]=s,t.listeners=l}t.addEventListener(e,s,n)}))}function ia(t,e,i){var n;return Bl(Event)&&Bl(CustomEvent)?n=new CustomEvent(e,{detail:i,bubbles:!0,cancelable:!0}):(n=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,i),t.dispatchEvent(n)}function na(t){var e=t.getBoundingClientRect();return{left:e.left+(window.pageXOffset-document.documentElement.clientLeft),top:e.top+(window.pageYOffset-document.documentElement.clientTop)}}var sa=$o.location,oa=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function la(t){var e=t.match(oa);return null!==e&&(e[1]!==sa.protocol||e[2]!==sa.hostname||e[3]!==sa.port)}function aa(t){var e="timestamp=".concat((new Date).getTime());return t+(-1===t.indexOf("?")?"?":"&")+e}function ra(t){var e=t.rotate,i=t.scaleX,n=t.scaleY,s=t.translateX,o=t.translateY,l=[];Tl(s)&&0!==s&&l.push("translateX(".concat(s,"px)")),Tl(o)&&0!==o&&l.push("translateY(".concat(o,"px)")),Tl(e)&&0!==e&&l.push("rotate(".concat(e,"deg)")),Tl(i)&&1!==i&&l.push("scaleX(".concat(i,")")),Tl(n)&&1!==n&&l.push("scaleY(".concat(n,")"));var a=l.length?l.join(" "):"none";return{WebkitTransform:a,msTransform:a,transform:a}}function ca(t,e){var i=t.pageX,n=t.pageY,s={endX:i,endY:n};return e?s:qo({startX:i,startY:n},s)}function ua(t){var e=t.aspectRatio,i=t.height,n=t.width,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"contain",o=Ml(n),l=Ml(i);if(o&&l){var a=i*e;"contain"===s&&a>n||"cover"===s&&a<n?i=n/e:n=i*e}else o?i=n/e:l&&(n=i*e);return{width:n,height:i}}function da(t,e,i,n){var s=e.aspectRatio,o=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,_=void 0===S?1/0:S,k=n.maxHeight,C=void 0===k?1/0:k,L=n.minWidth,A=void 0===L?0:L,E=n.minHeight,q=void 0===E?0:E,T=document.createElement("canvas"),M=T.getContext("2d"),O=ua({aspectRatio:h,width:_,height:C}),I=ua({aspectRatio:h,width:A,height:q},"cover"),z=Math.min(O.width,Math.max(I.width,p)),R=Math.min(O.height,Math.max(I.height,m)),B=ua({aspectRatio:s,width:_,height:C}),$=ua({aspectRatio:s,width:A,height:q},"cover"),N=Math.min(B.width,Math.max($.width,o)),P=Math.min(B.height,Math.max($.height,l)),D=[-N/2,-P/2,N,P];return T.width=Hl(z),T.height=Hl(R),M.fillStyle=f,M.fillRect(0,0,z,R),M.save(),M.translate(z/2,R/2),M.rotate(r*Math.PI/180),M.scale(u,b),M.imageSmoothingEnabled=y,M.imageSmoothingQuality=w,M.drawImage.apply(M,[t].concat(zo(D.map((function(t){return Math.floor(Hl(t))}))))),M.restore(),T}var ba=String.fromCharCode;var ha=/^data:.*,/;function pa(t){var e,i=new DataView(t);try{var n,s,o;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)){s=a;break}a+=1}if(s){var r=s+10;if("Exif"===function(t,e,i){var n="";i+=e;for(var s=e;s<i;s+=1)n+=ba(t.getUint8(s));return n}(i,s+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&&(o=r+u)}}}if(o){var d,b,h=i.getUint16(o,n);for(b=0;b<h;b+=1)if(d=o+12*b+2,274===i.getUint16(d,n)){d+=8,e=i.getUint16(d,n),i.setUint16(d,1,n);break}}}catch(t){e=1}return e}var ma={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var t=this.element,e=this.options,i=this.container,n=this.cropper,s=Number(e.minContainerWidth),o=Number(e.minContainerHeight);Wl(n,el),Gl(t,el);var l={width:Math.max(i.offsetWidth,s>=0?s:200),height:Math.max(i.offsetHeight,o>=0?o:100)};this.containerData=l,Ul(n,{width:l.width,height:l.height}),Wl(t,el),Gl(n,el)},initCanvas:function(){var t=this.containerData,e=this.imageData,i=this.options.viewMode,n=Math.abs(e.rotate)%180==90,s=n?e.naturalHeight:e.naturalWidth,o=n?e.naturalWidth:e.naturalHeight,l=s/o,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:s,naturalHeight:o,width:a,height:r};this.canvasData=c,this.limited=1===i||2===i,this.limitCanvas(!0,!0),c.width=Math.min(Math.max(c.width,c.minWidth),c.maxWidth),c.height=Math.min(Math.max(c.height,c.minHeight),c.maxHeight),c.left=(t.width-c.width)/2,c.top=(t.height-c.height)/2,c.oldLeft=c.left,c.oldTop=c.top,this.initialCanvasData=Dl({},c)},limitCanvas:function(t,e){var i=this.options,n=this.containerData,s=this.canvasData,o=this.cropBoxData,l=i.viewMode,a=s.aspectRatio,r=this.cropped&&o;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?o.width:0):u?u=Math.max(u,r?o.height:0):r&&(c=o.width,(u=o.height)*a>c?c=u*a:u=c/a));var d=ua({aspectRatio:a,width:c,height:u});c=d.width,u=d.height,s.minWidth=c,s.minHeight=u,s.maxWidth=1/0,s.maxHeight=1/0}if(e)if(l>(r?0:1)){var b=n.width-s.width,h=n.height-s.height;s.minLeft=Math.min(0,b),s.minTop=Math.min(0,h),s.maxLeft=Math.max(0,b),s.maxTop=Math.max(0,h),r&&this.limited&&(s.minLeft=Math.min(o.left,o.left+(o.width-s.width)),s.minTop=Math.min(o.top,o.top+(o.height-s.height)),s.maxLeft=o.left,s.maxTop=o.top,2===l&&(s.width>=n.width&&(s.minLeft=Math.min(0,b),s.maxLeft=Math.max(0,b)),s.height>=n.height&&(s.minTop=Math.min(0,h),s.maxTop=Math.max(0,h))))}else s.minLeft=-s.width,s.minTop=-s.height,s.maxLeft=n.width,s.maxTop=n.height},renderCanvas:function(t,e){var i=this.canvasData,n=this.imageData;if(e){var s=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 s=n%90*Math.PI/180,o=Math.sin(s),l=Math.cos(s),a=e*l+i*o,r=e*o+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}),o=s.width,l=s.height,a=i.width*(o/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=o/l,i.naturalWidth=o,i.naturalHeight=l,this.limitCanvas(!0,!1)}(i.width>i.maxWidth||i.width<i.minWidth)&&(i.left=i.oldLeft),(i.height>i.maxHeight||i.height<i.minHeight)&&(i.top=i.oldTop),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),this.limitCanvas(!1,!0),i.left=Math.min(Math.max(i.left,i.minLeft),i.maxLeft),i.top=Math.min(Math.max(i.top,i.minTop),i.maxTop),i.oldLeft=i.left,i.oldTop=i.top,Ul(this.canvas,Dl({width:i.width,height:i.height},ra({translateX:i.left,translateY:i.top}))),this.renderImage(t),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(t){var e=this.canvasData,i=this.imageData,n=i.naturalWidth*(e.width/e.naturalWidth),s=i.naturalHeight*(e.height/e.naturalHeight);Dl(i,{width:n,height:s,left:(e.width-n)/2,top:(e.height-s)/2}),Ul(this.image,Dl({width:i.width,height:i.height},ra(Dl({translateX:i.left,translateY:i.top},i)))),t&&this.output()},initCropBox:function(){var t=this.options,e=this.canvasData,i=t.aspectRatio||t.initialAspectRatio,n=Number(t.autoCropArea)||.8,s={width:e.width,height:e.height};i&&(e.height*i>e.width?s.height=s.width/i:s.width=s.height*i),this.cropBoxData=s,this.limitCropBox(!0,!0),s.width=Math.min(Math.max(s.width,s.minWidth),s.maxWidth),s.height=Math.min(Math.max(s.height,s.minHeight),s.maxHeight),s.width=Math.max(s.minWidth,s.width*n),s.height=Math.max(s.minHeight,s.height*n),s.left=e.left+(e.width-s.width)/2,s.top=e.top+(e.height-s.height)/2,s.oldLeft=s.left,s.oldTop=s.top,this.initialCropBoxData=Dl({},s)},limitCropBox:function(t,e){var i=this.options,n=this.containerData,s=this.canvasData,o=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,s.width,s.width+s.left,n.width-s.left):n.width,d=l?Math.min(n.height,s.height,s.height+s.top,n.height-s.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),o.minWidth=Math.min(r,u),o.minHeight=Math.min(c,d),o.maxWidth=u,o.maxHeight=d}e&&(l?(o.minLeft=Math.max(0,s.left),o.minTop=Math.max(0,s.top),o.maxLeft=Math.min(n.width,s.left+s.width)-o.width,o.maxTop=Math.min(n.height,s.top+s.height)-o.height):(o.minLeft=0,o.minTop=0,o.maxLeft=n.width-o.width,o.maxTop=n.height-o.height))},renderCropBox:function(){var t=this.options,e=this.containerData,i=this.cropBoxData;(i.width>i.maxWidth||i.width<i.minWidth)&&(i.left=i.oldLeft),(i.height>i.maxHeight||i.height<i.minHeight)&&(i.top=i.oldTop),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),this.limitCropBox(!1,!0),i.left=Math.min(Math.max(i.left,i.minLeft),i.maxLeft),i.top=Math.min(Math.max(i.top,i.minTop),i.maxTop),i.oldLeft=i.left,i.oldTop=i.top,t.movable&&t.cropBoxMovable&&Zl(this.face,ll,i.width>=e.width&&i.height>=e.height?Fo:jo),Ul(this.cropBox,Dl({width:i.width,height:i.height},ra({translateX:i.left,translateY:i.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),ia(this.element,dl,this.getData())}},ga={initPreview:function(){var t=this.element,e=this.crossOrigin,i=this.options.preview,n=e?this.crossOriginUrl:this.url,s=t.alt||"The image to preview",o=document.createElement("img");if(e&&(o.crossOrigin=e),o.src=n,o.alt=s,this.viewBox.appendChild(o),this.viewBoxImage=o,i){var l=i;"string"==typeof i?l=t.ownerDocument.querySelectorAll(i):i.querySelector&&(l=[i]),this.previews=l,Pl(l,(function(t){var i=document.createElement("img");Zl(t,al,{width:t.offsetWidth,height:t.offsetHeight,html:t.innerHTML}),e&&(i.crossOrigin=e),i.src=n,i.alt=s,i.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',t.innerHTML="",t.appendChild(i)}))}},resetPreview:function(){Pl(this.previews,(function(t){var e=Kl(t,al);Ul(t,{width:e.width,height:e.height}),t.innerHTML=e.html,function(t,e){if(Il(t[e]))try{delete t[e]}catch(i){t[e]=void 0}else if(t.dataset)try{delete t.dataset[e]}catch(i){t.dataset[e]=void 0}else t.removeAttribute("data-".concat(Vl(e)))}(t,al)}))},preview:function(){var t=this.imageData,e=this.canvasData,i=this.cropBoxData,n=i.width,s=i.height,o=t.width,l=t.height,a=i.left-e.left-t.left,r=i.top-e.top-t.top;this.cropped&&!this.disabled&&(Ul(this.viewBoxImage,Dl({width:o,height:l},ra(Dl({translateX:-a,translateY:-r},t)))),Pl(this.previews,(function(e){var i=Kl(e,al),c=i.width,u=i.height,d=c,b=u,h=1;n&&(b=s*(h=c/n)),s&&b>u&&(d=n*(h=u/s),b=u),Ul(e,{width:d,height:b}),Ul(e.getElementsByTagName("img")[0],Dl({width:o*h,height:l*h},ra(Dl({translateX:-a*h,translateY:-r*h},t))))})))}},fa={bind:function(){var t=this.element,e=this.options,i=this.cropper;Bl(e.cropstart)&&ea(t,pl,e.cropstart),Bl(e.cropmove)&&ea(t,hl,e.cropmove),Bl(e.cropend)&&ea(t,bl,e.cropend),Bl(e.crop)&&ea(t,dl,e.crop),Bl(e.zoom)&&ea(t,Sl,e.zoom),ea(i,gl,this.onCropStart=this.cropStart.bind(this)),e.zoomable&&e.zoomOnWheel&&ea(i,wl,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&ea(i,ml,this.onDblclick=this.dblclick.bind(this)),ea(t.ownerDocument,fl,this.onCropMove=this.cropMove.bind(this)),ea(t.ownerDocument,vl,this.onCropEnd=this.cropEnd.bind(this)),e.responsive&&ea(window,xl,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,e=this.options,i=this.cropper;Bl(e.cropstart)&&ta(t,pl,e.cropstart),Bl(e.cropmove)&&ta(t,hl,e.cropmove),Bl(e.cropend)&&ta(t,bl,e.cropend),Bl(e.crop)&&ta(t,dl,e.crop),Bl(e.zoom)&&ta(t,Sl,e.zoom),ta(i,gl,this.onCropStart),e.zoomable&&e.zoomOnWheel&&ta(i,wl,this.onWheel,{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&ta(i,ml,this.onDblclick),ta(t.ownerDocument,fl,this.onCropMove),ta(t.ownerDocument,vl,this.onCropEnd),e.responsive&&ta(window,xl,this.onResize)}},va={resize:function(){if(!this.disabled){var t,e,i=this.options,n=this.container,s=this.containerData,o=n.offsetWidth/s.width,l=n.offsetHeight/s.height,a=Math.abs(o-1)>Math.abs(l-1)?o:l;if(1!==a)i.restore&&(t=this.getCanvasData(),e=this.getCropBoxData()),this.render(),i.restore&&(this.setCanvasData(Pl(t,(function(e,i){t[i]=e*a}))),this.setCropBoxData(Pl(e,(function(t,i){e[i]=t*a}))))}},dblclick:function(){var t,e;this.disabled||this.options.dragMode===ul||this.setDragMode((t=this.dragBox,e=Jo,(t.classList?t.classList.contains(e):t.className.indexOf(e)>-1)?cl:rl))},wheel:function(t){var e=this,i=Number(this.options.wheelZoomRatio)||.1,n=1;this.disabled||(t.preventDefault(),this.wheeling||(this.wheeling=!0,setTimeout((function(){e.wheeling=!1}),50),t.deltaY?n=t.deltaY>0?1:-1:t.wheelDelta?n=-t.wheelDelta/120:t.detail&&(n=t.detail>0?1:-1),this.zoom(-n*i,t)))},cropStart:function(t){var e=t.buttons,i=t.button;if(!(this.disabled||("mousedown"===t.type||"pointerdown"===t.type&&"mouse"===t.pointerType)&&(Tl(e)&&1!==e||Tl(i)&&0!==i||t.ctrlKey))){var n,s=this.options,o=this.pointers;t.changedTouches?Pl(t.changedTouches,(function(t){o[t.identifier]=ca(t)})):o[t.pointerId||0]=ca(t),n=Object.keys(o).length>1&&s.zoomable&&s.zoomOnTouch?Uo:Kl(t.target,ll),kl.test(n)&&!1!==ia(this.element,pl,{originalEvent:t,action:n})&&(t.preventDefault(),this.action=n,this.cropping=!1,n===Ho&&(this.cropping=!0,Wl(this.dragBox,sl)))}},cropMove:function(t){var e=this.action;if(!this.disabled&&e){var i=this.pointers;t.preventDefault(),!1!==ia(this.element,hl,{originalEvent:t,action:e})&&(t.changedTouches?Pl(t.changedTouches,(function(t){Dl(i[t.identifier]||{},ca(t,!0))})):Dl(i[t.pointerId||0]||{},ca(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var e=this.action,i=this.pointers;t.changedTouches?Pl(t.changedTouches,(function(t){delete i[t.identifier]})):delete i[t.pointerId||0],e&&(t.preventDefault(),Object.keys(i).length||(this.action=""),this.cropping&&(this.cropping=!1,Yl(this.dragBox,sl,this.cropped&&this.options.modal)),ia(this.element,bl,{originalEvent:t,action:e}))}}},ya={change:function(t){var e,i=this.options,n=this.canvasData,s=this.containerData,o=this.cropBoxData,l=this.pointers,a=this.action,r=i.aspectRatio,c=o.left,u=o.top,d=o.width,b=o.height,h=c+d,p=u+b,m=0,g=0,f=s.width,v=s.height,y=!0;!r&&t.shiftKey&&(r=d&&b?d/b:1),this.limited&&(m=o.minLeft,g=o.minTop,f=m+Math.min(s.width,n.width,n.left+n.width),v=g+Math.min(s.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 Wo:h+w.x>f&&(w.x=f-h);break;case Go:c+w.x<m&&(w.x=m-c);break;case Xo:u+w.y<g&&(w.y=g-u);break;case Yo:p+w.y>v&&(w.y=v-p)}};switch(a){case jo:c+=w.x,u+=w.y;break;case Wo:if(w.x>=0&&(h>=f||r&&(u<=g||p>=v))){y=!1;break}S(Wo),(d+=w.x)<0&&(a=Go,c-=d=-d),r&&(b=d/r,u+=(o.height-b)/2);break;case Xo:if(w.y<=0&&(u<=g||r&&(c<=m||h>=f))){y=!1;break}S(Xo),b-=w.y,u+=w.y,b<0&&(a=Yo,u-=b=-b),r&&(d=b*r,c+=(o.width-d)/2);break;case Go:if(w.x<=0&&(c<=m||r&&(u<=g||p>=v))){y=!1;break}S(Go),d-=w.x,c+=w.x,d<0&&(a=Wo,c-=d=-d),r&&(b=d/r,u+=(o.height-b)/2);break;case Yo:if(w.y>=0&&(p>=v||r&&(c<=m||h>=f))){y=!1;break}S(Yo),(b+=w.y)<0&&(a=Xo,u-=b=-b),r&&(d=b*r,c+=(o.width-d)/2);break;case Vo:if(r){if(w.y<=0&&(u<=g||h>=f)){y=!1;break}S(Xo),b-=w.y,u+=w.y,d=b*r}else S(Xo),S(Wo),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=Qo,u-=b=-b,c-=d=-d):d<0?(a=Ko,c-=d=-d):b<0&&(a=Zo,u-=b=-b);break;case Ko:if(r){if(w.y<=0&&(u<=g||c<=m)){y=!1;break}S(Xo),b-=w.y,u+=w.y,d=b*r,c+=o.width-d}else S(Xo),S(Go),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=Zo,u-=b=-b,c-=d=-d):d<0?(a=Vo,c-=d=-d):b<0&&(a=Qo,u-=b=-b);break;case Qo:if(r){if(w.x<=0&&(c<=m||p>=v)){y=!1;break}S(Go),d-=w.x,c+=w.x,b=d/r}else S(Yo),S(Go),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=Vo,u-=b=-b,c-=d=-d):d<0?(a=Zo,c-=d=-d):b<0&&(a=Ko,u-=b=-b);break;case Zo:if(r){if(w.x>=0&&(h>=f||p>=v)){y=!1;break}S(Wo),b=(d+=w.x)/r}else S(Yo),S(Wo),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=Ko,u-=b=-b,c-=d=-d):d<0?(a=Qo,c-=d=-d):b<0&&(a=Vo,u-=b=-b);break;case Fo:this.move(w.x,w.y),y=!1;break;case Uo:this.zoom(function(t){var e=qo({},t),i=0;return Pl(t,(function(t,n){delete e[n],Pl(e,(function(e){var n=Math.abs(t.startX-e.startX),s=Math.abs(t.startY-e.startY),o=Math.abs(t.endX-e.endX),l=Math.abs(t.endY-e.endY),a=Math.sqrt(n*n+s*s),r=(Math.sqrt(o*o+l*l)-a)/a;Math.abs(r)>Math.abs(i)&&(i=r)}))})),i}(l),t),y=!1;break;case Ho:if(!w.x||!w.y){y=!1;break}e=na(this.cropper),c=x.startX-e.left,u=x.startY-e.top,d=o.minWidth,b=o.minHeight,w.x>0?a=w.y>0?Zo:Vo:w.x<0&&(c-=d,a=w.y>0?Qo:Ko),w.y<0&&(u-=b),this.cropped||(Gl(this.cropBox,el),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0))}y&&(o.width=d,o.height=b,o.left=c,o.top=u,this.action=a,this.renderCropBox()),Pl(l,(function(t){t.startX=t.endX,t.startY=t.endY}))}},xa={crop:function(){return!this.ready||this.cropped||this.disabled||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&Wl(this.dragBox,sl),Gl(this.cropBox,el),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=Dl({},this.initialImageData),this.canvasData=Dl({},this.initialCanvasData),this.cropBoxData=Dl({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(Dl(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),Gl(this.dragBox,sl),Wl(this.cropBox,el)),this},replace:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!this.disabled&&t&&(this.isImg&&(this.element.src=t),e?(this.url=t,this.image.src=t,this.ready&&(this.viewBoxImage.src=t,Pl(this.previews,(function(e){e.getElementsByTagName("img")[0].src=t})))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(t))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,Gl(this.cropper,tl)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,Wl(this.cropper,tl)),this},destroy:function(){var t=this.element;return t.cropper?(t.cropper=void 0,this.isImg&&this.replaced&&(t.src=this.originalUrl),this.uncreate(),this):this},move:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.canvasData,n=i.left,s=i.top;return this.moveTo(Ol(t)?t:n+Number(t),Ol(e)?e:s+Number(e))},moveTo:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.canvasData,n=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.movable&&(Tl(t)&&(i.left=t,n=!0),Tl(e)&&(i.top=e,n=!0),n&&this.renderCanvas(!0)),this},zoom:function(t,e){var i=this.canvasData;return t=(t=Number(t))<0?1/(1-t):1+t,this.zoomTo(i.width*t/i.naturalWidth,null,e)},zoomTo:function(t,e,i){var n=this.options,s=this.canvasData,o=s.width,l=s.height,a=s.naturalWidth,r=s.naturalHeight;if((t=Number(t))>=0&&this.ready&&!this.disabled&&n.zoomable){var c=a*t,u=r*t;if(!1===ia(this.element,Sl,{ratio:t,oldRatio:o/a,originalEvent:i}))return this;if(i){var d=this.pointers,b=na(this.cropper),h=d&&Object.keys(d).length?function(t){var e=0,i=0,n=0;return Pl(t,(function(t){var s=t.startX,o=t.startY;e+=s,i+=o,n+=1})),{pageX:e/=n,pageY:i/=n}}(d):{pageX:i.pageX,pageY:i.pageY};s.left-=(c-o)*((h.pageX-b.left-s.left)/o),s.top-=(u-l)*((h.pageY-b.top-s.top)/l)}else Rl(e)&&Tl(e.x)&&Tl(e.y)?(s.left-=(c-o)*((e.x-s.left)/o),s.top-=(u-l)*((e.y-s.top)/l)):(s.left-=(c-o)/2,s.top-=(u-l)/2);s.width=c,s.height=u,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return Tl(t=Number(t))&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=t%360,this.renderCanvas(!0,!0)),this},scaleX:function(t){var e=this.imageData.scaleY;return this.scale(t,Tl(e)?e:1)},scaleY:function(t){var e=this.imageData.scaleX;return this.scale(Tl(e)?e:1,t)},scale:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.imageData,n=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.scalable&&(Tl(t)&&(i.scaleX=t,n=!0),Tl(e)&&(i.scaleY=e,n=!0),n&&this.renderCanvas(!0,!0)),this},getData:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=this.options,n=this.imageData,s=this.canvasData,o=this.cropBoxData;if(this.ready&&this.cropped){t={x:o.left-s.left,y:o.top-s.top,width:o.width,height:o.height};var l=n.width/n.naturalWidth;if(Pl(t,(function(e,i){t[i]=e/l})),e){var a=Math.round(t.y+t.height),r=Math.round(t.x+t.width);t.x=Math.round(t.x),t.y=Math.round(t.y),t.width=r-t.x,t.height=a-t.y}}else t={x:0,y:0,width:0,height:0};return i.rotatable&&(t.rotate=n.rotate||0),i.scalable&&(t.scaleX=n.scaleX||1,t.scaleY=n.scaleY||1),t},setData:function(t){var e=this.options,i=this.imageData,n=this.canvasData,s={};if(this.ready&&!this.disabled&&Rl(t)){var o=!1;e.rotatable&&Tl(t.rotate)&&t.rotate!==i.rotate&&(i.rotate=t.rotate,o=!0),e.scalable&&(Tl(t.scaleX)&&t.scaleX!==i.scaleX&&(i.scaleX=t.scaleX,o=!0),Tl(t.scaleY)&&t.scaleY!==i.scaleY&&(i.scaleY=t.scaleY,o=!0)),o&&this.renderCanvas(!0,!0);var l=i.width/i.naturalWidth;Tl(t.x)&&(s.left=t.x*l+n.left),Tl(t.y)&&(s.top=t.y*l+n.top),Tl(t.width)&&(s.width=t.width*l),Tl(t.height)&&(s.height=t.height*l),this.setCropBoxData(s)}return this},getContainerData:function(){return this.ready?Dl({},this.containerData):{}},getImageData:function(){return this.sized?Dl({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,e={};return this.ready&&Pl(["left","top","width","height","naturalWidth","naturalHeight"],(function(i){e[i]=t[i]})),e},setCanvasData:function(t){var e=this.canvasData,i=e.aspectRatio;return this.ready&&!this.disabled&&Rl(t)&&(Tl(t.left)&&(e.left=t.left),Tl(t.top)&&(e.top=t.top),Tl(t.width)?(e.width=t.width,e.height=t.width/i):Tl(t.height)&&(e.height=t.height,e.width=t.height*i),this.renderCanvas(!0)),this},getCropBoxData:function(){var t,e=this.cropBoxData;return this.ready&&this.cropped&&(t={left:e.left,top:e.top,width:e.width,height:e.height}),t||{}},setCropBoxData:function(t){var e,i,n=this.cropBoxData,s=this.options.aspectRatio;return this.ready&&this.cropped&&!this.disabled&&Rl(t)&&(Tl(t.left)&&(n.left=t.left),Tl(t.top)&&(n.top=t.top),Tl(t.width)&&t.width!==n.width&&(e=!0,n.width=t.width),Tl(t.height)&&t.height!==n.height&&(i=!0,n.height=t.height),s&&(e?n.height=n.width/s:i&&(n.width=n.height*s)),this.renderCropBox()),this},getCroppedCanvas:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var e=this.canvasData,i=da(this.image,this.imageData,e,t);if(!this.cropped)return i;var n=this.getData(),s=n.x,o=n.y,l=n.width,a=n.height,r=i.width/Math.floor(e.naturalWidth);1!==r&&(s*=r,o*=r,l*=r,a*=r);var c=l/a,u=ua({aspectRatio:c,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),d=ua({aspectRatio:c,width:t.minWidth||0,height:t.minHeight||0},"cover"),b=ua({aspectRatio:c,width:t.width||(1!==r?i.width:l),height:t.height||(1!==r?i.height:a)}),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=Hl(h),m.height=Hl(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,L=i.width,A=i.height,E=s,q=o;E<=-l||E>L?(E=0,x=0,S=0,k=0):E<=0?(S=-E,E=0,k=x=Math.min(L,l+E)):E<=L&&(S=0,k=x=Math.min(l,L-E)),x<=0||q<=-a||q>A?(q=0,w=0,_=0,C=0):q<=0?(_=-q,q=0,C=w=Math.min(A,a+q)):q<=A&&(_=0,C=w=Math.min(a,A-q));var T=[E,q,x,w];if(k>0&&C>0){var M=h/l;T.push(S*M,_*M,k*M,C*M)}return g.drawImage.apply(g,[i].concat(zo(T.map((function(t){return Math.floor(Hl(t))}))))),m},setAspectRatio:function(t){var e=this.options;return this.disabled||Ol(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 s=t===rl,o=e.movable&&t===cl;t=s||o?t:ul,e.dragMode=t,Zl(i,ll,t),Yl(i,Jo,s),Yl(i,ol,o),e.cropBoxMovable||(Zl(n,ll,t),Yl(n,Jo,s),Yl(n,ol,o))}return this}},wa=$o.Cropper,Sa=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Mo(this,t),!e||!Al.test(e.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=e,this.options=Dl({},El,Rl(i)&&i),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}var e,i,n;return e=t,i=[{key:"init",value:function(){var t,e=this.element,i=e.tagName.toLowerCase();if(!e.cropper){if(e.cropper=this,"img"===i){if(this.isImg=!0,t=e.getAttribute("src")||"",this.originalUrl=t,!t)return;t=e.src}else"canvas"===i&&window.HTMLCanvasElement&&(t=e.toDataURL());this.load(t)}}},{key:"load",value:function(t){var e=this;if(t){this.url=t,this.imageData={};var i=this.element,n=this.options;if(n.rotatable||n.scalable||(n.checkOrientation=!1),n.checkOrientation&&window.ArrayBuffer)if(Cl.test(t))Ll.test(t)?this.read((s=t.replace(ha,""),o=atob(s),l=new ArrayBuffer(o.length),Pl(a=new Uint8Array(l),(function(t,e){a[e]=o.charCodeAt(e)})),l)):this.clone();else{var s,o,l,a,r=new XMLHttpRequest,c=this.clone.bind(this);this.reloading=!0,this.xhr=r,r.onabort=c,r.onerror=c,r.ontimeout=c,r.onprogress=function(){r.getResponseHeader("content-type")!==_l&&r.abort()},r.onload=function(){e.read(r.response)},r.onloadend=function(){e.reloading=!1,e.xhr=null},n.checkCrossOrigin&&la(t)&&i.crossOrigin&&(t=aa(t)),r.open("GET",t,!0),r.responseType="arraybuffer",r.withCredentials="use-credentials"===i.crossOrigin,r.send()}else this.clone()}}},{key:"read",value:function(t){var e=this.options,i=this.imageData,n=pa(t),s=0,o=1,l=1;if(n>1){this.url=function(t,e){for(var i=[],n=new Uint8Array(t);n.length>0;)i.push(ba.apply(null,Nl(n.subarray(0,8192)))),n=n.subarray(8192);return"data:".concat(e,";base64,").concat(btoa(i.join("")))}(t,_l);var a=function(t){var e=0,i=1,n=1;switch(t){case 2:i=-1;break;case 3:e=-180;break;case 4:n=-1;break;case 5:e=90,n=-1;break;case 6:e=90;break;case 7:e=90,i=-1;break;case 8:e=-90}return{rotate:e,scaleX:i,scaleY:n}}(n);s=a.rotate,o=a.scaleX,l=a.scaleY}e.rotatable&&(i.rotate=s),e.scalable&&(i.scaleX=o,i.scaleY=l),this.clone()}},{key:"clone",value:function(){var t=this.element,e=this.url,i=t.crossOrigin,n=e;this.options.checkCrossOrigin&&la(e)&&(i||(i="anonymous"),n=aa(e)),this.crossOrigin=i,this.crossOriginUrl=n;var s=document.createElement("img");i&&(s.crossOrigin=i),s.src=n||e,s.alt=t.alt||"The image to crop",this.image=s,s.onload=this.start.bind(this),s.onerror=this.stop.bind(this),Wl(s,il),t.parentNode.insertBefore(s,t.nextSibling)}},{key:"start",value:function(){var t=this,e=this.image;e.onload=null,e.onerror=null,this.sizing=!0;var i=$o.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test($o.navigator.userAgent),n=function(e,i){Dl(t.imageData,{naturalWidth:e,naturalHeight:i,aspectRatio:e/i}),t.initialImageData=Dl({},t.imageData),t.sizing=!1,t.sized=!0,t.build()};if(!e.naturalWidth||i){var s=document.createElement("img"),o=document.body||document.documentElement;this.sizingImage=s,s.onload=function(){n(s.width,s.height),i||o.removeChild(s)},s.src=e.src,i||(s.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;",o.appendChild(s))}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,s=document.createElement("div");s.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 o=s.querySelector(".".concat(Do,"-container")),l=o.querySelector(".".concat(Do,"-canvas")),a=o.querySelector(".".concat(Do,"-drag-box")),r=o.querySelector(".".concat(Do,"-crop-box")),c=r.querySelector(".".concat(Do,"-face"));this.container=n,this.cropper=o,this.canvas=l,this.dragBox=a,this.cropBox=r,this.viewBox=o.querySelector(".".concat(Do,"-view-box")),this.face=c,l.appendChild(i),Wl(t,el),n.insertBefore(o,t.nextSibling),this.isImg||Gl(i,il),this.initPreview(),this.bind(),e.initialAspectRatio=Math.max(0,e.initialAspectRatio)||NaN,e.aspectRatio=Math.max(0,e.aspectRatio)||NaN,e.viewMode=Math.max(0,Math.min(3,Math.round(e.viewMode)))||0,Wl(r,el),e.guides||Wl(r.getElementsByClassName("".concat(Do,"-dashed")),el),e.center||Wl(r.getElementsByClassName("".concat(Do,"-center")),el),e.background&&Wl(o,"".concat(Do,"-bg")),e.highlight||Wl(c,nl),e.cropBoxMovable&&(Wl(c,ol),Zl(c,ll,jo)),e.cropBoxResizable||(Wl(r.getElementsByClassName("".concat(Do,"-line")),el),Wl(r.getElementsByClassName("".concat(Do,"-point")),el)),this.render(),this.ready=!0,this.setDragMode(e.dragMode),e.autoCrop&&this.crop(),this.setData(e.data),Bl(e.ready)&&ea(t,yl,e.ready,{once:!0}),ia(t,yl)}}},{key:"unbuild",value:function(){this.ready&&(this.ready=!1,this.unbind(),this.resetPreview(),this.cropper.parentNode.removeChild(this.cropper),Gl(this.element,el))}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],n=[{key:"noConflict",value:function(){return window.Cropper=wa,t}},{key:"setDefaults",value:function(t){Dl(El,Rl(t)&&t)}}],i&&Oo(e.prototype,i),n&&Oo(e,n),t}();function _a(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];return e.map((function(e){return e.split(" ").map((function(e){return e?""+t+e:""})).join(" ")})).join(" ")}function ka(t,e){return function(i){i&&(t[e]=i)}}function Ca(t,e,i){return function(n){n&&(t[e][i]=n)}}function La(t,e){return function(i){var n=i.prototype;t.forEach((function(t){e(n,t)}))}}function Aa(t,e){return void 0===e&&(e={}),function(i,n){t.forEach((function(t){var s=e[t]||t;s in i||(i[s]=function(){for(var e,i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];var o=(e=this[n])[t].apply(e,i);return o===this[n]?this:o})}))}}Dl(Sa.prototype,ma,ga,fa,va,ya,xa);var Ea=function(){function t(){this.keys=[],this.values=[]}var e=t.prototype;return e.get=function(t){return this.values[this.keys.indexOf(t)]},e.set=function(t,e){var i=this.keys,n=this.values,s=i.indexOf(t),o=-1===s?i.length:s;i[o]=t,n[o]=e},t}(),qa=function(){function t(){this.object={}}var e=t.prototype;return e.get=function(t){return this.object[t]},e.set=function(t,e){this.object[t]=e},t}(),Ta="function"==typeof Map,Ma=function(){function t(){}var e=t.prototype;return e.connect=function(t,e){this.prev=t,this.next=e,t&&(t.next=this),e&&(e.prev=this)},e.disconnect=function(){var t=this.prev,e=this.next;t&&(t.next=e),e&&(e.prev=t)},e.getIndex=function(){for(var t=this,e=-1;t;)t=t.prev,++e;return e},t}();var Oa=function(){function t(t,e,i,n,s,o,l,a){this.prevList=t,this.list=e,this.added=i,this.removed=n,this.changed=s,this.maintained=o,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],s=t[1],o=new Ma;i[e]=o,n[s]=o})),i.forEach((function(t,e){t.connect(i[e-1])})),t.filter((function(t,i){return!e[i]})).map((function(t,e){var s=t[0],o=t[1];if(s===o)return[0,0];var l=i[s],a=n[o-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 s=t[0],o=t[1],l=e[n],a=l[0],r=l[1];if(s!==o)return i.push([a,r]),!0})),this.cachePureChanged=i},t}();function Ia(t,e,i){var n=Ta?Map:i?qa:Ea,s=i||function(t){return t},o=[],l=[],a=[],r=t.map(s),c=e.map(s),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?(o.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 Oa(t,e,o,l,m,a,b,h)}var za=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=Ia(this.list,e,this.findKeyCallback);return this.list=e,i},t}(),Ra="undefined",Ba=typeof window!==Ra,$a=[{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:'\\"',close:'\\"'},{open:"\\'",close:"\\'"}],Na=1e-7,Pa={cm:function(t){return 96*t/2.54},mm:function(t){return 96*t/254},in:function(t){return 96*t},pt:function(t){return 96*t/72},pc:function(t){return 96*t/6},"%":function(t,e){return t*e/100},vw:function(t,e){return void 0===e&&(e=window.innerWidth),t/100*e},vh:function(t,e){return void 0===e&&(e=window.innerHeight),t/100*e},vmax:function(t,e){return void 0===e&&(e=Math.max(window.innerWidth,window.innerHeight)),t/100*e},vmin:function(t,e){return void 0===e&&(e=Math.min(window.innerWidth,window.innerHeight)),t/100*e}};function Da(t){return typeof t===Ra}function ja(t){return t&&"object"==typeof t}function Ha(t){return Array.isArray(t)}function Fa(t){return"string"==typeof t}function Ua(t){return"number"==typeof t}function Wa(t){return"function"==typeof t}function Ga(t,e,i,n,s){return Ya(t,e,i)?i:function(t,e,i,n,s){for(var o,l=function(i){var l=e[i].trim();if(l===t.close&&!Ya(t,e,i))return{value:i};var a=i,r=ir(s,(function(t){return t.open===l}));if(r&&(a=Ga(r,e,i,n,s)),-1===a)return o=i,"break";o=i=a},a=i;a<n;++a){var r=l(a);if(a=o,"object"==typeof r)return r.value;if("break"===r)break}return-1}(t,e,i+1,n,s)}function Ya(t,e,i){if(!t.ignore)return null;var n=e.slice(Math.max(i-3,0),i+3).join("");return new RegExp(t.ignore).exec(n)}function Xa(t,e){var i=Fa(e)?{separator:e}:e,n=i.separator,s=void 0===n?",":n,o=i.isSeparateFirst,l=i.isSeparateOnlyOpenClose,a=i.isSeparateOpenClose,r=void 0===a?l:a,c=i.openCloseCharacters,u=void 0===c?$a:c,d=u.map((function(t){var e=t.open,i=t.close;return e===i?e:e+"|"+i})).join("|"),b=new RegExp("(\\s*"+s+"\\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=ir(u,(function(t){return t.open===e})),a=ir(u,(function(t){return t.close===e}));if(n){if(-1!==(i=Ga(n,h,t,p,u))&&r)return f()&&o?(v=t,"break"):(m.push(h.slice(t,i+1).join("")),t=i,o?(v=t,"break"):(v=t,"continue"))}else{if(a&&!Ya(a,h,t))throw new Error("invalid format: "+a.close);if(function(t,e){return(""===e||" "==e)&&(""===t||" "==t)||t===e}(e,s)&&!l)return f(),o?(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 Va(t){return Xa(t,"")}function Ka(t){return Xa(t,",")}function Za(t){var e=/([^(]*)\(([\s\S]*)\)([\s\S]*)/g.exec(t);return!e||e.length<4?{}:{prefix:e[1],value:e[2],suffix:e[3]}}function Qa(t){var e=/^([^\d|e|\-|\+]*)((?:\d|\.|-|e-|e\+)+)(\S*)$/g.exec(t);if(!e)return{prefix:"",unit:"",value:NaN};var i=e[1],n=e[2];return{prefix:i,unit:e[3],value:parseFloat(n)}}function Ja(t,e){return void 0===e&&(e="-"),t.replace(/([a-z])([A-Z])/g,(function(t,i,n){return""+i+e+n.toLowerCase()}))}function tr(){return Date.now?Date.now():(new Date).getTime()}function er(t,e,i){void 0===i&&(i=-1);for(var n=t.length,s=0;s<n;++s)if(e(t[s],s,t))return s;return i}function ir(t,e,i){var n=er(t,e);return n>-1?t[n]:i}var nr=function(){var t=tr(),e=Ba&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame);return e?e.bind(window):function(e){var i=tr();return window.setTimeout((function(){e(i-t)}),1e3/60)}}(),sr=function(){var t=Ba&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame);return t?t.bind(window):function(t){clearTimeout(t)}}();function or(t){if(Object.keys)return Object.keys(t);var e=[];for(var i in e)e.push(i);return e}function lr(t,e){var i=Qa(t),n=i.value,s=i.unit;if(ja(e)){var o=e[s];if(o){if(Wa(o))return o(n);if(Pa[s])return Pa[s](n,o)}}else if("%"===s)return n*e/100;return Pa[s]?Pa[s](n):n}function ar(t,e,i,n){return void 0===n&&(n=t[0]/t[1]),[[hr(e[0],Na),hr(e[0]/n,Na)],[hr(e[1]*n,Na),hr(e[1],Na)]].filter((function(t){return t.every((function(t,n){var s=e[n],o=hr(s,Na);return i?t<=s||t<=o:t>=s||t>=o}))}))[0]||t}function rr(t,e,i,n){if(!n)return t.map((function(t,n){return function(t,e,i){return Math.max(e,Math.min(t,i))}(t,e[n],i[n])}));var s=t[0],o=t[1],l=!0===n?s/o:n,a=ar(t,e,!1,l),r=a[0],c=a[1],u=ar(t,i,!0,l),d=u[0],b=u[1];return s<r||o<c?(s=r,o=c):(s>d||o>b)&&(s=d,o=b),[s,o]}function cr(t){for(var e=t.length,i=0,n=e-1;n>=0;--n)i+=t[n];return e?i/e:0}function ur(t,e){var i=e[0]-t[0],n=e[1]-t[1],s=Math.atan2(n,i);return s>=0?s:s+2*Math.PI}function dr(t){var e=function(t){return[0,1].map((function(e){return cr(t.map((function(t){return t[e]})))}))}(t),i=ur(e,t[0]),n=ur(e,t[1]);return i<n&&n-i<Math.PI||i>n&&n-i<-Math.PI?1:-1}function br(t,e){return Math.sqrt(Math.pow((e?e[0]:0)-t[0],2)+Math.pow((e?e[1]:0)-t[1],2))}function hr(t,e){if(!e)return t;var i=1/e;return Math.round(t/e)/i}function pr(t,e){return t.forEach((function(i,n){t[n]=hr(t[n],e)})),t}function mr(t,e){return t.classList?t.classList.contains(e):!!t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))}function gr(t,e,i,n){t.addEventListener(e,i,n)}function fr(t,e,i,n){t.removeEventListener(e,i,n)}
40
+ */(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;p=p.filter(e),t.opts.snippetJSON.snippets=p}else if("glide"===m){const e=t=>"slick"!==t.type;p=p.filter(e),t.opts.snippetJSON.snippets=p}else if("all"===m);else{const e=t=>"glide"!==t.type&&"slick"!==t.type;p=p.filter(e),t.opts.snippetJSON.snippets=p}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]}if(!t.win.FormViewer){const t=p.filter((t=>!("form"===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+""&&s.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+""&&s.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 Se(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 s=t.doc.querySelector("[data-new-dummy]");if(s){const t=s.parentNode,e=t.getBoundingClientRect();s.offsetWidth;let o=(i-s.offsetWidth/2-e.left)/t.offsetWidth*100,l=(n-s.offsetHeight/2-e.top)/t.offsetHeight*100;l<0&&(l=15),s.style.top=l+"%",s.style.left=o+"%",s.removeAttribute("data-new-dummy")}},onStart:()=>{f=null;const e=t.doc.querySelector(".builder-active");e&&(f=e,s.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&&s.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");s.addEventListener(n,"click",(()=>{Ao(t),i.clearActiveCell(),i.clearControls()}));const o=window.innerWidth;(t.opts.snippetOpen||e)&&o>=960&&(c.style.cssText="transition: all ease 0.8s;",setTimeout((function(){Ao(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 Ao(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 Eo(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 qo(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?Eo(Object(i),!0).forEach((function(e){Io(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):Eo(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function To(t){return To="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},To(t)}function Mo(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Oo(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 Io(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function zo(t){return function(t){if(Array.isArray(t))return Ro(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 Ro(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 Ro(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 Ro(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 Bo="undefined"!=typeof window&&void 0!==window.document,$o=Bo?window:{},No=!(!Bo||!$o.document.documentElement)&&"ontouchstart"in $o.document.documentElement,Po=!!Bo&&"PointerEvent"in $o,Do="cropper",jo="all",Ho="crop",Fo="move",Uo="zoom",Wo="e",Go="w",Yo="s",Xo="n",Vo="ne",Ko="nw",Zo="se",Qo="sw",Jo="".concat(Do,"-crop"),tl="".concat(Do,"-disabled"),el="".concat(Do,"-hidden"),il="".concat(Do,"-hide"),nl="".concat(Do,"-invisible"),sl="".concat(Do,"-modal"),ol="".concat(Do,"-move"),ll="".concat(Do,"Action"),al="".concat(Do,"Preview"),rl="crop",cl="move",ul="none",dl="crop",bl="cropend",hl="cropmove",pl="cropstart",ml="dblclick",gl=Po?"pointerdown":No?"touchstart":"mousedown",fl=Po?"pointermove":No?"touchmove":"mousemove",vl=Po?"pointerup pointercancel":No?"touchend touchcancel":"mouseup",yl="ready",xl="resize",wl="wheel",Sl="zoom",_l="image/jpeg",kl=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,Cl=/^data:/,Ll=/^data:image\/jpeg;base64,/,Al=/^img|canvas$/i,El={viewMode:0,dragMode:rl,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:200,minContainerHeight:100,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},ql=Number.isNaN||$o.isNaN;function Tl(t){return"number"==typeof t&&!ql(t)}var Ml=function(t){return t>0&&t<1/0};function Ol(t){return void 0===t}function Il(t){return"object"===To(t)&&null!==t}var zl=Object.prototype.hasOwnProperty;function Rl(t){if(!Il(t))return!1;try{var e=t.constructor,i=e.prototype;return e&&i&&zl.call(i,"isPrototypeOf")}catch(t){return!1}}function Bl(t){return"function"==typeof t}var $l=Array.prototype.slice;function Nl(t){return Array.from?Array.from(t):$l.call(t)}function Pl(t,e){return t&&Bl(e)&&(Array.isArray(t)||Tl(t.length)?Nl(t).forEach((function(i,n){e.call(t,i,n,t)})):Il(t)&&Object.keys(t).forEach((function(i){e.call(t,t[i],i,t)}))),t}var Dl=Object.assign||function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n<e;n++)i[n-1]=arguments[n];return Il(t)&&i.length>0&&i.forEach((function(e){Il(e)&&Object.keys(e).forEach((function(i){t[i]=e[i]}))})),t},jl=/\.\d*(?:0|9){12}\d*$/;function Hl(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return jl.test(t)?Math.round(t*e)/e:t}var Fl=/^width|height|left|top|marginLeft|marginTop$/;function Ul(t,e){var i=t.style;Pl(e,(function(t,e){Fl.test(e)&&Tl(t)&&(t="".concat(t,"px")),i[e]=t}))}function Wl(t,e){if(e)if(Tl(t.length))Pl(t,(function(t){Wl(t,e)}));else if(t.classList)t.classList.add(e);else{var i=t.className.trim();i?i.indexOf(e)<0&&(t.className="".concat(i," ").concat(e)):t.className=e}}function Gl(t,e){e&&(Tl(t.length)?Pl(t,(function(t){Gl(t,e)})):t.classList?t.classList.remove(e):t.className.indexOf(e)>=0&&(t.className=t.className.replace(e,"")))}function Yl(t,e,i){e&&(Tl(t.length)?Pl(t,(function(t){Yl(t,e,i)})):i?Wl(t,e):Gl(t,e))}var Xl=/([a-z\d])([A-Z])/g;function Vl(t){return t.replace(Xl,"$1-$2").toLowerCase()}function Kl(t,e){return Il(t[e])?t[e]:t.dataset?t.dataset[e]:t.getAttribute("data-".concat(Vl(e)))}function Zl(t,e,i){Il(i)?t[e]=i:t.dataset?t.dataset[e]=i:t.setAttribute("data-".concat(Vl(e)),i)}var Ql=/\s\s*/,Jl=function(){var t=!1;if(Bo){var e=!1,i=function(){},n=Object.defineProperty({},"once",{get:function(){return t=!0,e},set:function(t){e=t}});$o.addEventListener("test",i,n),$o.removeEventListener("test",i,n)}return t}();function ta(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=i;e.trim().split(Ql).forEach((function(e){if(!Jl){var o=t.listeners;o&&o[e]&&o[e][i]&&(s=o[e][i],delete o[e][i],0===Object.keys(o[e]).length&&delete o[e],0===Object.keys(o).length&&delete t.listeners)}t.removeEventListener(e,s,n)}))}function ea(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},s=i;e.trim().split(Ql).forEach((function(e){if(n.once&&!Jl){var o=t.listeners,l=void 0===o?{}:o;s=function(){delete l[e][i],t.removeEventListener(e,s,n);for(var o=arguments.length,a=new Array(o),r=0;r<o;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]=s,t.listeners=l}t.addEventListener(e,s,n)}))}function ia(t,e,i){var n;return Bl(Event)&&Bl(CustomEvent)?n=new CustomEvent(e,{detail:i,bubbles:!0,cancelable:!0}):(n=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,i),t.dispatchEvent(n)}function na(t){var e=t.getBoundingClientRect();return{left:e.left+(window.pageXOffset-document.documentElement.clientLeft),top:e.top+(window.pageYOffset-document.documentElement.clientTop)}}var sa=$o.location,oa=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function la(t){var e=t.match(oa);return null!==e&&(e[1]!==sa.protocol||e[2]!==sa.hostname||e[3]!==sa.port)}function aa(t){var e="timestamp=".concat((new Date).getTime());return t+(-1===t.indexOf("?")?"?":"&")+e}function ra(t){var e=t.rotate,i=t.scaleX,n=t.scaleY,s=t.translateX,o=t.translateY,l=[];Tl(s)&&0!==s&&l.push("translateX(".concat(s,"px)")),Tl(o)&&0!==o&&l.push("translateY(".concat(o,"px)")),Tl(e)&&0!==e&&l.push("rotate(".concat(e,"deg)")),Tl(i)&&1!==i&&l.push("scaleX(".concat(i,")")),Tl(n)&&1!==n&&l.push("scaleY(".concat(n,")"));var a=l.length?l.join(" "):"none";return{WebkitTransform:a,msTransform:a,transform:a}}function ca(t,e){var i=t.pageX,n=t.pageY,s={endX:i,endY:n};return e?s:qo({startX:i,startY:n},s)}function ua(t){var e=t.aspectRatio,i=t.height,n=t.width,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"contain",o=Ml(n),l=Ml(i);if(o&&l){var a=i*e;"contain"===s&&a>n||"cover"===s&&a<n?i=n/e:n=i*e}else o?i=n/e:l&&(n=i*e);return{width:n,height:i}}function da(t,e,i,n){var s=e.aspectRatio,o=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,_=void 0===S?1/0:S,k=n.maxHeight,C=void 0===k?1/0:k,L=n.minWidth,A=void 0===L?0:L,E=n.minHeight,q=void 0===E?0:E,T=document.createElement("canvas"),M=T.getContext("2d"),O=ua({aspectRatio:h,width:_,height:C}),I=ua({aspectRatio:h,width:A,height:q},"cover"),z=Math.min(O.width,Math.max(I.width,p)),R=Math.min(O.height,Math.max(I.height,m)),B=ua({aspectRatio:s,width:_,height:C}),$=ua({aspectRatio:s,width:A,height:q},"cover"),N=Math.min(B.width,Math.max($.width,o)),P=Math.min(B.height,Math.max($.height,l)),D=[-N/2,-P/2,N,P];return T.width=Hl(z),T.height=Hl(R),M.fillStyle=f,M.fillRect(0,0,z,R),M.save(),M.translate(z/2,R/2),M.rotate(r*Math.PI/180),M.scale(u,b),M.imageSmoothingEnabled=y,M.imageSmoothingQuality=w,M.drawImage.apply(M,[t].concat(zo(D.map((function(t){return Math.floor(Hl(t))}))))),M.restore(),T}var ba=String.fromCharCode;var ha=/^data:.*,/;function pa(t){var e,i=new DataView(t);try{var n,s,o;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)){s=a;break}a+=1}if(s){var r=s+10;if("Exif"===function(t,e,i){var n="";i+=e;for(var s=e;s<i;s+=1)n+=ba(t.getUint8(s));return n}(i,s+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&&(o=r+u)}}}if(o){var d,b,h=i.getUint16(o,n);for(b=0;b<h;b+=1)if(d=o+12*b+2,274===i.getUint16(d,n)){d+=8,e=i.getUint16(d,n),i.setUint16(d,1,n);break}}}catch(t){e=1}return e}var ma={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var t=this.element,e=this.options,i=this.container,n=this.cropper,s=Number(e.minContainerWidth),o=Number(e.minContainerHeight);Wl(n,el),Gl(t,el);var l={width:Math.max(i.offsetWidth,s>=0?s:200),height:Math.max(i.offsetHeight,o>=0?o:100)};this.containerData=l,Ul(n,{width:l.width,height:l.height}),Wl(t,el),Gl(n,el)},initCanvas:function(){var t=this.containerData,e=this.imageData,i=this.options.viewMode,n=Math.abs(e.rotate)%180==90,s=n?e.naturalHeight:e.naturalWidth,o=n?e.naturalWidth:e.naturalHeight,l=s/o,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:s,naturalHeight:o,width:a,height:r};this.canvasData=c,this.limited=1===i||2===i,this.limitCanvas(!0,!0),c.width=Math.min(Math.max(c.width,c.minWidth),c.maxWidth),c.height=Math.min(Math.max(c.height,c.minHeight),c.maxHeight),c.left=(t.width-c.width)/2,c.top=(t.height-c.height)/2,c.oldLeft=c.left,c.oldTop=c.top,this.initialCanvasData=Dl({},c)},limitCanvas:function(t,e){var i=this.options,n=this.containerData,s=this.canvasData,o=this.cropBoxData,l=i.viewMode,a=s.aspectRatio,r=this.cropped&&o;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?o.width:0):u?u=Math.max(u,r?o.height:0):r&&(c=o.width,(u=o.height)*a>c?c=u*a:u=c/a));var d=ua({aspectRatio:a,width:c,height:u});c=d.width,u=d.height,s.minWidth=c,s.minHeight=u,s.maxWidth=1/0,s.maxHeight=1/0}if(e)if(l>(r?0:1)){var b=n.width-s.width,h=n.height-s.height;s.minLeft=Math.min(0,b),s.minTop=Math.min(0,h),s.maxLeft=Math.max(0,b),s.maxTop=Math.max(0,h),r&&this.limited&&(s.minLeft=Math.min(o.left,o.left+(o.width-s.width)),s.minTop=Math.min(o.top,o.top+(o.height-s.height)),s.maxLeft=o.left,s.maxTop=o.top,2===l&&(s.width>=n.width&&(s.minLeft=Math.min(0,b),s.maxLeft=Math.max(0,b)),s.height>=n.height&&(s.minTop=Math.min(0,h),s.maxTop=Math.max(0,h))))}else s.minLeft=-s.width,s.minTop=-s.height,s.maxLeft=n.width,s.maxTop=n.height},renderCanvas:function(t,e){var i=this.canvasData,n=this.imageData;if(e){var s=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 s=n%90*Math.PI/180,o=Math.sin(s),l=Math.cos(s),a=e*l+i*o,r=e*o+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}),o=s.width,l=s.height,a=i.width*(o/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=o/l,i.naturalWidth=o,i.naturalHeight=l,this.limitCanvas(!0,!1)}(i.width>i.maxWidth||i.width<i.minWidth)&&(i.left=i.oldLeft),(i.height>i.maxHeight||i.height<i.minHeight)&&(i.top=i.oldTop),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),this.limitCanvas(!1,!0),i.left=Math.min(Math.max(i.left,i.minLeft),i.maxLeft),i.top=Math.min(Math.max(i.top,i.minTop),i.maxTop),i.oldLeft=i.left,i.oldTop=i.top,Ul(this.canvas,Dl({width:i.width,height:i.height},ra({translateX:i.left,translateY:i.top}))),this.renderImage(t),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(t){var e=this.canvasData,i=this.imageData,n=i.naturalWidth*(e.width/e.naturalWidth),s=i.naturalHeight*(e.height/e.naturalHeight);Dl(i,{width:n,height:s,left:(e.width-n)/2,top:(e.height-s)/2}),Ul(this.image,Dl({width:i.width,height:i.height},ra(Dl({translateX:i.left,translateY:i.top},i)))),t&&this.output()},initCropBox:function(){var t=this.options,e=this.canvasData,i=t.aspectRatio||t.initialAspectRatio,n=Number(t.autoCropArea)||.8,s={width:e.width,height:e.height};i&&(e.height*i>e.width?s.height=s.width/i:s.width=s.height*i),this.cropBoxData=s,this.limitCropBox(!0,!0),s.width=Math.min(Math.max(s.width,s.minWidth),s.maxWidth),s.height=Math.min(Math.max(s.height,s.minHeight),s.maxHeight),s.width=Math.max(s.minWidth,s.width*n),s.height=Math.max(s.minHeight,s.height*n),s.left=e.left+(e.width-s.width)/2,s.top=e.top+(e.height-s.height)/2,s.oldLeft=s.left,s.oldTop=s.top,this.initialCropBoxData=Dl({},s)},limitCropBox:function(t,e){var i=this.options,n=this.containerData,s=this.canvasData,o=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,s.width,s.width+s.left,n.width-s.left):n.width,d=l?Math.min(n.height,s.height,s.height+s.top,n.height-s.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),o.minWidth=Math.min(r,u),o.minHeight=Math.min(c,d),o.maxWidth=u,o.maxHeight=d}e&&(l?(o.minLeft=Math.max(0,s.left),o.minTop=Math.max(0,s.top),o.maxLeft=Math.min(n.width,s.left+s.width)-o.width,o.maxTop=Math.min(n.height,s.top+s.height)-o.height):(o.minLeft=0,o.minTop=0,o.maxLeft=n.width-o.width,o.maxTop=n.height-o.height))},renderCropBox:function(){var t=this.options,e=this.containerData,i=this.cropBoxData;(i.width>i.maxWidth||i.width<i.minWidth)&&(i.left=i.oldLeft),(i.height>i.maxHeight||i.height<i.minHeight)&&(i.top=i.oldTop),i.width=Math.min(Math.max(i.width,i.minWidth),i.maxWidth),i.height=Math.min(Math.max(i.height,i.minHeight),i.maxHeight),this.limitCropBox(!1,!0),i.left=Math.min(Math.max(i.left,i.minLeft),i.maxLeft),i.top=Math.min(Math.max(i.top,i.minTop),i.maxTop),i.oldLeft=i.left,i.oldTop=i.top,t.movable&&t.cropBoxMovable&&Zl(this.face,ll,i.width>=e.width&&i.height>=e.height?Fo:jo),Ul(this.cropBox,Dl({width:i.width,height:i.height},ra({translateX:i.left,translateY:i.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),ia(this.element,dl,this.getData())}},ga={initPreview:function(){var t=this.element,e=this.crossOrigin,i=this.options.preview,n=e?this.crossOriginUrl:this.url,s=t.alt||"The image to preview",o=document.createElement("img");if(e&&(o.crossOrigin=e),o.src=n,o.alt=s,this.viewBox.appendChild(o),this.viewBoxImage=o,i){var l=i;"string"==typeof i?l=t.ownerDocument.querySelectorAll(i):i.querySelector&&(l=[i]),this.previews=l,Pl(l,(function(t){var i=document.createElement("img");Zl(t,al,{width:t.offsetWidth,height:t.offsetHeight,html:t.innerHTML}),e&&(i.crossOrigin=e),i.src=n,i.alt=s,i.style.cssText='display:block;width:100%;height:auto;min-width:0!important;min-height:0!important;max-width:none!important;max-height:none!important;image-orientation:0deg!important;"',t.innerHTML="",t.appendChild(i)}))}},resetPreview:function(){Pl(this.previews,(function(t){var e=Kl(t,al);Ul(t,{width:e.width,height:e.height}),t.innerHTML=e.html,function(t,e){if(Il(t[e]))try{delete t[e]}catch(i){t[e]=void 0}else if(t.dataset)try{delete t.dataset[e]}catch(i){t.dataset[e]=void 0}else t.removeAttribute("data-".concat(Vl(e)))}(t,al)}))},preview:function(){var t=this.imageData,e=this.canvasData,i=this.cropBoxData,n=i.width,s=i.height,o=t.width,l=t.height,a=i.left-e.left-t.left,r=i.top-e.top-t.top;this.cropped&&!this.disabled&&(Ul(this.viewBoxImage,Dl({width:o,height:l},ra(Dl({translateX:-a,translateY:-r},t)))),Pl(this.previews,(function(e){var i=Kl(e,al),c=i.width,u=i.height,d=c,b=u,h=1;n&&(b=s*(h=c/n)),s&&b>u&&(d=n*(h=u/s),b=u),Ul(e,{width:d,height:b}),Ul(e.getElementsByTagName("img")[0],Dl({width:o*h,height:l*h},ra(Dl({translateX:-a*h,translateY:-r*h},t))))})))}},fa={bind:function(){var t=this.element,e=this.options,i=this.cropper;Bl(e.cropstart)&&ea(t,pl,e.cropstart),Bl(e.cropmove)&&ea(t,hl,e.cropmove),Bl(e.cropend)&&ea(t,bl,e.cropend),Bl(e.crop)&&ea(t,dl,e.crop),Bl(e.zoom)&&ea(t,Sl,e.zoom),ea(i,gl,this.onCropStart=this.cropStart.bind(this)),e.zoomable&&e.zoomOnWheel&&ea(i,wl,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&ea(i,ml,this.onDblclick=this.dblclick.bind(this)),ea(t.ownerDocument,fl,this.onCropMove=this.cropMove.bind(this)),ea(t.ownerDocument,vl,this.onCropEnd=this.cropEnd.bind(this)),e.responsive&&ea(window,xl,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,e=this.options,i=this.cropper;Bl(e.cropstart)&&ta(t,pl,e.cropstart),Bl(e.cropmove)&&ta(t,hl,e.cropmove),Bl(e.cropend)&&ta(t,bl,e.cropend),Bl(e.crop)&&ta(t,dl,e.crop),Bl(e.zoom)&&ta(t,Sl,e.zoom),ta(i,gl,this.onCropStart),e.zoomable&&e.zoomOnWheel&&ta(i,wl,this.onWheel,{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&ta(i,ml,this.onDblclick),ta(t.ownerDocument,fl,this.onCropMove),ta(t.ownerDocument,vl,this.onCropEnd),e.responsive&&ta(window,xl,this.onResize)}},va={resize:function(){if(!this.disabled){var t,e,i=this.options,n=this.container,s=this.containerData,o=n.offsetWidth/s.width,l=n.offsetHeight/s.height,a=Math.abs(o-1)>Math.abs(l-1)?o:l;if(1!==a)i.restore&&(t=this.getCanvasData(),e=this.getCropBoxData()),this.render(),i.restore&&(this.setCanvasData(Pl(t,(function(e,i){t[i]=e*a}))),this.setCropBoxData(Pl(e,(function(t,i){e[i]=t*a}))))}},dblclick:function(){var t,e;this.disabled||this.options.dragMode===ul||this.setDragMode((t=this.dragBox,e=Jo,(t.classList?t.classList.contains(e):t.className.indexOf(e)>-1)?cl:rl))},wheel:function(t){var e=this,i=Number(this.options.wheelZoomRatio)||.1,n=1;this.disabled||(t.preventDefault(),this.wheeling||(this.wheeling=!0,setTimeout((function(){e.wheeling=!1}),50),t.deltaY?n=t.deltaY>0?1:-1:t.wheelDelta?n=-t.wheelDelta/120:t.detail&&(n=t.detail>0?1:-1),this.zoom(-n*i,t)))},cropStart:function(t){var e=t.buttons,i=t.button;if(!(this.disabled||("mousedown"===t.type||"pointerdown"===t.type&&"mouse"===t.pointerType)&&(Tl(e)&&1!==e||Tl(i)&&0!==i||t.ctrlKey))){var n,s=this.options,o=this.pointers;t.changedTouches?Pl(t.changedTouches,(function(t){o[t.identifier]=ca(t)})):o[t.pointerId||0]=ca(t),n=Object.keys(o).length>1&&s.zoomable&&s.zoomOnTouch?Uo:Kl(t.target,ll),kl.test(n)&&!1!==ia(this.element,pl,{originalEvent:t,action:n})&&(t.preventDefault(),this.action=n,this.cropping=!1,n===Ho&&(this.cropping=!0,Wl(this.dragBox,sl)))}},cropMove:function(t){var e=this.action;if(!this.disabled&&e){var i=this.pointers;t.preventDefault(),!1!==ia(this.element,hl,{originalEvent:t,action:e})&&(t.changedTouches?Pl(t.changedTouches,(function(t){Dl(i[t.identifier]||{},ca(t,!0))})):Dl(i[t.pointerId||0]||{},ca(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var e=this.action,i=this.pointers;t.changedTouches?Pl(t.changedTouches,(function(t){delete i[t.identifier]})):delete i[t.pointerId||0],e&&(t.preventDefault(),Object.keys(i).length||(this.action=""),this.cropping&&(this.cropping=!1,Yl(this.dragBox,sl,this.cropped&&this.options.modal)),ia(this.element,bl,{originalEvent:t,action:e}))}}},ya={change:function(t){var e,i=this.options,n=this.canvasData,s=this.containerData,o=this.cropBoxData,l=this.pointers,a=this.action,r=i.aspectRatio,c=o.left,u=o.top,d=o.width,b=o.height,h=c+d,p=u+b,m=0,g=0,f=s.width,v=s.height,y=!0;!r&&t.shiftKey&&(r=d&&b?d/b:1),this.limited&&(m=o.minLeft,g=o.minTop,f=m+Math.min(s.width,n.width,n.left+n.width),v=g+Math.min(s.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 Wo:h+w.x>f&&(w.x=f-h);break;case Go:c+w.x<m&&(w.x=m-c);break;case Xo:u+w.y<g&&(w.y=g-u);break;case Yo:p+w.y>v&&(w.y=v-p)}};switch(a){case jo:c+=w.x,u+=w.y;break;case Wo:if(w.x>=0&&(h>=f||r&&(u<=g||p>=v))){y=!1;break}S(Wo),(d+=w.x)<0&&(a=Go,c-=d=-d),r&&(b=d/r,u+=(o.height-b)/2);break;case Xo:if(w.y<=0&&(u<=g||r&&(c<=m||h>=f))){y=!1;break}S(Xo),b-=w.y,u+=w.y,b<0&&(a=Yo,u-=b=-b),r&&(d=b*r,c+=(o.width-d)/2);break;case Go:if(w.x<=0&&(c<=m||r&&(u<=g||p>=v))){y=!1;break}S(Go),d-=w.x,c+=w.x,d<0&&(a=Wo,c-=d=-d),r&&(b=d/r,u+=(o.height-b)/2);break;case Yo:if(w.y>=0&&(p>=v||r&&(c<=m||h>=f))){y=!1;break}S(Yo),(b+=w.y)<0&&(a=Xo,u-=b=-b),r&&(d=b*r,c+=(o.width-d)/2);break;case Vo:if(r){if(w.y<=0&&(u<=g||h>=f)){y=!1;break}S(Xo),b-=w.y,u+=w.y,d=b*r}else S(Xo),S(Wo),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=Qo,u-=b=-b,c-=d=-d):d<0?(a=Ko,c-=d=-d):b<0&&(a=Zo,u-=b=-b);break;case Ko:if(r){if(w.y<=0&&(u<=g||c<=m)){y=!1;break}S(Xo),b-=w.y,u+=w.y,d=b*r,c+=o.width-d}else S(Xo),S(Go),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=Zo,u-=b=-b,c-=d=-d):d<0?(a=Vo,c-=d=-d):b<0&&(a=Qo,u-=b=-b);break;case Qo:if(r){if(w.x<=0&&(c<=m||p>=v)){y=!1;break}S(Go),d-=w.x,c+=w.x,b=d/r}else S(Yo),S(Go),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=Vo,u-=b=-b,c-=d=-d):d<0?(a=Zo,c-=d=-d):b<0&&(a=Ko,u-=b=-b);break;case Zo:if(r){if(w.x>=0&&(h>=f||p>=v)){y=!1;break}S(Wo),b=(d+=w.x)/r}else S(Yo),S(Wo),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=Ko,u-=b=-b,c-=d=-d):d<0?(a=Qo,c-=d=-d):b<0&&(a=Vo,u-=b=-b);break;case Fo:this.move(w.x,w.y),y=!1;break;case Uo:this.zoom(function(t){var e=qo({},t),i=0;return Pl(t,(function(t,n){delete e[n],Pl(e,(function(e){var n=Math.abs(t.startX-e.startX),s=Math.abs(t.startY-e.startY),o=Math.abs(t.endX-e.endX),l=Math.abs(t.endY-e.endY),a=Math.sqrt(n*n+s*s),r=(Math.sqrt(o*o+l*l)-a)/a;Math.abs(r)>Math.abs(i)&&(i=r)}))})),i}(l),t),y=!1;break;case Ho:if(!w.x||!w.y){y=!1;break}e=na(this.cropper),c=x.startX-e.left,u=x.startY-e.top,d=o.minWidth,b=o.minHeight,w.x>0?a=w.y>0?Zo:Vo:w.x<0&&(c-=d,a=w.y>0?Qo:Ko),w.y<0&&(u-=b),this.cropped||(Gl(this.cropBox,el),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0))}y&&(o.width=d,o.height=b,o.left=c,o.top=u,this.action=a,this.renderCropBox()),Pl(l,(function(t){t.startX=t.endX,t.startY=t.endY}))}},xa={crop:function(){return!this.ready||this.cropped||this.disabled||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&Wl(this.dragBox,sl),Gl(this.cropBox,el),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=Dl({},this.initialImageData),this.canvasData=Dl({},this.initialCanvasData),this.cropBoxData=Dl({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(Dl(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),Gl(this.dragBox,sl),Wl(this.cropBox,el)),this},replace:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return!this.disabled&&t&&(this.isImg&&(this.element.src=t),e?(this.url=t,this.image.src=t,this.ready&&(this.viewBoxImage.src=t,Pl(this.previews,(function(e){e.getElementsByTagName("img")[0].src=t})))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(t))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,Gl(this.cropper,tl)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,Wl(this.cropper,tl)),this},destroy:function(){var t=this.element;return t.cropper?(t.cropper=void 0,this.isImg&&this.replaced&&(t.src=this.originalUrl),this.uncreate(),this):this},move:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.canvasData,n=i.left,s=i.top;return this.moveTo(Ol(t)?t:n+Number(t),Ol(e)?e:s+Number(e))},moveTo:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.canvasData,n=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.movable&&(Tl(t)&&(i.left=t,n=!0),Tl(e)&&(i.top=e,n=!0),n&&this.renderCanvas(!0)),this},zoom:function(t,e){var i=this.canvasData;return t=(t=Number(t))<0?1/(1-t):1+t,this.zoomTo(i.width*t/i.naturalWidth,null,e)},zoomTo:function(t,e,i){var n=this.options,s=this.canvasData,o=s.width,l=s.height,a=s.naturalWidth,r=s.naturalHeight;if((t=Number(t))>=0&&this.ready&&!this.disabled&&n.zoomable){var c=a*t,u=r*t;if(!1===ia(this.element,Sl,{ratio:t,oldRatio:o/a,originalEvent:i}))return this;if(i){var d=this.pointers,b=na(this.cropper),h=d&&Object.keys(d).length?function(t){var e=0,i=0,n=0;return Pl(t,(function(t){var s=t.startX,o=t.startY;e+=s,i+=o,n+=1})),{pageX:e/=n,pageY:i/=n}}(d):{pageX:i.pageX,pageY:i.pageY};s.left-=(c-o)*((h.pageX-b.left-s.left)/o),s.top-=(u-l)*((h.pageY-b.top-s.top)/l)}else Rl(e)&&Tl(e.x)&&Tl(e.y)?(s.left-=(c-o)*((e.x-s.left)/o),s.top-=(u-l)*((e.y-s.top)/l)):(s.left-=(c-o)/2,s.top-=(u-l)/2);s.width=c,s.height=u,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return Tl(t=Number(t))&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=t%360,this.renderCanvas(!0,!0)),this},scaleX:function(t){var e=this.imageData.scaleY;return this.scale(t,Tl(e)?e:1)},scaleY:function(t){var e=this.imageData.scaleX;return this.scale(Tl(e)?e:1,t)},scale:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t,i=this.imageData,n=!1;return t=Number(t),e=Number(e),this.ready&&!this.disabled&&this.options.scalable&&(Tl(t)&&(i.scaleX=t,n=!0),Tl(e)&&(i.scaleY=e,n=!0),n&&this.renderCanvas(!0,!0)),this},getData:function(){var t,e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=this.options,n=this.imageData,s=this.canvasData,o=this.cropBoxData;if(this.ready&&this.cropped){t={x:o.left-s.left,y:o.top-s.top,width:o.width,height:o.height};var l=n.width/n.naturalWidth;if(Pl(t,(function(e,i){t[i]=e/l})),e){var a=Math.round(t.y+t.height),r=Math.round(t.x+t.width);t.x=Math.round(t.x),t.y=Math.round(t.y),t.width=r-t.x,t.height=a-t.y}}else t={x:0,y:0,width:0,height:0};return i.rotatable&&(t.rotate=n.rotate||0),i.scalable&&(t.scaleX=n.scaleX||1,t.scaleY=n.scaleY||1),t},setData:function(t){var e=this.options,i=this.imageData,n=this.canvasData,s={};if(this.ready&&!this.disabled&&Rl(t)){var o=!1;e.rotatable&&Tl(t.rotate)&&t.rotate!==i.rotate&&(i.rotate=t.rotate,o=!0),e.scalable&&(Tl(t.scaleX)&&t.scaleX!==i.scaleX&&(i.scaleX=t.scaleX,o=!0),Tl(t.scaleY)&&t.scaleY!==i.scaleY&&(i.scaleY=t.scaleY,o=!0)),o&&this.renderCanvas(!0,!0);var l=i.width/i.naturalWidth;Tl(t.x)&&(s.left=t.x*l+n.left),Tl(t.y)&&(s.top=t.y*l+n.top),Tl(t.width)&&(s.width=t.width*l),Tl(t.height)&&(s.height=t.height*l),this.setCropBoxData(s)}return this},getContainerData:function(){return this.ready?Dl({},this.containerData):{}},getImageData:function(){return this.sized?Dl({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,e={};return this.ready&&Pl(["left","top","width","height","naturalWidth","naturalHeight"],(function(i){e[i]=t[i]})),e},setCanvasData:function(t){var e=this.canvasData,i=e.aspectRatio;return this.ready&&!this.disabled&&Rl(t)&&(Tl(t.left)&&(e.left=t.left),Tl(t.top)&&(e.top=t.top),Tl(t.width)?(e.width=t.width,e.height=t.width/i):Tl(t.height)&&(e.height=t.height,e.width=t.height*i),this.renderCanvas(!0)),this},getCropBoxData:function(){var t,e=this.cropBoxData;return this.ready&&this.cropped&&(t={left:e.left,top:e.top,width:e.width,height:e.height}),t||{}},setCropBoxData:function(t){var e,i,n=this.cropBoxData,s=this.options.aspectRatio;return this.ready&&this.cropped&&!this.disabled&&Rl(t)&&(Tl(t.left)&&(n.left=t.left),Tl(t.top)&&(n.top=t.top),Tl(t.width)&&t.width!==n.width&&(e=!0,n.width=t.width),Tl(t.height)&&t.height!==n.height&&(i=!0,n.height=t.height),s&&(e?n.height=n.width/s:i&&(n.width=n.height*s)),this.renderCropBox()),this},getCroppedCanvas:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var e=this.canvasData,i=da(this.image,this.imageData,e,t);if(!this.cropped)return i;var n=this.getData(),s=n.x,o=n.y,l=n.width,a=n.height,r=i.width/Math.floor(e.naturalWidth);1!==r&&(s*=r,o*=r,l*=r,a*=r);var c=l/a,u=ua({aspectRatio:c,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),d=ua({aspectRatio:c,width:t.minWidth||0,height:t.minHeight||0},"cover"),b=ua({aspectRatio:c,width:t.width||(1!==r?i.width:l),height:t.height||(1!==r?i.height:a)}),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=Hl(h),m.height=Hl(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,L=i.width,A=i.height,E=s,q=o;E<=-l||E>L?(E=0,x=0,S=0,k=0):E<=0?(S=-E,E=0,k=x=Math.min(L,l+E)):E<=L&&(S=0,k=x=Math.min(l,L-E)),x<=0||q<=-a||q>A?(q=0,w=0,_=0,C=0):q<=0?(_=-q,q=0,C=w=Math.min(A,a+q)):q<=A&&(_=0,C=w=Math.min(a,A-q));var T=[E,q,x,w];if(k>0&&C>0){var M=h/l;T.push(S*M,_*M,k*M,C*M)}return g.drawImage.apply(g,[i].concat(zo(T.map((function(t){return Math.floor(Hl(t))}))))),m},setAspectRatio:function(t){var e=this.options;return this.disabled||Ol(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 s=t===rl,o=e.movable&&t===cl;t=s||o?t:ul,e.dragMode=t,Zl(i,ll,t),Yl(i,Jo,s),Yl(i,ol,o),e.cropBoxMovable||(Zl(n,ll,t),Yl(n,Jo,s),Yl(n,ol,o))}return this}},wa=$o.Cropper,Sa=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(Mo(this,t),!e||!Al.test(e.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=e,this.options=Dl({},El,Rl(i)&&i),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,this.sized=!1,this.sizing=!1,this.init()}var e,i,n;return e=t,i=[{key:"init",value:function(){var t,e=this.element,i=e.tagName.toLowerCase();if(!e.cropper){if(e.cropper=this,"img"===i){if(this.isImg=!0,t=e.getAttribute("src")||"",this.originalUrl=t,!t)return;t=e.src}else"canvas"===i&&window.HTMLCanvasElement&&(t=e.toDataURL());this.load(t)}}},{key:"load",value:function(t){var e=this;if(t){this.url=t,this.imageData={};var i=this.element,n=this.options;if(n.rotatable||n.scalable||(n.checkOrientation=!1),n.checkOrientation&&window.ArrayBuffer)if(Cl.test(t))Ll.test(t)?this.read((s=t.replace(ha,""),o=atob(s),l=new ArrayBuffer(o.length),Pl(a=new Uint8Array(l),(function(t,e){a[e]=o.charCodeAt(e)})),l)):this.clone();else{var s,o,l,a,r=new XMLHttpRequest,c=this.clone.bind(this);this.reloading=!0,this.xhr=r,r.onabort=c,r.onerror=c,r.ontimeout=c,r.onprogress=function(){r.getResponseHeader("content-type")!==_l&&r.abort()},r.onload=function(){e.read(r.response)},r.onloadend=function(){e.reloading=!1,e.xhr=null},n.checkCrossOrigin&&la(t)&&i.crossOrigin&&(t=aa(t)),r.open("GET",t,!0),r.responseType="arraybuffer",r.withCredentials="use-credentials"===i.crossOrigin,r.send()}else this.clone()}}},{key:"read",value:function(t){var e=this.options,i=this.imageData,n=pa(t),s=0,o=1,l=1;if(n>1){this.url=function(t,e){for(var i=[],n=new Uint8Array(t);n.length>0;)i.push(ba.apply(null,Nl(n.subarray(0,8192)))),n=n.subarray(8192);return"data:".concat(e,";base64,").concat(btoa(i.join("")))}(t,_l);var a=function(t){var e=0,i=1,n=1;switch(t){case 2:i=-1;break;case 3:e=-180;break;case 4:n=-1;break;case 5:e=90,n=-1;break;case 6:e=90;break;case 7:e=90,i=-1;break;case 8:e=-90}return{rotate:e,scaleX:i,scaleY:n}}(n);s=a.rotate,o=a.scaleX,l=a.scaleY}e.rotatable&&(i.rotate=s),e.scalable&&(i.scaleX=o,i.scaleY=l),this.clone()}},{key:"clone",value:function(){var t=this.element,e=this.url,i=t.crossOrigin,n=e;this.options.checkCrossOrigin&&la(e)&&(i||(i="anonymous"),n=aa(e)),this.crossOrigin=i,this.crossOriginUrl=n;var s=document.createElement("img");i&&(s.crossOrigin=i),s.src=n||e,s.alt=t.alt||"The image to crop",this.image=s,s.onload=this.start.bind(this),s.onerror=this.stop.bind(this),Wl(s,il),t.parentNode.insertBefore(s,t.nextSibling)}},{key:"start",value:function(){var t=this,e=this.image;e.onload=null,e.onerror=null,this.sizing=!0;var i=$o.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test($o.navigator.userAgent),n=function(e,i){Dl(t.imageData,{naturalWidth:e,naturalHeight:i,aspectRatio:e/i}),t.initialImageData=Dl({},t.imageData),t.sizing=!1,t.sized=!0,t.build()};if(!e.naturalWidth||i){var s=document.createElement("img"),o=document.body||document.documentElement;this.sizingImage=s,s.onload=function(){n(s.width,s.height),i||o.removeChild(s)},s.src=e.src,i||(s.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;",o.appendChild(s))}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,s=document.createElement("div");s.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 o=s.querySelector(".".concat(Do,"-container")),l=o.querySelector(".".concat(Do,"-canvas")),a=o.querySelector(".".concat(Do,"-drag-box")),r=o.querySelector(".".concat(Do,"-crop-box")),c=r.querySelector(".".concat(Do,"-face"));this.container=n,this.cropper=o,this.canvas=l,this.dragBox=a,this.cropBox=r,this.viewBox=o.querySelector(".".concat(Do,"-view-box")),this.face=c,l.appendChild(i),Wl(t,el),n.insertBefore(o,t.nextSibling),this.isImg||Gl(i,il),this.initPreview(),this.bind(),e.initialAspectRatio=Math.max(0,e.initialAspectRatio)||NaN,e.aspectRatio=Math.max(0,e.aspectRatio)||NaN,e.viewMode=Math.max(0,Math.min(3,Math.round(e.viewMode)))||0,Wl(r,el),e.guides||Wl(r.getElementsByClassName("".concat(Do,"-dashed")),el),e.center||Wl(r.getElementsByClassName("".concat(Do,"-center")),el),e.background&&Wl(o,"".concat(Do,"-bg")),e.highlight||Wl(c,nl),e.cropBoxMovable&&(Wl(c,ol),Zl(c,ll,jo)),e.cropBoxResizable||(Wl(r.getElementsByClassName("".concat(Do,"-line")),el),Wl(r.getElementsByClassName("".concat(Do,"-point")),el)),this.render(),this.ready=!0,this.setDragMode(e.dragMode),e.autoCrop&&this.crop(),this.setData(e.data),Bl(e.ready)&&ea(t,yl,e.ready,{once:!0}),ia(t,yl)}}},{key:"unbuild",value:function(){this.ready&&(this.ready=!1,this.unbind(),this.resetPreview(),this.cropper.parentNode.removeChild(this.cropper),Gl(this.element,el))}},{key:"uncreate",value:function(){this.ready?(this.unbuild(),this.ready=!1,this.cropped=!1):this.sizing?(this.sizingImage.onload=null,this.sizing=!1,this.sized=!1):this.reloading?(this.xhr.onabort=null,this.xhr.abort()):this.image&&this.stop()}}],n=[{key:"noConflict",value:function(){return window.Cropper=wa,t}},{key:"setDefaults",value:function(t){Dl(El,Rl(t)&&t)}}],i&&Oo(e.prototype,i),n&&Oo(e,n),t}();function _a(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];return e.map((function(e){return e.split(" ").map((function(e){return e?""+t+e:""})).join(" ")})).join(" ")}function ka(t,e){return function(i){i&&(t[e]=i)}}function Ca(t,e,i){return function(n){n&&(t[e][i]=n)}}function La(t,e){return function(i){var n=i.prototype;t.forEach((function(t){e(n,t)}))}}function Aa(t,e){return void 0===e&&(e={}),function(i,n){t.forEach((function(t){var s=e[t]||t;s in i||(i[s]=function(){for(var e,i=[],s=0;s<arguments.length;s++)i[s]=arguments[s];var o=(e=this[n])[t].apply(e,i);return o===this[n]?this:o})}))}}Dl(Sa.prototype,ma,ga,fa,va,ya,xa);var Ea=function(){function t(){this.keys=[],this.values=[]}var e=t.prototype;return e.get=function(t){return this.values[this.keys.indexOf(t)]},e.set=function(t,e){var i=this.keys,n=this.values,s=i.indexOf(t),o=-1===s?i.length:s;i[o]=t,n[o]=e},t}(),qa=function(){function t(){this.object={}}var e=t.prototype;return e.get=function(t){return this.object[t]},e.set=function(t,e){this.object[t]=e},t}(),Ta="function"==typeof Map,Ma=function(){function t(){}var e=t.prototype;return e.connect=function(t,e){this.prev=t,this.next=e,t&&(t.next=this),e&&(e.prev=this)},e.disconnect=function(){var t=this.prev,e=this.next;t&&(t.next=e),e&&(e.prev=t)},e.getIndex=function(){for(var t=this,e=-1;t;)t=t.prev,++e;return e},t}();var Oa=function(){function t(t,e,i,n,s,o,l,a){this.prevList=t,this.list=e,this.added=i,this.removed=n,this.changed=s,this.maintained=o,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],s=t[1],o=new Ma;i[e]=o,n[s]=o})),i.forEach((function(t,e){t.connect(i[e-1])})),t.filter((function(t,i){return!e[i]})).map((function(t,e){var s=t[0],o=t[1];if(s===o)return[0,0];var l=i[s],a=n[o-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 s=t[0],o=t[1],l=e[n],a=l[0],r=l[1];if(s!==o)return i.push([a,r]),!0})),this.cachePureChanged=i},t}();function Ia(t,e,i){var n=Ta?Map:i?qa:Ea,s=i||function(t){return t},o=[],l=[],a=[],r=t.map(s),c=e.map(s),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?(o.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 Oa(t,e,o,l,m,a,b,h)}var za=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=Ia(this.list,e,this.findKeyCallback);return this.list=e,i},t}(),Ra="undefined",Ba=typeof window!==Ra,$a=[{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"},{open:'\\"',close:'\\"'},{open:"\\'",close:"\\'"}],Na=1e-7,Pa={cm:function(t){return 96*t/2.54},mm:function(t){return 96*t/254},in:function(t){return 96*t},pt:function(t){return 96*t/72},pc:function(t){return 96*t/6},"%":function(t,e){return t*e/100},vw:function(t,e){return void 0===e&&(e=window.innerWidth),t/100*e},vh:function(t,e){return void 0===e&&(e=window.innerHeight),t/100*e},vmax:function(t,e){return void 0===e&&(e=Math.max(window.innerWidth,window.innerHeight)),t/100*e},vmin:function(t,e){return void 0===e&&(e=Math.min(window.innerWidth,window.innerHeight)),t/100*e}};function Da(t){return typeof t===Ra}function ja(t){return t&&"object"==typeof t}function Ha(t){return Array.isArray(t)}function Fa(t){return"string"==typeof t}function Ua(t){return"number"==typeof t}function Wa(t){return"function"==typeof t}function Ga(t,e,i,n,s){return Ya(t,e,i)?i:function(t,e,i,n,s){for(var o,l=function(i){var l=e[i].trim();if(l===t.close&&!Ya(t,e,i))return{value:i};var a=i,r=ir(s,(function(t){return t.open===l}));if(r&&(a=Ga(r,e,i,n,s)),-1===a)return o=i,"break";o=i=a},a=i;a<n;++a){var r=l(a);if(a=o,"object"==typeof r)return r.value;if("break"===r)break}return-1}(t,e,i+1,n,s)}function Ya(t,e,i){if(!t.ignore)return null;var n=e.slice(Math.max(i-3,0),i+3).join("");return new RegExp(t.ignore).exec(n)}function Xa(t,e){var i=Fa(e)?{separator:e}:e,n=i.separator,s=void 0===n?",":n,o=i.isSeparateFirst,l=i.isSeparateOnlyOpenClose,a=i.isSeparateOpenClose,r=void 0===a?l:a,c=i.openCloseCharacters,u=void 0===c?$a:c,d=u.map((function(t){var e=t.open,i=t.close;return e===i?e:e+"|"+i})).join("|"),b=new RegExp("(\\s*"+s+"\\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=ir(u,(function(t){return t.open===e})),a=ir(u,(function(t){return t.close===e}));if(n){if(-1!==(i=Ga(n,h,t,p,u))&&r)return f()&&o?(v=t,"break"):(m.push(h.slice(t,i+1).join("")),t=i,o?(v=t,"break"):(v=t,"continue"))}else{if(a&&!Ya(a,h,t))throw new Error("invalid format: "+a.close);if(function(t,e){return(""===e||" "==e)&&(""===t||" "==t)||t===e}(e,s)&&!l)return f(),o?(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 Va(t){return Xa(t,"")}function Ka(t){return Xa(t,",")}function Za(t){var e=/([^(]*)\(([\s\S]*)\)([\s\S]*)/g.exec(t);return!e||e.length<4?{}:{prefix:e[1],value:e[2],suffix:e[3]}}function Qa(t){var e=/^([^\d|e|\-|\+]*)((?:\d|\.|-|e-|e\+)+)(\S*)$/g.exec(t);if(!e)return{prefix:"",unit:"",value:NaN};var i=e[1],n=e[2];return{prefix:i,unit:e[3],value:parseFloat(n)}}function Ja(t,e){return void 0===e&&(e="-"),t.replace(/([a-z])([A-Z])/g,(function(t,i,n){return""+i+e+n.toLowerCase()}))}function tr(){return Date.now?Date.now():(new Date).getTime()}function er(t,e,i){void 0===i&&(i=-1);for(var n=t.length,s=0;s<n;++s)if(e(t[s],s,t))return s;return i}function ir(t,e,i){var n=er(t,e);return n>-1?t[n]:i}var nr=function(){var t=tr(),e=Ba&&(window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.msRequestAnimationFrame);return e?e.bind(window):function(e){var i=tr();return window.setTimeout((function(){e(i-t)}),1e3/60)}}(),sr=function(){var t=Ba&&(window.cancelAnimationFrame||window.webkitCancelAnimationFrame||window.mozCancelAnimationFrame||window.msCancelAnimationFrame);return t?t.bind(window):function(t){clearTimeout(t)}}();function or(t){if(Object.keys)return Object.keys(t);var e=[];for(var i in e)e.push(i);return e}function lr(t,e){var i=Qa(t),n=i.value,s=i.unit;if(ja(e)){var o=e[s];if(o){if(Wa(o))return o(n);if(Pa[s])return Pa[s](n,o)}}else if("%"===s)return n*e/100;return Pa[s]?Pa[s](n):n}function ar(t,e,i,n){return void 0===n&&(n=t[0]/t[1]),[[hr(e[0],Na),hr(e[0]/n,Na)],[hr(e[1]*n,Na),hr(e[1],Na)]].filter((function(t){return t.every((function(t,n){var s=e[n],o=hr(s,Na);return i?t<=s||t<=o:t>=s||t>=o}))}))[0]||t}function rr(t,e,i,n){if(!n)return t.map((function(t,n){return function(t,e,i){return Math.max(e,Math.min(t,i))}(t,e[n],i[n])}));var s=t[0],o=t[1],l=!0===n?s/o:n,a=ar(t,e,!1,l),r=a[0],c=a[1],u=ar(t,i,!0,l),d=u[0],b=u[1];return s<r||o<c?(s=r,o=c):(s>d||o>b)&&(s=d,o=b),[s,o]}function cr(t){for(var e=t.length,i=0,n=e-1;n>=0;--n)i+=t[n];return e?i/e:0}function ur(t,e){var i=e[0]-t[0],n=e[1]-t[1],s=Math.atan2(n,i);return s>=0?s:s+2*Math.PI}function dr(t){var e=function(t){return[0,1].map((function(e){return cr(t.map((function(t){return t[e]})))}))}(t),i=ur(e,t[0]),n=ur(e,t[1]);return i<n&&n-i<Math.PI||i>n&&n-i<-Math.PI?1:-1}function br(t,e){return Math.sqrt(Math.pow((e?e[0]:0)-t[0],2)+Math.pow((e?e[1]:0)-t[1],2))}function hr(t,e){if(!e)return t;var i=1/e;return Math.round(t/e)/i}function pr(t,e){return t.forEach((function(i,n){t[n]=hr(t[n],e)})),t}function mr(t,e){return t.classList?t.classList.contains(e):!!t.className.match(new RegExp("(\\s|^)"+e+"(\\s|$)"))}function gr(t,e,i,n){t.addEventListener(e,i,n)}function fr(t,e,i,n){t.removeEventListener(e,i,n)}
41
41
  /*! *****************************************************************************
42
42
  Copyright (c) Microsoft Corporation. All rights reserved.
43
43
  Licensed under the Apache License, Version 2.0 (the "License"); you may not use