UNPKG

uppy

Version:

Extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:

2 lines 561 kB
"use strict";(()=>{var qb=Object.create;var xl=Object.defineProperty;var $b=Object.getOwnPropertyDescriptor;var Vb=Object.getOwnPropertyNames;var Wb=Object.getPrototypeOf,Gb=Object.prototype.hasOwnProperty;var o=(i,e)=>xl(i,"name",{value:e,configurable:!0});var ve=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports),Fl=(i,e)=>{for(var t in e)xl(i,t,{get:e[t],enumerable:!0})},Kb=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Vb(e))!Gb.call(i,s)&&s!==t&&xl(i,s,{get:()=>e[s],enumerable:!(r=$b(e,s))||r.enumerable});return i};var be=(i,e,t)=>(t=i!=null?qb(Wb(i)):{},Kb(e||!i||!i.__esModule?xl(t,"default",{value:i,enumerable:!0}):t,i));var Sf=ve((YF,wf)=>{wf.exports=o(function(){var e={},t=e._fns={};e.emit=o(function(a,l,u,d,h,m,b){var v=r(a);v.length&&s(a,v,[l,u,d,h,m,b])},"emit"),e.on=o(function(a,l){t[a]||(t[a]=[]),t[a].push(l)},"on"),e.once=o(function(a,l){function u(){l.apply(this,arguments),e.off(a,u)}o(u,"one"),this.on(a,u)},"once"),e.off=o(function(a,l){var u=[];if(a&&l){var d=this._fns[a],h=0,m=d?d.length:0;for(h;h<m;h++)d[h]!==l&&u.push(d[h])}u.length?this._fns[a]=u:delete this._fns[a]},"off");function r(n){var a=t[n]?t[n]:[],l=n.indexOf(":"),u=l===-1?[n]:[n.substring(0,l),n.substring(l+1)],d=Object.keys(t),h=0,m=d.length;for(h;h<m;h++){var b=d[h];if(b==="*"&&(a=a.concat(t[b])),u.length===2&&u[0]===b){a=a.concat(t[b]);break}}return a}o(r,"getListeners");function s(n,a,l){var u=0,d=a.length;for(u;u<d&&a[u];u++)a[u].event=n,a[u].apply(a[u],l)}return o(s,"emitAll"),e},"createNamespaceEmitter")});var Cl=ve((e3,Pf)=>{function e1(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}o(e1,"isObject");Pf.exports=e1});var xf=ve((i3,_f)=>{var t1=typeof global=="object"&&global&&global.Object===Object&&global;_f.exports=t1});var ec=ve((r3,Ff)=>{var i1=xf(),r1=typeof self=="object"&&self&&self.Object===Object&&self,s1=i1||r1||Function("return this")();Ff.exports=s1});var Cf=ve((s3,Ef)=>{var o1=ec(),n1=o(function(){return o1.Date.now()},"now");Ef.exports=n1});var Of=ve((n3,Tf)=>{var a1=/\s/;function l1(i){for(var e=i.length;e--&&a1.test(i.charAt(e)););return e}o(l1,"trimmedEndIndex");Tf.exports=l1});var kf=ve((l3,Af)=>{var u1=Of(),c1=/^\s+/;function d1(i){return i&&i.slice(0,u1(i)+1).replace(c1,"")}o(d1,"baseTrim");Af.exports=d1});var tc=ve((c3,Rf)=>{var h1=ec(),p1=h1.Symbol;Rf.exports=p1});var Nf=ve((d3,Df)=>{var Uf=tc(),If=Object.prototype,f1=If.hasOwnProperty,m1=If.toString,un=Uf?Uf.toStringTag:void 0;function g1(i){var e=f1.call(i,un),t=i[un];try{i[un]=void 0;var r=!0}catch{}var s=m1.call(i);return r&&(e?i[un]=t:delete i[un]),s}o(g1,"getRawTag");Df.exports=g1});var Mf=ve((p3,Lf)=>{var y1=Object.prototype,v1=y1.toString;function b1(i){return v1.call(i)}o(b1,"objectToString");Lf.exports=b1});var Hf=ve((m3,jf)=>{var Bf=tc(),w1=Nf(),S1=Mf(),P1="[object Null]",_1="[object Undefined]",zf=Bf?Bf.toStringTag:void 0;function x1(i){return i==null?i===void 0?_1:P1:zf&&zf in Object(i)?w1(i):S1(i)}o(x1,"baseGetTag");jf.exports=x1});var $f=ve((y3,qf)=>{function F1(i){return i!=null&&typeof i=="object"}o(F1,"isObjectLike");qf.exports=F1});var Wf=ve((b3,Vf)=>{var E1=Hf(),C1=$f(),T1="[object Symbol]";function O1(i){return typeof i=="symbol"||C1(i)&&E1(i)==T1}o(O1,"isSymbol");Vf.exports=O1});var Yf=ve((S3,Xf)=>{var A1=kf(),Gf=Cl(),k1=Wf(),Kf=NaN,R1=/^[-+]0x[0-9a-f]+$/i,U1=/^0b[01]+$/i,I1=/^0o[0-7]+$/i,D1=parseInt;function N1(i){if(typeof i=="number")return i;if(k1(i))return Kf;if(Gf(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=Gf(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=A1(i);var t=U1.test(i);return t||I1.test(i)?D1(i.slice(2),t?2:8):R1.test(i)?Kf:+i}o(N1,"toNumber");Xf.exports=N1});var rc=ve((_3,Qf)=>{var L1=Cl(),ic=Cf(),Jf=Yf(),M1="Expected a function",B1=Math.max,z1=Math.min;function j1(i,e,t){var r,s,n,a,l,u,d=0,h=!1,m=!1,b=!0;if(typeof i!="function")throw new TypeError(M1);e=Jf(e)||0,L1(t)&&(h=!!t.leading,m="maxWait"in t,n=m?B1(Jf(t.maxWait)||0,e):n,b="trailing"in t?!!t.trailing:b);function v(q){var W=r,te=s;return r=s=void 0,d=q,a=i.apply(te,W),a}o(v,"invokeFunc");function P(q){return d=q,l=setTimeout(O,e),h?v(q):a}o(P,"leadingEdge");function R(q){var W=q-u,te=q-d,ne=e-W;return m?z1(ne,n-te):ne}o(R,"remainingWait");function E(q){var W=q-u,te=q-d;return u===void 0||W>=e||W<0||m&&te>=n}o(E,"shouldInvoke");function O(){var q=ic();if(E(q))return j(q);l=setTimeout(O,R(q))}o(O,"timerExpired");function j(q){return l=void 0,b&&r?v(q):(r=s=void 0,a)}o(j,"trailingEdge");function M(){l!==void 0&&clearTimeout(l),d=0,r=u=s=l=void 0}o(M,"cancel");function G(){return l===void 0?a:j(ic())}o(G,"flush");function J(){var q=ic(),W=E(q);if(r=arguments,s=this,u=q,W){if(l===void 0)return P(u);if(m)return clearTimeout(l),l=setTimeout(O,e),v(u)}return l===void 0&&(l=setTimeout(O,e)),a}return o(J,"debounced"),J.cancel=M,J.flush=G,J}o(j1,"debounce");Qf.exports=j1});var sc=ve((F3,Zf)=>{var H1=rc(),q1=Cl(),$1="Expected a function";function V1(i,e,t){var r=!0,s=!0;if(typeof i!="function")throw new TypeError($1);return q1(t)&&(r="leading"in t?!!t.leading:r,s="trailing"in t?!!t.trailing:s),H1(i,e,{leading:r,maxWait:e,trailing:s})}o(V1,"throttle");Zf.exports=V1});var pn=ve((K3,sm)=>{"use strict";sm.exports=o(function(e){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected a number, got ${typeof e}`);let t=e<0,r=["B","KB","MB","GB","TB","PB","EB","ZB","YB"];if(t&&(e=-e),e<1)return`${(t?"-":"")+e} B`;let s=Math.min(Math.floor(Math.log(e)/Math.log(1024)),r.length-1);e=Number(e/1024**s);let n=r[s];return e>=10||e%1===0?`${(t?"-":"")+e.toFixed(0)} ${n}`:`${(t?"-":"")+e.toFixed(1)} ${n}`},"prettierBytes")});var am=ve((Y3,nm)=>{"use strict";function om(i,e){this.text=i=i||"",this.hasWild=~i.indexOf("*"),this.separator=e,this.parts=i.split(e)}o(om,"WildcardMatcher");om.prototype.match=function(i){var e=!0,t=this.parts,r,s=t.length,n;if(typeof i=="string"||i instanceof String)if(!this.hasWild&&this.text!=i)e=!1;else{for(n=(i||"").split(this.separator),r=0;e&&r<s;r++)t[r]!=="*"&&(r<n.length?e=t[r]===n[r]:e=!1);e=e&&n}else if(typeof i.splice=="function")for(e=[],r=i.length;r--;)this.match(i[r])&&(e[e.length]=i[r]);else if(typeof i=="object"){e={};for(var a in i)this.match(a)&&(e[a]=i[a])}return e};nm.exports=function(i,e,t){var r=new om(i,t||/[\/\.]/);return typeof e<"u"?r.match(e):r}});var um=ve((Q3,lm)=>{var J1=am(),Q1=/[\/\+\.]/;lm.exports=function(i,e){function t(r){var s=J1(r,i,Q1);return s&&s.length>=2}return o(t,"test"),e?t(e.split(";")[0]):t}});var Im=ve((jE,Um)=>{function mi(i,e){typeof e=="boolean"&&(e={forever:e}),this._originalTimeouts=JSON.parse(JSON.stringify(i)),this._timeouts=i,this._options=e||{},this._maxRetryTime=e&&e.maxRetryTime||1/0,this._fn=null,this._errors=[],this._attempts=1,this._operationTimeout=null,this._operationTimeoutCb=null,this._timeout=null,this._operationStart=null,this._timer=null,this._options.forever&&(this._cachedTimeouts=this._timeouts.slice(0))}o(mi,"RetryOperation");Um.exports=mi;mi.prototype.reset=function(){this._attempts=1,this._timeouts=this._originalTimeouts.slice(0)};mi.prototype.stop=function(){this._timeout&&clearTimeout(this._timeout),this._timer&&clearTimeout(this._timer),this._timeouts=[],this._cachedTimeouts=null};mi.prototype.retry=function(i){if(this._timeout&&clearTimeout(this._timeout),!i)return!1;var e=new Date().getTime();if(i&&e-this._operationStart>=this._maxRetryTime)return this._errors.push(i),this._errors.unshift(new Error("RetryOperation timeout occurred")),!1;this._errors.push(i);var t=this._timeouts.shift();if(t===void 0)if(this._cachedTimeouts)this._errors.splice(0,this._errors.length-1),t=this._cachedTimeouts.slice(-1);else return!1;var r=this;return this._timer=setTimeout(function(){r._attempts++,r._operationTimeoutCb&&(r._timeout=setTimeout(function(){r._operationTimeoutCb(r._attempts)},r._operationTimeout),r._options.unref&&r._timeout.unref()),r._fn(r._attempts)},t),this._options.unref&&this._timer.unref(),!0};mi.prototype.attempt=function(i,e){this._fn=i,e&&(e.timeout&&(this._operationTimeout=e.timeout),e.cb&&(this._operationTimeoutCb=e.cb));var t=this;this._operationTimeoutCb&&(this._timeout=setTimeout(function(){t._operationTimeoutCb()},t._operationTimeout)),this._operationStart=new Date().getTime(),this._fn(this._attempts)};mi.prototype.try=function(i){console.log("Using RetryOperation.try() is deprecated"),this.attempt(i)};mi.prototype.start=function(i){console.log("Using RetryOperation.start() is deprecated"),this.attempt(i)};mi.prototype.start=mi.prototype.try;mi.prototype.errors=function(){return this._errors};mi.prototype.attempts=function(){return this._attempts};mi.prototype.mainError=function(){if(this._errors.length===0)return null;for(var i={},e=null,t=0,r=0;r<this._errors.length;r++){var s=this._errors[r],n=s.message,a=(i[n]||0)+1;i[n]=a,a>=t&&(e=s,t=a)}return e}});var Dm=ve(cs=>{var Tw=Im();cs.operation=function(i){var e=cs.timeouts(i);return new Tw(e,{forever:i&&(i.forever||i.retries===1/0),unref:i&&i.unref,maxRetryTime:i&&i.maxRetryTime})};cs.timeouts=function(i){if(i instanceof Array)return[].concat(i);var e={retries:10,factor:2,minTimeout:1*1e3,maxTimeout:1/0,randomize:!1};for(var t in i)e[t]=i[t];if(e.minTimeout>e.maxTimeout)throw new Error("minTimeout is greater than maxTimeout");for(var r=[],s=0;s<e.retries;s++)r.push(this.createTimeout(s,e));return i&&i.forever&&!r.length&&r.push(this.createTimeout(s,e)),r.sort(function(n,a){return n-a}),r};cs.createTimeout=function(i,e){var t=e.randomize?Math.random()+1:1,r=Math.round(t*Math.max(e.minTimeout,1)*Math.pow(e.factor,i));return r=Math.min(r,e.maxTimeout),r};cs.wrap=function(i,e,t){if(e instanceof Array&&(t=e,e=null),!t){t=[];for(var r in i)typeof i[r]=="function"&&t.push(r)}for(var s=0;s<t.length;s++){var n=t[s],a=i[n];i[n]=o(function(u){var d=cs.operation(e),h=Array.prototype.slice.call(arguments,1),m=h.pop();h.push(function(b){d.retry(b)||(b&&(arguments[0]=d.mainError()),m.apply(this,arguments))}),d.attempt(function(){u.apply(i,h)})},"retryWrapper").bind(i,a),i[n].options=e}}});var Lm=ve((VE,Nm)=>{Nm.exports=Dm()});var Rt=ve((U4,$l)=>{(function(){"use strict";var i={}.hasOwnProperty;function e(){for(var s="",n=0;n<arguments.length;n++){var a=arguments[n];a&&(s=r(s,t(a)))}return s}o(e,"classNames");function t(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return e.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var n="";for(var a in s)i.call(s,a)&&s[a]&&(n=r(n,a));return n}o(t,"parseValue");function r(s,n){return n?s?s+" "+n:s+n:s}o(r,"appendClass"),typeof $l<"u"&&$l.exports?(e.default=e,$l.exports=e):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return e}):window.classNames=e})()});var og=ve((NC,qc)=>{"use strict";var h2=Object.prototype.hasOwnProperty,It="~";function Dn(){}o(Dn,"Events");Object.create&&(Dn.prototype=Object.create(null),new Dn().__proto__||(It=!1));function p2(i,e,t){this.fn=i,this.context=e,this.once=t||!1}o(p2,"EE");function sg(i,e,t,r,s){if(typeof t!="function")throw new TypeError("The listener must be a function");var n=new p2(t,r||i,s),a=It?It+e:e;return i._events[a]?i._events[a].fn?i._events[a]=[i._events[a],n]:i._events[a].push(n):(i._events[a]=n,i._eventsCount++),i}o(sg,"addListener");function Jl(i,e){--i._eventsCount===0?i._events=new Dn:delete i._events[e]}o(Jl,"clearEvent");function At(){this._events=new Dn,this._eventsCount=0}o(At,"EventEmitter");At.prototype.eventNames=o(function(){var e=[],t,r;if(this._eventsCount===0)return e;for(r in t=this._events)h2.call(t,r)&&e.push(It?r.slice(1):r);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},"eventNames");At.prototype.listeners=o(function(e){var t=It?It+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,n=r.length,a=new Array(n);s<n;s++)a[s]=r[s].fn;return a},"listeners");At.prototype.listenerCount=o(function(e){var t=It?It+e:e,r=this._events[t];return r?r.fn?1:r.length:0},"listenerCount");At.prototype.emit=o(function(e,t,r,s,n,a){var l=It?It+e:e;if(!this._events[l])return!1;var u=this._events[l],d=arguments.length,h,m;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),d){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,r),!0;case 4:return u.fn.call(u.context,t,r,s),!0;case 5:return u.fn.call(u.context,t,r,s,n),!0;case 6:return u.fn.call(u.context,t,r,s,n,a),!0}for(m=1,h=new Array(d-1);m<d;m++)h[m-1]=arguments[m];u.fn.apply(u.context,h)}else{var b=u.length,v;for(m=0;m<b;m++)switch(u[m].once&&this.removeListener(e,u[m].fn,void 0,!0),d){case 1:u[m].fn.call(u[m].context);break;case 2:u[m].fn.call(u[m].context,t);break;case 3:u[m].fn.call(u[m].context,t,r);break;case 4:u[m].fn.call(u[m].context,t,r,s);break;default:if(!h)for(v=1,h=new Array(d-1);v<d;v++)h[v-1]=arguments[v];u[m].fn.apply(u[m].context,h)}}return!0},"emit");At.prototype.on=o(function(e,t,r){return sg(this,e,t,r,!1)},"on");At.prototype.once=o(function(e,t,r){return sg(this,e,t,r,!0)},"once");At.prototype.removeListener=o(function(e,t,r,s){var n=It?It+e:e;if(!this._events[n])return this;if(!t)return Jl(this,n),this;var a=this._events[n];if(a.fn)a.fn===t&&(!s||a.once)&&(!r||a.context===r)&&Jl(this,n);else{for(var l=0,u=[],d=a.length;l<d;l++)(a[l].fn!==t||s&&!a[l].once||r&&a[l].context!==r)&&u.push(a[l]);u.length?this._events[n]=u.length===1?u[0]:u:Jl(this,n)}return this},"removeListener");At.prototype.removeAllListeners=o(function(e){var t;return e?(t=It?It+e:e,this._events[t]&&Jl(this,t)):(this._events=new Dn,this._eventsCount=0),this},"removeAllListeners");At.prototype.off=At.prototype.removeListener;At.prototype.addListener=At.prototype.on;At.prefixed=It;At.EventEmitter=At;typeof qc<"u"&&(qc.exports=At)});var Ly=ve((Xd,Yd)=>{(function(i,e){typeof Xd=="object"&&typeof Yd<"u"?Yd.exports=e():typeof define=="function"&&define.amd?define(e):(i=typeof globalThis<"u"?globalThis:i||self,i.Cropper=e())})(Xd,function(){"use strict";function i(y,p){var g=Object.keys(y);if(Object.getOwnPropertySymbols){var f=Object.getOwnPropertySymbols(y);p&&(f=f.filter(function(F){return Object.getOwnPropertyDescriptor(y,F).enumerable})),g.push.apply(g,f)}return g}o(i,"ownKeys");function e(y){for(var p=1;p<arguments.length;p++){var g=arguments[p]!=null?arguments[p]:{};p%2?i(Object(g),!0).forEach(function(f){u(y,f,g[f])}):Object.getOwnPropertyDescriptors?Object.defineProperties(y,Object.getOwnPropertyDescriptors(g)):i(Object(g)).forEach(function(f){Object.defineProperty(y,f,Object.getOwnPropertyDescriptor(g,f))})}return y}o(e,"_objectSpread2");function t(y,p){if(typeof y!="object"||!y)return y;var g=y[Symbol.toPrimitive];if(g!==void 0){var f=g.call(y,p||"default");if(typeof f!="object")return f;throw new TypeError("@@toPrimitive must return a primitive value.")}return(p==="string"?String:Number)(y)}o(t,"_toPrimitive");function r(y){var p=t(y,"string");return typeof p=="symbol"?p:p+""}o(r,"_toPropertyKey");function s(y){"@babel/helpers - typeof";return s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(p){return typeof p}:function(p){return p&&typeof Symbol=="function"&&p.constructor===Symbol&&p!==Symbol.prototype?"symbol":typeof p},s(y)}o(s,"_typeof");function n(y,p){if(!(y instanceof p))throw new TypeError("Cannot call a class as a function")}o(n,"_classCallCheck");function a(y,p){for(var g=0;g<p.length;g++){var f=p[g];f.enumerable=f.enumerable||!1,f.configurable=!0,"value"in f&&(f.writable=!0),Object.defineProperty(y,r(f.key),f)}}o(a,"_defineProperties");function l(y,p,g){return p&&a(y.prototype,p),g&&a(y,g),Object.defineProperty(y,"prototype",{writable:!1}),y}o(l,"_createClass");function u(y,p,g){return p=r(p),p in y?Object.defineProperty(y,p,{value:g,enumerable:!0,configurable:!0,writable:!0}):y[p]=g,y}o(u,"_defineProperty");function d(y){return h(y)||m(y)||b(y)||P()}o(d,"_toConsumableArray");function h(y){if(Array.isArray(y))return v(y)}o(h,"_arrayWithoutHoles");function m(y){if(typeof Symbol<"u"&&y[Symbol.iterator]!=null||y["@@iterator"]!=null)return Array.from(y)}o(m,"_iterableToArray");function b(y,p){if(y){if(typeof y=="string")return v(y,p);var g=Object.prototype.toString.call(y).slice(8,-1);if(g==="Object"&&y.constructor&&(g=y.constructor.name),g==="Map"||g==="Set")return Array.from(y);if(g==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(g))return v(y,p)}}o(b,"_unsupportedIterableToArray");function v(y,p){(p==null||p>y.length)&&(p=y.length);for(var g=0,f=new Array(p);g<p;g++)f[g]=y[g];return f}o(v,"_arrayLikeToArray");function P(){throw new TypeError(`Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}o(P,"_nonIterableSpread");var R=typeof window<"u"&&typeof window.document<"u",E=R?window:{},O=R&&E.document.documentElement?"ontouchstart"in E.document.documentElement:!1,j=R?"PointerEvent"in E:!1,M="cropper",G="all",J="crop",q="move",W="zoom",te="e",ne="w",Oe="s",Ae="n",$e="ne",xe="nw",ke="se",Xe="sw",C="".concat(M,"-crop"),S="".concat(M,"-disabled"),_="".concat(M,"-hidden"),L="".concat(M,"-hide"),H="".concat(M,"-invisible"),z="".concat(M,"-modal"),U="".concat(M,"-move"),T="".concat(M,"Action"),A="".concat(M,"Preview"),N="crop",Y="move",Q="none",Fe="crop",de="cropend",le="cropmove",ue="cropstart",Re="dblclick",Le=O?"touchstart":"mousedown",kt=O?"touchmove":"mousemove",Ve=O?"touchend touchcancel":"mouseup",ae=j?"pointerdown":Le,Tt=j?"pointermove":kt,Ye=j?"pointerup pointercancel":Ve,Wi="ready",ho="resize",zr="wheel",Gi="zoom",jr="image/jpeg",Zr=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,Hr=/^data:/,lt=/^data:image\/jpeg;base64,/,ut=/^img|canvas$/i,Zo=200,en=100,tn={viewMode:0,dragMode:N,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:Zo,minContainerHeight:en,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},vl='<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>',bl=Number.isNaN||E.isNaN;function he(y){return typeof y=="number"&&!bl(y)}o(he,"isNumber");var rn=o(function(p){return p>0&&p<1/0},"isPositiveNumber");function po(y){return typeof y>"u"}o(po,"isUndefined");function Ii(y){return s(y)==="object"&&y!==null}o(Ii,"isObject");var Xu=Object.prototype.hasOwnProperty;function qr(y){if(!Ii(y))return!1;try{var p=y.constructor,g=p.prototype;return p&&g&&Xu.call(g,"isPrototypeOf")}catch{return!1}}o(qr,"isPlainObject");function Ot(y){return typeof y=="function"}o(Ot,"isFunction");var Yu=Array.prototype.slice;function fo(y){return Array.from?Array.from(y):Yu.call(y)}o(fo,"toArray");function Me(y,p){return y&&Ot(p)&&(Array.isArray(y)||he(y.length)?fo(y).forEach(function(g,f){p.call(y,g,f,y)}):Ii(y)&&Object.keys(y).forEach(function(g){p.call(y,y[g],g,y)})),y}o(Me,"forEach");var Ee=Object.assign||o(function(p){for(var g=arguments.length,f=new Array(g>1?g-1:0),F=1;F<g;F++)f[F-1]=arguments[F];return Ii(p)&&f.length>0&&f.forEach(function(w){Ii(w)&&Object.keys(w).forEach(function(x){p[x]=w[x]})}),p},"assign"),sn=/\.\d*(?:0|9){12}\d*$/;function Di(y){var p=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return sn.test(y)?Math.round(y*p)/p:y}o(Di,"normalizeDecimalNumber");var wl=/^width|height|left|top|marginLeft|marginTop$/;function Si(y,p){var g=y.style;Me(p,function(f,F){wl.test(F)&&he(f)&&(f="".concat(f,"px")),g[F]=f})}o(Si,"setStyle");function Sl(y,p){return y.classList?y.classList.contains(p):y.className.indexOf(p)>-1}o(Sl,"hasClass");function We(y,p){if(p){if(he(y.length)){Me(y,function(f){We(f,p)});return}if(y.classList){y.classList.add(p);return}var g=y.className.trim();g?g.indexOf(p)<0&&(y.className="".concat(g," ").concat(p)):y.className=p}}o(We,"addClass");function Gt(y,p){if(p){if(he(y.length)){Me(y,function(g){Gt(g,p)});return}if(y.classList){y.classList.remove(p);return}y.className.indexOf(p)>=0&&(y.className=y.className.replace(p,""))}}o(Gt,"removeClass");function es(y,p,g){if(p){if(he(y.length)){Me(y,function(f){es(f,p,g)});return}g?We(y,p):Gt(y,p)}}o(es,"toggleClass");var ts=/([a-z\d])([A-Z])/g;function mo(y){return y.replace(ts,"$1-$2").toLowerCase()}o(mo,"toParamCase");function go(y,p){return Ii(y[p])?y[p]:y.dataset?y.dataset[p]:y.getAttribute("data-".concat(mo(p)))}o(go,"getData");function di(y,p,g){Ii(g)?y[p]=g:y.dataset?y.dataset[p]=g:y.setAttribute("data-".concat(mo(p)),g)}o(di,"setData");function on(y,p){if(Ii(y[p]))try{delete y[p]}catch{y[p]=void 0}else if(y.dataset)try{delete y.dataset[p]}catch{y.dataset[p]=void 0}else y.removeAttribute("data-".concat(mo(p)))}o(on,"removeData");var $r=/\s\s*/,lf=function(){var y=!1;if(R){var p=!1,g=o(function(){},"listener"),f=Object.defineProperty({},"once",{get:o(function(){return y=!0,p},"get"),set:o(function(w){p=w},"set")});E.addEventListener("test",g,f),E.removeEventListener("test",g,f)}return y}();function Pi(y,p,g){var f=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},F=g;p.trim().split($r).forEach(function(w){if(!lf){var x=y.listeners;x&&x[w]&&x[w][g]&&(F=x[w][g],delete x[w][g],Object.keys(x[w]).length===0&&delete x[w],Object.keys(x).length===0&&delete y.listeners)}y.removeEventListener(w,F,f)})}o(Pi,"removeListener");function hi(y,p,g){var f=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},F=g;p.trim().split($r).forEach(function(w){if(f.once&&!lf){var x=y.listeners,k=x===void 0?{}:x;F=o(function(){delete k[w][g],y.removeEventListener(w,F,f);for(var B=arguments.length,I=new Array(B),D=0;D<B;D++)I[D]=arguments[D];g.apply(y,I)},"handler"),k[w]||(k[w]={}),k[w][g]&&y.removeEventListener(w,k[w][g],f),k[w][g]=F,y.listeners=k}y.addEventListener(w,F,f)})}o(hi,"addListener");function yo(y,p,g){var f;return Ot(Event)&&Ot(CustomEvent)?f=new CustomEvent(p,{detail:g,bubbles:!0,cancelable:!0}):(f=document.createEvent("CustomEvent"),f.initCustomEvent(p,!0,!0,g)),y.dispatchEvent(f)}o(yo,"dispatchEvent");function uf(y){var p=y.getBoundingClientRect();return{left:p.left+(window.pageXOffset-document.documentElement.clientLeft),top:p.top+(window.pageYOffset-document.documentElement.clientTop)}}o(uf,"getOffset");var Ju=E.location,_b=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function cf(y){var p=y.match(_b);return p!==null&&(p[1]!==Ju.protocol||p[2]!==Ju.hostname||p[3]!==Ju.port)}o(cf,"isCrossOriginURL");function df(y){var p="timestamp=".concat(new Date().getTime());return y+(y.indexOf("?")===-1?"?":"&")+p}o(df,"addTimestamp");function nn(y){var p=y.rotate,g=y.scaleX,f=y.scaleY,F=y.translateX,w=y.translateY,x=[];he(F)&&F!==0&&x.push("translateX(".concat(F,"px)")),he(w)&&w!==0&&x.push("translateY(".concat(w,"px)")),he(p)&&p!==0&&x.push("rotate(".concat(p,"deg)")),he(g)&&g!==1&&x.push("scaleX(".concat(g,")")),he(f)&&f!==1&&x.push("scaleY(".concat(f,")"));var k=x.length?x.join(" "):"none";return{WebkitTransform:k,msTransform:k,transform:k}}o(nn,"getTransforms");function xb(y){var p=e({},y),g=0;return Me(y,function(f,F){delete p[F],Me(p,function(w){var x=Math.abs(f.startX-w.startX),k=Math.abs(f.startY-w.startY),V=Math.abs(f.endX-w.endX),B=Math.abs(f.endY-w.endY),I=Math.sqrt(x*x+k*k),D=Math.sqrt(V*V+B*B),$=(D-I)/I;Math.abs($)>Math.abs(g)&&(g=$)})}),g}o(xb,"getMaxZoomRatio");function Pl(y,p){var g=y.pageX,f=y.pageY,F={endX:g,endY:f};return p?F:e({startX:g,startY:f},F)}o(Pl,"getPointer");function Fb(y){var p=0,g=0,f=0;return Me(y,function(F){var w=F.startX,x=F.startY;p+=w,g+=x,f+=1}),p/=f,g/=f,{pageX:p,pageY:g}}o(Fb,"getPointersCenter");function Vr(y){var p=y.aspectRatio,g=y.height,f=y.width,F=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",w=rn(f),x=rn(g);if(w&&x){var k=g*p;F==="contain"&&k>f||F==="cover"&&k<f?g=f/p:f=g*p}else w?g=f/p:x&&(f=g*p);return{width:f,height:g}}o(Vr,"getAdjustedSizes");function Eb(y){var p=y.width,g=y.height,f=y.degree;if(f=Math.abs(f)%180,f===90)return{width:g,height:p};var F=f%90*Math.PI/180,w=Math.sin(F),x=Math.cos(F),k=p*x+g*w,V=p*w+g*x;return f>90?{width:V,height:k}:{width:k,height:V}}o(Eb,"getRotatedSizes");function Cb(y,p,g,f){var F=p.aspectRatio,w=p.naturalWidth,x=p.naturalHeight,k=p.rotate,V=k===void 0?0:k,B=p.scaleX,I=B===void 0?1:B,D=p.scaleY,$=D===void 0?1:D,ge=g.aspectRatio,me=g.naturalWidth,De=g.naturalHeight,Se=f.fillColor,tt=Se===void 0?"transparent":Se,ct=f.imageSmoothingEnabled,Je=ct===void 0?!0:ct,Ki=f.imageSmoothingQuality,Kt=Ki===void 0?"low":Ki,K=f.maxWidth,Pe=K===void 0?1/0:K,it=f.maxHeight,pi=it===void 0?1/0:it,Xi=f.minWidth,is=Xi===void 0?0:Xi,rs=f.minHeight,Wr=rs===void 0?0:rs,Ni=document.createElement("canvas"),Ht=Ni.getContext("2d"),ss=Vr({aspectRatio:ge,width:Pe,height:pi}),_l=Vr({aspectRatio:ge,width:is,height:Wr},"cover"),Qu=Math.min(ss.width,Math.max(_l.width,me)),Zu=Math.min(ss.height,Math.max(_l.height,De)),ff=Vr({aspectRatio:F,width:Pe,height:pi}),mf=Vr({aspectRatio:F,width:is,height:Wr},"cover"),gf=Math.min(ff.width,Math.max(mf.width,w)),yf=Math.min(ff.height,Math.max(mf.height,x)),jb=[-gf/2,-yf/2,gf,yf];return Ni.width=Di(Qu),Ni.height=Di(Zu),Ht.fillStyle=tt,Ht.fillRect(0,0,Qu,Zu),Ht.save(),Ht.translate(Qu/2,Zu/2),Ht.rotate(V*Math.PI/180),Ht.scale(I,$),Ht.imageSmoothingEnabled=Je,Ht.imageSmoothingQuality=Kt,Ht.drawImage.apply(Ht,[y].concat(d(jb.map(function(Hb){return Math.floor(Di(Hb))})))),Ht.restore(),Ni}o(Cb,"getSourceCanvas");var hf=String.fromCharCode;function Tb(y,p,g){var f="";g+=p;for(var F=p;F<g;F+=1)f+=hf(y.getUint8(F));return f}o(Tb,"getStringFromCharCode");var Ob=/^data:.*,/;function Ab(y){var p=y.replace(Ob,""),g=atob(p),f=new ArrayBuffer(g.length),F=new Uint8Array(f);return Me(F,function(w,x){F[x]=g.charCodeAt(x)}),f}o(Ab,"dataURLToArrayBuffer");function kb(y,p){for(var g=[],f=8192,F=new Uint8Array(y);F.length>0;)g.push(hf.apply(null,fo(F.subarray(0,f)))),F=F.subarray(f);return"data:".concat(p,";base64,").concat(btoa(g.join("")))}o(kb,"arrayBufferToDataURL");function Rb(y){var p=new DataView(y),g;try{var f,F,w;if(p.getUint8(0)===255&&p.getUint8(1)===216)for(var x=p.byteLength,k=2;k+1<x;){if(p.getUint8(k)===255&&p.getUint8(k+1)===225){F=k;break}k+=1}if(F){var V=F+4,B=F+10;if(Tb(p,V,4)==="Exif"){var I=p.getUint16(B);if(f=I===18761,(f||I===19789)&&p.getUint16(B+2,f)===42){var D=p.getUint32(B+4,f);D>=8&&(w=B+D)}}}if(w){var $=p.getUint16(w,f),ge,me;for(me=0;me<$;me+=1)if(ge=w+me*12+2,p.getUint16(ge,f)===274){ge+=8,g=p.getUint16(ge,f),p.setUint16(ge,1,f);break}}}catch{g=1}return g}o(Rb,"resetAndGetOrientation");function Ub(y){var p=0,g=1,f=1;switch(y){case 2:g=-1;break;case 3:p=-180;break;case 4:f=-1;break;case 5:p=90,f=-1;break;case 6:p=90;break;case 7:p=90,g=-1;break;case 8:p=-90;break}return{rotate:p,scaleX:g,scaleY:f}}o(Ub,"parseOrientation");var Ib={render:o(function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},"render"),initContainer:o(function(){var p=this.element,g=this.options,f=this.container,F=this.cropper,w=Number(g.minContainerWidth),x=Number(g.minContainerHeight);We(F,_),Gt(p,_);var k={width:Math.max(f.offsetWidth,w>=0?w:Zo),height:Math.max(f.offsetHeight,x>=0?x:en)};this.containerData=k,Si(F,{width:k.width,height:k.height}),We(p,_),Gt(F,_)},"initContainer"),initCanvas:o(function(){var p=this.containerData,g=this.imageData,f=this.options.viewMode,F=Math.abs(g.rotate)%180===90,w=F?g.naturalHeight:g.naturalWidth,x=F?g.naturalWidth:g.naturalHeight,k=w/x,V=p.width,B=p.height;p.height*k>p.width?f===3?V=p.height*k:B=p.width/k:f===3?B=p.width/k:V=p.height*k;var I={aspectRatio:k,naturalWidth:w,naturalHeight:x,width:V,height:B};this.canvasData=I,this.limited=f===1||f===2,this.limitCanvas(!0,!0),I.width=Math.min(Math.max(I.width,I.minWidth),I.maxWidth),I.height=Math.min(Math.max(I.height,I.minHeight),I.maxHeight),I.left=(p.width-I.width)/2,I.top=(p.height-I.height)/2,I.oldLeft=I.left,I.oldTop=I.top,this.initialCanvasData=Ee({},I)},"initCanvas"),limitCanvas:o(function(p,g){var f=this.options,F=this.containerData,w=this.canvasData,x=this.cropBoxData,k=f.viewMode,V=w.aspectRatio,B=this.cropped&&x;if(p){var I=Number(f.minCanvasWidth)||0,D=Number(f.minCanvasHeight)||0;k>1?(I=Math.max(I,F.width),D=Math.max(D,F.height),k===3&&(D*V>I?I=D*V:D=I/V)):k>0&&(I?I=Math.max(I,B?x.width:0):D?D=Math.max(D,B?x.height:0):B&&(I=x.width,D=x.height,D*V>I?I=D*V:D=I/V));var $=Vr({aspectRatio:V,width:I,height:D});I=$.width,D=$.height,w.minWidth=I,w.minHeight=D,w.maxWidth=1/0,w.maxHeight=1/0}if(g)if(k>(B?0:1)){var ge=F.width-w.width,me=F.height-w.height;w.minLeft=Math.min(0,ge),w.minTop=Math.min(0,me),w.maxLeft=Math.max(0,ge),w.maxTop=Math.max(0,me),B&&this.limited&&(w.minLeft=Math.min(x.left,x.left+(x.width-w.width)),w.minTop=Math.min(x.top,x.top+(x.height-w.height)),w.maxLeft=x.left,w.maxTop=x.top,k===2&&(w.width>=F.width&&(w.minLeft=Math.min(0,ge),w.maxLeft=Math.max(0,ge)),w.height>=F.height&&(w.minTop=Math.min(0,me),w.maxTop=Math.max(0,me))))}else w.minLeft=-w.width,w.minTop=-w.height,w.maxLeft=F.width,w.maxTop=F.height},"limitCanvas"),renderCanvas:o(function(p,g){var f=this.canvasData,F=this.imageData;if(g){var w=Eb({width:F.naturalWidth*Math.abs(F.scaleX||1),height:F.naturalHeight*Math.abs(F.scaleY||1),degree:F.rotate||0}),x=w.width,k=w.height,V=f.width*(x/f.naturalWidth),B=f.height*(k/f.naturalHeight);f.left-=(V-f.width)/2,f.top-=(B-f.height)/2,f.width=V,f.height=B,f.aspectRatio=x/k,f.naturalWidth=x,f.naturalHeight=k,this.limitCanvas(!0,!1)}(f.width>f.maxWidth||f.width<f.minWidth)&&(f.left=f.oldLeft),(f.height>f.maxHeight||f.height<f.minHeight)&&(f.top=f.oldTop),f.width=Math.min(Math.max(f.width,f.minWidth),f.maxWidth),f.height=Math.min(Math.max(f.height,f.minHeight),f.maxHeight),this.limitCanvas(!1,!0),f.left=Math.min(Math.max(f.left,f.minLeft),f.maxLeft),f.top=Math.min(Math.max(f.top,f.minTop),f.maxTop),f.oldLeft=f.left,f.oldTop=f.top,Si(this.canvas,Ee({width:f.width,height:f.height},nn({translateX:f.left,translateY:f.top}))),this.renderImage(p),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},"renderCanvas"),renderImage:o(function(p){var g=this.canvasData,f=this.imageData,F=f.naturalWidth*(g.width/g.naturalWidth),w=f.naturalHeight*(g.height/g.naturalHeight);Ee(f,{width:F,height:w,left:(g.width-F)/2,top:(g.height-w)/2}),Si(this.image,Ee({width:f.width,height:f.height},nn(Ee({translateX:f.left,translateY:f.top},f)))),p&&this.output()},"renderImage"),initCropBox:o(function(){var p=this.options,g=this.canvasData,f=p.aspectRatio||p.initialAspectRatio,F=Number(p.autoCropArea)||.8,w={width:g.width,height:g.height};f&&(g.height*f>g.width?w.height=w.width/f:w.width=w.height*f),this.cropBoxData=w,this.limitCropBox(!0,!0),w.width=Math.min(Math.max(w.width,w.minWidth),w.maxWidth),w.height=Math.min(Math.max(w.height,w.minHeight),w.maxHeight),w.width=Math.max(w.minWidth,w.width*F),w.height=Math.max(w.minHeight,w.height*F),w.left=g.left+(g.width-w.width)/2,w.top=g.top+(g.height-w.height)/2,w.oldLeft=w.left,w.oldTop=w.top,this.initialCropBoxData=Ee({},w)},"initCropBox"),limitCropBox:o(function(p,g){var f=this.options,F=this.containerData,w=this.canvasData,x=this.cropBoxData,k=this.limited,V=f.aspectRatio;if(p){var B=Number(f.minCropBoxWidth)||0,I=Number(f.minCropBoxHeight)||0,D=k?Math.min(F.width,w.width,w.width+w.left,F.width-w.left):F.width,$=k?Math.min(F.height,w.height,w.height+w.top,F.height-w.top):F.height;B=Math.min(B,F.width),I=Math.min(I,F.height),V&&(B&&I?I*V>B?I=B/V:B=I*V:B?I=B/V:I&&(B=I*V),$*V>D?$=D/V:D=$*V),x.minWidth=Math.min(B,D),x.minHeight=Math.min(I,$),x.maxWidth=D,x.maxHeight=$}g&&(k?(x.minLeft=Math.max(0,w.left),x.minTop=Math.max(0,w.top),x.maxLeft=Math.min(F.width,w.left+w.width)-x.width,x.maxTop=Math.min(F.height,w.top+w.height)-x.height):(x.minLeft=0,x.minTop=0,x.maxLeft=F.width-x.width,x.maxTop=F.height-x.height))},"limitCropBox"),renderCropBox:o(function(){var p=this.options,g=this.containerData,f=this.cropBoxData;(f.width>f.maxWidth||f.width<f.minWidth)&&(f.left=f.oldLeft),(f.height>f.maxHeight||f.height<f.minHeight)&&(f.top=f.oldTop),f.width=Math.min(Math.max(f.width,f.minWidth),f.maxWidth),f.height=Math.min(Math.max(f.height,f.minHeight),f.maxHeight),this.limitCropBox(!1,!0),f.left=Math.min(Math.max(f.left,f.minLeft),f.maxLeft),f.top=Math.min(Math.max(f.top,f.minTop),f.maxTop),f.oldLeft=f.left,f.oldTop=f.top,p.movable&&p.cropBoxMovable&&di(this.face,T,f.width>=g.width&&f.height>=g.height?q:G),Si(this.cropBox,Ee({width:f.width,height:f.height},nn({translateX:f.left,translateY:f.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},"renderCropBox"),output:o(function(){this.preview(),yo(this.element,Fe,this.getData())},"output")},Db={initPreview:o(function(){var p=this.element,g=this.crossOrigin,f=this.options.preview,F=g?this.crossOriginUrl:this.url,w=p.alt||"The image to preview",x=document.createElement("img");if(g&&(x.crossOrigin=g),x.src=F,x.alt=w,this.viewBox.appendChild(x),this.viewBoxImage=x,!!f){var k=f;typeof f=="string"?k=p.ownerDocument.querySelectorAll(f):f.querySelector&&(k=[f]),this.previews=k,Me(k,function(V){var B=document.createElement("img");di(V,A,{width:V.offsetWidth,height:V.offsetHeight,html:V.innerHTML}),g&&(B.crossOrigin=g),B.src=F,B.alt=w,B.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;"',V.innerHTML="",V.appendChild(B)})}},"initPreview"),resetPreview:o(function(){Me(this.previews,function(p){var g=go(p,A);Si(p,{width:g.width,height:g.height}),p.innerHTML=g.html,on(p,A)})},"resetPreview"),preview:o(function(){var p=this.imageData,g=this.canvasData,f=this.cropBoxData,F=f.width,w=f.height,x=p.width,k=p.height,V=f.left-g.left-p.left,B=f.top-g.top-p.top;!this.cropped||this.disabled||(Si(this.viewBoxImage,Ee({width:x,height:k},nn(Ee({translateX:-V,translateY:-B},p)))),Me(this.previews,function(I){var D=go(I,A),$=D.width,ge=D.height,me=$,De=ge,Se=1;F&&(Se=$/F,De=w*Se),w&&De>ge&&(Se=ge/w,me=F*Se,De=ge),Si(I,{width:me,height:De}),Si(I.getElementsByTagName("img")[0],Ee({width:x*Se,height:k*Se},nn(Ee({translateX:-V*Se,translateY:-B*Se},p))))}))},"preview")},Nb={bind:o(function(){var p=this.element,g=this.options,f=this.cropper;Ot(g.cropstart)&&hi(p,ue,g.cropstart),Ot(g.cropmove)&&hi(p,le,g.cropmove),Ot(g.cropend)&&hi(p,de,g.cropend),Ot(g.crop)&&hi(p,Fe,g.crop),Ot(g.zoom)&&hi(p,Gi,g.zoom),hi(f,ae,this.onCropStart=this.cropStart.bind(this)),g.zoomable&&g.zoomOnWheel&&hi(f,zr,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),g.toggleDragModeOnDblclick&&hi(f,Re,this.onDblclick=this.dblclick.bind(this)),hi(p.ownerDocument,Tt,this.onCropMove=this.cropMove.bind(this)),hi(p.ownerDocument,Ye,this.onCropEnd=this.cropEnd.bind(this)),g.responsive&&hi(window,ho,this.onResize=this.resize.bind(this))},"bind"),unbind:o(function(){var p=this.element,g=this.options,f=this.cropper;Ot(g.cropstart)&&Pi(p,ue,g.cropstart),Ot(g.cropmove)&&Pi(p,le,g.cropmove),Ot(g.cropend)&&Pi(p,de,g.cropend),Ot(g.crop)&&Pi(p,Fe,g.crop),Ot(g.zoom)&&Pi(p,Gi,g.zoom),Pi(f,ae,this.onCropStart),g.zoomable&&g.zoomOnWheel&&Pi(f,zr,this.onWheel,{passive:!1,capture:!0}),g.toggleDragModeOnDblclick&&Pi(f,Re,this.onDblclick),Pi(p.ownerDocument,Tt,this.onCropMove),Pi(p.ownerDocument,Ye,this.onCropEnd),g.responsive&&Pi(window,ho,this.onResize)},"unbind")},Lb={resize:o(function(){if(!this.disabled){var p=this.options,g=this.container,f=this.containerData,F=g.offsetWidth/f.width,w=g.offsetHeight/f.height,x=Math.abs(F-1)>Math.abs(w-1)?F:w;if(x!==1){var k,V;p.restore&&(k=this.getCanvasData(),V=this.getCropBoxData()),this.render(),p.restore&&(this.setCanvasData(Me(k,function(B,I){k[I]=B*x})),this.setCropBoxData(Me(V,function(B,I){V[I]=B*x})))}}},"resize"),dblclick:o(function(){this.disabled||this.options.dragMode===Q||this.setDragMode(Sl(this.dragBox,C)?Y:N)},"dblclick"),wheel:o(function(p){var g=this,f=Number(this.options.wheelZoomRatio)||.1,F=1;this.disabled||(p.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){g.wheeling=!1},50),p.deltaY?F=p.deltaY>0?1:-1:p.wheelDelta?F=-p.wheelDelta/120:p.detail&&(F=p.detail>0?1:-1),this.zoom(-F*f,p)))},"wheel"),cropStart:o(function(p){var g=p.buttons,f=p.button;if(!(this.disabled||(p.type==="mousedown"||p.type==="pointerdown"&&p.pointerType==="mouse")&&(he(g)&&g!==1||he(f)&&f!==0||p.ctrlKey))){var F=this.options,w=this.pointers,x;p.changedTouches?Me(p.changedTouches,function(k){w[k.identifier]=Pl(k)}):w[p.pointerId||0]=Pl(p),Object.keys(w).length>1&&F.zoomable&&F.zoomOnTouch?x=W:x=go(p.target,T),Zr.test(x)&&yo(this.element,ue,{originalEvent:p,action:x})!==!1&&(p.preventDefault(),this.action=x,this.cropping=!1,x===J&&(this.cropping=!0,We(this.dragBox,z)))}},"cropStart"),cropMove:o(function(p){var g=this.action;if(!(this.disabled||!g)){var f=this.pointers;p.preventDefault(),yo(this.element,le,{originalEvent:p,action:g})!==!1&&(p.changedTouches?Me(p.changedTouches,function(F){Ee(f[F.identifier]||{},Pl(F,!0))}):Ee(f[p.pointerId||0]||{},Pl(p,!0)),this.change(p))}},"cropMove"),cropEnd:o(function(p){if(!this.disabled){var g=this.action,f=this.pointers;p.changedTouches?Me(p.changedTouches,function(F){delete f[F.identifier]}):delete f[p.pointerId||0],g&&(p.preventDefault(),Object.keys(f).length||(this.action=""),this.cropping&&(this.cropping=!1,es(this.dragBox,z,this.cropped&&this.options.modal)),yo(this.element,de,{originalEvent:p,action:g}))}},"cropEnd")},Mb={change:o(function(p){var g=this.options,f=this.canvasData,F=this.containerData,w=this.cropBoxData,x=this.pointers,k=this.action,V=g.aspectRatio,B=w.left,I=w.top,D=w.width,$=w.height,ge=B+D,me=I+$,De=0,Se=0,tt=F.width,ct=F.height,Je=!0,Ki;!V&&p.shiftKey&&(V=D&&$?D/$:1),this.limited&&(De=w.minLeft,Se=w.minTop,tt=De+Math.min(F.width,f.width,f.left+f.width),ct=Se+Math.min(F.height,f.height,f.top+f.height));var Kt=x[Object.keys(x)[0]],K={x:Kt.endX-Kt.startX,y:Kt.endY-Kt.startY},Pe=o(function(pi){switch(pi){case te:ge+K.x>tt&&(K.x=tt-ge);break;case ne:B+K.x<De&&(K.x=De-B);break;case Ae:I+K.y<Se&&(K.y=Se-I);break;case Oe:me+K.y>ct&&(K.y=ct-me);break}},"check");switch(k){case G:B+=K.x,I+=K.y;break;case te:if(K.x>=0&&(ge>=tt||V&&(I<=Se||me>=ct))){Je=!1;break}Pe(te),D+=K.x,D<0&&(k=ne,D=-D,B-=D),V&&($=D/V,I+=(w.height-$)/2);break;case Ae:if(K.y<=0&&(I<=Se||V&&(B<=De||ge>=tt))){Je=!1;break}Pe(Ae),$-=K.y,I+=K.y,$<0&&(k=Oe,$=-$,I-=$),V&&(D=$*V,B+=(w.width-D)/2);break;case ne:if(K.x<=0&&(B<=De||V&&(I<=Se||me>=ct))){Je=!1;break}Pe(ne),D-=K.x,B+=K.x,D<0&&(k=te,D=-D,B-=D),V&&($=D/V,I+=(w.height-$)/2);break;case Oe:if(K.y>=0&&(me>=ct||V&&(B<=De||ge>=tt))){Je=!1;break}Pe(Oe),$+=K.y,$<0&&(k=Ae,$=-$,I-=$),V&&(D=$*V,B+=(w.width-D)/2);break;case $e:if(V){if(K.y<=0&&(I<=Se||ge>=tt)){Je=!1;break}Pe(Ae),$-=K.y,I+=K.y,D=$*V}else Pe(Ae),Pe(te),K.x>=0?ge<tt?D+=K.x:K.y<=0&&I<=Se&&(Je=!1):D+=K.x,K.y<=0?I>Se&&($-=K.y,I+=K.y):($-=K.y,I+=K.y);D<0&&$<0?(k=Xe,$=-$,D=-D,I-=$,B-=D):D<0?(k=xe,D=-D,B-=D):$<0&&(k=ke,$=-$,I-=$);break;case xe:if(V){if(K.y<=0&&(I<=Se||B<=De)){Je=!1;break}Pe(Ae),$-=K.y,I+=K.y,D=$*V,B+=w.width-D}else Pe(Ae),Pe(ne),K.x<=0?B>De?(D-=K.x,B+=K.x):K.y<=0&&I<=Se&&(Je=!1):(D-=K.x,B+=K.x),K.y<=0?I>Se&&($-=K.y,I+=K.y):($-=K.y,I+=K.y);D<0&&$<0?(k=ke,$=-$,D=-D,I-=$,B-=D):D<0?(k=$e,D=-D,B-=D):$<0&&(k=Xe,$=-$,I-=$);break;case Xe:if(V){if(K.x<=0&&(B<=De||me>=ct)){Je=!1;break}Pe(ne),D-=K.x,B+=K.x,$=D/V}else Pe(Oe),Pe(ne),K.x<=0?B>De?(D-=K.x,B+=K.x):K.y>=0&&me>=ct&&(Je=!1):(D-=K.x,B+=K.x),K.y>=0?me<ct&&($+=K.y):$+=K.y;D<0&&$<0?(k=$e,$=-$,D=-D,I-=$,B-=D):D<0?(k=ke,D=-D,B-=D):$<0&&(k=xe,$=-$,I-=$);break;case ke:if(V){if(K.x>=0&&(ge>=tt||me>=ct)){Je=!1;break}Pe(te),D+=K.x,$=D/V}else Pe(Oe),Pe(te),K.x>=0?ge<tt?D+=K.x:K.y>=0&&me>=ct&&(Je=!1):D+=K.x,K.y>=0?me<ct&&($+=K.y):$+=K.y;D<0&&$<0?(k=xe,$=-$,D=-D,I-=$,B-=D):D<0?(k=Xe,D=-D,B-=D):$<0&&(k=$e,$=-$,I-=$);break;case q:this.move(K.x,K.y),Je=!1;break;case W:this.zoom(xb(x),p),Je=!1;break;case J:if(!K.x||!K.y){Je=!1;break}Ki=uf(this.cropper),B=Kt.startX-Ki.left,I=Kt.startY-Ki.top,D=w.minWidth,$=w.minHeight,K.x>0?k=K.y>0?ke:$e:K.x<0&&(B-=D,k=K.y>0?Xe:xe),K.y<0&&(I-=$),this.cropped||(Gt(this.cropBox,_),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}Je&&(w.width=D,w.height=$,w.left=B,w.top=I,this.action=k,this.renderCropBox()),Me(x,function(it){it.startX=it.endX,it.startY=it.endY})},"change")},Bb={crop:o(function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&We(this.dragBox,z),Gt(this.cropBox,_),this.setCropBoxData(this.initialCropBoxData)),this},"crop"),reset:o(function(){return this.ready&&!this.disabled&&(this.imageData=Ee({},this.initialImageData),this.canvasData=Ee({},this.initialCanvasData),this.cropBoxData=Ee({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},"reset"),clear:o(function(){return this.cropped&&!this.disabled&&(Ee(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),Gt(this.dragBox,z),We(this.cropBox,_)),this},"clear"),replace:o(function(p){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&p&&(this.isImg&&(this.element.src=p),g?(this.url=p,this.image.src=p,this.ready&&(this.viewBoxImage.src=p,Me(this.previews,function(f){f.getElementsByTagName("img")[0].src=p}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(p))),this},"replace"),enable:o(function(){return this.ready&&this.disabled&&(this.disabled=!1,Gt(this.cropper,S)),this},"enable"),disable:o(function(){return this.ready&&!this.disabled&&(this.disabled=!0,We(this.cropper,S)),this},"disable"),destroy:o(function(){var p=this.element;return p[M]?(p[M]=void 0,this.isImg&&this.replaced&&(p.src=this.originalUrl),this.uncreate(),this):this},"destroy"),move:o(function(p){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p,f=this.canvasData,F=f.left,w=f.top;return this.moveTo(po(p)?p:F+Number(p),po(g)?g:w+Number(g))},"move"),moveTo:o(function(p){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p,f=this.canvasData,F=!1;return p=Number(p),g=Number(g),this.ready&&!this.disabled&&this.options.movable&&(he(p)&&(f.left=p,F=!0),he(g)&&(f.top=g,F=!0),F&&this.renderCanvas(!0)),this},"moveTo"),zoom:o(function(p,g){var f=this.canvasData;return p=Number(p),p<0?p=1/(1-p):p=1+p,this.zoomTo(f.width*p/f.naturalWidth,null,g)},"zoom"),zoomTo:o(function(p,g,f){var F=this.options,w=this.canvasData,x=w.width,k=w.height,V=w.naturalWidth,B=w.naturalHeight;if(p=Number(p),p>=0&&this.ready&&!this.disabled&&F.zoomable){var I=V*p,D=B*p;if(yo(this.element,Gi,{ratio:p,oldRatio:x/V,originalEvent:f})===!1)return this;if(f){var $=this.pointers,ge=uf(this.cropper),me=$&&Object.keys($).length?Fb($):{pageX:f.pageX,pageY:f.pageY};w.left-=(I-x)*((me.pageX-ge.left-w.left)/x),w.top-=(D-k)*((me.pageY-ge.top-w.top)/k)}else qr(g)&&he(g.x)&&he(g.y)?(w.left-=(I-x)*((g.x-w.left)/x),w.top-=(D-k)*((g.y-w.top)/k)):(w.left-=(I-x)/2,w.top-=(D-k)/2);w.width=I,w.height=D,this.renderCanvas(!0)}return this},"zoomTo"),rotate:o(function(p){return this.rotateTo((this.imageData.rotate||0)+Number(p))},"rotate"),rotateTo:o(function(p){return p=Number(p),he(p)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=p%360,this.renderCanvas(!0,!0)),this},"rotateTo"),scaleX:o(function(p){var g=this.imageData.scaleY;return this.scale(p,he(g)?g:1)},"scaleX"),scaleY:o(function(p){var g=this.imageData.scaleX;return this.scale(he(g)?g:1,p)},"scaleY"),scale:o(function(p){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:p,f=this.imageData,F=!1;return p=Number(p),g=Number(g),this.ready&&!this.disabled&&this.options.scalable&&(he(p)&&(f.scaleX=p,F=!0),he(g)&&(f.scaleY=g,F=!0),F&&this.renderCanvas(!0,!0)),this},"scale"),getData:o(function(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,g=this.options,f=this.imageData,F=this.canvasData,w=this.cropBoxData,x;if(this.ready&&this.cropped){x={x:w.left-F.left,y:w.top-F.top,width:w.width,height:w.height};var k=f.width/f.naturalWidth;if(Me(x,function(I,D){x[D]=I/k}),p){var V=Math.round(x.y+x.height),B=Math.round(x.x+x.width);x.x=Math.round(x.x),x.y=Math.round(x.y),x.width=B-x.x,x.height=V-x.y}}else x={x:0,y:0,width:0,height:0};return g.rotatable&&(x.rotate=f.rotate||0),g.scalable&&(x.scaleX=f.scaleX||1,x.scaleY=f.scaleY||1),x},"getData"),setData:o(function(p){var g=this.options,f=this.imageData,F=this.canvasData,w={};if(this.ready&&!this.disabled&&qr(p)){var x=!1;g.rotatable&&he(p.rotate)&&p.rotate!==f.rotate&&(f.rotate=p.rotate,x=!0),g.scalable&&(he(p.scaleX)&&p.scaleX!==f.scaleX&&(f.scaleX=p.scaleX,x=!0),he(p.scaleY)&&p.scaleY!==f.scaleY&&(f.scaleY=p.scaleY,x=!0)),x&&this.renderCanvas(!0,!0);var k=f.width/f.naturalWidth;he(p.x)&&(w.left=p.x*k+F.left),he(p.y)&&(w.top=p.y*k+F.top),he(p.width)&&(w.width=p.width*k),he(p.height)&&(w.height=p.height*k),this.setCropBoxData(w)}return this},"setData"),getContainerData:o(function(){return this.ready?Ee({},this.containerData):{}},"getContainerData"),getImageData:o(function(){return this.sized?Ee({},this.imageData):{}},"getImageData"),getCanvasData:o(function(){var p=this.canvasData,g={};return this.ready&&Me(["left","top","width","height","naturalWidth","naturalHeight"],function(f){g[f]=p[f]}),g},"getCanvasData"),setCanvasData:o(function(p){var g=this.canvasData,f=g.aspectRatio;return this.ready&&!this.disabled&&qr(p)&&(he(p.left)&&(g.left=p.left),he(p.top)&&(g.top=p.top),he(p.width)?(g.width=p.width,g.height=p.width/f):he(p.height)&&(g.height=p.height,g.width=p.height*f),this.renderCanvas(!0)),this},"setCanvasData"),getCropBoxData:o(function(){var p=this.cropBoxData,g;return this.ready&&this.cropped&&(g={left:p.left,top:p.top,width:p.width,height:p.height}),g||{}},"getCropBoxData"),setCropBoxData:o(function(p){var g=this.cropBoxData,f=this.options.aspectRatio,F,w;return this.ready&&this.cropped&&!this.disabled&&qr(p)&&(he(p.left)&&(g.left=p.left),he(p.top)&&(g.top=p.top),he(p.width)&&p.width!==g.width&&(F=!0,g.width=p.width),he(p.height)&&p.height!==g.height&&(w=!0,g.height=p.height),f&&(F?g.height=g.width/f:w&&(g.width=g.height*f)),this.renderCropBox()),this},"setCropBoxData"),getCroppedCanvas:o(function(){var p=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var g=this.canvasData,f=Cb(this.image,this.imageData,g,p);if(!this.cropped)return f;var F=this.getData(p.rounded),w=F.x,x=F.y,k=F.width,V=F.height,B=f.width/Math.floor(g.naturalWidth);B!==1&&(w*=B,x*=B,k*=B,V*=B);var I=k/V,D=Vr({aspectRatio:I,width:p.maxWidth||1/0,height:p.maxHeight||1/0}),$=Vr({aspectRatio:I,width:p.minWidth||0,height:p.minHeight||0},"cover"),ge=Vr({aspectRatio:I,width:p.width||(B!==1?f.width:k),height:p.height||(B!==1?f.height:V)}),me=ge.width,De=ge.height;me=Math.min(D.width,Math.max($.width,me)),De=Math.min(D.height,Math.max($.height,De));var Se=document.createElement("canvas"),tt=Se.getContext("2d");Se.width=Di(me),Se.height=Di(De),tt.fillStyle=p.fillColor||"transparent",tt.fillRect(0,0,me,De);var ct=p.imageSmoothingEnabled,Je=ct===void 0?!0:ct,Ki=p.imageSmoothingQuality;tt.imageSmoothingEnabled=Je,Ki&&(tt.imageSmoothingQuality=Ki);var Kt=f.width,K=f.height,Pe=w,it=x,pi,Xi,is,rs,Wr,Ni;Pe<=-k||Pe>Kt?(Pe=0,pi=0,is=0,Wr=0):Pe<=0?(is=-Pe,Pe=0,pi=Math.min(Kt,k+Pe),Wr=pi):Pe<=Kt&&(is=0,pi=Math.min(k,Kt-Pe),Wr=pi),pi<=0||it<=-V||it>K?(it=0,Xi=0,rs=0,Ni=0):it<=0?(rs=-it,it=0,Xi=Math.min(K,V+it),Ni=Xi):it<=K&&(rs=0,Xi=Math.min(V,K-it),Ni=Xi);var Ht=[Pe,it,pi,Xi];if(Wr>0&&Ni>0){var ss=me/k;Ht.push(is*ss,rs*ss,Wr*ss,Ni*ss)}return tt.drawImage.apply(tt,[f].concat(d(Ht.map(function(_l){return Math.floor(Di(_l))})))),Se},"getCroppedCanvas"),setAspectRatio:o(function(p){var g=this.options;return!this.disabled&&!po(p)&&(g.aspectRatio=Math.max(0,p)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},"setAspectRatio"),setDragMode:o(function(p){var g=this.options,f=this.dragBox,F=this.face;if(this.ready&&!this.disabled){var w=p===N,x=g.movable&&p===Y;p=w||x?p:Q,g.dragMode=p,di(f,T,p),es(f,C,w),es(f,U,x),g.cropBoxMovable||(di(F,T,p),es(F,C,w),es(F,U,x))}return this},"setDragMode")},zb=E.Cropper,pf=function(){function y(p){var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(n(this,y),!p||!ut.test(p.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=p,this.options=Ee({},tn,qr(g)&&g),this.cropped=!1,this.disabled=!1,this.pointers={},this.ready=!1,this.reloading=!1,this.replaced=!1,