(()=>{var Dv=Object.create;var wd=Object.defineProperty;var Nv=Object.getOwnPropertyDescriptor;var Bv=Object.getOwnPropertyNames;var Uv=Object.getPrototypeOf,zv=Object.prototype.hasOwnProperty;var _e=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var Hv=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Bv(e))!zv.call(i,s)&&s!==t&&wd(i,s,{get:()=>e[s],enumerable:!(r=Nv(e,s))||r.enumerable});return i};var Ce=(i,e,t)=>(t=i!=null?Dv(Uv(i)):{},Hv(e||!i||!i.__esModule?wd(t,"default",{value:i,enumerable:!0}):t,i));var Nd=_e((gx,Dd)=>{var Ob="Expected a function",Md=NaN,Rb="[object Symbol]",Lb=/^\s+|\s+$/g,Mb=/^[-+]0x[0-9a-f]+$/i,Ib=/^0b[01]+$/i,Db=/^0o[0-7]+$/i,Nb=parseInt,Bb=typeof global=="object"&&global&&global.Object===Object&&global,Ub=typeof self=="object"&&self&&self.Object===Object&&self,zb=Bb||Ub||Function("return this")(),Hb=Object.prototype,$b=Hb.toString,qb=Math.max,Vb=Math.min,sc=function(){return zb.Date.now()};function jb(i,e,t){var r,s,n,o,a,l,c=0,d=!1,f=!1,y=!0;if(typeof i!="function")throw new TypeError(Ob);e=Id(e)||0,nc(t)&&(d=!!t.leading,f="maxWait"in t,n=f?qb(Id(t.maxWait)||0,e):n,y="trailing"in t?!!t.trailing:y);function v(R){var G=r,K=s;return r=s=void 0,c=R,o=i.apply(K,G),o}function x(R){return c=R,a=setTimeout(I,e),d?v(R):o}function P(R){var G=R-l,K=R-c,Y=e-G;return f?Vb(Y,n-K):Y}function C(R){var G=R-l,K=R-c;return l===void 0||G>=e||G<0||f&&K>=n}function I(){var R=sc();if(C(R))return D(R);a=setTimeout(I,P(R))}function D(R){return a=void 0,y&&r?v(R):(r=s=void 0,o)}function q(){a!==void 0&&clearTimeout(a),c=0,r=l=s=a=void 0}function M(){return a===void 0?o:D(sc())}function H(){var R=sc(),G=C(R);if(r=arguments,s=this,l=R,G){if(a===void 0)return x(l);if(f)return a=setTimeout(I,e),v(l)}return a===void 0&&(a=setTimeout(I,e)),o}return H.cancel=q,H.flush=M,H}function nc(i){var e=typeof i;return!!i&&(e=="object"||e=="function")}function Wb(i){return!!i&&typeof i=="object"}function Gb(i){return typeof i=="symbol"||Wb(i)&&$b.call(i)==Rb}function Id(i){if(typeof i=="number")return i;if(Gb(i))return Md;if(nc(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=nc(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=i.replace(Lb,"");var t=Ib.test(i);return t||Db.test(i)?Nb(i.slice(2),t?2:8):Mb.test(i)?Md:+i}Dd.exports=jb});var Dp=_e((aC,Ip)=>{Ip.exports=function(){var e={},t=e._fns={};e.emit=function(o,a,l,c,d,f,y){var v=r(o);v.length&&s(o,v,[a,l,c,d,f,y])},e.on=function(o,a){t[o]||(t[o]=[]),t[o].push(a)},e.once=function(o,a){function l(){a.apply(this,arguments),e.off(o,l)}this.on(o,l)},e.off=function(o,a){var l=[];if(o&&a){var c=this._fns[o],d=0,f=c?c.length:0;for(d;d{function k0(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}Bp.exports=k0});var zp=_e((uC,Up)=>{var P0=typeof global=="object"&&global&&global.Object===Object&&global;Up.exports=P0});var Dc=_e((hC,Hp)=>{var C0=zp(),F0=typeof self=="object"&&self&&self.Object===Object&&self,_0=C0||F0||Function("return this")();Hp.exports=_0});var qp=_e((dC,$p)=>{var O0=Dc(),R0=function(){return O0.Date.now()};$p.exports=R0});var jp=_e((pC,Vp)=>{var L0=/\s/;function M0(i){for(var e=i.length;e--&&L0.test(i.charAt(e)););return e}Vp.exports=M0});var Gp=_e((fC,Wp)=>{var I0=jp(),D0=/^\s+/;function N0(i){return i&&i.slice(0,I0(i)+1).replace(D0,"")}Wp.exports=N0});var Nc=_e((mC,Kp)=>{var B0=Dc(),U0=B0.Symbol;Kp.exports=U0});var Qp=_e((gC,Zp)=>{var Xp=Nc(),Yp=Object.prototype,z0=Yp.hasOwnProperty,H0=Yp.toString,Pn=Xp?Xp.toStringTag:void 0;function $0(i){var e=z0.call(i,Pn),t=i[Pn];try{i[Pn]=void 0;var r=!0}catch{}var s=H0.call(i);return r&&(e?i[Pn]=t:delete i[Pn]),s}Zp.exports=$0});var ef=_e((vC,Jp)=>{var q0=Object.prototype,V0=q0.toString;function j0(i){return V0.call(i)}Jp.exports=j0});var nf=_e((bC,sf)=>{var tf=Nc(),W0=Qp(),G0=ef(),K0="[object Null]",X0="[object Undefined]",rf=tf?tf.toStringTag:void 0;function Y0(i){return i==null?i===void 0?X0:K0:rf&&rf in Object(i)?W0(i):G0(i)}sf.exports=Y0});var af=_e((yC,of)=>{function Z0(i){return i!=null&&typeof i=="object"}of.exports=Z0});var cf=_e((wC,lf)=>{var Q0=nf(),J0=af(),ew="[object Symbol]";function tw(i){return typeof i=="symbol"||J0(i)&&Q0(i)==ew}lf.exports=tw});var pf=_e((SC,df)=>{var iw=Gp(),uf=Sa(),rw=cf(),hf=NaN,sw=/^[-+]0x[0-9a-f]+$/i,nw=/^0b[01]+$/i,ow=/^0o[0-7]+$/i,aw=parseInt;function lw(i){if(typeof i=="number")return i;if(rw(i))return hf;if(uf(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=uf(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=iw(i);var t=nw.test(i);return t||ow.test(i)?aw(i.slice(2),t?2:8):sw.test(i)?hf:+i}df.exports=lw});var Uc=_e((EC,mf)=>{var cw=Sa(),Bc=qp(),ff=pf(),uw="Expected a function",hw=Math.max,dw=Math.min;function pw(i,e,t){var r,s,n,o,a,l,c=0,d=!1,f=!1,y=!0;if(typeof i!="function")throw new TypeError(uw);e=ff(e)||0,cw(t)&&(d=!!t.leading,f="maxWait"in t,n=f?hw(ff(t.maxWait)||0,e):n,y="trailing"in t?!!t.trailing:y);function v(R){var G=r,K=s;return r=s=void 0,c=R,o=i.apply(K,G),o}function x(R){return c=R,a=setTimeout(I,e),d?v(R):o}function P(R){var G=R-l,K=R-c,Y=e-G;return f?dw(Y,n-K):Y}function C(R){var G=R-l,K=R-c;return l===void 0||G>=e||G<0||f&&K>=n}function I(){var R=Bc();if(C(R))return D(R);a=setTimeout(I,P(R))}function D(R){return a=void 0,y&&r?v(R):(r=s=void 0,o)}function q(){a!==void 0&&clearTimeout(a),c=0,r=l=s=a=void 0}function M(){return a===void 0?o:D(Bc())}function H(){var R=Bc(),G=C(R);if(r=arguments,s=this,l=R,G){if(a===void 0)return x(l);if(f)return clearTimeout(a),a=setTimeout(I,e),v(l)}return a===void 0&&(a=setTimeout(I,e)),o}return H.cancel=q,H.flush=M,H}mf.exports=pw});var vf=_e((TC,gf)=>{var fw=Uc(),mw=Sa(),gw="Expected a function";function vw(i,e,t){var r=!0,s=!0;if(typeof i!="function")throw new TypeError(gw);return mw(t)&&(r="leading"in t?!!t.leading:r,s="trailing"in t?!!t.trailing:s),fw(i,e,{leading:r,maxWait:e,trailing:s})}gf.exports=vw});var Aa=_e((NC,xf)=>{"use strict";xf.exports=function(e){if(typeof e!="number"||Number.isNaN(e))throw new TypeError(`Expected a number, got ${typeof e}`);let t=e<0,r=Math.abs(e);if(t&&(r=-r),r===0)return"0 B";let s=["B","KB","MB","GB","TB","PB","EB","ZB","YB"],n=Math.min(Math.floor(Math.log(r)/Math.log(1024)),s.length-1),o=Number(r/1024**n),a=s[n];return`${o>=10||o%1===0?Math.round(o):o.toFixed(1)} ${a}`}});var Pf=_e((BC,kf)=>{"use strict";function Af(i,e){this.text=i=i||"",this.hasWild=~i.indexOf("*"),this.separator=e,this.parts=i.split(e)}Af.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{var Tw=Pf(),xw=/[\/\+\.]/;Cf.exports=function(i,e){function t(r){var s=Tw(r,i,xw);return s&&s.length>=2}return e?t(e.split(";")[0]):t}});var bt=_e((v2,Ia)=>{(function(){"use strict";var i={}.hasOwnProperty;function e(){for(var s="",n=0;n{"use strict";var Q1=Object.prototype.hasOwnProperty,wt="~";function so(){}Object.create&&(so.prototype=Object.create(null),new so().__proto__||(wt=!1));function J1(i,e,t){this.fn=i,this.context=e,this.once=t||!1}function Xm(i,e,t,r,s){if(typeof t!="function")throw new TypeError("The listener must be a function");var n=new J1(t,r||i,s),o=wt?wt+e:e;return i._events[o]?i._events[o].fn?i._events[o]=[i._events[o],n]:i._events[o].push(n):(i._events[o]=n,i._eventsCount++),i}function el(i,e){--i._eventsCount===0?i._events=new so:delete i._events[e]}function dt(){this._events=new so,this._eventsCount=0}dt.prototype.eventNames=function(){var e=[],t,r;if(this._eventsCount===0)return e;for(r in t=this._events)Q1.call(t,r)&&e.push(wt?r.slice(1):r);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};dt.prototype.listeners=function(e){var t=wt?wt+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var s=0,n=r.length,o=new Array(n);s{(function(i,e){typeof Eh=="object"&&typeof Th<"u"?Th.exports=e():typeof define=="function"&&define.amd?define(e):(i=typeof globalThis<"u"?globalThis:i||self,i.Cropper=e())})(Eh,function(){"use strict";function i(g,h){var m=Object.keys(g);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(g);h&&(p=p.filter(function(E){return Object.getOwnPropertyDescriptor(g,E).enumerable})),m.push.apply(m,p)}return m}function e(g){for(var h=1;hg.length)&&(h=g.length);for(var m=0,p=new Array(h);m
',ms=Number.isNaN||C.isNaN;function re(g){return typeof g=="number"&&!ms(g)}var zt=function(h){return h>0&&h<1/0};function vi(g){return typeof g>"u"}function ti(g){return s(g)==="object"&&g!==null}var tn=Object.prototype.hasOwnProperty;function rr(g){if(!ti(g))return!1;try{var h=g.constructor,m=h.prototype;return h&&m&&tn.call(m,"isPrototypeOf")}catch{return!1}}function Ge(g){return typeof g=="function"}var gs=Array.prototype.slice;function Mo(g){return Array.from?Array.from(g):gs.call(g)}function ye(g,h){return g&&Ge(h)&&(Array.isArray(g)||re(g.length)?Mo(g).forEach(function(m,p){h.call(g,m,p,g)}):ti(g)&&Object.keys(g).forEach(function(m){h.call(g,g[m],m,g)})),g}var we=Object.assign||function(h){for(var m=arguments.length,p=new Array(m>1?m-1:0),E=1;E0&&p.forEach(function(b){ti(b)&&Object.keys(b).forEach(function(S){h[S]=b[S]})}),h},Fl=/\.\d*(?:0|9){12}\d*$/;function Te(g){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return Fl.test(g)?Math.round(g*h)/h:g}var sr=/^width|height|left|top|marginLeft|marginTop$/;function bi(g,h){var m=g.style;ye(h,function(p,E){sr.test(E)&&re(p)&&(p="".concat(p,"px")),m[E]=p})}function Io(g,h){return g.classList?g.classList.contains(h):g.className.indexOf(h)>-1}function Ie(g,h){if(h){if(re(g.length)){ye(g,function(p){Ie(p,h)});return}if(g.classList){g.classList.add(h);return}var m=g.className.trim();m?m.indexOf(h)<0&&(g.className="".concat(m," ").concat(h)):g.className=h}}function Ft(g,h){if(h){if(re(g.length)){ye(g,function(m){Ft(m,h)});return}if(g.classList){g.classList.remove(h);return}g.className.indexOf(h)>=0&&(g.className=g.className.replace(h,""))}}function _i(g,h,m){if(h){if(re(g.length)){ye(g,function(p){_i(p,h,m)});return}m?Ie(g,h):Ft(g,h)}}var _l=/([a-z\d])([A-Z])/g;function xt(g){return g.replace(_l,"$1-$2").toLowerCase()}function nr(g,h){return ti(g[h])?g[h]:g.dataset?g.dataset[h]:g.getAttribute("data-".concat(xt(h)))}function or(g,h,m){ti(m)?g[h]=m:g.dataset?g.dataset[h]=m:g.setAttribute("data-".concat(xt(h)),m)}function Do(g,h){if(ti(g[h]))try{delete g[h]}catch{g[h]=void 0}else if(g.dataset)try{delete g.dataset[h]}catch{g.dataset[h]=void 0}else g.removeAttribute("data-".concat(xt(h)))}var rn=/\s\s*/,sn=function(){var g=!1;if(P){var h=!1,m=function(){},p=Object.defineProperty({},"once",{get:function(){return g=!0,h},set:function(b){h=b}});C.addEventListener("test",m,p),C.removeEventListener("test",m,p)}return g}();function Be(g,h,m){var p=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},E=m;h.trim().split(rn).forEach(function(b){if(!sn){var S=g.listeners;S&&S[b]&&S[b][m]&&(E=S[b][m],delete S[b][m],Object.keys(S[b]).length===0&&delete S[b],Object.keys(S).length===0&&delete g.listeners)}g.removeEventListener(b,E,p)})}function pt(g,h,m){var p=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},E=m;h.trim().split(rn).forEach(function(b){if(p.once&&!sn){var S=g.listeners,F=S===void 0?{}:S;E=function(){delete F[b][m],g.removeEventListener(b,E,p);for(var L=arguments.length,_=new Array(L),O=0;OMath.abs(m)&&(m=N)})}),m}function ve(g,h){var m=g.pageX,p=g.pageY,E={endX:m,endY:p};return h?E:e({startX:m,startY:p},E)}function Qe(g){var h=0,m=0,p=0;return ye(g,function(E){var b=E.startX,S=E.startY;h+=b,m+=S,p+=1}),h/=p,m/=p,{pageX:h,pageY:m}}function Se(g){var h=g.aspectRatio,m=g.height,p=g.width,E=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",b=zt(p),S=zt(m);if(b&&S){var F=m*h;E==="contain"&&F>p||E==="cover"&&F90?{width:U,height:F}:{width:F,height:U}}function Ht(g,h,m,p){var E=h.aspectRatio,b=h.naturalWidth,S=h.naturalHeight,F=h.rotate,U=F===void 0?0:F,L=h.scaleX,_=L===void 0?1:L,O=h.scaleY,N=O===void 0?1:O,he=m.aspectRatio,ue=m.naturalWidth,Pe=m.naturalHeight,pe=p.fillColor,Ke=pe===void 0?"transparent":pe,Je=p.imageSmoothingEnabled,$e=Je===void 0?!0:Je,Ri=p.imageSmoothingQuality,_t=Ri===void 0?"low":Ri,V=p.maxWidth,fe=V===void 0?1/0:V,Xe=p.maxHeight,$t=Xe===void 0?1/0:Xe,Li=p.minWidth,wr=Li===void 0?0:Li,Sr=p.minHeight,lr=Sr===void 0?0:Sr,yi=document.createElement("canvas"),At=yi.getContext("2d"),Er=Se({aspectRatio:he,width:fe,height:$t}),Uo=Se({aspectRatio:he,width:wr,height:lr},"cover"),Rl=Math.min(Er.width,Math.max(Uo.width,ue)),Ll=Math.min(Er.height,Math.max(Uo.height,Pe)),gd=Se({aspectRatio:E,width:fe,height:$t}),vd=Se({aspectRatio:E,width:wr,height:lr},"cover"),bd=Math.min(gd.width,Math.max(vd.width,b)),yd=Math.min(gd.height,Math.max(vd.height,S)),Mv=[-bd/2,-yd/2,bd,yd];return yi.width=Te(Rl),yi.height=Te(Ll),At.fillStyle=Ke,At.fillRect(0,0,Rl,Ll),At.save(),At.translate(Rl/2,Ll/2),At.rotate(U*Math.PI/180),At.scale(_,N),At.imageSmoothingEnabled=$e,At.imageSmoothingQuality=_t,At.drawImage.apply(At,[g].concat(c(Mv.map(function(Iv){return Math.floor(Te(Iv))})))),At.restore(),yi}var ar=String.fromCharCode;function st(g,h,m){var p="";m+=h;for(var E=h;E0;)m.push(ar.apply(null,Mo(E.subarray(0,p)))),E=E.subarray(p);return"data:".concat(h,";base64,").concat(btoa(m.join("")))}function Av(g){var h=new DataView(g),m;try{var p,E,b;if(h.getUint8(0)===255&&h.getUint8(1)===216)for(var S=h.byteLength,F=2;F+1=8&&(b=L+O)}}}if(b){var N=h.getUint16(b,p),he,ue;for(ue=0;ue=0?b:ir),height:Math.max(p.offsetHeight,S>=0?S:en)};this.containerData=F,bi(E,{width:F.width,height:F.height}),Ie(h,k),Ft(E,k)},initCanvas:function(){var h=this.containerData,m=this.imageData,p=this.options.viewMode,E=Math.abs(m.rotate)%180===90,b=E?m.naturalHeight:m.naturalWidth,S=E?m.naturalWidth:m.naturalHeight,F=b/S,U=h.width,L=h.height;h.height*F>h.width?p===3?U=h.height*F:L=h.width/F:p===3?L=h.width/F:U=h.height*F;var _={aspectRatio:F,naturalWidth:b,naturalHeight:S,width:U,height:L};this.canvasData=_,this.limited=p===1||p===2,this.limitCanvas(!0,!0),_.width=Math.min(Math.max(_.width,_.minWidth),_.maxWidth),_.height=Math.min(Math.max(_.height,_.minHeight),_.maxHeight),_.left=(h.width-_.width)/2,_.top=(h.height-_.height)/2,_.oldLeft=_.left,_.oldTop=_.top,this.initialCanvasData=we({},_)},limitCanvas:function(h,m){var p=this.options,E=this.containerData,b=this.canvasData,S=this.cropBoxData,F=p.viewMode,U=b.aspectRatio,L=this.cropped&&S;if(h){var _=Number(p.minCanvasWidth)||0,O=Number(p.minCanvasHeight)||0;F>1?(_=Math.max(_,E.width),O=Math.max(O,E.height),F===3&&(O*U>_?_=O*U:O=_/U)):F>0&&(_?_=Math.max(_,L?S.width:0):O?O=Math.max(O,L?S.height:0):L&&(_=S.width,O=S.height,O*U>_?_=O*U:O=_/U));var N=Se({aspectRatio:U,width:_,height:O});_=N.width,O=N.height,b.minWidth=_,b.minHeight=O,b.maxWidth=1/0,b.maxHeight=1/0}if(m)if(F>(L?0:1)){var he=E.width-b.width,ue=E.height-b.height;b.minLeft=Math.min(0,he),b.minTop=Math.min(0,ue),b.maxLeft=Math.max(0,he),b.maxTop=Math.max(0,ue),L&&this.limited&&(b.minLeft=Math.min(S.left,S.left+(S.width-b.width)),b.minTop=Math.min(S.top,S.top+(S.height-b.height)),b.maxLeft=S.left,b.maxTop=S.top,F===2&&(b.width>=E.width&&(b.minLeft=Math.min(0,he),b.maxLeft=Math.max(0,he)),b.height>=E.height&&(b.minTop=Math.min(0,ue),b.maxTop=Math.max(0,ue))))}else b.minLeft=-b.width,b.minTop=-b.height,b.maxLeft=E.width,b.maxTop=E.height},renderCanvas:function(h,m){var p=this.canvasData,E=this.imageData;if(m){var b=ut({width:E.naturalWidth*Math.abs(E.scaleX||1),height:E.naturalHeight*Math.abs(E.scaleY||1),degree:E.rotate||0}),S=b.width,F=b.height,U=p.width*(S/p.naturalWidth),L=p.height*(F/p.naturalHeight);p.left-=(U-p.width)/2,p.top-=(L-p.height)/2,p.width=U,p.height=L,p.aspectRatio=S/F,p.naturalWidth=S,p.naturalHeight=F,this.limitCanvas(!0,!1)}(p.width>p.maxWidth||p.widthp.maxHeight||p.heightm.width?b.height=b.width/p:b.width=b.height*p),this.cropBoxData=b,this.limitCropBox(!0,!0),b.width=Math.min(Math.max(b.width,b.minWidth),b.maxWidth),b.height=Math.min(Math.max(b.height,b.minHeight),b.maxHeight),b.width=Math.max(b.minWidth,b.width*E),b.height=Math.max(b.minHeight,b.height*E),b.left=m.left+(m.width-b.width)/2,b.top=m.top+(m.height-b.height)/2,b.oldLeft=b.left,b.oldTop=b.top,this.initialCropBoxData=we({},b)},limitCropBox:function(h,m){var p=this.options,E=this.containerData,b=this.canvasData,S=this.cropBoxData,F=this.limited,U=p.aspectRatio;if(h){var L=Number(p.minCropBoxWidth)||0,_=Number(p.minCropBoxHeight)||0,O=F?Math.min(E.width,b.width,b.width+b.left,E.width-b.left):E.width,N=F?Math.min(E.height,b.height,b.height+b.top,E.height-b.top):E.height;L=Math.min(L,E.width),_=Math.min(_,E.height),U&&(L&&_?_*U>L?_=L/U:L=_*U:L?_=L/U:_&&(L=_*U),N*U>O?N=O/U:O=N*U),S.minWidth=Math.min(L,O),S.minHeight=Math.min(_,N),S.maxWidth=O,S.maxHeight=N}m&&(F?(S.minLeft=Math.max(0,b.left),S.minTop=Math.max(0,b.top),S.maxLeft=Math.min(E.width,b.left+b.width)-S.width,S.maxTop=Math.min(E.height,b.top+b.height)-S.height):(S.minLeft=0,S.minTop=0,S.maxLeft=E.width-S.width,S.maxTop=E.height-S.height))},renderCropBox:function(){var h=this.options,m=this.containerData,p=this.cropBoxData;(p.width>p.maxWidth||p.widthp.maxHeight||p.height=m.width&&p.height>=m.height?R:M),bi(this.cropBox,we({width:p.width,height:p.height},B({translateX:p.left,translateY:p.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),Oi(this.element,Ne,this.getData())}},Cv={initPreview:function(){var h=this.element,m=this.crossOrigin,p=this.options.preview,E=m?this.crossOriginUrl:this.url,b=h.alt||"The image to preview",S=document.createElement("img");if(m&&(S.crossOrigin=m),S.src=E,S.alt=b,this.viewBox.appendChild(S),this.viewBoxImage=S,!!p){var F=p;typeof p=="string"?F=h.ownerDocument.querySelectorAll(p):p.querySelector&&(F=[p]),this.previews=F,ye(F,function(U){var L=document.createElement("img");or(U,ke,{width:U.offsetWidth,height:U.offsetHeight,html:U.innerHTML}),m&&(L.crossOrigin=m),L.src=E,L.alt=b,L.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;"',U.innerHTML="",U.appendChild(L)})}},resetPreview:function(){ye(this.previews,function(h){var m=nr(h,ke);bi(h,{width:m.width,height:m.height}),h.innerHTML=m.html,Do(h,ke)})},preview:function(){var h=this.imageData,m=this.canvasData,p=this.cropBoxData,E=p.width,b=p.height,S=h.width,F=h.height,U=p.left-m.left-h.left,L=p.top-m.top-h.top;!this.cropped||this.disabled||(bi(this.viewBoxImage,we({width:S,height:F},B(we({translateX:-U,translateY:-L},h)))),ye(this.previews,function(_){var O=nr(_,ke),N=O.width,he=O.height,ue=N,Pe=he,pe=1;E&&(pe=N/E,Pe=b*pe),b&&Pe>he&&(pe=he/b,ue=E*pe,Pe=he),bi(_,{width:ue,height:Pe}),bi(_.getElementsByTagName("img")[0],we({width:S*pe,height:F*pe},B(we({translateX:-U*pe,translateY:-L*pe},h))))}))}},Fv={bind:function(){var h=this.element,m=this.options,p=this.cropper;Ge(m.cropstart)&&pt(h,mi,m.cropstart),Ge(m.cropmove)&&pt(h,fi,m.cropmove),Ge(m.cropend)&&pt(h,He,m.cropend),Ge(m.crop)&&pt(h,Ne,m.crop),Ge(m.zoom)&&pt(h,tr,m.zoom),pt(p,ki,this.onCropStart=this.cropStart.bind(this)),m.zoomable&&m.zoomOnWheel&&pt(p,gi,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),m.toggleDragModeOnDblclick&&pt(p,Yt,this.onDblclick=this.dblclick.bind(this)),pt(h.ownerDocument,Ut,this.onCropMove=this.cropMove.bind(this)),pt(h.ownerDocument,Pi,this.onCropEnd=this.cropEnd.bind(this)),m.responsive&&pt(window,Ct,this.onResize=this.resize.bind(this))},unbind:function(){var h=this.element,m=this.options,p=this.cropper;Ge(m.cropstart)&&Be(h,mi,m.cropstart),Ge(m.cropmove)&&Be(h,fi,m.cropmove),Ge(m.cropend)&&Be(h,He,m.cropend),Ge(m.crop)&&Be(h,Ne,m.crop),Ge(m.zoom)&&Be(h,tr,m.zoom),Be(p,ki,this.onCropStart),m.zoomable&&m.zoomOnWheel&&Be(p,gi,this.onWheel,{passive:!1,capture:!0}),m.toggleDragModeOnDblclick&&Be(p,Yt,this.onDblclick),Be(h.ownerDocument,Ut,this.onCropMove),Be(h.ownerDocument,Pi,this.onCropEnd),m.responsive&&Be(window,Ct,this.onResize)}},_v={resize:function(){if(!this.disabled){var h=this.options,m=this.container,p=this.containerData,E=m.offsetWidth/p.width,b=m.offsetHeight/p.height,S=Math.abs(E-1)>Math.abs(b-1)?E:b;if(S!==1){var F,U;h.restore&&(F=this.getCanvasData(),U=this.getCropBoxData()),this.render(),h.restore&&(this.setCanvasData(ye(F,function(L,_){F[_]=L*S})),this.setCropBoxData(ye(U,function(L,_){U[_]=L*S})))}}},dblclick:function(){this.disabled||this.options.dragMode===Me||this.setDragMode(Io(this.dragBox,T)?ce:se)},wheel:function(h){var m=this,p=Number(this.options.wheelZoomRatio)||.1,E=1;this.disabled||(h.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){m.wheeling=!1},50),h.deltaY?E=h.deltaY>0?1:-1:h.wheelDelta?E=-h.wheelDelta/120:h.detail&&(E=h.detail>0?1:-1),this.zoom(-E*p,h)))},cropStart:function(h){var m=h.buttons,p=h.button;if(!(this.disabled||(h.type==="mousedown"||h.type==="pointerdown"&&h.pointerType==="mouse")&&(re(m)&&m!==1||re(p)&&p!==0||h.ctrlKey))){var E=this.options,b=this.pointers,S;h.changedTouches?ye(h.changedTouches,function(F){b[F.identifier]=ve(F)}):b[h.pointerId||0]=ve(h),Object.keys(b).length>1&&E.zoomable&&E.zoomOnTouch?S=G:S=nr(h.target,ee),Qt.test(S)&&Oi(this.element,mi,{originalEvent:h,action:S})!==!1&&(h.preventDefault(),this.action=S,this.cropping=!1,S===H&&(this.cropping=!0,Ie(this.dragBox,z)))}},cropMove:function(h){var m=this.action;if(!(this.disabled||!m)){var p=this.pointers;h.preventDefault(),Oi(this.element,fi,{originalEvent:h,action:m})!==!1&&(h.changedTouches?ye(h.changedTouches,function(E){we(p[E.identifier]||{},ve(E,!0))}):we(p[h.pointerId||0]||{},ve(h,!0)),this.change(h))}},cropEnd:function(h){if(!this.disabled){var m=this.action,p=this.pointers;h.changedTouches?ye(h.changedTouches,function(E){delete p[E.identifier]}):delete p[h.pointerId||0],m&&(h.preventDefault(),Object.keys(p).length||(this.action=""),this.cropping&&(this.cropping=!1,_i(this.dragBox,z,this.cropped&&this.options.modal)),Oi(this.element,He,{originalEvent:h,action:m}))}}},Ov={change:function(h){var m=this.options,p=this.canvasData,E=this.containerData,b=this.cropBoxData,S=this.pointers,F=this.action,U=m.aspectRatio,L=b.left,_=b.top,O=b.width,N=b.height,he=L+O,ue=_+N,Pe=0,pe=0,Ke=E.width,Je=E.height,$e=!0,Ri;!U&&h.shiftKey&&(U=O&&N?O/N:1),this.limited&&(Pe=b.minLeft,pe=b.minTop,Ke=Pe+Math.min(E.width,p.width,p.left+p.width),Je=pe+Math.min(E.height,p.height,p.top+p.height));var _t=S[Object.keys(S)[0]],V={x:_t.endX-_t.startX,y:_t.endY-_t.startY},fe=function($t){switch($t){case K:he+V.x>Ke&&(V.x=Ke-he);break;case Y:L+V.xJe&&(V.y=Je-ue);break}};switch(F){case M:L+=V.x,_+=V.y;break;case K:if(V.x>=0&&(he>=Ke||U&&(_<=pe||ue>=Je))){$e=!1;break}fe(K),O+=V.x,O<0&&(F=Y,O=-O,L-=O),U&&(N=O/U,_+=(b.height-N)/2);break;case Q:if(V.y<=0&&(_<=pe||U&&(L<=Pe||he>=Ke))){$e=!1;break}fe(Q),N-=V.y,_+=V.y,N<0&&(F=ie,N=-N,_-=N),U&&(O=N*U,L+=(b.width-O)/2);break;case Y:if(V.x<=0&&(L<=Pe||U&&(_<=pe||ue>=Je))){$e=!1;break}fe(Y),O-=V.x,L+=V.x,O<0&&(F=K,O=-O,L-=O),U&&(N=O/U,_+=(b.height-N)/2);break;case ie:if(V.y>=0&&(ue>=Je||U&&(L<=Pe||he>=Ke))){$e=!1;break}fe(ie),N+=V.y,N<0&&(F=Q,N=-N,_-=N),U&&(O=N*U,L+=(b.width-O)/2);break;case oe:if(U){if(V.y<=0&&(_<=pe||he>=Ke)){$e=!1;break}fe(Q),N-=V.y,_+=V.y,O=N*U}else fe(Q),fe(K),V.x>=0?hepe&&(N-=V.y,_+=V.y):(N-=V.y,_+=V.y);O<0&&N<0?(F=We,N=-N,O=-O,_-=N,L-=O):O<0?(F=le,O=-O,L-=O):N<0&&(F=Ae,N=-N,_-=N);break;case le:if(U){if(V.y<=0&&(_<=pe||L<=Pe)){$e=!1;break}fe(Q),N-=V.y,_+=V.y,O=N*U,L+=b.width-O}else fe(Q),fe(Y),V.x<=0?L>Pe?(O-=V.x,L+=V.x):V.y<=0&&_<=pe&&($e=!1):(O-=V.x,L+=V.x),V.y<=0?_>pe&&(N-=V.y,_+=V.y):(N-=V.y,_+=V.y);O<0&&N<0?(F=Ae,N=-N,O=-O,_-=N,L-=O):O<0?(F=oe,O=-O,L-=O):N<0&&(F=We,N=-N,_-=N);break;case We:if(U){if(V.x<=0&&(L<=Pe||ue>=Je)){$e=!1;break}fe(Y),O-=V.x,L+=V.x,N=O/U}else fe(ie),fe(Y),V.x<=0?L>Pe?(O-=V.x,L+=V.x):V.y>=0&&ue>=Je&&($e=!1):(O-=V.x,L+=V.x),V.y>=0?ue=0&&(he>=Ke||ue>=Je)){$e=!1;break}fe(K),O+=V.x,N=O/U}else fe(ie),fe(K),V.x>=0?he=0&&ue>=Je&&($e=!1):O+=V.x,V.y>=0?ue0?F=V.y>0?Ae:oe:V.x<0&&(L-=O,F=V.y>0?We:le),V.y<0&&(_-=N),this.cropped||(Ft(this.cropBox,k),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}$e&&(b.width=O,b.height=N,b.left=L,b.top=_,this.action=F,this.renderCropBox()),ye(S,function(Xe){Xe.startX=Xe.endX,Xe.startY=Xe.endY})}},Rv={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&Ie(this.dragBox,z),Ft(this.cropBox,k),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=we({},this.initialImageData),this.canvasData=we({},this.initialCanvasData),this.cropBoxData=we({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(we(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),Ft(this.dragBox,z),Ie(this.cropBox,k)),this},replace:function(h){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return!this.disabled&&h&&(this.isImg&&(this.element.src=h),m?(this.url=h,this.image.src=h,this.ready&&(this.viewBoxImage.src=h,ye(this.previews,function(p){p.getElementsByTagName("img")[0].src=h}))):(this.isImg&&(this.replaced=!0),this.options.data=null,this.uncreate(),this.load(h))),this},enable:function(){return this.ready&&this.disabled&&(this.disabled=!1,Ft(this.cropper,A)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,Ie(this.cropper,A)),this},destroy:function(){var h=this.element;return h[q]?(h[q]=void 0,this.isImg&&this.replaced&&(h.src=this.originalUrl),this.uncreate(),this):this},move:function(h){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h,p=this.canvasData,E=p.left,b=p.top;return this.moveTo(vi(h)?h:E+Number(h),vi(m)?m:b+Number(m))},moveTo:function(h){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h,p=this.canvasData,E=!1;return h=Number(h),m=Number(m),this.ready&&!this.disabled&&this.options.movable&&(re(h)&&(p.left=h,E=!0),re(m)&&(p.top=m,E=!0),E&&this.renderCanvas(!0)),this},zoom:function(h,m){var p=this.canvasData;return h=Number(h),h<0?h=1/(1-h):h=1+h,this.zoomTo(p.width*h/p.naturalWidth,null,m)},zoomTo:function(h,m,p){var E=this.options,b=this.canvasData,S=b.width,F=b.height,U=b.naturalWidth,L=b.naturalHeight;if(h=Number(h),h>=0&&this.ready&&!this.disabled&&E.zoomable){var _=U*h,O=L*h;if(Oi(this.element,tr,{ratio:h,oldRatio:S/U,originalEvent:p})===!1)return this;if(p){var N=this.pointers,he=nn(this.cropper),ue=N&&Object.keys(N).length?Qe(N):{pageX:p.pageX,pageY:p.pageY};b.left-=(_-S)*((ue.pageX-he.left-b.left)/S),b.top-=(O-F)*((ue.pageY-he.top-b.top)/F)}else rr(m)&&re(m.x)&&re(m.y)?(b.left-=(_-S)*((m.x-b.left)/S),b.top-=(O-F)*((m.y-b.top)/F)):(b.left-=(_-S)/2,b.top-=(O-F)/2);b.width=_,b.height=O,this.renderCanvas(!0)}return this},rotate:function(h){return this.rotateTo((this.imageData.rotate||0)+Number(h))},rotateTo:function(h){return h=Number(h),re(h)&&this.ready&&!this.disabled&&this.options.rotatable&&(this.imageData.rotate=h%360,this.renderCanvas(!0,!0)),this},scaleX:function(h){var m=this.imageData.scaleY;return this.scale(h,re(m)?m:1)},scaleY:function(h){var m=this.imageData.scaleX;return this.scale(re(m)?m:1,h)},scale:function(h){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h,p=this.imageData,E=!1;return h=Number(h),m=Number(m),this.ready&&!this.disabled&&this.options.scalable&&(re(h)&&(p.scaleX=h,E=!0),re(m)&&(p.scaleY=m,E=!0),E&&this.renderCanvas(!0,!0)),this},getData:function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,m=this.options,p=this.imageData,E=this.canvasData,b=this.cropBoxData,S;if(this.ready&&this.cropped){S={x:b.left-E.left,y:b.top-E.top,width:b.width,height:b.height};var F=p.width/p.naturalWidth;if(ye(S,function(_,O){S[O]=_/F}),h){var U=Math.round(S.y+S.height),L=Math.round(S.x+S.width);S.x=Math.round(S.x),S.y=Math.round(S.y),S.width=L-S.x,S.height=U-S.y}}else S={x:0,y:0,width:0,height:0};return m.rotatable&&(S.rotate=p.rotate||0),m.scalable&&(S.scaleX=p.scaleX||1,S.scaleY=p.scaleY||1),S},setData:function(h){var m=this.options,p=this.imageData,E=this.canvasData,b={};if(this.ready&&!this.disabled&&rr(h)){var S=!1;m.rotatable&&re(h.rotate)&&h.rotate!==p.rotate&&(p.rotate=h.rotate,S=!0),m.scalable&&(re(h.scaleX)&&h.scaleX!==p.scaleX&&(p.scaleX=h.scaleX,S=!0),re(h.scaleY)&&h.scaleY!==p.scaleY&&(p.scaleY=h.scaleY,S=!0)),S&&this.renderCanvas(!0,!0);var F=p.width/p.naturalWidth;re(h.x)&&(b.left=h.x*F+E.left),re(h.y)&&(b.top=h.y*F+E.top),re(h.width)&&(b.width=h.width*F),re(h.height)&&(b.height=h.height*F),this.setCropBoxData(b)}return this},getContainerData:function(){return this.ready?we({},this.containerData):{}},getImageData:function(){return this.sized?we({},this.imageData):{}},getCanvasData:function(){var h=this.canvasData,m={};return this.ready&&ye(["left","top","width","height","naturalWidth","naturalHeight"],function(p){m[p]=h[p]}),m},setCanvasData:function(h){var m=this.canvasData,p=m.aspectRatio;return this.ready&&!this.disabled&&rr(h)&&(re(h.left)&&(m.left=h.left),re(h.top)&&(m.top=h.top),re(h.width)?(m.width=h.width,m.height=h.width/p):re(h.height)&&(m.height=h.height,m.width=h.height*p),this.renderCanvas(!0)),this},getCropBoxData:function(){var h=this.cropBoxData,m;return this.ready&&this.cropped&&(m={left:h.left,top:h.top,width:h.width,height:h.height}),m||{}},setCropBoxData:function(h){var m=this.cropBoxData,p=this.options.aspectRatio,E,b;return this.ready&&this.cropped&&!this.disabled&&rr(h)&&(re(h.left)&&(m.left=h.left),re(h.top)&&(m.top=h.top),re(h.width)&&h.width!==m.width&&(E=!0,m.width=h.width),re(h.height)&&h.height!==m.height&&(b=!0,m.height=h.height),p&&(E?m.height=m.width/p:b&&(m.width=m.height*p)),this.renderCropBox()),this},getCroppedCanvas:function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.ready||!window.HTMLCanvasElement)return null;var m=this.canvasData,p=Ht(this.image,this.imageData,m,h);if(!this.cropped)return p;var E=this.getData(h.rounded),b=E.x,S=E.y,F=E.width,U=E.height,L=p.width/Math.floor(m.naturalWidth);L!==1&&(b*=L,S*=L,F*=L,U*=L);var _=F/U,O=Se({aspectRatio:_,width:h.maxWidth||1/0,height:h.maxHeight||1/0}),N=Se({aspectRatio:_,width:h.minWidth||0,height:h.minHeight||0},"cover"),he=Se({aspectRatio:_,width:h.width||(L!==1?p.width:F),height:h.height||(L!==1?p.height:U)}),ue=he.width,Pe=he.height;ue=Math.min(O.width,Math.max(N.width,ue)),Pe=Math.min(O.height,Math.max(N.height,Pe));var pe=document.createElement("canvas"),Ke=pe.getContext("2d");pe.width=Te(ue),pe.height=Te(Pe),Ke.fillStyle=h.fillColor||"transparent",Ke.fillRect(0,0,ue,Pe);var Je=h.imageSmoothingEnabled,$e=Je===void 0?!0:Je,Ri=h.imageSmoothingQuality;Ke.imageSmoothingEnabled=$e,Ri&&(Ke.imageSmoothingQuality=Ri);var _t=p.width,V=p.height,fe=b,Xe=S,$t,Li,wr,Sr,lr,yi;fe<=-F||fe>_t?(fe=0,$t=0,wr=0,lr=0):fe<=0?(wr=-fe,fe=0,$t=Math.min(_t,F+fe),lr=$t):fe<=_t&&(wr=0,$t=Math.min(F,_t-fe),lr=$t),$t<=0||Xe<=-U||Xe>V?(Xe=0,Li=0,Sr=0,yi=0):Xe<=0?(Sr=-Xe,Xe=0,Li=Math.min(V,U+Xe),yi=Li):Xe<=V&&(Sr=0,Li=Math.min(U,V-Xe),yi=Li);var At=[fe,Xe,$t,Li];if(lr>0&&yi>0){var Er=ue/F;At.push(wr*Er,Sr*Er,lr*Er,yi*Er)}return Ke.drawImage.apply(Ke,[p].concat(c(At.map(function(Uo){return Math.floor(Te(Uo))})))),pe},setAspectRatio:function(h){var m=this.options;return!this.disabled&&!vi(h)&&(m.aspectRatio=Math.max(0,h)||NaN,this.ready&&(this.initCropBox(),this.cropped&&this.renderCropBox())),this},setDragMode:function(h){var m=this.options,p=this.dragBox,E=this.face;if(this.ready&&!this.disabled){var b=h===se,S=m.movable&&h===ce;h=b||S?h:Me,m.dragMode=h,or(p,ee,h),_i(p,T,b),_i(p,J,S),m.cropBoxMovable||(or(E,ee,h),_i(E,T,b),_i(E,J,S))}return this}},Lv=C.Cropper,md=function(){function g(h){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(n(this,g),!h||!yr.test(h.tagName))throw new Error("The first argument is required and must be an or element.");this.element=h,this.options=we({},fs,rr(m)&&m),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(g,[{key:"init",value:function(){var m=this.element,p=m.tagName.toLowerCase(),E;if(!m[q]){if(m[q]=this,p==="img"){if(this.isImg=!0,E=m.getAttribute("src")||"",this.originalUrl=E,!E)return;E=m.src}else p==="canvas"&&window.HTMLCanvasElement&&(E=m.toDataURL());this.load(E)}}},{key:"load",value:function(m){var p=this;if(m){this.url=m,this.imageData={};var E=this.element,b=this.options;if(!b.rotatable&&!b.scalable&&(b.checkOrientation=!1),!b.checkOrientation||!window.ArrayBuffer){this.clone();return}if(Jt.test(m)){ei.test(m)?this.read(Bo(m)):this.clone();return}var S=new XMLHttpRequest,F=this.clone.bind(this);this.reloading=!0,this.xhr=S,S.onabort=F,S.onerror=F,S.ontimeout=F,S.onprogress=function(){S.getResponseHeader("content-type")!==Fi&&S.abort()},S.onload=function(){p.read(S.response)},S.onloadend=function(){p.reloading=!1,p.xhr=null},b.checkCrossOrigin&&Z(m)&&E.crossOrigin&&(m=w(m)),S.open("GET",m,!0),S.responseType="arraybuffer",S.withCredentials=E.crossOrigin==="use-credentials",S.send()}}},{key:"read",value:function(m){var p=this.options,E=this.imageData,b=Av(m),S=0,F=1,U=1;if(b>1){this.url=xv(m,Fi);var L=kv(b);S=L.rotate,F=L.scaleX,U=L.scaleY}p.rotatable&&(E.rotate=S),p.scalable&&(E.scaleX=F,E.scaleY=U),this.clone()}},{key:"clone",value:function(){var m=this.element,p=this.url,E=m.crossOrigin,b=p;this.options.checkCrossOrigin&&Z(p)&&(E||(E="anonymous"),b=w(p)),this.crossOrigin=E,this.crossOriginUrl=b;var S=document.createElement("img");E&&(S.crossOrigin=E),S.src=b||p,S.alt=m.alt||"The image to crop",this.image=S,S.onload=this.start.bind(this),S.onerror=this.stop.bind(this),Ie(S,$),m.parentNode.insertBefore(S,m.nextSibling)}},{key:"start",value:function(){var m=this,p=this.image;p.onload=null,p.onerror=null,this.sizing=!0;var E=C.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(C.navigator.userAgent),b=function(L,_){we(m.imageData,{naturalWidth:L,naturalHeight:_,aspectRatio:L/_}),m.initialImageData=we({},m.imageData),m.sizing=!1,m.sized=!0,m.build()};if(p.naturalWidth&&!E){b(p.naturalWidth,p.naturalHeight);return}var S=document.createElement("img"),F=document.body||document.documentElement;this.sizingImage=S,S.onload=function(){b(S.width,S.height),E||F.removeChild(S)},S.src=p.src,E||(S.style.cssText="left:0;max-height:none!important;max-width:none!important;min-height:0!important;min-width:0!important;opacity:0;position:absolute;top:0;z-index:-1;",F.appendChild(S))}},{key:"stop",value:function(){var m=this.image;m.onload=null,m.onerror=null,m.parentNode.removeChild(m),this.image=null}},{key:"build",value:function(){if(!(!this.sized||this.ready)){var m=this.element,p=this.options,E=this.image,b=m.parentNode,S=document.createElement("div");S.innerHTML=Lo;var F=S.querySelector(".".concat(q,"-container")),U=F.querySelector(".".concat(q,"-canvas")),L=F.querySelector(".".concat(q,"-drag-box")),_=F.querySelector(".".concat(q,"-crop-box")),O=_.querySelector(".".concat(q,"-face"));this.container=b,this.cropper=F,this.canvas=U,this.dragBox=L,this.cropBox=_,this.viewBox=F.querySelector(".".concat(q,"-view-box")),this.face=O,U.appendChild(E),Ie(m,k),b.insertBefore(F,m.nextSibling),Ft(E,$),this.initPreview(),this.bind(),p.initialAspectRatio=Math.max(0,p.initialAspectRatio)||NaN,p.aspectRatio=Math.max(0,p.aspectRatio)||NaN,p.viewMode=Math.max(0,Math.min(3,Math.round(p.viewMode)))||0,Ie(_,k),p.guides||Ie(_.getElementsByClassName("".concat(q,"-dashed")),k),p.center||Ie(_.getElementsByClassName("".concat(q,"-center")),k),p.background&&Ie(F,"".concat(q,"-bg")),p.highlight||Ie(O,j),p.cropBoxMovable&&(Ie(O,J),or(O,ee,M)),p.cropBoxResizable||(Ie(_.getElementsByClassName("".concat(q,"-line")),k),Ie(_.getElementsByClassName("".concat(q,"-point")),k)),this.render(),this.ready=!0,this.setDragMode(p.dragMode),p.autoCrop&&this.crop(),this.setData(p.data),Ge(p.ready)&&pt(m,Ci,p.ready,{once:!0}),Oi(m,Ci)}}},{key:"unbuild",value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var m=this.cropper.parentNode;m&&m.removeChild(this.cropper),Ft(this.element,k)}}},{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=Lv,g}},{key:"setDefaults",value:function(m){we(fs,rr(m)&&m)}}])}();return we(md.prototype,Pv,Cv,Fv,_v,Ov,Rv),md})});var Ml=class{constructor(e,t,r){this.eventTarget=e,this.eventName=t,this.eventOptions=r,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(e){this.unorderedBindings.add(e)}bindingDisconnected(e){this.unorderedBindings.delete(e)}handleEvent(e){let t=$v(e);for(let r of this.bindings){if(t.immediatePropagationStopped)break;r.handleEvent(t)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort((e,t)=>{let r=e.index,s=t.index;return rs?1:0})}};function $v(i){if("immediatePropagationStopped"in i)return i;{let{stopImmediatePropagation:e}=i;return Object.assign(i,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,e.call(this)}})}}var Il=class{constructor(e){this.application=e,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach(e=>e.connect()))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach(e=>e.disconnect()))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce((e,t)=>e.concat(Array.from(t.values())),[])}bindingConnected(e){this.fetchEventListenerForBinding(e).bindingConnected(e)}bindingDisconnected(e,t=!1){this.fetchEventListenerForBinding(e).bindingDisconnected(e),t&&this.clearEventListenersForBinding(e)}handleError(e,t,r={}){this.application.handleError(e,`Error ${t}`,r)}clearEventListenersForBinding(e){let t=this.fetchEventListenerForBinding(e);t.hasBindings()||(t.disconnect(),this.removeMappedEventListenerFor(e))}removeMappedEventListenerFor(e){let{eventTarget:t,eventName:r,eventOptions:s}=e,n=this.fetchEventListenerMapForEventTarget(t),o=this.cacheKey(r,s);n.delete(o),n.size==0&&this.eventListenerMaps.delete(t)}fetchEventListenerForBinding(e){let{eventTarget:t,eventName:r,eventOptions:s}=e;return this.fetchEventListener(t,r,s)}fetchEventListener(e,t,r){let s=this.fetchEventListenerMapForEventTarget(e),n=this.cacheKey(t,r),o=s.get(n);return o||(o=this.createEventListener(e,t,r),s.set(n,o)),o}createEventListener(e,t,r){let s=new Ml(e,t,r);return this.started&&s.connect(),s}fetchEventListenerMapForEventTarget(e){let t=this.eventListenerMaps.get(e);return t||(t=new Map,this.eventListenerMaps.set(e,t)),t}cacheKey(e,t){let r=[e];return Object.keys(t).sort().forEach(s=>{r.push(`${t[s]?"":"!"}${s}`)}),r.join(":")}},qv={stop({event:i,value:e}){return e&&i.stopPropagation(),!0},prevent({event:i,value:e}){return e&&i.preventDefault(),!0},self({event:i,value:e,element:t}){return e?t===i.target:!0}},Vv=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function jv(i){let t=i.trim().match(Vv)||[],r=t[2],s=t[3];return s&&!["keydown","keyup","keypress"].includes(r)&&(r+=`.${s}`,s=""),{eventTarget:Wv(t[4]),eventName:r,eventOptions:t[7]?Gv(t[7]):{},identifier:t[5],methodName:t[6],keyFilter:t[1]||s}}function Wv(i){if(i=="window")return window;if(i=="document")return document}function Gv(i){return i.split(":").reduce((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)}),{})}function Kv(i){if(i==window)return"window";if(i==document)return"document"}function rc(i){return i.replace(/(?:[_-])([a-z0-9])/g,(e,t)=>t.toUpperCase())}function Dl(i){return rc(i.replace(/--/g,"-").replace(/__/g,"_"))}function an(i){return i.charAt(0).toUpperCase()+i.slice(1)}function _d(i){return i.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`)}function Xv(i){return i.match(/[^\s]+/g)||[]}function Sd(i){return i!=null}function Nl(i,e){return Object.prototype.hasOwnProperty.call(i,e)}var Ed=["meta","ctrl","alt","shift"],Bl=class{constructor(e,t,r,s){this.element=e,this.index=t,this.eventTarget=r.eventTarget||e,this.eventName=r.eventName||Yv(e)||zo("missing event name"),this.eventOptions=r.eventOptions||{},this.identifier=r.identifier||zo("missing identifier"),this.methodName=r.methodName||zo("missing method name"),this.keyFilter=r.keyFilter||"",this.schema=s}static forToken(e,t){return new this(e.element,e.index,jv(e.content),t)}toString(){let e=this.keyFilter?`.${this.keyFilter}`:"",t=this.eventTargetName?`@${this.eventTargetName}`:"";return`${this.eventName}${e}${t}->${this.identifier}#${this.methodName}`}shouldIgnoreKeyboardEvent(e){if(!this.keyFilter)return!1;let t=this.keyFilter.split("+");if(this.keyFilterDissatisfied(e,t))return!0;let r=t.filter(s=>!Ed.includes(s))[0];return r?(Nl(this.keyMappings,r)||zo(`contains unknown key filter: ${this.keyFilter}`),this.keyMappings[r].toLowerCase()!==e.key.toLowerCase()):!1}shouldIgnoreMouseEvent(e){if(!this.keyFilter)return!1;let t=[this.keyFilter];return!!this.keyFilterDissatisfied(e,t)}get params(){let e={},t=new RegExp(`^data-${this.identifier}-(.+)-param$`,"i");for(let{name:r,value:s}of Array.from(this.element.attributes)){let n=r.match(t),o=n&&n[1];o&&(e[rc(o)]=Zv(s))}return e}get eventTargetName(){return Kv(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(e,t){let[r,s,n,o]=Ed.map(a=>t.includes(a));return e.metaKey!==r||e.ctrlKey!==s||e.altKey!==n||e.shiftKey!==o}},Td={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:i=>i.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function Yv(i){let e=i.tagName.toLowerCase();if(e in Td)return Td[e](i)}function zo(i){throw new Error(i)}function Zv(i){try{return JSON.parse(i)}catch{return i}}var Ul=class{constructor(e,t){this.context=e,this.action=t}get index(){return this.action.index}get eventTarget(){return this.action.eventTarget}get eventOptions(){return this.action.eventOptions}get identifier(){return this.context.identifier}handleEvent(e){let t=this.prepareActionEvent(e);this.willBeInvokedByEvent(e)&&this.applyEventModifiers(t)&&this.invokeWithEvent(t)}get eventName(){return this.action.eventName}get method(){let e=this.controller[this.methodName];if(typeof e=="function")return e;throw new Error(`Action "${this.action}" references undefined method "${this.methodName}"`)}applyEventModifiers(e){let{element:t}=this.action,{actionDescriptorFilters:r}=this.context.application,{controller:s}=this.context,n=!0;for(let[o,a]of Object.entries(this.eventOptions))if(o in r){let l=r[o];n=n&&l({name:o,value:a,event:e,element:t,controller:s})}else continue;return n}prepareActionEvent(e){return Object.assign(e,{params:this.action.params})}invokeWithEvent(e){let{target:t,currentTarget:r}=e;try{this.method.call(this.controller,e),this.context.logDebugActivity(this.methodName,{event:e,target:t,currentTarget:r,action:this.methodName})}catch(s){let{identifier:n,controller:o,element:a,index:l}=this,c={identifier:n,controller:o,element:a,index:l,event:e};this.context.handleError(s,`invoking action "${this.action}"`,c)}}willBeInvokedByEvent(e){let t=e.target;return e instanceof KeyboardEvent&&this.action.shouldIgnoreKeyboardEvent(e)||e instanceof MouseEvent&&this.action.shouldIgnoreMouseEvent(e)?!1:this.element===t?!0:t instanceof Element&&this.element.contains(t)?this.scope.containsElement(t):this.scope.containsElement(this.action.element)}get controller(){return this.context.controller}get methodName(){return this.action.methodName}get element(){return this.scope.element}get scope(){return this.context.scope}},Ho=class{constructor(e,t){this.mutationObserverInit={attributes:!0,childList:!0,subtree:!0},this.element=e,this.started=!1,this.delegate=t,this.elements=new Set,this.mutationObserver=new MutationObserver(r=>this.processMutations(r))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,this.mutationObserverInit),this.refresh())}pause(e){this.started&&(this.mutationObserver.disconnect(),this.started=!1),e(),this.started||(this.mutationObserver.observe(this.element,this.mutationObserverInit),this.started=!0)}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started){let e=new Set(this.matchElementsInTree());for(let t of Array.from(this.elements))e.has(t)||this.removeElement(t);for(let t of Array.from(e))this.addElement(t)}}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){e.type=="attributes"?this.processAttributeChange(e.target,e.attributeName):e.type=="childList"&&(this.processRemovedNodes(e.removedNodes),this.processAddedNodes(e.addedNodes))}processAttributeChange(e,t){this.elements.has(e)?this.delegate.elementAttributeChanged&&this.matchElement(e)?this.delegate.elementAttributeChanged(e,t):this.removeElement(e):this.matchElement(e)&&this.addElement(e)}processRemovedNodes(e){for(let t of Array.from(e)){let r=this.elementFromNode(t);r&&this.processTree(r,this.removeElement)}}processAddedNodes(e){for(let t of Array.from(e)){let r=this.elementFromNode(t);r&&this.elementIsActive(r)&&this.processTree(r,this.addElement)}}matchElement(e){return this.delegate.matchElement(e)}matchElementsInTree(e=this.element){return this.delegate.matchElementsInTree(e)}processTree(e,t){for(let r of this.matchElementsInTree(e))t.call(this,r)}elementFromNode(e){if(e.nodeType==Node.ELEMENT_NODE)return e}elementIsActive(e){return e.isConnected!=this.element.isConnected?!1:this.element.contains(e)}addElement(e){this.elements.has(e)||this.elementIsActive(e)&&(this.elements.add(e),this.delegate.elementMatched&&this.delegate.elementMatched(e))}removeElement(e){this.elements.has(e)&&(this.elements.delete(e),this.delegate.elementUnmatched&&this.delegate.elementUnmatched(e))}},$o=class{constructor(e,t,r){this.attributeName=t,this.delegate=r,this.elementObserver=new Ho(e,this)}get element(){return this.elementObserver.element}get selector(){return`[${this.attributeName}]`}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get started(){return this.elementObserver.started}matchElement(e){return e.hasAttribute(this.attributeName)}matchElementsInTree(e){let t=this.matchElement(e)?[e]:[],r=Array.from(e.querySelectorAll(this.selector));return t.concat(r)}elementMatched(e){this.delegate.elementMatchedAttribute&&this.delegate.elementMatchedAttribute(e,this.attributeName)}elementUnmatched(e){this.delegate.elementUnmatchedAttribute&&this.delegate.elementUnmatchedAttribute(e,this.attributeName)}elementAttributeChanged(e,t){this.delegate.elementAttributeValueChanged&&this.attributeName==t&&this.delegate.elementAttributeValueChanged(e,t)}};function Qv(i,e,t){Od(i,e).add(t)}function Jv(i,e,t){Od(i,e).delete(t),eb(i,e)}function Od(i,e){let t=i.get(e);return t||(t=new Set,i.set(e,t)),t}function eb(i,e){let t=i.get(e);t!=null&&t.size==0&&i.delete(e)}var Mi=class{constructor(){this.valuesByKey=new Map}get keys(){return Array.from(this.valuesByKey.keys())}get values(){return Array.from(this.valuesByKey.values()).reduce((t,r)=>t.concat(Array.from(r)),[])}get size(){return Array.from(this.valuesByKey.values()).reduce((t,r)=>t+r.size,0)}add(e,t){Qv(this.valuesByKey,e,t)}delete(e,t){Jv(this.valuesByKey,e,t)}has(e,t){let r=this.valuesByKey.get(e);return r!=null&&r.has(t)}hasKey(e){return this.valuesByKey.has(e)}hasValue(e){return Array.from(this.valuesByKey.values()).some(r=>r.has(e))}getValuesForKey(e){let t=this.valuesByKey.get(e);return t?Array.from(t):[]}getKeysForValue(e){return Array.from(this.valuesByKey).filter(([t,r])=>r.has(e)).map(([t,r])=>t)}};var zl=class{constructor(e,t,r,s){this._selector=t,this.details=s,this.elementObserver=new Ho(e,this),this.delegate=r,this.matchesByElement=new Mi}get started(){return this.elementObserver.started}get selector(){return this._selector}set selector(e){this._selector=e,this.refresh()}start(){this.elementObserver.start()}pause(e){this.elementObserver.pause(e)}stop(){this.elementObserver.stop()}refresh(){this.elementObserver.refresh()}get element(){return this.elementObserver.element}matchElement(e){let{selector:t}=this;if(t){let r=e.matches(t);return this.delegate.selectorMatchElement?r&&this.delegate.selectorMatchElement(e,this.details):r}else return!1}matchElementsInTree(e){let{selector:t}=this;if(t){let r=this.matchElement(e)?[e]:[],s=Array.from(e.querySelectorAll(t)).filter(n=>this.matchElement(n));return r.concat(s)}else return[]}elementMatched(e){let{selector:t}=this;t&&this.selectorMatched(e,t)}elementUnmatched(e){let t=this.matchesByElement.getKeysForValue(e);for(let r of t)this.selectorUnmatched(e,r)}elementAttributeChanged(e,t){let{selector:r}=this;if(r){let s=this.matchElement(e),n=this.matchesByElement.has(r,e);s&&!n?this.selectorMatched(e,r):!s&&n&&this.selectorUnmatched(e,r)}}selectorMatched(e,t){this.delegate.selectorMatched(e,t,this.details),this.matchesByElement.add(t,e)}selectorUnmatched(e,t){this.delegate.selectorUnmatched(e,t,this.details),this.matchesByElement.delete(t,e)}},Hl=class{constructor(e,t){this.element=e,this.delegate=t,this.started=!1,this.stringMap=new Map,this.mutationObserver=new MutationObserver(r=>this.processMutations(r))}start(){this.started||(this.started=!0,this.mutationObserver.observe(this.element,{attributes:!0,attributeOldValue:!0}),this.refresh())}stop(){this.started&&(this.mutationObserver.takeRecords(),this.mutationObserver.disconnect(),this.started=!1)}refresh(){if(this.started)for(let e of this.knownAttributeNames)this.refreshAttribute(e,null)}processMutations(e){if(this.started)for(let t of e)this.processMutation(t)}processMutation(e){let t=e.attributeName;t&&this.refreshAttribute(t,e.oldValue)}refreshAttribute(e,t){let r=this.delegate.getStringMapKeyForAttribute(e);if(r!=null){this.stringMap.has(e)||this.stringMapKeyAdded(r,e);let s=this.element.getAttribute(e);if(this.stringMap.get(e)!=s&&this.stringMapValueChanged(s,r,t),s==null){let n=this.stringMap.get(e);this.stringMap.delete(e),n&&this.stringMapKeyRemoved(r,e,n)}else this.stringMap.set(e,s)}}stringMapKeyAdded(e,t){this.delegate.stringMapKeyAdded&&this.delegate.stringMapKeyAdded(e,t)}stringMapValueChanged(e,t,r){this.delegate.stringMapValueChanged&&this.delegate.stringMapValueChanged(e,t,r)}stringMapKeyRemoved(e,t,r){this.delegate.stringMapKeyRemoved&&this.delegate.stringMapKeyRemoved(e,t,r)}get knownAttributeNames(){return Array.from(new Set(this.currentAttributeNames.concat(this.recordedAttributeNames)))}get currentAttributeNames(){return Array.from(this.element.attributes).map(e=>e.name)}get recordedAttributeNames(){return Array.from(this.stringMap.keys())}},qo=class{constructor(e,t,r){this.attributeObserver=new $o(e,t,this),this.delegate=r,this.tokensByElement=new Mi}get started(){return this.attributeObserver.started}start(){this.attributeObserver.start()}pause(e){this.attributeObserver.pause(e)}stop(){this.attributeObserver.stop()}refresh(){this.attributeObserver.refresh()}get element(){return this.attributeObserver.element}get attributeName(){return this.attributeObserver.attributeName}elementMatchedAttribute(e){this.tokensMatched(this.readTokensForElement(e))}elementAttributeValueChanged(e){let[t,r]=this.refreshTokensForElement(e);this.tokensUnmatched(t),this.tokensMatched(r)}elementUnmatchedAttribute(e){this.tokensUnmatched(this.tokensByElement.getValuesForKey(e))}tokensMatched(e){e.forEach(t=>this.tokenMatched(t))}tokensUnmatched(e){e.forEach(t=>this.tokenUnmatched(t))}tokenMatched(e){this.delegate.tokenMatched(e),this.tokensByElement.add(e.element,e)}tokenUnmatched(e){this.delegate.tokenUnmatched(e),this.tokensByElement.delete(e.element,e)}refreshTokensForElement(e){let t=this.tokensByElement.getValuesForKey(e),r=this.readTokensForElement(e),s=ib(t,r).findIndex(([n,o])=>!rb(n,o));return s==-1?[[],[]]:[t.slice(s),r.slice(s)]}readTokensForElement(e){let t=this.attributeName,r=e.getAttribute(t)||"";return tb(r,e,t)}};function tb(i,e,t){return i.trim().split(/\s+/).filter(r=>r.length).map((r,s)=>({element:e,attributeName:t,content:r,index:s}))}function ib(i,e){let t=Math.max(i.length,e.length);return Array.from({length:t},(r,s)=>[i[s],e[s]])}function rb(i,e){return i&&e&&i.index==e.index&&i.content==e.content}var Vo=class{constructor(e,t,r){this.tokenListObserver=new qo(e,t,this),this.delegate=r,this.parseResultsByToken=new WeakMap,this.valuesByTokenByElement=new WeakMap}get started(){return this.tokenListObserver.started}start(){this.tokenListObserver.start()}stop(){this.tokenListObserver.stop()}refresh(){this.tokenListObserver.refresh()}get element(){return this.tokenListObserver.element}get attributeName(){return this.tokenListObserver.attributeName}tokenMatched(e){let{element:t}=e,{value:r}=this.fetchParseResultForToken(e);r&&(this.fetchValuesByTokenForElement(t).set(e,r),this.delegate.elementMatchedValue(t,r))}tokenUnmatched(e){let{element:t}=e,{value:r}=this.fetchParseResultForToken(e);r&&(this.fetchValuesByTokenForElement(t).delete(e),this.delegate.elementUnmatchedValue(t,r))}fetchParseResultForToken(e){let t=this.parseResultsByToken.get(e);return t||(t=this.parseToken(e),this.parseResultsByToken.set(e,t)),t}fetchValuesByTokenForElement(e){let t=this.valuesByTokenByElement.get(e);return t||(t=new Map,this.valuesByTokenByElement.set(e,t)),t}parseToken(e){try{return{value:this.delegate.parseValueForToken(e)}}catch(t){return{error:t}}}},$l=class{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new Vo(this.element,this.actionAttribute,this),this.valueListObserver.start())}stop(){this.valueListObserver&&(this.valueListObserver.stop(),delete this.valueListObserver,this.disconnectAllActions())}get element(){return this.context.element}get identifier(){return this.context.identifier}get actionAttribute(){return this.schema.actionAttribute}get schema(){return this.context.schema}get bindings(){return Array.from(this.bindingsByAction.values())}connectAction(e){let t=new Ul(this.context,e);this.bindingsByAction.set(e,t),this.delegate.bindingConnected(t)}disconnectAction(e){let t=this.bindingsByAction.get(e);t&&(this.bindingsByAction.delete(e),this.delegate.bindingDisconnected(t))}disconnectAllActions(){this.bindings.forEach(e=>this.delegate.bindingDisconnected(e,!0)),this.bindingsByAction.clear()}parseValueForToken(e){let t=Bl.forToken(e,this.schema);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}},ql=class{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new Hl(this.element,this),this.valueDescriptorMap=this.controller.valueDescriptorMap}start(){this.stringMapObserver.start(),this.invokeChangedCallbacksForDefaultValues()}stop(){this.stringMapObserver.stop()}get element(){return this.context.element}get controller(){return this.context.controller}getStringMapKeyForAttribute(e){if(e in this.valueDescriptorMap)return this.valueDescriptorMap[e].name}stringMapKeyAdded(e,t){let r=this.valueDescriptorMap[t];this.hasValue(e)||this.invokeChangedCallback(e,r.writer(this.receiver[e]),r.writer(r.defaultValue))}stringMapValueChanged(e,t,r){let s=this.valueDescriptorNameMap[t];e!==null&&(r===null&&(r=s.writer(s.defaultValue)),this.invokeChangedCallback(t,e,r))}stringMapKeyRemoved(e,t,r){let s=this.valueDescriptorNameMap[e];this.hasValue(e)?this.invokeChangedCallback(e,s.writer(this.receiver[e]),r):this.invokeChangedCallback(e,s.writer(s.defaultValue),r)}invokeChangedCallbacksForDefaultValues(){for(let{key:e,name:t,defaultValue:r,writer:s}of this.valueDescriptors)r!=null&&!this.controller.data.has(e)&&this.invokeChangedCallback(t,s(r),void 0)}invokeChangedCallback(e,t,r){let s=`${e}Changed`,n=this.receiver[s];if(typeof n=="function"){let o=this.valueDescriptorNameMap[e];try{let a=o.reader(t),l=r;r&&(l=o.reader(r)),n.call(this.receiver,a,l)}catch(a){throw a instanceof TypeError&&(a.message=`Stimulus Value "${this.context.identifier}.${o.name}" - ${a.message}`),a}}}get valueDescriptors(){let{valueDescriptorMap:e}=this;return Object.keys(e).map(t=>e[t])}get valueDescriptorNameMap(){let e={};return Object.keys(this.valueDescriptorMap).forEach(t=>{let r=this.valueDescriptorMap[t];e[r.name]=r}),e}hasValue(e){let t=this.valueDescriptorNameMap[e],r=`has${an(t.name)}`;return this.receiver[r]}},Vl=class{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new Mi}start(){this.tokenListObserver||(this.tokenListObserver=new qo(this.element,this.attributeName,this),this.tokenListObserver.start())}stop(){this.tokenListObserver&&(this.disconnectAllTargets(),this.tokenListObserver.stop(),delete this.tokenListObserver)}tokenMatched({element:e,content:t}){this.scope.containsElement(e)&&this.connectTarget(e,t)}tokenUnmatched({element:e,content:t}){this.disconnectTarget(e,t)}connectTarget(e,t){var r;this.targetsByName.has(t,e)||(this.targetsByName.add(t,e),(r=this.tokenListObserver)===null||r===void 0||r.pause(()=>this.delegate.targetConnected(e,t)))}disconnectTarget(e,t){var r;this.targetsByName.has(t,e)&&(this.targetsByName.delete(t,e),(r=this.tokenListObserver)===null||r===void 0||r.pause(()=>this.delegate.targetDisconnected(e,t)))}disconnectAllTargets(){for(let e of this.targetsByName.keys)for(let t of this.targetsByName.getValuesForKey(e))this.disconnectTarget(t,e)}get attributeName(){return`data-${this.context.identifier}-target`}get element(){return this.context.element}get scope(){return this.context.scope}};function ln(i,e){let t=Rd(i);return Array.from(t.reduce((r,s)=>(nb(s,e).forEach(n=>r.add(n)),r),new Set))}function sb(i,e){return Rd(i).reduce((r,s)=>(r.push(...ob(s,e)),r),[])}function Rd(i){let e=[];for(;i;)e.push(i),i=Object.getPrototypeOf(i);return e.reverse()}function nb(i,e){let t=i[e];return Array.isArray(t)?t:[]}function ob(i,e){let t=i[e];return t?Object.keys(t).map(r=>[r,t[r]]):[]}var jl=class{constructor(e,t){this.started=!1,this.context=e,this.delegate=t,this.outletsByName=new Mi,this.outletElementsByName=new Mi,this.selectorObserverMap=new Map,this.attributeObserverMap=new Map}start(){this.started||(this.outletDefinitions.forEach(e=>{this.setupSelectorObserverForOutlet(e),this.setupAttributeObserverForOutlet(e)}),this.started=!0,this.dependentContexts.forEach(e=>e.refresh()))}refresh(){this.selectorObserverMap.forEach(e=>e.refresh()),this.attributeObserverMap.forEach(e=>e.refresh())}stop(){this.started&&(this.started=!1,this.disconnectAllOutlets(),this.stopSelectorObservers(),this.stopAttributeObservers())}stopSelectorObservers(){this.selectorObserverMap.size>0&&(this.selectorObserverMap.forEach(e=>e.stop()),this.selectorObserverMap.clear())}stopAttributeObservers(){this.attributeObserverMap.size>0&&(this.attributeObserverMap.forEach(e=>e.stop()),this.attributeObserverMap.clear())}selectorMatched(e,t,{outletName:r}){let s=this.getOutlet(e,r);s&&this.connectOutlet(s,e,r)}selectorUnmatched(e,t,{outletName:r}){let s=this.getOutletFromMap(e,r);s&&this.disconnectOutlet(s,e,r)}selectorMatchElement(e,{outletName:t}){let r=this.selector(t),s=this.hasOutlet(e,t),n=e.matches(`[${this.schema.controllerAttribute}~=${t}]`);return r?s&&n&&e.matches(r):!1}elementMatchedAttribute(e,t){let r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}elementAttributeValueChanged(e,t){let r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}elementUnmatchedAttribute(e,t){let r=this.getOutletNameFromOutletAttributeName(t);r&&this.updateSelectorObserverForOutlet(r)}connectOutlet(e,t,r){var s;this.outletElementsByName.has(r,t)||(this.outletsByName.add(r,e),this.outletElementsByName.add(r,t),(s=this.selectorObserverMap.get(r))===null||s===void 0||s.pause(()=>this.delegate.outletConnected(e,t,r)))}disconnectOutlet(e,t,r){var s;this.outletElementsByName.has(r,t)&&(this.outletsByName.delete(r,e),this.outletElementsByName.delete(r,t),(s=this.selectorObserverMap.get(r))===null||s===void 0||s.pause(()=>this.delegate.outletDisconnected(e,t,r)))}disconnectAllOutlets(){for(let e of this.outletElementsByName.keys)for(let t of this.outletElementsByName.getValuesForKey(e))for(let r of this.outletsByName.getValuesForKey(e))this.disconnectOutlet(r,t,e)}updateSelectorObserverForOutlet(e){let t=this.selectorObserverMap.get(e);t&&(t.selector=this.selector(e))}setupSelectorObserverForOutlet(e){let t=this.selector(e),r=new zl(document.body,t,this,{outletName:e});this.selectorObserverMap.set(e,r),r.start()}setupAttributeObserverForOutlet(e){let t=this.attributeNameForOutletName(e),r=new $o(this.scope.element,t,this);this.attributeObserverMap.set(e,r),r.start()}selector(e){return this.scope.outlets.getSelectorForOutletName(e)}attributeNameForOutletName(e){return this.scope.schema.outletAttributeForScope(this.identifier,e)}getOutletNameFromOutletAttributeName(e){return this.outletDefinitions.find(t=>this.attributeNameForOutletName(t)===e)}get outletDependencies(){let e=new Mi;return this.router.modules.forEach(t=>{let r=t.definition.controllerConstructor;ln(r,"outlets").forEach(n=>e.add(n,t.identifier))}),e}get outletDefinitions(){return this.outletDependencies.getKeysForValue(this.identifier)}get dependentControllerIdentifiers(){return this.outletDependencies.getValuesForKey(this.identifier)}get dependentContexts(){let e=this.dependentControllerIdentifiers;return this.router.contexts.filter(t=>e.includes(t.identifier))}hasOutlet(e,t){return!!this.getOutlet(e,t)||!!this.getOutletFromMap(e,t)}getOutlet(e,t){return this.application.getControllerForElementAndIdentifier(e,t)}getOutletFromMap(e,t){return this.outletsByName.getValuesForKey(t).find(r=>r.element===e)}get scope(){return this.context.scope}get schema(){return this.context.schema}get identifier(){return this.context.identifier}get application(){return this.context.application}get router(){return this.application.router}},Wl=class{constructor(e,t){this.logDebugActivity=(r,s={})=>{let{identifier:n,controller:o,element:a}=this;s=Object.assign({identifier:n,controller:o,element:a},s),this.application.logDebugActivity(this.identifier,r,s)},this.module=e,this.scope=t,this.controller=new e.controllerConstructor(this),this.bindingObserver=new $l(this,this.dispatcher),this.valueObserver=new ql(this,this.controller),this.targetObserver=new Vl(this,this),this.outletObserver=new jl(this,this);try{this.controller.initialize(),this.logDebugActivity("initialize")}catch(r){this.handleError(r,"initializing controller")}}connect(){this.bindingObserver.start(),this.valueObserver.start(),this.targetObserver.start(),this.outletObserver.start();try{this.controller.connect(),this.logDebugActivity("connect")}catch(e){this.handleError(e,"connecting controller")}}refresh(){this.outletObserver.refresh()}disconnect(){try{this.controller.disconnect(),this.logDebugActivity("disconnect")}catch(e){this.handleError(e,"disconnecting controller")}this.outletObserver.stop(),this.targetObserver.stop(),this.valueObserver.stop(),this.bindingObserver.stop()}get application(){return this.module.application}get identifier(){return this.module.identifier}get schema(){return this.application.schema}get dispatcher(){return this.application.dispatcher}get element(){return this.scope.element}get parentElement(){return this.element.parentElement}handleError(e,t,r={}){let{identifier:s,controller:n,element:o}=this;r=Object.assign({identifier:s,controller:n,element:o},r),this.application.handleError(e,`Error ${t}`,r)}targetConnected(e,t){this.invokeControllerMethod(`${t}TargetConnected`,e)}targetDisconnected(e,t){this.invokeControllerMethod(`${t}TargetDisconnected`,e)}outletConnected(e,t,r){this.invokeControllerMethod(`${Dl(r)}OutletConnected`,e,t)}outletDisconnected(e,t,r){this.invokeControllerMethod(`${Dl(r)}OutletDisconnected`,e,t)}invokeControllerMethod(e,...t){let r=this.controller;typeof r[e]=="function"&&r[e](...t)}};function ab(i){return lb(i,cb(i))}function lb(i,e){let t=pb(i),r=ub(i.prototype,e);return Object.defineProperties(t.prototype,r),t}function cb(i){return ln(i,"blessings").reduce((t,r)=>{let s=r(i);for(let n in s){let o=t[n]||{};t[n]=Object.assign(o,s[n])}return t},{})}function ub(i,e){return db(e).reduce((t,r)=>{let s=hb(i,e,r);return s&&Object.assign(t,{[r]:s}),t},{})}function hb(i,e,t){let r=Object.getOwnPropertyDescriptor(i,t);if(!(r&&"value"in r)){let n=Object.getOwnPropertyDescriptor(e,t).value;return r&&(n.get=r.get||n.get,n.set=r.set||n.set),n}}var db=typeof Object.getOwnPropertySymbols=="function"?i=>[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)]:Object.getOwnPropertyNames,pb=(()=>{function i(t){function r(){return Reflect.construct(t,arguments,new.target)}return r.prototype=Object.create(t.prototype,{constructor:{value:r}}),Reflect.setPrototypeOf(r,t),r}function e(){let r=i(function(){this.a.call(this)});return r.prototype.a=function(){},new r}try{return e(),i}catch{return r=>class extends r{}}})();function fb(i){return{identifier:i.identifier,controllerConstructor:ab(i.controllerConstructor)}}var Gl=class{constructor(e,t){this.application=e,this.definition=fb(t),this.contextsByScope=new WeakMap,this.connectedContexts=new Set}get identifier(){return this.definition.identifier}get controllerConstructor(){return this.definition.controllerConstructor}get contexts(){return Array.from(this.connectedContexts)}connectContextForScope(e){let t=this.fetchContextForScope(e);this.connectedContexts.add(t),t.connect()}disconnectContextForScope(e){let t=this.contextsByScope.get(e);t&&(this.connectedContexts.delete(t),t.disconnect())}fetchContextForScope(e){let t=this.contextsByScope.get(e);return t||(t=new Wl(this,e),this.contextsByScope.set(e,t)),t}},Kl=class{constructor(e){this.scope=e}has(e){return this.data.has(this.getDataKey(e))}get(e){return this.getAll(e)[0]}getAll(e){let t=this.data.get(this.getDataKey(e))||"";return Xv(t)}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}},Xl=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get(e){let t=this.getAttributeNameForKey(e);return this.element.getAttribute(t)}set(e,t){let r=this.getAttributeNameForKey(e);return this.element.setAttribute(r,t),this.get(e)}has(e){let t=this.getAttributeNameForKey(e);return this.element.hasAttribute(t)}delete(e){if(this.has(e)){let t=this.getAttributeNameForKey(e);return this.element.removeAttribute(t),!0}else return!1}getAttributeNameForKey(e){return`data-${this.identifier}-${_d(e)}`}},Yl=class{constructor(e){this.warnedKeysByObject=new WeakMap,this.logger=e}warn(e,t,r){let s=this.warnedKeysByObject.get(e);s||(s=new Set,this.warnedKeysByObject.set(e,s)),s.has(t)||(s.add(t),this.logger.warn(r,e))}};function Zl(i,e){return`[${i}~="${e}"]`}var Ql=class{constructor(e){this.scope=e}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,r)=>t||this.findTarget(r)||this.findLegacyTarget(r),void 0)}findAll(...e){return e.reduce((t,r)=>[...t,...this.findAllTargets(r),...this.findAllLegacyTargets(r)],[])}findTarget(e){let t=this.getSelectorForTargetName(e);return this.scope.findElement(t)}findAllTargets(e){let t=this.getSelectorForTargetName(e);return this.scope.findAllElements(t)}getSelectorForTargetName(e){let t=this.schema.targetAttributeForScope(this.identifier);return Zl(t,e)}findLegacyTarget(e){let t=this.getLegacySelectorForTargetName(e);return this.deprecate(this.scope.findElement(t),e)}findAllLegacyTargets(e){let t=this.getLegacySelectorForTargetName(e);return this.scope.findAllElements(t).map(r=>this.deprecate(r,e))}getLegacySelectorForTargetName(e){let t=`${this.identifier}.${e}`;return Zl(this.schema.targetAttribute,t)}deprecate(e,t){if(e){let{identifier:r}=this,s=this.schema.targetAttribute,n=this.schema.targetAttributeForScope(r);this.guide.warn(e,`target:${t}`,`Please replace ${s}="${r}.${t}" with ${n}="${t}". The ${s} attribute is deprecated and will be removed in a future version of Stimulus.`)}return e}get guide(){return this.scope.guide}},Jl=class{constructor(e,t){this.scope=e,this.controllerElement=t}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get schema(){return this.scope.schema}has(e){return this.find(e)!=null}find(...e){return e.reduce((t,r)=>t||this.findOutlet(r),void 0)}findAll(...e){return e.reduce((t,r)=>[...t,...this.findAllOutlets(r)],[])}getSelectorForOutletName(e){let t=this.schema.outletAttributeForScope(this.identifier,e);return this.controllerElement.getAttribute(t)}findOutlet(e){let t=this.getSelectorForOutletName(e);if(t)return this.findElement(t,e)}findAllOutlets(e){let t=this.getSelectorForOutletName(e);return t?this.findAllElements(t,e):[]}findElement(e,t){return this.scope.queryElements(e).filter(s=>this.matchesElement(s,e,t))[0]}findAllElements(e,t){return this.scope.queryElements(e).filter(s=>this.matchesElement(s,e,t))}matchesElement(e,t,r){let s=e.getAttribute(this.scope.schema.controllerAttribute)||"";return e.matches(t)&&s.split(" ").includes(r)}},ec=class i{constructor(e,t,r,s){this.targets=new Ql(this),this.classes=new Kl(this),this.data=new Xl(this),this.containsElement=n=>n.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=r,this.guide=new Yl(s),this.outlets=new Jl(this.documentScope,t)}findElement(e){return this.element.matches(e)?this.element:this.queryElements(e).find(this.containsElement)}findAllElements(e){return[...this.element.matches(e)?[this.element]:[],...this.queryElements(e).filter(this.containsElement)]}queryElements(e){return Array.from(this.element.querySelectorAll(e))}get controllerSelector(){return Zl(this.schema.controllerAttribute,this.identifier)}get isDocumentScope(){return this.element===document.documentElement}get documentScope(){return this.isDocumentScope?this:new i(this.schema,document.documentElement,this.identifier,this.guide.logger)}},tc=class{constructor(e,t,r){this.element=e,this.schema=t,this.delegate=r,this.valueListObserver=new Vo(this.element,this.controllerAttribute,this),this.scopesByIdentifierByElement=new WeakMap,this.scopeReferenceCounts=new WeakMap}start(){this.valueListObserver.start()}stop(){this.valueListObserver.stop()}get controllerAttribute(){return this.schema.controllerAttribute}parseValueForToken(e){let{element:t,content:r}=e;return this.parseValueForElementAndIdentifier(t,r)}parseValueForElementAndIdentifier(e,t){let r=this.fetchScopesByIdentifierForElement(e),s=r.get(t);return s||(s=this.delegate.createScopeForElementAndIdentifier(e,t),r.set(t,s)),s}elementMatchedValue(e,t){let r=(this.scopeReferenceCounts.get(t)||0)+1;this.scopeReferenceCounts.set(t,r),r==1&&this.delegate.scopeConnected(t)}elementUnmatchedValue(e,t){let r=this.scopeReferenceCounts.get(t);r&&(this.scopeReferenceCounts.set(t,r-1),r==1&&this.delegate.scopeDisconnected(t))}fetchScopesByIdentifierForElement(e){let t=this.scopesByIdentifierByElement.get(e);return t||(t=new Map,this.scopesByIdentifierByElement.set(e,t)),t}},ic=class{constructor(e){this.application=e,this.scopeObserver=new tc(this.element,this.schema,this),this.scopesByIdentifier=new Mi,this.modulesByIdentifier=new Map}get element(){return this.application.element}get schema(){return this.application.schema}get logger(){return this.application.logger}get controllerAttribute(){return this.schema.controllerAttribute}get modules(){return Array.from(this.modulesByIdentifier.values())}get contexts(){return this.modules.reduce((e,t)=>e.concat(t.contexts),[])}start(){this.scopeObserver.start()}stop(){this.scopeObserver.stop()}loadDefinition(e){this.unloadIdentifier(e.identifier);let t=new Gl(this.application,e);this.connectModule(t);let r=e.controllerConstructor.afterLoad;r&&r.call(e.controllerConstructor,e.identifier,this.application)}unloadIdentifier(e){let t=this.modulesByIdentifier.get(e);t&&this.disconnectModule(t)}getContextForElementAndIdentifier(e,t){let r=this.modulesByIdentifier.get(t);if(r)return r.contexts.find(s=>s.element==e)}proposeToConnectScopeForElementAndIdentifier(e,t){let r=this.scopeObserver.parseValueForElementAndIdentifier(e,t);r?this.scopeObserver.elementMatchedValue(r.element,r):console.error(`Couldn't find or create scope for identifier: "${t}" and element:`,e)}handleError(e,t,r){this.application.handleError(e,t,r)}createScopeForElementAndIdentifier(e,t){return new ec(this.schema,e,t,this.logger)}scopeConnected(e){this.scopesByIdentifier.add(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.connectContextForScope(e)}scopeDisconnected(e){this.scopesByIdentifier.delete(e.identifier,e);let t=this.modulesByIdentifier.get(e.identifier);t&&t.disconnectContextForScope(e)}connectModule(e){this.modulesByIdentifier.set(e.identifier,e),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(r=>e.connectContextForScope(r))}disconnectModule(e){this.modulesByIdentifier.delete(e.identifier),this.scopesByIdentifier.getValuesForKey(e.identifier).forEach(r=>e.disconnectContextForScope(r))}},mb={controllerAttribute:"data-controller",actionAttribute:"data-action",targetAttribute:"data-target",targetAttributeForScope:i=>`data-${i}-target`,outletAttributeForScope:(i,e)=>`data-${i}-${e}-outlet`,keyMappings:Object.assign(Object.assign({enter:"Enter",tab:"Tab",esc:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",page_up:"PageUp",page_down:"PageDown"},xd("abcdefghijklmnopqrstuvwxyz".split("").map(i=>[i,i]))),xd("0123456789".split("").map(i=>[i,i])))};function xd(i){return i.reduce((e,[t,r])=>Object.assign(Object.assign({},e),{[t]:r}),{})}var jo=class{constructor(e=document.documentElement,t=mb){this.logger=console,this.debug=!1,this.logDebugActivity=(r,s,n={})=>{this.debug&&this.logFormattedMessage(r,s,n)},this.element=e,this.schema=t,this.dispatcher=new Il(this),this.router=new ic(this),this.actionDescriptorFilters=Object.assign({},qv)}static start(e,t){let r=new this(e,t);return r.start(),r}async start(){await gb(),this.logDebugActivity("application","starting"),this.dispatcher.start(),this.router.start(),this.logDebugActivity("application","start")}stop(){this.logDebugActivity("application","stopping"),this.dispatcher.stop(),this.router.stop(),this.logDebugActivity("application","stop")}register(e,t){this.load({identifier:e,controllerConstructor:t})}registerActionOption(e,t){this.actionDescriptorFilters[e]=t}load(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(s=>{s.controllerConstructor.shouldLoad&&this.router.loadDefinition(s)})}unload(e,...t){(Array.isArray(e)?e:[e,...t]).forEach(s=>this.router.unloadIdentifier(s))}get controllers(){return this.router.contexts.map(e=>e.controller)}getControllerForElementAndIdentifier(e,t){let r=this.router.getContextForElementAndIdentifier(e,t);return r?r.controller:null}handleError(e,t,r){var s;this.logger.error(`%s %o %o`,t,e,r),(s=window.onerror)===null||s===void 0||s.call(window,t,"",0,0,e)}logFormattedMessage(e,t,r={}){r=Object.assign({application:this},r),this.logger.groupCollapsed(`${e} #${t}`),this.logger.log("details:",Object.assign({},r)),this.logger.groupEnd()}};function gb(){return new Promise(i=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>i()):i()})}function vb(i){return ln(i,"classes").reduce((t,r)=>Object.assign(t,bb(r)),{})}function bb(i){return{[`${i}Class`]:{get(){let{classes:e}=this;if(e.has(i))return e.get(i);{let t=e.getAttributeName(i);throw new Error(`Missing attribute "${t}"`)}}},[`${i}Classes`]:{get(){return this.classes.getAll(i)}},[`has${an(i)}Class`]:{get(){return this.classes.has(i)}}}}function yb(i){return ln(i,"outlets").reduce((t,r)=>Object.assign(t,wb(r)),{})}function Ad(i,e,t){return i.application.getControllerForElementAndIdentifier(e,t)}function kd(i,e,t){let r=Ad(i,e,t);if(r||(i.application.router.proposeToConnectScopeForElementAndIdentifier(e,t),r=Ad(i,e,t),r))return r}function wb(i){let e=Dl(i);return{[`${e}Outlet`]:{get(){let t=this.outlets.find(i),r=this.outlets.getSelectorForOutletName(i);if(t){let s=kd(this,t,i);if(s)return s;throw new Error(`The provided outlet element is missing an outlet controller "${i}" instance for host controller "${this.identifier}"`)}throw new Error(`Missing outlet element "${i}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${r}".`)}},[`${e}Outlets`]:{get(){let t=this.outlets.findAll(i);return t.length>0?t.map(r=>{let s=kd(this,r,i);if(s)return s;console.warn(`The provided outlet element is missing an outlet controller "${i}" instance for host controller "${this.identifier}"`,r)}).filter(r=>r):[]}},[`${e}OutletElement`]:{get(){let t=this.outlets.find(i),r=this.outlets.getSelectorForOutletName(i);if(t)return t;throw new Error(`Missing outlet element "${i}" for host controller "${this.identifier}". Stimulus couldn't find a matching outlet element using selector "${r}".`)}},[`${e}OutletElements`]:{get(){return this.outlets.findAll(i)}},[`has${an(e)}Outlet`]:{get(){return this.outlets.has(i)}}}}function Sb(i){return ln(i,"targets").reduce((t,r)=>Object.assign(t,Eb(r)),{})}function Eb(i){return{[`${i}Target`]:{get(){let e=this.targets.find(i);if(e)return e;throw new Error(`Missing target element "${i}" for "${this.identifier}" controller`)}},[`${i}Targets`]:{get(){return this.targets.findAll(i)}},[`has${an(i)}Target`]:{get(){return this.targets.has(i)}}}}function Tb(i){let e=sb(i,"values"),t={valueDescriptorMap:{get(){return e.reduce((r,s)=>{let n=Ld(s,this.identifier),o=this.data.getAttributeNameForKey(n.key);return Object.assign(r,{[o]:n})},{})}}};return e.reduce((r,s)=>Object.assign(r,xb(s)),t)}function xb(i,e){let t=Ld(i,e),{key:r,name:s,reader:n,writer:o}=t;return{[s]:{get(){let a=this.data.get(r);return a!==null?n(a):t.defaultValue},set(a){a===void 0?this.data.delete(r):this.data.set(r,o(a))}},[`has${an(s)}`]:{get(){return this.data.has(r)||t.hasCustomDefaultValue}}}}function Ld([i,e],t){return Cb({controller:t,token:i,typeDefinition:e})}function Wo(i){switch(i){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function on(i){switch(typeof i){case"boolean":return"boolean";case"number":return"number";case"string":return"string"}if(Array.isArray(i))return"array";if(Object.prototype.toString.call(i)==="[object Object]")return"object"}function Ab(i){let{controller:e,token:t,typeObject:r}=i,s=Sd(r.type),n=Sd(r.default),o=s&&n,a=s&&!n,l=!s&&n,c=Wo(r.type),d=on(i.typeObject.default);if(a)return c;if(l)return d;if(c!==d){let f=e?`${e}.${t}`:t;throw new Error(`The specified default value for the Stimulus Value "${f}" must match the defined type "${c}". The provided default value of "${r.default}" is of type "${d}".`)}if(o)return c}function kb(i){let{controller:e,token:t,typeDefinition:r}=i,n=Ab({controller:e,token:t,typeObject:r}),o=on(r),a=Wo(r),l=n||o||a;if(l)return l;let c=e?`${e}.${r}`:t;throw new Error(`Unknown value type "${c}" for "${t}" value`)}function Pb(i){let e=Wo(i);if(e)return Pd[e];let t=Nl(i,"default"),r=Nl(i,"type"),s=i;if(t)return s.default;if(r){let{type:n}=s,o=Wo(n);if(o)return Pd[o]}return i}function Cb(i){let{token:e,typeDefinition:t}=i,r=`${_d(e)}-value`,s=kb(i);return{type:s,key:r,name:rc(r),get defaultValue(){return Pb(t)},get hasCustomDefaultValue(){return on(t)!==void 0},reader:Fb[s],writer:Cd[s]||Cd.default}}var Pd={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},Fb={array(i){let e=JSON.parse(i);if(!Array.isArray(e))throw new TypeError(`expected value of type "array" but instead got value "${i}" of type "${on(e)}"`);return e},boolean(i){return!(i=="0"||String(i).toLowerCase()=="false")},number(i){return Number(i.replace(/_/g,""))},object(i){let e=JSON.parse(i);if(e===null||typeof e!="object"||Array.isArray(e))throw new TypeError(`expected value of type "object" but instead got value "${i}" of type "${on(e)}"`);return e},string(i){return i}},Cd={default:_b,array:Fd,object:Fd};function Fd(i){return JSON.stringify(i)}function _b(i){return`${i}`}var ne=class{constructor(e){this.context=e}static get shouldLoad(){return!0}static afterLoad(e,t){}get application(){return this.context.application}get scope(){return this.context.scope}get element(){return this.scope.element}get identifier(){return this.scope.identifier}get targets(){return this.scope.targets}get outlets(){return this.scope.outlets}get classes(){return this.scope.classes}get data(){return this.scope.data}initialize(){}connect(){}disconnect(){}dispatch(e,{target:t=this.element,detail:r={},prefix:s=this.identifier,bubbles:n=!0,cancelable:o=!0}={}){let a=s?`${s}:${e}`:e,l=new CustomEvent(a,{detail:r,bubbles:n,cancelable:o});return t.dispatchEvent(l),l}};ne.blessings=[vb,Sb,Tb,yb];ne.targets=[];ne.outlets=[];ne.values={};var Go=class extends ne{static targets=["openIcon","closeIcon"];static outlets=["sidebar"];static values={placement:{type:String,default:"left"},bodyScrolling:{type:Boolean,default:!1},backdrop:{type:Boolean,default:!0},edge:{type:Boolean,default:!1},edgeOffset:{type:String,default:"bottom-[60px]"}};static classes={backdrop:"bg-gray-900/50 dark:bg-gray-900/80 fixed inset-0 z-30"};initialize(){this.visible=!1,this.handleEscapeKey=this.handleEscapeKey.bind(this)}connect(){document.addEventListener("keydown",this.handleEscapeKey)}sidebarOutletConnected(){this.#e(this.sidebarOutlet.element)}disconnect(){this.#i(),document.removeEventListener("keydown",this.handleEscapeKey),this.bodyScrollingValue||document.body.classList.remove("overflow-hidden")}#e(i){i.setAttribute("aria-hidden","true"),i.classList.add("transition-transform"),this.#s(this.placementValue).base.forEach(e=>{i.classList.add(e)})}toggleDrawer(){this.visible?this.hideDrawer():this.showDrawer()}showDrawer(){this.edgeValue?this.#n(`${this.placementValue}-edge`,!0):this.#r(this.placementValue,!0),this.openIconTarget.classList.add("hidden"),this.openIconTarget.setAttribute("aria-hidden","true"),this.closeIconTarget.classList.remove("hidden"),this.closeIconTarget.setAttribute("aria-hidden","false"),this.sidebarOutlet.element.setAttribute("aria-modal","true"),this.sidebarOutlet.element.setAttribute("role","dialog"),this.sidebarOutlet.element.removeAttribute("aria-hidden"),this.bodyScrollingValue||document.body.classList.add("overflow-hidden"),this.backdropValue&&this.#t(),this.visible=!0,this.dispatch("show")}hideDrawer(){this.edgeValue?this.#n(`${this.placementValue}-edge`,!1):this.#r(this.placementValue,!1),this.openIconTarget.classList.remove("hidden"),this.openIconTarget.setAttribute("aria-hidden","false"),this.closeIconTarget.classList.add("hidden"),this.closeIconTarget.setAttribute("aria-hidden","true"),this.sidebarOutlet.element.setAttribute("aria-hidden","true"),this.sidebarOutlet.element.removeAttribute("aria-modal"),this.sidebarOutlet.element.removeAttribute("role"),this.bodyScrollingValue||document.body.classList.remove("overflow-hidden"),this.backdropValue&&this.#i(),this.visible=!1,this.dispatch("hide")}handleEscapeKey(i){i.key==="Escape"&&this.visible&&this.hideDrawer()}#t(){if(!this.visible){let i=document.createElement("div");i.setAttribute("data-drawer-backdrop",""),i.classList.add(...this.constructor.classes.backdrop.split(" ")),i.addEventListener("click",()=>this.hideDrawer()),document.body.appendChild(i)}}#i(){let i=document.querySelector("[data-drawer-backdrop]");i&&i.remove()}#s(i){let e={top:{base:["top-0","left-0","right-0"],active:["transform-none"],inactive:["-translate-y-full"]},right:{base:["right-0","top-0"],active:["transform-none"],inactive:["translate-x-full"]},bottom:{base:["bottom-0","left-0","right-0"],active:["transform-none"],inactive:["translate-y-full"]},left:{base:["left-0","top-0"],active:["transform-none"],inactive:["-translate-x-full"]},"bottom-edge":{base:["left-0","top-0"],active:["transform-none"],inactive:["translate-y-full",this.edgeOffsetValue]}};return e[i]||e.left}#r(i,e){let t=this.#s(i);e?(t.active.forEach(r=>this.sidebarOutlet.element.classList.add(r)),t.inactive.forEach(r=>this.sidebarOutlet.element.classList.remove(r))):(t.active.forEach(r=>this.sidebarOutlet.element.classList.remove(r)),t.inactive.forEach(r=>this.sidebarOutlet.element.classList.add(r)))}#n(i,e){this.#r(i,e)}};var Ko=class extends ne{static targets=["target","template","addButton"];static values={wrapperSelector:{type:String,default:".nested-resource-form-fields"},limit:Number};connect(){this.updateState()}add(i){i.preventDefault();let e=this.templateTarget.innerHTML.replace(/NEW_RECORD/g,new Date().getTime().toString());this.targetTarget.insertAdjacentHTML("beforebegin",e);let t=new CustomEvent("nested-resource-form-fields:add",{bubbles:!0});this.element.dispatchEvent(t),this.updateState()}remove(i){i.preventDefault();let e=i.target.closest(this.wrapperSelectorValue);if(e.dataset.newRecord!==void 0)e.remove();else{e.style.display="none",e.classList.remove(...e.classList);let r=e.querySelector("input[name*='_destroy']");r.value="1"}let t=new CustomEvent("nested-resource-form-fields:remove",{bubbles:!0});this.element.dispatchEvent(t),this.updateState()}updateState(){!this.hasAddButtonTarget||this.limitValue==0||(this.childCount>=this.limitValue?this.addButtonTarget.style.display="none":this.addButtonTarget.style.display="initial")}get childCount(){return this.element.querySelectorAll(this.wrapperSelectorValue).length}};var bx=Ce(Nd(),1),Xo=class extends ne{connect(){}submit(){this.element.requestSubmit()}};var De="top",Ye="bottom",qe="right",Ue="left",Yo="auto",cr=[De,Ye,qe,Ue],Ii="start",Tr="end",Bd="clippingParents",Zo="viewport",bs="popper",Ud="reference",oc=cr.reduce(function(i,e){return i.concat([e+"-"+Ii,e+"-"+Tr])},[]),Qo=[].concat(cr,[Yo]).reduce(function(i,e){return i.concat([e,e+"-"+Ii,e+"-"+Tr])},[]),Kb="beforeRead",Xb="read",Yb="afterRead",Zb="beforeMain",Qb="main",Jb="afterMain",ey="beforeWrite",ty="write",iy="afterWrite",zd=[Kb,Xb,Yb,Zb,Qb,Jb,ey,ty,iy];function et(i){return i?(i.nodeName||"").toLowerCase():null}function Fe(i){if(i==null)return window;if(i.toString()!=="[object Window]"){var e=i.ownerDocument;return e&&e.defaultView||window}return i}function qt(i){var e=Fe(i).Element;return i instanceof e||i instanceof Element}function Ze(i){var e=Fe(i).HTMLElement;return i instanceof e||i instanceof HTMLElement}function ys(i){if(typeof ShadowRoot>"u")return!1;var e=Fe(i).ShadowRoot;return i instanceof e||i instanceof ShadowRoot}function ry(i){var e=i.state;Object.keys(e.elements).forEach(function(t){var r=e.styles[t]||{},s=e.attributes[t]||{},n=e.elements[t];!Ze(n)||!et(n)||(Object.assign(n.style,r),Object.keys(s).forEach(function(o){var a=s[o];a===!1?n.removeAttribute(o):n.setAttribute(o,a===!0?"":a)}))})}function sy(i){var e=i.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(r){var s=e.elements[r],n=e.attributes[r]||{},o=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:t[r]),a=o.reduce(function(l,c){return l[c]="",l},{});!Ze(s)||!et(s)||(Object.assign(s.style,a),Object.keys(n).forEach(function(l){s.removeAttribute(l)}))})}}var Hd={name:"applyStyles",enabled:!0,phase:"write",fn:ry,effect:sy,requires:["computeStyles"]};function tt(i){return i.split("-")[0]}var ii=Math.max,xr=Math.min,Di=Math.round;function ws(){var i=navigator.userAgentData;return i!=null&&i.brands&&Array.isArray(i.brands)?i.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function cn(){return!/^((?!chrome|android).)*safari/i.test(ws())}function Vt(i,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var r=i.getBoundingClientRect(),s=1,n=1;e&&Ze(i)&&(s=i.offsetWidth>0&&Di(r.width)/i.offsetWidth||1,n=i.offsetHeight>0&&Di(r.height)/i.offsetHeight||1);var o=qt(i)?Fe(i):window,a=o.visualViewport,l=!cn()&&t,c=(r.left+(l&&a?a.offsetLeft:0))/s,d=(r.top+(l&&a?a.offsetTop:0))/n,f=r.width/s,y=r.height/n;return{width:f,height:y,top:d,right:c+f,bottom:d+y,left:c,x:c,y:d}}function Ar(i){var e=Vt(i),t=i.offsetWidth,r=i.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:i.offsetLeft,y:i.offsetTop,width:t,height:r}}function un(i,e){var t=e.getRootNode&&e.getRootNode();if(i.contains(e))return!0;if(t&&ys(t)){var r=e;do{if(r&&i.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function ft(i){return Fe(i).getComputedStyle(i)}function ac(i){return["table","td","th"].indexOf(et(i))>=0}function nt(i){return((qt(i)?i.ownerDocument:i.document)||window.document).documentElement}function Ni(i){return et(i)==="html"?i:i.assignedSlot||i.parentNode||(ys(i)?i.host:null)||nt(i)}function $d(i){return!Ze(i)||ft(i).position==="fixed"?null:i.offsetParent}function ny(i){var e=/firefox/i.test(ws()),t=/Trident/i.test(ws());if(t&&Ze(i)){var r=ft(i);if(r.position==="fixed")return null}var s=Ni(i);for(ys(s)&&(s=s.host);Ze(s)&&["html","body"].indexOf(et(s))<0;){var n=ft(s);if(n.transform!=="none"||n.perspective!=="none"||n.contain==="paint"||["transform","perspective"].indexOf(n.willChange)!==-1||e&&n.willChange==="filter"||e&&n.filter&&n.filter!=="none")return s;s=s.parentNode}return null}function ri(i){for(var e=Fe(i),t=$d(i);t&&ac(t)&&ft(t).position==="static";)t=$d(t);return t&&(et(t)==="html"||et(t)==="body"&&ft(t).position==="static")?e:t||ny(i)||e}function kr(i){return["top","bottom"].indexOf(i)>=0?"x":"y"}function Pr(i,e,t){return ii(i,xr(e,t))}function qd(i,e,t){var r=Pr(i,e,t);return r>t?t:r}function hn(){return{top:0,right:0,bottom:0,left:0}}function dn(i){return Object.assign({},hn(),i)}function pn(i,e){return e.reduce(function(t,r){return t[r]=i,t},{})}var oy=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,dn(typeof e!="number"?e:pn(e,cr))};function ay(i){var e,t=i.state,r=i.name,s=i.options,n=t.elements.arrow,o=t.modifiersData.popperOffsets,a=tt(t.placement),l=kr(a),c=[Ue,qe].indexOf(a)>=0,d=c?"height":"width";if(!(!n||!o)){var f=oy(s.padding,t),y=Ar(n),v=l==="y"?De:Ue,x=l==="y"?Ye:qe,P=t.rects.reference[d]+t.rects.reference[l]-o[l]-t.rects.popper[d],C=o[l]-t.rects.reference[l],I=ri(n),D=I?l==="y"?I.clientHeight||0:I.clientWidth||0:0,q=P/2-C/2,M=f[v],H=D-y[d]-f[x],R=D/2-y[d]/2+q,G=Pr(M,R,H),K=l;t.modifiersData[r]=(e={},e[K]=G,e.centerOffset=G-R,e)}}function ly(i){var e=i.state,t=i.options,r=t.element,s=r===void 0?"[data-popper-arrow]":r;s!=null&&(typeof s=="string"&&(s=e.elements.popper.querySelector(s),!s)||un(e.elements.popper,s)&&(e.elements.arrow=s))}var Vd={name:"arrow",enabled:!0,phase:"main",fn:ay,effect:ly,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function jt(i){return i.split("-")[1]}var cy={top:"auto",right:"auto",bottom:"auto",left:"auto"};function uy(i,e){var t=i.x,r=i.y,s=e.devicePixelRatio||1;return{x:Di(t*s)/s||0,y:Di(r*s)/s||0}}function jd(i){var e,t=i.popper,r=i.popperRect,s=i.placement,n=i.variation,o=i.offsets,a=i.position,l=i.gpuAcceleration,c=i.adaptive,d=i.roundOffsets,f=i.isFixed,y=o.x,v=y===void 0?0:y,x=o.y,P=x===void 0?0:x,C=typeof d=="function"?d({x:v,y:P}):{x:v,y:P};v=C.x,P=C.y;var I=o.hasOwnProperty("x"),D=o.hasOwnProperty("y"),q=Ue,M=De,H=window;if(c){var R=ri(t),G="clientHeight",K="clientWidth";if(R===Fe(t)&&(R=nt(t),ft(R).position!=="static"&&a==="absolute"&&(G="scrollHeight",K="scrollWidth")),R=R,s===De||(s===Ue||s===qe)&&n===Tr){M=Ye;var Y=f&&R===H&&H.visualViewport?H.visualViewport.height:R[G];P-=Y-r.height,P*=l?1:-1}if(s===Ue||(s===De||s===Ye)&&n===Tr){q=qe;var ie=f&&R===H&&H.visualViewport?H.visualViewport.width:R[K];v-=ie-r.width,v*=l?1:-1}}var Q=Object.assign({position:a},c&&cy),oe=d===!0?uy({x:v,y:P},Fe(t)):{x:v,y:P};if(v=oe.x,P=oe.y,l){var le;return Object.assign({},Q,(le={},le[M]=D?"0":"",le[q]=I?"0":"",le.transform=(H.devicePixelRatio||1)<=1?"translate("+v+"px, "+P+"px)":"translate3d("+v+"px, "+P+"px, 0)",le))}return Object.assign({},Q,(e={},e[M]=D?P+"px":"",e[q]=I?v+"px":"",e.transform="",e))}function hy(i){var e=i.state,t=i.options,r=t.gpuAcceleration,s=r===void 0?!0:r,n=t.adaptive,o=n===void 0?!0:n,a=t.roundOffsets,l=a===void 0?!0:a,c={placement:tt(e.placement),variation:jt(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,jd(Object.assign({},c,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,jd(Object.assign({},c,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}var Wd={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:hy,data:{}};var Jo={passive:!0};function dy(i){var e=i.state,t=i.instance,r=i.options,s=r.scroll,n=s===void 0?!0:s,o=r.resize,a=o===void 0?!0:o,l=Fe(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return n&&c.forEach(function(d){d.addEventListener("scroll",t.update,Jo)}),a&&l.addEventListener("resize",t.update,Jo),function(){n&&c.forEach(function(d){d.removeEventListener("scroll",t.update,Jo)}),a&&l.removeEventListener("resize",t.update,Jo)}}var Gd={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:dy,data:{}};var py={left:"right",right:"left",bottom:"top",top:"bottom"};function Ss(i){return i.replace(/left|right|bottom|top/g,function(e){return py[e]})}var fy={start:"end",end:"start"};function ea(i){return i.replace(/start|end/g,function(e){return fy[e]})}function Cr(i){var e=Fe(i),t=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:t,scrollTop:r}}function Fr(i){return Vt(nt(i)).left+Cr(i).scrollLeft}function lc(i,e){var t=Fe(i),r=nt(i),s=t.visualViewport,n=r.clientWidth,o=r.clientHeight,a=0,l=0;if(s){n=s.width,o=s.height;var c=cn();(c||!c&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:n,height:o,x:a+Fr(i),y:l}}function cc(i){var e,t=nt(i),r=Cr(i),s=(e=i.ownerDocument)==null?void 0:e.body,n=ii(t.scrollWidth,t.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=ii(t.scrollHeight,t.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-r.scrollLeft+Fr(i),l=-r.scrollTop;return ft(s||t).direction==="rtl"&&(a+=ii(t.clientWidth,s?s.clientWidth:0)-n),{width:n,height:o,x:a,y:l}}function _r(i){var e=ft(i),t=e.overflow,r=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+s+r)}function ta(i){return["html","body","#document"].indexOf(et(i))>=0?i.ownerDocument.body:Ze(i)&&_r(i)?i:ta(Ni(i))}function ur(i,e){var t;e===void 0&&(e=[]);var r=ta(i),s=r===((t=i.ownerDocument)==null?void 0:t.body),n=Fe(r),o=s?[n].concat(n.visualViewport||[],_r(r)?r:[]):r,a=e.concat(o);return s?a:a.concat(ur(Ni(o)))}function Es(i){return Object.assign({},i,{left:i.x,top:i.y,right:i.x+i.width,bottom:i.y+i.height})}function my(i,e){var t=Vt(i,!1,e==="fixed");return t.top=t.top+i.clientTop,t.left=t.left+i.clientLeft,t.bottom=t.top+i.clientHeight,t.right=t.left+i.clientWidth,t.width=i.clientWidth,t.height=i.clientHeight,t.x=t.left,t.y=t.top,t}function Kd(i,e,t){return e===Zo?Es(lc(i,t)):qt(e)?my(e,t):Es(cc(nt(i)))}function gy(i){var e=ur(Ni(i)),t=["absolute","fixed"].indexOf(ft(i).position)>=0,r=t&&Ze(i)?ri(i):i;return qt(r)?e.filter(function(s){return qt(s)&&un(s,r)&&et(s)!=="body"}):[]}function uc(i,e,t,r){var s=e==="clippingParents"?gy(i):[].concat(e),n=[].concat(s,[t]),o=n[0],a=n.reduce(function(l,c){var d=Kd(i,c,r);return l.top=ii(d.top,l.top),l.right=xr(d.right,l.right),l.bottom=xr(d.bottom,l.bottom),l.left=ii(d.left,l.left),l},Kd(i,o,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function fn(i){var e=i.reference,t=i.element,r=i.placement,s=r?tt(r):null,n=r?jt(r):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(s){case De:l={x:o,y:e.y-t.height};break;case Ye:l={x:o,y:e.y+e.height};break;case qe:l={x:e.x+e.width,y:a};break;case Ue:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var c=s?kr(s):null;if(c!=null){var d=c==="y"?"height":"width";switch(n){case Ii:l[c]=l[c]-(e[d]/2-t[d]/2);break;case Tr:l[c]=l[c]+(e[d]/2-t[d]/2);break;default:}}return l}function si(i,e){e===void 0&&(e={});var t=e,r=t.placement,s=r===void 0?i.placement:r,n=t.strategy,o=n===void 0?i.strategy:n,a=t.boundary,l=a===void 0?Bd:a,c=t.rootBoundary,d=c===void 0?Zo:c,f=t.elementContext,y=f===void 0?bs:f,v=t.altBoundary,x=v===void 0?!1:v,P=t.padding,C=P===void 0?0:P,I=dn(typeof C!="number"?C:pn(C,cr)),D=y===bs?Ud:bs,q=i.rects.popper,M=i.elements[x?D:y],H=uc(qt(M)?M:M.contextElement||nt(i.elements.popper),l,d,o),R=Vt(i.elements.reference),G=fn({reference:R,element:q,strategy:"absolute",placement:s}),K=Es(Object.assign({},q,G)),Y=y===bs?K:R,ie={top:H.top-Y.top+I.top,bottom:Y.bottom-H.bottom+I.bottom,left:H.left-Y.left+I.left,right:Y.right-H.right+I.right},Q=i.modifiersData.offset;if(y===bs&&Q){var oe=Q[s];Object.keys(ie).forEach(function(le){var Ae=[qe,Ye].indexOf(le)>=0?1:-1,We=[De,Ye].indexOf(le)>=0?"y":"x";ie[le]+=oe[We]*Ae})}return ie}function hc(i,e){e===void 0&&(e={});var t=e,r=t.placement,s=t.boundary,n=t.rootBoundary,o=t.padding,a=t.flipVariations,l=t.allowedAutoPlacements,c=l===void 0?Qo:l,d=jt(r),f=d?a?oc:oc.filter(function(x){return jt(x)===d}):cr,y=f.filter(function(x){return c.indexOf(x)>=0});y.length===0&&(y=f);var v=y.reduce(function(x,P){return x[P]=si(i,{placement:P,boundary:s,rootBoundary:n,padding:o})[tt(P)],x},{});return Object.keys(v).sort(function(x,P){return v[x]-v[P]})}function vy(i){if(tt(i)===Yo)return[];var e=Ss(i);return[ea(i),e,ea(e)]}function by(i){var e=i.state,t=i.options,r=i.name;if(!e.modifiersData[r]._skip){for(var s=t.mainAxis,n=s===void 0?!0:s,o=t.altAxis,a=o===void 0?!0:o,l=t.fallbackPlacements,c=t.padding,d=t.boundary,f=t.rootBoundary,y=t.altBoundary,v=t.flipVariations,x=v===void 0?!0:v,P=t.allowedAutoPlacements,C=e.options.placement,I=tt(C),D=I===C,q=l||(D||!x?[Ss(C)]:vy(C)),M=[C].concat(q).reduce(function(ke,se){return ke.concat(tt(se)===Yo?hc(e,{placement:se,boundary:d,rootBoundary:f,padding:c,flipVariations:x,allowedAutoPlacements:P}):se)},[]),H=e.rects.reference,R=e.rects.popper,G=new Map,K=!0,Y=M[0],ie=0;ie=0,We=Ae?"width":"height",T=si(e,{placement:Q,boundary:d,rootBoundary:f,altBoundary:y,padding:c}),A=Ae?le?qe:Ue:le?Ye:De;H[We]>R[We]&&(A=Ss(A));var k=Ss(A),$=[];if(n&&$.push(T[oe]<=0),a&&$.push(T[A]<=0,T[k]<=0),$.every(function(ke){return ke})){Y=Q,K=!1;break}G.set(Q,$)}if(K)for(var j=x?3:1,z=function(se){var ce=M.find(function(Me){var Ne=G.get(Me);if(Ne)return Ne.slice(0,se).every(function(He){return He})});if(ce)return Y=ce,"break"},J=j;J>0;J--){var ee=z(J);if(ee==="break")break}e.placement!==Y&&(e.modifiersData[r]._skip=!0,e.placement=Y,e.reset=!0)}}var Xd={name:"flip",enabled:!0,phase:"main",fn:by,requiresIfExists:["offset"],data:{_skip:!1}};function Yd(i,e,t){return t===void 0&&(t={x:0,y:0}),{top:i.top-e.height-t.y,right:i.right-e.width+t.x,bottom:i.bottom-e.height+t.y,left:i.left-e.width-t.x}}function Zd(i){return[De,qe,Ye,Ue].some(function(e){return i[e]>=0})}function yy(i){var e=i.state,t=i.name,r=e.rects.reference,s=e.rects.popper,n=e.modifiersData.preventOverflow,o=si(e,{elementContext:"reference"}),a=si(e,{altBoundary:!0}),l=Yd(o,r),c=Yd(a,s,n),d=Zd(l),f=Zd(c);e.modifiersData[t]={referenceClippingOffsets:l,popperEscapeOffsets:c,isReferenceHidden:d,hasPopperEscaped:f},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":f})}var Qd={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:yy};function wy(i,e,t){var r=tt(i),s=[Ue,De].indexOf(r)>=0?-1:1,n=typeof t=="function"?t(Object.assign({},e,{placement:i})):t,o=n[0],a=n[1];return o=o||0,a=(a||0)*s,[Ue,qe].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function Sy(i){var e=i.state,t=i.options,r=i.name,s=t.offset,n=s===void 0?[0,0]:s,o=Qo.reduce(function(d,f){return d[f]=wy(f,e.rects,n),d},{}),a=o[e.placement],l=a.x,c=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=c),e.modifiersData[r]=o}var Jd={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Sy};function Ey(i){var e=i.state,t=i.name;e.modifiersData[t]=fn({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}var ep={name:"popperOffsets",enabled:!0,phase:"read",fn:Ey,data:{}};function dc(i){return i==="x"?"y":"x"}function Ty(i){var e=i.state,t=i.options,r=i.name,s=t.mainAxis,n=s===void 0?!0:s,o=t.altAxis,a=o===void 0?!1:o,l=t.boundary,c=t.rootBoundary,d=t.altBoundary,f=t.padding,y=t.tether,v=y===void 0?!0:y,x=t.tetherOffset,P=x===void 0?0:x,C=si(e,{boundary:l,rootBoundary:c,padding:f,altBoundary:d}),I=tt(e.placement),D=jt(e.placement),q=!D,M=kr(I),H=dc(M),R=e.modifiersData.popperOffsets,G=e.rects.reference,K=e.rects.popper,Y=typeof P=="function"?P(Object.assign({},e.rects,{placement:e.placement})):P,ie=typeof Y=="number"?{mainAxis:Y,altAxis:Y}:Object.assign({mainAxis:0,altAxis:0},Y),Q=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,oe={x:0,y:0};if(R){if(n){var le,Ae=M==="y"?De:Ue,We=M==="y"?Ye:qe,T=M==="y"?"height":"width",A=R[M],k=A+C[Ae],$=A-C[We],j=v?-K[T]/2:0,z=D===Ii?G[T]:K[T],J=D===Ii?-K[T]:-G[T],ee=e.elements.arrow,ke=v&&ee?Ar(ee):{width:0,height:0},se=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:hn(),ce=se[Ae],Me=se[We],Ne=Pr(0,G[T],ke[T]),He=q?G[T]/2-j-Ne-ce-ie.mainAxis:z-Ne-ce-ie.mainAxis,fi=q?-G[T]/2+j+Ne+Me+ie.mainAxis:J+Ne+Me+ie.mainAxis,mi=e.elements.arrow&&ri(e.elements.arrow),Yt=mi?M==="y"?mi.clientTop||0:mi.clientLeft||0:0,er=(le=Q?.[M])!=null?le:0,Zt=A+He-er-Yt,br=A+fi-er,ki=Pr(v?xr(k,Zt):k,A,v?ii($,br):$);R[M]=ki,oe[M]=ki-A}if(a){var Ut,Pi=M==="x"?De:Ue,Ci=M==="x"?Ye:qe,Ct=R[H],gi=H==="y"?"height":"width",tr=Ct+C[Pi],Fi=Ct-C[Ci],Qt=[De,Ue].indexOf(I)!==-1,Jt=(Ut=Q?.[H])!=null?Ut:0,ei=Qt?tr:Ct-G[gi]-K[gi]-Jt+ie.altAxis,yr=Qt?Ct+G[gi]+K[gi]-Jt-ie.altAxis:Fi,ir=v&&Qt?qd(ei,Ct,yr):Pr(v?ei:tr,Ct,v?yr:Fi);R[H]=ir,oe[H]=ir-Ct}e.modifiersData[r]=oe}}var tp={name:"preventOverflow",enabled:!0,phase:"main",fn:Ty,requiresIfExists:["offset"]};function pc(i){return{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}}function fc(i){return i===Fe(i)||!Ze(i)?Cr(i):pc(i)}function xy(i){var e=i.getBoundingClientRect(),t=Di(e.width)/i.offsetWidth||1,r=Di(e.height)/i.offsetHeight||1;return t!==1||r!==1}function mc(i,e,t){t===void 0&&(t=!1);var r=Ze(e),s=Ze(e)&&xy(e),n=nt(e),o=Vt(i,s,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!t)&&((et(e)!=="body"||_r(n))&&(a=fc(e)),Ze(e)?(l=Vt(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):n&&(l.x=Fr(n))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function Ay(i){var e=new Map,t=new Set,r=[];i.forEach(function(n){e.set(n.name,n)});function s(n){t.add(n.name);var o=[].concat(n.requires||[],n.requiresIfExists||[]);o.forEach(function(a){if(!t.has(a)){var l=e.get(a);l&&s(l)}}),r.push(n)}return i.forEach(function(n){t.has(n.name)||s(n)}),r}function gc(i){var e=Ay(i);return zd.reduce(function(t,r){return t.concat(e.filter(function(s){return s.phase===r}))},[])}function vc(i){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(i())})})),e}}function bc(i){var e=i.reduce(function(t,r){var s=t[r.name];return t[r.name]=s?Object.assign({},s,r,{options:Object.assign({},s.options,r.options),data:Object.assign({},s.data,r.data)}):r,t},{});return Object.keys(e).map(function(t){return e[t]})}var ip={placement:"bottom",modifiers:[],strategy:"absolute"};function rp(){for(var i=arguments.length,e=new Array(i),t=0;t{i.type==="click"?this.toggle():setTimeout(()=>{this.show()},this.options.delay)},this.hoverShowMenuHandler=()=>{this.show()},this.hoverHideHandler=()=>{setTimeout(()=>{this.menuTarget.matches(":hover")||this.hide()},this.options.delay)},this.options.triggerType==="click"?this.triggerTarget.addEventListener("click",this.clickHandler):this.options.triggerType==="hover"&&(this.triggerTarget.addEventListener("mouseenter",this.hoverShowTriggerHandler),this.menuTarget.addEventListener("mouseenter",this.hoverShowMenuHandler),this.triggerTarget.addEventListener("mouseleave",this.hoverHideHandler),this.menuTarget.addEventListener("mouseleave",this.hoverHideHandler))}setupClickOutsideListener(){this.clickOutsideHandler=i=>{let e=i.target,t=this.options.ignoreClickOutsideClass,r=!1;t&&document.querySelectorAll(`.${t}`).forEach(n=>{if(n.contains(e)){r=!0;return}}),e!==this.menuTarget&&!this.menuTarget.contains(e)&&!this.triggerTarget.contains(e)&&!r&&this.visible&&this.hide()},document.body.addEventListener("click",this.clickOutsideHandler,!0)}removeClickOutsideListener(){this.clickOutsideHandler&&document.body.removeEventListener("click",this.clickOutsideHandler,!0)}toggle(){this.visible?this.hide():this.show()}show(){this.menuTarget.classList.remove("hidden"),this.menuTarget.classList.add("block"),this.menuTarget.removeAttribute("aria-hidden"),this.popperInstance.setOptions(i=>({...i,modifiers:[...i.modifiers,{name:"eventListeners",enabled:!0}]})),this.setupClickOutsideListener(),this.popperInstance.update(),this.visible=!0}hide(){this.menuTarget.classList.remove("block"),this.menuTarget.classList.add("hidden"),this.menuTarget.setAttribute("aria-hidden","true"),this.popperInstance.setOptions(i=>({...i,modifiers:[...i.modifiers,{name:"eventListeners",enabled:!1}]})),this.removeClickOutsideListener(),this.visible=!1}};var ra=class extends ne{static targets=["trigger","menu"];connect(){this.element.hasAttribute("data-visible")||this.element.setAttribute("data-visible","false"),this.#e()}toggle(){let i=this.element.getAttribute("data-visible")==="true";this.element.setAttribute("data-visible",(!i).toString()),this.#e()}#e(){this.element.getAttribute("data-visible")==="true"?(this.menuTarget.classList.remove("hidden"),this.triggerTarget.setAttribute("aria-expanded","true"),this.dispatch("expand")):(this.menuTarget.classList.add("hidden"),this.triggerTarget.setAttribute("aria-expanded","false"),this.dispatch("collapse"))}};var sa=class extends ne{static values={after:Number};connect(){this.hasAfterValue&&this.afterValue>0&&(this.autoDismissTimeout=setTimeout(()=>{this.dismiss(),this.autoDismissTimeout=null},this.afterValue))}disconnect(){this.autoDismissTimeout&&clearTimeout(this.autoDismissTimeout),this.autoDismissTimeout=null}dismiss(){this.element.remove()}};var na=class extends ne{static targets=["frame","refreshButton","backButton","homeButton","maximizeLink"];connect(){this.#t(),this.srcHistory=[],this.originalFrameSrc=this.frameTarget.src,this.hasRefreshButtonTarget&&(this.refreshButtonTarget.style.display="",this.refreshButtonClicked=this.refreshButtonClicked.bind(this),this.refreshButtonTarget.addEventListener("click",this.refreshButtonClicked)),this.hasBackButtonTarget&&(this.backButtonClicked=this.backButtonClicked.bind(this),this.backButtonTarget.addEventListener("click",this.backButtonClicked)),this.hasHomeButtonTarget&&(this.homeButtonClicked=this.homeButtonClicked.bind(this),this.homeButtonTarget.addEventListener("click",this.homeButtonClicked)),this.frameLoaded=this.frameLoaded.bind(this),this.frameTarget.addEventListener("turbo:frame-load",this.frameLoaded),this.frameLoading=this.frameLoading.bind(this),this.frameTarget.addEventListener("turbo:click",this.frameLoading),this.frameTarget.addEventListener("turbo:submit-start",this.frameLoading),this.frameFailed=this.frameFailed.bind(this),this.frameTarget.addEventListener("turbo:fetch-request-error",this.frameFailed)}disconnect(){this.hasRefreshButtonTarget&&this.refreshButtonTarget.removeEventListener("click",this.refreshButtonClicked),this.hasBackButtonTarget&&this.backButtonTarget.removeEventListener("click",this.backButtonClicked),this.hasHomeButtonTarget&&this.homeButtonTarget.removeEventListener("click",this.homeButtonClicked),this.frameTarget.removeEventListener("turbo:frame-load",this.frameLoaded),this.frameTarget.removeEventListener("turbo:click",this.frameLoading),this.frameTarget.removeEventListener("turbo:submit-start",this.frameLoading),this.frameTarget.removeEventListener("turbo:fetch-request-error",this.frameFailed)}frameLoading(i){this.#t()}frameFailed(i){this.#i()}frameLoaded(i){this.#i();let e=i.target.src;this.#e(e)}refreshButtonClicked(i){this.frameLoading(null),this.frameTarget.reload()}backButtonClicked(i){this.frameLoading(null),this.srcHistory.pop(),this.frameTarget.src=this.currentSrc}homeButtonClicked(i){this.frameLoading(null),this.frameTarget.src=this.originalFrameSrc}get currentSrc(){return this.srcHistory[this.srcHistory.length-1]}#e(i){i==this.currentSrc||(i==this.originalFrameSrc?this.srcHistory=[i]:this.srcHistory.push(i)),this.#s(),this.hasMaximizeLinkTarget&&(this.maximizeLinkTarget.href=i)}#t(){this.hasRefreshButtonTarget&&this.refreshButtonTarget.classList.add("motion-safe:animate-spin"),this.frameTarget.classList.add("motion-safe:animate-pulse")}#i(){this.hasRefreshButtonTarget&&this.refreshButtonTarget.classList.remove("motion-safe:animate-spin"),this.frameTarget.classList.remove("motion-safe:animate-pulse")}#s(){this.hasHomeButtonTarget&&(this.homeButtonTarget.style.display=this.srcHistory.length>2?"":"none"),this.hasBackButtonTarget&&(this.backButtonTarget.style.display=this.srcHistory.length>1?"":"none")}};var oa=class extends ne{connect(){this.updateColorMode()}disconnect(){}updateColorMode(){localStorage.theme==="dark"||!("theme"in localStorage)&&window.matchMedia("(prefers-color-scheme: dark)").matches?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark")}setLightColorMode(){localStorage.theme="light",this.updateColorMode()}setDarkColorMode(){localStorage.theme="dark",this.updateColorMode()}setSystemColorMode(){localStorage.removeItem("theme"),this.updateColorMode()}};var{entries:fp,setPrototypeOf:np,isFrozen:Py,getPrototypeOf:Cy,getOwnPropertyDescriptor:Fy}=Object,{freeze:gt,seal:Wt,create:mp}=Object,{apply:Ac,construct:kc}=typeof Reflect<"u"&&Reflect;gt||(gt=function(e){return e});Wt||(Wt=function(e){return e});Ac||(Ac=function(e,t,r){return e.apply(t,r)});kc||(kc=function(e,t){return new e(...t)});var aa=Ot(Array.prototype.forEach),op=Ot(Array.prototype.pop),mn=Ot(Array.prototype.push),ca=Ot(String.prototype.toLowerCase),wc=Ot(String.prototype.toString),ap=Ot(String.prototype.match),gn=Ot(String.prototype.replace),_y=Ot(String.prototype.indexOf),Oy=Ot(String.prototype.trim),ni=Ot(Object.prototype.hasOwnProperty),mt=Ot(RegExp.prototype.test),vn=Ry(TypeError);function Ot(i){return function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s2&&arguments[2]!==void 0?arguments[2]:ca;np&&np(i,null);let r=e.length;for(;r--;){let s=e[r];if(typeof s=="string"){let n=t(s);n!==s&&(Py(e)||(e[r]=n),s=n)}i[s]=!0}return i}function Ly(i){for(let e=0;e/gm),By=Wt(/\${[\w\W]*}/gm),Uy=Wt(/^data-[\-\w.\u00B7-\uFFFF]/),zy=Wt(/^aria-[\-\w]+$/),gp=Wt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Hy=Wt(/^(?:\w+script|data):/i),$y=Wt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),vp=Wt(/^html$/i),qy=Wt(/^[a-z][.\w]*(-[.\w]+)+$/i),dp=Object.freeze({__proto__:null,ARIA_ATTR:zy,ATTR_WHITESPACE:$y,CUSTOM_ELEMENT:qy,DATA_ATTR:Uy,DOCTYPE_NAME:vp,ERB_EXPR:Ny,IS_ALLOWED_URI:gp,IS_SCRIPT_OR_DATA:Hy,MUSTACHE_EXPR:Dy,TMPLIT_EXPR:By}),yn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Vy=function(){return typeof window>"u"?null:window},jy=function(e,t){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null,s="data-tt-policy-suffix";t&&t.hasAttribute(s)&&(r=t.getAttribute(s));let n="dompurify"+(r?"#"+r:"");try{return e.createPolicy(n,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+n+" could not be created."),null}},pp=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function bp(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Vy(),e=Z=>bp(Z);if(e.version="3.2.2",e.removed=[],!i||!i.document||i.document.nodeType!==yn.document)return e.isSupported=!1,e;let{document:t}=i,r=t,s=r.currentScript,{DocumentFragment:n,HTMLTemplateElement:o,Node:a,Element:l,NodeFilter:c,NamedNodeMap:d=i.NamedNodeMap||i.MozNamedAttrMap,HTMLFormElement:f,DOMParser:y,trustedTypes:v}=i,x=l.prototype,P=bn(x,"cloneNode"),C=bn(x,"remove"),I=bn(x,"nextSibling"),D=bn(x,"childNodes"),q=bn(x,"parentNode");if(typeof o=="function"){let Z=t.createElement("template");Z.content&&Z.content.ownerDocument&&(t=Z.content.ownerDocument)}let M,H="",{implementation:R,createNodeIterator:G,createDocumentFragment:K,getElementsByTagName:Y}=t,{importNode:ie}=r,Q=pp();e.isSupported=typeof fp=="function"&&typeof q=="function"&&R&&R.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:oe,ERB_EXPR:le,TMPLIT_EXPR:Ae,DATA_ATTR:We,ARIA_ATTR:T,IS_SCRIPT_OR_DATA:A,ATTR_WHITESPACE:k,CUSTOM_ELEMENT:$}=dp,{IS_ALLOWED_URI:j}=dp,z=null,J=ae({},[...lp,...Sc,...Ec,...Tc,...cp]),ee=null,ke=ae({},[...up,...xc,...hp,...la]),se=Object.seal(mp(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ce=null,Me=null,Ne=!0,He=!0,fi=!1,mi=!0,Yt=!1,er=!0,Zt=!1,br=!1,ki=!1,Ut=!1,Pi=!1,Ci=!1,Ct=!0,gi=!1,tr="user-content-",Fi=!0,Qt=!1,Jt={},ei=null,yr=ae({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]),ir=null,en=ae({},["audio","video","img","source","image","track"]),fs=null,Lo=ae({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ms="http://www.w3.org/1998/Math/MathML",re="http://www.w3.org/2000/svg",zt="http://www.w3.org/1999/xhtml",vi=zt,ti=!1,tn=null,rr=ae({},[ms,re,zt],wc),Ge=ae({},["mi","mo","mn","ms","mtext"]),gs=ae({},["annotation-xml"]),Mo=ae({},["title","style","font","a","script"]),ye=null,we=["application/xhtml+xml","text/html"],Fl="text/html",Te=null,sr=null,bi=t.createElement("form"),Io=function(w){return w instanceof RegExp||w instanceof Function},Ie=function(){let w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(sr&&sr===w)){if((!w||typeof w!="object")&&(w={}),w=Or(w),ye=we.indexOf(w.PARSER_MEDIA_TYPE)===-1?Fl:w.PARSER_MEDIA_TYPE,Te=ye==="application/xhtml+xml"?wc:ca,z=ni(w,"ALLOWED_TAGS")?ae({},w.ALLOWED_TAGS,Te):J,ee=ni(w,"ALLOWED_ATTR")?ae({},w.ALLOWED_ATTR,Te):ke,tn=ni(w,"ALLOWED_NAMESPACES")?ae({},w.ALLOWED_NAMESPACES,wc):rr,fs=ni(w,"ADD_URI_SAFE_ATTR")?ae(Or(Lo),w.ADD_URI_SAFE_ATTR,Te):Lo,ir=ni(w,"ADD_DATA_URI_TAGS")?ae(Or(en),w.ADD_DATA_URI_TAGS,Te):en,ei=ni(w,"FORBID_CONTENTS")?ae({},w.FORBID_CONTENTS,Te):yr,ce=ni(w,"FORBID_TAGS")?ae({},w.FORBID_TAGS,Te):{},Me=ni(w,"FORBID_ATTR")?ae({},w.FORBID_ATTR,Te):{},Jt=ni(w,"USE_PROFILES")?w.USE_PROFILES:!1,Ne=w.ALLOW_ARIA_ATTR!==!1,He=w.ALLOW_DATA_ATTR!==!1,fi=w.ALLOW_UNKNOWN_PROTOCOLS||!1,mi=w.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Yt=w.SAFE_FOR_TEMPLATES||!1,er=w.SAFE_FOR_XML!==!1,Zt=w.WHOLE_DOCUMENT||!1,Ut=w.RETURN_DOM||!1,Pi=w.RETURN_DOM_FRAGMENT||!1,Ci=w.RETURN_TRUSTED_TYPE||!1,ki=w.FORCE_BODY||!1,Ct=w.SANITIZE_DOM!==!1,gi=w.SANITIZE_NAMED_PROPS||!1,Fi=w.KEEP_CONTENT!==!1,Qt=w.IN_PLACE||!1,j=w.ALLOWED_URI_REGEXP||gp,vi=w.NAMESPACE||zt,Ge=w.MATHML_TEXT_INTEGRATION_POINTS||Ge,gs=w.HTML_INTEGRATION_POINTS||gs,se=w.CUSTOM_ELEMENT_HANDLING||{},w.CUSTOM_ELEMENT_HANDLING&&Io(w.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(se.tagNameCheck=w.CUSTOM_ELEMENT_HANDLING.tagNameCheck),w.CUSTOM_ELEMENT_HANDLING&&Io(w.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(se.attributeNameCheck=w.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),w.CUSTOM_ELEMENT_HANDLING&&typeof w.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(se.allowCustomizedBuiltInElements=w.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Yt&&(He=!1),Pi&&(Ut=!0),Jt&&(z=ae({},cp),ee=[],Jt.html===!0&&(ae(z,lp),ae(ee,up)),Jt.svg===!0&&(ae(z,Sc),ae(ee,xc),ae(ee,la)),Jt.svgFilters===!0&&(ae(z,Ec),ae(ee,xc),ae(ee,la)),Jt.mathMl===!0&&(ae(z,Tc),ae(ee,hp),ae(ee,la))),w.ADD_TAGS&&(z===J&&(z=Or(z)),ae(z,w.ADD_TAGS,Te)),w.ADD_ATTR&&(ee===ke&&(ee=Or(ee)),ae(ee,w.ADD_ATTR,Te)),w.ADD_URI_SAFE_ATTR&&ae(fs,w.ADD_URI_SAFE_ATTR,Te),w.FORBID_CONTENTS&&(ei===yr&&(ei=Or(ei)),ae(ei,w.FORBID_CONTENTS,Te)),Fi&&(z["#text"]=!0),Zt&&ae(z,["html","head","body"]),z.table&&(ae(z,["tbody"]),delete ce.tbody),w.TRUSTED_TYPES_POLICY){if(typeof w.TRUSTED_TYPES_POLICY.createHTML!="function")throw vn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof w.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw vn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');M=w.TRUSTED_TYPES_POLICY,H=M.createHTML("")}else M===void 0&&(M=jy(v,s)),M!==null&&typeof H=="string"&&(H=M.createHTML(""));gt&>(w),sr=w}},Ft=ae({},[...Sc,...Ec,...My]),_i=ae({},[...Tc,...Iy]),_l=function(w){let B=q(w);(!B||!B.tagName)&&(B={namespaceURI:vi,tagName:"template"});let X=ca(w.tagName),ve=ca(B.tagName);return tn[w.namespaceURI]?w.namespaceURI===re?B.namespaceURI===zt?X==="svg":B.namespaceURI===ms?X==="svg"&&(ve==="annotation-xml"||Ge[ve]):!!Ft[X]:w.namespaceURI===ms?B.namespaceURI===zt?X==="math":B.namespaceURI===re?X==="math"&&gs[ve]:!!_i[X]:w.namespaceURI===zt?B.namespaceURI===re&&!gs[ve]||B.namespaceURI===ms&&!Ge[ve]?!1:!_i[X]&&(Mo[X]||!Ft[X]):!!(ye==="application/xhtml+xml"&&tn[w.namespaceURI]):!1},xt=function(w){mn(e.removed,{element:w});try{q(w).removeChild(w)}catch{C(w)}},nr=function(w,B){try{mn(e.removed,{attribute:B.getAttributeNode(w),from:B})}catch{mn(e.removed,{attribute:null,from:B})}if(B.removeAttribute(w),w==="is")if(Ut||Pi)try{xt(B)}catch{}else try{B.setAttribute(w,"")}catch{}},or=function(w){let B=null,X=null;if(ki)w=""+w;else{let Se=ap(w,/^[\r\n\t ]+/);X=Se&&Se[0]}ye==="application/xhtml+xml"&&vi===zt&&(w=''+w+"");let ve=M?M.createHTML(w):w;if(vi===zt)try{B=new y().parseFromString(ve,ye)}catch{}if(!B||!B.documentElement){B=R.createDocument(vi,"template",null);try{B.documentElement.innerHTML=ti?H:ve}catch{}}let Qe=B.body||B.documentElement;return w&&X&&Qe.insertBefore(t.createTextNode(X),Qe.childNodes[0]||null),vi===zt?Y.call(B,Zt?"html":"body")[0]:Zt?B.documentElement:Qe},Do=function(w){return G.call(w.ownerDocument||w,w,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},rn=function(w){return w instanceof f&&(typeof w.nodeName!="string"||typeof w.textContent!="string"||typeof w.removeChild!="function"||!(w.attributes instanceof d)||typeof w.removeAttribute!="function"||typeof w.setAttribute!="function"||typeof w.namespaceURI!="string"||typeof w.insertBefore!="function"||typeof w.hasChildNodes!="function")},sn=function(w){return typeof a=="function"&&w instanceof a};function Be(Z,w,B){aa(Z,X=>{X.call(e,w,B,sr)})}let pt=function(w){let B=null;if(Be(Q.beforeSanitizeElements,w,null),rn(w))return xt(w),!0;let X=Te(w.nodeName);if(Be(Q.uponSanitizeElement,w,{tagName:X,allowedTags:z}),w.hasChildNodes()&&!sn(w.firstElementChild)&&mt(/<[/\w]/g,w.innerHTML)&&mt(/<[/\w]/g,w.textContent)||w.nodeType===yn.progressingInstruction||er&&w.nodeType===yn.comment&&mt(/<[/\w]/g,w.data))return xt(w),!0;if(!z[X]||ce[X]){if(!ce[X]&&nn(X)&&(se.tagNameCheck instanceof RegExp&&mt(se.tagNameCheck,X)||se.tagNameCheck instanceof Function&&se.tagNameCheck(X)))return!1;if(Fi&&!ei[X]){let ve=q(w)||w.parentNode,Qe=D(w)||w.childNodes;if(Qe&&ve){let Se=Qe.length;for(let ut=Se-1;ut>=0;--ut){let Ht=P(Qe[ut],!0);Ht.__removalCount=(w.__removalCount||0)+1,ve.insertBefore(Ht,I(w))}}}return xt(w),!0}return w instanceof l&&!_l(w)||(X==="noscript"||X==="noembed"||X==="noframes")&&mt(/<\/no(script|embed|frames)/i,w.innerHTML)?(xt(w),!0):(Yt&&w.nodeType===yn.text&&(B=w.textContent,aa([oe,le,Ae],ve=>{B=gn(B,ve," ")}),w.textContent!==B&&(mn(e.removed,{element:w.cloneNode()}),w.textContent=B)),Be(Q.afterSanitizeElements,w,null),!1)},Oi=function(w,B,X){if(Ct&&(B==="id"||B==="name")&&(X in t||X in bi))return!1;if(!(He&&!Me[B]&&mt(We,B))){if(!(Ne&&mt(T,B))){if(!ee[B]||Me[B]){if(!(nn(w)&&(se.tagNameCheck instanceof RegExp&&mt(se.tagNameCheck,w)||se.tagNameCheck instanceof Function&&se.tagNameCheck(w))&&(se.attributeNameCheck instanceof RegExp&&mt(se.attributeNameCheck,B)||se.attributeNameCheck instanceof Function&&se.attributeNameCheck(B))||B==="is"&&se.allowCustomizedBuiltInElements&&(se.tagNameCheck instanceof RegExp&&mt(se.tagNameCheck,X)||se.tagNameCheck instanceof Function&&se.tagNameCheck(X))))return!1}else if(!fs[B]){if(!mt(j,gn(X,k,""))){if(!((B==="src"||B==="xlink:href"||B==="href")&&w!=="script"&&_y(X,"data:")===0&&ir[w])){if(!(fi&&!mt(A,gn(X,k,"")))){if(X)return!1}}}}}}return!0},nn=function(w){return w!=="annotation-xml"&&ap(w,$)},vs=function(w){Be(Q.beforeSanitizeAttributes,w,null);let{attributes:B}=w;if(!B)return;let X={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ee,forceKeepAttr:void 0},ve=B.length;for(;ve--;){let Qe=B[ve],{name:Se,namespaceURI:ut,value:Ht}=Qe,ar=Te(Se),st=Se==="value"?Ht:Oy(Ht);if(X.attrName=ar,X.attrValue=st,X.keepAttr=!0,X.forceKeepAttr=void 0,Be(Q.uponSanitizeAttribute,w,X),st=X.attrValue,gi&&(ar==="id"||ar==="name")&&(nr(Se,w),st=tr+st),er&&mt(/((--!?|])>)|<\/(style|title)/i,st)){nr(Se,w);continue}if(X.forceKeepAttr||(nr(Se,w),!X.keepAttr))continue;if(!mi&&mt(/\/>/i,st)){nr(Se,w);continue}Yt&&aa([oe,le,Ae],Bo=>{st=gn(st,Bo," ")});let No=Te(w.nodeName);if(Oi(No,ar,st)){if(M&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!ut)switch(v.getAttributeType(No,ar)){case"TrustedHTML":{st=M.createHTML(st);break}case"TrustedScriptURL":{st=M.createScriptURL(st);break}}try{ut?w.setAttributeNS(ut,Se,st):w.setAttribute(Se,st),rn(w)?xt(w):op(e.removed)}catch{}}}Be(Q.afterSanitizeAttributes,w,null)},Ol=function Z(w){let B=null,X=Do(w);for(Be(Q.beforeSanitizeShadowDOM,w,null);B=X.nextNode();)Be(Q.uponSanitizeShadowNode,B,null),!pt(B)&&(B.content instanceof n&&Z(B.content),vs(B));Be(Q.afterSanitizeShadowDOM,w,null)};return e.sanitize=function(Z){let w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},B=null,X=null,ve=null,Qe=null;if(ti=!Z,ti&&(Z=""),typeof Z!="string"&&!sn(Z))if(typeof Z.toString=="function"){if(Z=Z.toString(),typeof Z!="string")throw vn("dirty is not a string, aborting")}else throw vn("toString is not a function");if(!e.isSupported)return Z;if(br||Ie(w),e.removed=[],typeof Z=="string"&&(Qt=!1),Qt){if(Z.nodeName){let Ht=Te(Z.nodeName);if(!z[Ht]||ce[Ht])throw vn("root node is forbidden and cannot be sanitized in-place")}}else if(Z instanceof a)B=or(""),X=B.ownerDocument.importNode(Z,!0),X.nodeType===yn.element&&X.nodeName==="BODY"||X.nodeName==="HTML"?B=X:B.appendChild(X);else{if(!Ut&&!Yt&&!Zt&&Z.indexOf("<")===-1)return M&&Ci?M.createHTML(Z):Z;if(B=or(Z),!B)return Ut?null:Ci?H:""}B&&ki&&xt(B.firstChild);let Se=Do(Qt?Z:B);for(;ve=Se.nextNode();)pt(ve)||(ve.content instanceof n&&Ol(ve.content),vs(ve));if(Qt)return Z;if(Ut){if(Pi)for(Qe=K.call(B.ownerDocument);B.firstChild;)Qe.appendChild(B.firstChild);else Qe=B;return(ee.shadowroot||ee.shadowrootmode)&&(Qe=ie.call(r,Qe,!0)),Qe}let ut=Zt?B.outerHTML:B.innerHTML;return Zt&&z["!doctype"]&&B.ownerDocument&&B.ownerDocument.doctype&&B.ownerDocument.doctype.name&&mt(vp,B.ownerDocument.doctype.name)&&(ut=" `+ut),Yt&&aa([oe,le,Ae],Ht=>{ut=gn(ut,Ht," ")}),M&&Ci?M.createHTML(ut):ut},e.setConfig=function(){let Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ie(Z),br=!0},e.clearConfig=function(){sr=null,br=!1},e.isValidAttribute=function(Z,w,B){sr||Ie({});let X=Te(Z),ve=Te(w);return Oi(X,ve,B)},e.addHook=function(Z,w){typeof w=="function"&&mn(Q[Z],w)},e.removeHook=function(Z){return op(Q[Z])},e.removeHooks=function(Z){Q[Z]=[]},e.removeAllHooks=function(){Q=pp()},e}var Ts=bp();function Fc(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Lr=Fc();function xp(i){Lr=i}var En={exec:()=>null};function be(i,e=""){let t=typeof i=="string"?i:i.source,r={replace:(s,n)=>{let o=typeof n=="string"?n:n.source;return o=o.replace(vt.caret,"$1"),t=t.replace(s,o),r},getRegex:()=>new RegExp(t,e)};return r}var vt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:i=>new RegExp(`^( {0,3}${i})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}#`),htmlBeginRegex:i=>new RegExp(`^ {0,${Math.min(3,i-1)}}<(?:[a-z].*>|!--)`,"i")},Wy=/^(?:[ \t]*(?:\n|$))+/,Gy=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Ky=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,xn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Xy=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Ap=/(?:[*+-]|\d{1,9}[.)])/,kp=be(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,Ap).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),_c=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Yy=/^[^\n]+/,Oc=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Zy=be(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Oc).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),Qy=be(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Ap).getRegex(),da="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",Rc=/|$))/,Jy=be("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|\\n*|$)|\\n*|$)|)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",Rc).replace("tag",da).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),Pp=be(_c).replace("hr",xn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",da).getRegex(),e0=be(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",Pp).getRegex(),Lc={blockquote:e0,code:Gy,def:Zy,fences:Ky,heading:Xy,hr:xn,html:Jy,lheading:kp,list:Qy,newline:Wy,paragraph:Pp,table:En,text:Yy},yp=be("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",xn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",da).getRegex(),t0={...Lc,table:yp,paragraph:be(_c).replace("hr",xn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",yp).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|textarea|!--)").replace("tag",da).getRegex()},i0={...Lc,html:be(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",Rc).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:En,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:be(_c).replace("hr",xn).replace("heading",` *#{1,6} *[^ ]`).replace("lheading",kp).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Cp=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,r0=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Fp=/^( {2,}|\\)\n(?!\s*$)/,s0=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\]*?>/g,a0=be(/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,"u").replace(/punct/g,pa).getRegex(),l0=be("^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)","gu").replace(/notPunctSpace/g,_p).replace(/punctSpace/g,Mc).replace(/punct/g,pa).getRegex(),c0=be("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,_p).replace(/punctSpace/g,Mc).replace(/punct/g,pa).getRegex(),u0=be(/\\(punct)/,"gu").replace(/punct/g,pa).getRegex(),h0=be(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),d0=be(Rc).replace("(?:-->|$)","-->").getRegex(),p0=be("^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^").replace("comment",d0).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),ha=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,f0=be(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",ha).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Op=be(/^!?\[(label)\]\[(ref)\]/).replace("label",ha).replace("ref",Oc).getRegex(),Rp=be(/^!?\[(ref)\](?:\[\])?/).replace("ref",Oc).getRegex(),m0=be("reflink|nolink(?!\\()","g").replace("reflink",Op).replace("nolink",Rp).getRegex(),Ic={_backpedal:En,anyPunctuation:u0,autolink:h0,blockSkip:o0,br:Fp,code:r0,del:En,emStrongLDelim:a0,emStrongRDelimAst:l0,emStrongRDelimUnd:c0,escape:Cp,link:f0,nolink:Rp,punctuation:n0,reflink:Op,reflinkSearch:m0,tag:p0,text:s0,url:En},g0={...Ic,link:be(/^!?\[(label)\]\((.*?)\)/).replace("label",ha).getRegex(),reflink:be(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",ha).getRegex()},Pc={...Ic,escape:be(Cp).replace("])","~|])").getRegex(),url:be(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\":">",'"':""","'":"'"},wp=i=>b0[i];function wi(i,e){if(e){if(vt.escapeTest.test(i))return i.replace(vt.escapeReplace,wp)}else if(vt.escapeTestNoEncode.test(i))return i.replace(vt.escapeReplaceNoEncode,wp);return i}function Sp(i){try{i=encodeURI(i).replace(vt.percentDecode,"%")}catch{return null}return i}function Ep(i,e){let t=i.replace(vt.findPipe,(n,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),r=t.split(vt.splitPipe),s=0;if(r[0].trim()||r.shift(),r.length>0&&!r.at(-1)?.trim()&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length{let o=n.match(t.other.beginningSpace);if(o===null)return n;let[a]=o;return a.length>=s.length?n.slice(s.length):n}).join(` `)}var As=class{options;rules;lexer;constructor(e){this.options=e||Lr}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let r=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?r:Sn(r,` `)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let r=t[0],s=w0(r,t[3]||"",this.rules);return{type:"code",raw:r,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:s}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let r=t[2].trim();if(this.rules.other.endingHash.test(r)){let s=Sn(r,"#");(this.options.pedantic||!s||this.rules.other.endingSpaceChar.test(s))&&(r=s.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:r,tokens:this.lexer.inline(r)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:"hr",raw:Sn(t[0],` `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let r=Sn(t[0],` `).split(` `),s="",n="",o=[];for(;r.length>0;){let a=!1,l=[],c;for(c=0;c1,n={type:"list",raw:"",ordered:s,start:s?+r.slice(0,-1):"",loose:!1,items:[]};r=s?`\\d{1,9}\\${r.slice(-1)}`:`\\${r}`,this.options.pedantic&&(r=s?r:"[*+-]");let o=this.rules.other.listItemRegex(r),a=!1;for(;e;){let c=!1,d="",f="";if(!(t=o.exec(e))||this.rules.block.hr.test(e))break;d=t[0],e=e.substring(d.length);let y=t[2].split(` `,1)[0].replace(this.rules.other.listReplaceTabs,D=>" ".repeat(3*D.length)),v=e.split(` `,1)[0],x=!y.trim(),P=0;if(this.options.pedantic?(P=2,f=y.trimStart()):x?P=t[1].length+1:(P=t[2].search(this.rules.other.nonSpaceChar),P=P>4?1:P,f=y.slice(P),P+=t[1].length),x&&this.rules.other.blankLine.test(v)&&(d+=v+` `,e=e.substring(v.length+1),c=!0),!c){let D=this.rules.other.nextBulletRegex(P),q=this.rules.other.hrRegex(P),M=this.rules.other.fencesBeginRegex(P),H=this.rules.other.headingBeginRegex(P),R=this.rules.other.htmlBeginRegex(P);for(;e;){let G=e.split(` `,1)[0],K;if(v=G,this.options.pedantic?(v=v.replace(this.rules.other.listReplaceNesting," "),K=v):K=v.replace(this.rules.other.tabCharGlobal," "),M.test(v)||H.test(v)||R.test(v)||D.test(v)||q.test(v))break;if(K.search(this.rules.other.nonSpaceChar)>=P||!v.trim())f+=` `+K.slice(P);else{if(x||y.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||M.test(y)||H.test(y)||q.test(y))break;f+=` `+v}!x&&!v.trim()&&(x=!0),d+=G+` `,e=e.substring(G.length+1),y=K.slice(P)}}n.loose||(a?n.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(a=!0));let C=null,I;this.options.gfm&&(C=this.rules.other.listIsTask.exec(f),C&&(I=C[0]!=="[ ] ",f=f.replace(this.rules.other.listReplaceTask,""))),n.items.push({type:"list_item",raw:d,task:!!C,checked:I,loose:!1,text:f,tokens:[]}),n.raw+=d}let l=n.items.at(-1);l&&(l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd()),n.raw=n.raw.trimEnd();for(let c=0;cy.type==="space"),f=d.length>0&&d.some(y=>this.rules.other.anyLine.test(y.raw));n.loose=f}if(n.loose)for(let c=0;c({text:l,tokens:this.lexer.inline(l),header:!1,align:o.align[c]})));return o}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let r=t[1].charAt(t[1].length-1)===` `?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:r,tokens:this.lexer.inline(r)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let o=Sn(r.slice(0,-1),"\\");if((r.length-o.length)%2===0)return}else{let o=y0(t[2],"()");if(o>-1){let l=(t[0].indexOf("!")===0?5:4)+t[1].length+o;t[2]=t[2].substring(0,o),t[0]=t[0].substring(0,l).trim(),t[3]=""}}let s=t[2],n="";if(this.options.pedantic){let o=this.rules.other.pedanticHrefTitle.exec(s);o&&(s=o[1],n=o[3])}else n=t[3]?t[3].slice(1,-1):"";return s=s.trim(),this.rules.other.startAngleBracket.test(s)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?s=s.slice(1):s=s.slice(1,-1)),Tp(t,{href:s&&s.replace(this.rules.inline.anyPunctuation,"$1"),title:n&&n.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(e,t){let r;if((r=this.rules.inline.reflink.exec(e))||(r=this.rules.inline.nolink.exec(e))){let s=(r[2]||r[1]).replace(this.rules.other.multipleSpaceGlobal," "),n=t[s.toLowerCase()];if(!n){let o=r[0].charAt(0);return{type:"text",raw:o,text:o}}return Tp(r,n,r[0],this.lexer,this.rules)}}emStrong(e,t,r=""){let s=this.rules.inline.emStrongLDelim.exec(e);if(!s||s[3]&&r.match(this.rules.other.unicodeAlphaNumeric))return;if(!(s[1]||s[2]||"")||!r||this.rules.inline.punctuation.exec(r)){let o=[...s[0]].length-1,a,l,c=o,d=0,f=s[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(f.lastIndex=0,t=t.slice(-1*e.length+o);(s=f.exec(t))!=null;){if(a=s[1]||s[2]||s[3]||s[4]||s[5]||s[6],!a)continue;if(l=[...a].length,s[3]||s[4]){c+=l;continue}else if((s[5]||s[6])&&o%3&&!((o+l)%3)){d+=l;continue}if(c-=l,c>0)continue;l=Math.min(l,l+c+d);let y=[...s[0]][0].length,v=e.slice(0,o+s.index+y+l);if(Math.min(o,l)%2){let P=v.slice(1,-1);return{type:"em",raw:v,text:P,tokens:this.lexer.inlineTokens(P)}}let x=v.slice(2,-2);return{type:"strong",raw:v,text:x,tokens:this.lexer.inlineTokens(x)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let r=t[2].replace(this.rules.other.newLineCharGlobal," "),s=this.rules.other.nonSpaceChar.test(r),n=this.rules.other.startingSpaceChar.test(r)&&this.rules.other.endingSpaceChar.test(r);return s&&n&&(r=r.substring(1,r.length-1)),{type:"codespan",raw:t[0],text:r}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let r,s;return t[2]==="@"?(r=t[1],s="mailto:"+r):(r=t[1],s=r),{type:"link",raw:t[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let r,s;if(t[2]==="@")r=t[0],s="mailto:"+r;else{let n;do n=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??"";while(n!==t[0]);r=t[0],t[1]==="www."?s="http://"+t[0]:s=t[0]}return{type:"link",raw:t[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let r=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:r}}}},oi=class i{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Lr,this.options.tokenizer=this.options.tokenizer||new As,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={other:vt,block:ua.normal,inline:wn.normal};this.options.pedantic?(t.block=ua.pedantic,t.inline=wn.pedantic):this.options.gfm&&(t.block=ua.gfm,this.options.breaks?t.inline=wn.breaks:t.inline=wn.gfm),this.tokenizer.rules=t}static get rules(){return{block:ua,inline:wn}}static lex(e,t){return new i(t).lex(e)}static lexInline(e,t){return new i(t).inlineTokens(e)}lex(e){e=e.replace(vt.carriageReturn,` `),this.blockTokens(e,this.tokens);for(let t=0;t(s=o.call({lexer:this},e,t))?(e=e.substring(s.raw.length),t.push(s),!0):!1))continue;if(s=this.tokenizer.space(e)){e=e.substring(s.raw.length);let o=t.at(-1);s.raw.length===1&&o!==void 0?o.raw+=` `:t.push(s);continue}if(s=this.tokenizer.code(e)){e=e.substring(s.raw.length);let o=t.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=` `+s.raw,o.text+=` `+s.text,this.inlineQueue.at(-1).src=o.text):t.push(s);continue}if(s=this.tokenizer.fences(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.heading(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.hr(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.blockquote(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.list(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.html(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.def(e)){e=e.substring(s.raw.length);let o=t.at(-1);o?.type==="paragraph"||o?.type==="text"?(o.raw+=` `+s.raw,o.text+=` `+s.raw,this.inlineQueue.at(-1).src=o.text):this.tokens.links[s.tag]||(this.tokens.links[s.tag]={href:s.href,title:s.title});continue}if(s=this.tokenizer.table(e)){e=e.substring(s.raw.length),t.push(s);continue}if(s=this.tokenizer.lheading(e)){e=e.substring(s.raw.length),t.push(s);continue}let n=e;if(this.options.extensions?.startBlock){let o=1/0,a=e.slice(1),l;this.options.extensions.startBlock.forEach(c=>{l=c.call({lexer:this},a),typeof l=="number"&&l>=0&&(o=Math.min(o,l))}),o<1/0&&o>=0&&(n=e.substring(0,o+1))}if(this.state.top&&(s=this.tokenizer.paragraph(n))){let o=t.at(-1);r&&o?.type==="paragraph"?(o.raw+=` `+s.raw,o.text+=` `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(s),r=n.length!==e.length,e=e.substring(s.raw.length);continue}if(s=this.tokenizer.text(e)){e=e.substring(s.raw.length);let o=t.at(-1);o?.type==="text"?(o.raw+=` `+s.raw,o.text+=` `+s.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=o.text):t.push(s);continue}if(e){let o="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(o);break}else throw new Error(o)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let r=e,s=null;if(this.tokens.links){let a=Object.keys(this.tokens.links);if(a.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)a.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let n=!1,o="";for(;e;){n||(o=""),n=!1;let a;if(this.options.extensions?.inline?.some(c=>(a=c.call({lexer:this},e,t))?(e=e.substring(a.raw.length),t.push(a),!0):!1))continue;if(a=this.tokenizer.escape(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.tag(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.link(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(a.raw.length);let c=t.at(-1);a.type==="text"&&c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):t.push(a);continue}if(a=this.tokenizer.emStrong(e,r,o)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.codespan(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.br(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.del(e)){e=e.substring(a.raw.length),t.push(a);continue}if(a=this.tokenizer.autolink(e)){e=e.substring(a.raw.length),t.push(a);continue}if(!this.state.inLink&&(a=this.tokenizer.url(e))){e=e.substring(a.raw.length),t.push(a);continue}let l=e;if(this.options.extensions?.startInline){let c=1/0,d=e.slice(1),f;this.options.extensions.startInline.forEach(y=>{f=y.call({lexer:this},d),typeof f=="number"&&f>=0&&(c=Math.min(c,f))}),c<1/0&&c>=0&&(l=e.substring(0,c+1))}if(a=this.tokenizer.inlineText(l)){e=e.substring(a.raw.length),a.raw.slice(-1)!=="_"&&(o=a.raw.slice(-1)),n=!0;let c=t.at(-1);c?.type==="text"?(c.raw+=a.raw,c.text+=a.text):t.push(a);continue}if(e){let c="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(c);break}else throw new Error(c)}}return t}},ks=class{options;parser;constructor(e){this.options=e||Lr}space(e){return""}code({text:e,lang:t,escaped:r}){let s=(t||"").match(vt.notSpaceStart)?.[0],n=e.replace(vt.endingNewline,"")+` `;return s?'
'+(r?n:wi(n,!0))+`
`:"
"+(r?n:wi(n,!0))+`
`}blockquote({tokens:e}){return`
${this.parser.parse(e)}
`}html({text:e}){return e}heading({tokens:e,depth:t}){return`${this.parser.parseInline(e)} `}hr(e){return`
`}list(e){let t=e.ordered,r=e.start,s="";for(let a=0;a `+s+" `}listitem(e){let t="";if(e.task){let r=this.checkbox({checked:!!e.checked});e.loose?e.tokens[0]?.type==="paragraph"?(e.tokens[0].text=r+" "+e.tokens[0].text,e.tokens[0].tokens&&e.tokens[0].tokens.length>0&&e.tokens[0].tokens[0].type==="text"&&(e.tokens[0].tokens[0].text=r+" "+wi(e.tokens[0].tokens[0].text),e.tokens[0].tokens[0].escaped=!0)):e.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):t+=r+" "}return t+=this.parser.parse(e.tokens,!!e.loose),`
  • ${t}
  • `}checkbox({checked:e}){return"'}paragraph({tokens:e}){return`

    ${this.parser.parseInline(e)}

    `}table(e){let t="",r="";for(let n=0;n${s}`),` `+t+` `+s+`
    `}tablerow({text:e}){return` ${e} `}tablecell(e){let t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+` `}strong({tokens:e}){return`${this.parser.parseInline(e)}`}em({tokens:e}){return`${this.parser.parseInline(e)}`}codespan({text:e}){return`${wi(e,!0)}`}br(e){return"
    "}del({tokens:e}){return`${this.parser.parseInline(e)}`}link({href:e,title:t,tokens:r}){let s=this.parser.parseInline(r),n=Sp(e);if(n===null)return s;e=n;let o='
    ",o}image({href:e,title:t,text:r}){let s=Sp(e);if(s===null)return wi(r);e=s;let n=`${r}{let a=n[o].flat(1/0);r=r.concat(this.walkTokens(a,t))}):n.tokens&&(r=r.concat(this.walkTokens(n.tokens,t)))}}return r}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(r=>{let s={...r};if(s.async=this.defaults.async||s.async||!1,r.extensions&&(r.extensions.forEach(n=>{if(!n.name)throw new Error("extension name required");if("renderer"in n){let o=t.renderers[n.name];o?t.renderers[n.name]=function(...a){let l=n.renderer.apply(this,a);return l===!1&&(l=o.apply(this,a)),l}:t.renderers[n.name]=n.renderer}if("tokenizer"in n){if(!n.level||n.level!=="block"&&n.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let o=t[n.level];o?o.unshift(n.tokenizer):t[n.level]=[n.tokenizer],n.start&&(n.level==="block"?t.startBlock?t.startBlock.push(n.start):t.startBlock=[n.start]:n.level==="inline"&&(t.startInline?t.startInline.push(n.start):t.startInline=[n.start]))}"childTokens"in n&&n.childTokens&&(t.childTokens[n.name]=n.childTokens)}),s.extensions=t),r.renderer){let n=this.defaults.renderer||new ks(this.defaults);for(let o in r.renderer){if(!(o in n))throw new Error(`renderer '${o}' does not exist`);if(["options","parser"].includes(o))continue;let a=o,l=r.renderer[a],c=n[a];n[a]=(...d)=>{let f=l.apply(n,d);return f===!1&&(f=c.apply(n,d)),f||""}}s.renderer=n}if(r.tokenizer){let n=this.defaults.tokenizer||new As(this.defaults);for(let o in r.tokenizer){if(!(o in n))throw new Error(`tokenizer '${o}' does not exist`);if(["options","rules","lexer"].includes(o))continue;let a=o,l=r.tokenizer[a],c=n[a];n[a]=(...d)=>{let f=l.apply(n,d);return f===!1&&(f=c.apply(n,d)),f}}s.tokenizer=n}if(r.hooks){let n=this.defaults.hooks||new xs;for(let o in r.hooks){if(!(o in n))throw new Error(`hook '${o}' does not exist`);if(["options","block"].includes(o))continue;let a=o,l=r.hooks[a],c=n[a];xs.passThroughHooks.has(o)?n[a]=d=>{if(this.defaults.async)return Promise.resolve(l.call(n,d)).then(y=>c.call(n,y));let f=l.call(n,d);return c.call(n,f)}:n[a]=(...d)=>{let f=l.apply(n,d);return f===!1&&(f=c.apply(n,d)),f}}s.hooks=n}if(r.walkTokens){let n=this.defaults.walkTokens,o=r.walkTokens;s.walkTokens=function(a){let l=[];return l.push(o.call(this,a)),n&&(l=l.concat(n.call(this,a))),l}}this.defaults={...this.defaults,...s}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return oi.lex(e,t??this.defaults)}parser(e,t){return ai.parse(e,t??this.defaults)}parseMarkdown(e){return(r,s)=>{let n={...s},o={...this.defaults,...n},a=this.onError(!!o.silent,!!o.async);if(this.defaults.async===!0&&n.async===!1)return a(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof r>"u"||r===null)return a(new Error("marked(): input parameter is undefined or null"));if(typeof r!="string")return a(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(r)+", string expected"));o.hooks&&(o.hooks.options=o,o.hooks.block=e);let l=o.hooks?o.hooks.provideLexer():e?oi.lex:oi.lexInline,c=o.hooks?o.hooks.provideParser():e?ai.parse:ai.parseInline;if(o.async)return Promise.resolve(o.hooks?o.hooks.preprocess(r):r).then(d=>l(d,o)).then(d=>o.hooks?o.hooks.processAllTokens(d):d).then(d=>o.walkTokens?Promise.all(this.walkTokens(d,o.walkTokens)).then(()=>d):d).then(d=>c(d,o)).then(d=>o.hooks?o.hooks.postprocess(d):d).catch(a);try{o.hooks&&(r=o.hooks.preprocess(r));let d=l(r,o);o.hooks&&(d=o.hooks.processAllTokens(d)),o.walkTokens&&this.walkTokens(d,o.walkTokens);let f=c(d,o);return o.hooks&&(f=o.hooks.postprocess(f)),f}catch(d){return a(d)}}}onError(e,t){return r=>{if(r.message+=` Please report this to https://github.com/markedjs/marked.`,e){let s="

    An error occurred:

    "+wi(r.message+"",!0)+"
    ";return t?Promise.resolve(s):s}if(t)return Promise.reject(r);throw r}}},Rr=new Cc;function me(i,e){return Rr.parse(i,e)}me.options=me.setOptions=function(i){return Rr.setOptions(i),me.defaults=Rr.defaults,xp(me.defaults),me};me.getDefaults=Fc;me.defaults=Lr;me.use=function(...i){return Rr.use(...i),me.defaults=Rr.defaults,xp(me.defaults),me};me.walkTokens=function(i,e){return Rr.walkTokens(i,e)};me.parseInline=Rr.parseInline;me.Parser=ai;me.parser=ai.parse;me.Renderer=ks;me.TextRenderer=Tn;me.Lexer=oi;me.lexer=oi.lex;me.Tokenizer=As;me.Hooks=xs;me.parse=me;var RP=me.options,LP=me.setOptions,MP=me.use,IP=me.walkTokens,DP=me.parseInline;var NP=ai.parse,BP=oi.lex;var fa=class extends ne{connect(){this.easyMDE=new EasyMDE(this.#e()),this.element.setAttribute("data-action","turbo:morph-element->easymde#reconnect")}disconnect(){this.easyMDE.toTextArea(),this.easyMDE=null}reconnect(){this.disconnect(),this.connect()}#e(){let i={element:this.element,promptURLs:!0,spellChecker:!1,previewRender:e=>{let t=Ts.sanitize(e,{ALLOWED_TAGS:["strong","em","sub","sup","details","summary"],ALLOWED_ATTR:[]}),r=me(t);return Ts.sanitize(r,{USE_PROFILES:{html:!0}})}};return this.element.attributes.id.value&&(i.autosave={enabled:!0,uniqueId:this.element.attributes.id.value,delay:1e3}),i}};var ma=class extends ne{connect(){this.slimSelect=new SlimSelect({select:this.element}),this.element.setAttribute("data-action","turbo:morph-element->slim-select#reconnect")}disconnect(){this.slimSelect.destroy(),this.slimSelect=null}reconnect(){this.disconnect(),setTimeout(()=>this.connect(),10)}};var ga=class extends ne{connect(){this.picker=new flatpickr(this.element,this.#e()),this.element.setAttribute("data-action","turbo:morph-element->flatpickr#reconnect")}disconnect(){this.picker.destroy(),this.picker=null}reconnect(){this.disconnect(),this.connect()}#e(){let i={altInput:!0};return this.element.attributes.type.value=="datetime-local"?i.enableTime=!0:this.element.attributes.type.value=="time"&&(i.enableTime=!0,i.noCalendar=!0),i}};var va=class extends ne{static targets=["input"];connect(){}disconnect(){this.inputTargetDisconnected()}inputTargetConnected(){this.hasInputTarget&&(this.iti=window.intlTelInput(this.inputTarget,this.#e()),this.inputTarget.setAttribute("data-action","turbo:morph-element->intl-tel-input#reconnect"))}inputTargetDisconnected(){this.iti&&this.iti.destroy(),this.iti=null}reconnect(){this.inputTargetDisconnected(),this.inputTargetConnected()}#e(){return{strictMode:!0,hiddenInput:()=>({phone:this.inputTarget.attributes.name.value}),loadUtilsOnInit:"https://cdn.jsdelivr.net/npm/intl-tel-input@24.8.1/build/js/utils.js"}}};var ba=class extends ne{static targets=["select"];navigate(i){let e=this.selectTarget.value,t=document.createElement("a");t.href=e,this.element.appendChild(t),t.click(),t.remove()}};var ya=class extends ne{static targets=["btn","tab"];static values={defaultTab:String,activeClasses:String,inActiveClasses:String};connect(){this.activeClasses=this.hasActiveClassesValue?this.activeClassesValue.split(" "):[],this.inActiveClasses=this.hasInActiveClassesValue?this.inActiveClassesValue.split(" "):[],this.#e(this.defaultTabValue||this.btnTargets[0].id)}select(i){this.#e(i.currentTarget.id)}#e(i){let e=this.btnTargets.find(r=>r.id===i);if(!e){console.error(`Tab Button with id "${i}" not found`);return}let t=this.tabTargets.find(r=>r.id===e.dataset.target);if(!t){console.error(`Tab Panel with id "${e.dataset.target}" not found`);return}this.tabTargets.forEach(r=>{r.hidden=!0,r.setAttribute("aria-hidden","true")}),this.btnTargets.forEach(r=>{r.setAttribute("aria-selected","false"),r.setAttribute("tabindex","-1"),r.classList.remove(...this.activeClasses),r.classList.add(...this.inActiveClasses)}),e.setAttribute("aria-selected","true"),e.setAttribute("tabindex","0"),e.classList.remove(...this.inActiveClasses),e.classList.add(...this.activeClasses),t.hidden=!1,t.setAttribute("aria-hidden","false"),e!==document.activeElement&&e.focus()}};function wa(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var S0=0;function Mp(i){return"__private_"+S0+++"_"+i}function E0(i,e,t){let r=[];return i.forEach(s=>typeof s!="string"?r.push(s):e[Symbol.split](s).forEach((n,o,a)=>{n!==""&&r.push(n),o{throw new Error(`missing string: ${i}`)},An=Mp("onMissingKey"),kn=Mp("apply"),Mr=class{constructor(e,t){let{onMissingKey:r=T0}=t===void 0?{}:t;Object.defineProperty(this,kn,{value:x0}),Object.defineProperty(this,An,{writable:!0,value:void 0}),this.locale={strings:{},pluralize(s){return s===1?0:1}},Array.isArray(e)?e.forEach(wa(this,kn)[kn],this):wa(this,kn)[kn](e),wa(this,An)[An]=r}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){let r=this.locale.strings[e];if(r==null&&(wa(this,An)[An](e),r=e),typeof r=="object"){if(t&&typeof t.smart_count<"u"){let n=this.locale.pluralize(t.smart_count);return Lp(r[n],t)}throw new Error("Attempted to use a string with plural forms, but no value was given for %{smart_count}")}if(typeof r!="string")throw new Error("string was not a string");return Lp(r,t)}};function x0(i){if(!(i!=null&&i.strings))return;let e=this.locale;Object.assign(this.locale,{strings:{...e.strings,...i.strings},pluralize:i.pluralize||e.pluralize})}var Lf=Ce(Dp(),1);var A0="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var Np=(i=21)=>{let e="",t=i|0;for(;t--;)e+=A0[Math.random()*64|0];return e};var Mf=Ce(vf(),1);function Ea(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var bw=0;function bf(i){return"__private_"+bw+++"_"+i}var yw={version:"4.1.2"},Ir=bf("callbacks"),zc=bf("publish"),Ta=class{constructor(){Object.defineProperty(this,zc,{value:ww}),this.state={},Object.defineProperty(this,Ir,{writable:!0,value:new Set})}getState(){return this.state}setState(e){let t={...this.state},r={...this.state,...e};this.state=r,Ea(this,zc)[zc](t,r,e)}subscribe(e){return Ea(this,Ir)[Ir].add(e),()=>{Ea(this,Ir)[Ir].delete(e)}}};function ww(){for(var i=arguments.length,e=new Array(i),t=0;t{r(...e)})}Ta.VERSION=yw.version;var yf=Ta;function Dr(i){let e=i.lastIndexOf(".");return e===-1||e===i.length-1?{name:i,extension:void 0}:{name:i.slice(0,e),extension:i.slice(e+1)}}var Hc={__proto__:null,md:"text/markdown",markdown:"text/markdown",mp4:"video/mp4",mp3:"audio/mp3",svg:"image/svg+xml",jpg:"image/jpeg",png:"image/png",webp:"image/webp",gif:"image/gif",heic:"image/heic",heif:"image/heif",yaml:"text/yaml",yml:"text/yaml",csv:"text/csv",tsv:"text/tab-separated-values",tab:"text/tab-separated-values",avi:"video/x-msvideo",mks:"video/x-matroska",mkv:"video/x-matroska",mov:"video/quicktime",dicom:"application/dicom",doc:"application/msword",docm:"application/vnd.ms-word.document.macroenabled.12",docx:"application/vnd.openxmlformats-officedocument.wordprocessingml.document",dot:"application/msword",dotm:"application/vnd.ms-word.template.macroenabled.12",dotx:"application/vnd.openxmlformats-officedocument.wordprocessingml.template",xla:"application/vnd.ms-excel",xlam:"application/vnd.ms-excel.addin.macroenabled.12",xlc:"application/vnd.ms-excel",xlf:"application/x-xliff+xml",xlm:"application/vnd.ms-excel",xls:"application/vnd.ms-excel",xlsb:"application/vnd.ms-excel.sheet.binary.macroenabled.12",xlsm:"application/vnd.ms-excel.sheet.macroenabled.12",xlsx:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",xlt:"application/vnd.ms-excel",xltm:"application/vnd.ms-excel.template.macroenabled.12",xltx:"application/vnd.openxmlformats-officedocument.spreadsheetml.template",xlw:"application/vnd.ms-excel",txt:"text/plain",text:"text/plain",conf:"text/plain",log:"text/plain",pdf:"application/pdf",zip:"application/zip","7z":"application/x-7z-compressed",rar:"application/x-rar-compressed",tar:"application/x-tar",gz:"application/gzip",dmg:"application/x-apple-diskimage"};function Cn(i){var e;if(i.type)return i.type;let t=i.name?(e=Dr(i.name).extension)==null?void 0:e.toLowerCase():null;return t&&t in Hc?Hc[t]:"application/octet-stream"}function Sw(i){return i.charCodeAt(0).toString(32)}function wf(i){let e="";return i.replace(/[^A-Z0-9]/gi,t=>(e+=`-${Sw(t)}`,"/"))+e}function Sf(i,e){let t=e||"uppy";return typeof i.name=="string"&&(t+=`-${wf(i.name.toLowerCase())}`),i.type!==void 0&&(t+=`-${i.type}`),i.meta&&typeof i.meta.relativePath=="string"&&(t+=`-${wf(i.meta.relativePath.toLowerCase())}`),i.data.size!==void 0&&(t+=`-${i.data.size}`),i.data.lastModified!==void 0&&(t+=`-${i.data.lastModified}`),t}function Ew(i){return!i.isRemote||!i.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(i.remote.provider)}function xa(i,e){if(Ew(i))return i.id;let t=Cn(i);return Sf({...i,type:t},e)}function $c(i){if(i==null&&typeof navigator<"u"&&(i=navigator.userAgent),!i)return!0;let e=/Edge\/(\d+\.\d+)/.exec(i);if(!e)return!0;let r=e[1].split(".",2),s=parseInt(r[0],10),n=parseInt(r[1],10);return s<15||s===15&&n<15063||s>18||s===18&&n>=18218}function qc(i,e){return e.name?e.name:i.split("/")[0]==="image"?`${i.split("/")[0]}.${i.split("/")[1]}`:"noname"}function Vc(i){return i<10?`0${i}`:i.toString()}function Ps(){let i=new Date,e=Vc(i.getHours()),t=Vc(i.getMinutes()),r=Vc(i.getSeconds());return`${e}:${t}:${r}`}var Ef={debug:()=>{},warn:()=>{},error:function(){for(var i=arguments.length,e=new Array(i),t=0;t{var r;let s=e();if(((r=s.restrictions)==null?void 0:r.allowedFileTypes)!=null&&!Array.isArray(s.restrictions.allowedFileTypes))throw new TypeError("`restrictions.allowedFileTypes` must be an array");return s}}validateAggregateRestrictions(e,t){let{maxTotalFileSize:r,maxNumberOfFiles:s}=this.getOpts().restrictions;if(s&&e.filter(o=>!o.isGhost).length+t.length>s)throw new kt(`${this.getI18n()("youCanOnlyUploadX",{smart_count:s})}`);if(r){let n=[...e,...t].reduce((o,a)=>{var l;return o+((l=a.size)!=null?l:0)},0);if(n>r)throw new kt(this.getI18n()("aggregateExceedsSize",{sizeAllowed:(0,Fn.default)(r),size:(0,Fn.default)(n)}))}}validateSingleFile(e){let{maxFileSize:t,minFileSize:r,allowedFileTypes:s}=this.getOpts().restrictions;if(s&&!s.some(a=>a.includes("/")?e.type?(0,_f.default)(e.type.replace(/;.*?$/,""),a):!1:a[0]==="."&&e.extension?e.extension.toLowerCase()===a.slice(1).toLowerCase():!1)){let a=s.join(", ");throw new kt(this.getI18n()("youCanOnlyUploadFileTypes",{types:a}),{file:e})}if(t&&e.size!=null&&e.size>t){var n;throw new kt(this.getI18n()("exceedsSize",{size:(0,Fn.default)(t),file:(n=e.name)!=null?n:this.getI18n()("unnamed")}),{file:e})}if(r&&e.size!=null&&e.size{this.validateSingleFile(r)}),this.validateAggregateRestrictions(e,t)}validateMinNumberOfFiles(e){let{minNumberOfFiles:t}=this.getOpts().restrictions;if(t&&Object.keys(e).length{let o=s?this.getFile(s.id):void 0;if(s==null||!o){this.log(`Not setting progress for a file that has been removed: ${s?.id}`);return}if(o.progress.percentage===100){this.log(`Not setting progress for a file that has been already uploaded: ${s.id}`);return}let a={bytesTotal:n.bytesTotal,percentage:n.bytesTotal!=null&&Number.isFinite(n.bytesTotal)&&n.bytesTotal>0?Math.round(n.bytesUploaded/n.bytesTotal*100):void 0};o.progress.uploadStarted!=null?this.setFileState(s.id,{progress:{...o.progress,...a,bytesUploaded:n.bytesUploaded}}):this.setFileState(s.id,{progress:{...o.progress,...a}}),W(this,$i)[$i]()}}),Object.defineProperty(this,$i,{writable:!0,value:(0,Mf.default)(()=>W(this,Mn)[Mn](),500,{leading:!0,trailing:!0})}),Object.defineProperty(this,li,{writable:!0,value:this.updateOnlineStatus.bind(this)}),Object.defineProperty(this,In,{writable:!0,value:new Map}),this.defaultLocale=Rf;let t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:Of,meta:{},onBeforeFileAdded:(s,n)=>!Object.hasOwn(n,s.id),onBeforeUpload:s=>s,store:new yf,logger:Ef,infoTimeout:5e3},r={...t,...e};this.opts={...r,restrictions:{...t.restrictions,...e&&e.restrictions}},e&&e.logger&&e.debug?this.log("You are using a custom `logger`, but also set `debug: true`, which uses built-in logger to output logs to console. Ignoring `debug: true` and using your custom `logger`.","warning"):e&&e.debug&&(this.opts.logger=Tf),this.log(`Using Core v${i.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...Pa,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:$c(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),W(this,at)[at]=new ka(()=>this.opts,()=>this.i18n),W(this,_n)[_n]=this.store.subscribe((s,n,o)=>{this.emit("state-update",s,n,o),this.updateAll(n)}),this.opts.debug&&typeof window<"u"&&(window[this.opts.id]=this),W(this,Wc)[Wc]()}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s{t.update(e)})}setState(e){this.store.setState(e)}getState(){return this.store.getState()}patchFilesState(e){let t=this.getState().files;this.setState({files:{...t,...Object.fromEntries(Object.entries(e).map(r=>{let[s,n]=r;return[s,{...t[s],...n}]}))}})}setFileState(e,t){if(!this.getState().files[e])throw new Error(`Can\u2019t set state for ${e} (the file could have been removed)`);this.patchFilesState({[e]:t})}i18nInit(){let e=r=>this.log(`Missing i18n string: ${r}`,"error"),t=new Mr([this.defaultLocale,this.opts.locale],{onMissingKey:e});this.i18n=t.translate.bind(t),this.i18nArray=t.translateArray.bind(t),this.locale=t.locale}setOptions(e){this.opts={...this.opts,...e,restrictions:{...this.opts.restrictions,...e?.restrictions}},e.meta&&this.setMeta(e.meta),this.i18nInit(),e.locale&&this.iteratePlugins(t=>{t.setOptions(e)}),this.setState(void 0)}resetProgress(){let e={percentage:0,bytesUploaded:!1,uploadComplete:!1,uploadStarted:null},t={...this.getState().files},r=Object.create(null);Object.keys(t).forEach(s=>{r[s]={...t[s],progress:{...t[s].progress,...e},tus:void 0,transloadit:void 0}}),this.setState({files:r,...Pa})}clear(){let{capabilities:e,currentUploads:t}=this.getState();if(Object.keys(t).length>0&&!e.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");this.setState({...Pa,files:{}})}addPreProcessor(e){W(this,Nr)[Nr].add(e)}removePreProcessor(e){return W(this,Nr)[Nr].delete(e)}addPostProcessor(e){W(this,Hi)[Hi].add(e)}removePostProcessor(e){return W(this,Hi)[Hi].delete(e)}addUploader(e){W(this,Br)[Br].add(e)}removeUploader(e){return W(this,Br)[Br].delete(e)}setMeta(e){let t={...this.getState().meta,...e},r={...this.getState().files};Object.keys(r).forEach(s=>{r[s]={...r[s],meta:{...r[s].meta,...e}}}),this.log("Adding metadata:"),this.log(e),this.setState({meta:t,files:r})}setFileMeta(e,t){let r={...this.getState().files};if(!r[e]){this.log(`Was trying to set metadata for a file that has been removed: ${e}`);return}let s={...r[e].meta,...t};r[e]={...r[e],meta:s},this.setState({files:r})}getFile(e){return this.getState().files[e]}getFiles(){let{files:e}=this.getState();return Object.values(e)}getFilesByIds(e){return e.map(t=>this.getFile(t))}getObjectOfFilesPerState(){let{files:e,totalProgress:t,error:r}=this.getState(),s=Object.values(e),n=[],o=[],a=[],l=[],c=[],d=[],f=[],y=[],v=[];for(let x of s){let{progress:P}=x;!P.uploadComplete&&P.uploadStarted&&(n.push(x),x.isPaused||y.push(x)),P.uploadStarted||o.push(x),(P.uploadStarted||P.preprocess||P.postprocess)&&a.push(x),P.uploadStarted&&l.push(x),x.isPaused&&c.push(x),P.uploadComplete&&d.push(x),x.error&&f.push(x),(P.preprocess||P.postprocess)&&v.push(x)}return{newFiles:o,startedFiles:a,uploadStartedFiles:l,pausedFiles:c,completeFiles:d,erroredFiles:f,inProgressFiles:n,inProgressNotPausedFiles:y,processingFiles:v,isUploadStarted:l.length>0,isAllComplete:t===100&&d.length===s.length&&v.length===0,isAllErrored:!!r&&f.length===s.length,isAllPaused:n.length!==0&&c.length===n.length,isUploadInProgress:n.length>0,isSomeGhost:s.some(x=>x.isGhost)}}validateRestrictions(e,t){t===void 0&&(t=this.getFiles());try{W(this,at)[at].validate(t,[e])}catch(r){return r}return null}validateSingleFile(e){try{W(this,at)[at].validateSingleFile(e)}catch(t){return t.message}return null}validateAggregateRestrictions(e){let t=this.getFiles();try{W(this,at)[at].validateAggregateRestrictions(t,e)}catch(r){return r.message}return null}checkIfFileAlreadyExists(e){let{files:t}=this.getState();return!!(t[e]&&!t[e].isGhost)}addFile(e){W(this,On)[On](e);let{nextFilesState:t,validFilesToAdd:r,errors:s}=W(this,Ln)[Ln]([e]),n=s.filter(a=>a.isRestriction);if(W(this,Rt)[Rt](n),s.length>0)throw s[0];this.setState({files:t});let[o]=r;return this.emit("file-added",o),this.emit("files-added",r),this.log(`Added file: ${o.name}, ${o.id}, mime type: ${o.type}`),W(this,Rn)[Rn](),o.id}addFiles(e){W(this,On)[On]();let{nextFilesState:t,validFilesToAdd:r,errors:s}=W(this,Ln)[Ln](e),n=s.filter(a=>a.isRestriction);W(this,Rt)[Rt](n);let o=s.filter(a=>!a.isRestriction);if(o.length>0){let a=`Multiple errors occurred while adding files: `;if(o.forEach(l=>{a+=` * ${l.message}`}),this.info({message:this.i18n("addBulkFilesFailed",{smart_count:o.length}),details:a},"error",this.opts.infoTimeout),typeof AggregateError=="function")throw new AggregateError(o,a);{let l=new Error(a);throw l.errors=o,l}}this.setState({files:t}),r.forEach(a=>{this.emit("file-added",a)}),this.emit("files-added",r),r.length>5?this.log(`Added batch of ${r.length} files`):Object.values(r).forEach(a=>{this.log(`Added file: ${a.name} id: ${a.id} type: ${a.type}`)}),r.length>0&&W(this,Rn)[Rn]()}removeFiles(e){let{files:t,currentUploads:r}=this.getState(),s={...t},n={...r},o=Object.create(null);e.forEach(d=>{t[d]&&(o[d]=t[d],delete s[d])});function a(d){return o[d]===void 0}Object.keys(n).forEach(d=>{let f=r[d].fileIDs.filter(a);if(f.length===0){delete n[d];return}let{capabilities:y}=this.getState();if(f.length!==r[d].fileIDs.length&&!y.individualCancellation)throw new Error("The installed uploader plugin does not allow removing files during an upload.");n[d]={...r[d],fileIDs:f}});let l={currentUploads:n,files:s};Object.keys(s).length===0&&(l.allowNewUpload=!0,l.error=null,l.recoveredState=null),this.setState(l),W(this,$i)[$i]();let c=Object.keys(o);c.forEach(d=>{this.emit("file-removed",o[d])}),c.length>5?this.log(`Removed ${c.length} files`):this.log(`Removed files: ${c.join(", ")}`)}removeFile(e){this.removeFiles([e])}pauseResume(e){if(!this.getState().capabilities.resumableUploads||this.getFile(e).progress.uploadComplete)return;let t=this.getFile(e),s=!(t.isPaused||!1);return this.setFileState(e,{isPaused:s}),this.emit("upload-pause",t,s),s}pauseAll(){let e={...this.getState().files};Object.keys(e).filter(r=>!e[r].progress.uploadComplete&&e[r].progress.uploadStarted).forEach(r=>{let s={...e[r],isPaused:!0};e[r]=s}),this.setState({files:e}),this.emit("pause-all")}resumeAll(){let e={...this.getState().files};Object.keys(e).filter(r=>!e[r].progress.uploadComplete&&e[r].progress.uploadStarted).forEach(r=>{let s={...e[r],isPaused:!1,error:null};e[r]=s}),this.setState({files:e}),this.emit("resume-all")}retryAll(){let e={...this.getState().files},t=Object.keys(e).filter(s=>e[s].error);if(t.forEach(s=>{let n={...e[s],isPaused:!1,error:null};e[s]=n}),this.setState({files:e,error:null}),this.emit("retry-all",Object.values(e)),t.length===0)return Promise.resolve({successful:[],failed:[]});let r=W(this,Ui)[Ui](t,{forceAllowNewUpload:!0});return W(this,zi)[zi](r)}cancelAll(){this.emit("cancel-all");let{files:e}=this.getState(),t=Object.keys(e);t.length&&this.removeFiles(t),this.setState(Pa)}retryUpload(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",this.getFile(e));let t=W(this,Ui)[Ui]([e],{forceAllowNewUpload:!0});return W(this,zi)[zi](t)}logout(){this.iteratePlugins(e=>{var t;(t=e.provider)==null||t.logout==null||t.logout()})}[Symbol.for("uppy test: updateTotalProgress")](){return W(this,Mn)[Mn]()}updateOnlineStatus(){var e;((e=window.navigator.onLine)!=null?e:!0)?(this.emit("is-online"),this.wasOffline&&(this.emit("back-online"),this.info(this.i18n("connectedToInternet"),"success",3e3),this.wasOffline=!1)):(this.emit("is-offline"),this.info(this.i18n("noInternetConnection"),"error",0),this.wasOffline=!0)}getID(){return this.opts.id}use(e){if(typeof e!="function"){let l=`Expected a plugin class, but got ${e===null?"null":typeof e}. Please verify that the plugin was imported and spelled correctly.`;throw new TypeError(l)}for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;ss.id===e);if(r!=null)return r}}[Symbol.for("uppy test: getPlugins")](e){return W(this,ot)[ot][e]}iteratePlugins(e){Object.values(W(this,ot)[ot]).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();let t=W(this,ot)[ot][e.type],r=t.findIndex(o=>o.id===e.id);r!==-1&&t.splice(r,1);let n={plugins:{...this.getState().plugins,[e.id]:void 0}};this.setState(n)}destroy(){this.log(`Closing Uppy instance ${this.opts.id}: removing all files and uninstalling plugins`),this.cancelAll(),W(this,_n)[_n](),this.iteratePlugins(e=>{this.removePlugin(e)}),typeof window<"u"&&window.removeEventListener&&(window.removeEventListener("online",W(this,li)[li]),window.removeEventListener("offline",W(this,li)[li]))}hideInfo(){let{info:e}=this.getState();this.setState({info:e.slice(1)}),this.emit("info-hidden")}info(e,t,r){t===void 0&&(t="info"),r===void 0&&(r=3e3);let s=typeof e=="object";this.setState({info:[...this.getState().info,{type:t,message:s?e.message:e,details:s?e.details:null}]}),setTimeout(()=>this.hideInfo(),r),this.emit("info-visible")}log(e,t){let{logger:r}=this.opts;switch(t){case"error":r.error(e);break;case"warning":r.warn(e);break;default:r.debug(e);break}}registerRequestClient(e,t){W(this,In)[In].set(e,t)}getRequestClientForFile(e){if(!e.remote)throw new Error(`Tried to get RequestClient for a non-remote file ${e.id}`);let t=W(this,In)[In].get(e.remote.requestClientId);if(t==null)throw new Error(`requestClientId "${e.remote.requestClientId}" not registered for file "${e.id}"`);return t}restore(e){return this.log(`Core: attempting to restore upload "${e}"`),this.getState().currentUploads[e]?W(this,zi)[zi](e):(W(this,Ur)[Ur](e),Promise.reject(new Error("Nonexistent upload")))}[Symbol.for("uppy test: createUpload")](){return W(this,Ui)[Ui](...arguments)}addResultData(e,t){if(!W(this,Gc)[Gc](e)){this.log(`Not setting result for an upload that has been removed: ${e}`);return}let{currentUploads:r}=this.getState(),s={...r[e],result:{...r[e].result,...t}};this.setState({currentUploads:{...r,[e]:s}})}upload(){var e;(e=W(this,ot)[ot].uploader)!=null&&e.length||this.log("No uploader type plugins are used","warning");let{files:t}=this.getState(),r=this.opts.onBeforeUpload(t);return r===!1?Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false")):(r&&typeof r=="object"&&(t=r,this.setState({files:t})),Promise.resolve().then(()=>W(this,at)[at].validateMinNumberOfFiles(t)).catch(s=>{throw W(this,Rt)[Rt]([s]),s}).then(()=>{if(!W(this,jc)[jc](t))throw new kt(this.i18n("missingRequiredMetaField"))}).catch(s=>{throw s}).then(()=>{let{currentUploads:s}=this.getState(),n=Object.values(s).flatMap(l=>l.fileIDs),o=[];Object.keys(t).forEach(l=>{let c=this.getFile(l);!c.progress.uploadStarted&&n.indexOf(l)===-1&&o.push(c.id)});let a=W(this,Ui)[Ui](o);return W(this,zi)[zi](a)}).catch(s=>{throw this.emit("error",s),this.log(s,"error"),s}))}};function Pw(i){for(let n of i)n.isRestriction?this.emit("restriction-failed",n.file,n):this.emit("error",n,n.file),this.log(n,"warning");let e=i.filter(n=>n.isUserFacing),t=4,r=e.slice(0,t),s=e.slice(t);r.forEach(n=>{let{message:o,details:a=""}=n;this.info({message:o,details:a},"error",this.opts.infoTimeout)}),s.length>0&&this.info({message:this.i18n("additionalRestrictionsFailed",{count:s.length})})}function Cw(i){let{missingFields:e,error:t}=W(this,at)[at].getMissingRequiredMetaFields(i);return e.length>0?(this.setFileState(i.id,{missingRequiredMetaFields:e}),this.log(t.message),this.emit("restriction-failed",i,t),!1):!0}function Fw(i){let e=!0;for(let t of Object.values(i))W(this,Dn)[Dn](t)||(e=!1);return e}function _w(i){let{allowNewUpload:e}=this.getState();if(e===!1){let t=new kt(this.i18n("noMoreFilesAllowed"),{file:i});throw W(this,Rt)[Rt]([t]),t}}function Ow(i){let e=i instanceof File?{name:i.name,type:i.type,size:i.size,data:i}:i,t=Cn(e),r=qc(t,e),s=Dr(r).extension,n=xa(e,this.getID()),o=e.meta||{};o.name=r,o.type=t;let a=Number.isFinite(e.data.size)?e.data.size:null;return{source:e.source||"",id:n,name:r,extension:s||"",meta:{...this.getState().meta,...o},type:t,data:e.data,progress:{percentage:0,bytesUploaded:!1,bytesTotal:a,uploadComplete:!1,uploadStarted:null},size:a,isGhost:!1,isRemote:e.isRemote||!1,remote:e.remote,preview:e.preview}}function Rw(){this.opts.autoProceed&&!this.scheduledAutoProceed&&(this.scheduledAutoProceed=setTimeout(()=>{this.scheduledAutoProceed=null,this.upload().catch(i=>{i.isRestriction||this.log(i.stack||i.message||i)})},4))}function Lw(i){let{files:e}=this.getState(),t={...e},r=[],s=[];for(let a of i)try{var n;let l=W(this,Kc)[Kc](a),c=(n=e[l.id])==null?void 0:n.isGhost;c&&(l={...e[l.id],isGhost:!1,data:a.data},this.log(`Replaced the blob in the restored ghost file: ${l.name}, ${l.id}`));let d=this.opts.onBeforeFileAdded(l,t);if(!d&&this.checkIfFileAlreadyExists(l.id)){var o;throw new kt(this.i18n("noDuplicates",{fileName:(o=l.name)!=null?o:this.i18n("unnamed")}),{file:a})}if(d===!1&&!c)throw new kt("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:a});typeof d=="object"&&d!==null&&(l=d),W(this,at)[at].validateSingleFile(l),t[l.id]=l,r.push(l)}catch(l){s.push(l)}try{W(this,at)[at].validateAggregateRestrictions(Object.values(e),r)}catch(a){return s.push(a),{nextFilesState:e,validFilesToAdd:[],errors:s}}return{nextFilesState:t,validFilesToAdd:r,errors:s}}function Mw(){var i,e;let t=W(this,Yc)[Yc](),r=null;t!=null&&(r=Math.round(t*100),r>100?r=100:r<0&&(r=0)),this.emit("progress",(i=r)!=null?i:0),this.setState({totalProgress:(e=r)!=null?e:0})}function Iw(){let e=this.getFiles().filter(a=>a.progress.uploadStarted||a.progress.preprocess||a.progress.postprocess);if(e.length===0)return 0;if(e.every(a=>a.progress.uploadComplete))return 1;let t=a=>a.progress.bytesTotal!=null&&a.progress.bytesTotal!==0,r=e.filter(t),s=e.filter(a=>!t(a));if(r.every(a=>a.progress.uploadComplete)&&s.length>0&&!s.every(a=>a.progress.uploadComplete))return null;let n=r.reduce((a,l)=>{var c;return a+((c=l.progress.bytesTotal)!=null?c:0)},0),o=r.reduce((a,l)=>a+(l.progress.bytesUploaded||0),0);return n===0?0:o/n}function Dw(){let i=(r,s,n)=>{let o=r.message||"Unknown error";r.details&&(o+=` ${r.details}`),this.setState({error:o}),s!=null&&s.id in this.getState().files&&this.setFileState(s.id,{error:o,response:n})};this.on("error",i),this.on("upload-error",(r,s,n)=>{if(i(s,r,n),typeof s=="object"&&s.message){var o;this.log(s.message,"error");let a=new Error(this.i18n("failedToUpload",{file:(o=r?.name)!=null?o:""}));a.isUserFacing=!0,a.details=s.message,s.details&&(a.details+=` ${s.details}`),W(this,Rt)[Rt]([a])}else W(this,Rt)[Rt]([s])});let e=null;this.on("upload-stalled",(r,s)=>{let{message:n}=r,o=s.map(a=>a.meta.name).join(", ");e||(this.info({message:n,details:o},"warning",this.opts.infoTimeout),e=setTimeout(()=>{e=null},this.opts.infoTimeout)),this.log(`${n} ${o}`.trim(),"warning")}),this.on("upload",()=>{this.setState({error:null})});let t=r=>{let s=r.filter(o=>{let a=o!=null&&this.getFile(o.id);return a||this.log(`Not setting progress for a file that has been removed: ${o?.id}`),a}),n=Object.fromEntries(s.map(o=>[o.id,{progress:{uploadStarted:Date.now(),uploadComplete:!1,bytesUploaded:0,bytesTotal:o.size}}]));this.patchFilesState(n)};this.on("upload-start",t),this.on("upload-progress",W(this,Xc)[Xc]),this.on("upload-success",(r,s)=>{if(r==null||!this.getFile(r.id)){this.log(`Not setting progress for a file that has been removed: ${r?.id}`);return}let n=this.getFile(r.id).progress;this.setFileState(r.id,{progress:{...n,postprocess:W(this,Hi)[Hi].size>0?{mode:"indeterminate"}:void 0,uploadComplete:!0,percentage:100,bytesUploaded:n.bytesTotal},response:s,uploadURL:s.uploadURL,isPaused:!1}),r.size==null&&this.setFileState(r.id,{size:s.bytesUploaded||n.bytesTotal}),W(this,$i)[$i]()}),this.on("preprocess-progress",(r,s)=>{if(r==null||!this.getFile(r.id)){this.log(`Not setting progress for a file that has been removed: ${r?.id}`);return}this.setFileState(r.id,{progress:{...this.getFile(r.id).progress,preprocess:s}})}),this.on("preprocess-complete",r=>{if(r==null||!this.getFile(r.id)){this.log(`Not setting progress for a file that has been removed: ${r?.id}`);return}let s={...this.getState().files};s[r.id]={...s[r.id],progress:{...s[r.id].progress}},delete s[r.id].progress.preprocess,this.setState({files:s})}),this.on("postprocess-progress",(r,s)=>{if(r==null||!this.getFile(r.id)){this.log(`Not setting progress for a file that has been removed: ${r?.id}`);return}this.setFileState(r.id,{progress:{...this.getState().files[r.id].progress,postprocess:s}})}),this.on("postprocess-complete",r=>{if(r==null||!this.getFile(r.id)){this.log(`Not setting progress for a file that has been removed: ${r?.id}`);return}let s={...this.getState().files};s[r.id]={...s[r.id],progress:{...s[r.id].progress}},delete s[r.id].progress.postprocess,this.setState({files:s})}),this.on("restored",()=>{W(this,$i)[$i]()}),this.on("dashboard:file-edit-complete",r=>{r&&W(this,Dn)[Dn](r)}),typeof window<"u"&&window.addEventListener&&(window.addEventListener("online",W(this,li)[li]),window.addEventListener("offline",W(this,li)[li]),setTimeout(W(this,li)[li],3e3))}function Nw(i,e){e===void 0&&(e={});let{forceAllowNewUpload:t=!1}=e,{allowNewUpload:r,currentUploads:s}=this.getState();if(!r&&!t)throw new Error("Cannot create a new upload: already uploading.");let n=Np();return this.emit("upload",n,this.getFilesByIds(i)),this.setState({allowNewUpload:this.opts.allowMultipleUploadBatches!==!1&&this.opts.allowMultipleUploads!==!1,currentUploads:{...s,[n]:{fileIDs:i,step:0,result:{}}}}),n}function Bw(i){let{currentUploads:e}=this.getState();return e[i]}function Uw(i){let e={...this.getState().currentUploads};delete e[i],this.setState({currentUploads:e})}async function zw(i){let e=()=>{let{currentUploads:n}=this.getState();return n[i]},t=e(),r=[...W(this,Nr)[Nr],...W(this,Br)[Br],...W(this,Hi)[Hi]];try{for(let n=t.step||0;n{let c=this.getFile(l);c&&c.progress.postprocess&&this.emit("postprocess-complete",c)});let n=t.fileIDs.map(l=>this.getFile(l)),o=n.filter(l=>!l.error),a=n.filter(l=>l.error);this.addResultData(i,{successful:o,failed:a,uploadID:i}),t=e()}let s;return t&&(s=t.result,this.emit("complete",s),W(this,Ur)[Ur](i)),s==null&&this.log(`Not setting result for an upload that has been removed: ${i}`),s}Ca.VERSION=kw.version;var Zc=Ca;var Un,Ee,Uf,Hw,zr,If,zf,Qc,tu,Jc,eu,$w,Bn={},Hf=[],qw=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Oa=Array.isArray;function qi(i,e){for(var t in e)i[t]=e[t];return i}function $f(i){i&&i.parentNode&&i.parentNode.removeChild(i)}function u(i,e,t){var r,s,n,o={};for(n in e)n=="key"?r=e[n]:n=="ref"?s=e[n]:o[n]=e[n];if(arguments.length>2&&(o.children=arguments.length>3?Un.call(arguments,2):t),typeof i=="function"&&i.defaultProps!=null)for(n in i.defaultProps)o[n]===void 0&&(o[n]=i.defaultProps[n]);return Nn(i,o,r,s,null)}function Nn(i,e,t,r,s){var n={type:i,props:e,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:s??++Uf,__i:-1,__u:0};return s==null&&Ee.vnode!=null&&Ee.vnode(n),n}function qf(){return{current:null}}function Lt(i){return i.children}function ht(i,e){this.props=i,this.context=e}function Cs(i,e){if(e==null)return i.__?Cs(i.__,i.__i+1):null;for(var t;ee&&zr.sort(Qc));_a.__r=0}function jf(i,e,t,r,s,n,o,a,l,c,d){var f,y,v,x,P,C=r&&r.__k||Hf,I=e.length;for(t.__d=l,Vw(t,e,C),l=t.__d,f=0;f0?Nn(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):s).__=i,s.__b=i.__b+1,n=null,(a=s.__i=jw(s,t,o,d))!==-1&&(d--,(n=t[a])&&(n.__u|=131072)),n==null||n.__v===null?(a==-1&&f--,typeof s.type!="function"&&(s.__u|=65536)):a!==o&&(a==o-1?f--:a==o+1?f++:(a>o?f--:f++,s.__u|=65536))):s=i.__k[r]=null;if(d)for(r=0;r(l!=null&&!(131072&l.__u)?1:0))for(;o>=0||a=0){if((l=e[o])&&!(131072&l.__u)&&s==l.key&&n===l.type)return o;o--}if(a2&&(a.children=arguments.length>3?Un.call(arguments,2):t),Nn(i.type,a,r||i.key,s||i.ref,null)}Un=Hf.slice,Ee={__e:function(i,e,t,r){for(var s,n,o;e=e.__;)if((s=e.__c)&&!s.__)try{if((n=s.constructor)&&n.getDerivedStateFromError!=null&&(s.setState(n.getDerivedStateFromError(i)),o=s.__d),s.componentDidCatch!=null&&(s.componentDidCatch(i,r||{}),o=s.__d),o)return s.__E=s}catch(a){i=a}throw i}},Uf=0,Hw=function(i){return i!=null&&i.constructor==null},ht.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=qi({},this.state),typeof i=="function"&&(i=i(qi({},t),this.props)),i&&qi(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),Df(this))},ht.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),Df(this))},ht.prototype.render=Lt,zr=[],zf=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Qc=function(i,e){return i.__v.__b-e.__v.__b},_a.__r=0,tu=0,Jc=Bf(!1),eu=Bf(!0),$w=0;function zn(i){return typeof i!="object"||i===null||!("nodeType"in i)?!1:i.nodeType===Node.ELEMENT_NODE}function Kw(i,e){return e===void 0&&(e=document),typeof i=="string"?e.querySelector(i):zn(i)?i:null}var Xf=Kw;function Xw(i){for(var e;i&&!i.dir;)i=i.parentNode;return(e=i)==null?void 0:e.dir}var La=Xw;var Hr=class{constructor(e,t){this.uppy=e,this.opts=t??{}}getPluginState(){let{plugins:e}=this.uppy.getState();return e?.[this.id]||{}}setPluginState(e){let{plugins:t}=this.uppy.getState();this.uppy.setState({plugins:{...t,[this.id]:{...t[this.id],...e}}})}setOptions(e){this.opts={...this.opts,...e},this.setPluginState(void 0),this.i18nInit()}i18nInit(){let e=new Mr([this.defaultLocale,this.uppy.locale,this.opts.locale]);this.i18n=e.translate.bind(e),this.i18nArray=e.translateArray.bind(e),this.setPluginState(void 0)}addTarget(e){throw new Error("Extend the addTarget method to add your plugin to another plugin's target")}install(){}uninstall(){}update(e){}afterUpdate(){}};function Yf(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var Yw=0;function Zw(i){return"__private_"+Yw+++"_"+i}function Qw(i){let e=null,t;return function(){for(var r=arguments.length,s=new Array(r),n=0;n(e=null,i(...t)))),e}}var Hn=Zw("updateUI"),nu=class i extends Hr{constructor(){super(...arguments),Object.defineProperty(this,Hn,{writable:!0,value:void 0})}getTargetPlugin(e){let t;if(typeof e?.addTarget=="function")t=e,t instanceof i||console.warn(new Error("The provided plugin is not an instance of UIPlugin. This is an indication of a bug with the way Uppy is bundled.",{cause:{targetPlugin:t,UIPlugin:i}}));else if(typeof e=="function"){let r=e;this.uppy.iteratePlugins(s=>{s instanceof r&&(t=s)})}return t}mount(e,t){let r=t.id,s=Xf(e);if(s){this.isTargetDOMEl=!0;let a=document.createElement("div");return a.classList.add("uppy-Root"),Yf(this,Hn)[Hn]=Qw(l=>{this.uppy.getPlugin(this.id)&&(su(this.render(l,a),a),this.afterUpdate())}),this.uppy.log(`Installing ${r} to a DOM element '${e}'`),this.opts.replaceTargetContent&&(s.innerHTML=""),su(this.render(this.uppy.getState(),a),a),this.el=a,s.appendChild(a),a.dir=this.opts.direction||La(a)||"ltr",this.onMount(),this.el}let n=this.getTargetPlugin(e);if(n)return this.uppy.log(`Installing ${r} to ${n.id}`),this.parent=n,this.el=n.addTarget(t),this.onMount(),this.el;this.uppy.log(`Not installing ${r}`);let o=`Invalid target option given to ${r}.`;throw typeof e=="function"?o+=" The given target is not a Plugin class. Please check that you're not specifying a React Component instead of a plugin. If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.":o+="If you meant to target an HTML element, please make sure that the element exists. Check that the