(function(t,e){"object"===typeof exports&&"object"===typeof module?module.exports=e():"function"===typeof define&&define.amd?define([],e):"object"===typeof exports?exports["cropperjs"]=e():t["cropperjs"]=e()})("undefined"!==typeof self?self:this,(function(){return function(){var t={9662:function(t,e,i){var n=i(614),r=i(6330),a=TypeError;t.exports=function(t){if(n(t))return t;throw a(r(t)+" is not a function")}},9670:function(t,e,i){var n=i(111),r=String,a=TypeError;t.exports=function(t){if(n(t))return t;throw a(r(t)+" is not an object")}},1318:function(t,e,i){var n=i(5656),r=i(1400),a=i(6244),o=function(t){return function(e,i,o){var s,h=n(e),c=a(h),p=r(o,c);if(t&&i!=i){while(c>p)if(s=h[p++],s!=s)return!0}else for(;c>p;p++)if((t||p in h)&&h[p]===i)return t||p||0;return!t&&-1}};t.exports={includes:o(!0),indexOf:o(!1)}},3658:function(t,e,i){"use strict";var n=i(9781),r=i(3157),a=TypeError,o=Object.getOwnPropertyDescriptor,s=n&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}();t.exports=s?function(t,e){if(r(t)&&!o(t,"length").writable)throw a("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e}},4326:function(t,e,i){var n=i(1702),r=n({}.toString),a=n("".slice);t.exports=function(t){return a(r(t),8,-1)}},9920:function(t,e,i){var n=i(2597),r=i(3887),a=i(1236),o=i(3070);t.exports=function(t,e,i){for(var s=r(e),h=o.f,c=a.f,p=0;pi)throw e("Maximum allowed index exceeded");return t}},8113:function(t){t.exports="undefined"!=typeof navigator&&String(navigator.userAgent)||""},7392:function(t,e,i){var n,r,a=i(7854),o=i(8113),s=a.process,h=a.Deno,c=s&&s.versions||h&&h.version,p=c&&c.v8;p&&(n=p.split("."),r=n[0]>0&&n[0]<4?1:+(n[0]+n[1])),!r&&o&&(n=o.match(/Edge\/(\d+)/),(!n||n[1]>=74)&&(n=o.match(/Chrome\/(\d+)/),n&&(r=+n[1]))),t.exports=r},748:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},2109:function(t,e,i){var n=i(7854),r=i(1236).f,a=i(8880),o=i(8052),s=i(3072),h=i(9920),c=i(4705);t.exports=function(t,e){var i,p,u,l,d,f,m=t.target,g=t.global,v=t.stat;if(p=g?n:v?n[m]||s(m,{}):(n[m]||{}).prototype,p)for(u in e){if(d=e[u],t.dontCallGetSet?(f=r(p,u),l=f&&f.value):l=p[u],i=c(g?u:m+(v?".":"#")+u,t.forced),!i&&void 0!==l){if(typeof d==typeof l)continue;h(d,l)}(t.sham||l&&l.sham)&&a(d,"sham",!0),o(p,u,d,t)}}},7293:function(t){t.exports=function(t){try{return!!t()}catch(e){return!0}}},4374:function(t,e,i){var n=i(7293);t.exports=!n((function(){var t=function(){}.bind();return"function"!=typeof t||t.hasOwnProperty("prototype")}))},6916:function(t,e,i){var n=i(4374),r=Function.prototype.call;t.exports=n?r.bind(r):function(){return r.apply(r,arguments)}},6530:function(t,e,i){var n=i(9781),r=i(2597),a=Function.prototype,o=n&&Object.getOwnPropertyDescriptor,s=r(a,"name"),h=s&&"something"===function(){}.name,c=s&&(!n||n&&o(a,"name").configurable);t.exports={EXISTS:s,PROPER:h,CONFIGURABLE:c}},1702:function(t,e,i){var n=i(4374),r=Function.prototype,a=r.call,o=n&&r.bind.bind(a,a);t.exports=n?o:function(t){return function(){return a.apply(t,arguments)}}},5005:function(t,e,i){var n=i(7854),r=i(614),a=function(t){return r(t)?t:void 0};t.exports=function(t,e){return arguments.length<2?a(n[t]):n[t]&&n[t][e]}},8173:function(t,e,i){var n=i(9662),r=i(8554);t.exports=function(t,e){var i=t[e];return r(i)?void 0:n(i)}},7854:function(t,e,i){var n=function(t){return t&&t.Math==Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof i.g&&i.g)||function(){return this}()||Function("return this")()},2597:function(t,e,i){var n=i(1702),r=i(7908),a=n({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return a(r(t),e)}},3501:function(t){t.exports={}},4664:function(t,e,i){var n=i(9781),r=i(7293),a=i(317);t.exports=!n&&!r((function(){return 7!=Object.defineProperty(a("div"),"a",{get:function(){return 7}}).a}))},8361:function(t,e,i){var n=i(1702),r=i(7293),a=i(4326),o=Object,s=n("".split);t.exports=r((function(){return!o("z").propertyIsEnumerable(0)}))?function(t){return"String"==a(t)?s(t,""):o(t)}:o},2788:function(t,e,i){var n=i(1702),r=i(614),a=i(5465),o=n(Function.toString);r(a.inspectSource)||(a.inspectSource=function(t){return o(t)}),t.exports=a.inspectSource},9909:function(t,e,i){var n,r,a,o=i(4811),s=i(7854),h=i(111),c=i(8880),p=i(2597),u=i(5465),l=i(6200),d=i(3501),f="Object already initialized",m=s.TypeError,g=s.WeakMap,v=function(t){return a(t)?r(t):n(t,{})},b=function(t){return function(e){var i;if(!h(e)||(i=r(e)).type!==t)throw m("Incompatible receiver, "+t+" required");return i}};if(o||u.state){var y=u.state||(u.state=new g);y.get=y.get,y.has=y.has,y.set=y.set,n=function(t,e){if(y.has(t))throw m(f);return e.facade=t,y.set(t,e),e},r=function(t){return y.get(t)||{}},a=function(t){return y.has(t)}}else{var w=l("state");d[w]=!0,n=function(t,e){if(p(t,w))throw m(f);return e.facade=t,c(t,w,e),e},r=function(t){return p(t,w)?t[w]:{}},a=function(t){return p(t,w)}}t.exports={set:n,get:r,has:a,enforce:v,getterFor:b}},3157:function(t,e,i){var n=i(4326);t.exports=Array.isArray||function(t){return"Array"==n(t)}},614:function(t,e,i){var n=i(4154),r=n.all;t.exports=n.IS_HTMLDDA?function(t){return"function"==typeof t||t===r}:function(t){return"function"==typeof t}},4705:function(t,e,i){var n=i(7293),r=i(614),a=/#|\.prototype\./,o=function(t,e){var i=h[s(t)];return i==p||i!=c&&(r(e)?n(e):!!e)},s=o.normalize=function(t){return String(t).replace(a,".").toLowerCase()},h=o.data={},c=o.NATIVE="N",p=o.POLYFILL="P";t.exports=o},8554:function(t){t.exports=function(t){return null===t||void 0===t}},111:function(t,e,i){var n=i(614),r=i(4154),a=r.all;t.exports=r.IS_HTMLDDA?function(t){return"object"==typeof t?null!==t:n(t)||t===a}:function(t){return"object"==typeof t?null!==t:n(t)}},1913:function(t){t.exports=!1},2190:function(t,e,i){var n=i(5005),r=i(614),a=i(7976),o=i(3307),s=Object;t.exports=o?function(t){return"symbol"==typeof t}:function(t){var e=n("Symbol");return r(e)&&a(e.prototype,s(t))}},6244:function(t,e,i){var n=i(7466);t.exports=function(t){return n(t.length)}},6339:function(t,e,i){var n=i(1702),r=i(7293),a=i(614),o=i(2597),s=i(9781),h=i(6530).CONFIGURABLE,c=i(2788),p=i(9909),u=p.enforce,l=p.get,d=String,f=Object.defineProperty,m=n("".slice),g=n("".replace),v=n([].join),b=s&&!r((function(){return 8!==f((function(){}),"length",{value:8}).length})),y=String(String).split("String"),w=t.exports=function(t,e,i){"Symbol("===m(d(e),0,7)&&(e="["+g(d(e),/^Symbol\(([^)]*)\)/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!o(t,"name")||h&&t.name!==e)&&(s?f(t,"name",{value:e,configurable:!0}):t.name=e),b&&i&&o(i,"arity")&&t.length!==i.arity&&f(t,"length",{value:i.arity});try{i&&o(i,"constructor")&&i.constructor?s&&f(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(r){}var n=u(t);return o(n,"source")||(n.source=v(y,"string"==typeof e?e:"")),t};Function.prototype.toString=w((function(){return a(this)&&l(this).source||c(this)}),"toString")},4758:function(t){var e=Math.ceil,i=Math.floor;t.exports=Math.trunc||function(t){var n=+t;return(n>0?i:e)(n)}},3070:function(t,e,i){var n=i(9781),r=i(4664),a=i(3353),o=i(9670),s=i(4948),h=TypeError,c=Object.defineProperty,p=Object.getOwnPropertyDescriptor,u="enumerable",l="configurable",d="writable";e.f=n?a?function(t,e,i){if(o(t),e=s(e),o(i),"function"===typeof t&&"prototype"===e&&"value"in i&&d in i&&!i[d]){var n=p(t,e);n&&n[d]&&(t[e]=i.value,i={configurable:l in i?i[l]:n[l],enumerable:u in i?i[u]:n[u],writable:!1})}return c(t,e,i)}:c:function(t,e,i){if(o(t),e=s(e),o(i),r)try{return c(t,e,i)}catch(n){}if("get"in i||"set"in i)throw h("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},1236:function(t,e,i){var n=i(9781),r=i(6916),a=i(5296),o=i(9114),s=i(5656),h=i(4948),c=i(2597),p=i(4664),u=Object.getOwnPropertyDescriptor;e.f=n?u:function(t,e){if(t=s(t),e=h(e),p)try{return u(t,e)}catch(i){}if(c(t,e))return o(!r(a.f,t,e),t[e])}},8006:function(t,e,i){var n=i(6324),r=i(748),a=r.concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return n(t,a)}},5181:function(t,e){e.f=Object.getOwnPropertySymbols},7976:function(t,e,i){var n=i(1702);t.exports=n({}.isPrototypeOf)},6324:function(t,e,i){var n=i(1702),r=i(2597),a=i(5656),o=i(1318).indexOf,s=i(3501),h=n([].push);t.exports=function(t,e){var i,n=a(t),c=0,p=[];for(i in n)!r(s,i)&&r(n,i)&&h(p,i);while(e.length>c)r(n,i=e[c++])&&(~o(p,i)||h(p,i));return p}},5296:function(t,e){"use strict";var i={}.propertyIsEnumerable,n=Object.getOwnPropertyDescriptor,r=n&&!i.call({1:2},1);e.f=r?function(t){var e=n(this,t);return!!e&&e.enumerable}:i},2140:function(t,e,i){var n=i(6916),r=i(614),a=i(111),o=TypeError;t.exports=function(t,e){var i,s;if("string"===e&&r(i=t.toString)&&!a(s=n(i,t)))return s;if(r(i=t.valueOf)&&!a(s=n(i,t)))return s;if("string"!==e&&r(i=t.toString)&&!a(s=n(i,t)))return s;throw o("Can't convert object to primitive value")}},3887:function(t,e,i){var n=i(5005),r=i(1702),a=i(8006),o=i(5181),s=i(9670),h=r([].concat);t.exports=n("Reflect","ownKeys")||function(t){var e=a.f(s(t)),i=o.f;return i?h(e,i(t)):e}},4488:function(t,e,i){var n=i(8554),r=TypeError;t.exports=function(t){if(n(t))throw r("Can't call method on "+t);return t}},6200:function(t,e,i){var n=i(2309),r=i(9711),a=n("keys");t.exports=function(t){return a[t]||(a[t]=r(t))}},5465:function(t,e,i){var n=i(7854),r=i(3072),a="__core-js_shared__",o=n[a]||r(a,{});t.exports=o},2309:function(t,e,i){var n=i(1913),r=i(5465);(t.exports=function(t,e){return r[t]||(r[t]=void 0!==e?e:{})})("versions",[]).push({version:"3.29.1",mode:n?"pure":"global",copyright:"© 2014-2023 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.29.1/LICENSE",source:"https://github.com/zloirock/core-js"})},6293:function(t,e,i){var n=i(7392),r=i(7293);t.exports=!!Object.getOwnPropertySymbols&&!r((function(){var t=Symbol();return!String(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&n&&n<41}))},1400:function(t,e,i){var n=i(9303),r=Math.max,a=Math.min;t.exports=function(t,e){var i=n(t);return i<0?r(i+e,0):a(i,e)}},5656:function(t,e,i){var n=i(8361),r=i(4488);t.exports=function(t){return n(r(t))}},9303:function(t,e,i){var n=i(4758);t.exports=function(t){var e=+t;return e!==e||0===e?0:n(e)}},7466:function(t,e,i){var n=i(9303),r=Math.min;t.exports=function(t){return t>0?r(n(t),9007199254740991):0}},7908:function(t,e,i){var n=i(4488),r=Object;t.exports=function(t){return r(n(t))}},7593:function(t,e,i){var n=i(6916),r=i(111),a=i(2190),o=i(8173),s=i(2140),h=i(5112),c=TypeError,p=h("toPrimitive");t.exports=function(t,e){if(!r(t)||a(t))return t;var i,h=o(t,p);if(h){if(void 0===e&&(e="default"),i=n(h,t,e),!r(i)||a(i))return i;throw c("Can't convert object to primitive value")}return void 0===e&&(e="number"),s(t,e)}},4948:function(t,e,i){var n=i(7593),r=i(2190);t.exports=function(t){var e=n(t,"string");return r(e)?e:e+""}},6330:function(t){var e=String;t.exports=function(t){try{return e(t)}catch(i){return"Object"}}},9711:function(t,e,i){var n=i(1702),r=0,a=Math.random(),o=n(1..toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+o(++r+a,36)}},3307:function(t,e,i){var n=i(6293);t.exports=n&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},3353:function(t,e,i){var n=i(9781),r=i(7293);t.exports=n&&r((function(){return 42!=Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))},4811:function(t,e,i){var n=i(7854),r=i(614),a=n.WeakMap;t.exports=r(a)&&/native code/.test(String(a))},5112:function(t,e,i){var n=i(7854),r=i(2309),a=i(2597),o=i(9711),s=i(6293),h=i(3307),c=n.Symbol,p=r("wks"),u=h?c["for"]||c:c&&c.withoutSetter||o;t.exports=function(t){return a(p,t)||(p[t]=s&&a(c,t)?c[t]:u("Symbol."+t)),p[t]}},7658:function(t,e,i){"use strict";var n=i(2109),r=i(7908),a=i(6244),o=i(3658),s=i(7207),h=i(7293),c=h((function(){return 4294967297!==[].push.call({length:4294967296},1)})),p=function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(t){return t instanceof TypeError}},u=c||!p();n({target:"Array",proto:!0,arity:1,forced:u},{push:function(t){var e=r(this),i=a(e),n=arguments.length;s(i+n);for(var h=0;ht.length)&&(e=t.length);for(var i=0,n=new Array(e);i
',lt=Number.isNaN||f.isNaN;function dt(t){return"number"===typeof t&&!lt(t)}var ft=function(t){return t>0&&t<1/0};function mt(t){return"undefined"===typeof t}function gt(t){return"object"===i(t)&&null!==t}var vt=Object.prototype.hasOwnProperty;function bt(t){if(!gt(t))return!1;try{var e=t.constructor,i=e.prototype;return e&&i&&vt.call(i,"isPrototypeOf")}catch(n){return!1}}function yt(t){return"function"===typeof t}var wt=Array.prototype.slice;function xt(t){return Array.from?Array.from(t):wt.call(t)}function Mt(t,e){return t&&yt(e)&&(Array.isArray(t)||dt(t.length)?xt(t).forEach((function(i,n){e.call(t,i,n,t)})):gt(t)&&Object.keys(t).forEach((function(i){e.call(t,t[i],i,t)}))),t}var Ct=Object.assign||function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),n=1;n0&&i.forEach((function(e){gt(e)&&Object.keys(e).forEach((function(i){t[i]=e[i]}))})),t},Dt=/\.\d*(?:0|9){12}\d*$/;function Ot(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e11;return Dt.test(t)?Math.round(t*e)/e:t}var Bt=/^width|height|left|top|marginLeft|marginTop$/;function St(t,e){var i=t.style;Mt(e,(function(t,e){Bt.test(e)&&dt(t)&&(t="".concat(t,"px")),i[e]=t}))}function Tt(t,e){return t.classList?t.classList.contains(e):t.className.indexOf(e)>-1}function kt(t,e){if(e)if(dt(t.length))Mt(t,(function(t){kt(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 Et(t,e){e&&(dt(t.length)?Mt(t,(function(t){Et(t,e)})):t.classList?t.classList.remove(e):t.className.indexOf(e)>=0&&(t.className=t.className.replace(e,"")))}function jt(t,e,i){e&&(dt(t.length)?Mt(t,(function(t){jt(t,e,i)})):i?kt(t,e):Et(t,e))}var Nt=/([a-z\d])([A-Z])/g;function Wt(t){return t.replace(Nt,"$1-$2").toLowerCase()}function Lt(t,e){return gt(t[e])?t[e]:t.dataset?t.dataset[e]:t.getAttribute("data-".concat(Wt(e)))}function Ht(t,e,i){gt(i)?t[e]=i:t.dataset?t.dataset[e]=i:t.setAttribute("data-".concat(Wt(e)),i)}function zt(t,e){if(gt(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(Wt(e)))}var Rt=/\s\s*/,Pt=function(){var t=!1;if(d){var e=!1,i=function(){},n=Object.defineProperty({},"once",{get:function(){return t=!0,e},set:function(t){e=t}});f.addEventListener("test",i,n),f.removeEventListener("test",i,n)}return t}();function At(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=i;e.trim().split(Rt).forEach((function(e){if(!Pt){var a=t.listeners;a&&a[e]&&a[e][i]&&(r=a[e][i],delete a[e][i],0===Object.keys(a[e]).length&&delete a[e],0===Object.keys(a).length&&delete t.listeners)}t.removeEventListener(e,r,n)}))}function Yt(t,e,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=i;e.trim().split(Rt).forEach((function(e){if(n.once&&!Pt){var a=t.listeners,o=void 0===a?{}:a;r=function(){delete o[e][i],t.removeEventListener(e,r,n);for(var a=arguments.length,s=new Array(a),h=0;hMath.abs(n)&&(n=c)}))})),n}function Gt(t,i){var n=t.pageX,r=t.pageY,a={endX:n,endY:r};return i?a:e({startX:n,startY:r},a)}function Kt(t){var e=0,i=0,n=0;return Mt(t,(function(t){var r=t.startX,a=t.startY;e+=r,i+=a,n+=1})),e/=n,i/=n,{pageX:e,pageY:i}}function Qt(t){var e=t.aspectRatio,i=t.height,n=t.width,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"contain",a=ft(n),o=ft(i);if(a&&o){var s=i*e;"contain"===r&&s>n||"cover"===r&&s90?{width:h,height:s}:{width:s,height:h}}function Jt(t,e,i,n){var r=e.aspectRatio,a=e.naturalWidth,o=e.naturalHeight,h=e.rotate,c=void 0===h?0:h,p=e.scaleX,u=void 0===p?1:p,l=e.scaleY,d=void 0===l?1:l,f=i.aspectRatio,m=i.naturalWidth,g=i.naturalHeight,v=n.fillColor,b=void 0===v?"transparent":v,y=n.imageSmoothingEnabled,w=void 0===y||y,x=n.imageSmoothingQuality,M=void 0===x?"low":x,C=n.maxWidth,D=void 0===C?1/0:C,O=n.maxHeight,B=void 0===O?1/0:O,S=n.minWidth,T=void 0===S?0:S,k=n.minHeight,E=void 0===k?0:k,j=document.createElement("canvas"),N=j.getContext("2d"),W=Qt({aspectRatio:f,width:D,height:B}),L=Qt({aspectRatio:f,width:T,height:E},"cover"),H=Math.min(W.width,Math.max(L.width,m)),z=Math.min(W.height,Math.max(L.height,g)),R=Qt({aspectRatio:r,width:D,height:B}),P=Qt({aspectRatio:r,width:T,height:E},"cover"),A=Math.min(R.width,Math.max(P.width,a)),Y=Math.min(R.height,Math.max(P.height,o)),X=[-A/2,-Y/2,A,Y];return j.width=Ot(H),j.height=Ot(z),N.fillStyle=b,N.fillRect(0,0,H,z),N.save(),N.translate(H/2,z/2),N.rotate(c*Math.PI/180),N.scale(u,d),N.imageSmoothingEnabled=w,N.imageSmoothingQuality=M,N.drawImage.apply(N,[t].concat(s(X.map((function(t){return Math.floor(Ot(t))}))))),N.restore(),j}var te=String.fromCharCode;function ee(t,e,i){var n="";i+=e;for(var r=e;r0)i.push(te.apply(null,xt(r.subarray(0,n)))),r=r.subarray(n);return"data:".concat(e,";base64,").concat(btoa(i.join("")))}function ae(t){var e,i=new DataView(t);try{var n,r,a;if(255===i.getUint8(0)&&216===i.getUint8(1)){var o=i.byteLength,s=2;while(s+1=8&&(a=c+u)}}}if(a){var l,d,f=i.getUint16(a,n);for(d=0;d=0?r:ht),height:Math.max(i.offsetHeight,a>=0?a:ct)};this.containerData=o,St(n,{width:o.width,height:o.height}),kt(t,N),Et(n,N)},initCanvas:function(){var t=this.containerData,e=this.imageData,i=this.options.viewMode,n=Math.abs(e.rotate)%180===90,r=n?e.naturalHeight:e.naturalWidth,a=n?e.naturalWidth:e.naturalHeight,o=r/a,s=t.width,h=t.height;t.height*o>t.width?3===i?s=t.height*o:h=t.width/o:3===i?h=t.width/o:s=t.height*o;var c={aspectRatio:o,naturalWidth:r,naturalHeight:a,width:s,height:h};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=Ct({},c)},limitCanvas:function(t,e){var i=this.options,n=this.containerData,r=this.canvasData,a=this.cropBoxData,o=i.viewMode,s=r.aspectRatio,h=this.cropped&&a;if(t){var c=Number(i.minCanvasWidth)||0,p=Number(i.minCanvasHeight)||0;o>1?(c=Math.max(c,n.width),p=Math.max(p,n.height),3===o&&(p*s>c?c=p*s:p=c/s)):o>0&&(c?c=Math.max(c,h?a.width:0):p?p=Math.max(p,h?a.height:0):h&&(c=a.width,p=a.height,p*s>c?c=p*s:p=c/s));var u=Qt({aspectRatio:s,width:c,height:p});c=u.width,p=u.height,r.minWidth=c,r.minHeight=p,r.maxWidth=1/0,r.maxHeight=1/0}if(e)if(o>(h?0:1)){var l=n.width-r.width,d=n.height-r.height;r.minLeft=Math.min(0,l),r.minTop=Math.min(0,d),r.maxLeft=Math.max(0,l),r.maxTop=Math.max(0,d),h&&this.limited&&(r.minLeft=Math.min(a.left,a.left+(a.width-r.width)),r.minTop=Math.min(a.top,a.top+(a.height-r.height)),r.maxLeft=a.left,r.maxTop=a.top,2===o&&(r.width>=n.width&&(r.minLeft=Math.min(0,l),r.maxLeft=Math.max(0,l)),r.height>=n.height&&(r.minTop=Math.min(0,d),r.maxTop=Math.max(0,d))))}else r.minLeft=-r.width,r.minTop=-r.height,r.maxLeft=n.width,r.maxTop=n.height},renderCanvas:function(t,e){var i=this.canvasData,n=this.imageData;if(e){var r=Vt({width:n.naturalWidth*Math.abs(n.scaleX||1),height:n.naturalHeight*Math.abs(n.scaleY||1),degree:n.rotate||0}),a=r.width,o=r.height,s=i.width*(a/i.naturalWidth),h=i.height*(o/i.naturalHeight);i.left-=(s-i.width)/2,i.top-=(h-i.height)/2,i.width=s,i.height=h,i.aspectRatio=a/o,i.naturalWidth=a,i.naturalHeight=o,this.limitCanvas(!0,!1)}(i.width>i.maxWidth||i.widthi.maxHeight||i.heighte.width?r.height=r.width/i:r.width=r.height*i),this.cropBoxData=r,this.limitCropBox(!0,!0),r.width=Math.min(Math.max(r.width,r.minWidth),r.maxWidth),r.height=Math.min(Math.max(r.height,r.minHeight),r.maxHeight),r.width=Math.max(r.minWidth,r.width*n),r.height=Math.max(r.minHeight,r.height*n),r.left=e.left+(e.width-r.width)/2,r.top=e.top+(e.height-r.height)/2,r.oldLeft=r.left,r.oldTop=r.top,this.initialCropBoxData=Ct({},r)},limitCropBox:function(t,e){var i=this.options,n=this.containerData,r=this.canvasData,a=this.cropBoxData,o=this.limited,s=i.aspectRatio;if(t){var h=Number(i.minCropBoxWidth)||0,c=Number(i.minCropBoxHeight)||0,p=o?Math.min(n.width,r.width,r.width+r.left,n.width-r.left):n.width,u=o?Math.min(n.height,r.height,r.height+r.top,n.height-r.top):n.height;h=Math.min(h,n.width),c=Math.min(c,n.height),s&&(h&&c?c*s>h?c=h/s:h=c*s:h?c=h/s:c&&(h=c*s),u*s>p?u=p/s:p=u*s),a.minWidth=Math.min(h,p),a.minHeight=Math.min(c,u),a.maxWidth=p,a.maxHeight=u}e&&(o?(a.minLeft=Math.max(0,r.left),a.minTop=Math.max(0,r.top),a.maxLeft=Math.min(n.width,r.left+r.width)-a.width,a.maxTop=Math.min(n.height,r.top+r.height)-a.height):(a.minLeft=0,a.minTop=0,a.maxLeft=n.width-a.width,a.maxTop=n.height-a.height))},renderCropBox:function(){var t=this.options,e=this.containerData,i=this.cropBoxData;(i.width>i.maxWidth||i.widthi.maxHeight||i.height=e.width&&i.height>=e.height?w:b),St(this.cropBox,Ct({width:i.width,height:i.height},Ft({translateX:i.left,translateY:i.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),Xt(this.element,I,this.getData())}},he={initPreview:function(){var t=this.element,e=this.crossOrigin,i=this.options.preview,n=e?this.crossOriginUrl:this.url,r=t.alt||"The image to preview",a=document.createElement("img");if(e&&(a.crossOrigin=e),a.src=n,a.alt=r,this.viewBox.appendChild(a),this.viewBoxImage=a,i){var o=i;"string"===typeof i?o=t.ownerDocument.querySelectorAll(i):i.querySelector&&(o=[i]),this.previews=o,Mt(o,(function(t){var i=document.createElement("img");Ht(t,P,{width:t.offsetWidth,height:t.offsetHeight,html:t.innerHTML}),e&&(i.crossOrigin=e),i.src=n,i.alt=r,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(){Mt(this.previews,(function(t){var e=Lt(t,P);St(t,{width:e.width,height:e.height}),t.innerHTML=e.html,zt(t,P)}))},preview:function(){var t=this.imageData,e=this.canvasData,i=this.cropBoxData,n=i.width,r=i.height,a=t.width,o=t.height,s=i.left-e.left-t.left,h=i.top-e.top-t.top;this.cropped&&!this.disabled&&(St(this.viewBoxImage,Ct({width:a,height:o},Ft(Ct({translateX:-s,translateY:-h},t)))),Mt(this.previews,(function(e){var i=Lt(e,P),c=i.width,p=i.height,u=c,l=p,d=1;n&&(d=c/n,l=r*d),r&&l>p&&(d=p/r,u=n*d,l=p),St(e,{width:u,height:l}),St(e.getElementsByTagName("img")[0],Ct({width:a*d,height:o*d},Ft(Ct({translateX:-s*d,translateY:-h*d},t))))})))}},ce={bind:function(){var t=this.element,e=this.options,i=this.cropper;yt(e.cropstart)&&Yt(t,q,e.cropstart),yt(e.cropmove)&&Yt(t,_,e.cropmove),yt(e.cropend)&&Yt(t,U,e.cropend),yt(e.crop)&&Yt(t,I,e.crop),yt(e.zoom)&&Yt(t,it,e.zoom),Yt(i,K,this.onCropStart=this.cropStart.bind(this)),e.zoomable&&e.zoomOnWheel&&Yt(i,et,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&Yt(i,$,this.onDblclick=this.dblclick.bind(this)),Yt(t.ownerDocument,Q,this.onCropMove=this.cropMove.bind(this)),Yt(t.ownerDocument,V,this.onCropEnd=this.cropEnd.bind(this)),e.responsive&&Yt(window,tt,this.onResize=this.resize.bind(this))},unbind:function(){var t=this.element,e=this.options,i=this.cropper;yt(e.cropstart)&&At(t,q,e.cropstart),yt(e.cropmove)&&At(t,_,e.cropmove),yt(e.cropend)&&At(t,U,e.cropend),yt(e.crop)&&At(t,I,e.crop),yt(e.zoom)&&At(t,it,e.zoom),At(i,K,this.onCropStart),e.zoomable&&e.zoomOnWheel&&At(i,et,this.onWheel,{passive:!1,capture:!0}),e.toggleDragModeOnDblclick&&At(i,$,this.onDblclick),At(t.ownerDocument,Q,this.onCropMove),At(t.ownerDocument,V,this.onCropEnd),e.responsive&&At(window,tt,this.onResize)}},pe={resize:function(){if(!this.disabled){var t,e,i=this.options,n=this.container,r=this.containerData,a=n.offsetWidth/r.width,o=n.offsetHeight/r.height,s=Math.abs(a-1)>Math.abs(o-1)?a:o;if(1!==s)i.restore&&(t=this.getCanvasData(),e=this.getCropBoxData()),this.render(),i.restore&&(this.setCanvasData(Mt(t,(function(e,i){t[i]=e*s}))),this.setCropBoxData(Mt(e,(function(t,i){e[i]=t*s}))))}},dblclick:function(){this.disabled||this.options.dragMode===X||this.setDragMode(Tt(this.dragBox,E)?Y:A)},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)&&(dt(e)&&1!==e||dt(i)&&0!==i||t.ctrlKey))){var n,r=this.options,a=this.pointers;t.changedTouches?Mt(t.changedTouches,(function(t){a[t.identifier]=Gt(t)})):a[t.pointerId||0]=Gt(t),n=Object.keys(a).length>1&&r.zoomable&&r.zoomOnTouch?x:Lt(t.target,R),rt.test(n)&&!1!==Xt(this.element,q,{originalEvent:t,action:n})&&(t.preventDefault(),this.action=n,this.cropping=!1,n===y&&(this.cropping=!0,kt(this.dragBox,H)))}},cropMove:function(t){var e=this.action;if(!this.disabled&&e){var i=this.pointers;t.preventDefault(),!1!==Xt(this.element,_,{originalEvent:t,action:e})&&(t.changedTouches?Mt(t.changedTouches,(function(t){Ct(i[t.identifier]||{},Gt(t,!0))})):Ct(i[t.pointerId||0]||{},Gt(t,!0)),this.change(t))}},cropEnd:function(t){if(!this.disabled){var e=this.action,i=this.pointers;t.changedTouches?Mt(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,jt(this.dragBox,H,this.cropped&&this.options.modal)),Xt(this.element,U,{originalEvent:t,action:e}))}}},ue={change:function(t){var e,i=this.options,n=this.canvasData,r=this.containerData,a=this.cropBoxData,o=this.pointers,s=this.action,h=i.aspectRatio,c=a.left,p=a.top,u=a.width,l=a.height,d=c+u,f=p+l,m=0,g=0,v=r.width,E=r.height,j=!0;!h&&t.shiftKey&&(h=u&&l?u/l:1),this.limited&&(m=a.minLeft,g=a.minTop,v=m+Math.min(r.width,n.width,n.left+n.width),E=g+Math.min(r.height,n.height,n.top+n.height));var W=o[Object.keys(o)[0]],L={x:W.endX-W.startX,y:W.endY-W.startY},H=function(t){switch(t){case M:d+L.x>v&&(L.x=v-d);break;case C:c+L.xE&&(L.y=E-f);break}};switch(s){case b:c+=L.x,p+=L.y;break;case M:if(L.x>=0&&(d>=v||h&&(p<=g||f>=E))){j=!1;break}H(M),u+=L.x,u<0&&(s=C,u=-u,c-=u),h&&(l=u/h,p+=(a.height-l)/2);break;case O:if(L.y<=0&&(p<=g||h&&(c<=m||d>=v))){j=!1;break}H(O),l-=L.y,p+=L.y,l<0&&(s=D,l=-l,p-=l),h&&(u=l*h,c+=(a.width-u)/2);break;case C:if(L.x<=0&&(c<=m||h&&(p<=g||f>=E))){j=!1;break}H(C),u-=L.x,c+=L.x,u<0&&(s=M,u=-u,c-=u),h&&(l=u/h,p+=(a.height-l)/2);break;case D:if(L.y>=0&&(f>=E||h&&(c<=m||d>=v))){j=!1;break}H(D),l+=L.y,l<0&&(s=O,l=-l,p-=l),h&&(u=l*h,c+=(a.width-u)/2);break;case B:if(h){if(L.y<=0&&(p<=g||d>=v)){j=!1;break}H(O),l-=L.y,p+=L.y,u=l*h}else H(O),H(M),L.x>=0?dg&&(l-=L.y,p+=L.y):(l-=L.y,p+=L.y);u<0&&l<0?(s=k,l=-l,u=-u,p-=l,c-=u):u<0?(s=S,u=-u,c-=u):l<0&&(s=T,l=-l,p-=l);break;case S:if(h){if(L.y<=0&&(p<=g||c<=m)){j=!1;break}H(O),l-=L.y,p+=L.y,u=l*h,c+=a.width-u}else H(O),H(C),L.x<=0?c>m?(u-=L.x,c+=L.x):L.y<=0&&p<=g&&(j=!1):(u-=L.x,c+=L.x),L.y<=0?p>g&&(l-=L.y,p+=L.y):(l-=L.y,p+=L.y);u<0&&l<0?(s=T,l=-l,u=-u,p-=l,c-=u):u<0?(s=B,u=-u,c-=u):l<0&&(s=k,l=-l,p-=l);break;case k:if(h){if(L.x<=0&&(c<=m||f>=E)){j=!1;break}H(C),u-=L.x,c+=L.x,l=u/h}else H(D),H(C),L.x<=0?c>m?(u-=L.x,c+=L.x):L.y>=0&&f>=E&&(j=!1):(u-=L.x,c+=L.x),L.y>=0?f=0&&(d>=v||f>=E)){j=!1;break}H(M),u+=L.x,l=u/h}else H(D),H(M),L.x>=0?d=0&&f>=E&&(j=!1):u+=L.x,L.y>=0?f0?s=L.y>0?T:B:L.x<0&&(c-=u,s=L.y>0?k:S),L.y<0&&(p-=l),this.cropped||(Et(this.cropBox,N),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}j&&(a.width=u,a.height=l,a.left=c,a.top=p,this.action=s,this.renderCropBox()),Mt(o,(function(t){t.startX=t.endX,t.startY=t.endY}))}},le={crop:function(){return!this.ready||this.cropped||this.disabled||(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&kt(this.dragBox,H),Et(this.cropBox,N),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=Ct({},this.initialImageData),this.canvasData=Ct({},this.initialCanvasData),this.cropBoxData=Ct({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(Ct(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),Et(this.dragBox,H),kt(this.cropBox,N)),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,Mt(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,Et(this.cropper,j)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,kt(this.cropper,j)),this},destroy:function(){var t=this.element;return t[v]?(t[v]=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,r=i.top;return this.moveTo(mt(t)?t:n+Number(t),mt(e)?e:r+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&&(dt(t)&&(i.left=t,n=!0),dt(e)&&(i.top=e,n=!0),n&&this.renderCanvas(!0)),this},zoom:function(t,e){var i=this.canvasData;return t=Number(t),t=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,r=this.canvasData,a=r.width,o=r.height,s=r.naturalWidth,h=r.naturalHeight;if(t=Number(t),t>=0&&this.ready&&!this.disabled&&n.zoomable){var c=s*t,p=h*t;if(!1===Xt(this.element,it,{ratio:t,oldRatio:a/s,originalEvent:i}))return this;if(i){var u=this.pointers,l=It(this.cropper),d=u&&Object.keys(u).length?Kt(u):{pageX:i.pageX,pageY:i.pageY};r.left-=(c-a)*((d.pageX-l.left-r.left)/a),r.top-=(p-o)*((d.pageY-l.top-r.top)/o)}else bt(e)&&dt(e.x)&&dt(e.y)?(r.left-=(c-a)*((e.x-r.left)/a),r.top-=(p-o)*((e.y-r.top)/o)):(r.left-=(c-a)/2,r.top-=(p-o)/2);r.width=c,r.height=p,this.renderCanvas(!0)}return this},rotate:function(t){return this.rotateTo((this.imageData.rotate||0)+Number(t))},rotateTo:function(t){return t=Number(t),dt(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,dt(e)?e:1)},scaleY:function(t){var e=this.imageData.scaleX;return this.scale(dt(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&&(dt(t)&&(i.scaleX=t,n=!0),dt(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,r=this.canvasData,a=this.cropBoxData;if(this.ready&&this.cropped){t={x:a.left-r.left,y:a.top-r.top,width:a.width,height:a.height};var o=n.width/n.naturalWidth;if(Mt(t,(function(e,i){t[i]=e/o})),e){var s=Math.round(t.y+t.height),h=Math.round(t.x+t.width);t.x=Math.round(t.x),t.y=Math.round(t.y),t.width=h-t.x,t.height=s-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,r={};if(this.ready&&!this.disabled&&bt(t)){var a=!1;e.rotatable&&dt(t.rotate)&&t.rotate!==i.rotate&&(i.rotate=t.rotate,a=!0),e.scalable&&(dt(t.scaleX)&&t.scaleX!==i.scaleX&&(i.scaleX=t.scaleX,a=!0),dt(t.scaleY)&&t.scaleY!==i.scaleY&&(i.scaleY=t.scaleY,a=!0)),a&&this.renderCanvas(!0,!0);var o=i.width/i.naturalWidth;dt(t.x)&&(r.left=t.x*o+n.left),dt(t.y)&&(r.top=t.y*o+n.top),dt(t.width)&&(r.width=t.width*o),dt(t.height)&&(r.height=t.height*o),this.setCropBoxData(r)}return this},getContainerData:function(){return this.ready?Ct({},this.containerData):{}},getImageData:function(){return this.sized?Ct({},this.imageData):{}},getCanvasData:function(){var t=this.canvasData,e={};return this.ready&&Mt(["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&&bt(t)&&(dt(t.left)&&(e.left=t.left),dt(t.top)&&(e.top=t.top),dt(t.width)?(e.width=t.width,e.height=t.width/i):dt(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,r=this.options.aspectRatio;return this.ready&&this.cropped&&!this.disabled&&bt(t)&&(dt(t.left)&&(n.left=t.left),dt(t.top)&&(n.top=t.top),dt(t.width)&&t.width!==n.width&&(e=!0,n.width=t.width),dt(t.height)&&t.height!==n.height&&(i=!0,n.height=t.height),r&&(e?n.height=n.width/r:i&&(n.width=n.height*r)),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=Jt(this.image,this.imageData,e,t);if(!this.cropped)return i;var n=this.getData(),r=n.x,a=n.y,o=n.width,h=n.height,c=i.width/Math.floor(e.naturalWidth);1!==c&&(r*=c,a*=c,o*=c,h*=c);var p=o/h,u=Qt({aspectRatio:p,width:t.maxWidth||1/0,height:t.maxHeight||1/0}),l=Qt({aspectRatio:p,width:t.minWidth||0,height:t.minHeight||0},"cover"),d=Qt({aspectRatio:p,width:t.width||(1!==c?i.width:o),height:t.height||(1!==c?i.height:h)}),f=d.width,m=d.height;f=Math.min(u.width,Math.max(l.width,f)),m=Math.min(u.height,Math.max(l.height,m));var g=document.createElement("canvas"),v=g.getContext("2d");g.width=Ot(f),g.height=Ot(m),v.fillStyle=t.fillColor||"transparent",v.fillRect(0,0,f,m);var b=t.imageSmoothingEnabled,y=void 0===b||b,w=t.imageSmoothingQuality;v.imageSmoothingEnabled=y,w&&(v.imageSmoothingQuality=w);var x,M,C,D,O,B,S=i.width,T=i.height,k=r,E=a;k<=-o||k>S?(k=0,x=0,C=0,O=0):k<=0?(C=-k,k=0,x=Math.min(S,o+k),O=x):k<=S&&(C=0,x=Math.min(o,S-k),O=x),x<=0||E<=-h||E>T?(E=0,M=0,D=0,B=0):E<=0?(D=-E,E=0,M=Math.min(T,h+E),B=M):E<=T&&(D=0,M=Math.min(h,T-E),B=M);var j=[k,E,x,M];if(O>0&&B>0){var N=f/o;j.push(C*N,D*N,O*N,B*N)}return v.drawImage.apply(v,[i].concat(s(j.map((function(t){return Math.floor(Ot(t))}))))),g},setAspectRatio:function(t){var e=this.options;return this.disabled||mt(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 r=t===A,a=e.movable&&t===Y;t=r||a?t:X,e.dragMode=t,Ht(i,R,t),jt(i,E,r),jt(i,z,a),e.cropBoxMovable||(Ht(n,R,t),jt(n,E,r),jt(n,z,a))}return this}},de=f.Cropper,fe=function(){function t(e){var i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(n(this,t),!e||!st.test(e.tagName))throw new Error("The first argument is required and must be an or element.");this.element=e,this.options=Ct({},pt,bt(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()}return a(t,[{key:"init",value:function(){var t,e=this.element,i=e.tagName.toLowerCase();if(!e[v]){if(e[v]=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(at.test(t))ot.test(t)?this.read(ne(t)):this.clone();else{var r=new XMLHttpRequest,a=this.clone.bind(this);this.reloading=!0,this.xhr=r,r.onabort=a,r.onerror=a,r.ontimeout=a,r.onprogress=function(){r.getResponseHeader("content-type")!==nt&&r.abort()},r.onload=function(){e.read(r.response)},r.onloadend=function(){e.reloading=!1,e.xhr=null},n.checkCrossOrigin&&qt(t)&&i.crossOrigin&&(t=$t(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=ae(t),r=0,a=1,o=1;if(n>1){this.url=re(t,nt);var s=oe(n);r=s.rotate,a=s.scaleX,o=s.scaleY}e.rotatable&&(i.rotate=r),e.scalable&&(i.scaleX=a,i.scaleY=o),this.clone()}},{key:"clone",value:function(){var t=this.element,e=this.url,i=t.crossOrigin,n=e;this.options.checkCrossOrigin&&qt(e)&&(i||(i="anonymous"),n=$t(e)),this.crossOrigin=i,this.crossOriginUrl=n;var r=document.createElement("img");i&&(r.crossOrigin=i),r.src=n||e,r.alt=t.alt||"The image to crop",this.image=r,r.onload=this.start.bind(this),r.onerror=this.stop.bind(this),kt(r,W),t.parentNode.insertBefore(r,t.nextSibling)}},{key:"start",value:function(){var t=this,e=this.image;e.onload=null,e.onerror=null,this.sizing=!0;var i=f.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(f.navigator.userAgent),n=function(e,i){Ct(t.imageData,{naturalWidth:e,naturalHeight:i,aspectRatio:e/i}),t.initialImageData=Ct({},t.imageData),t.sizing=!1,t.sized=!0,t.build()};if(!e.naturalWidth||i){var r=document.createElement("img"),a=document.body||document.documentElement;this.sizingImage=r,r.onload=function(){n(r.width,r.height),i||a.removeChild(r)},r.src=e.src,i||(r.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;",a.appendChild(r))}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,r=document.createElement("div");r.innerHTML=ut;var a=r.querySelector(".".concat(v,"-container")),o=a.querySelector(".".concat(v,"-canvas")),s=a.querySelector(".".concat(v,"-drag-box")),h=a.querySelector(".".concat(v,"-crop-box")),c=h.querySelector(".".concat(v,"-face"));this.container=n,this.cropper=a,this.canvas=o,this.dragBox=s,this.cropBox=h,this.viewBox=a.querySelector(".".concat(v,"-view-box")),this.face=c,o.appendChild(i),kt(t,N),n.insertBefore(a,t.nextSibling),Et(i,W),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,kt(h,N),e.guides||kt(h.getElementsByClassName("".concat(v,"-dashed")),N),e.center||kt(h.getElementsByClassName("".concat(v,"-center")),N),e.background&&kt(a,"".concat(v,"-bg")),e.highlight||kt(c,L),e.cropBoxMovable&&(kt(c,z),Ht(c,R,b)),e.cropBoxResizable||(kt(h.getElementsByClassName("".concat(v,"-line")),N),kt(h.getElementsByClassName("".concat(v,"-point")),N)),this.render(),this.ready=!0,this.setDragMode(e.dragMode),e.autoCrop&&this.crop(),this.setData(e.data),yt(e.ready)&&Yt(t,J,e.ready,{once:!0}),Xt(t,J)}}},{key:"unbuild",value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var t=this.cropper.parentNode;t&&t.removeChild(this.cropper),Et(this.element,N)}}},{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()}}],[{key:"noConflict",value:function(){return window.Cropper=de,t}},{key:"setDefaults",value:function(t){Ct(pt,bt(t)&&t)}}]),t}();return Ct(fe.prototype,se,he,ce,pe,ue,le),fe}))}},e={};function i(n){var r=e[n];if(void 0!==r)return r.exports;var a=e[n]={exports:{}};return t[n].call(a.exports,a,a.exports,i),a.exports}!function(){i.n=function(t){var e=t&&t.__esModule?function(){return t["default"]}:function(){return t};return i.d(e,{a:e}),e}}(),function(){i.d=function(t,e){for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})}}(),function(){i.g=function(){if("object"===typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"===typeof window)return window}}()}(),function(){i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}}(),function(){i.p=""}();var n={};return function(){"use strict";if("undefined"!==typeof window){var t=window.document.currentScript,e=t&&t.src.match(/(.+\/)[^/]+\.js(\?.*)?$/);e&&(i.p=e[1])}i(7658);var n=i(3129),r=i.n(n);const a="undefined"===typeof window?[String,Array]:[String,Array,Element,NodeList];var o={render(t){const e=this.crossorigin||void 0;return t("div",{style:this.containerStyle},[t("img",{ref:"img",attrs:{src:this.src,alt:this.alt||"image",crossorigin:e},style:[{"max-width":"100%"},this.imgStyle]})])},props:{containerStyle:Object,src:{type:String,default:""},alt:String,imgStyle:Object,viewMode:Number,dragMode:String,initialAspectRatio:Number,aspectRatio:Number,value:Object,preview:a,responsive:{type:Boolean,default:!0},restore:{type:Boolean,default:!0},checkCrossOrigin:{type:Boolean,default:!0},checkOrientation:{type:Boolean,default:!0},crossorigin:{type:String},modal:{type:Boolean,default:!0},guides:{type:Boolean,default:!0},center:{type:Boolean,default:!0},highlight:{type:Boolean,default:!0},background:{type:Boolean,default:!0},autoCrop:{type:Boolean,default:!0},autoCropArea:Number,movable:{type:Boolean,default:!0},rotatable:{type:Boolean,default:!0},scalable:{type:Boolean,default:!0},zoomable:{type:Boolean,default:!1},zoomOnTouch:{type:Boolean,default:!1},zoomOnWheel:{type:Boolean,default:!1},wheelZoomRatio:Number,cropBoxMovable:{type:Boolean,default:!0},cropBoxResizable:{type:Boolean,default:!0},toggleDragModeOnDblclick:{type:Boolean,default:!0},minCanvasWidth:Number,minCanvasHeight:Number,minCropBoxWidth:Number,minCropBoxHeight:Number,minContainerWidth:Number,minContainerHeight:Number},mounted(){const{containerStyle:t,value:e,src:i,alt:n,imgStyle:a,...o}=this.$props,s={};for(const r in o)void 0!==this[r]&&(s[r]=this[r]);s.cropend=t=>{this.$emit("input",this.getData())},s.zoom=t=>{this.$emit("input",this.getData())},s.data=e,this.cropper=new(r())(this.$refs.img,s)},methods:{reset(){return this.cropper.reset()},clear(){return this.cropper.clear()},initCrop(){return this.cropper.crop()},replace(t,e=!1){return this.cropper.replace(t,e)},enable(){return this.cropper.enable()},disable(){return this.cropper.disable()},destroy(){return this.cropper.destroy()},move(t,e){return this.cropper.move(t,e)},moveTo(t,e=t){return this.cropper.moveTo(t,e)},relativeZoom(t,e){return this.cropper.zoom(t,e)},zoomTo(t,e){return this.cropper.zoomTo(t,e)},rotate(t){return this.cropper.rotate(t)},rotateTo(t){return this.cropper.rotateTo(t)},scaleX(t){return this.cropper.scaleX(t)},scaleY(t){return this.cropper.scaleY(t)},scale(t,e=t){return this.cropper.scale(t,e)},getData(t=!1){return this.cropper.getData(t)},setData(t){return this.cropper.setData(t)},getContainerData(){return this.cropper.getContainerData()},getImageData(){return this.cropper.getImageData()},getCanvasData(){return this.cropper.getCanvasData()},setCanvasData(t){return this.cropper.setCanvasData(t)},getCropBoxData(){return this.cropper.getCropBoxData()},setCropBoxData(t){return this.cropper.setCropBoxData(t)},getCroppedCanvas(t={}){return this.cropper.getCroppedCanvas(t)},setAspectRatio(t){return this.cropper.setAspectRatio(t)},setDragMode(t){return this.cropper.setDragMode(t)}}};(window.__goplaidVueComponentRegisters=window.__goplaidVueComponentRegisters||[]).push((t=>{t.component("vue-cropper",o)}))}(),n=n["default"],n}()}));