plutonium 0.36.0 → 0.37.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/app/assets/plutonium.css +11 -1
- data/app/assets/plutonium.js +1188 -1552
- data/app/assets/plutonium.js.map +4 -4
- data/app/assets/plutonium.min.js +70 -70
- data/app/assets/plutonium.min.js.map +4 -4
- data/lib/plutonium/ui/form/base.rb +5 -0
- data/lib/plutonium/ui/form/components/secure_association.rb +3 -3
- data/lib/plutonium/version.rb +1 -1
- data/package.json +1 -1
- data/src/css/slim_select.css +78 -21
- data/src/js/controllers/register_controllers.js +2 -0
- data/src/js/controllers/textarea_autogrow_controller.js +56 -0
- data/yarn.lock +958 -1677
- metadata +2 -2
- data/package-lock.json +0 -6644
data/app/assets/plutonium.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
(()=>{var gb=Object.create;var Ud=Object.defineProperty;var vb=Object.getOwnPropertyDescriptor;var bb=Object.getOwnPropertyNames;var yb=Object.getPrototypeOf,wb=Object.prototype.hasOwnProperty;var Ce=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var Sb=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of bb(e))!wb.call(i,s)&&s!==t&&Ud(i,s,{get:()=>e[s],enumerable:!(r=vb(e,s))||r.enumerable});return i};var Te=(i,e,t)=>(t=i!=null?gb(yb(i)):{},Sb(e||!i||!i.__esModule?Ud(t,"default",{value:i,enumerable:!0}):t,i));var Cf=Ce((XP,_f)=>{_f.exports=function(){var e={},t=e._fns={};e.emit=function(o,a,l,c,d,f,g){var b=r(o);b.length&&s(o,b,[a,l,c,d,f,g])},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<f;d++)c[d]!==a&&l.push(c[d])}l.length?this._fns[o]=l:delete this._fns[o]};function r(n){var o=t[n]?t[n]:[],a=n.indexOf(":"),l=a===-1?[n]:[n.substring(0,a),n.substring(a+1)],c=Object.keys(t),d=0,f=c.length;for(d;d<f;d++){var g=c[d];if(g==="*"&&(o=o.concat(t[g])),l.length===2&&l[0]===g){o=o.concat(t[g]);break}}return o}function s(n,o,a){var l=0,c=o.length;for(l;l<c&&o[l];l++)o[l].event=n,o[l].apply(o[l],a)}return e}});var Na=Ce((ZP,Pf)=>{function b1(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}Pf.exports=b1});var Of=Ce((QP,Ff)=>{var y1=typeof global=="object"&&global&&global.Object===Object&&global;Ff.exports=y1});var Mu=Ce((JP,Rf)=>{var w1=Of(),S1=typeof self=="object"&&self&&self.Object===Object&&self,E1=w1||S1||Function("return this")();Rf.exports=E1});var Mf=Ce((e5,Lf)=>{var T1=Mu(),x1=function(){return T1.Date.now()};Lf.exports=x1});var Df=Ce((t5,If)=>{var k1=/\s/;function A1(i){for(var e=i.length;e--&&k1.test(i.charAt(e)););return e}If.exports=A1});var Bf=Ce((i5,Nf)=>{var _1=Df(),C1=/^\s+/;function P1(i){return i&&i.slice(0,_1(i)+1).replace(C1,"")}Nf.exports=P1});var Iu=Ce((r5,Uf)=>{var F1=Mu(),O1=F1.Symbol;Uf.exports=O1});var qf=Ce((s5,$f)=>{var zf=Iu(),Hf=Object.prototype,R1=Hf.hasOwnProperty,L1=Hf.toString,Pn=zf?zf.toStringTag:void 0;function M1(i){var e=R1.call(i,Pn),t=i[Pn];try{i[Pn]=void 0;var r=!0}catch{}var s=L1.call(i);return r&&(e?i[Pn]=t:delete i[Pn]),s}$f.exports=M1});var jf=Ce((n5,Vf)=>{var I1=Object.prototype,D1=I1.toString;function N1(i){return D1.call(i)}Vf.exports=N1});var Xf=Ce((o5,Kf)=>{var Wf=Iu(),B1=qf(),U1=jf(),z1="[object Null]",H1="[object Undefined]",Gf=Wf?Wf.toStringTag:void 0;function $1(i){return i==null?i===void 0?H1:z1:Gf&&Gf in Object(i)?B1(i):U1(i)}Kf.exports=$1});var Zf=Ce((a5,Yf)=>{function q1(i){return i!=null&&typeof i=="object"}Yf.exports=q1});var Jf=Ce((l5,Qf)=>{var V1=Xf(),j1=Zf(),W1="[object Symbol]";function G1(i){return typeof i=="symbol"||j1(i)&&V1(i)==W1}Qf.exports=G1});var rm=Ce((c5,im)=>{var K1=Bf(),em=Na(),X1=Jf(),tm=NaN,Y1=/^[-+]0x[0-9a-f]+$/i,Z1=/^0b[01]+$/i,Q1=/^0o[0-7]+$/i,J1=parseInt;function eS(i){if(typeof i=="number")return i;if(X1(i))return tm;if(em(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=em(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=K1(i);var t=Z1.test(i);return t||Q1.test(i)?J1(i.slice(2),t?2:8):Y1.test(i)?tm:+i}im.exports=eS});var Nu=Ce((u5,nm)=>{var tS=Na(),Du=Mf(),sm=rm(),iS="Expected a function",rS=Math.max,sS=Math.min;function nS(i,e,t){var r,s,n,o,a,l,c=0,d=!1,f=!1,g=!0;if(typeof i!="function")throw new TypeError(iS);e=sm(e)||0,tS(t)&&(d=!!t.leading,f="maxWait"in t,n=f?rS(sm(t.maxWait)||0,e):n,g="trailing"in t?!!t.trailing:g);function b(F){var O=r,M=s;return r=s=void 0,c=F,o=i.apply(M,O),o}function w(F){return c=F,a=setTimeout(C,e),d?b(F):o}function P(F){var O=F-l,M=F-c,H=e-O;return f?sS(H,n-M):H}function R(F){var O=F-l,M=F-c;return l===void 0||O>=e||O<0||f&&M>=n}function C(){var F=Du();if(R(F))return k(F);a=setTimeout(C,P(F))}function k(F){return a=void 0,g&&r?b(F):(r=s=void 0,o)}function _(){a!==void 0&&clearTimeout(a),c=0,r=l=s=a=void 0}function E(){return a===void 0?o:k(Du())}function A(){var F=Du(),O=R(F);if(r=arguments,s=this,l=F,O){if(a===void 0)return w(l);if(f)return clearTimeout(a),a=setTimeout(C,e),b(l)}return a===void 0&&(a=setTimeout(C,e)),o}return A.cancel=_,A.flush=E,A}nm.exports=nS});var am=Ce((h5,om)=>{var oS=Nu(),aS=Na(),lS="Expected a function";function cS(i,e,t){var r=!0,s=!0;if(typeof i!="function")throw new TypeError(lS);return aS(t)&&(r="leading"in t?!!t.leading:r,s="trailing"in t?!!t.trailing:s),oS(i,e,{leading:r,maxWait:e,trailing:s})}om.exports=cS});var Ha=Ce((k5,fm)=>{"use strict";fm.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 vm=Ce((A5,gm)=>{"use strict";function mm(i,e){this.text=i=i||"",this.hasWild=~i.indexOf("*"),this.separator=e,this.parts=i.split(e)}mm.prototype.match=function(i){var e=!0,t=this.parts,r,s=t.length,n;if(typeof i=="string"||i instanceof String)if(!this.hasWild&&this.text!=i)e=!1;else{for(n=(i||"").split(this.separator),r=0;e&&r<s;r++)t[r]!=="*"&&(r<n.length?e=t[r]===n[r]:e=!1);e=e&&n}else if(typeof i.splice=="function")for(e=[],r=i.length;r--;)this.match(i[r])&&(e[e.length]=i[r]);else if(typeof i=="object"){e={};for(var o in i)this.match(o)&&(e[o]=i[o])}return e};gm.exports=function(i,e,t){var r=new mm(i,t||/[\/\.]/);return typeof e<"u"?r.match(e):r}});var ym=Ce((_5,bm)=>{var mS=vm(),gS=/[\/\+\.]/;bm.exports=function(i,e){function t(r){var s=mS(r,i,gS);return s&&s.length>=2}return e?t(e.split(";")[0]):t}});var yt=Ce((w2,Ja)=>{(function(){"use strict";var i={}.hasOwnProperty;function e(){for(var s="",n=0;n<arguments.length;n++){var o=arguments[n];o&&(s=r(s,t(o)))}return s}function t(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return e.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var n="";for(var o in s)i.call(s,o)&&s[o]&&(n=r(n,o));return n}function r(s,n){return n?s?s+" "+n:s+n:s}typeof Ja<"u"&&Ja.exports?(e.default=e,Ja.exports=e):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return e}):window.classNames=e})()});var iv=Ce((dO,qh)=>{"use strict";var sT=Object.prototype.hasOwnProperty,St="~";function uo(){}Object.create&&(uo.prototype=Object.create(null),new uo().__proto__||(St=!1));function nT(i,e,t){this.fn=i,this.context=e,this.once=t||!1}function tv(i,e,t,r,s){if(typeof t!="function")throw new TypeError("The listener must be a function");var n=new nT(t,r||i,s),o=St?St+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 vl(i,e){--i._eventsCount===0?i._events=new uo:delete i._events[e]}function lt(){this._events=new uo,this._eventsCount=0}lt.prototype.eventNames=function(){var e=[],t,r;if(this._eventsCount===0)return e;for(r in t=this._events)sT.call(t,r)&&e.push(St?r.slice(1):r);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};lt.prototype.listeners=function(e){var t=St?St+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<n;s++)o[s]=r[s].fn;return o};lt.prototype.listenerCount=function(e){var t=St?St+e:e,r=this._events[t];return r?r.fn?1:r.length:0};lt.prototype.emit=function(e,t,r,s,n,o){var a=St?St+e:e;if(!this._events[a])return!1;var l=this._events[a],c=arguments.length,d,f;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),c){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,r),!0;case 4:return l.fn.call(l.context,t,r,s),!0;case 5:return l.fn.call(l.context,t,r,s,n),!0;case 6:return l.fn.call(l.context,t,r,s,n,o),!0}for(f=1,d=new Array(c-1);f<c;f++)d[f-1]=arguments[f];l.fn.apply(l.context,d)}else{var g=l.length,b;for(f=0;f<g;f++)switch(l[f].once&&this.removeListener(e,l[f].fn,void 0,!0),c){case 1:l[f].fn.call(l[f].context);break;case 2:l[f].fn.call(l[f].context,t);break;case 3:l[f].fn.call(l[f].context,t,r);break;case 4:l[f].fn.call(l[f].context,t,r,s);break;default:if(!d)for(b=1,d=new Array(c-1);b<c;b++)d[b-1]=arguments[b];l[f].fn.apply(l[f].context,d)}}return!0};lt.prototype.on=function(e,t,r){return tv(this,e,t,r,!1)};lt.prototype.once=function(e,t,r){return tv(this,e,t,r,!0)};lt.prototype.removeListener=function(e,t,r,s){var n=St?St+e:e;if(!this._events[n])return this;if(!t)return vl(this,n),this;var o=this._events[n];if(o.fn)o.fn===t&&(!s||o.once)&&(!r||o.context===r)&&vl(this,n);else{for(var a=0,l=[],c=o.length;a<c;a++)(o[a].fn!==t||s&&!o[a].once||r&&o[a].context!==r)&&l.push(o[a]);l.length?this._events[n]=l.length===1?l[0]:l:vl(this,n)}return this};lt.prototype.removeAllListeners=function(e){var t;return e?(t=St?St+e:e,this._events[t]&&vl(this,t)):(this._events=new uo,this._eventsCount=0),this};lt.prototype.off=lt.prototype.removeListener;lt.prototype.addListener=lt.prototype.on;lt.prefixed=St;lt.EventEmitter=lt;typeof qh<"u"&&(qh.exports=lt)});var zv=Ce((wd,Sd)=>{(function(i,e){typeof wd=="object"&&typeof Sd<"u"?Sd.exports=e():typeof define=="function"&&define.amd?define(e):(i=typeof globalThis<"u"?globalThis:i||self,i.Cropper=e())})(wd,function(){"use strict";function i(v,h){var m=Object.keys(v);if(Object.getOwnPropertySymbols){var p=Object.getOwnPropertySymbols(v);h&&(p=p.filter(function(x){return Object.getOwnPropertyDescriptor(v,x).enumerable})),m.push.apply(m,p)}return m}function e(v){for(var h=1;h<arguments.length;h++){var m=arguments[h]!=null?arguments[h]:{};h%2?i(Object(m),!0).forEach(function(p){l(v,p,m[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(v,Object.getOwnPropertyDescriptors(m)):i(Object(m)).forEach(function(p){Object.defineProperty(v,p,Object.getOwnPropertyDescriptor(m,p))})}return v}function t(v,h){if(typeof v!="object"||!v)return v;var m=v[Symbol.toPrimitive];if(m!==void 0){var p=m.call(v,h||"default");if(typeof p!="object")return p;throw new TypeError("@@toPrimitive must return a primitive value.")}return(h==="string"?String:Number)(v)}function r(v){var h=t(v,"string");return typeof h=="symbol"?h:h+""}function s(v){"@babel/helpers - typeof";return s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(h){return typeof h}:function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h},s(v)}function n(v,h){if(!(v instanceof h))throw new TypeError("Cannot call a class as a function")}function o(v,h){for(var m=0;m<h.length;m++){var p=h[m];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(v,r(p.key),p)}}function a(v,h,m){return h&&o(v.prototype,h),m&&o(v,m),Object.defineProperty(v,"prototype",{writable:!1}),v}function l(v,h,m){return h=r(h),h in v?Object.defineProperty(v,h,{value:m,enumerable:!0,configurable:!0,writable:!0}):v[h]=m,v}function c(v){return d(v)||f(v)||g(v)||w()}function d(v){if(Array.isArray(v))return b(v)}function f(v){if(typeof Symbol<"u"&&v[Symbol.iterator]!=null||v["@@iterator"]!=null)return Array.from(v)}function g(v,h){if(v){if(typeof v=="string")return b(v,h);var m=Object.prototype.toString.call(v).slice(8,-1);if(m==="Object"&&v.constructor&&(m=v.constructor.name),m==="Map"||m==="Set")return Array.from(v);if(m==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m))return b(v,h)}}function b(v,h){(h==null||h>v.length)&&(h=v.length);for(var m=0,p=new Array(h);m<h;m++)p[m]=v[m];return p}function w(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var P=typeof window<"u"&&typeof window.document<"u",R=P?window:{},C=P&&R.document.documentElement?"ontouchstart"in R.document.documentElement:!1,k=P?"PointerEvent"in R:!1,_="cropper",E="all",A="crop",F="move",O="zoom",M="e",H="w",W="s",q="n",Y="ne",ne="nw",se="se",Qe="sw",Ee="".concat(_,"-crop"),Me="".concat(_,"-disabled"),be="".concat(_,"-hidden"),ct="".concat(_,"-hide"),Ut="".concat(_,"-invisible"),oe="".concat(_,"-modal"),ut="".concat(_,"-move"),ae="".concat(_,"Action"),nt="".concat(_,"Preview"),J="crop",ht="move",zt="none",dt="crop",ot="cropend",rr="cropmove",gi="cropstart",Qt="dblclick",Ai=C?"touchstart":"mousedown",Jt=C?"touchmove":"mousemove",kr=C?"touchend touchcancel":"mouseup",_i=k?"pointerdown":Ai,Ht=k?"pointermove":Jt,Ci=k?"pointerup pointercancel":kr,Pi="ready",Ft="resize",vi="wheel",sr="zoom",Fi="image/jpeg",ei=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,ti=/^data:/,ii=/^data:image\/jpeg;base64,/,Ar=/^img|canvas$/i,nr=200,Ys=100,gs={viewMode:0,dragMode:J,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:nr,minContainerHeight:Ys,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},Mo='<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>',vs=Number.isNaN||R.isNaN;function Z(v){return typeof v=="number"&&!vs(v)}var $t=function(h){return h>0&&h<1/0};function bi(v){return typeof v>"u"}function ri(v){return s(v)==="object"&&v!==null}var Zs=Object.prototype.hasOwnProperty;function or(v){if(!ri(v))return!1;try{var h=v.constructor,m=h.prototype;return h&&m&&Zs.call(m,"isPrototypeOf")}catch{return!1}}function Ue(v){return typeof v=="function"}var bs=Array.prototype.slice;function Io(v){return Array.from?Array.from(v):bs.call(v)}function ge(v,h){return v&&Ue(h)&&(Array.isArray(v)||Z(v.length)?Io(v).forEach(function(m,p){h.call(v,m,p,v)}):ri(v)&&Object.keys(v).forEach(function(m){h.call(v,v[m],m,v)})),v}var ve=Object.assign||function(h){for(var m=arguments.length,p=new Array(m>1?m-1:0),x=1;x<m;x++)p[x-1]=arguments[x];return ri(h)&&p.length>0&&p.forEach(function(y){ri(y)&&Object.keys(y).forEach(function(T){h[T]=y[T]})}),h},Hl=/\.\d*(?:0|9){12}\d*$/;function ye(v){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return Hl.test(v)?Math.round(v*h)/h:v}var ar=/^width|height|left|top|marginLeft|marginTop$/;function yi(v,h){var m=v.style;ge(h,function(p,x){ar.test(x)&&Z(p)&&(p="".concat(p,"px")),m[x]=p})}function Do(v,h){return v.classList?v.classList.contains(h):v.className.indexOf(h)>-1}function _e(v,h){if(h){if(Z(v.length)){ge(v,function(p){_e(p,h)});return}if(v.classList){v.classList.add(h);return}var m=v.className.trim();m?m.indexOf(h)<0&&(v.className="".concat(m," ").concat(h)):v.className=h}}function Ot(v,h){if(h){if(Z(v.length)){ge(v,function(m){Ot(m,h)});return}if(v.classList){v.classList.remove(h);return}v.className.indexOf(h)>=0&&(v.className=v.className.replace(h,""))}}function Oi(v,h,m){if(h){if(Z(v.length)){ge(v,function(p){Oi(p,h,m)});return}m?_e(v,h):Ot(v,h)}}var $l=/([a-z\d])([A-Z])/g;function kt(v){return v.replace($l,"$1-$2").toLowerCase()}function wi(v,h){return ri(v[h])?v[h]:v.dataset?v.dataset[h]:v.getAttribute("data-".concat(kt(h)))}function lr(v,h,m){ri(m)?v[h]=m:v.dataset?v.dataset[h]=m:v.setAttribute("data-".concat(kt(h)),m)}function No(v,h){if(ri(v[h]))try{delete v[h]}catch{v[h]=void 0}else if(v.dataset)try{delete v.dataset[h]}catch{v.dataset[h]=void 0}else v.removeAttribute("data-".concat(kt(h)))}var ys=/\s\s*/,Qs=function(){var v=!1;if(P){var h=!1,m=function(){},p=Object.defineProperty({},"once",{get:function(){return v=!0,h},set:function(y){h=y}});R.addEventListener("test",m,p),R.removeEventListener("test",m,p)}return v}();function Fe(v,h,m){var p=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},x=m;h.trim().split(ys).forEach(function(y){if(!Qs){var T=v.listeners;T&&T[y]&&T[y][m]&&(x=T[y][m],delete T[y][m],Object.keys(T[y]).length===0&&delete T[y],Object.keys(T).length===0&&delete v.listeners)}v.removeEventListener(y,x,p)})}function pt(v,h,m){var p=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},x=m;h.trim().split(ys).forEach(function(y){if(p.once&&!Qs){var T=v.listeners,L=T===void 0?{}:T;x=function(){delete L[y][m],v.removeEventListener(y,x,p);for(var N=arguments.length,I=new Array(N),D=0;D<N;D++)I[D]=arguments[D];m.apply(v,I)},L[y]||(L[y]={}),L[y][m]&&v.removeEventListener(y,L[y][m],p),L[y][m]=x,v.listeners=L}v.addEventListener(y,x,p)})}function Ri(v,h,m){var p;return Ue(Event)&&Ue(CustomEvent)?p=new CustomEvent(h,{detail:m,bubbles:!0,cancelable:!0}):(p=document.createEvent("CustomEvent"),p.initCustomEvent(h,!0,!0,m)),v.dispatchEvent(p)}function Js(v){var h=v.getBoundingClientRect();return{left:h.left+(window.pageXOffset-document.documentElement.clientLeft),top:h.top+(window.pageYOffset-document.documentElement.clientTop)}}var ws=R.location,ql=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function G(v){var h=v.match(ql);return h!==null&&(h[1]!==ws.protocol||h[2]!==ws.hostname||h[3]!==ws.port)}function S(v){var h="timestamp=".concat(new Date().getTime());return v+(v.indexOf("?")===-1?"?":"&")+h}function B(v){var h=v.rotate,m=v.scaleX,p=v.scaleY,x=v.translateX,y=v.translateY,T=[];Z(x)&&x!==0&&T.push("translateX(".concat(x,"px)")),Z(y)&&y!==0&&T.push("translateY(".concat(y,"px)")),Z(h)&&h!==0&&T.push("rotate(".concat(h,"deg)")),Z(m)&&m!==1&&T.push("scaleX(".concat(m,")")),Z(p)&&p!==1&&T.push("scaleY(".concat(p,")"));var L=T.length?T.join(" "):"none";return{WebkitTransform:L,msTransform:L,transform:L}}function j(v){var h=e({},v),m=0;return ge(v,function(p,x){delete h[x],ge(h,function(y){var T=Math.abs(p.startX-y.startX),L=Math.abs(p.startY-y.startY),z=Math.abs(p.endX-y.endX),N=Math.abs(p.endY-y.endY),I=Math.sqrt(T*T+L*L),D=Math.sqrt(z*z+N*N),U=(D-I)/I;Math.abs(U)>Math.abs(m)&&(m=U)})}),m}function pe(v,h){var m=v.pageX,p=v.pageY,x={endX:m,endY:p};return h?x:e({startX:m,startY:p},x)}function Ve(v){var h=0,m=0,p=0;return ge(v,function(x){var y=x.startX,T=x.startY;h+=y,m+=T,p+=1}),h/=p,m/=p,{pageX:h,pageY:m}}function fe(v){var h=v.aspectRatio,m=v.height,p=v.width,x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"contain",y=$t(p),T=$t(m);if(y&&T){var L=m*h;x==="contain"&&L>p||x==="cover"&&L<p?m=p/h:p=m*h}else y?m=p/h:T&&(p=m*h);return{width:p,height:m}}function at(v){var h=v.width,m=v.height,p=v.degree;if(p=Math.abs(p)%180,p===90)return{width:m,height:h};var x=p%90*Math.PI/180,y=Math.sin(x),T=Math.cos(x),L=h*T+m*y,z=h*y+m*T;return p>90?{width:z,height:L}:{width:L,height:z}}function si(v,h,m,p){var x=h.aspectRatio,y=h.naturalWidth,T=h.naturalHeight,L=h.rotate,z=L===void 0?0:L,N=h.scaleX,I=N===void 0?1:N,D=h.scaleY,U=D===void 0?1:D,ie=m.aspectRatio,te=m.naturalWidth,we=m.naturalHeight,le=p.fillColor,ze=le===void 0?"transparent":le,We=p.imageSmoothingEnabled,Ie=We===void 0?!0:We,Li=p.imageSmoothingQuality,Rt=Li===void 0?"low":Li,$=p.maxWidth,ce=$===void 0?1/0:$,He=p.maxHeight,qt=He===void 0?1/0:He,Mi=p.minWidth,_r=Mi===void 0?0:Mi,Cr=p.minHeight,ur=Cr===void 0?0:Cr,Si=document.createElement("canvas"),At=Si.getContext("2d"),Pr=fe({aspectRatio:ie,width:ce,height:qt}),zo=fe({aspectRatio:ie,width:_r,height:ur},"cover"),Vl=Math.min(Pr.width,Math.max(zo.width,te)),jl=Math.min(Pr.height,Math.max(zo.height,we)),Id=fe({aspectRatio:x,width:ce,height:qt}),Dd=fe({aspectRatio:x,width:_r,height:ur},"cover"),Nd=Math.min(Id.width,Math.max(Dd.width,y)),Bd=Math.min(Id.height,Math.max(Dd.height,T)),fb=[-Nd/2,-Bd/2,Nd,Bd];return Si.width=ye(Vl),Si.height=ye(jl),At.fillStyle=ze,At.fillRect(0,0,Vl,jl),At.save(),At.translate(Vl/2,jl/2),At.rotate(z*Math.PI/180),At.scale(I,U),At.imageSmoothingEnabled=Ie,At.imageSmoothingQuality=Rt,At.drawImage.apply(At,[v].concat(c(fb.map(function(mb){return Math.floor(ye(mb))})))),At.restore(),Si}var cr=String.fromCharCode;function en(v,h,m){var p="";m+=h;for(var x=h;x<m;x+=1)p+=cr(v.getUint8(x));return p}var je=/^data:.*,/;function Bo(v){var h=v.replace(je,""),m=atob(h),p=new ArrayBuffer(m.length),x=new Uint8Array(p);return ge(x,function(y,T){x[T]=m.charCodeAt(T)}),p}function Uo(v,h){for(var m=[],p=8192,x=new Uint8Array(v);x.length>0;)m.push(cr.apply(null,Io(x.subarray(0,p)))),x=x.subarray(p);return"data:".concat(h,";base64,").concat(btoa(m.join("")))}function nb(v){var h=new DataView(v),m;try{var p,x,y;if(h.getUint8(0)===255&&h.getUint8(1)===216)for(var T=h.byteLength,L=2;L+1<T;){if(h.getUint8(L)===255&&h.getUint8(L+1)===225){x=L;break}L+=1}if(x){var z=x+4,N=x+10;if(en(h,z,4)==="Exif"){var I=h.getUint16(N);if(p=I===18761,(p||I===19789)&&h.getUint16(N+2,p)===42){var D=h.getUint32(N+4,p);D>=8&&(y=N+D)}}}if(y){var U=h.getUint16(y,p),ie,te;for(te=0;te<U;te+=1)if(ie=y+te*12+2,h.getUint16(ie,p)===274){ie+=8,m=h.getUint16(ie,p),h.setUint16(ie,1,p);break}}}catch{m=1}return m}function ob(v){var h=0,m=1,p=1;switch(v){case 2:m=-1;break;case 3:h=-180;break;case 4:p=-1;break;case 5:h=90,p=-1;break;case 6:h=90;break;case 7:h=90,m=-1;break;case 8:h=-90;break}return{rotate:h,scaleX:m,scaleY:p}}var ab={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var h=this.element,m=this.options,p=this.container,x=this.cropper,y=Number(m.minContainerWidth),T=Number(m.minContainerHeight);_e(x,be),Ot(h,be);var L={width:Math.max(p.offsetWidth,y>=0?y:nr),height:Math.max(p.offsetHeight,T>=0?T:Ys)};this.containerData=L,yi(x,{width:L.width,height:L.height}),_e(h,be),Ot(x,be)},initCanvas:function(){var h=this.containerData,m=this.imageData,p=this.options.viewMode,x=Math.abs(m.rotate)%180===90,y=x?m.naturalHeight:m.naturalWidth,T=x?m.naturalWidth:m.naturalHeight,L=y/T,z=h.width,N=h.height;h.height*L>h.width?p===3?z=h.height*L:N=h.width/L:p===3?N=h.width/L:z=h.height*L;var I={aspectRatio:L,naturalWidth:y,naturalHeight:T,width:z,height:N};this.canvasData=I,this.limited=p===1||p===2,this.limitCanvas(!0,!0),I.width=Math.min(Math.max(I.width,I.minWidth),I.maxWidth),I.height=Math.min(Math.max(I.height,I.minHeight),I.maxHeight),I.left=(h.width-I.width)/2,I.top=(h.height-I.height)/2,I.oldLeft=I.left,I.oldTop=I.top,this.initialCanvasData=ve({},I)},limitCanvas:function(h,m){var p=this.options,x=this.containerData,y=this.canvasData,T=this.cropBoxData,L=p.viewMode,z=y.aspectRatio,N=this.cropped&&T;if(h){var I=Number(p.minCanvasWidth)||0,D=Number(p.minCanvasHeight)||0;L>1?(I=Math.max(I,x.width),D=Math.max(D,x.height),L===3&&(D*z>I?I=D*z:D=I/z)):L>0&&(I?I=Math.max(I,N?T.width:0):D?D=Math.max(D,N?T.height:0):N&&(I=T.width,D=T.height,D*z>I?I=D*z:D=I/z));var U=fe({aspectRatio:z,width:I,height:D});I=U.width,D=U.height,y.minWidth=I,y.minHeight=D,y.maxWidth=1/0,y.maxHeight=1/0}if(m)if(L>(N?0:1)){var ie=x.width-y.width,te=x.height-y.height;y.minLeft=Math.min(0,ie),y.minTop=Math.min(0,te),y.maxLeft=Math.max(0,ie),y.maxTop=Math.max(0,te),N&&this.limited&&(y.minLeft=Math.min(T.left,T.left+(T.width-y.width)),y.minTop=Math.min(T.top,T.top+(T.height-y.height)),y.maxLeft=T.left,y.maxTop=T.top,L===2&&(y.width>=x.width&&(y.minLeft=Math.min(0,ie),y.maxLeft=Math.max(0,ie)),y.height>=x.height&&(y.minTop=Math.min(0,te),y.maxTop=Math.max(0,te))))}else y.minLeft=-y.width,y.minTop=-y.height,y.maxLeft=x.width,y.maxTop=x.height},renderCanvas:function(h,m){var p=this.canvasData,x=this.imageData;if(m){var y=at({width:x.naturalWidth*Math.abs(x.scaleX||1),height:x.naturalHeight*Math.abs(x.scaleY||1),degree:x.rotate||0}),T=y.width,L=y.height,z=p.width*(T/p.naturalWidth),N=p.height*(L/p.naturalHeight);p.left-=(z-p.width)/2,p.top-=(N-p.height)/2,p.width=z,p.height=N,p.aspectRatio=T/L,p.naturalWidth=T,p.naturalHeight=L,this.limitCanvas(!0,!1)}(p.width>p.maxWidth||p.width<p.minWidth)&&(p.left=p.oldLeft),(p.height>p.maxHeight||p.height<p.minHeight)&&(p.top=p.oldTop),p.width=Math.min(Math.max(p.width,p.minWidth),p.maxWidth),p.height=Math.min(Math.max(p.height,p.minHeight),p.maxHeight),this.limitCanvas(!1,!0),p.left=Math.min(Math.max(p.left,p.minLeft),p.maxLeft),p.top=Math.min(Math.max(p.top,p.minTop),p.maxTop),p.oldLeft=p.left,p.oldTop=p.top,yi(this.canvas,ve({width:p.width,height:p.height},B({translateX:p.left,translateY:p.top}))),this.renderImage(h),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(h){var m=this.canvasData,p=this.imageData,x=p.naturalWidth*(m.width/m.naturalWidth),y=p.naturalHeight*(m.height/m.naturalHeight);ve(p,{width:x,height:y,left:(m.width-x)/2,top:(m.height-y)/2}),yi(this.image,ve({width:p.width,height:p.height},B(ve({translateX:p.left,translateY:p.top},p)))),h&&this.output()},initCropBox:function(){var h=this.options,m=this.canvasData,p=h.aspectRatio||h.initialAspectRatio,x=Number(h.autoCropArea)||.8,y={width:m.width,height:m.height};p&&(m.height*p>m.width?y.height=y.width/p:y.width=y.height*p),this.cropBoxData=y,this.limitCropBox(!0,!0),y.width=Math.min(Math.max(y.width,y.minWidth),y.maxWidth),y.height=Math.min(Math.max(y.height,y.minHeight),y.maxHeight),y.width=Math.max(y.minWidth,y.width*x),y.height=Math.max(y.minHeight,y.height*x),y.left=m.left+(m.width-y.width)/2,y.top=m.top+(m.height-y.height)/2,y.oldLeft=y.left,y.oldTop=y.top,this.initialCropBoxData=ve({},y)},limitCropBox:function(h,m){var p=this.options,x=this.containerData,y=this.canvasData,T=this.cropBoxData,L=this.limited,z=p.aspectRatio;if(h){var N=Number(p.minCropBoxWidth)||0,I=Number(p.minCropBoxHeight)||0,D=L?Math.min(x.width,y.width,y.width+y.left,x.width-y.left):x.width,U=L?Math.min(x.height,y.height,y.height+y.top,x.height-y.top):x.height;N=Math.min(N,x.width),I=Math.min(I,x.height),z&&(N&&I?I*z>N?I=N/z:N=I*z:N?I=N/z:I&&(N=I*z),U*z>D?U=D/z:D=U*z),T.minWidth=Math.min(N,D),T.minHeight=Math.min(I,U),T.maxWidth=D,T.maxHeight=U}m&&(L?(T.minLeft=Math.max(0,y.left),T.minTop=Math.max(0,y.top),T.maxLeft=Math.min(x.width,y.left+y.width)-T.width,T.maxTop=Math.min(x.height,y.top+y.height)-T.height):(T.minLeft=0,T.minTop=0,T.maxLeft=x.width-T.width,T.maxTop=x.height-T.height))},renderCropBox:function(){var h=this.options,m=this.containerData,p=this.cropBoxData;(p.width>p.maxWidth||p.width<p.minWidth)&&(p.left=p.oldLeft),(p.height>p.maxHeight||p.height<p.minHeight)&&(p.top=p.oldTop),p.width=Math.min(Math.max(p.width,p.minWidth),p.maxWidth),p.height=Math.min(Math.max(p.height,p.minHeight),p.maxHeight),this.limitCropBox(!1,!0),p.left=Math.min(Math.max(p.left,p.minLeft),p.maxLeft),p.top=Math.min(Math.max(p.top,p.minTop),p.maxTop),p.oldLeft=p.left,p.oldTop=p.top,h.movable&&h.cropBoxMovable&&lr(this.face,ae,p.width>=m.width&&p.height>=m.height?F:E),yi(this.cropBox,ve({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(),Ri(this.element,dt,this.getData())}},lb={initPreview:function(){var h=this.element,m=this.crossOrigin,p=this.options.preview,x=m?this.crossOriginUrl:this.url,y=h.alt||"The image to preview",T=document.createElement("img");if(m&&(T.crossOrigin=m),T.src=x,T.alt=y,this.viewBox.appendChild(T),this.viewBoxImage=T,!!p){var L=p;typeof p=="string"?L=h.ownerDocument.querySelectorAll(p):p.querySelector&&(L=[p]),this.previews=L,ge(L,function(z){var N=document.createElement("img");lr(z,nt,{width:z.offsetWidth,height:z.offsetHeight,html:z.innerHTML}),m&&(N.crossOrigin=m),N.src=x,N.alt=y,N.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;"',z.innerHTML="",z.appendChild(N)})}},resetPreview:function(){ge(this.previews,function(h){var m=wi(h,nt);yi(h,{width:m.width,height:m.height}),h.innerHTML=m.html,No(h,nt)})},preview:function(){var h=this.imageData,m=this.canvasData,p=this.cropBoxData,x=p.width,y=p.height,T=h.width,L=h.height,z=p.left-m.left-h.left,N=p.top-m.top-h.top;!this.cropped||this.disabled||(yi(this.viewBoxImage,ve({width:T,height:L},B(ve({translateX:-z,translateY:-N},h)))),ge(this.previews,function(I){var D=wi(I,nt),U=D.width,ie=D.height,te=U,we=ie,le=1;x&&(le=U/x,we=y*le),y&&we>ie&&(le=ie/y,te=x*le,we=ie),yi(I,{width:te,height:we}),yi(I.getElementsByTagName("img")[0],ve({width:T*le,height:L*le},B(ve({translateX:-z*le,translateY:-N*le},h))))}))}},cb={bind:function(){var h=this.element,m=this.options,p=this.cropper;Ue(m.cropstart)&&pt(h,gi,m.cropstart),Ue(m.cropmove)&&pt(h,rr,m.cropmove),Ue(m.cropend)&&pt(h,ot,m.cropend),Ue(m.crop)&&pt(h,dt,m.crop),Ue(m.zoom)&&pt(h,sr,m.zoom),pt(p,_i,this.onCropStart=this.cropStart.bind(this)),m.zoomable&&m.zoomOnWheel&&pt(p,vi,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),m.toggleDragModeOnDblclick&&pt(p,Qt,this.onDblclick=this.dblclick.bind(this)),pt(h.ownerDocument,Ht,this.onCropMove=this.cropMove.bind(this)),pt(h.ownerDocument,Ci,this.onCropEnd=this.cropEnd.bind(this)),m.responsive&&pt(window,Ft,this.onResize=this.resize.bind(this))},unbind:function(){var h=this.element,m=this.options,p=this.cropper;Ue(m.cropstart)&&Fe(h,gi,m.cropstart),Ue(m.cropmove)&&Fe(h,rr,m.cropmove),Ue(m.cropend)&&Fe(h,ot,m.cropend),Ue(m.crop)&&Fe(h,dt,m.crop),Ue(m.zoom)&&Fe(h,sr,m.zoom),Fe(p,_i,this.onCropStart),m.zoomable&&m.zoomOnWheel&&Fe(p,vi,this.onWheel,{passive:!1,capture:!0}),m.toggleDragModeOnDblclick&&Fe(p,Qt,this.onDblclick),Fe(h.ownerDocument,Ht,this.onCropMove),Fe(h.ownerDocument,Ci,this.onCropEnd),m.responsive&&Fe(window,Ft,this.onResize)}},ub={resize:function(){if(!this.disabled){var h=this.options,m=this.container,p=this.containerData,x=m.offsetWidth/p.width,y=m.offsetHeight/p.height,T=Math.abs(x-1)>Math.abs(y-1)?x:y;if(T!==1){var L,z;h.restore&&(L=this.getCanvasData(),z=this.getCropBoxData()),this.render(),h.restore&&(this.setCanvasData(ge(L,function(N,I){L[I]=N*T})),this.setCropBoxData(ge(z,function(N,I){z[I]=N*T})))}}},dblclick:function(){this.disabled||this.options.dragMode===zt||this.setDragMode(Do(this.dragBox,Ee)?ht:J)},wheel:function(h){var m=this,p=Number(this.options.wheelZoomRatio)||.1,x=1;this.disabled||(h.preventDefault(),!this.wheeling&&(this.wheeling=!0,setTimeout(function(){m.wheeling=!1},50),h.deltaY?x=h.deltaY>0?1:-1:h.wheelDelta?x=-h.wheelDelta/120:h.detail&&(x=h.detail>0?1:-1),this.zoom(-x*p,h)))},cropStart:function(h){var m=h.buttons,p=h.button;if(!(this.disabled||(h.type==="mousedown"||h.type==="pointerdown"&&h.pointerType==="mouse")&&(Z(m)&&m!==1||Z(p)&&p!==0||h.ctrlKey))){var x=this.options,y=this.pointers,T;h.changedTouches?ge(h.changedTouches,function(L){y[L.identifier]=pe(L)}):y[h.pointerId||0]=pe(h),Object.keys(y).length>1&&x.zoomable&&x.zoomOnTouch?T=O:T=wi(h.target,ae),ei.test(T)&&Ri(this.element,gi,{originalEvent:h,action:T})!==!1&&(h.preventDefault(),this.action=T,this.cropping=!1,T===A&&(this.cropping=!0,_e(this.dragBox,oe)))}},cropMove:function(h){var m=this.action;if(!(this.disabled||!m)){var p=this.pointers;h.preventDefault(),Ri(this.element,rr,{originalEvent:h,action:m})!==!1&&(h.changedTouches?ge(h.changedTouches,function(x){ve(p[x.identifier]||{},pe(x,!0))}):ve(p[h.pointerId||0]||{},pe(h,!0)),this.change(h))}},cropEnd:function(h){if(!this.disabled){var m=this.action,p=this.pointers;h.changedTouches?ge(h.changedTouches,function(x){delete p[x.identifier]}):delete p[h.pointerId||0],m&&(h.preventDefault(),Object.keys(p).length||(this.action=""),this.cropping&&(this.cropping=!1,Oi(this.dragBox,oe,this.cropped&&this.options.modal)),Ri(this.element,ot,{originalEvent:h,action:m}))}}},hb={change:function(h){var m=this.options,p=this.canvasData,x=this.containerData,y=this.cropBoxData,T=this.pointers,L=this.action,z=m.aspectRatio,N=y.left,I=y.top,D=y.width,U=y.height,ie=N+D,te=I+U,we=0,le=0,ze=x.width,We=x.height,Ie=!0,Li;!z&&h.shiftKey&&(z=D&&U?D/U:1),this.limited&&(we=y.minLeft,le=y.minTop,ze=we+Math.min(x.width,p.width,p.left+p.width),We=le+Math.min(x.height,p.height,p.top+p.height));var Rt=T[Object.keys(T)[0]],$={x:Rt.endX-Rt.startX,y:Rt.endY-Rt.startY},ce=function(qt){switch(qt){case M:ie+$.x>ze&&($.x=ze-ie);break;case H:N+$.x<we&&($.x=we-N);break;case q:I+$.y<le&&($.y=le-I);break;case W:te+$.y>We&&($.y=We-te);break}};switch(L){case E:N+=$.x,I+=$.y;break;case M:if($.x>=0&&(ie>=ze||z&&(I<=le||te>=We))){Ie=!1;break}ce(M),D+=$.x,D<0&&(L=H,D=-D,N-=D),z&&(U=D/z,I+=(y.height-U)/2);break;case q:if($.y<=0&&(I<=le||z&&(N<=we||ie>=ze))){Ie=!1;break}ce(q),U-=$.y,I+=$.y,U<0&&(L=W,U=-U,I-=U),z&&(D=U*z,N+=(y.width-D)/2);break;case H:if($.x<=0&&(N<=we||z&&(I<=le||te>=We))){Ie=!1;break}ce(H),D-=$.x,N+=$.x,D<0&&(L=M,D=-D,N-=D),z&&(U=D/z,I+=(y.height-U)/2);break;case W:if($.y>=0&&(te>=We||z&&(N<=we||ie>=ze))){Ie=!1;break}ce(W),U+=$.y,U<0&&(L=q,U=-U,I-=U),z&&(D=U*z,N+=(y.width-D)/2);break;case Y:if(z){if($.y<=0&&(I<=le||ie>=ze)){Ie=!1;break}ce(q),U-=$.y,I+=$.y,D=U*z}else ce(q),ce(M),$.x>=0?ie<ze?D+=$.x:$.y<=0&&I<=le&&(Ie=!1):D+=$.x,$.y<=0?I>le&&(U-=$.y,I+=$.y):(U-=$.y,I+=$.y);D<0&&U<0?(L=Qe,U=-U,D=-D,I-=U,N-=D):D<0?(L=ne,D=-D,N-=D):U<0&&(L=se,U=-U,I-=U);break;case ne:if(z){if($.y<=0&&(I<=le||N<=we)){Ie=!1;break}ce(q),U-=$.y,I+=$.y,D=U*z,N+=y.width-D}else ce(q),ce(H),$.x<=0?N>we?(D-=$.x,N+=$.x):$.y<=0&&I<=le&&(Ie=!1):(D-=$.x,N+=$.x),$.y<=0?I>le&&(U-=$.y,I+=$.y):(U-=$.y,I+=$.y);D<0&&U<0?(L=se,U=-U,D=-D,I-=U,N-=D):D<0?(L=Y,D=-D,N-=D):U<0&&(L=Qe,U=-U,I-=U);break;case Qe:if(z){if($.x<=0&&(N<=we||te>=We)){Ie=!1;break}ce(H),D-=$.x,N+=$.x,U=D/z}else ce(W),ce(H),$.x<=0?N>we?(D-=$.x,N+=$.x):$.y>=0&&te>=We&&(Ie=!1):(D-=$.x,N+=$.x),$.y>=0?te<We&&(U+=$.y):U+=$.y;D<0&&U<0?(L=Y,U=-U,D=-D,I-=U,N-=D):D<0?(L=se,D=-D,N-=D):U<0&&(L=ne,U=-U,I-=U);break;case se:if(z){if($.x>=0&&(ie>=ze||te>=We)){Ie=!1;break}ce(M),D+=$.x,U=D/z}else ce(W),ce(M),$.x>=0?ie<ze?D+=$.x:$.y>=0&&te>=We&&(Ie=!1):D+=$.x,$.y>=0?te<We&&(U+=$.y):U+=$.y;D<0&&U<0?(L=ne,U=-U,D=-D,I-=U,N-=D):D<0?(L=Qe,D=-D,N-=D):U<0&&(L=Y,U=-U,I-=U);break;case F:this.move($.x,$.y),Ie=!1;break;case O:this.zoom(j(T),h),Ie=!1;break;case A:if(!$.x||!$.y){Ie=!1;break}Li=Js(this.cropper),N=Rt.startX-Li.left,I=Rt.startY-Li.top,D=y.minWidth,U=y.minHeight,$.x>0?L=$.y>0?se:Y:$.x<0&&(N-=D,L=$.y>0?Qe:ne),$.y<0&&(I-=U),this.cropped||(Ot(this.cropBox,be),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}Ie&&(y.width=D,y.height=U,y.left=N,y.top=I,this.action=L,this.renderCropBox()),ge(T,function(He){He.startX=He.endX,He.startY=He.endY})}},db={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&_e(this.dragBox,oe),Ot(this.cropBox,be),this.setCropBoxData(this.initialCropBoxData)),this},reset:function(){return this.ready&&!this.disabled&&(this.imageData=ve({},this.initialImageData),this.canvasData=ve({},this.initialCanvasData),this.cropBoxData=ve({},this.initialCropBoxData),this.renderCanvas(),this.cropped&&this.renderCropBox()),this},clear:function(){return this.cropped&&!this.disabled&&(ve(this.cropBoxData,{left:0,top:0,width:0,height:0}),this.cropped=!1,this.renderCropBox(),this.limitCanvas(!0,!0),this.renderCanvas(),Ot(this.dragBox,oe),_e(this.cropBox,be)),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,ge(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,Ot(this.cropper,Me)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,_e(this.cropper,Me)),this},destroy:function(){var h=this.element;return h[_]?(h[_]=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,x=p.left,y=p.top;return this.moveTo(bi(h)?h:x+Number(h),bi(m)?m:y+Number(m))},moveTo:function(h){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h,p=this.canvasData,x=!1;return h=Number(h),m=Number(m),this.ready&&!this.disabled&&this.options.movable&&(Z(h)&&(p.left=h,x=!0),Z(m)&&(p.top=m,x=!0),x&&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 x=this.options,y=this.canvasData,T=y.width,L=y.height,z=y.naturalWidth,N=y.naturalHeight;if(h=Number(h),h>=0&&this.ready&&!this.disabled&&x.zoomable){var I=z*h,D=N*h;if(Ri(this.element,sr,{ratio:h,oldRatio:T/z,originalEvent:p})===!1)return this;if(p){var U=this.pointers,ie=Js(this.cropper),te=U&&Object.keys(U).length?Ve(U):{pageX:p.pageX,pageY:p.pageY};y.left-=(I-T)*((te.pageX-ie.left-y.left)/T),y.top-=(D-L)*((te.pageY-ie.top-y.top)/L)}else or(m)&&Z(m.x)&&Z(m.y)?(y.left-=(I-T)*((m.x-y.left)/T),y.top-=(D-L)*((m.y-y.top)/L)):(y.left-=(I-T)/2,y.top-=(D-L)/2);y.width=I,y.height=D,this.renderCanvas(!0)}return this},rotate:function(h){return this.rotateTo((this.imageData.rotate||0)+Number(h))},rotateTo:function(h){return h=Number(h),Z(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,Z(m)?m:1)},scaleY:function(h){var m=this.imageData.scaleX;return this.scale(Z(m)?m:1,h)},scale:function(h){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:h,p=this.imageData,x=!1;return h=Number(h),m=Number(m),this.ready&&!this.disabled&&this.options.scalable&&(Z(h)&&(p.scaleX=h,x=!0),Z(m)&&(p.scaleY=m,x=!0),x&&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,x=this.canvasData,y=this.cropBoxData,T;if(this.ready&&this.cropped){T={x:y.left-x.left,y:y.top-x.top,width:y.width,height:y.height};var L=p.width/p.naturalWidth;if(ge(T,function(I,D){T[D]=I/L}),h){var z=Math.round(T.y+T.height),N=Math.round(T.x+T.width);T.x=Math.round(T.x),T.y=Math.round(T.y),T.width=N-T.x,T.height=z-T.y}}else T={x:0,y:0,width:0,height:0};return m.rotatable&&(T.rotate=p.rotate||0),m.scalable&&(T.scaleX=p.scaleX||1,T.scaleY=p.scaleY||1),T},setData:function(h){var m=this.options,p=this.imageData,x=this.canvasData,y={};if(this.ready&&!this.disabled&&or(h)){var T=!1;m.rotatable&&Z(h.rotate)&&h.rotate!==p.rotate&&(p.rotate=h.rotate,T=!0),m.scalable&&(Z(h.scaleX)&&h.scaleX!==p.scaleX&&(p.scaleX=h.scaleX,T=!0),Z(h.scaleY)&&h.scaleY!==p.scaleY&&(p.scaleY=h.scaleY,T=!0)),T&&this.renderCanvas(!0,!0);var L=p.width/p.naturalWidth;Z(h.x)&&(y.left=h.x*L+x.left),Z(h.y)&&(y.top=h.y*L+x.top),Z(h.width)&&(y.width=h.width*L),Z(h.height)&&(y.height=h.height*L),this.setCropBoxData(y)}return this},getContainerData:function(){return this.ready?ve({},this.containerData):{}},getImageData:function(){return this.sized?ve({},this.imageData):{}},getCanvasData:function(){var h=this.canvasData,m={};return this.ready&&ge(["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&&or(h)&&(Z(h.left)&&(m.left=h.left),Z(h.top)&&(m.top=h.top),Z(h.width)?(m.width=h.width,m.height=h.width/p):Z(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,x,y;return this.ready&&this.cropped&&!this.disabled&&or(h)&&(Z(h.left)&&(m.left=h.left),Z(h.top)&&(m.top=h.top),Z(h.width)&&h.width!==m.width&&(x=!0,m.width=h.width),Z(h.height)&&h.height!==m.height&&(y=!0,m.height=h.height),p&&(x?m.height=m.width/p:y&&(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=si(this.image,this.imageData,m,h);if(!this.cropped)return p;var x=this.getData(h.rounded),y=x.x,T=x.y,L=x.width,z=x.height,N=p.width/Math.floor(m.naturalWidth);N!==1&&(y*=N,T*=N,L*=N,z*=N);var I=L/z,D=fe({aspectRatio:I,width:h.maxWidth||1/0,height:h.maxHeight||1/0}),U=fe({aspectRatio:I,width:h.minWidth||0,height:h.minHeight||0},"cover"),ie=fe({aspectRatio:I,width:h.width||(N!==1?p.width:L),height:h.height||(N!==1?p.height:z)}),te=ie.width,we=ie.height;te=Math.min(D.width,Math.max(U.width,te)),we=Math.min(D.height,Math.max(U.height,we));var le=document.createElement("canvas"),ze=le.getContext("2d");le.width=ye(te),le.height=ye(we),ze.fillStyle=h.fillColor||"transparent",ze.fillRect(0,0,te,we);var We=h.imageSmoothingEnabled,Ie=We===void 0?!0:We,Li=h.imageSmoothingQuality;ze.imageSmoothingEnabled=Ie,Li&&(ze.imageSmoothingQuality=Li);var Rt=p.width,$=p.height,ce=y,He=T,qt,Mi,_r,Cr,ur,Si;ce<=-L||ce>Rt?(ce=0,qt=0,_r=0,ur=0):ce<=0?(_r=-ce,ce=0,qt=Math.min(Rt,L+ce),ur=qt):ce<=Rt&&(_r=0,qt=Math.min(L,Rt-ce),ur=qt),qt<=0||He<=-z||He>$?(He=0,Mi=0,Cr=0,Si=0):He<=0?(Cr=-He,He=0,Mi=Math.min($,z+He),Si=Mi):He<=$&&(Cr=0,Mi=Math.min(z,$-He),Si=Mi);var At=[ce,He,qt,Mi];if(ur>0&&Si>0){var Pr=te/L;At.push(_r*Pr,Cr*Pr,ur*Pr,Si*Pr)}return ze.drawImage.apply(ze,[p].concat(c(At.map(function(zo){return Math.floor(ye(zo))})))),le},setAspectRatio:function(h){var m=this.options;return!this.disabled&&!bi(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,x=this.face;if(this.ready&&!this.disabled){var y=h===J,T=m.movable&&h===ht;h=y||T?h:zt,m.dragMode=h,lr(p,ae,h),Oi(p,Ee,y),Oi(p,ut,T),m.cropBoxMovable||(lr(x,ae,h),Oi(x,Ee,y),Oi(x,ut,T))}return this}},pb=R.Cropper,Md=function(){function v(h){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(n(this,v),!h||!Ar.test(h.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=h,this.options=ve({},gs,or(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(v,[{key:"init",value:function(){var m=this.element,p=m.tagName.toLowerCase(),x;if(!m[_]){if(m[_]=this,p==="img"){if(this.isImg=!0,x=m.getAttribute("src")||"",this.originalUrl=x,!x)return;x=m.src}else p==="canvas"&&window.HTMLCanvasElement&&(x=m.toDataURL());this.load(x)}}},{key:"load",value:function(m){var p=this;if(m){this.url=m,this.imageData={};var x=this.element,y=this.options;if(!y.rotatable&&!y.scalable&&(y.checkOrientation=!1),!y.checkOrientation||!window.ArrayBuffer){this.clone();return}if(ti.test(m)){ii.test(m)?this.read(Bo(m)):this.clone();return}var T=new XMLHttpRequest,L=this.clone.bind(this);this.reloading=!0,this.xhr=T,T.onabort=L,T.onerror=L,T.ontimeout=L,T.onprogress=function(){T.getResponseHeader("content-type")!==Fi&&T.abort()},T.onload=function(){p.read(T.response)},T.onloadend=function(){p.reloading=!1,p.xhr=null},y.checkCrossOrigin&&G(m)&&x.crossOrigin&&(m=S(m)),T.open("GET",m,!0),T.responseType="arraybuffer",T.withCredentials=x.crossOrigin==="use-credentials",T.send()}}},{key:"read",value:function(m){var p=this.options,x=this.imageData,y=nb(m),T=0,L=1,z=1;if(y>1){this.url=Uo(m,Fi);var N=ob(y);T=N.rotate,L=N.scaleX,z=N.scaleY}p.rotatable&&(x.rotate=T),p.scalable&&(x.scaleX=L,x.scaleY=z),this.clone()}},{key:"clone",value:function(){var m=this.element,p=this.url,x=m.crossOrigin,y=p;this.options.checkCrossOrigin&&G(p)&&(x||(x="anonymous"),y=S(p)),this.crossOrigin=x,this.crossOriginUrl=y;var T=document.createElement("img");x&&(T.crossOrigin=x),T.src=y||p,T.alt=m.alt||"The image to crop",this.image=T,T.onload=this.start.bind(this),T.onerror=this.stop.bind(this),_e(T,ct),m.parentNode.insertBefore(T,m.nextSibling)}},{key:"start",value:function(){var m=this,p=this.image;p.onload=null,p.onerror=null,this.sizing=!0;var x=R.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(R.navigator.userAgent),y=function(N,I){ve(m.imageData,{naturalWidth:N,naturalHeight:I,aspectRatio:N/I}),m.initialImageData=ve({},m.imageData),m.sizing=!1,m.sized=!0,m.build()};if(p.naturalWidth&&!x){y(p.naturalWidth,p.naturalHeight);return}var T=document.createElement("img"),L=document.body||document.documentElement;this.sizingImage=T,T.onload=function(){y(T.width,T.height),x||L.removeChild(T)},T.src=p.src,x||(T.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;",L.appendChild(T))}},{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,x=this.image,y=m.parentNode,T=document.createElement("div");T.innerHTML=Mo;var L=T.querySelector(".".concat(_,"-container")),z=L.querySelector(".".concat(_,"-canvas")),N=L.querySelector(".".concat(_,"-drag-box")),I=L.querySelector(".".concat(_,"-crop-box")),D=I.querySelector(".".concat(_,"-face"));this.container=y,this.cropper=L,this.canvas=z,this.dragBox=N,this.cropBox=I,this.viewBox=L.querySelector(".".concat(_,"-view-box")),this.face=D,z.appendChild(x),_e(m,be),y.insertBefore(L,m.nextSibling),Ot(x,ct),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,_e(I,be),p.guides||_e(I.getElementsByClassName("".concat(_,"-dashed")),be),p.center||_e(I.getElementsByClassName("".concat(_,"-center")),be),p.background&&_e(L,"".concat(_,"-bg")),p.highlight||_e(D,Ut),p.cropBoxMovable&&(_e(D,ut),lr(D,ae,E)),p.cropBoxResizable||(_e(I.getElementsByClassName("".concat(_,"-line")),be),_e(I.getElementsByClassName("".concat(_,"-point")),be)),this.render(),this.ready=!0,this.setDragMode(p.dragMode),p.autoCrop&&this.crop(),this.setData(p.data),Ue(p.ready)&&pt(m,Pi,p.ready,{once:!0}),Ri(m,Pi)}}},{key:"unbuild",value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var m=this.cropper.parentNode;m&&m.removeChild(this.cropper),Ot(this.element,be)}}},{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=pb,v}},{key:"setDefaults",value:function(m){ve(gs,or(m)&&m)}}])}();return ve(Md.prototype,ab,lb,cb,ub,hb,db),Md})});(function(i){if(typeof i.requestSubmit=="function")return;i.requestSubmit=function(r){r?(e(r,this),r.click()):(r=document.createElement("input"),r.type="submit",r.hidden=!0,this.appendChild(r),r.click(),this.removeChild(r))};function e(r,s){r instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),r.type=="submit"||t(TypeError,"The specified element is not a submit button"),r.form==s||t(DOMException,"The specified element is not owned by this form element","NotFoundError")}function t(r,s,n){throw new r("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+s+".",n)}})(HTMLFormElement.prototype);var Gd=new WeakMap;function Eb(i){let e=i instanceof Element?i:i instanceof Node?i.parentElement:null,t=e?e.closest("input, button"):null;return t?.type=="submit"?t:null}function Tb(i){let e=Eb(i.target);e&&e.form&&Gd.set(e.form,e)}(function(){if("submitter"in Event.prototype)return;let i=window.Event.prototype;if("SubmitEvent"in window){let e=window.SubmitEvent.prototype;if(/Apple Computer/.test(navigator.vendor)&&!("submitter"in e))i=e;else return}addEventListener("click",Tb,!0),Object.defineProperty(i,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return Gd.get(this.target)}})})();var Es={eager:"eager",lazy:"lazy"},oi=class i extends HTMLElement{static delegateConstructor=void 0;loaded=Promise.resolve();static get observedAttributes(){return["disabled","loading","src"]}constructor(){super(),this.delegate=new i.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){e=="loading"?this.delegate.loadingStyleChanged():e=="src"?this.delegate.sourceURLChanged():e=="disabled"&&this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(e){e?this.setAttribute("refresh",e):this.removeAttribute("refresh")}get shouldReloadWithMorph(){return this.src&&this.refresh==="morph"}get loading(){return xb(this.getAttribute("loading")||"")}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){return this.ownerDocument?.documentElement?.hasAttribute("data-turbo-preview")}};function xb(i){switch(i.toLowerCase()){case"lazy":return Es.lazy;default:return Es.eager}}var kb={enabled:!0,progressBarDelay:500,unvisitableExtensions:new Set([".7z",".aac",".apk",".avi",".bmp",".bz2",".css",".csv",".deb",".dmg",".doc",".docx",".exe",".gif",".gz",".heic",".heif",".ico",".iso",".jpeg",".jpg",".js",".json",".m4a",".mkv",".mov",".mp3",".mp4",".mpeg",".mpg",".msi",".ogg",".ogv",".pdf",".pkg",".png",".ppt",".pptx",".rar",".rtf",".svg",".tar",".tif",".tiff",".txt",".wav",".webm",".webp",".wma",".wmv",".xls",".xlsx",".xml",".zip"])};function rn(i){if(i.getAttribute("data-turbo-eval")=="false")return i;{let e=document.createElement("script"),t=Jd();return t&&(e.nonce=t),e.textContent=i.textContent,e.async=!1,Ab(e,i),e}}function Ab(i,e){for(let{name:t,value:r}of e.attributes)i.setAttribute(t,r)}function _b(i){let e=document.createElement("template");return e.innerHTML=i,e.content}function xe(i,{target:e,cancelable:t,detail:r}={}){let s=new CustomEvent(i,{cancelable:t,bubbles:!0,composed:!0,detail:r});return e&&e.isConnected?e.dispatchEvent(s):document.documentElement.dispatchEvent(s),s}function zd(i){i.preventDefault(),i.stopImmediatePropagation()}function tn(){return document.visibilityState==="hidden"?Xd():Kd()}function Kd(){return new Promise(i=>requestAnimationFrame(()=>i()))}function Xd(){return new Promise(i=>setTimeout(()=>i(),0))}function Cb(){return Promise.resolve()}function Yd(i=""){return new DOMParser().parseFromString(i,"text/html")}function Zd(i,...e){let t=Pb(i,e).replace(/^\n/,"").split(`
|
|
1
|
+
(()=>{var Zv=Object.create;var Ld=Object.defineProperty;var Qv=Object.getOwnPropertyDescriptor;var Jv=Object.getOwnPropertyNames;var eb=Object.getPrototypeOf,tb=Object.prototype.hasOwnProperty;var Me=(i,e)=>()=>(e||i((e={exports:{}}).exports,e),e.exports);var ib=(i,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Jv(e))!tb.call(i,s)&&s!==t&&Ld(i,s,{get:()=>e[s],enumerable:!(r=Qv(e,s))||r.enumerable});return i};var Fe=(i,e,t)=>(t=i!=null?Zv(eb(i)):{},ib(e||!i||!i.__esModule?Ld(t,"default",{value:i,enumerable:!0}):t,i));var Sf=Me((u5,wf)=>{wf.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<f;d++)c[d]!==a&&l.push(c[d])}l.length?this._fns[o]=l:delete this._fns[o]};function r(n){var o=t[n]?t[n]:[],a=n.indexOf(":"),l=a===-1?[n]:[n.substring(0,a),n.substring(a+1)],c=Object.keys(t),d=0,f=c.length;for(d;d<f;d++){var y=c[d];if(y==="*"&&(o=o.concat(t[y])),l.length===2&&l[0]===y){o=o.concat(t[y]);break}}return o}function s(n,o,a){var l=0,c=o.length;for(l;l<c&&o[l];l++)o[l].event=n,o[l].apply(o[l],a)}return e}});var Ma=Me((d5,Ef)=>{function Qw(i){var e=typeof i;return i!=null&&(e=="object"||e=="function")}Ef.exports=Qw});var xf=Me((p5,Tf)=>{var Jw=typeof global=="object"&&global&&global.Object===Object&&global;Tf.exports=Jw});var Pu=Me((f5,kf)=>{var e1=xf(),t1=typeof self=="object"&&self&&self.Object===Object&&self,i1=e1||t1||Function("return this")();kf.exports=i1});var Cf=Me((m5,Af)=>{var r1=Pu(),s1=function(){return r1.Date.now()};Af.exports=s1});var Ff=Me((g5,Pf)=>{var n1=/\s/;function o1(i){for(var e=i.length;e--&&n1.test(i.charAt(e)););return e}Pf.exports=o1});var Of=Me((v5,_f)=>{var a1=Ff(),l1=/^\s+/;function c1(i){return i&&i.slice(0,a1(i)+1).replace(l1,"")}_f.exports=c1});var Fu=Me((b5,Lf)=>{var u1=Pu(),h1=u1.Symbol;Lf.exports=h1});var Df=Me((y5,If)=>{var Rf=Fu(),Mf=Object.prototype,d1=Mf.hasOwnProperty,p1=Mf.toString,Ln=Rf?Rf.toStringTag:void 0;function f1(i){var e=d1.call(i,Ln),t=i[Ln];try{i[Ln]=void 0;var r=!0}catch{}var s=p1.call(i);return r&&(e?i[Ln]=t:delete i[Ln]),s}If.exports=f1});var Bf=Me((w5,Nf)=>{var m1=Object.prototype,g1=m1.toString;function v1(i){return g1.call(i)}Nf.exports=v1});var $f=Me((S5,Hf)=>{var Uf=Fu(),b1=Df(),y1=Bf(),w1="[object Null]",S1="[object Undefined]",zf=Uf?Uf.toStringTag:void 0;function E1(i){return i==null?i===void 0?S1:w1:zf&&zf in Object(i)?b1(i):y1(i)}Hf.exports=E1});var Vf=Me((E5,qf)=>{function T1(i){return i!=null&&typeof i=="object"}qf.exports=T1});var Wf=Me((T5,jf)=>{var x1=$f(),k1=Vf(),A1="[object Symbol]";function C1(i){return typeof i=="symbol"||k1(i)&&x1(i)==A1}jf.exports=C1});var Yf=Me((x5,Xf)=>{var P1=Of(),Gf=Ma(),F1=Wf(),Kf=NaN,_1=/^[-+]0x[0-9a-f]+$/i,O1=/^0b[01]+$/i,L1=/^0o[0-7]+$/i,R1=parseInt;function M1(i){if(typeof i=="number")return i;if(F1(i))return Kf;if(Gf(i)){var e=typeof i.valueOf=="function"?i.valueOf():i;i=Gf(e)?e+"":e}if(typeof i!="string")return i===0?i:+i;i=P1(i);var t=O1.test(i);return t||L1.test(i)?R1(i.slice(2),t?2:8):_1.test(i)?Kf:+i}Xf.exports=M1});var Ou=Me((k5,Qf)=>{var I1=Ma(),_u=Cf(),Zf=Yf(),D1="Expected a function",N1=Math.max,B1=Math.min;function U1(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(D1);e=Zf(e)||0,I1(t)&&(d=!!t.leading,f="maxWait"in t,n=f?N1(Zf(t.maxWait)||0,e):n,y="trailing"in t?!!t.trailing:y);function v(z){var G=r,K=s;return r=s=void 0,c=z,o=i.apply(K,G),o}function x(z){return c=z,a=setTimeout(L,e),d?v(z):o}function C(z){var G=z-l,K=z-c,Q=e-G;return f?B1(Q,n-K):Q}function F(z){var G=z-l,K=z-c;return l===void 0||G>=e||G<0||f&&K>=n}function L(){var z=_u();if(F(z))return D(z);a=setTimeout(L,C(z))}function D(z){return a=void 0,y&&r?v(z):(r=s=void 0,o)}function V(){a!==void 0&&clearTimeout(a),c=0,r=l=s=a=void 0}function M(){return a===void 0?o:D(_u())}function $(){var z=_u(),G=F(z);if(r=arguments,s=this,l=z,G){if(a===void 0)return x(l);if(f)return clearTimeout(a),a=setTimeout(L,e),v(l)}return a===void 0&&(a=setTimeout(L,e)),o}return $.cancel=V,$.flush=M,$}Qf.exports=U1});var em=Me((A5,Jf)=>{var z1=Ou(),H1=Ma(),$1="Expected a function";function q1(i,e,t){var r=!0,s=!0;if(typeof i!="function")throw new TypeError($1);return H1(t)&&(r="leading"in t?!!t.leading:r,s="trailing"in t?!!t.trailing:s),z1(i,e,{leading:r,maxWait:e,trailing:s})}Jf.exports=q1});var Ba=Me((z5,am)=>{"use strict";am.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 um=Me((H5,cm)=>{"use strict";function lm(i,e){this.text=i=i||"",this.hasWild=~i.indexOf("*"),this.separator=e,this.parts=i.split(e)}lm.prototype.match=function(i){var e=!0,t=this.parts,r,s=t.length,n;if(typeof i=="string"||i instanceof String)if(!this.hasWild&&this.text!=i)e=!1;else{for(n=(i||"").split(this.separator),r=0;e&&r<s;r++)t[r]!=="*"&&(r<n.length?e=t[r]===n[r]:e=!1);e=e&&n}else if(typeof i.splice=="function")for(e=[],r=i.length;r--;)this.match(i[r])&&(e[e.length]=i[r]);else if(typeof i=="object"){e={};for(var o in i)this.match(o)&&(e[o]=i[o])}return e};cm.exports=function(i,e,t){var r=new lm(i,t||/[\/\.]/);return typeof e<"u"?r.match(e):r}});var dm=Me(($5,hm)=>{var X1=um(),Y1=/[\/\+\.]/;hm.exports=function(i,e){function t(r){var s=X1(r,i,Y1);return s&&s.length>=2}return e?t(e.split(";")[0]):t}});var wt=Me((S2,Ka)=>{(function(){"use strict";var i={}.hasOwnProperty;function e(){for(var s="",n=0;n<arguments.length;n++){var o=arguments[n];o&&(s=r(s,t(o)))}return s}function t(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return e.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var n="";for(var o in s)i.call(s,o)&&s[o]&&(n=r(n,o));return n}function r(s,n){return n?s?s+" "+n:s+n:s}typeof Ka<"u"&&Ka.exports?(e.default=e,Ka.exports=e):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return e}):window.classNames=e})()});var Ig=Me((m_,Dh)=>{"use strict";var xE=Object.prototype.hasOwnProperty,Et="~";function uo(){}Object.create&&(uo.prototype=Object.create(null),new uo().__proto__||(Et=!1));function kE(i,e,t){this.fn=i,this.context=e,this.once=t||!1}function Mg(i,e,t,r,s){if(typeof t!="function")throw new TypeError("The listener must be a function");var n=new kE(t,r||i,s),o=Et?Et+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 pl(i,e){--i._eventsCount===0?i._events=new uo:delete i._events[e]}function pt(){this._events=new uo,this._eventsCount=0}pt.prototype.eventNames=function(){var e=[],t,r;if(this._eventsCount===0)return e;for(r in t=this._events)xE.call(t,r)&&e.push(Et?r.slice(1):r);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e};pt.prototype.listeners=function(e){var t=Et?Et+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<n;s++)o[s]=r[s].fn;return o};pt.prototype.listenerCount=function(e){var t=Et?Et+e:e,r=this._events[t];return r?r.fn?1:r.length:0};pt.prototype.emit=function(e,t,r,s,n,o){var a=Et?Et+e:e;if(!this._events[a])return!1;var l=this._events[a],c=arguments.length,d,f;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),c){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,r),!0;case 4:return l.fn.call(l.context,t,r,s),!0;case 5:return l.fn.call(l.context,t,r,s,n),!0;case 6:return l.fn.call(l.context,t,r,s,n,o),!0}for(f=1,d=new Array(c-1);f<c;f++)d[f-1]=arguments[f];l.fn.apply(l.context,d)}else{var y=l.length,v;for(f=0;f<y;f++)switch(l[f].once&&this.removeListener(e,l[f].fn,void 0,!0),c){case 1:l[f].fn.call(l[f].context);break;case 2:l[f].fn.call(l[f].context,t);break;case 3:l[f].fn.call(l[f].context,t,r);break;case 4:l[f].fn.call(l[f].context,t,r,s);break;default:if(!d)for(v=1,d=new Array(c-1);v<c;v++)d[v-1]=arguments[v];l[f].fn.apply(l[f].context,d)}}return!0};pt.prototype.on=function(e,t,r){return Mg(this,e,t,r,!1)};pt.prototype.once=function(e,t,r){return Mg(this,e,t,r,!0)};pt.prototype.removeListener=function(e,t,r,s){var n=Et?Et+e:e;if(!this._events[n])return this;if(!t)return pl(this,n),this;var o=this._events[n];if(o.fn)o.fn===t&&(!s||o.once)&&(!r||o.context===r)&&pl(this,n);else{for(var a=0,l=[],c=o.length;a<c;a++)(o[a].fn!==t||s&&!o[a].once||r&&o[a].context!==r)&&l.push(o[a]);l.length?this._events[n]=l.length===1?l[0]:l:pl(this,n)}return this};pt.prototype.removeAllListeners=function(e){var t;return e?(t=Et?Et+e:e,this._events[t]&&pl(this,t)):(this._events=new uo,this._eventsCount=0),this};pt.prototype.off=pt.prototype.removeListener;pt.prototype.addListener=pt.prototype.on;pt.prefixed=Et;pt.EventEmitter=pt;typeof Dh<"u"&&(Dh.exports=pt)});var wv=Me((pd,fd)=>{(function(i,e){typeof pd=="object"&&typeof fd<"u"?fd.exports=e():typeof define=="function"&&define.amd?define(e):(i=typeof globalThis<"u"?globalThis:i||self,i.Cropper=e())})(pd,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;h<arguments.length;h++){var m=arguments[h]!=null?arguments[h]:{};h%2?i(Object(m),!0).forEach(function(p){l(g,p,m[p])}):Object.getOwnPropertyDescriptors?Object.defineProperties(g,Object.getOwnPropertyDescriptors(m)):i(Object(m)).forEach(function(p){Object.defineProperty(g,p,Object.getOwnPropertyDescriptor(m,p))})}return g}function t(g,h){if(typeof g!="object"||!g)return g;var m=g[Symbol.toPrimitive];if(m!==void 0){var p=m.call(g,h||"default");if(typeof p!="object")return p;throw new TypeError("@@toPrimitive must return a primitive value.")}return(h==="string"?String:Number)(g)}function r(g){var h=t(g,"string");return typeof h=="symbol"?h:h+""}function s(g){"@babel/helpers - typeof";return s=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(h){return typeof h}:function(h){return h&&typeof Symbol=="function"&&h.constructor===Symbol&&h!==Symbol.prototype?"symbol":typeof h},s(g)}function n(g,h){if(!(g instanceof h))throw new TypeError("Cannot call a class as a function")}function o(g,h){for(var m=0;m<h.length;m++){var p=h[m];p.enumerable=p.enumerable||!1,p.configurable=!0,"value"in p&&(p.writable=!0),Object.defineProperty(g,r(p.key),p)}}function a(g,h,m){return h&&o(g.prototype,h),m&&o(g,m),Object.defineProperty(g,"prototype",{writable:!1}),g}function l(g,h,m){return h=r(h),h in g?Object.defineProperty(g,h,{value:m,enumerable:!0,configurable:!0,writable:!0}):g[h]=m,g}function c(g){return d(g)||f(g)||y(g)||x()}function d(g){if(Array.isArray(g))return v(g)}function f(g){if(typeof Symbol<"u"&&g[Symbol.iterator]!=null||g["@@iterator"]!=null)return Array.from(g)}function y(g,h){if(g){if(typeof g=="string")return v(g,h);var m=Object.prototype.toString.call(g).slice(8,-1);if(m==="Object"&&g.constructor&&(m=g.constructor.name),m==="Map"||m==="Set")return Array.from(g);if(m==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(m))return v(g,h)}}function v(g,h){(h==null||h>g.length)&&(h=g.length);for(var m=0,p=new Array(h);m<h;m++)p[m]=g[m];return p}function x(){throw new TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var C=typeof window<"u"&&typeof window.document<"u",F=C?window:{},L=C&&F.document.documentElement?"ontouchstart"in F.document.documentElement:!1,D=C?"PointerEvent"in F:!1,V="cropper",M="all",$="crop",z="move",G="zoom",K="e",Q="w",ne="s",Y="n",re="ne",le="nw",ke="se",We="sw",T="".concat(V,"-crop"),k="".concat(V,"-disabled"),A="".concat(V,"-hidden"),H="".concat(V,"-hide"),j="".concat(V,"-invisible"),U="".concat(V,"-modal"),ee="".concat(V,"-move"),te="".concat(V,"Action"),Ae="".concat(V,"Preview"),oe="crop",ce="move",Le="none",De="crop",He="cropend",gi="cropmove",vi="cropstart",Zt="dblclick",tr=L?"touchstart":"mousedown",Qt=L?"touchmove":"mousemove",Sr=L?"touchend touchcancel":"mouseup",Pi=D?"pointerdown":tr,zt=D?"pointermove":Qt,Fi=D?"pointerup pointercancel":Sr,_i="ready",_t="resize",bi="wheel",ir="zoom",Oi="image/jpeg",Jt=/^e|w|s|n|se|sw|ne|nw|all|crop|move|zoom$/,ei=/^data:/,ti=/^data:image\/jpeg;base64,/,Er=/^img|canvas$/i,rr=200,Js=100,gs={viewMode:0,dragMode:oe,initialAspectRatio:NaN,aspectRatio:NaN,data:null,preview:"",responsive:!0,restore:!0,checkCrossOrigin:!0,checkOrientation:!0,modal:!0,guides:!0,center:!0,highlight:!0,background:!0,autoCrop:!0,autoCropArea:.8,movable:!0,rotatable:!0,scalable:!0,zoomable:!0,zoomOnTouch:!0,zoomOnWheel:!0,wheelZoomRatio:.1,cropBoxMovable:!0,cropBoxResizable:!0,toggleDragModeOnDblclick:!0,minCanvasWidth:0,minCanvasHeight:0,minCropBoxWidth:0,minCropBoxHeight:0,minContainerWidth:rr,minContainerHeight:Js,ready:null,cropstart:null,cropmove:null,cropend:null,crop:null,zoom:null},Mo='<div class="cropper-container" touch-action="none"><div class="cropper-wrap-box"><div class="cropper-canvas"></div></div><div class="cropper-drag-box"></div><div class="cropper-crop-box"><span class="cropper-view-box"></span><span class="cropper-dashed dashed-h"></span><span class="cropper-dashed dashed-v"></span><span class="cropper-center"></span><span class="cropper-face"></span><span class="cropper-line line-e" data-cropper-action="e"></span><span class="cropper-line line-n" data-cropper-action="n"></span><span class="cropper-line line-w" data-cropper-action="w"></span><span class="cropper-line line-s" data-cropper-action="s"></span><span class="cropper-point point-e" data-cropper-action="e"></span><span class="cropper-point point-n" data-cropper-action="n"></span><span class="cropper-point point-w" data-cropper-action="w"></span><span class="cropper-point point-s" data-cropper-action="s"></span><span class="cropper-point point-ne" data-cropper-action="ne"></span><span class="cropper-point point-nw" data-cropper-action="nw"></span><span class="cropper-point point-sw" data-cropper-action="sw"></span><span class="cropper-point point-se" data-cropper-action="se"></span></div></div>',vs=Number.isNaN||F.isNaN;function se(g){return typeof g=="number"&&!vs(g)}var Ht=function(h){return h>0&&h<1/0};function yi(g){return typeof g>"u"}function ii(g){return s(g)==="object"&&g!==null}var en=Object.prototype.hasOwnProperty;function sr(g){if(!ii(g))return!1;try{var h=g.constructor,m=h.prototype;return h&&m&&en.call(m,"isPrototypeOf")}catch{return!1}}function Ge(g){return typeof g=="function"}var bs=Array.prototype.slice;function Io(g){return Array.from?Array.from(g):bs.call(g)}function ye(g,h){return g&&Ge(h)&&(Array.isArray(g)||se(g.length)?Io(g).forEach(function(m,p){h.call(g,m,p,g)}):ii(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;E<m;E++)p[E-1]=arguments[E];return ii(h)&&p.length>0&&p.forEach(function(b){ii(b)&&Object.keys(b).forEach(function(S){h[S]=b[S]})}),h},Nl=/\.\d*(?:0|9){12}\d*$/;function Te(g){var h=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1e11;return Nl.test(g)?Math.round(g*h)/h:g}var nr=/^width|height|left|top|marginLeft|marginTop$/;function wi(g,h){var m=g.style;ye(h,function(p,E){nr.test(E)&&se(p)&&(p="".concat(p,"px")),m[E]=p})}function Do(g,h){return g.classList?g.classList.contains(h):g.className.indexOf(h)>-1}function Re(g,h){if(h){if(se(g.length)){ye(g,function(p){Re(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 Ot(g,h){if(h){if(se(g.length)){ye(g,function(m){Ot(m,h)});return}if(g.classList){g.classList.remove(h);return}g.className.indexOf(h)>=0&&(g.className=g.className.replace(h,""))}}function Li(g,h,m){if(h){if(se(g.length)){ye(g,function(p){Li(p,h,m)});return}m?Re(g,h):Ot(g,h)}}var Bl=/([a-z\d])([A-Z])/g;function At(g){return g.replace(Bl,"$1-$2").toLowerCase()}function or(g,h){return ii(g[h])?g[h]:g.dataset?g.dataset[h]:g.getAttribute("data-".concat(At(h)))}function ar(g,h,m){ii(m)?g[h]=m:g.dataset?g.dataset[h]=m:g.setAttribute("data-".concat(At(h)),m)}function No(g,h){if(ii(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(At(h)))}var ys=/\s\s*/,tn=function(){var g=!1;if(C){var h=!1,m=function(){},p=Object.defineProperty({},"once",{get:function(){return g=!0,h},set:function(b){h=b}});F.addEventListener("test",m,p),F.removeEventListener("test",m,p)}return g}();function Ne(g,h,m){var p=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},E=m;h.trim().split(ys).forEach(function(b){if(!tn){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 ft(g,h,m){var p=arguments.length>3&&arguments[3]!==void 0?arguments[3]:{},E=m;h.trim().split(ys).forEach(function(b){if(p.once&&!tn){var S=g.listeners,P=S===void 0?{}:S;E=function(){delete P[b][m],g.removeEventListener(b,E,p);for(var R=arguments.length,_=new Array(R),O=0;O<R;O++)_[O]=arguments[O];m.apply(g,_)},P[b]||(P[b]={}),P[b][m]&&g.removeEventListener(b,P[b][m],p),P[b][m]=E,g.listeners=P}g.addEventListener(b,E,p)})}function Ri(g,h,m){var p;return Ge(Event)&&Ge(CustomEvent)?p=new CustomEvent(h,{detail:m,bubbles:!0,cancelable:!0}):(p=document.createEvent("CustomEvent"),p.initCustomEvent(h,!0,!0,m)),g.dispatchEvent(p)}function rn(g){var h=g.getBoundingClientRect();return{left:h.left+(window.pageXOffset-document.documentElement.clientLeft),top:h.top+(window.pageYOffset-document.documentElement.clientTop)}}var ws=F.location,Ul=/^(\w+:)\/\/([^:/?#]*):?(\d*)/i;function Z(g){var h=g.match(Ul);return h!==null&&(h[1]!==ws.protocol||h[2]!==ws.hostname||h[3]!==ws.port)}function w(g){var h="timestamp=".concat(new Date().getTime());return g+(g.indexOf("?")===-1?"?":"&")+h}function I(g){var h=g.rotate,m=g.scaleX,p=g.scaleY,E=g.translateX,b=g.translateY,S=[];se(E)&&E!==0&&S.push("translateX(".concat(E,"px)")),se(b)&&b!==0&&S.push("translateY(".concat(b,"px)")),se(h)&&h!==0&&S.push("rotate(".concat(h,"deg)")),se(m)&&m!==1&&S.push("scaleX(".concat(m,")")),se(p)&&p!==1&&S.push("scaleY(".concat(p,")"));var P=S.length?S.join(" "):"none";return{WebkitTransform:P,msTransform:P,transform:P}}function X(g){var h=e({},g),m=0;return ye(g,function(p,E){delete h[E],ye(h,function(b){var S=Math.abs(p.startX-b.startX),P=Math.abs(p.startY-b.startY),B=Math.abs(p.endX-b.endX),R=Math.abs(p.endY-b.endY),_=Math.sqrt(S*S+P*P),O=Math.sqrt(B*B+R*R),N=(O-_)/_;Math.abs(N)>Math.abs(m)&&(m=N)})}),m}function be(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=Ht(p),S=Ht(m);if(b&&S){var P=m*h;E==="contain"&&P>p||E==="cover"&&P<p?m=p/h:p=m*h}else b?m=p/h:S&&(p=m*h);return{width:p,height:m}}function ht(g){var h=g.width,m=g.height,p=g.degree;if(p=Math.abs(p)%180,p===90)return{width:m,height:h};var E=p%90*Math.PI/180,b=Math.sin(E),S=Math.cos(E),P=h*S+m*b,B=h*b+m*S;return p>90?{width:B,height:P}:{width:P,height:B}}function $t(g,h,m,p){var E=h.aspectRatio,b=h.naturalWidth,S=h.naturalHeight,P=h.rotate,B=P===void 0?0:P,R=h.scaleX,_=R===void 0?1:R,O=h.scaleY,N=O===void 0?1:O,he=m.aspectRatio,ue=m.naturalWidth,Ce=m.naturalHeight,pe=p.fillColor,Ke=pe===void 0?"transparent":pe,Je=p.imageSmoothingEnabled,$e=Je===void 0?!0:Je,Mi=p.imageSmoothingQuality,Lt=Mi===void 0?"low":Mi,q=p.maxWidth,fe=q===void 0?1/0:q,Xe=p.maxHeight,qt=Xe===void 0?1/0:Xe,Ii=p.minWidth,Tr=Ii===void 0?0:Ii,xr=p.minHeight,cr=xr===void 0?0:xr,Si=document.createElement("canvas"),Ct=Si.getContext("2d"),kr=Se({aspectRatio:he,width:fe,height:qt}),zo=Se({aspectRatio:he,width:Tr,height:cr},"cover"),zl=Math.min(kr.width,Math.max(zo.width,ue)),Hl=Math.min(kr.height,Math.max(zo.height,Ce)),Pd=Se({aspectRatio:E,width:fe,height:qt}),Fd=Se({aspectRatio:E,width:Tr,height:cr},"cover"),_d=Math.min(Pd.width,Math.max(Fd.width,b)),Od=Math.min(Pd.height,Math.max(Fd.height,S)),Xv=[-_d/2,-Od/2,_d,Od];return Si.width=Te(zl),Si.height=Te(Hl),Ct.fillStyle=Ke,Ct.fillRect(0,0,zl,Hl),Ct.save(),Ct.translate(zl/2,Hl/2),Ct.rotate(B*Math.PI/180),Ct.scale(_,N),Ct.imageSmoothingEnabled=$e,Ct.imageSmoothingQuality=Lt,Ct.drawImage.apply(Ct,[g].concat(c(Xv.map(function(Yv){return Math.floor(Te(Yv))})))),Ct.restore(),Si}var lr=String.fromCharCode;function nt(g,h,m){var p="";m+=h;for(var E=h;E<m;E+=1)p+=lr(g.getUint8(E));return p}var Bo=/^data:.*,/;function Uo(g){var h=g.replace(Bo,""),m=atob(h),p=new ArrayBuffer(m.length),E=new Uint8Array(p);return ye(E,function(b,S){E[S]=m.charCodeAt(S)}),p}function Uv(g,h){for(var m=[],p=8192,E=new Uint8Array(g);E.length>0;)m.push(lr.apply(null,Io(E.subarray(0,p)))),E=E.subarray(p);return"data:".concat(h,";base64,").concat(btoa(m.join("")))}function zv(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,P=2;P+1<S;){if(h.getUint8(P)===255&&h.getUint8(P+1)===225){E=P;break}P+=1}if(E){var B=E+4,R=E+10;if(nt(h,B,4)==="Exif"){var _=h.getUint16(R);if(p=_===18761,(p||_===19789)&&h.getUint16(R+2,p)===42){var O=h.getUint32(R+4,p);O>=8&&(b=R+O)}}}if(b){var N=h.getUint16(b,p),he,ue;for(ue=0;ue<N;ue+=1)if(he=b+ue*12+2,h.getUint16(he,p)===274){he+=8,m=h.getUint16(he,p),h.setUint16(he,1,p);break}}}catch{m=1}return m}function Hv(g){var h=0,m=1,p=1;switch(g){case 2:m=-1;break;case 3:h=-180;break;case 4:p=-1;break;case 5:h=90,p=-1;break;case 6:h=90;break;case 7:h=90,m=-1;break;case 8:h=-90;break}return{rotate:h,scaleX:m,scaleY:p}}var $v={render:function(){this.initContainer(),this.initCanvas(),this.initCropBox(),this.renderCanvas(),this.cropped&&this.renderCropBox()},initContainer:function(){var h=this.element,m=this.options,p=this.container,E=this.cropper,b=Number(m.minContainerWidth),S=Number(m.minContainerHeight);Re(E,A),Ot(h,A);var P={width:Math.max(p.offsetWidth,b>=0?b:rr),height:Math.max(p.offsetHeight,S>=0?S:Js)};this.containerData=P,wi(E,{width:P.width,height:P.height}),Re(h,A),Ot(E,A)},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,P=b/S,B=h.width,R=h.height;h.height*P>h.width?p===3?B=h.height*P:R=h.width/P:p===3?R=h.width/P:B=h.height*P;var _={aspectRatio:P,naturalWidth:b,naturalHeight:S,width:B,height:R};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,P=p.viewMode,B=b.aspectRatio,R=this.cropped&&S;if(h){var _=Number(p.minCanvasWidth)||0,O=Number(p.minCanvasHeight)||0;P>1?(_=Math.max(_,E.width),O=Math.max(O,E.height),P===3&&(O*B>_?_=O*B:O=_/B)):P>0&&(_?_=Math.max(_,R?S.width:0):O?O=Math.max(O,R?S.height:0):R&&(_=S.width,O=S.height,O*B>_?_=O*B:O=_/B));var N=Se({aspectRatio:B,width:_,height:O});_=N.width,O=N.height,b.minWidth=_,b.minHeight=O,b.maxWidth=1/0,b.maxHeight=1/0}if(m)if(P>(R?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),R&&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,P===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=ht({width:E.naturalWidth*Math.abs(E.scaleX||1),height:E.naturalHeight*Math.abs(E.scaleY||1),degree:E.rotate||0}),S=b.width,P=b.height,B=p.width*(S/p.naturalWidth),R=p.height*(P/p.naturalHeight);p.left-=(B-p.width)/2,p.top-=(R-p.height)/2,p.width=B,p.height=R,p.aspectRatio=S/P,p.naturalWidth=S,p.naturalHeight=P,this.limitCanvas(!0,!1)}(p.width>p.maxWidth||p.width<p.minWidth)&&(p.left=p.oldLeft),(p.height>p.maxHeight||p.height<p.minHeight)&&(p.top=p.oldTop),p.width=Math.min(Math.max(p.width,p.minWidth),p.maxWidth),p.height=Math.min(Math.max(p.height,p.minHeight),p.maxHeight),this.limitCanvas(!1,!0),p.left=Math.min(Math.max(p.left,p.minLeft),p.maxLeft),p.top=Math.min(Math.max(p.top,p.minTop),p.maxTop),p.oldLeft=p.left,p.oldTop=p.top,wi(this.canvas,we({width:p.width,height:p.height},I({translateX:p.left,translateY:p.top}))),this.renderImage(h),this.cropped&&this.limited&&this.limitCropBox(!0,!0)},renderImage:function(h){var m=this.canvasData,p=this.imageData,E=p.naturalWidth*(m.width/m.naturalWidth),b=p.naturalHeight*(m.height/m.naturalHeight);we(p,{width:E,height:b,left:(m.width-E)/2,top:(m.height-b)/2}),wi(this.image,we({width:p.width,height:p.height},I(we({translateX:p.left,translateY:p.top},p)))),h&&this.output()},initCropBox:function(){var h=this.options,m=this.canvasData,p=h.aspectRatio||h.initialAspectRatio,E=Number(h.autoCropArea)||.8,b={width:m.width,height:m.height};p&&(m.height*p>m.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,P=this.limited,B=p.aspectRatio;if(h){var R=Number(p.minCropBoxWidth)||0,_=Number(p.minCropBoxHeight)||0,O=P?Math.min(E.width,b.width,b.width+b.left,E.width-b.left):E.width,N=P?Math.min(E.height,b.height,b.height+b.top,E.height-b.top):E.height;R=Math.min(R,E.width),_=Math.min(_,E.height),B&&(R&&_?_*B>R?_=R/B:R=_*B:R?_=R/B:_&&(R=_*B),N*B>O?N=O/B:O=N*B),S.minWidth=Math.min(R,O),S.minHeight=Math.min(_,N),S.maxWidth=O,S.maxHeight=N}m&&(P?(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.width<p.minWidth)&&(p.left=p.oldLeft),(p.height>p.maxHeight||p.height<p.minHeight)&&(p.top=p.oldTop),p.width=Math.min(Math.max(p.width,p.minWidth),p.maxWidth),p.height=Math.min(Math.max(p.height,p.minHeight),p.maxHeight),this.limitCropBox(!1,!0),p.left=Math.min(Math.max(p.left,p.minLeft),p.maxLeft),p.top=Math.min(Math.max(p.top,p.minTop),p.maxTop),p.oldLeft=p.left,p.oldTop=p.top,h.movable&&h.cropBoxMovable&&ar(this.face,te,p.width>=m.width&&p.height>=m.height?z:M),wi(this.cropBox,we({width:p.width,height:p.height},I({translateX:p.left,translateY:p.top}))),this.cropped&&this.limited&&this.limitCanvas(!0,!0),this.disabled||this.output()},output:function(){this.preview(),Ri(this.element,De,this.getData())}},qv={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 P=p;typeof p=="string"?P=h.ownerDocument.querySelectorAll(p):p.querySelector&&(P=[p]),this.previews=P,ye(P,function(B){var R=document.createElement("img");ar(B,Ae,{width:B.offsetWidth,height:B.offsetHeight,html:B.innerHTML}),m&&(R.crossOrigin=m),R.src=E,R.alt=b,R.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;"',B.innerHTML="",B.appendChild(R)})}},resetPreview:function(){ye(this.previews,function(h){var m=or(h,Ae);wi(h,{width:m.width,height:m.height}),h.innerHTML=m.html,No(h,Ae)})},preview:function(){var h=this.imageData,m=this.canvasData,p=this.cropBoxData,E=p.width,b=p.height,S=h.width,P=h.height,B=p.left-m.left-h.left,R=p.top-m.top-h.top;!this.cropped||this.disabled||(wi(this.viewBoxImage,we({width:S,height:P},I(we({translateX:-B,translateY:-R},h)))),ye(this.previews,function(_){var O=or(_,Ae),N=O.width,he=O.height,ue=N,Ce=he,pe=1;E&&(pe=N/E,Ce=b*pe),b&&Ce>he&&(pe=he/b,ue=E*pe,Ce=he),wi(_,{width:ue,height:Ce}),wi(_.getElementsByTagName("img")[0],we({width:S*pe,height:P*pe},I(we({translateX:-B*pe,translateY:-R*pe},h))))}))}},Vv={bind:function(){var h=this.element,m=this.options,p=this.cropper;Ge(m.cropstart)&&ft(h,vi,m.cropstart),Ge(m.cropmove)&&ft(h,gi,m.cropmove),Ge(m.cropend)&&ft(h,He,m.cropend),Ge(m.crop)&&ft(h,De,m.crop),Ge(m.zoom)&&ft(h,ir,m.zoom),ft(p,Pi,this.onCropStart=this.cropStart.bind(this)),m.zoomable&&m.zoomOnWheel&&ft(p,bi,this.onWheel=this.wheel.bind(this),{passive:!1,capture:!0}),m.toggleDragModeOnDblclick&&ft(p,Zt,this.onDblclick=this.dblclick.bind(this)),ft(h.ownerDocument,zt,this.onCropMove=this.cropMove.bind(this)),ft(h.ownerDocument,Fi,this.onCropEnd=this.cropEnd.bind(this)),m.responsive&&ft(window,_t,this.onResize=this.resize.bind(this))},unbind:function(){var h=this.element,m=this.options,p=this.cropper;Ge(m.cropstart)&&Ne(h,vi,m.cropstart),Ge(m.cropmove)&&Ne(h,gi,m.cropmove),Ge(m.cropend)&&Ne(h,He,m.cropend),Ge(m.crop)&&Ne(h,De,m.crop),Ge(m.zoom)&&Ne(h,ir,m.zoom),Ne(p,Pi,this.onCropStart),m.zoomable&&m.zoomOnWheel&&Ne(p,bi,this.onWheel,{passive:!1,capture:!0}),m.toggleDragModeOnDblclick&&Ne(p,Zt,this.onDblclick),Ne(h.ownerDocument,zt,this.onCropMove),Ne(h.ownerDocument,Fi,this.onCropEnd),m.responsive&&Ne(window,_t,this.onResize)}},jv={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 P,B;h.restore&&(P=this.getCanvasData(),B=this.getCropBoxData()),this.render(),h.restore&&(this.setCanvasData(ye(P,function(R,_){P[_]=R*S})),this.setCropBoxData(ye(B,function(R,_){B[_]=R*S})))}}},dblclick:function(){this.disabled||this.options.dragMode===Le||this.setDragMode(Do(this.dragBox,T)?ce:oe)},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")&&(se(m)&&m!==1||se(p)&&p!==0||h.ctrlKey))){var E=this.options,b=this.pointers,S;h.changedTouches?ye(h.changedTouches,function(P){b[P.identifier]=be(P)}):b[h.pointerId||0]=be(h),Object.keys(b).length>1&&E.zoomable&&E.zoomOnTouch?S=G:S=or(h.target,te),Jt.test(S)&&Ri(this.element,vi,{originalEvent:h,action:S})!==!1&&(h.preventDefault(),this.action=S,this.cropping=!1,S===$&&(this.cropping=!0,Re(this.dragBox,U)))}},cropMove:function(h){var m=this.action;if(!(this.disabled||!m)){var p=this.pointers;h.preventDefault(),Ri(this.element,gi,{originalEvent:h,action:m})!==!1&&(h.changedTouches?ye(h.changedTouches,function(E){we(p[E.identifier]||{},be(E,!0))}):we(p[h.pointerId||0]||{},be(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,Li(this.dragBox,U,this.cropped&&this.options.modal)),Ri(this.element,He,{originalEvent:h,action:m}))}}},Wv={change:function(h){var m=this.options,p=this.canvasData,E=this.containerData,b=this.cropBoxData,S=this.pointers,P=this.action,B=m.aspectRatio,R=b.left,_=b.top,O=b.width,N=b.height,he=R+O,ue=_+N,Ce=0,pe=0,Ke=E.width,Je=E.height,$e=!0,Mi;!B&&h.shiftKey&&(B=O&&N?O/N:1),this.limited&&(Ce=b.minLeft,pe=b.minTop,Ke=Ce+Math.min(E.width,p.width,p.left+p.width),Je=pe+Math.min(E.height,p.height,p.top+p.height));var Lt=S[Object.keys(S)[0]],q={x:Lt.endX-Lt.startX,y:Lt.endY-Lt.startY},fe=function(qt){switch(qt){case K:he+q.x>Ke&&(q.x=Ke-he);break;case Q:R+q.x<Ce&&(q.x=Ce-R);break;case Y:_+q.y<pe&&(q.y=pe-_);break;case ne:ue+q.y>Je&&(q.y=Je-ue);break}};switch(P){case M:R+=q.x,_+=q.y;break;case K:if(q.x>=0&&(he>=Ke||B&&(_<=pe||ue>=Je))){$e=!1;break}fe(K),O+=q.x,O<0&&(P=Q,O=-O,R-=O),B&&(N=O/B,_+=(b.height-N)/2);break;case Y:if(q.y<=0&&(_<=pe||B&&(R<=Ce||he>=Ke))){$e=!1;break}fe(Y),N-=q.y,_+=q.y,N<0&&(P=ne,N=-N,_-=N),B&&(O=N*B,R+=(b.width-O)/2);break;case Q:if(q.x<=0&&(R<=Ce||B&&(_<=pe||ue>=Je))){$e=!1;break}fe(Q),O-=q.x,R+=q.x,O<0&&(P=K,O=-O,R-=O),B&&(N=O/B,_+=(b.height-N)/2);break;case ne:if(q.y>=0&&(ue>=Je||B&&(R<=Ce||he>=Ke))){$e=!1;break}fe(ne),N+=q.y,N<0&&(P=Y,N=-N,_-=N),B&&(O=N*B,R+=(b.width-O)/2);break;case re:if(B){if(q.y<=0&&(_<=pe||he>=Ke)){$e=!1;break}fe(Y),N-=q.y,_+=q.y,O=N*B}else fe(Y),fe(K),q.x>=0?he<Ke?O+=q.x:q.y<=0&&_<=pe&&($e=!1):O+=q.x,q.y<=0?_>pe&&(N-=q.y,_+=q.y):(N-=q.y,_+=q.y);O<0&&N<0?(P=We,N=-N,O=-O,_-=N,R-=O):O<0?(P=le,O=-O,R-=O):N<0&&(P=ke,N=-N,_-=N);break;case le:if(B){if(q.y<=0&&(_<=pe||R<=Ce)){$e=!1;break}fe(Y),N-=q.y,_+=q.y,O=N*B,R+=b.width-O}else fe(Y),fe(Q),q.x<=0?R>Ce?(O-=q.x,R+=q.x):q.y<=0&&_<=pe&&($e=!1):(O-=q.x,R+=q.x),q.y<=0?_>pe&&(N-=q.y,_+=q.y):(N-=q.y,_+=q.y);O<0&&N<0?(P=ke,N=-N,O=-O,_-=N,R-=O):O<0?(P=re,O=-O,R-=O):N<0&&(P=We,N=-N,_-=N);break;case We:if(B){if(q.x<=0&&(R<=Ce||ue>=Je)){$e=!1;break}fe(Q),O-=q.x,R+=q.x,N=O/B}else fe(ne),fe(Q),q.x<=0?R>Ce?(O-=q.x,R+=q.x):q.y>=0&&ue>=Je&&($e=!1):(O-=q.x,R+=q.x),q.y>=0?ue<Je&&(N+=q.y):N+=q.y;O<0&&N<0?(P=re,N=-N,O=-O,_-=N,R-=O):O<0?(P=ke,O=-O,R-=O):N<0&&(P=le,N=-N,_-=N);break;case ke:if(B){if(q.x>=0&&(he>=Ke||ue>=Je)){$e=!1;break}fe(K),O+=q.x,N=O/B}else fe(ne),fe(K),q.x>=0?he<Ke?O+=q.x:q.y>=0&&ue>=Je&&($e=!1):O+=q.x,q.y>=0?ue<Je&&(N+=q.y):N+=q.y;O<0&&N<0?(P=le,N=-N,O=-O,_-=N,R-=O):O<0?(P=We,O=-O,R-=O):N<0&&(P=re,N=-N,_-=N);break;case z:this.move(q.x,q.y),$e=!1;break;case G:this.zoom(X(S),h),$e=!1;break;case $:if(!q.x||!q.y){$e=!1;break}Mi=rn(this.cropper),R=Lt.startX-Mi.left,_=Lt.startY-Mi.top,O=b.minWidth,N=b.minHeight,q.x>0?P=q.y>0?ke:re:q.x<0&&(R-=O,P=q.y>0?We:le),q.y<0&&(_-=N),this.cropped||(Ot(this.cropBox,A),this.cropped=!0,this.limited&&this.limitCropBox(!0,!0));break}$e&&(b.width=O,b.height=N,b.left=R,b.top=_,this.action=P,this.renderCropBox()),ye(S,function(Xe){Xe.startX=Xe.endX,Xe.startY=Xe.endY})}},Gv={crop:function(){return this.ready&&!this.cropped&&!this.disabled&&(this.cropped=!0,this.limitCropBox(!0,!0),this.options.modal&&Re(this.dragBox,U),Ot(this.cropBox,A),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(),Ot(this.dragBox,U),Re(this.cropBox,A)),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,Ot(this.cropper,k)),this},disable:function(){return this.ready&&!this.disabled&&(this.disabled=!0,Re(this.cropper,k)),this},destroy:function(){var h=this.element;return h[V]?(h[V]=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(yi(h)?h:E+Number(h),yi(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&&(se(h)&&(p.left=h,E=!0),se(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,P=b.height,B=b.naturalWidth,R=b.naturalHeight;if(h=Number(h),h>=0&&this.ready&&!this.disabled&&E.zoomable){var _=B*h,O=R*h;if(Ri(this.element,ir,{ratio:h,oldRatio:S/B,originalEvent:p})===!1)return this;if(p){var N=this.pointers,he=rn(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-P)*((ue.pageY-he.top-b.top)/P)}else sr(m)&&se(m.x)&&se(m.y)?(b.left-=(_-S)*((m.x-b.left)/S),b.top-=(O-P)*((m.y-b.top)/P)):(b.left-=(_-S)/2,b.top-=(O-P)/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),se(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,se(m)?m:1)},scaleY:function(h){var m=this.imageData.scaleX;return this.scale(se(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&&(se(h)&&(p.scaleX=h,E=!0),se(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 P=p.width/p.naturalWidth;if(ye(S,function(_,O){S[O]=_/P}),h){var B=Math.round(S.y+S.height),R=Math.round(S.x+S.width);S.x=Math.round(S.x),S.y=Math.round(S.y),S.width=R-S.x,S.height=B-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&&sr(h)){var S=!1;m.rotatable&&se(h.rotate)&&h.rotate!==p.rotate&&(p.rotate=h.rotate,S=!0),m.scalable&&(se(h.scaleX)&&h.scaleX!==p.scaleX&&(p.scaleX=h.scaleX,S=!0),se(h.scaleY)&&h.scaleY!==p.scaleY&&(p.scaleY=h.scaleY,S=!0)),S&&this.renderCanvas(!0,!0);var P=p.width/p.naturalWidth;se(h.x)&&(b.left=h.x*P+E.left),se(h.y)&&(b.top=h.y*P+E.top),se(h.width)&&(b.width=h.width*P),se(h.height)&&(b.height=h.height*P),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&&sr(h)&&(se(h.left)&&(m.left=h.left),se(h.top)&&(m.top=h.top),se(h.width)?(m.width=h.width,m.height=h.width/p):se(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&&sr(h)&&(se(h.left)&&(m.left=h.left),se(h.top)&&(m.top=h.top),se(h.width)&&h.width!==m.width&&(E=!0,m.width=h.width),se(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=$t(this.image,this.imageData,m,h);if(!this.cropped)return p;var E=this.getData(h.rounded),b=E.x,S=E.y,P=E.width,B=E.height,R=p.width/Math.floor(m.naturalWidth);R!==1&&(b*=R,S*=R,P*=R,B*=R);var _=P/B,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||(R!==1?p.width:P),height:h.height||(R!==1?p.height:B)}),ue=he.width,Ce=he.height;ue=Math.min(O.width,Math.max(N.width,ue)),Ce=Math.min(O.height,Math.max(N.height,Ce));var pe=document.createElement("canvas"),Ke=pe.getContext("2d");pe.width=Te(ue),pe.height=Te(Ce),Ke.fillStyle=h.fillColor||"transparent",Ke.fillRect(0,0,ue,Ce);var Je=h.imageSmoothingEnabled,$e=Je===void 0?!0:Je,Mi=h.imageSmoothingQuality;Ke.imageSmoothingEnabled=$e,Mi&&(Ke.imageSmoothingQuality=Mi);var Lt=p.width,q=p.height,fe=b,Xe=S,qt,Ii,Tr,xr,cr,Si;fe<=-P||fe>Lt?(fe=0,qt=0,Tr=0,cr=0):fe<=0?(Tr=-fe,fe=0,qt=Math.min(Lt,P+fe),cr=qt):fe<=Lt&&(Tr=0,qt=Math.min(P,Lt-fe),cr=qt),qt<=0||Xe<=-B||Xe>q?(Xe=0,Ii=0,xr=0,Si=0):Xe<=0?(xr=-Xe,Xe=0,Ii=Math.min(q,B+Xe),Si=Ii):Xe<=q&&(xr=0,Ii=Math.min(B,q-Xe),Si=Ii);var Ct=[fe,Xe,qt,Ii];if(cr>0&&Si>0){var kr=ue/P;Ct.push(Tr*kr,xr*kr,cr*kr,Si*kr)}return Ke.drawImage.apply(Ke,[p].concat(c(Ct.map(function(zo){return Math.floor(Te(zo))})))),pe},setAspectRatio:function(h){var m=this.options;return!this.disabled&&!yi(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===oe,S=m.movable&&h===ce;h=b||S?h:Le,m.dragMode=h,ar(p,te,h),Li(p,T,b),Li(p,ee,S),m.cropBoxMovable||(ar(E,te,h),Li(E,T,b),Li(E,ee,S))}return this}},Kv=F.Cropper,Cd=function(){function g(h){var m=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(n(this,g),!h||!Er.test(h.tagName))throw new Error("The first argument is required and must be an <img> or <canvas> element.");this.element=h,this.options=we({},gs,sr(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[V]){if(m[V]=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(ei.test(m)){ti.test(m)?this.read(Uo(m)):this.clone();return}var S=new XMLHttpRequest,P=this.clone.bind(this);this.reloading=!0,this.xhr=S,S.onabort=P,S.onerror=P,S.ontimeout=P,S.onprogress=function(){S.getResponseHeader("content-type")!==Oi&&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=zv(m),S=0,P=1,B=1;if(b>1){this.url=Uv(m,Oi);var R=Hv(b);S=R.rotate,P=R.scaleX,B=R.scaleY}p.rotatable&&(E.rotate=S),p.scalable&&(E.scaleX=P,E.scaleY=B),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),Re(S,H),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=F.navigator&&/(?:iPad|iPhone|iPod).*?AppleWebKit/i.test(F.navigator.userAgent),b=function(R,_){we(m.imageData,{naturalWidth:R,naturalHeight:_,aspectRatio:R/_}),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"),P=document.body||document.documentElement;this.sizingImage=S,S.onload=function(){b(S.width,S.height),E||P.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;",P.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=Mo;var P=S.querySelector(".".concat(V,"-container")),B=P.querySelector(".".concat(V,"-canvas")),R=P.querySelector(".".concat(V,"-drag-box")),_=P.querySelector(".".concat(V,"-crop-box")),O=_.querySelector(".".concat(V,"-face"));this.container=b,this.cropper=P,this.canvas=B,this.dragBox=R,this.cropBox=_,this.viewBox=P.querySelector(".".concat(V,"-view-box")),this.face=O,B.appendChild(E),Re(m,A),b.insertBefore(P,m.nextSibling),Ot(E,H),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,Re(_,A),p.guides||Re(_.getElementsByClassName("".concat(V,"-dashed")),A),p.center||Re(_.getElementsByClassName("".concat(V,"-center")),A),p.background&&Re(P,"".concat(V,"-bg")),p.highlight||Re(O,j),p.cropBoxMovable&&(Re(O,ee),ar(O,te,M)),p.cropBoxResizable||(Re(_.getElementsByClassName("".concat(V,"-line")),A),Re(_.getElementsByClassName("".concat(V,"-point")),A)),this.render(),this.ready=!0,this.setDragMode(p.dragMode),p.autoCrop&&this.crop(),this.setData(p.data),Ge(p.ready)&&ft(m,_i,p.ready,{once:!0}),Ri(m,_i)}}},{key:"unbuild",value:function(){if(this.ready){this.ready=!1,this.unbind(),this.resetPreview();var m=this.cropper.parentNode;m&&m.removeChild(this.cropper),Ot(this.element,A)}}},{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=Kv,g}},{key:"setDefaults",value:function(m){we(gs,sr(m)&&m)}}])}();return we(Cd.prototype,$v,qv,Vv,jv,Wv,Gv),Cd})});(function(i){if(typeof i.requestSubmit=="function")return;i.requestSubmit=function(r){r?(e(r,this),r.click()):(r=document.createElement("input"),r.type="submit",r.hidden=!0,this.appendChild(r),r.click(),this.removeChild(r))};function e(r,s){r instanceof HTMLElement||t(TypeError,"parameter 1 is not of type 'HTMLElement'"),r.type=="submit"||t(TypeError,"The specified element is not a submit button"),r.form==s||t(DOMException,"The specified element is not owned by this form element","NotFoundError")}function t(r,s,n){throw new r("Failed to execute 'requestSubmit' on 'HTMLFormElement': "+s+".",n)}})(HTMLFormElement.prototype);var zd=new WeakMap;function rb(i){let e=i instanceof Element?i:i instanceof Node?i.parentElement:null,t=e?e.closest("input, button"):null;return t?.type=="submit"?t:null}function sb(i){let e=rb(i.target);e&&e.form&&zd.set(e.form,e)}(function(){if("submitter"in Event.prototype)return;let i=window.Event.prototype;if("SubmitEvent"in window){let e=window.SubmitEvent.prototype;if(/Apple Computer/.test(navigator.vendor)&&!("submitter"in e))i=e;else return}addEventListener("click",sb,!0),Object.defineProperty(i,"submitter",{get(){if(this.type=="submit"&&this.target instanceof HTMLFormElement)return zd.get(this.target)}})})();var Es={eager:"eager",lazy:"lazy"},si=class i extends HTMLElement{static delegateConstructor=void 0;loaded=Promise.resolve();static get observedAttributes(){return["disabled","loading","src"]}constructor(){super(),this.delegate=new i.delegateConstructor(this)}connectedCallback(){this.delegate.connect()}disconnectedCallback(){this.delegate.disconnect()}reload(){return this.delegate.sourceURLReloaded()}attributeChangedCallback(e){e=="loading"?this.delegate.loadingStyleChanged():e=="src"?this.delegate.sourceURLChanged():e=="disabled"&&this.delegate.disabledChanged()}get src(){return this.getAttribute("src")}set src(e){e?this.setAttribute("src",e):this.removeAttribute("src")}get refresh(){return this.getAttribute("refresh")}set refresh(e){e?this.setAttribute("refresh",e):this.removeAttribute("refresh")}get shouldReloadWithMorph(){return this.src&&this.refresh==="morph"}get loading(){return nb(this.getAttribute("loading")||"")}set loading(e){e?this.setAttribute("loading",e):this.removeAttribute("loading")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){e?this.setAttribute("disabled",""):this.removeAttribute("disabled")}get autoscroll(){return this.hasAttribute("autoscroll")}set autoscroll(e){e?this.setAttribute("autoscroll",""):this.removeAttribute("autoscroll")}get complete(){return!this.delegate.isLoading}get isActive(){return this.ownerDocument===document&&!this.isPreview}get isPreview(){return this.ownerDocument?.documentElement?.hasAttribute("data-turbo-preview")}};function nb(i){switch(i.toLowerCase()){case"lazy":return Es.lazy;default:return Es.eager}}var ob={enabled:!0,progressBarDelay:500,unvisitableExtensions:new Set([".7z",".aac",".apk",".avi",".bmp",".bz2",".css",".csv",".deb",".dmg",".doc",".docx",".exe",".gif",".gz",".heic",".heif",".ico",".iso",".jpeg",".jpg",".js",".json",".m4a",".mkv",".mov",".mp3",".mp4",".mpeg",".mpg",".msi",".ogg",".ogv",".pdf",".pkg",".png",".ppt",".pptx",".rar",".rtf",".svg",".tar",".tif",".tiff",".txt",".wav",".webm",".webp",".wma",".wmv",".xls",".xlsx",".xml",".zip"])};function nn(i){if(i.getAttribute("data-turbo-eval")=="false")return i;{let e=document.createElement("script"),t=Wd();return t&&(e.nonce=t),e.textContent=i.textContent,e.async=!1,ab(e,i),e}}function ab(i,e){for(let{name:t,value:r}of e.attributes)i.setAttribute(t,r)}function lb(i){let e=document.createElement("template");return e.innerHTML=i,e.content}function _e(i,{target:e,cancelable:t,detail:r}={}){let s=new CustomEvent(i,{cancelable:t,bubbles:!0,composed:!0,detail:r});return e&&e.isConnected?e.dispatchEvent(s):document.documentElement.dispatchEvent(s),s}function Rd(i){i.preventDefault(),i.stopImmediatePropagation()}function sn(){return document.visibilityState==="hidden"?$d():Hd()}function Hd(){return new Promise(i=>requestAnimationFrame(()=>i()))}function $d(){return new Promise(i=>setTimeout(()=>i(),0))}function cb(){return Promise.resolve()}function qd(i=""){return new DOMParser().parseFromString(i,"text/html")}function Vd(i,...e){let t=ub(i,e).replace(/^\n/,"").split(`
|
|
3
3
|
`),r=t[0].match(/^\s+/),s=r?r[0].length:0;return t.map(n=>n.slice(s)).join(`
|
|
4
|
-
`)}function Pb(i,e){return i.reduce((t,r,s)=>{let n=e[s]==null?"":e[s];return t+r+n},"")}function dr(){return Array.from({length:36}).map((i,e)=>e==8||e==13||e==18||e==23?"-":e==14?"4":e==19?(Math.floor(Math.random()*4)+8).toString(16):Math.floor(Math.random()*15).toString(16)).join("")}function qo(i,...e){for(let t of e.map(r=>r?.getAttribute(i)))if(typeof t=="string")return t;return null}function Fb(i,...e){return e.some(t=>t&&t.hasAttribute(i))}function Vo(...i){for(let e of i)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function jo(...i){for(let e of i)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function Ob(i,e=2e3){return new Promise(t=>{let r=()=>{i.removeEventListener("error",r),i.removeEventListener("load",r),t()};i.addEventListener("load",r,{once:!0}),i.addEventListener("error",r,{once:!0}),setTimeout(t,e)})}function Qd(i){switch(i){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function Rb(i){return i=="advance"||i=="replace"||i=="restore"}function Rr(...i){let e=qo("data-turbo-action",...i);return Rb(e)?e:null}function kc(i){return document.querySelector(`meta[name="${i}"]`)}function Wo(i){let e=kc(i);return e&&e.content}function Jd(){let i=kc("csp-nonce");if(i){let{nonce:e,content:t}=i;return e==""?t:e}}function Lb(i,e){let t=kc(i);return t||(t=document.createElement("meta"),t.setAttribute("name",i),document.head.appendChild(t)),t.setAttribute("content",e),t}function xs(i,e){if(i instanceof Element)return i.closest(e)||xs(i.assignedSlot||i.getRootNode()?.host,e)}function Ac(i){return!!i&&i.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])")==null&&typeof i.focus=="function"}function ep(i){return Array.from(i.querySelectorAll("[autofocus]")).find(Ac)}async function Mb(i,e){let t=e();i(),await Kd();let r=e();return[t,r]}function tp(i){if(i==="_blank")return!1;if(i){for(let e of document.getElementsByName(i))if(e instanceof HTMLIFrameElement)return!1;return!0}else return!0}function ip(i){return xs(i,"a[href]:not([target^=_]):not([download])")}function rp(i){return Ke(i.getAttribute("href")||"")}function Ib(i,e){let t=null;return(...r)=>{let s=()=>i.apply(this,r);clearTimeout(t),t=setTimeout(s,e)}}var Db={"aria-disabled":{beforeSubmit:i=>{i.setAttribute("aria-disabled","true"),i.addEventListener("click",zd)},afterSubmit:i=>{i.removeAttribute("aria-disabled"),i.removeEventListener("click",zd)}},disabled:{beforeSubmit:i=>i.disabled=!0,afterSubmit:i=>i.disabled=!1}},Wl=class{#e=null;constructor(e){Object.assign(this,e)}get submitter(){return this.#e}set submitter(e){this.#e=Db[e]||e}},Nb=new Wl({mode:"on",submitter:"disabled"}),Ge={drive:kb,forms:Nb};function Ke(i){return new URL(i.toString(),document.baseURI)}function Lr(i){let e;if(i.hash)return i.hash.slice(1);if(e=i.href.match(/#(.*)$/))return e[1]}function _c(i,e){let t=e?.getAttribute("formaction")||i.getAttribute("action")||i.action;return Ke(t)}function Bb(i){return($b(i).match(/\.[^.]*$/)||[])[0]||""}function Ub(i,e){let t=qb(e);return i.href===Ke(t).href||i.href.startsWith(t)}function hr(i,e){return Ub(i,e)&&!Ge.drive.unvisitableExtensions.has(Bb(i))}function Gl(i){let e=Lr(i);return e!=null?i.href.slice(0,-(e.length+1)):i.href}function Ho(i){return Gl(i)}function zb(i,e){return Ke(i).href==Ke(e).href}function Hb(i){return i.pathname.split("/").slice(1)}function $b(i){return Hb(i).slice(-1)[0]}function qb(i){return Vb(i.origin+i.pathname)}function Vb(i){return i.endsWith("/")?i:i+"/"}var sn=class{constructor(e){this.response=e}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return Ke(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}},Kl=class extends Set{constructor(e){super(),this.maxSize=e}add(e){if(this.size>=this.maxSize){let r=this.values().next().value;this.delete(r)}super.add(e)}},sp=new Kl(20),jb=window.fetch;function np(i,e={}){let t=new Headers(e.headers||{}),r=dr();return sp.add(r),t.append("X-Turbo-Request-Id",r),jb(i,{...e,headers:t})}function Cc(i){switch(i.toLowerCase()){case"get":return Vt.get;case"post":return Vt.post;case"put":return Vt.put;case"patch":return Vt.patch;case"delete":return Vt.delete}}var Vt={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};function Wb(i){switch(i.toLowerCase()){case Or.multipart:return Or.multipart;case Or.plain:return Or.plain;default:return Or.urlEncoded}}var Or={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"},Mr=class{abortController=new AbortController;#e=e=>{};constructor(e,t,r,s=new URLSearchParams,n=null,o=Or.urlEncoded){let[a,l]=Hd(Ke(r),t,s,o);this.delegate=e,this.url=a,this.target=n,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:t.toUpperCase(),headers:{...this.defaultHeaders},body:l,signal:this.abortSignal,referrer:this.delegate.referrer?.href},this.enctype=o}get method(){return this.fetchOptions.method}set method(e){let t=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,r=Cc(e)||Vt.get;this.url.search="";let[s,n]=Hd(this.url,r,t,this.enctype);this.url=s,this.fetchOptions.body=n,this.fetchOptions.method=r.toUpperCase()}get headers(){return this.fetchOptions.headers}set headers(e){this.fetchOptions.headers=e}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(e){this.fetchOptions.body=e}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){let{fetchOptions:e}=this;this.delegate.prepareRequest(this);let t=await this.#t(e);try{this.delegate.requestStarted(this),t.detail.fetchRequest?this.response=t.detail.fetchRequest.response:this.response=np(this.url.href,e);let r=await this.response;return await this.receive(r)}catch(r){if(r.name!=="AbortError")throw this.#i(r)&&this.delegate.requestErrored(this,r),r}finally{this.delegate.requestFinished(this)}}async receive(e){let t=new sn(e);return xe("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:t},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,t):t.succeeded?this.delegate.requestSucceededWithResponse(this,t):this.delegate.requestFailedWithResponse(this,t),t}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return Pc(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async#t(e){let t=new Promise(s=>this.#e=s),r=xe("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.#e},target:this.target});return this.url=r.detail.url,r.defaultPrevented&&await t,r}#i(e){return!xe("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}};function Pc(i){return Cc(i)==Vt.get}function Hd(i,e,t,r){let s=Array.from(t).length>0?new URLSearchParams(op(t)):i.searchParams;return Pc(e)?[Gb(i,s),null]:r==Or.urlEncoded?[i,s]:[i,t]}function op(i){let e=[];for(let[t,r]of i)r instanceof File||e.push([t,r]);return e}function Gb(i,e){let t=new URLSearchParams(op(e));return i.search=t.toString(),i}var Xl=class{started=!1;constructor(e,t){this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}intersect=e=>{e.slice(-1)[0]?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)}},pr=class{static contentType="text/vnd.turbo-stream.html";static wrap(e){return typeof e=="string"?new this(_b(e)):e}constructor(e){this.fragment=Kb(e)}};function Kb(i){for(let e of i.querySelectorAll("turbo-stream")){let t=document.importNode(e,!0);for(let r of t.templateElement.content.querySelectorAll("script"))r.replaceWith(rn(r));e.replaceWith(t)}return i}var Xb=100,Yl=class{#e=null;#t=null;get(e){if(this.#t&&this.#t.url===e&&this.#t.expire>Date.now())return this.#t.request}setLater(e,t,r){this.clear(),this.#e=setTimeout(()=>{t.perform(),this.set(e,t,r),this.#e=null},Xb)}set(e,t,r){this.#t={url:e,request:t,expire:new Date(new Date().getTime()+r)}}clear(){this.#e&&clearTimeout(this.#e),this.#t=null}},Yb=10*1e3,Ts=new Yl,Ss={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"},Go=class i{state=Ss.initialized;static confirmMethod(e){return Promise.resolve(confirm(e))}constructor(e,t,r,s=!1){let n=iy(t,r),o=ty(ey(t,r),n),a=Zb(t,r),l=ry(t,r);this.delegate=e,this.formElement=t,this.submitter=r,this.fetchRequest=new Mr(this,n,o,a,t,l),this.mustRedirect=s}get method(){return this.fetchRequest.method}set method(e){this.fetchRequest.method=e}get action(){return this.fetchRequest.url.toString()}set action(e){this.fetchRequest.url=Ke(e)}get body(){return this.fetchRequest.body}get enctype(){return this.fetchRequest.enctype}get isSafe(){return this.fetchRequest.isSafe}get location(){return this.fetchRequest.url}async start(){let{initialized:e,requesting:t}=Ss,r=qo("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof r=="string"&&!await(typeof Ge.forms.confirm=="function"?Ge.forms.confirm:i.confirmMethod)(r,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:t}=Ss;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){let t=Qb(Wo("csrf-param"))||Wo("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(pr.contentType)}requestStarted(e){this.state=Ss.waiting,this.submitter&&Ge.forms.submitter.beforeSubmit(this.submitter),this.setSubmitsWith(),Vo(this.formElement),xe("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){Ts.clear(),this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError){this.delegate.formSubmissionFailedWithResponse(this,t);return}if(Ts.clear(),this.requestMustRedirect(e)&&Jb(t)){let r=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,r)}else this.state=Ss.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){this.state=Ss.stopped,this.submitter&&Ge.forms.submitter.afterSubmit(this.submitter),this.resetSubmitterText(),jo(this.formElement),xe("turbo:submit-end",{target:this.formElement,detail:{formSubmission:this,...this.result}}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){if(!(!this.submitter||!this.submitsWith)){if(this.submitter.matches("button"))this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith;else if(this.submitter.matches("input")){let e=this.submitter;this.originalSubmitText=e.value,e.value=this.submitsWith}}}resetSubmitterText(){if(!(!this.submitter||!this.originalSubmitText)){if(this.submitter.matches("button"))this.submitter.innerHTML=this.originalSubmitText;else if(this.submitter.matches("input")){let e=this.submitter;e.value=this.originalSubmitText}}}requestMustRedirect(e){return!e.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(e){return!e.isSafe||Fb("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){return this.submitter?.getAttribute("data-turbo-submits-with")}};function Zb(i,e){let t=new FormData(i),r=e?.getAttribute("name"),s=e?.getAttribute("value");return r&&t.append(r,s||""),t}function Qb(i){if(i!=null){let t=(document.cookie?document.cookie.split("; "):[]).find(r=>r.startsWith(i));if(t){let r=t.split("=").slice(1).join("=");return r?decodeURIComponent(r):void 0}}}function Jb(i){return i.statusCode==200&&!i.redirected}function ey(i,e){let t=typeof i.action=="string"?i.action:null;return e?.hasAttribute("formaction")?e.getAttribute("formaction")||"":i.getAttribute("action")||t||""}function ty(i,e){let t=Ke(i);return Pc(e)&&(t.search=""),t}function iy(i,e){let t=e?.getAttribute("formmethod")||i.getAttribute("method")||"";return Cc(t.toLowerCase())||Vt.get}function ry(i,e){return Wb(e?.getAttribute("formenctype")||i.enctype)}var As=class{constructor(e){this.element=e}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(e){return this.getElementForAnchor(e)!=null}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return ep(this.element)}get permanentElements(){return lp(this.element)}getPermanentElementById(e){return ap(this.element,e)}getPermanentElementMapForSnapshot(e){let t={};for(let r of this.permanentElements){let{id:s}=r,n=e.getPermanentElementById(s);n&&(t[s]=[r,n])}return t}};function ap(i,e){return i.querySelector(`#${e}[data-turbo-permanent]`)}function lp(i){return i.querySelectorAll("[id][data-turbo-permanent]")}var nn=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)};submitBubbled=e=>{if(!e.defaultPrevented){let t=e.target instanceof HTMLFormElement?e.target:void 0,r=e.submitter||void 0;t&&sy(t,r)&&ny(t,r)&&this.delegate.willSubmitForm(t,r)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,r))}}};function sy(i,e){return(e?.getAttribute("formmethod")||i.getAttribute("method"))!="dialog"}function ny(i,e){let t=e?.getAttribute("formtarget")||i.getAttribute("target");return tp(t)}var Ko=class{#e=e=>{};#t=e=>{};constructor(e,t){this.delegate=e,this.element=t}scrollToAnchor(e){let t=this.snapshot.getElementForAnchor(e);t?(this.scrollToElement(t),this.focusElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(Lr(e))}scrollToElement(e){e.scrollIntoView()}focusElement(e){e instanceof HTMLElement&&(e.hasAttribute("tabindex")?e.focus():(e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")))}scrollToPosition({x:e,y:t}){this.scrollRoot.scrollTo(e,t)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(e){let{isPreview:t,shouldRender:r,willRender:s,newSnapshot:n}=e,o=s;if(r)try{this.renderPromise=new Promise(d=>this.#e=d),this.renderer=e,await this.prepareToRenderSnapshot(e);let a=new Promise(d=>this.#t=d),l={resume:this.#t,render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(n,l)||await a,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(n,t,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.#e(void 0),delete this.renderPromise}else o&&this.invalidate(e.reloadReason)}invalidate(e){this.delegate.viewInvalidated(e)}async prepareToRenderSnapshot(e){this.markAsPreview(e.isPreview),await e.prepareToRender()}markAsPreview(e){e?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}markVisitDirection(e){this.element.setAttribute("data-turbo-visit-direction",e)}unmarkVisitDirection(){this.element.removeAttribute("data-turbo-visit-direction")}async renderSnapshot(e){await e.render()}finishRenderingSnapshot(e){e.finishRendering()}},Zl=class extends Ko{missing(){this.element.innerHTML='<strong class="turbo-frame-error">Content missing</strong>'}get snapshot(){return new As(this.element)}},Xo=class{constructor(e,t){this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}clickBubbled=e=>{this.clickEventIsSignificant(e)?this.clickEvent=e:delete this.clickEvent};linkClicked=e=>{this.clickEvent&&this.clickEventIsSignificant(e)&&this.delegate.shouldInterceptLinkClick(e.target,e.detail.url,e.detail.originalEvent)&&(this.clickEvent.preventDefault(),e.preventDefault(),this.delegate.linkClickIntercepted(e.target,e.detail.url,e.detail.originalEvent)),delete this.clickEvent};willVisit=e=>{delete this.clickEvent};clickEventIsSignificant(e){let t=e.composed?e.target?.parentElement:e.target,r=ip(t)||t;return r instanceof Element&&r.closest("turbo-frame, html")==this.element}},Yo=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)};clickBubbled=e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){let t=e.composedPath&&e.composedPath()[0]||e.target,r=ip(t);if(r&&tp(r.target)){let s=rp(r);this.delegate.willFollowLinkToLocation(r,s,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(r,s))}}};clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}},Zo=class{constructor(e,t){this.delegate=e,this.linkInterceptor=new Yo(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(e,t){return!1}prefetchAndCacheRequestToLocation(e,t){}willFollowLinkToLocation(e,t,r){return this.delegate.willSubmitFormLinkToLocation(e,t,r)&&(e.hasAttribute("data-turbo-method")||e.hasAttribute("data-turbo-stream"))}followedLinkToLocation(e,t){let r=document.createElement("form"),s="hidden";for(let[f,g]of t.searchParams)r.append(Object.assign(document.createElement("input"),{type:s,name:f,value:g}));let n=Object.assign(t,{search:""});r.setAttribute("data-turbo","true"),r.setAttribute("action",n.href),r.setAttribute("hidden","");let o=e.getAttribute("data-turbo-method");o&&r.setAttribute("method",o);let a=e.getAttribute("data-turbo-frame");a&&r.setAttribute("data-turbo-frame",a);let l=Rr(e);l&&r.setAttribute("data-turbo-action",l);let c=e.getAttribute("data-turbo-confirm");c&&r.setAttribute("data-turbo-confirm",c),e.hasAttribute("data-turbo-stream")&&r.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(e,t,r),document.body.appendChild(r),r.addEventListener("turbo:submit-end",()=>r.remove(),{once:!0}),requestAnimationFrame(()=>r.requestSubmit())}},Qo=class{static async preservingPermanentElements(e,t,r){let s=new this(e,t);s.enter(),await r(),s.leave()}constructor(e,t){this.delegate=e,this.permanentElementMap=t}enter(){for(let e in this.permanentElementMap){let[t,r]=this.permanentElementMap[e];this.delegate.enteringBardo(t,r),this.replaceNewPermanentElementWithPlaceholder(r)}}leave(){for(let e in this.permanentElementMap){let[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t),this.delegate.leavingBardo(t)}}replaceNewPermanentElementWithPlaceholder(e){let t=oy(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){let t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){this.getPlaceholderById(e.id)?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find(t=>t.content==e)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function oy(i){let e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",i.id),e}var on=class{#e=null;static renderElement(e,t){}constructor(e,t,r,s=!0){this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=r,this.willRender=s,this.renderElement=this.constructor.renderElement,this.promise=new Promise((n,o)=>this.resolvingFunctions={resolve:n,reject:o})}get shouldRender(){return!0}get shouldAutofocus(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await Qo.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){if(this.shouldAutofocus){let e=this.connectedSnapshot.firstAutofocusableElement;e&&e.focus()}}enteringBardo(e){this.#e||e.contains(this.currentSnapshot.activeElement)&&(this.#e=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.#e)&&this.#e instanceof HTMLElement&&(this.#e.focus(),this.#e=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}get renderMethod(){return"replace"}},an=class extends on{static renderElement(e,t){let r=document.createRange();r.selectNodeContents(e),r.deleteContents();let s=t,n=s.ownerDocument?.createRange();n&&(n.selectNodeContents(s),e.appendChild(n.extractContents()))}constructor(e,t,r,s,n,o=!0){super(t,r,s,n,o),this.delegate=e}get shouldRender(){return!0}async render(){await tn(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await tn(),this.focusFirstAutofocusableElement(),await tn(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let e=this.currentElement.firstElementChild,t=ay(this.currentElement.getAttribute("data-autoscroll-block"),"end"),r=ly(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(e)return e.scrollIntoView({block:t,behavior:r}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let t=rn(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function ay(i,e){return i=="end"||i=="start"||i=="center"||i=="nearest"?i:e}function ly(i,e){return i=="auto"||i=="smooth"?i:e}var cy=function(){let i=()=>{},e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:i,afterNodeAdded:i,beforeNodeMorphed:i,afterNodeMorphed:i,beforeNodeRemoved:i,afterNodeRemoved:i,beforeAttributeUpdated:i},head:{style:"merge",shouldPreserve:g=>g.getAttribute("im-preserve")==="true",shouldReAppend:g=>g.getAttribute("im-re-append")==="true",shouldRemove:i,afterHeadMorphed:i},restoreFocus:!0};function t(g,b,w={}){g=d(g);let P=f(b),R=c(g,P,w),C=s(R,()=>a(R,g,P,k=>k.morphStyle==="innerHTML"?(n(k,g,P),Array.from(g.childNodes)):r(k,g,P)));return R.pantry.remove(),C}function r(g,b,w){let P=f(b),R=Array.from(P.childNodes),C=R.indexOf(b),k=R.length-(C+1);return n(g,P,w,b,b.nextSibling),R=Array.from(P.childNodes),R.slice(C,R.length-k)}function s(g,b){if(!g.config.restoreFocus)return b();let w=document.activeElement;if(!(w instanceof HTMLInputElement||w instanceof HTMLTextAreaElement))return b();let{id:P,selectionStart:R,selectionEnd:C}=w,k=b();return P&&P!==document.activeElement?.id&&(w=g.target.querySelector(`#${P}`),w?.focus()),w&&!w.selectionEnd&&C&&w.setSelectionRange(R,C),k}let n=function(){function g(E,A,F,O=null,M=null){A instanceof HTMLTemplateElement&&F instanceof HTMLTemplateElement&&(A=A.content,F=F.content),O||=A.firstChild;for(let H of F.childNodes){if(O&&O!=M){let q=w(E,H,O,M);if(q){q!==O&&R(E,O,q),o(q,H,E),O=q.nextSibling;continue}}if(H instanceof Element&&E.persistentIds.has(H.id)){let q=C(A,H.id,O,E);o(q,H,E),O=q.nextSibling;continue}let W=b(A,H,O,E);W&&(O=W.nextSibling)}for(;O&&O!=M;){let H=O;O=O.nextSibling,P(E,H)}}function b(E,A,F,O){if(O.callbacks.beforeNodeAdded(A)===!1)return null;if(O.idMap.has(A)){let M=document.createElement(A.tagName);return E.insertBefore(M,F),o(M,A,O),O.callbacks.afterNodeAdded(M),M}else{let M=document.importNode(A,!0);return E.insertBefore(M,F),O.callbacks.afterNodeAdded(M),M}}let w=function(){function E(O,M,H,W){let q=null,Y=M.nextSibling,ne=0,se=H;for(;se&&se!=W;){if(F(se,M)){if(A(O,se,M))return se;q===null&&(O.idMap.has(se)||(q=se))}if(q===null&&Y&&F(se,Y)&&(ne++,Y=Y.nextSibling,ne>=2&&(q=void 0)),se.contains(document.activeElement))break;se=se.nextSibling}return q||null}function A(O,M,H){let W=O.idMap.get(M),q=O.idMap.get(H);if(!q||!W)return!1;for(let Y of W)if(q.has(Y))return!0;return!1}function F(O,M){let H=O,W=M;return H.nodeType===W.nodeType&&H.tagName===W.tagName&&(!H.id||H.id===W.id)}return E}();function P(E,A){if(E.idMap.has(A))_(E.pantry,A,null);else{if(E.callbacks.beforeNodeRemoved(A)===!1)return;A.parentNode?.removeChild(A),E.callbacks.afterNodeRemoved(A)}}function R(E,A,F){let O=A;for(;O&&O!==F;){let M=O;O=O.nextSibling,P(E,M)}return O}function C(E,A,F,O){let M=O.target.querySelector(`#${A}`)||O.pantry.querySelector(`#${A}`);return k(M,O),_(E,M,F),M}function k(E,A){let F=E.id;for(;E=E.parentNode;){let O=A.idMap.get(E);O&&(O.delete(F),O.size||A.idMap.delete(E))}}function _(E,A,F){if(E.moveBefore)try{E.moveBefore(A,F)}catch{E.insertBefore(A,F)}else E.insertBefore(A,F)}return g}(),o=function(){function g(k,_,E){return E.ignoreActive&&k===document.activeElement?null:(E.callbacks.beforeNodeMorphed(k,_)===!1||(k instanceof HTMLHeadElement&&E.head.ignore||(k instanceof HTMLHeadElement&&E.head.style!=="morph"?l(k,_,E):(b(k,_,E),C(k,E)||n(E,k,_))),E.callbacks.afterNodeMorphed(k,_)),k)}function b(k,_,E){let A=_.nodeType;if(A===1){let F=k,O=_,M=F.attributes,H=O.attributes;for(let W of H)R(W.name,F,"update",E)||F.getAttribute(W.name)!==W.value&&F.setAttribute(W.name,W.value);for(let W=M.length-1;0<=W;W--){let q=M[W];if(q&&!O.hasAttribute(q.name)){if(R(q.name,F,"remove",E))continue;F.removeAttribute(q.name)}}C(F,E)||w(F,O,E)}(A===8||A===3)&&k.nodeValue!==_.nodeValue&&(k.nodeValue=_.nodeValue)}function w(k,_,E){if(k instanceof HTMLInputElement&&_ instanceof HTMLInputElement&&_.type!=="file"){let A=_.value,F=k.value;P(k,_,"checked",E),P(k,_,"disabled",E),_.hasAttribute("value")?F!==A&&(R("value",k,"update",E)||(k.setAttribute("value",A),k.value=A)):R("value",k,"remove",E)||(k.value="",k.removeAttribute("value"))}else if(k instanceof HTMLOptionElement&&_ instanceof HTMLOptionElement)P(k,_,"selected",E);else if(k instanceof HTMLTextAreaElement&&_ instanceof HTMLTextAreaElement){let A=_.value,F=k.value;if(R("value",k,"update",E))return;A!==F&&(k.value=A),k.firstChild&&k.firstChild.nodeValue!==A&&(k.firstChild.nodeValue=A)}}function P(k,_,E,A){let F=_[E],O=k[E];if(F!==O){let M=R(E,k,"update",A);M||(k[E]=_[E]),F?M||k.setAttribute(E,""):R(E,k,"remove",A)||k.removeAttribute(E)}}function R(k,_,E,A){return k==="value"&&A.ignoreActiveValue&&_===document.activeElement?!0:A.callbacks.beforeAttributeUpdated(k,_,E)===!1}function C(k,_){return!!_.ignoreActiveValue&&k===document.activeElement&&k!==document.body}return g}();function a(g,b,w,P){if(g.head.block){let R=b.querySelector("head"),C=w.querySelector("head");if(R&&C){let k=l(R,C,g);return Promise.all(k).then(()=>{let _=Object.assign(g,{head:{block:!1,ignore:!0}});return P(_)})}}return P(g)}function l(g,b,w){let P=[],R=[],C=[],k=[],_=new Map;for(let A of b.children)_.set(A.outerHTML,A);for(let A of g.children){let F=_.has(A.outerHTML),O=w.head.shouldReAppend(A),M=w.head.shouldPreserve(A);F||M?O?R.push(A):(_.delete(A.outerHTML),C.push(A)):w.head.style==="append"?O&&(R.push(A),k.push(A)):w.head.shouldRemove(A)!==!1&&R.push(A)}k.push(..._.values());let E=[];for(let A of k){let F=document.createRange().createContextualFragment(A.outerHTML).firstChild;if(w.callbacks.beforeNodeAdded(F)!==!1){if("href"in F&&F.href||"src"in F&&F.src){let O,M=new Promise(function(H){O=H});F.addEventListener("load",function(){O()}),E.push(M)}g.appendChild(F),w.callbacks.afterNodeAdded(F),P.push(F)}}for(let A of R)w.callbacks.beforeNodeRemoved(A)!==!1&&(g.removeChild(A),w.callbacks.afterNodeRemoved(A));return w.head.afterHeadMorphed(g,{added:P,kept:C,removed:R}),E}let c=function(){function g(_,E,A){let{persistentIds:F,idMap:O}=C(_,E),M=b(A),H=M.morphStyle||"outerHTML";if(!["innerHTML","outerHTML"].includes(H))throw`Do not understand how to morph style ${H}`;return{target:_,newContent:E,config:M,morphStyle:H,ignoreActive:M.ignoreActive,ignoreActiveValue:M.ignoreActiveValue,restoreFocus:M.restoreFocus,idMap:O,persistentIds:F,pantry:w(),callbacks:M.callbacks,head:M.head}}function b(_){let E=Object.assign({},e);return Object.assign(E,_),E.callbacks=Object.assign({},e.callbacks,_.callbacks),E.head=Object.assign({},e.head,_.head),E}function w(){let _=document.createElement("div");return _.hidden=!0,document.body.insertAdjacentElement("afterend",_),_}function P(_){let E=Array.from(_.querySelectorAll("[id]"));return _.id&&E.push(_),E}function R(_,E,A,F){for(let O of F)if(E.has(O.id)){let M=O;for(;M;){let H=_.get(M);if(H==null&&(H=new Set,_.set(M,H)),H.add(O.id),M===A)break;M=M.parentElement}}}function C(_,E){let A=P(_),F=P(E),O=k(A,F),M=new Map;R(M,O,_,A);let H=E.__idiomorphRoot||E;return R(M,O,H,F),{persistentIds:O,idMap:M}}function k(_,E){let A=new Set,F=new Map;for(let{id:M,tagName:H}of _)F.has(M)?A.add(M):F.set(M,H);let O=new Set;for(let{id:M,tagName:H}of E)O.has(M)?A.add(M):F.get(M)===H&&O.add(M);for(let M of A)O.delete(M);return O}return g}(),{normalizeElement:d,normalizeParent:f}=function(){let g=new WeakSet;function b(C){return C instanceof Document?C.documentElement:C}function w(C){if(C==null)return document.createElement("div");if(typeof C=="string")return w(R(C));if(g.has(C))return C;if(C instanceof Node){if(C.parentNode)return P(C);{let k=document.createElement("div");return k.append(C),k}}else{let k=document.createElement("div");for(let _ of[...C])k.append(_);return k}}function P(C){return{childNodes:[C],querySelectorAll:k=>{let _=C.querySelectorAll(k);return C.matches(k)?[C,..._]:_},insertBefore:(k,_)=>C.parentNode.insertBefore(k,_),moveBefore:(k,_)=>C.parentNode.moveBefore(k,_),get __idiomorphRoot(){return C}}}function R(C){let k=new DOMParser,_=C.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(_.match(/<\/html>/)||_.match(/<\/head>/)||_.match(/<\/body>/)){let E=k.parseFromString(C,"text/html");if(_.match(/<\/html>/))return g.add(E),E;{let A=E.firstChild;return A&&g.add(A),A}}else{let A=k.parseFromString("<body><template>"+C+"</template></body>","text/html").body.querySelector("template").content;return g.add(A),A}}return{normalizeElement:b,normalizeParent:w}}();return{morph:t,defaults:e}}();function Fc(i,e,{callbacks:t,...r}={}){cy.morph(i,e,{...r,callbacks:new Ql(t)})}function cp(i,e){Fc(i,e.childNodes,{morphStyle:"innerHTML"})}var Ql=class{#e;constructor({beforeNodeMorphed:e}={}){this.#e=e||(()=>!0)}beforeNodeAdded=e=>!(e.id&&e.hasAttribute("data-turbo-permanent")&&document.getElementById(e.id));beforeNodeMorphed=(e,t)=>{if(e instanceof Element)return!e.hasAttribute("data-turbo-permanent")&&this.#e(e,t)?!xe("turbo:before-morph-element",{cancelable:!0,target:e,detail:{currentElement:e,newElement:t}}).defaultPrevented:!1};beforeAttributeUpdated=(e,t,r)=>!xe("turbo:before-morph-attribute",{cancelable:!0,target:t,detail:{attributeName:e,mutationType:r}}).defaultPrevented;beforeNodeRemoved=e=>this.beforeNodeMorphed(e);afterNodeMorphed=(e,t)=>{e instanceof Element&&xe("turbo:morph-element",{target:e,detail:{currentElement:e,newElement:t}})}},Jl=class extends an{static renderElement(e,t){xe("turbo:before-frame-morph",{target:e,detail:{currentElement:e,newElement:t}}),cp(e,t)}async preservingPermanentElements(e){return await e()}},ec=class i{static animationDuration=300;static get defaultCSS(){return Zd`
|
|
4
|
+
`)}function ub(i,e){return i.reduce((t,r,s)=>{let n=e[s]==null?"":e[s];return t+r+n},"")}function hr(){return Array.from({length:36}).map((i,e)=>e==8||e==13||e==18||e==23?"-":e==14?"4":e==19?(Math.floor(Math.random()*4)+8).toString(16):Math.floor(Math.random()*15).toString(16)).join("")}function qo(i,...e){for(let t of e.map(r=>r?.getAttribute(i)))if(typeof t=="string")return t;return null}function hb(i,...e){return e.some(t=>t&&t.hasAttribute(i))}function Vo(...i){for(let e of i)e.localName=="turbo-frame"&&e.setAttribute("busy",""),e.setAttribute("aria-busy","true")}function jo(...i){for(let e of i)e.localName=="turbo-frame"&&e.removeAttribute("busy"),e.removeAttribute("aria-busy")}function db(i,e=2e3){return new Promise(t=>{let r=()=>{i.removeEventListener("error",r),i.removeEventListener("load",r),t()};i.addEventListener("load",r,{once:!0}),i.addEventListener("error",r,{once:!0}),setTimeout(t,e)})}function jd(i){switch(i){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}function pb(i){return i=="advance"||i=="replace"||i=="restore"}function Pr(...i){let e=qo("data-turbo-action",...i);return pb(e)?e:null}function Sc(i){return document.querySelector(`meta[name="${i}"]`)}function Wo(i){let e=Sc(i);return e&&e.content}function Wd(){let i=Sc("csp-nonce");if(i){let{nonce:e,content:t}=i;return e==""?t:e}}function fb(i,e){let t=Sc(i);return t||(t=document.createElement("meta"),t.setAttribute("name",i),document.head.appendChild(t)),t.setAttribute("content",e),t}function xs(i,e){if(i instanceof Element)return i.closest(e)||xs(i.assignedSlot||i.getRootNode()?.host,e)}function Ec(i){return!!i&&i.closest("[inert], :disabled, [hidden], details:not([open]), dialog:not([open])")==null&&typeof i.focus=="function"}function Gd(i){return Array.from(i.querySelectorAll("[autofocus]")).find(Ec)}async function mb(i,e){let t=e();i(),await Hd();let r=e();return[t,r]}function Kd(i){if(i==="_blank")return!1;if(i){for(let e of document.getElementsByName(i))if(e instanceof HTMLIFrameElement)return!1;return!0}else return!0}function Xd(i){return xs(i,"a[href]:not([target^=_]):not([download])")}function Yd(i){return tt(i.getAttribute("href")||"")}function gb(i,e){let t=null;return(...r)=>{let s=()=>i.apply(this,r);clearTimeout(t),t=setTimeout(s,e)}}var vb={"aria-disabled":{beforeSubmit:i=>{i.setAttribute("aria-disabled","true"),i.addEventListener("click",Rd)},afterSubmit:i=>{i.removeAttribute("aria-disabled"),i.removeEventListener("click",Rd)}},disabled:{beforeSubmit:i=>i.disabled=!0,afterSubmit:i=>i.disabled=!1}},$l=class{#e=null;constructor(e){Object.assign(this,e)}get submitter(){return this.#e}set submitter(e){this.#e=vb[e]||e}},bb=new $l({mode:"on",submitter:"disabled"}),et={drive:ob,forms:bb};function tt(i){return new URL(i.toString(),document.baseURI)}function Fr(i){let e;if(i.hash)return i.hash.slice(1);if(e=i.href.match(/#(.*)$/))return e[1]}function Tc(i,e){let t=e?.getAttribute("formaction")||i.getAttribute("action")||i.action;return tt(t)}function yb(i){return(Tb(i).match(/\.[^.]*$/)||[])[0]||""}function wb(i,e){let t=xb(e);return i.href===tt(t).href||i.href.startsWith(t)}function ur(i,e){return wb(i,e)&&!et.drive.unvisitableExtensions.has(yb(i))}function ql(i){let e=Fr(i);return e!=null?i.href.slice(0,-(e.length+1)):i.href}function Ho(i){return ql(i)}function Sb(i,e){return tt(i).href==tt(e).href}function Eb(i){return i.pathname.split("/").slice(1)}function Tb(i){return Eb(i).slice(-1)[0]}function xb(i){return kb(i.origin+i.pathname)}function kb(i){return i.endsWith("/")?i:i+"/"}var on=class{constructor(e){this.response=e}get succeeded(){return this.response.ok}get failed(){return!this.succeeded}get clientError(){return this.statusCode>=400&&this.statusCode<=499}get serverError(){return this.statusCode>=500&&this.statusCode<=599}get redirected(){return this.response.redirected}get location(){return tt(this.response.url)}get isHTML(){return this.contentType&&this.contentType.match(/^(?:text\/([^\s;,]+\b)?html|application\/xhtml\+xml)\b/)}get statusCode(){return this.response.status}get contentType(){return this.header("Content-Type")}get responseText(){return this.response.clone().text()}get responseHTML(){return this.isHTML?this.response.clone().text():Promise.resolve(void 0)}header(e){return this.response.headers.get(e)}},Vl=class extends Set{constructor(e){super(),this.maxSize=e}add(e){if(this.size>=this.maxSize){let r=this.values().next().value;this.delete(r)}super.add(e)}},Zd=new Vl(20),Ab=window.fetch;function Qd(i,e={}){let t=new Headers(e.headers||{}),r=hr();return Zd.add(r),t.append("X-Turbo-Request-Id",r),Ab(i,{...e,headers:t})}function xc(i){switch(i.toLowerCase()){case"get":return Vt.get;case"post":return Vt.post;case"put":return Vt.put;case"patch":return Vt.patch;case"delete":return Vt.delete}}var Vt={get:"get",post:"post",put:"put",patch:"patch",delete:"delete"};function Cb(i){switch(i.toLowerCase()){case Cr.multipart:return Cr.multipart;case Cr.plain:return Cr.plain;default:return Cr.urlEncoded}}var Cr={urlEncoded:"application/x-www-form-urlencoded",multipart:"multipart/form-data",plain:"text/plain"},_r=class{abortController=new AbortController;#e=e=>{};constructor(e,t,r,s=new URLSearchParams,n=null,o=Cr.urlEncoded){let[a,l]=Md(tt(r),t,s,o);this.delegate=e,this.url=a,this.target=n,this.fetchOptions={credentials:"same-origin",redirect:"follow",method:t.toUpperCase(),headers:{...this.defaultHeaders},body:l,signal:this.abortSignal,referrer:this.delegate.referrer?.href},this.enctype=o}get method(){return this.fetchOptions.method}set method(e){let t=this.isSafe?this.url.searchParams:this.fetchOptions.body||new FormData,r=xc(e)||Vt.get;this.url.search="";let[s,n]=Md(this.url,r,t,this.enctype);this.url=s,this.fetchOptions.body=n,this.fetchOptions.method=r.toUpperCase()}get headers(){return this.fetchOptions.headers}set headers(e){this.fetchOptions.headers=e}get body(){return this.isSafe?this.url.searchParams:this.fetchOptions.body}set body(e){this.fetchOptions.body=e}get location(){return this.url}get params(){return this.url.searchParams}get entries(){return this.body?Array.from(this.body.entries()):[]}cancel(){this.abortController.abort()}async perform(){let{fetchOptions:e}=this;this.delegate.prepareRequest(this);let t=await this.#t(e);try{this.delegate.requestStarted(this),t.detail.fetchRequest?this.response=t.detail.fetchRequest.response:this.response=Qd(this.url.href,e);let r=await this.response;return await this.receive(r)}catch(r){if(r.name!=="AbortError")throw this.#i(r)&&this.delegate.requestErrored(this,r),r}finally{this.delegate.requestFinished(this)}}async receive(e){let t=new on(e);return _e("turbo:before-fetch-response",{cancelable:!0,detail:{fetchResponse:t},target:this.target}).defaultPrevented?this.delegate.requestPreventedHandlingResponse(this,t):t.succeeded?this.delegate.requestSucceededWithResponse(this,t):this.delegate.requestFailedWithResponse(this,t),t}get defaultHeaders(){return{Accept:"text/html, application/xhtml+xml"}}get isSafe(){return kc(this.method)}get abortSignal(){return this.abortController.signal}acceptResponseType(e){this.headers.Accept=[e,this.headers.Accept].join(", ")}async#t(e){let t=new Promise(s=>this.#e=s),r=_e("turbo:before-fetch-request",{cancelable:!0,detail:{fetchOptions:e,url:this.url,resume:this.#e},target:this.target});return this.url=r.detail.url,r.defaultPrevented&&await t,r}#i(e){return!_e("turbo:fetch-request-error",{target:this.target,cancelable:!0,detail:{request:this,error:e}}).defaultPrevented}};function kc(i){return xc(i)==Vt.get}function Md(i,e,t,r){let s=Array.from(t).length>0?new URLSearchParams(Jd(t)):i.searchParams;return kc(e)?[Pb(i,s),null]:r==Cr.urlEncoded?[i,s]:[i,t]}function Jd(i){let e=[];for(let[t,r]of i)r instanceof File||e.push([t,r]);return e}function Pb(i,e){let t=new URLSearchParams(Jd(e));return i.search=t.toString(),i}var jl=class{started=!1;constructor(e,t){this.delegate=e,this.element=t,this.intersectionObserver=new IntersectionObserver(this.intersect)}start(){this.started||(this.started=!0,this.intersectionObserver.observe(this.element))}stop(){this.started&&(this.started=!1,this.intersectionObserver.unobserve(this.element))}intersect=e=>{e.slice(-1)[0]?.isIntersecting&&this.delegate.elementAppearedInViewport(this.element)}},dr=class{static contentType="text/vnd.turbo-stream.html";static wrap(e){return typeof e=="string"?new this(lb(e)):e}constructor(e){this.fragment=Fb(e)}};function Fb(i){for(let e of i.querySelectorAll("turbo-stream")){let t=document.importNode(e,!0);for(let r of t.templateElement.content.querySelectorAll("script"))r.replaceWith(nn(r));e.replaceWith(t)}return i}var _b=100,Wl=class{#e=null;#t=null;get(e){if(this.#t&&this.#t.url===e&&this.#t.expire>Date.now())return this.#t.request}setLater(e,t,r){this.clear(),this.#e=setTimeout(()=>{t.perform(),this.set(e,t,r),this.#e=null},_b)}set(e,t,r){this.#t={url:e,request:t,expire:new Date(new Date().getTime()+r)}}clear(){this.#e&&clearTimeout(this.#e),this.#t=null}},Ob=10*1e3,Ts=new Wl,Ss={initialized:"initialized",requesting:"requesting",waiting:"waiting",receiving:"receiving",stopping:"stopping",stopped:"stopped"},Go=class i{state=Ss.initialized;static confirmMethod(e){return Promise.resolve(confirm(e))}constructor(e,t,r,s=!1){let n=Nb(t,r),o=Db(Ib(t,r),n),a=Lb(t,r),l=Bb(t,r);this.delegate=e,this.formElement=t,this.submitter=r,this.fetchRequest=new _r(this,n,o,a,t,l),this.mustRedirect=s}get method(){return this.fetchRequest.method}set method(e){this.fetchRequest.method=e}get action(){return this.fetchRequest.url.toString()}set action(e){this.fetchRequest.url=tt(e)}get body(){return this.fetchRequest.body}get enctype(){return this.fetchRequest.enctype}get isSafe(){return this.fetchRequest.isSafe}get location(){return this.fetchRequest.url}async start(){let{initialized:e,requesting:t}=Ss,r=qo("data-turbo-confirm",this.submitter,this.formElement);if(!(typeof r=="string"&&!await(typeof et.forms.confirm=="function"?et.forms.confirm:i.confirmMethod)(r,this.formElement,this.submitter))&&this.state==e)return this.state=t,this.fetchRequest.perform()}stop(){let{stopping:e,stopped:t}=Ss;if(this.state!=e&&this.state!=t)return this.state=e,this.fetchRequest.cancel(),!0}prepareRequest(e){if(!e.isSafe){let t=Rb(Wo("csrf-param"))||Wo("csrf-token");t&&(e.headers["X-CSRF-Token"]=t)}this.requestAcceptsTurboStreamResponse(e)&&e.acceptResponseType(dr.contentType)}requestStarted(e){this.state=Ss.waiting,this.submitter&&et.forms.submitter.beforeSubmit(this.submitter),this.setSubmitsWith(),Vo(this.formElement),_e("turbo:submit-start",{target:this.formElement,detail:{formSubmission:this}}),this.delegate.formSubmissionStarted(this)}requestPreventedHandlingResponse(e,t){Ts.clear(),this.result={success:t.succeeded,fetchResponse:t}}requestSucceededWithResponse(e,t){if(t.clientError||t.serverError){this.delegate.formSubmissionFailedWithResponse(this,t);return}if(Ts.clear(),this.requestMustRedirect(e)&&Mb(t)){let r=new Error("Form responses must redirect to another location");this.delegate.formSubmissionErrored(this,r)}else this.state=Ss.receiving,this.result={success:!0,fetchResponse:t},this.delegate.formSubmissionSucceededWithResponse(this,t)}requestFailedWithResponse(e,t){this.result={success:!1,fetchResponse:t},this.delegate.formSubmissionFailedWithResponse(this,t)}requestErrored(e,t){this.result={success:!1,error:t},this.delegate.formSubmissionErrored(this,t)}requestFinished(e){this.state=Ss.stopped,this.submitter&&et.forms.submitter.afterSubmit(this.submitter),this.resetSubmitterText(),jo(this.formElement),_e("turbo:submit-end",{target:this.formElement,detail:{formSubmission:this,...this.result}}),this.delegate.formSubmissionFinished(this)}setSubmitsWith(){if(!(!this.submitter||!this.submitsWith)){if(this.submitter.matches("button"))this.originalSubmitText=this.submitter.innerHTML,this.submitter.innerHTML=this.submitsWith;else if(this.submitter.matches("input")){let e=this.submitter;this.originalSubmitText=e.value,e.value=this.submitsWith}}}resetSubmitterText(){if(!(!this.submitter||!this.originalSubmitText)){if(this.submitter.matches("button"))this.submitter.innerHTML=this.originalSubmitText;else if(this.submitter.matches("input")){let e=this.submitter;e.value=this.originalSubmitText}}}requestMustRedirect(e){return!e.isSafe&&this.mustRedirect}requestAcceptsTurboStreamResponse(e){return!e.isSafe||hb("data-turbo-stream",this.submitter,this.formElement)}get submitsWith(){return this.submitter?.getAttribute("data-turbo-submits-with")}};function Lb(i,e){let t=new FormData(i),r=e?.getAttribute("name"),s=e?.getAttribute("value");return r&&t.append(r,s||""),t}function Rb(i){if(i!=null){let t=(document.cookie?document.cookie.split("; "):[]).find(r=>r.startsWith(i));if(t){let r=t.split("=").slice(1).join("=");return r?decodeURIComponent(r):void 0}}}function Mb(i){return i.statusCode==200&&!i.redirected}function Ib(i,e){let t=typeof i.action=="string"?i.action:null;return e?.hasAttribute("formaction")?e.getAttribute("formaction")||"":i.getAttribute("action")||t||""}function Db(i,e){let t=tt(i);return kc(e)&&(t.search=""),t}function Nb(i,e){let t=e?.getAttribute("formmethod")||i.getAttribute("method")||"";return xc(t.toLowerCase())||Vt.get}function Bb(i,e){return Cb(e?.getAttribute("formenctype")||i.enctype)}var As=class{constructor(e){this.element=e}get activeElement(){return this.element.ownerDocument.activeElement}get children(){return[...this.element.children]}hasAnchor(e){return this.getElementForAnchor(e)!=null}getElementForAnchor(e){return e?this.element.querySelector(`[id='${e}'], a[name='${e}']`):null}get isConnected(){return this.element.isConnected}get firstAutofocusableElement(){return Gd(this.element)}get permanentElements(){return tp(this.element)}getPermanentElementById(e){return ep(this.element,e)}getPermanentElementMapForSnapshot(e){let t={};for(let r of this.permanentElements){let{id:s}=r,n=e.getPermanentElementById(s);n&&(t[s]=[r,n])}return t}};function ep(i,e){return i.querySelector(`#${e}[data-turbo-permanent]`)}function tp(i){return i.querySelectorAll("[id][data-turbo-permanent]")}var an=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("submit",this.submitCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("submit",this.submitCaptured,!0),this.started=!1)}submitCaptured=()=>{this.eventTarget.removeEventListener("submit",this.submitBubbled,!1),this.eventTarget.addEventListener("submit",this.submitBubbled,!1)};submitBubbled=e=>{if(!e.defaultPrevented){let t=e.target instanceof HTMLFormElement?e.target:void 0,r=e.submitter||void 0;t&&Ub(t,r)&&zb(t,r)&&this.delegate.willSubmitForm(t,r)&&(e.preventDefault(),e.stopImmediatePropagation(),this.delegate.formSubmitted(t,r))}}};function Ub(i,e){return(e?.getAttribute("formmethod")||i.getAttribute("method"))!="dialog"}function zb(i,e){let t=e?.getAttribute("formtarget")||i.getAttribute("target");return Kd(t)}var Ko=class{#e=e=>{};#t=e=>{};constructor(e,t){this.delegate=e,this.element=t}scrollToAnchor(e){let t=this.snapshot.getElementForAnchor(e);t?(this.scrollToElement(t),this.focusElement(t)):this.scrollToPosition({x:0,y:0})}scrollToAnchorFromLocation(e){this.scrollToAnchor(Fr(e))}scrollToElement(e){e.scrollIntoView()}focusElement(e){e instanceof HTMLElement&&(e.hasAttribute("tabindex")?e.focus():(e.setAttribute("tabindex","-1"),e.focus(),e.removeAttribute("tabindex")))}scrollToPosition({x:e,y:t}){this.scrollRoot.scrollTo(e,t)}scrollToTop(){this.scrollToPosition({x:0,y:0})}get scrollRoot(){return window}async render(e){let{isPreview:t,shouldRender:r,willRender:s,newSnapshot:n}=e,o=s;if(r)try{this.renderPromise=new Promise(d=>this.#e=d),this.renderer=e,await this.prepareToRenderSnapshot(e);let a=new Promise(d=>this.#t=d),l={resume:this.#t,render:this.renderer.renderElement,renderMethod:this.renderer.renderMethod};this.delegate.allowsImmediateRender(n,l)||await a,await this.renderSnapshot(e),this.delegate.viewRenderedSnapshot(n,t,this.renderer.renderMethod),this.delegate.preloadOnLoadLinksForView(this.element),this.finishRenderingSnapshot(e)}finally{delete this.renderer,this.#e(void 0),delete this.renderPromise}else o&&this.invalidate(e.reloadReason)}invalidate(e){this.delegate.viewInvalidated(e)}async prepareToRenderSnapshot(e){this.markAsPreview(e.isPreview),await e.prepareToRender()}markAsPreview(e){e?this.element.setAttribute("data-turbo-preview",""):this.element.removeAttribute("data-turbo-preview")}markVisitDirection(e){this.element.setAttribute("data-turbo-visit-direction",e)}unmarkVisitDirection(){this.element.removeAttribute("data-turbo-visit-direction")}async renderSnapshot(e){await e.render()}finishRenderingSnapshot(e){e.finishRendering()}},Gl=class extends Ko{missing(){this.element.innerHTML='<strong class="turbo-frame-error">Content missing</strong>'}get snapshot(){return new As(this.element)}},Xo=class{constructor(e,t){this.delegate=e,this.element=t}start(){this.element.addEventListener("click",this.clickBubbled),document.addEventListener("turbo:click",this.linkClicked),document.addEventListener("turbo:before-visit",this.willVisit)}stop(){this.element.removeEventListener("click",this.clickBubbled),document.removeEventListener("turbo:click",this.linkClicked),document.removeEventListener("turbo:before-visit",this.willVisit)}clickBubbled=e=>{this.clickEventIsSignificant(e)?this.clickEvent=e:delete this.clickEvent};linkClicked=e=>{this.clickEvent&&this.clickEventIsSignificant(e)&&this.delegate.shouldInterceptLinkClick(e.target,e.detail.url,e.detail.originalEvent)&&(this.clickEvent.preventDefault(),e.preventDefault(),this.delegate.linkClickIntercepted(e.target,e.detail.url,e.detail.originalEvent)),delete this.clickEvent};willVisit=e=>{delete this.clickEvent};clickEventIsSignificant(e){let t=e.composed?e.target?.parentElement:e.target,r=Xd(t)||t;return r instanceof Element&&r.closest("turbo-frame, html")==this.element}},Yo=class{started=!1;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.addEventListener("click",this.clickCaptured,!0),this.started=!0)}stop(){this.started&&(this.eventTarget.removeEventListener("click",this.clickCaptured,!0),this.started=!1)}clickCaptured=()=>{this.eventTarget.removeEventListener("click",this.clickBubbled,!1),this.eventTarget.addEventListener("click",this.clickBubbled,!1)};clickBubbled=e=>{if(e instanceof MouseEvent&&this.clickEventIsSignificant(e)){let t=e.composedPath&&e.composedPath()[0]||e.target,r=Xd(t);if(r&&Kd(r.target)){let s=Yd(r);this.delegate.willFollowLinkToLocation(r,s,e)&&(e.preventDefault(),this.delegate.followedLinkToLocation(r,s))}}};clickEventIsSignificant(e){return!(e.target&&e.target.isContentEditable||e.defaultPrevented||e.which>1||e.altKey||e.ctrlKey||e.metaKey||e.shiftKey)}},Zo=class{constructor(e,t){this.delegate=e,this.linkInterceptor=new Yo(this,t)}start(){this.linkInterceptor.start()}stop(){this.linkInterceptor.stop()}canPrefetchRequestToLocation(e,t){return!1}prefetchAndCacheRequestToLocation(e,t){}willFollowLinkToLocation(e,t,r){return this.delegate.willSubmitFormLinkToLocation(e,t,r)&&(e.hasAttribute("data-turbo-method")||e.hasAttribute("data-turbo-stream"))}followedLinkToLocation(e,t){let r=document.createElement("form"),s="hidden";for(let[f,y]of t.searchParams)r.append(Object.assign(document.createElement("input"),{type:s,name:f,value:y}));let n=Object.assign(t,{search:""});r.setAttribute("data-turbo","true"),r.setAttribute("action",n.href),r.setAttribute("hidden","");let o=e.getAttribute("data-turbo-method");o&&r.setAttribute("method",o);let a=e.getAttribute("data-turbo-frame");a&&r.setAttribute("data-turbo-frame",a);let l=Pr(e);l&&r.setAttribute("data-turbo-action",l);let c=e.getAttribute("data-turbo-confirm");c&&r.setAttribute("data-turbo-confirm",c),e.hasAttribute("data-turbo-stream")&&r.setAttribute("data-turbo-stream",""),this.delegate.submittedFormLinkToLocation(e,t,r),document.body.appendChild(r),r.addEventListener("turbo:submit-end",()=>r.remove(),{once:!0}),requestAnimationFrame(()=>r.requestSubmit())}},Qo=class{static async preservingPermanentElements(e,t,r){let s=new this(e,t);s.enter(),await r(),s.leave()}constructor(e,t){this.delegate=e,this.permanentElementMap=t}enter(){for(let e in this.permanentElementMap){let[t,r]=this.permanentElementMap[e];this.delegate.enteringBardo(t,r),this.replaceNewPermanentElementWithPlaceholder(r)}}leave(){for(let e in this.permanentElementMap){let[t]=this.permanentElementMap[e];this.replaceCurrentPermanentElementWithClone(t),this.replacePlaceholderWithPermanentElement(t),this.delegate.leavingBardo(t)}}replaceNewPermanentElementWithPlaceholder(e){let t=Hb(e);e.replaceWith(t)}replaceCurrentPermanentElementWithClone(e){let t=e.cloneNode(!0);e.replaceWith(t)}replacePlaceholderWithPermanentElement(e){this.getPlaceholderById(e.id)?.replaceWith(e)}getPlaceholderById(e){return this.placeholders.find(t=>t.content==e)}get placeholders(){return[...document.querySelectorAll("meta[name=turbo-permanent-placeholder][content]")]}};function Hb(i){let e=document.createElement("meta");return e.setAttribute("name","turbo-permanent-placeholder"),e.setAttribute("content",i.id),e}var ln=class{#e=null;static renderElement(e,t){}constructor(e,t,r,s=!0){this.currentSnapshot=e,this.newSnapshot=t,this.isPreview=r,this.willRender=s,this.renderElement=this.constructor.renderElement,this.promise=new Promise((n,o)=>this.resolvingFunctions={resolve:n,reject:o})}get shouldRender(){return!0}get shouldAutofocus(){return!0}get reloadReason(){}prepareToRender(){}render(){}finishRendering(){this.resolvingFunctions&&(this.resolvingFunctions.resolve(),delete this.resolvingFunctions)}async preservingPermanentElements(e){await Qo.preservingPermanentElements(this,this.permanentElementMap,e)}focusFirstAutofocusableElement(){if(this.shouldAutofocus){let e=this.connectedSnapshot.firstAutofocusableElement;e&&e.focus()}}enteringBardo(e){this.#e||e.contains(this.currentSnapshot.activeElement)&&(this.#e=this.currentSnapshot.activeElement)}leavingBardo(e){e.contains(this.#e)&&this.#e instanceof HTMLElement&&(this.#e.focus(),this.#e=null)}get connectedSnapshot(){return this.newSnapshot.isConnected?this.newSnapshot:this.currentSnapshot}get currentElement(){return this.currentSnapshot.element}get newElement(){return this.newSnapshot.element}get permanentElementMap(){return this.currentSnapshot.getPermanentElementMapForSnapshot(this.newSnapshot)}get renderMethod(){return"replace"}},cn=class extends ln{static renderElement(e,t){let r=document.createRange();r.selectNodeContents(e),r.deleteContents();let s=t,n=s.ownerDocument?.createRange();n&&(n.selectNodeContents(s),e.appendChild(n.extractContents()))}constructor(e,t,r,s,n,o=!0){super(t,r,s,n,o),this.delegate=e}get shouldRender(){return!0}async render(){await sn(),this.preservingPermanentElements(()=>{this.loadFrameElement()}),this.scrollFrameIntoView(),await sn(),this.focusFirstAutofocusableElement(),await sn(),this.activateScriptElements()}loadFrameElement(){this.delegate.willRenderFrame(this.currentElement,this.newElement),this.renderElement(this.currentElement,this.newElement)}scrollFrameIntoView(){if(this.currentElement.autoscroll||this.newElement.autoscroll){let e=this.currentElement.firstElementChild,t=$b(this.currentElement.getAttribute("data-autoscroll-block"),"end"),r=qb(this.currentElement.getAttribute("data-autoscroll-behavior"),"auto");if(e)return e.scrollIntoView({block:t,behavior:r}),!0}return!1}activateScriptElements(){for(let e of this.newScriptElements){let t=nn(e);e.replaceWith(t)}}get newScriptElements(){return this.currentElement.querySelectorAll("script")}};function $b(i,e){return i=="end"||i=="start"||i=="center"||i=="nearest"?i:e}function qb(i,e){return i=="auto"||i=="smooth"?i:e}var Vb=function(){let i=new Set,e={morphStyle:"outerHTML",callbacks:{beforeNodeAdded:y,afterNodeAdded:y,beforeNodeMorphed:y,afterNodeMorphed:y,beforeNodeRemoved:y,afterNodeRemoved:y,beforeAttributeUpdated:y},head:{style:"merge",shouldPreserve:function(T){return T.getAttribute("im-preserve")==="true"},shouldReAppend:function(T){return T.getAttribute("im-re-append")==="true"},shouldRemove:y,afterHeadMorphed:y}};function t(T,k,A={}){T instanceof Document&&(T=T.documentElement),typeof k=="string"&&(k=M(k));let H=$(k),j=x(T,H,A);return r(T,H,j)}function r(T,k,A){if(A.head.block){let H=T.querySelector("head"),j=k.querySelector("head");if(H&&j){let U=f(j,H,A);Promise.all(U).then(function(){r(T,k,Object.assign(A,{head:{block:!1,ignore:!0}}))});return}}if(A.morphStyle==="innerHTML")return o(k,T,A),T.children;if(A.morphStyle==="outerHTML"||A.morphStyle==null){let H=G(k,T,A),j=H?.previousSibling,U=H?.nextSibling,ee=n(T,H,A);return H?z(j,ee,U):[]}else throw"Do not understand how to morph style "+A.morphStyle}function s(T,k){return k.ignoreActiveValue&&T===document.activeElement&&T!==document.body}function n(T,k,A){if(!(A.ignoreActive&&T===document.activeElement))return k==null?A.callbacks.beforeNodeRemoved(T)===!1?T:(T.remove(),A.callbacks.afterNodeRemoved(T),null):F(T,k)?(A.callbacks.beforeNodeMorphed(T,k)===!1||(T instanceof HTMLHeadElement&&A.head.ignore||(T instanceof HTMLHeadElement&&A.head.style!=="morph"?f(k,T,A):(l(k,T,A),s(T,A)||o(k,T,A))),A.callbacks.afterNodeMorphed(T,k)),T):A.callbacks.beforeNodeRemoved(T)===!1||A.callbacks.beforeNodeAdded(k)===!1?T:(T.parentElement.replaceChild(k,T),A.callbacks.afterNodeAdded(k),A.callbacks.afterNodeRemoved(T),k)}function o(T,k,A){let H=T.firstChild,j=k.firstChild,U;for(;H;){if(U=H,H=U.nextSibling,j==null){if(A.callbacks.beforeNodeAdded(U)===!1)return;k.appendChild(U),A.callbacks.afterNodeAdded(U),re(A,U);continue}if(C(U,j,A)){n(j,U,A),j=j.nextSibling,re(A,U);continue}let ee=D(T,k,U,j,A);if(ee){j=L(j,ee,A),n(ee,U,A),re(A,U);continue}let te=V(T,k,U,j,A);if(te){j=L(j,te,A),n(te,U,A),re(A,U);continue}if(A.callbacks.beforeNodeAdded(U)===!1)return;k.insertBefore(U,j),A.callbacks.afterNodeAdded(U),re(A,U)}for(;j!==null;){let ee=j;j=j.nextSibling,Q(ee,A)}}function a(T,k,A,H){return T==="value"&&H.ignoreActiveValue&&k===document.activeElement?!0:H.callbacks.beforeAttributeUpdated(T,k,A)===!1}function l(T,k,A){let H=T.nodeType;if(H===1){let j=T.attributes,U=k.attributes;for(let ee of j)a(ee.name,k,"update",A)||k.getAttribute(ee.name)!==ee.value&&k.setAttribute(ee.name,ee.value);for(let ee=U.length-1;0<=ee;ee--){let te=U[ee];a(te.name,k,"remove",A)||T.hasAttribute(te.name)||k.removeAttribute(te.name)}}(H===8||H===3)&&k.nodeValue!==T.nodeValue&&(k.nodeValue=T.nodeValue),s(k,A)||d(T,k,A)}function c(T,k,A,H){if(T[A]!==k[A]){let j=a(A,k,"update",H);j||(k[A]=T[A]),T[A]?j||k.setAttribute(A,T[A]):a(A,k,"remove",H)||k.removeAttribute(A)}}function d(T,k,A){if(T instanceof HTMLInputElement&&k instanceof HTMLInputElement&&T.type!=="file"){let H=T.value,j=k.value;c(T,k,"checked",A),c(T,k,"disabled",A),T.hasAttribute("value")?H!==j&&(a("value",k,"update",A)||(k.setAttribute("value",H),k.value=H)):a("value",k,"remove",A)||(k.value="",k.removeAttribute("value"))}else if(T instanceof HTMLOptionElement)c(T,k,"selected",A);else if(T instanceof HTMLTextAreaElement&&k instanceof HTMLTextAreaElement){let H=T.value,j=k.value;if(a("value",k,"update",A))return;H!==j&&(k.value=H),k.firstChild&&k.firstChild.nodeValue!==H&&(k.firstChild.nodeValue=H)}}function f(T,k,A){let H=[],j=[],U=[],ee=[],te=A.head.style,Ae=new Map;for(let ce of T.children)Ae.set(ce.outerHTML,ce);for(let ce of k.children){let Le=Ae.has(ce.outerHTML),De=A.head.shouldReAppend(ce),He=A.head.shouldPreserve(ce);Le||He?De?j.push(ce):(Ae.delete(ce.outerHTML),U.push(ce)):te==="append"?De&&(j.push(ce),ee.push(ce)):A.head.shouldRemove(ce)!==!1&&j.push(ce)}ee.push(...Ae.values());let oe=[];for(let ce of ee){let Le=document.createRange().createContextualFragment(ce.outerHTML).firstChild;if(A.callbacks.beforeNodeAdded(Le)!==!1){if(Le.href||Le.src){let De=null,He=new Promise(function(gi){De=gi});Le.addEventListener("load",function(){De()}),oe.push(He)}k.appendChild(Le),A.callbacks.afterNodeAdded(Le),H.push(Le)}}for(let ce of j)A.callbacks.beforeNodeRemoved(ce)!==!1&&(k.removeChild(ce),A.callbacks.afterNodeRemoved(ce));return A.head.afterHeadMorphed(k,{added:H,kept:U,removed:j}),oe}function y(){}function v(T){let k={};return Object.assign(k,e),Object.assign(k,T),k.callbacks={},Object.assign(k.callbacks,e.callbacks),Object.assign(k.callbacks,T.callbacks),k.head={},Object.assign(k.head,e.head),Object.assign(k.head,T.head),k}function x(T,k,A){return A=v(A),{target:T,newContent:k,config:A,morphStyle:A.morphStyle,ignoreActive:A.ignoreActive,ignoreActiveValue:A.ignoreActiveValue,idMap:We(T,k),deadIds:new Set,callbacks:A.callbacks,head:A.head}}function C(T,k,A){return T==null||k==null?!1:T.nodeType===k.nodeType&&T.tagName===k.tagName?T.id!==""&&T.id===k.id?!0:le(A,T,k)>0:!1}function F(T,k){return T==null||k==null?!1:T.nodeType===k.nodeType&&T.tagName===k.tagName}function L(T,k,A){for(;T!==k;){let H=T;T=T.nextSibling,Q(H,A)}return re(A,k),k.nextSibling}function D(T,k,A,H,j){let U=le(j,A,k),ee=null;if(U>0){let te=H,Ae=0;for(;te!=null;){if(C(A,te,j))return te;if(Ae+=le(j,te,T),Ae>U)return null;te=te.nextSibling}}return ee}function V(T,k,A,H,j){let U=H,ee=A.nextSibling,te=0;for(;U!=null;){if(le(j,U,T)>0)return null;if(F(A,U))return U;if(F(ee,U)&&(te++,ee=ee.nextSibling,te>=2))return null;U=U.nextSibling}return U}function M(T){let k=new DOMParser,A=T.replace(/<svg(\s[^>]*>|>)([\s\S]*?)<\/svg>/gim,"");if(A.match(/<\/html>/)||A.match(/<\/head>/)||A.match(/<\/body>/)){let H=k.parseFromString(T,"text/html");if(A.match(/<\/html>/))return H.generatedByIdiomorph=!0,H;{let j=H.firstChild;return j?(j.generatedByIdiomorph=!0,j):null}}else{let j=k.parseFromString("<body><template>"+T+"</template></body>","text/html").body.querySelector("template").content;return j.generatedByIdiomorph=!0,j}}function $(T){if(T==null)return document.createElement("div");if(T.generatedByIdiomorph)return T;if(T instanceof Node){let k=document.createElement("div");return k.append(T),k}else{let k=document.createElement("div");for(let A of[...T])k.append(A);return k}}function z(T,k,A){let H=[],j=[];for(;T!=null;)H.push(T),T=T.previousSibling;for(;H.length>0;){let U=H.pop();j.push(U),k.parentElement.insertBefore(U,k)}for(j.push(k);A!=null;)H.push(A),j.push(A),A=A.nextSibling;for(;H.length>0;)k.parentElement.insertBefore(H.pop(),k.nextSibling);return j}function G(T,k,A){let H;H=T.firstChild;let j=H,U=0;for(;H;){let ee=K(H,k,A);ee>U&&(j=H,U=ee),H=H.nextSibling}return j}function K(T,k,A){return F(T,k)?.5+le(A,T,k):0}function Q(T,k){re(k,T),k.callbacks.beforeNodeRemoved(T)!==!1&&(T.remove(),k.callbacks.afterNodeRemoved(T))}function ne(T,k){return!T.deadIds.has(k)}function Y(T,k,A){return(T.idMap.get(A)||i).has(k)}function re(T,k){let A=T.idMap.get(k)||i;for(let H of A)T.deadIds.add(H)}function le(T,k,A){let H=T.idMap.get(k)||i,j=0;for(let U of H)ne(T,U)&&Y(T,U,A)&&++j;return j}function ke(T,k){let A=T.parentElement,H=T.querySelectorAll("[id]");for(let j of H){let U=j;for(;U!==A&&U!=null;){let ee=k.get(U);ee==null&&(ee=new Set,k.set(U,ee)),ee.add(j.id),U=U.parentElement}}}function We(T,k){let A=new Map;return ke(T,A),ke(k,A),A}return{morph:t,defaults:e}}();function Ac(i,e,{callbacks:t,...r}={}){Vb.morph(i,e,{...r,callbacks:new Kl(t)})}function ip(i,e){Ac(i,e.children,{morphStyle:"innerHTML"})}var Kl=class{#e;constructor({beforeNodeMorphed:e}={}){this.#e=e||(()=>!0)}beforeNodeAdded=e=>!(e.id&&e.hasAttribute("data-turbo-permanent")&&document.getElementById(e.id));beforeNodeMorphed=(e,t)=>{if(e instanceof Element)return!e.hasAttribute("data-turbo-permanent")&&this.#e(e,t)?!_e("turbo:before-morph-element",{cancelable:!0,target:e,detail:{currentElement:e,newElement:t}}).defaultPrevented:!1};beforeAttributeUpdated=(e,t,r)=>!_e("turbo:before-morph-attribute",{cancelable:!0,target:t,detail:{attributeName:e,mutationType:r}}).defaultPrevented;beforeNodeRemoved=e=>this.beforeNodeMorphed(e);afterNodeMorphed=(e,t)=>{e instanceof Element&&_e("turbo:morph-element",{target:e,detail:{currentElement:e,newElement:t}})}},Xl=class extends cn{static renderElement(e,t){_e("turbo:before-frame-morph",{target:e,detail:{currentElement:e,newElement:t}}),ip(e,t)}async preservingPermanentElements(e){return await e()}},Yl=class i{static animationDuration=300;static get defaultCSS(){return Vd`
|
|
5
5
|
.turbo-progress-bar {
|
|
6
6
|
position: fixed;
|
|
7
7
|
display: block;
|
|
@@ -15,7 +15,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
15
15
|
opacity ${i.animationDuration/2}ms ${i.animationDuration/2}ms ease-in;
|
|
16
16
|
transform: translate3d(0, 0, 0);
|
|
17
17
|
}
|
|
18
|
-
`}hiding=!1;value=0;visible=!1;constructor(){this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement(()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1}))}setValue(e){this.value=e,this.refresh()}installStylesheetElement(){document.head.insertBefore(this.stylesheetElement,document.head.firstChild)}installProgressElement(){this.progressElement.style.width="0",this.progressElement.style.opacity="1",document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()}fadeProgressElement(e){this.progressElement.style.opacity="0",setTimeout(e,i.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,i.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}trickle=()=>{this.setValue(this.value+Math.random()/100)};refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let e=document.createElement("style");e.type="text/css",e.textContent=i.defaultCSS;let t=Jd();return t&&(e.nonce=t),e}createProgressElement(){let e=document.createElement("div");return e.className="turbo-progress-bar",e}},tc=class extends As{detailsByOuterHTML=this.children.filter(e=>!py(e)).map(e=>gy(e)).reduce((e,t)=>{let{outerHTML:r}=t,s=r in e?e[r]:{type:uy(t),tracked:hy(t),elements:[]};return{...e,[r]:{...s,elements:[...s.elements,t]}}},{});get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(e=>this.detailsByOuterHTML[e].tracked).join("")}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("script",e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",e)}getElementsMatchingTypeNotInSnapshot(e,t){return Object.keys(this.detailsByOuterHTML).filter(r=>!(r in t.detailsByOuterHTML)).map(r=>this.detailsByOuterHTML[r]).filter(({type:r})=>r==e).map(({elements:[r]})=>r)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{let{type:r,tracked:s,elements:n}=this.detailsByOuterHTML[t];return r==null&&!s?[...e,...n]:n.length>1?[...e,...n.slice(1)]:e},[])}getMetaValue(e){let t=this.findMetaElementByName(e);return t?t.getAttribute("content"):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce((t,r)=>{let{elements:[s]}=this.detailsByOuterHTML[r];return my(s,e)?s:t},void 0|void 0)}};function uy(i){if(dy(i))return"script";if(fy(i))return"stylesheet"}function hy(i){return i.getAttribute("data-turbo-track")=="reload"}function dy(i){return i.localName=="script"}function py(i){return i.localName=="noscript"}function fy(i){let e=i.localName;return e=="style"||e=="link"&&i.getAttribute("rel")=="stylesheet"}function my(i,e){return i.localName=="meta"&&i.getAttribute("name")==e}function gy(i){return i.hasAttribute("nonce")&&i.setAttribute("nonce",""),i}var ni=class i extends As{static fromHTMLString(e=""){return this.fromDocument(Yd(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({documentElement:e,body:t,head:r}){return new this(e,t,new tc(r))}constructor(e,t,r){super(t),this.documentElement=e,this.headSnapshot=r}clone(){let e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),r=e.querySelectorAll("select");for(let[s,n]of t.entries()){let o=r[s];for(let a of o.selectedOptions)a.selected=!1;for(let a of n.selectedOptions)o.options[a.index].selected=!0}for(let s of e.querySelectorAll('input[type="password"]'))s.value="";return new i(this.documentElement,e,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get headElement(){return this.headSnapshot.element}get rootLocation(){let e=this.getSetting("root")??"/";return Ke(e)}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}get prefersViewTransitions(){return this.headSnapshot.getMetaValue("view-transition")==="same-origin"}get shouldMorphPage(){return this.getSetting("refresh-method")==="morph"}get shouldPreserveScrollPosition(){return this.getSetting("refresh-scroll")==="preserve"}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}},ic=class{#e=!1;#t=Promise.resolve();renderChange(e,t){return e&&this.viewTransitionsAvailable&&!this.#e?(this.#e=!0,this.#t=this.#t.then(async()=>{await document.startViewTransition(t).finished})):this.#t=this.#t.then(t),this.#t}get viewTransitionsAvailable(){return document.startViewTransition}},vy={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1},$o={visitStart:"visitStart",requestStart:"requestStart",requestEnd:"requestEnd",visitEnd:"visitEnd"},Ii={initialized:"initialized",started:"started",canceled:"canceled",failed:"failed",completed:"completed"},ks={networkFailure:0,timeoutFailure:-1,contentTypeMismatch:-2},by={advance:"forward",restore:"back",replace:"none"},rc=class{identifier=dr();timingMetrics={};followedRedirect=!1;historyChanged=!1;scrolled=!1;shouldCacheSnapshot=!0;acceptsStreamResponse=!1;snapshotCached=!1;state=Ii.initialized;viewTransitioner=new ic;constructor(e,t,r,s={}){this.delegate=e,this.location=t,this.restorationIdentifier=r||dr();let{action:n,historyChanged:o,referrer:a,snapshot:l,snapshotHTML:c,response:d,visitCachedSnapshot:f,willRender:g,updateHistory:b,shouldCacheSnapshot:w,acceptsStreamResponse:P,direction:R}={...vy,...s};this.action=n,this.historyChanged=o,this.referrer=a,this.snapshot=l,this.snapshotHTML=c,this.response=d,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=f,this.willRender=g,this.updateHistory=b,this.scrolled=!g,this.shouldCacheSnapshot=w,this.acceptsStreamResponse=P,this.direction=R||by[n]}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}get restorationData(){return this.history.getRestorationDataForIdentifier(this.restorationIdentifier)}get silent(){return this.isSamePage}start(){this.state==Ii.initialized&&(this.recordTimingMetric($o.visitStart),this.state=Ii.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==Ii.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=Ii.canceled)}complete(){this.state==Ii.started&&(this.recordTimingMetric($o.visitEnd),this.adapter.visitCompleted(this),this.state=Ii.completed,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==Ii.started&&(this.state=Ii.failed,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){if(!this.historyChanged&&this.updateHistory){let e=this.location.href===this.referrer?.href?"replace":this.action,t=Qd(e);this.history.update(t,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new Mr(this,Vt.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric($o.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:t}=e;$d(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric($o.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{if(this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,$d(e)&&t!=null){let r=ni.fromHTMLString(t);await this.renderPageSnapshot(r,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(ni.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){let e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!Lr(this.location)||e.hasAnchor(Lr(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return ni.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let e=this.getCachedSnapshot();if(e){let t=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isSamePage||this.isPageRefresh?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.renderPageSnapshot(e,t),this.adapter.visitRendered(this),t||this.complete())})}}followRedirect(){this.redirectedToLocation&&!this.followedRedirect&&this.response?.redirected&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response,shouldCacheSnapshot:!1,willRender:!1}),this.followedRedirect=!0)}goToSamePageAnchor(){this.isSamePage&&this.render(async()=>{this.cacheSnapshot(),this.performScroll(),this.changeHistory(),this.adapter.visitRendered(this)})}prepareRequest(e){this.acceptsStreamResponse&&e.acceptResponseType(pr.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){let r=await t.responseHTML,{redirected:s,statusCode:n}=t;r==null?this.recordResponse({statusCode:ks.contentTypeMismatch,redirected:s}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:n,responseHTML:r,redirected:s}))}async requestFailedWithResponse(e,t){let r=await t.responseHTML,{redirected:s,statusCode:n}=t;r==null?this.recordResponse({statusCode:ks.contentTypeMismatch,redirected:s}):this.recordResponse({statusCode:n,responseHTML:r,redirected:s})}requestErrored(e,t){this.recordResponse({statusCode:ks.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&!this.view.shouldPreserveScrollPosition(this)&&(this.action=="restore"?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.isSamePage&&this.delegate.visitScrolledToSamePageLocation(this.view.lastRenderedLocation,this.location),this.scrolled=!0)}scrollToRestoredPosition(){let{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){let e=Lr(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return{...this.timingMetrics}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.isSamePage?!1:this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),await new Promise(t=>{this.frame=document.visibilityState==="hidden"?setTimeout(()=>t(),0):requestAnimationFrame(()=>t())}),await e(),delete this.frame}async renderPageSnapshot(e,t){await this.viewTransitioner.renderChange(this.view.shouldTransitionTo(e),async()=>{await this.view.renderPage(e,t,this.willRender,this),this.performScroll()})}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function $d(i){return i>=200&&i<300}var sc=class{progressBar=new ec;constructor(e){this.session=e}visitProposedToLocation(e,t){hr(e,this.navigator.rootLocation)?this.navigator.startVisit(e,t?.restorationIdentifier||dr(),t):window.location.href=e.toString()}visitStarted(e){this.location=e.location,e.loadCachedSnapshot(),e.issueRequest(),e.goToSamePageAnchor()}visitRequestStarted(e){this.progressBar.setValue(0),e.hasCachedSnapshot()||e.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(e){e.loadResponse()}visitRequestFailedWithStatusCode(e,t){switch(t){case ks.networkFailure:case ks.timeoutFailure:case ks.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){}visitCompleted(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}pageInvalidated(e){this.reload(e)}visitFailed(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitRendered(e){}linkPrefetchingIsEnabledForLocation(e){return!0}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}showProgressBar=()=>{this.progressBar.show()};reload(e){xe("turbo:reload",{detail:e}),window.location.href=this.location?.toString()||window.location.href}get navigator(){return this.session.navigator}},nc=class{selector="[data-turbo-temporary]";deprecatedSelector="[data-turbo-cache=false]";started=!1;start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}removeTemporaryElements=e=>{for(let t of this.temporaryElements)t.remove()};get temporaryElements(){return[...document.querySelectorAll(this.selector),...this.temporaryElementsWithDeprecation]}get temporaryElementsWithDeprecation(){let e=document.querySelectorAll(this.deprecatedSelector);return e.length&&console.warn(`The ${this.deprecatedSelector} selector is deprecated and will be removed in a future version. Use ${this.selector} instead.`),[...e]}},oc=class{constructor(e,t){this.session=e,this.element=t,this.linkInterceptor=new Xo(this,t),this.formSubmitObserver=new nn(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,r){return this.#t(e)}linkClickIntercepted(e,t,r){let s=this.#i(e);s&&s.delegate.linkClickIntercepted(e,t,r)}willSubmitForm(e,t){return e.closest("turbo-frame")==null&&this.#e(e,t)&&this.#t(e,t)}formSubmitted(e,t){let r=this.#i(e,t);r&&r.delegate.formSubmitted(e,t)}#e(e,t){let r=_c(e,t),s=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),n=Ke(s?.content??"/");return this.#t(e,t)&&hr(r,n)}#t(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){let s=this.#i(e,t);return s?s!=e.closest("turbo-frame"):!1}else return!1}#i(e,t){let r=t?.getAttribute("data-turbo-frame")||e.getAttribute("data-turbo-frame");if(r&&r!="_top"){let s=this.element.querySelector(`#${r}:not([disabled])`);if(s instanceof oi)return s}}},ac=class{location;restorationIdentifier=dr();restorationData={};started=!1;pageLoaded=!1;currentIndex=0;constructor(e){this.delegate=e}start(){this.started||(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.currentIndex=history.state?.turbo?.restorationIndex||0,this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),removeEventListener("load",this.onPageLoad,!1),this.started=!1)}push(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,r=dr()){e===history.pushState&&++this.currentIndex;let s={turbo:{restorationIdentifier:r,restorationIndex:this.currentIndex}};e.call(history,s,"",t.href),this.location=t,this.restorationIdentifier=r}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){let{restorationIdentifier:t}=this,r=this.restorationData[t];this.restorationData[t]={...r,...e}}assumeControlOfScrollRestoration(){this.previousScrollRestoration||(this.previousScrollRestoration=history.scrollRestoration??"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}onPopState=e=>{if(this.shouldHandlePopState()){let{turbo:t}=e.state||{};if(t){this.location=new URL(window.location.href);let{restorationIdentifier:r,restorationIndex:s}=t;this.restorationIdentifier=r;let n=s>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,r,n),this.currentIndex=s}}};onPageLoad=async e=>{await Cb(),this.pageLoaded=!0};shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||document.readyState=="complete"}},lc=class{started=!1;#e=null;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.readyState==="loading"?this.eventTarget.addEventListener("DOMContentLoaded",this.#t,{once:!0}):this.#t())}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",this.#i,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",this.#n,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",this.#a,!0),this.started=!1)}#t=()=>{this.eventTarget.addEventListener("mouseenter",this.#i,{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",this.#n,{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",this.#a,!0),this.started=!0};#i=e=>{if(Wo("turbo-prefetch")==="false")return;let t=e.target;if(t.matches&&t.matches("a[href]:not([target^=_]):not([download])")&&this.#u(t)){let s=t,n=rp(s);if(this.delegate.canPrefetchRequestToLocation(s,n)){this.#e=s;let o=new Mr(this,Vt.get,n,new URLSearchParams,t);Ts.setLater(n.toString(),o,this.#r)}}};#n=e=>{e.target===this.#e&&this.#o()};#o=()=>{Ts.clear(),this.#e=null};#a=e=>{if(e.target.tagName!=="FORM"&&e.detail.fetchOptions.method==="GET"){let t=Ts.get(e.detail.url.toString());t&&(e.detail.fetchRequest=t),Ts.clear()}};prepareRequest(e){let t=e.target;e.headers["X-Sec-Purpose"]="prefetch";let r=t.closest("turbo-frame"),s=t.getAttribute("data-turbo-frame")||r?.getAttribute("target")||r?.id;s&&s!=="_top"&&(e.headers["Turbo-Frame"]=s)}requestSucceededWithResponse(){}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}get#r(){return Number(Wo("turbo-prefetch-cache-time"))||Yb}#u(e){return!(!e.getAttribute("href")||yy(e)||wy(e)||Sy(e)||Ey(e)||xy(e))}},yy=i=>i.origin!==document.location.origin||!["http:","https:"].includes(i.protocol)||i.hasAttribute("target"),wy=i=>i.pathname+i.search===document.location.pathname+document.location.search||i.href.startsWith("#"),Sy=i=>{if(i.getAttribute("data-turbo-prefetch")==="false"||i.getAttribute("data-turbo")==="false")return!0;let e=xs(i,"[data-turbo-prefetch]");return!!(e&&e.getAttribute("data-turbo-prefetch")==="false")},Ey=i=>{let e=i.getAttribute("data-turbo-method");return!!(e&&e.toLowerCase()!=="get"||Ty(i)||i.hasAttribute("data-turbo-confirm")||i.hasAttribute("data-turbo-stream"))},Ty=i=>i.hasAttribute("data-remote")||i.hasAttribute("data-behavior")||i.hasAttribute("data-confirm")||i.hasAttribute("data-method"),xy=i=>xe("turbo:before-prefetch",{target:i,cancelable:!0}).defaultPrevented,cc=class{constructor(e){this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&this.delegate.visitProposedToLocation(e,t)}startVisit(e,t,r={}){this.stop(),this.currentVisit=new rc(this,Ke(e),t,{referrer:this.location,...r}),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new Go(this,e,t,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get rootLocation(){return this.view.snapshot.rootLocation}get history(){return this.delegate.history}formSubmissionStarted(e){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,t){if(e==this.formSubmission){let r=await t.responseHTML;if(r){let s=e.isSafe;s||this.view.clearSnapshotCache();let{statusCode:n,redirected:o}=t,l={action:this.#e(e,t),shouldCacheSnapshot:s,response:{statusCode:n,responseHTML:r,redirected:o}};this.proposeVisit(t.location,l)}}}async formSubmissionFailedWithResponse(e,t){let r=await t.responseHTML;if(r){let s=ni.fromHTMLString(r);t.serverError?await this.view.renderError(s,this.currentVisit):await this.view.renderPage(s,!1,!0,this.currentVisit),s.shouldPreserveScrollPosition||this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}linkPrefetchingIsEnabledForLocation(e){return typeof this.adapter.linkPrefetchingIsEnabledForLocation=="function"?this.adapter.linkPrefetchingIsEnabledForLocation(e):!0}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e),delete this.currentVisit}locationWithActionIsSamePage(e,t){let r=Lr(e),s=Lr(this.view.lastRenderedLocation),n=t==="restore"&&typeof r>"u";return t!=="replace"&&Gl(e)===Gl(this.view.lastRenderedLocation)&&(n||r!=null&&r!==s)}visitScrolledToSamePageLocation(e,t){this.delegate.visitScrolledToSamePageLocation(e,t)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}#e(e,t){let{submitter:r,formElement:s}=e;return Rr(r,s)||this.#t(t)}#t(e){return e.redirected&&e.location.href===this.location?.href?"replace":"advance"}},Fr={initial:0,loading:1,interactive:2,complete:3},uc=class{stage=Fr.initial;started=!1;constructor(e){this.delegate=e}start(){this.started||(this.stage==Fr.initial&&(this.stage=Fr.loading),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}interpretReadyState=()=>{let{readyState:e}=this;e=="interactive"?this.pageIsInteractive():e=="complete"&&this.pageIsComplete()};pageIsInteractive(){this.stage==Fr.loading&&(this.stage=Fr.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==Fr.interactive&&(this.stage=Fr.complete,this.delegate.pageLoaded())}pageWillUnload=()=>{this.delegate.pageWillUnload()};get readyState(){return document.readyState}},hc=class{started=!1;constructor(e){this.delegate=e}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})};updatePosition(e){this.delegate.scrollPositionChanged(e)}},dc=class{render({fragment:e}){Qo.preservingPermanentElements(this,ky(e),()=>{Ay(e,()=>{_y(()=>{document.documentElement.appendChild(e)})})})}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}};function ky(i){let e=lp(document.documentElement),t={};for(let r of e){let{id:s}=r;for(let n of i.querySelectorAll("turbo-stream")){let o=ap(n.templateElement.content,s);o&&(t[s]=[r,o])}}return t}async function Ay(i,e){let t=`turbo-stream-autofocus-${dr()}`,r=i.querySelectorAll("turbo-stream"),s=Cy(r),n=null;if(s&&(s.id?n=s.id:n=t,s.id=n),e(),await tn(),(document.activeElement==null||document.activeElement==document.body)&&n){let a=document.getElementById(n);Ac(a)&&a.focus(),a&&a.id==t&&a.removeAttribute("id")}}async function _y(i){let[e,t]=await Mb(i,()=>document.activeElement),r=e&&e.id;if(r){let s=document.getElementById(r);Ac(s)&&s!=t&&s.focus()}}function Cy(i){for(let e of i){let t=ep(e.templateElement.content);if(t)return t}return null}var pc=class{sources=new Set;#e=!1;constructor(e){this.delegate=e}start(){this.#e||(this.#e=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.#e&&(this.#e=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(e){this.streamSourceIsConnected(e)||(this.sources.add(e),e.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(e){this.streamSourceIsConnected(e)&&(this.sources.delete(e),e.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(e){return this.sources.has(e)}inspectFetchResponse=e=>{let t=Py(e);t&&Fy(t)&&(e.preventDefault(),this.receiveMessageResponse(t))};receiveMessageEvent=e=>{this.#e&&typeof e.data=="string"&&this.receiveMessageHTML(e.data)};async receiveMessageResponse(e){let t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(pr.wrap(e))}};function Py(i){let e=i.detail?.fetchResponse;if(e instanceof sn)return e}function Fy(i){return(i.contentType??"").startsWith(pr.contentType)}var fc=class extends on{static renderElement(e,t){let{documentElement:r,body:s}=document;r.replaceChild(t,s)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:e,head:t}=document;e.replaceChild(this.newHead,t),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(let e of this.scriptElements){let t=e.parentNode;if(t){let r=rn(e);t.replaceChild(r,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}},ln=class extends on{static renderElement(e,t){document.body&&t instanceof HTMLBodyElement?document.body.replaceWith(t):document.documentElement.appendChild(t)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:"turbo_visit_control_is_reload"};if(!this.trackedElementsAreIdentical)return{reason:"tracked_element_mismatch"}}async prepareToRender(){this.#e(),await this.mergeHead()}async render(){this.willRender&&await this.replaceBody()}finishRendering(){super.finishRendering(),this.isPreview||this.focusFirstAutofocusableElement()}get currentHeadSnapshot(){return this.currentSnapshot.headSnapshot}get newHeadSnapshot(){return this.newSnapshot.headSnapshot}get newElement(){return this.newSnapshot.element}#e(){let{documentElement:e}=this.currentSnapshot,{lang:t}=this.newSnapshot;t?e.setAttribute("lang",t):e.removeAttribute("lang")}async mergeHead(){let e=this.mergeProvisionalElements(),t=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await e,await t,this.willRender&&this.removeUnusedDynamicStylesheetElements()}async replaceBody(){await this.preservingPermanentElements(async()=>{this.activateNewBody(),await this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){let e=[];for(let t of this.newHeadStylesheetElements)e.push(Ob(t)),document.head.appendChild(t);await Promise.all(e)}copyNewHeadScriptElements(){for(let e of this.newHeadScriptElements)document.head.appendChild(rn(e))}removeUnusedDynamicStylesheetElements(){for(let e of this.unusedDynamicStylesheetElements)document.head.removeChild(e)}async mergeProvisionalElements(){let e=[...this.newHeadProvisionalElements];for(let t of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(t,e)||document.head.removeChild(t);for(let t of e)document.head.appendChild(t)}isCurrentElementInElementList(e,t){for(let[r,s]of t.entries()){if(e.tagName=="TITLE"){if(s.tagName!="TITLE")continue;if(e.innerHTML==s.innerHTML)return t.splice(r,1),!0}if(s.isEqualNode(e))return t.splice(r,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(let e of this.currentHeadProvisionalElements)document.head.removeChild(e)}copyNewHeadProvisionalElements(){for(let e of this.newHeadProvisionalElements)document.head.appendChild(e)}activateNewBody(){document.adoptNode(this.newElement),this.activateNewBodyScriptElements()}activateNewBodyScriptElements(){for(let e of this.newBodyScriptElements){let t=rn(e);e.replaceWith(t)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get unusedDynamicStylesheetElements(){return this.oldHeadStylesheetElements.filter(e=>e.getAttribute("data-turbo-track")==="dynamic")}get oldHeadStylesheetElements(){return this.currentHeadSnapshot.getStylesheetElementsNotInSnapshot(this.newHeadSnapshot)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}},mc=class extends ln{static renderElement(e,t){Fc(e,t,{callbacks:{beforeNodeMorphed:r=>!qd(r)}});for(let r of e.querySelectorAll("turbo-frame"))qd(r)&&r.reload();xe("turbo:morph",{detail:{currentElement:e,newElement:t}})}async preservingPermanentElements(e){return await e()}get renderMethod(){return"morph"}get shouldAutofocus(){return!1}};function qd(i){return i instanceof oi&&i.src&&i.refresh==="morph"&&!i.closest("[data-turbo-permanent]")}var gc=class{keys=[];snapshots={};constructor(e){this.size=e}has(e){return Ho(e)in this.snapshots}get(e){if(this.has(e)){let t=this.read(e);return this.touch(e),t}}put(e,t){return this.write(e,t),this.touch(e),t}clear(){this.snapshots={}}read(e){return this.snapshots[Ho(e)]}write(e,t){this.snapshots[Ho(e)]=t}touch(e){let t=Ho(e),r=this.keys.indexOf(t);r>-1&&this.keys.splice(r,1),this.keys.unshift(t),this.trim()}trim(){for(let e of this.keys.splice(this.size))delete this.snapshots[e]}},vc=class extends Ko{snapshotCache=new gc(10);lastRenderedLocation=new URL(location.href);forceReloaded=!1;shouldTransitionTo(e){return this.snapshot.prefersViewTransitions&&e.prefersViewTransitions}renderPage(e,t=!1,r=!0,s){let o=this.isPageRefresh(s)&&this.snapshot.shouldMorphPage?mc:ln,a=new o(this.snapshot,e,t,r);return a.shouldRender?s?.changeHistory():this.forceReloaded=!0,this.render(a)}renderError(e,t){t?.changeHistory();let r=new fc(this.snapshot,e,!1);return this.render(r)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(e=this.snapshot){if(e.isCacheable){this.delegate.viewWillCacheSnapshot();let{lastRenderedLocation:t}=this;await Xd();let r=e.clone();return this.snapshotCache.put(t,r),r}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}isPageRefresh(e){return!e||this.lastRenderedLocation.pathname===e.location.pathname&&e.action==="replace"}shouldPreserveScrollPosition(e){return this.isPageRefresh(e)&&this.snapshot.shouldPreserveScrollPosition}get snapshot(){return ni.fromElement(this.element)}},bc=class{selector="a[data-turbo-preload]";constructor(e,t){this.delegate=e,this.snapshotCache=t}start(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",this.#e):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",this.#e)}preloadOnLoadLinksForView(e){for(let t of e.querySelectorAll(this.selector))this.delegate.shouldPreloadLink(t)&&this.preloadURL(t)}async preloadURL(e){let t=new URL(e.href);if(this.snapshotCache.has(t))return;await new Mr(this,Vt.get,t,new URLSearchParams,e).perform()}prepareRequest(e){e.headers["X-Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(e,t){try{let r=await t.responseHTML,s=ni.fromHTMLString(r);this.snapshotCache.put(e.url,s)}catch{}}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}#e=()=>{this.preloadOnLoadLinksForView(document.body)}},yc=class{constructor(e){this.session=e}clear(){this.session.clearCache()}resetCacheControl(){this.#e("")}exemptPageFromCache(){this.#e("no-cache")}exemptPageFromPreview(){this.#e("no-preview")}#e(e){Lb("turbo-cache-control",e)}},wc=class{navigator=new cc(this);history=new ac(this);view=new vc(this,document.documentElement);adapter=new sc(this);pageObserver=new uc(this);cacheObserver=new nc;linkPrefetchObserver=new lc(this,document);linkClickObserver=new Yo(this,window);formSubmitObserver=new nn(this,document);scrollObserver=new hc(this);streamObserver=new pc(this);formLinkClickObserver=new Zo(this,document.documentElement);frameRedirector=new oc(this,document.documentElement);streamMessageRenderer=new dc;cache=new yc(this);enabled=!0;started=!1;#e=150;constructor(e){this.recentRequests=e,this.preloader=new bc(this,this.view.snapshotCache),this.debouncedRefresh=this.refresh,this.pageRefreshDebouncePeriod=this.pageRefreshDebouncePeriod}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.linkPrefetchObserver.start(),this.formLinkClickObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.preloader.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.linkPrefetchObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.preloader.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,t={}){let r=t.frame?document.getElementById(t.frame):null;if(r instanceof oi){let s=t.action||Rr(r);r.delegate.proposeVisitIfNavigatedWithAction(r,s),r.src=e.toString()}else this.navigator.proposeVisit(Ke(e),t)}refresh(e,t){let r=t&&this.recentRequests.has(t),s=e===document.baseURI;!r&&!this.navigator.currentVisit&&s&&this.visit(e,{action:"replace",shouldCacheSnapshot:!1})}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(pr.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){console.warn("Please replace `session.setProgressBarDelay(delay)` with `session.progressBarDelay = delay`. The function is deprecated and will be removed in a future version of Turbo.`"),this.progressBarDelay=e}set progressBarDelay(e){Ge.drive.progressBarDelay=e}get progressBarDelay(){return Ge.drive.progressBarDelay}set drive(e){Ge.drive.enabled=e}get drive(){return Ge.drive.enabled}set formMode(e){Ge.forms.mode=e}get formMode(){return Ge.forms.mode}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return this.#e}set pageRefreshDebouncePeriod(e){this.refresh=Ib(this.debouncedRefresh.bind(this),e),this.#e=e}shouldPreloadLink(e){let t=e.hasAttribute("data-turbo-method"),r=e.hasAttribute("data-turbo-stream"),s=e.getAttribute("data-turbo-frame"),n=s=="_top"?null:document.getElementById(s)||xs(e,"turbo-frame:not([disabled])");if(t||r||n instanceof oi)return!1;{let o=new URL(e.href);return this.elementIsNavigatable(e)&&hr(o,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(e,t,r){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0,direction:r}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&hr(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(e,t){return this.elementIsNavigatable(e)&&hr(t,this.snapshot.rootLocation)&&this.navigator.linkPrefetchingIsEnabledForLocation(t)}willFollowLinkToLocation(e,t,r){return this.elementIsNavigatable(e)&&hr(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t,r)}followedLinkToLocation(e,t){let r=this.getActionForLink(e),s=e.hasAttribute("data-turbo-stream");this.visit(t.href,{action:r,acceptsStreamResponse:s})}allowsVisitingLocationWithAction(e,t){return this.locationWithActionIsSamePage(e,t)||this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){Vd(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||(Vo(document.documentElement),this.view.markVisitDirection(e.direction)),Vd(e.location),e.silent||this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.view.unmarkVisitDirection(),jo(document.documentElement),this.notifyApplicationAfterPageLoad(e.getTimingMetrics())}locationWithActionIsSamePage(e,t){return this.navigator.locationWithActionIsSamePage(e,t)}visitScrolledToSamePageLocation(e,t){this.notifyApplicationAfterVisitingSamePageLocation(e,t)}willSubmitForm(e,t){let r=_c(e,t);return this.submissionIsNavigatable(e,t)&&hr(Ke(r),this.snapshot.rootLocation)}formSubmitted(e,t){this.navigator.submitForm(e,t)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){this.navigator.currentVisit?.silent||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){let r=this.notifyApplicationBeforeRender(e,t),{defaultPrevented:s,detail:{render:n}}=r;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(e,t,r){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(r)}preloadOnLoadLinksForView(e){this.preloader.preloadOnLoadLinksForView(e)}viewInvalidated(e){this.adapter.pageInvalidated(e)}frameLoaded(e){this.notifyApplicationAfterFrameLoad(e)}frameRendered(e,t){this.notifyApplicationAfterFrameRender(e,t)}applicationAllowsFollowingLinkToLocation(e,t,r){return!this.notifyApplicationAfterClickingLinkToLocation(e,t,r).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t,r){return xe("turbo:click",{target:e,detail:{url:t.href,originalEvent:r},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return xe("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return xe("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return xe("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return xe("turbo:before-render",{detail:{newBody:e,...t},cancelable:!0})}notifyApplicationAfterRender(e){return xe("turbo:render",{detail:{renderMethod:e}})}notifyApplicationAfterPageLoad(e={}){return xe("turbo:load",{detail:{url:this.location.href,timing:e}})}notifyApplicationAfterVisitingSamePageLocation(e,t){dispatchEvent(new HashChangeEvent("hashchange",{oldURL:e.toString(),newURL:t.toString()}))}notifyApplicationAfterFrameLoad(e){return xe("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return xe("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if(Ge.forms.mode=="off")return!1;{let r=t?this.elementIsNavigatable(t):!0;return Ge.forms.mode=="optin"?r&&e.closest('[data-turbo="true"]')!=null:r&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){let t=xs(e,"[data-turbo]"),r=xs(e,"turbo-frame");return Ge.drive.enabled||r?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return Rr(e)||"advance"}get snapshot(){return this.view.snapshot}};function Vd(i){Object.defineProperties(i,Oy)}var Oy={absoluteURL:{get(){return this.toString()}}},Oe=new wc(sp),{cache:Ry,navigator:Ly}=Oe;function up(){Oe.start()}function My(i){Oe.registerAdapter(i)}function Iy(i,e){Oe.visit(i,e)}function hp(i){Oe.connectStreamSource(i)}function dp(i){Oe.disconnectStreamSource(i)}function Dy(i){Oe.renderStreamMessage(i)}function Ny(){console.warn("Please replace `Turbo.clearCache()` with `Turbo.cache.clear()`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),Oe.clearCache()}function By(i){console.warn("Please replace `Turbo.setProgressBarDelay(delay)` with `Turbo.config.drive.progressBarDelay = delay`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),Ge.drive.progressBarDelay=i}function Uy(i){console.warn("Please replace `Turbo.setConfirmMethod(confirmMethod)` with `Turbo.config.forms.confirm = confirmMethod`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),Ge.forms.confirm=i}function zy(i){console.warn("Please replace `Turbo.setFormMode(mode)` with `Turbo.config.forms.mode = mode`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),Ge.forms.mode=i}var Hy=Object.freeze({__proto__:null,navigator:Ly,session:Oe,cache:Ry,PageRenderer:ln,PageSnapshot:ni,FrameRenderer:an,fetch:np,config:Ge,start:up,registerAdapter:My,visit:Iy,connectStreamSource:hp,disconnectStreamSource:dp,renderStreamMessage:Dy,clearCache:Ny,setProgressBarDelay:By,setConfirmMethod:Uy,setFormMode:zy}),Sc=class extends Error{},Ec=class{fetchResponseLoaded=e=>Promise.resolve();#e=null;#t=()=>{};#i=!1;#n=!1;#o=new Set;#a=!1;action=null;constructor(e){this.element=e,this.view=new Zl(this,this.element),this.appearanceObserver=new Xl(this,this.element),this.formLinkClickObserver=new Zo(this,this.element),this.linkInterceptor=new Xo(this,this.element),this.restorationIdentifier=dr(),this.formSubmitObserver=new nn(this,this.element)}connect(){this.#i||(this.#i=!0,this.loadingStyle==Es.lazy?this.appearanceObserver.start():this.#r(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.#i&&(this.#i=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop())}disabledChanged(){this.loadingStyle==Es.eager&&this.#r()}sourceURLChanged(){this.#y("src")||(this.element.isConnected&&(this.complete=!1),(this.loadingStyle==Es.eager||this.#n)&&this.#r())}sourceURLReloaded(){let{refresh:e,src:t}=this.element;return this.#a=t&&e==="morph",this.element.removeAttribute("complete"),this.element.src=null,this.element.src=t,this.element.loaded}loadingStyleChanged(){this.loadingStyle==Es.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.#r())}async#r(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.#s(Ke(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.#n=!0)}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{let t=await e.responseHTML;if(t){let r=Yd(t);ni.fromDocument(r).isVisitable?await this.#u(e,r):await this.#l(e)}}finally{this.#a=!1,this.fetchResponseLoaded=()=>Promise.resolve()}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,Rr(e)),this.#r()}willSubmitFormLinkToLocation(e){return this.#f(e)}submittedFormLinkToLocation(e,t,r){let s=this.#d(e);s&&r.setAttribute("data-turbo-frame",s.id)}shouldInterceptLinkClick(e,t,r){return this.#f(e)}linkClickIntercepted(e,t){this.#p(e,t)}willSubmitForm(e,t){return e.closest("turbo-frame")==this.element&&this.#f(e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new Go(this,e,t);let{fetchRequest:r}=this.formSubmission;this.prepareRequest(r),this.formSubmission.start()}prepareRequest(e){e.headers["Turbo-Frame"]=this.id,this.currentNavigationElement?.hasAttribute("data-turbo-stream")&&e.acceptResponseType(pr.contentType)}requestStarted(e){Vo(this.element)}requestPreventedHandlingResponse(e,t){this.#t()}async requestSucceededWithResponse(e,t){await this.loadResponse(t),this.#t()}async requestFailedWithResponse(e,t){await this.loadResponse(t),this.#t()}requestErrored(e,t){console.error(t),this.#t()}requestFinished(e){jo(this.element)}formSubmissionStarted({formElement:e}){Vo(e,this.#d(e))}formSubmissionSucceededWithResponse(e,t){let r=this.#d(e.formElement,e.submitter);r.delegate.proposeVisitIfNavigatedWithAction(r,Rr(e.submitter,e.formElement,r)),r.delegate.loadResponse(t),e.isSafe||Oe.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),Oe.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){jo(e,this.#d(e))}allowsImmediateRender({element:e},t){let r=xe("turbo:before-frame-render",{target:this.element,detail:{newFrame:e,...t},cancelable:!0}),{defaultPrevented:s,detail:{render:n}}=r;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(e,t,r){}preloadOnLoadLinksForView(e){Oe.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}visitCachedSnapshot=({element:e})=>{let t=e.querySelector("#"+this.element.id);t&&this.previousFrameElement&&t.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement};async#u(e,t){let r=await this.extractForeignFrameElement(t.body),s=this.#a?Jl:an;if(r){let n=new As(r),o=new s(this,this.view.snapshot,n,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(o),this.complete=!0,Oe.frameRendered(e,this.element),Oe.frameLoaded(this.element),await this.fetchResponseLoaded(e)}else this.#h(e)&&this.#c(e)}async#s(e){let t=new Mr(this,Vt.get,e,new URLSearchParams,this.element);return this.#e?.cancel(),this.#e=t,new Promise(r=>{this.#t=()=>{this.#t=()=>{},this.#e=null,r()},t.perform()})}#p(e,t,r){let s=this.#d(e,r);s.delegate.proposeVisitIfNavigatedWithAction(s,Rr(r,e,s)),this.#m(e,()=>{s.src=t})}proposeVisitIfNavigatedWithAction(e,t=null){if(this.action=t,this.action){let r=ni.fromElement(e).clone(),{visitCachedSnapshot:s}=e.delegate;e.delegate.fetchResponseLoaded=async n=>{if(e.src){let{statusCode:o,redirected:a}=n,l=await n.responseHTML,d={response:{statusCode:o,redirected:a,responseHTML:l},visitCachedSnapshot:s,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:r};this.action&&(d.action=this.action),Oe.visit(e.src,d)}}}}changeHistory(){if(this.action){let e=Qd(this.action);Oe.history.update(e,Ke(this.element.src||""),this.restorationIdentifier)}}async#l(e){console.warn(`The response (${e.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`),await this.#v(e.response)}#h(e){this.element.setAttribute("complete","");let t=e.response,r=async(n,o)=>{n instanceof Response?this.#v(n):Oe.visit(n,o)};return!xe("turbo:frame-missing",{target:this.element,detail:{response:t,visit:r},cancelable:!0}).defaultPrevented}#c(e){this.view.missing(),this.#g(e)}#g(e){let t=`The response (${e.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new Sc(t)}async#v(e){let t=new sn(e),r=await t.responseHTML,{location:s,redirected:n,statusCode:o}=t;return Oe.visit(s,{response:{redirected:n,statusCode:o,responseHTML:r}})}#d(e,t){let r=qo("data-turbo-frame",t,e)||this.element.getAttribute("target");return jd(r)??this.element}async extractForeignFrameElement(e){let t,r=CSS.escape(this.id);try{if(t=Wd(e.querySelector(`turbo-frame#${r}`),this.sourceURL),t)return t;if(t=Wd(e.querySelector(`turbo-frame[src][recurse~=${r}]`),this.sourceURL),t)return await t.loaded,await this.extractForeignFrameElement(t)}catch(s){return console.error(s),new oi}return null}#b(e,t){let r=_c(e,t);return hr(Ke(r),this.rootLocation)}#f(e,t){let r=qo("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!this.#b(e,t)||!this.enabled||r=="_top")return!1;if(r){let s=jd(r);if(s)return!s.disabled}return!(!Oe.elementIsNavigatable(e)||t&&!Oe.elementIsNavigatable(t))}get id(){return this.element.id}get enabled(){return!this.element.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(e){this.#w("src",()=>{this.element.src=e??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.#t()!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")}get isActive(){return this.element.isActive&&this.#i}get rootLocation(){let t=this.element.ownerDocument.querySelector('meta[name="turbo-root"]')?.content??"/";return Ke(t)}#y(e){return this.#o.has(e)}#w(e,t){this.#o.add(e),t(),this.#o.delete(e)}#m(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement}};function jd(i){if(i!=null){let e=document.getElementById(i);if(e instanceof oi)return e}}function Wd(i,e){if(i){let t=i.getAttribute("src");if(t!=null&&e!=null&&zb(t,e))throw new Error(`Matching <turbo-frame id="${i.id}"> element has a source URL which references itself`);if(i.ownerDocument!==document&&(i=document.importNode(i,!0)),i instanceof oi)return i.connectedCallback(),i.disconnectedCallback(),i}}var pp={after(){this.targetElements.forEach(i=>i.parentElement?.insertBefore(this.templateContent,i.nextSibling))},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(i=>i.append(this.templateContent))},before(){this.targetElements.forEach(i=>i.parentElement?.insertBefore(this.templateContent,i))},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(i=>i.prepend(this.templateContent))},remove(){this.targetElements.forEach(i=>i.remove())},replace(){let i=this.getAttribute("method");this.targetElements.forEach(e=>{i==="morph"?Fc(e,this.templateContent):e.replaceWith(this.templateContent)})},update(){let i=this.getAttribute("method");this.targetElements.forEach(e=>{i==="morph"?cp(e,this.templateContent):(e.innerHTML="",e.append(this.templateContent))})},refresh(){Oe.refresh(this.baseURI,this.requestId)}},Tc=class i extends HTMLElement{static async renderElement(e){await e.performAction()}async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){return this.renderPromise??=(async()=>{let e=this.beforeRenderEvent;this.dispatchEvent(e)&&(await tn(),await e.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){let e=this.targetElements.flatMap(r=>[...r.children]).filter(r=>!!r.getAttribute("id")),t=[...this.templateContent?.children||[]].filter(r=>!!r.getAttribute("id")).map(r=>r.getAttribute("id"));return e.filter(r=>t.includes(r.getAttribute("id")))}get performAction(){if(this.action){let e=pp[this.action];if(e)return e;this.#e("unknown action")}this.#e("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.#e("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){let e=this.ownerDocument.createElement("template");return this.appendChild(e),e}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.#e("first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}get requestId(){return this.getAttribute("request-id")}#e(e){throw new Error(`${this.description}: ${e}`)}get description(){return(this.outerHTML.match(/<[^>]+>/)??[])[0]??"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0,detail:{newStream:this,render:i.renderElement}})}get targetElementsById(){let e=this.ownerDocument?.getElementById(this.target);return e!==null?[e]:[]}get targetElementsByQuery(){let e=this.ownerDocument?.querySelectorAll(this.targets);return e.length!==0?Array.prototype.slice.call(e):[]}},xc=class extends HTMLElement{streamSource=null;connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),hp(this.streamSource)}disconnectedCallback(){this.streamSource&&(this.streamSource.close(),dp(this.streamSource))}get src(){return this.getAttribute("src")||""}};oi.delegateConstructor=Ec;customElements.get("turbo-frame")===void 0&&customElements.define("turbo-frame",oi);customElements.get("turbo-stream")===void 0&&customElements.define("turbo-stream",Tc);customElements.get("turbo-stream-source")===void 0&&customElements.define("turbo-stream-source",xc);(()=>{let i=document.currentScript;if(i&&!i.hasAttribute("data-turbo-suppress-warning"))for(i=i.parentElement;i;){if(i==document.body)return console.warn(Zd`
|
|
18
|
+
`}hiding=!1;value=0;visible=!1;constructor(){this.stylesheetElement=this.createStylesheetElement(),this.progressElement=this.createProgressElement(),this.installStylesheetElement(),this.setValue(0)}show(){this.visible||(this.visible=!0,this.installProgressElement(),this.startTrickling())}hide(){this.visible&&!this.hiding&&(this.hiding=!0,this.fadeProgressElement(()=>{this.uninstallProgressElement(),this.stopTrickling(),this.visible=!1,this.hiding=!1}))}setValue(e){this.value=e,this.refresh()}installStylesheetElement(){document.head.insertBefore(this.stylesheetElement,document.head.firstChild)}installProgressElement(){this.progressElement.style.width="0",this.progressElement.style.opacity="1",document.documentElement.insertBefore(this.progressElement,document.body),this.refresh()}fadeProgressElement(e){this.progressElement.style.opacity="0",setTimeout(e,i.animationDuration*1.5)}uninstallProgressElement(){this.progressElement.parentNode&&document.documentElement.removeChild(this.progressElement)}startTrickling(){this.trickleInterval||(this.trickleInterval=window.setInterval(this.trickle,i.animationDuration))}stopTrickling(){window.clearInterval(this.trickleInterval),delete this.trickleInterval}trickle=()=>{this.setValue(this.value+Math.random()/100)};refresh(){requestAnimationFrame(()=>{this.progressElement.style.width=`${10+this.value*90}%`})}createStylesheetElement(){let e=document.createElement("style");e.type="text/css",e.textContent=i.defaultCSS;let t=Wd();return t&&(e.nonce=t),e}createProgressElement(){let e=document.createElement("div");return e.className="turbo-progress-bar",e}},Zl=class extends As{detailsByOuterHTML=this.children.filter(e=>!Kb(e)).map(e=>Zb(e)).reduce((e,t)=>{let{outerHTML:r}=t,s=r in e?e[r]:{type:jb(t),tracked:Wb(t),elements:[]};return{...e,[r]:{...s,elements:[...s.elements,t]}}},{});get trackedElementSignature(){return Object.keys(this.detailsByOuterHTML).filter(e=>this.detailsByOuterHTML[e].tracked).join("")}getScriptElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("script",e)}getStylesheetElementsNotInSnapshot(e){return this.getElementsMatchingTypeNotInSnapshot("stylesheet",e)}getElementsMatchingTypeNotInSnapshot(e,t){return Object.keys(this.detailsByOuterHTML).filter(r=>!(r in t.detailsByOuterHTML)).map(r=>this.detailsByOuterHTML[r]).filter(({type:r})=>r==e).map(({elements:[r]})=>r)}get provisionalElements(){return Object.keys(this.detailsByOuterHTML).reduce((e,t)=>{let{type:r,tracked:s,elements:n}=this.detailsByOuterHTML[t];return r==null&&!s?[...e,...n]:n.length>1?[...e,...n.slice(1)]:e},[])}getMetaValue(e){let t=this.findMetaElementByName(e);return t?t.getAttribute("content"):null}findMetaElementByName(e){return Object.keys(this.detailsByOuterHTML).reduce((t,r)=>{let{elements:[s]}=this.detailsByOuterHTML[r];return Yb(s,e)?s:t},void 0|void 0)}};function jb(i){if(Gb(i))return"script";if(Xb(i))return"stylesheet"}function Wb(i){return i.getAttribute("data-turbo-track")=="reload"}function Gb(i){return i.localName=="script"}function Kb(i){return i.localName=="noscript"}function Xb(i){let e=i.localName;return e=="style"||e=="link"&&i.getAttribute("rel")=="stylesheet"}function Yb(i,e){return i.localName=="meta"&&i.getAttribute("name")==e}function Zb(i){return i.hasAttribute("nonce")&&i.setAttribute("nonce",""),i}var ri=class i extends As{static fromHTMLString(e=""){return this.fromDocument(qd(e))}static fromElement(e){return this.fromDocument(e.ownerDocument)}static fromDocument({documentElement:e,body:t,head:r}){return new this(e,t,new Zl(r))}constructor(e,t,r){super(t),this.documentElement=e,this.headSnapshot=r}clone(){let e=this.element.cloneNode(!0),t=this.element.querySelectorAll("select"),r=e.querySelectorAll("select");for(let[s,n]of t.entries()){let o=r[s];for(let a of o.selectedOptions)a.selected=!1;for(let a of n.selectedOptions)o.options[a.index].selected=!0}for(let s of e.querySelectorAll('input[type="password"]'))s.value="";return new i(this.documentElement,e,this.headSnapshot)}get lang(){return this.documentElement.getAttribute("lang")}get headElement(){return this.headSnapshot.element}get rootLocation(){let e=this.getSetting("root")??"/";return tt(e)}get cacheControlValue(){return this.getSetting("cache-control")}get isPreviewable(){return this.cacheControlValue!="no-preview"}get isCacheable(){return this.cacheControlValue!="no-cache"}get isVisitable(){return this.getSetting("visit-control")!="reload"}get prefersViewTransitions(){return this.headSnapshot.getMetaValue("view-transition")==="same-origin"}get shouldMorphPage(){return this.getSetting("refresh-method")==="morph"}get shouldPreserveScrollPosition(){return this.getSetting("refresh-scroll")==="preserve"}getSetting(e){return this.headSnapshot.getMetaValue(`turbo-${e}`)}},Ql=class{#e=!1;#t=Promise.resolve();renderChange(e,t){return e&&this.viewTransitionsAvailable&&!this.#e?(this.#e=!0,this.#t=this.#t.then(async()=>{await document.startViewTransition(t).finished})):this.#t=this.#t.then(t),this.#t}get viewTransitionsAvailable(){return document.startViewTransition}},Qb={action:"advance",historyChanged:!1,visitCachedSnapshot:()=>{},willRender:!0,updateHistory:!0,shouldCacheSnapshot:!0,acceptsStreamResponse:!1},$o={visitStart:"visitStart",requestStart:"requestStart",requestEnd:"requestEnd",visitEnd:"visitEnd"},Di={initialized:"initialized",started:"started",canceled:"canceled",failed:"failed",completed:"completed"},ks={networkFailure:0,timeoutFailure:-1,contentTypeMismatch:-2},Jb={advance:"forward",restore:"back",replace:"none"},Jl=class{identifier=hr();timingMetrics={};followedRedirect=!1;historyChanged=!1;scrolled=!1;shouldCacheSnapshot=!0;acceptsStreamResponse=!1;snapshotCached=!1;state=Di.initialized;viewTransitioner=new Ql;constructor(e,t,r,s={}){this.delegate=e,this.location=t,this.restorationIdentifier=r||hr();let{action:n,historyChanged:o,referrer:a,snapshot:l,snapshotHTML:c,response:d,visitCachedSnapshot:f,willRender:y,updateHistory:v,shouldCacheSnapshot:x,acceptsStreamResponse:C,direction:F}={...Qb,...s};this.action=n,this.historyChanged=o,this.referrer=a,this.snapshot=l,this.snapshotHTML=c,this.response=d,this.isSamePage=this.delegate.locationWithActionIsSamePage(this.location,this.action),this.isPageRefresh=this.view.isPageRefresh(this),this.visitCachedSnapshot=f,this.willRender=y,this.updateHistory=v,this.scrolled=!y,this.shouldCacheSnapshot=x,this.acceptsStreamResponse=C,this.direction=F||Jb[n]}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get history(){return this.delegate.history}get restorationData(){return this.history.getRestorationDataForIdentifier(this.restorationIdentifier)}get silent(){return this.isSamePage}start(){this.state==Di.initialized&&(this.recordTimingMetric($o.visitStart),this.state=Di.started,this.adapter.visitStarted(this),this.delegate.visitStarted(this))}cancel(){this.state==Di.started&&(this.request&&this.request.cancel(),this.cancelRender(),this.state=Di.canceled)}complete(){this.state==Di.started&&(this.recordTimingMetric($o.visitEnd),this.adapter.visitCompleted(this),this.state=Di.completed,this.followRedirect(),this.followedRedirect||this.delegate.visitCompleted(this))}fail(){this.state==Di.started&&(this.state=Di.failed,this.adapter.visitFailed(this),this.delegate.visitCompleted(this))}changeHistory(){if(!this.historyChanged&&this.updateHistory){let e=this.location.href===this.referrer?.href?"replace":this.action,t=jd(e);this.history.update(t,this.location,this.restorationIdentifier),this.historyChanged=!0}}issueRequest(){this.hasPreloadedResponse()?this.simulateRequest():this.shouldIssueRequest()&&!this.request&&(this.request=new _r(this,Vt.get,this.location),this.request.perform())}simulateRequest(){this.response&&(this.startRequest(),this.recordResponse(),this.finishRequest())}startRequest(){this.recordTimingMetric($o.requestStart),this.adapter.visitRequestStarted(this)}recordResponse(e=this.response){if(this.response=e,e){let{statusCode:t}=e;Id(t)?this.adapter.visitRequestCompleted(this):this.adapter.visitRequestFailedWithStatusCode(this,t)}}finishRequest(){this.recordTimingMetric($o.requestEnd),this.adapter.visitRequestFinished(this)}loadResponse(){if(this.response){let{statusCode:e,responseHTML:t}=this.response;this.render(async()=>{if(this.shouldCacheSnapshot&&this.cacheSnapshot(),this.view.renderPromise&&await this.view.renderPromise,Id(e)&&t!=null){let r=ri.fromHTMLString(t);await this.renderPageSnapshot(r,!1),this.adapter.visitRendered(this),this.complete()}else await this.view.renderError(ri.fromHTMLString(t),this),this.adapter.visitRendered(this),this.fail()})}}getCachedSnapshot(){let e=this.view.getCachedSnapshotForLocation(this.location)||this.getPreloadedSnapshot();if(e&&(!Fr(this.location)||e.hasAnchor(Fr(this.location)))&&(this.action=="restore"||e.isPreviewable))return e}getPreloadedSnapshot(){if(this.snapshotHTML)return ri.fromHTMLString(this.snapshotHTML)}hasCachedSnapshot(){return this.getCachedSnapshot()!=null}loadCachedSnapshot(){let e=this.getCachedSnapshot();if(e){let t=this.shouldIssueRequest();this.render(async()=>{this.cacheSnapshot(),this.isSamePage||this.isPageRefresh?this.adapter.visitRendered(this):(this.view.renderPromise&&await this.view.renderPromise,await this.renderPageSnapshot(e,t),this.adapter.visitRendered(this),t||this.complete())})}}followRedirect(){this.redirectedToLocation&&!this.followedRedirect&&this.response?.redirected&&(this.adapter.visitProposedToLocation(this.redirectedToLocation,{action:"replace",response:this.response,shouldCacheSnapshot:!1,willRender:!1}),this.followedRedirect=!0)}goToSamePageAnchor(){this.isSamePage&&this.render(async()=>{this.cacheSnapshot(),this.performScroll(),this.changeHistory(),this.adapter.visitRendered(this)})}prepareRequest(e){this.acceptsStreamResponse&&e.acceptResponseType(dr.contentType)}requestStarted(){this.startRequest()}requestPreventedHandlingResponse(e,t){}async requestSucceededWithResponse(e,t){let r=await t.responseHTML,{redirected:s,statusCode:n}=t;r==null?this.recordResponse({statusCode:ks.contentTypeMismatch,redirected:s}):(this.redirectedToLocation=t.redirected?t.location:void 0,this.recordResponse({statusCode:n,responseHTML:r,redirected:s}))}async requestFailedWithResponse(e,t){let r=await t.responseHTML,{redirected:s,statusCode:n}=t;r==null?this.recordResponse({statusCode:ks.contentTypeMismatch,redirected:s}):this.recordResponse({statusCode:n,responseHTML:r,redirected:s})}requestErrored(e,t){this.recordResponse({statusCode:ks.networkFailure,redirected:!1})}requestFinished(){this.finishRequest()}performScroll(){!this.scrolled&&!this.view.forceReloaded&&!this.view.shouldPreserveScrollPosition(this)&&(this.action=="restore"?this.scrollToRestoredPosition()||this.scrollToAnchor()||this.view.scrollToTop():this.scrollToAnchor()||this.view.scrollToTop(),this.isSamePage&&this.delegate.visitScrolledToSamePageLocation(this.view.lastRenderedLocation,this.location),this.scrolled=!0)}scrollToRestoredPosition(){let{scrollPosition:e}=this.restorationData;if(e)return this.view.scrollToPosition(e),!0}scrollToAnchor(){let e=Fr(this.location);if(e!=null)return this.view.scrollToAnchor(e),!0}recordTimingMetric(e){this.timingMetrics[e]=new Date().getTime()}getTimingMetrics(){return{...this.timingMetrics}}getHistoryMethodForAction(e){switch(e){case"replace":return history.replaceState;case"advance":case"restore":return history.pushState}}hasPreloadedResponse(){return typeof this.response=="object"}shouldIssueRequest(){return this.isSamePage?!1:this.action=="restore"?!this.hasCachedSnapshot():this.willRender}cacheSnapshot(){this.snapshotCached||(this.view.cacheSnapshot(this.snapshot).then(e=>e&&this.visitCachedSnapshot(e)),this.snapshotCached=!0)}async render(e){this.cancelRender(),await new Promise(t=>{this.frame=document.visibilityState==="hidden"?setTimeout(()=>t(),0):requestAnimationFrame(()=>t())}),await e(),delete this.frame}async renderPageSnapshot(e,t){await this.viewTransitioner.renderChange(this.view.shouldTransitionTo(e),async()=>{await this.view.renderPage(e,t,this.willRender,this),this.performScroll()})}cancelRender(){this.frame&&(cancelAnimationFrame(this.frame),delete this.frame)}};function Id(i){return i>=200&&i<300}var ec=class{progressBar=new Yl;constructor(e){this.session=e}visitProposedToLocation(e,t){ur(e,this.navigator.rootLocation)?this.navigator.startVisit(e,t?.restorationIdentifier||hr(),t):window.location.href=e.toString()}visitStarted(e){this.location=e.location,e.loadCachedSnapshot(),e.issueRequest(),e.goToSamePageAnchor()}visitRequestStarted(e){this.progressBar.setValue(0),e.hasCachedSnapshot()||e.action!="restore"?this.showVisitProgressBarAfterDelay():this.showProgressBar()}visitRequestCompleted(e){e.loadResponse()}visitRequestFailedWithStatusCode(e,t){switch(t){case ks.networkFailure:case ks.timeoutFailure:case ks.contentTypeMismatch:return this.reload({reason:"request_failed",context:{statusCode:t}});default:return e.loadResponse()}}visitRequestFinished(e){}visitCompleted(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}pageInvalidated(e){this.reload(e)}visitFailed(e){this.progressBar.setValue(1),this.hideVisitProgressBar()}visitRendered(e){}formSubmissionStarted(e){this.progressBar.setValue(0),this.showFormProgressBarAfterDelay()}formSubmissionFinished(e){this.progressBar.setValue(1),this.hideFormProgressBar()}showVisitProgressBarAfterDelay(){this.visitProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay)}hideVisitProgressBar(){this.progressBar.hide(),this.visitProgressBarTimeout!=null&&(window.clearTimeout(this.visitProgressBarTimeout),delete this.visitProgressBarTimeout)}showFormProgressBarAfterDelay(){this.formProgressBarTimeout==null&&(this.formProgressBarTimeout=window.setTimeout(this.showProgressBar,this.session.progressBarDelay))}hideFormProgressBar(){this.progressBar.hide(),this.formProgressBarTimeout!=null&&(window.clearTimeout(this.formProgressBarTimeout),delete this.formProgressBarTimeout)}showProgressBar=()=>{this.progressBar.show()};reload(e){_e("turbo:reload",{detail:e}),window.location.href=this.location?.toString()||window.location.href}get navigator(){return this.session.navigator}},tc=class{selector="[data-turbo-temporary]";deprecatedSelector="[data-turbo-cache=false]";started=!1;start(){this.started||(this.started=!0,addEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}stop(){this.started&&(this.started=!1,removeEventListener("turbo:before-cache",this.removeTemporaryElements,!1))}removeTemporaryElements=e=>{for(let t of this.temporaryElements)t.remove()};get temporaryElements(){return[...document.querySelectorAll(this.selector),...this.temporaryElementsWithDeprecation]}get temporaryElementsWithDeprecation(){let e=document.querySelectorAll(this.deprecatedSelector);return e.length&&console.warn(`The ${this.deprecatedSelector} selector is deprecated and will be removed in a future version. Use ${this.selector} instead.`),[...e]}},ic=class{constructor(e,t){this.session=e,this.element=t,this.linkInterceptor=new Xo(this,t),this.formSubmitObserver=new an(this,t)}start(){this.linkInterceptor.start(),this.formSubmitObserver.start()}stop(){this.linkInterceptor.stop(),this.formSubmitObserver.stop()}shouldInterceptLinkClick(e,t,r){return this.#t(e)}linkClickIntercepted(e,t,r){let s=this.#i(e);s&&s.delegate.linkClickIntercepted(e,t,r)}willSubmitForm(e,t){return e.closest("turbo-frame")==null&&this.#e(e,t)&&this.#t(e,t)}formSubmitted(e,t){let r=this.#i(e,t);r&&r.delegate.formSubmitted(e,t)}#e(e,t){let r=Tc(e,t),s=this.element.ownerDocument.querySelector('meta[name="turbo-root"]'),n=tt(s?.content??"/");return this.#t(e,t)&&ur(r,n)}#t(e,t){if(e instanceof HTMLFormElement?this.session.submissionIsNavigatable(e,t):this.session.elementIsNavigatable(e)){let s=this.#i(e,t);return s?s!=e.closest("turbo-frame"):!1}else return!1}#i(e,t){let r=t?.getAttribute("data-turbo-frame")||e.getAttribute("data-turbo-frame");if(r&&r!="_top"){let s=this.element.querySelector(`#${r}:not([disabled])`);if(s instanceof si)return s}}},rc=class{location;restorationIdentifier=hr();restorationData={};started=!1;pageLoaded=!1;currentIndex=0;constructor(e){this.delegate=e}start(){this.started||(addEventListener("popstate",this.onPopState,!1),addEventListener("load",this.onPageLoad,!1),this.currentIndex=history.state?.turbo?.restorationIndex||0,this.started=!0,this.replace(new URL(window.location.href)))}stop(){this.started&&(removeEventListener("popstate",this.onPopState,!1),removeEventListener("load",this.onPageLoad,!1),this.started=!1)}push(e,t){this.update(history.pushState,e,t)}replace(e,t){this.update(history.replaceState,e,t)}update(e,t,r=hr()){e===history.pushState&&++this.currentIndex;let s={turbo:{restorationIdentifier:r,restorationIndex:this.currentIndex}};e.call(history,s,"",t.href),this.location=t,this.restorationIdentifier=r}getRestorationDataForIdentifier(e){return this.restorationData[e]||{}}updateRestorationData(e){let{restorationIdentifier:t}=this,r=this.restorationData[t];this.restorationData[t]={...r,...e}}assumeControlOfScrollRestoration(){this.previousScrollRestoration||(this.previousScrollRestoration=history.scrollRestoration??"auto",history.scrollRestoration="manual")}relinquishControlOfScrollRestoration(){this.previousScrollRestoration&&(history.scrollRestoration=this.previousScrollRestoration,delete this.previousScrollRestoration)}onPopState=e=>{if(this.shouldHandlePopState()){let{turbo:t}=e.state||{};if(t){this.location=new URL(window.location.href);let{restorationIdentifier:r,restorationIndex:s}=t;this.restorationIdentifier=r;let n=s>this.currentIndex?"forward":"back";this.delegate.historyPoppedToLocationWithRestorationIdentifierAndDirection(this.location,r,n),this.currentIndex=s}}};onPageLoad=async e=>{await cb(),this.pageLoaded=!0};shouldHandlePopState(){return this.pageIsLoaded()}pageIsLoaded(){return this.pageLoaded||document.readyState=="complete"}},sc=class{started=!1;#e=null;constructor(e,t){this.delegate=e,this.eventTarget=t}start(){this.started||(this.eventTarget.readyState==="loading"?this.eventTarget.addEventListener("DOMContentLoaded",this.#t,{once:!0}):this.#t())}stop(){this.started&&(this.eventTarget.removeEventListener("mouseenter",this.#i,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("mouseleave",this.#n,{capture:!0,passive:!0}),this.eventTarget.removeEventListener("turbo:before-fetch-request",this.#a,!0),this.started=!1)}#t=()=>{this.eventTarget.addEventListener("mouseenter",this.#i,{capture:!0,passive:!0}),this.eventTarget.addEventListener("mouseleave",this.#n,{capture:!0,passive:!0}),this.eventTarget.addEventListener("turbo:before-fetch-request",this.#a,!0),this.started=!0};#i=e=>{if(Wo("turbo-prefetch")==="false")return;let t=e.target;if(t.matches&&t.matches("a[href]:not([target^=_]):not([download])")&&this.#u(t)){let s=t,n=Yd(s);if(this.delegate.canPrefetchRequestToLocation(s,n)){this.#e=s;let o=new _r(this,Vt.get,n,new URLSearchParams,t);Ts.setLater(n.toString(),o,this.#r)}}};#n=e=>{e.target===this.#e&&this.#o()};#o=()=>{Ts.clear(),this.#e=null};#a=e=>{if(e.target.tagName!=="FORM"&&e.detail.fetchOptions.method==="GET"){let t=Ts.get(e.detail.url.toString());t&&(e.detail.fetchRequest=t),Ts.clear()}};prepareRequest(e){let t=e.target;e.headers["X-Sec-Purpose"]="prefetch";let r=t.closest("turbo-frame"),s=t.getAttribute("data-turbo-frame")||r?.getAttribute("target")||r?.id;s&&s!=="_top"&&(e.headers["Turbo-Frame"]=s)}requestSucceededWithResponse(){}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}get#r(){return Number(Wo("turbo-prefetch-cache-time"))||Ob}#u(e){return!(!e.getAttribute("href")||ey(e)||ty(e)||iy(e)||ry(e)||ny(e))}},ey=i=>i.origin!==document.location.origin||!["http:","https:"].includes(i.protocol)||i.hasAttribute("target"),ty=i=>i.pathname+i.search===document.location.pathname+document.location.search||i.href.startsWith("#"),iy=i=>{if(i.getAttribute("data-turbo-prefetch")==="false"||i.getAttribute("data-turbo")==="false")return!0;let e=xs(i,"[data-turbo-prefetch]");return!!(e&&e.getAttribute("data-turbo-prefetch")==="false")},ry=i=>{let e=i.getAttribute("data-turbo-method");return!!(e&&e.toLowerCase()!=="get"||sy(i)||i.hasAttribute("data-turbo-confirm")||i.hasAttribute("data-turbo-stream"))},sy=i=>i.hasAttribute("data-remote")||i.hasAttribute("data-behavior")||i.hasAttribute("data-confirm")||i.hasAttribute("data-method"),ny=i=>_e("turbo:before-prefetch",{target:i,cancelable:!0}).defaultPrevented,nc=class{constructor(e){this.delegate=e}proposeVisit(e,t={}){this.delegate.allowsVisitingLocationWithAction(e,t.action)&&this.delegate.visitProposedToLocation(e,t)}startVisit(e,t,r={}){this.stop(),this.currentVisit=new Jl(this,tt(e),t,{referrer:this.location,...r}),this.currentVisit.start()}submitForm(e,t){this.stop(),this.formSubmission=new Go(this,e,t,!0),this.formSubmission.start()}stop(){this.formSubmission&&(this.formSubmission.stop(),delete this.formSubmission),this.currentVisit&&(this.currentVisit.cancel(),delete this.currentVisit)}get adapter(){return this.delegate.adapter}get view(){return this.delegate.view}get rootLocation(){return this.view.snapshot.rootLocation}get history(){return this.delegate.history}formSubmissionStarted(e){typeof this.adapter.formSubmissionStarted=="function"&&this.adapter.formSubmissionStarted(e)}async formSubmissionSucceededWithResponse(e,t){if(e==this.formSubmission){let r=await t.responseHTML;if(r){let s=e.isSafe;s||this.view.clearSnapshotCache();let{statusCode:n,redirected:o}=t,l={action:this.#e(e,t),shouldCacheSnapshot:s,response:{statusCode:n,responseHTML:r,redirected:o}};this.proposeVisit(t.location,l)}}}async formSubmissionFailedWithResponse(e,t){let r=await t.responseHTML;if(r){let s=ri.fromHTMLString(r);t.serverError?await this.view.renderError(s,this.currentVisit):await this.view.renderPage(s,!1,!0,this.currentVisit),s.shouldPreserveScrollPosition||this.view.scrollToTop(),this.view.clearSnapshotCache()}}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished(e){typeof this.adapter.formSubmissionFinished=="function"&&this.adapter.formSubmissionFinished(e)}visitStarted(e){this.delegate.visitStarted(e)}visitCompleted(e){this.delegate.visitCompleted(e),delete this.currentVisit}locationWithActionIsSamePage(e,t){let r=Fr(e),s=Fr(this.view.lastRenderedLocation),n=t==="restore"&&typeof r>"u";return t!=="replace"&&ql(e)===ql(this.view.lastRenderedLocation)&&(n||r!=null&&r!==s)}visitScrolledToSamePageLocation(e,t){this.delegate.visitScrolledToSamePageLocation(e,t)}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}#e(e,t){let{submitter:r,formElement:s}=e;return Pr(r,s)||this.#t(t)}#t(e){return e.redirected&&e.location.href===this.location?.href?"replace":"advance"}},Ar={initial:0,loading:1,interactive:2,complete:3},oc=class{stage=Ar.initial;started=!1;constructor(e){this.delegate=e}start(){this.started||(this.stage==Ar.initial&&(this.stage=Ar.loading),document.addEventListener("readystatechange",this.interpretReadyState,!1),addEventListener("pagehide",this.pageWillUnload,!1),this.started=!0)}stop(){this.started&&(document.removeEventListener("readystatechange",this.interpretReadyState,!1),removeEventListener("pagehide",this.pageWillUnload,!1),this.started=!1)}interpretReadyState=()=>{let{readyState:e}=this;e=="interactive"?this.pageIsInteractive():e=="complete"&&this.pageIsComplete()};pageIsInteractive(){this.stage==Ar.loading&&(this.stage=Ar.interactive,this.delegate.pageBecameInteractive())}pageIsComplete(){this.pageIsInteractive(),this.stage==Ar.interactive&&(this.stage=Ar.complete,this.delegate.pageLoaded())}pageWillUnload=()=>{this.delegate.pageWillUnload()};get readyState(){return document.readyState}},ac=class{started=!1;constructor(e){this.delegate=e}start(){this.started||(addEventListener("scroll",this.onScroll,!1),this.onScroll(),this.started=!0)}stop(){this.started&&(removeEventListener("scroll",this.onScroll,!1),this.started=!1)}onScroll=()=>{this.updatePosition({x:window.pageXOffset,y:window.pageYOffset})};updatePosition(e){this.delegate.scrollPositionChanged(e)}},lc=class{render({fragment:e}){Qo.preservingPermanentElements(this,oy(e),()=>{ay(e,()=>{ly(()=>{document.documentElement.appendChild(e)})})})}enteringBardo(e,t){t.replaceWith(e.cloneNode(!0))}leavingBardo(){}};function oy(i){let e=tp(document.documentElement),t={};for(let r of e){let{id:s}=r;for(let n of i.querySelectorAll("turbo-stream")){let o=ep(n.templateElement.content,s);o&&(t[s]=[r,o])}}return t}async function ay(i,e){let t=`turbo-stream-autofocus-${hr()}`,r=i.querySelectorAll("turbo-stream"),s=cy(r),n=null;if(s&&(s.id?n=s.id:n=t,s.id=n),e(),await sn(),(document.activeElement==null||document.activeElement==document.body)&&n){let a=document.getElementById(n);Ec(a)&&a.focus(),a&&a.id==t&&a.removeAttribute("id")}}async function ly(i){let[e,t]=await mb(i,()=>document.activeElement),r=e&&e.id;if(r){let s=document.getElementById(r);Ec(s)&&s!=t&&s.focus()}}function cy(i){for(let e of i){let t=Gd(e.templateElement.content);if(t)return t}return null}var cc=class{sources=new Set;#e=!1;constructor(e){this.delegate=e}start(){this.#e||(this.#e=!0,addEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}stop(){this.#e&&(this.#e=!1,removeEventListener("turbo:before-fetch-response",this.inspectFetchResponse,!1))}connectStreamSource(e){this.streamSourceIsConnected(e)||(this.sources.add(e),e.addEventListener("message",this.receiveMessageEvent,!1))}disconnectStreamSource(e){this.streamSourceIsConnected(e)&&(this.sources.delete(e),e.removeEventListener("message",this.receiveMessageEvent,!1))}streamSourceIsConnected(e){return this.sources.has(e)}inspectFetchResponse=e=>{let t=uy(e);t&&hy(t)&&(e.preventDefault(),this.receiveMessageResponse(t))};receiveMessageEvent=e=>{this.#e&&typeof e.data=="string"&&this.receiveMessageHTML(e.data)};async receiveMessageResponse(e){let t=await e.responseHTML;t&&this.receiveMessageHTML(t)}receiveMessageHTML(e){this.delegate.receivedMessageFromStream(dr.wrap(e))}};function uy(i){let e=i.detail?.fetchResponse;if(e instanceof on)return e}function hy(i){return(i.contentType??"").startsWith(dr.contentType)}var uc=class extends ln{static renderElement(e,t){let{documentElement:r,body:s}=document;r.replaceChild(t,s)}async render(){this.replaceHeadAndBody(),this.activateScriptElements()}replaceHeadAndBody(){let{documentElement:e,head:t}=document;e.replaceChild(this.newHead,t),this.renderElement(this.currentElement,this.newElement)}activateScriptElements(){for(let e of this.scriptElements){let t=e.parentNode;if(t){let r=nn(e);t.replaceChild(r,e)}}}get newHead(){return this.newSnapshot.headSnapshot.element}get scriptElements(){return document.documentElement.querySelectorAll("script")}},un=class extends ln{static renderElement(e,t){document.body&&t instanceof HTMLBodyElement?document.body.replaceWith(t):document.documentElement.appendChild(t)}get shouldRender(){return this.newSnapshot.isVisitable&&this.trackedElementsAreIdentical}get reloadReason(){if(!this.newSnapshot.isVisitable)return{reason:"turbo_visit_control_is_reload"};if(!this.trackedElementsAreIdentical)return{reason:"tracked_element_mismatch"}}async prepareToRender(){this.#e(),await this.mergeHead()}async render(){this.willRender&&await this.replaceBody()}finishRendering(){super.finishRendering(),this.isPreview||this.focusFirstAutofocusableElement()}get currentHeadSnapshot(){return this.currentSnapshot.headSnapshot}get newHeadSnapshot(){return this.newSnapshot.headSnapshot}get newElement(){return this.newSnapshot.element}#e(){let{documentElement:e}=this.currentSnapshot,{lang:t}=this.newSnapshot;t?e.setAttribute("lang",t):e.removeAttribute("lang")}async mergeHead(){let e=this.mergeProvisionalElements(),t=this.copyNewHeadStylesheetElements();this.copyNewHeadScriptElements(),await e,await t,this.willRender&&this.removeUnusedDynamicStylesheetElements()}async replaceBody(){await this.preservingPermanentElements(async()=>{this.activateNewBody(),await this.assignNewBody()})}get trackedElementsAreIdentical(){return this.currentHeadSnapshot.trackedElementSignature==this.newHeadSnapshot.trackedElementSignature}async copyNewHeadStylesheetElements(){let e=[];for(let t of this.newHeadStylesheetElements)e.push(db(t)),document.head.appendChild(t);await Promise.all(e)}copyNewHeadScriptElements(){for(let e of this.newHeadScriptElements)document.head.appendChild(nn(e))}removeUnusedDynamicStylesheetElements(){for(let e of this.unusedDynamicStylesheetElements)document.head.removeChild(e)}async mergeProvisionalElements(){let e=[...this.newHeadProvisionalElements];for(let t of this.currentHeadProvisionalElements)this.isCurrentElementInElementList(t,e)||document.head.removeChild(t);for(let t of e)document.head.appendChild(t)}isCurrentElementInElementList(e,t){for(let[r,s]of t.entries()){if(e.tagName=="TITLE"){if(s.tagName!="TITLE")continue;if(e.innerHTML==s.innerHTML)return t.splice(r,1),!0}if(s.isEqualNode(e))return t.splice(r,1),!0}return!1}removeCurrentHeadProvisionalElements(){for(let e of this.currentHeadProvisionalElements)document.head.removeChild(e)}copyNewHeadProvisionalElements(){for(let e of this.newHeadProvisionalElements)document.head.appendChild(e)}activateNewBody(){document.adoptNode(this.newElement),this.activateNewBodyScriptElements()}activateNewBodyScriptElements(){for(let e of this.newBodyScriptElements){let t=nn(e);e.replaceWith(t)}}async assignNewBody(){await this.renderElement(this.currentElement,this.newElement)}get unusedDynamicStylesheetElements(){return this.oldHeadStylesheetElements.filter(e=>e.getAttribute("data-turbo-track")==="dynamic")}get oldHeadStylesheetElements(){return this.currentHeadSnapshot.getStylesheetElementsNotInSnapshot(this.newHeadSnapshot)}get newHeadStylesheetElements(){return this.newHeadSnapshot.getStylesheetElementsNotInSnapshot(this.currentHeadSnapshot)}get newHeadScriptElements(){return this.newHeadSnapshot.getScriptElementsNotInSnapshot(this.currentHeadSnapshot)}get currentHeadProvisionalElements(){return this.currentHeadSnapshot.provisionalElements}get newHeadProvisionalElements(){return this.newHeadSnapshot.provisionalElements}get newBodyScriptElements(){return this.newElement.querySelectorAll("script")}},hc=class extends un{static renderElement(e,t){Ac(e,t,{callbacks:{beforeNodeMorphed:r=>!Dd(r)}});for(let r of e.querySelectorAll("turbo-frame"))Dd(r)&&r.reload();_e("turbo:morph",{detail:{currentElement:e,newElement:t}})}async preservingPermanentElements(e){return await e()}get renderMethod(){return"morph"}get shouldAutofocus(){return!1}};function Dd(i){return i instanceof si&&i.src&&i.refresh==="morph"&&!i.closest("[data-turbo-permanent]")}var dc=class{keys=[];snapshots={};constructor(e){this.size=e}has(e){return Ho(e)in this.snapshots}get(e){if(this.has(e)){let t=this.read(e);return this.touch(e),t}}put(e,t){return this.write(e,t),this.touch(e),t}clear(){this.snapshots={}}read(e){return this.snapshots[Ho(e)]}write(e,t){this.snapshots[Ho(e)]=t}touch(e){let t=Ho(e),r=this.keys.indexOf(t);r>-1&&this.keys.splice(r,1),this.keys.unshift(t),this.trim()}trim(){for(let e of this.keys.splice(this.size))delete this.snapshots[e]}},pc=class extends Ko{snapshotCache=new dc(10);lastRenderedLocation=new URL(location.href);forceReloaded=!1;shouldTransitionTo(e){return this.snapshot.prefersViewTransitions&&e.prefersViewTransitions}renderPage(e,t=!1,r=!0,s){let o=this.isPageRefresh(s)&&this.snapshot.shouldMorphPage?hc:un,a=new o(this.snapshot,e,t,r);return a.shouldRender?s?.changeHistory():this.forceReloaded=!0,this.render(a)}renderError(e,t){t?.changeHistory();let r=new uc(this.snapshot,e,!1);return this.render(r)}clearSnapshotCache(){this.snapshotCache.clear()}async cacheSnapshot(e=this.snapshot){if(e.isCacheable){this.delegate.viewWillCacheSnapshot();let{lastRenderedLocation:t}=this;await $d();let r=e.clone();return this.snapshotCache.put(t,r),r}}getCachedSnapshotForLocation(e){return this.snapshotCache.get(e)}isPageRefresh(e){return!e||this.lastRenderedLocation.pathname===e.location.pathname&&e.action==="replace"}shouldPreserveScrollPosition(e){return this.isPageRefresh(e)&&this.snapshot.shouldPreserveScrollPosition}get snapshot(){return ri.fromElement(this.element)}},fc=class{selector="a[data-turbo-preload]";constructor(e,t){this.delegate=e,this.snapshotCache=t}start(){document.readyState==="loading"?document.addEventListener("DOMContentLoaded",this.#e):this.preloadOnLoadLinksForView(document.body)}stop(){document.removeEventListener("DOMContentLoaded",this.#e)}preloadOnLoadLinksForView(e){for(let t of e.querySelectorAll(this.selector))this.delegate.shouldPreloadLink(t)&&this.preloadURL(t)}async preloadURL(e){let t=new URL(e.href);if(this.snapshotCache.has(t))return;await new _r(this,Vt.get,t,new URLSearchParams,e).perform()}prepareRequest(e){e.headers["X-Sec-Purpose"]="prefetch"}async requestSucceededWithResponse(e,t){try{let r=await t.responseHTML,s=ri.fromHTMLString(r);this.snapshotCache.put(e.url,s)}catch{}}requestStarted(e){}requestErrored(e){}requestFinished(e){}requestPreventedHandlingResponse(e,t){}requestFailedWithResponse(e,t){}#e=()=>{this.preloadOnLoadLinksForView(document.body)}},mc=class{constructor(e){this.session=e}clear(){this.session.clearCache()}resetCacheControl(){this.#e("")}exemptPageFromCache(){this.#e("no-cache")}exemptPageFromPreview(){this.#e("no-preview")}#e(e){fb("turbo-cache-control",e)}},gc=class{navigator=new nc(this);history=new rc(this);view=new pc(this,document.documentElement);adapter=new ec(this);pageObserver=new oc(this);cacheObserver=new tc;linkPrefetchObserver=new sc(this,document);linkClickObserver=new Yo(this,window);formSubmitObserver=new an(this,document);scrollObserver=new ac(this);streamObserver=new cc(this);formLinkClickObserver=new Zo(this,document.documentElement);frameRedirector=new ic(this,document.documentElement);streamMessageRenderer=new lc;cache=new mc(this);enabled=!0;started=!1;#e=150;constructor(e){this.recentRequests=e,this.preloader=new fc(this,this.view.snapshotCache),this.debouncedRefresh=this.refresh,this.pageRefreshDebouncePeriod=this.pageRefreshDebouncePeriod}start(){this.started||(this.pageObserver.start(),this.cacheObserver.start(),this.linkPrefetchObserver.start(),this.formLinkClickObserver.start(),this.linkClickObserver.start(),this.formSubmitObserver.start(),this.scrollObserver.start(),this.streamObserver.start(),this.frameRedirector.start(),this.history.start(),this.preloader.start(),this.started=!0,this.enabled=!0)}disable(){this.enabled=!1}stop(){this.started&&(this.pageObserver.stop(),this.cacheObserver.stop(),this.linkPrefetchObserver.stop(),this.formLinkClickObserver.stop(),this.linkClickObserver.stop(),this.formSubmitObserver.stop(),this.scrollObserver.stop(),this.streamObserver.stop(),this.frameRedirector.stop(),this.history.stop(),this.preloader.stop(),this.started=!1)}registerAdapter(e){this.adapter=e}visit(e,t={}){let r=t.frame?document.getElementById(t.frame):null;if(r instanceof si){let s=t.action||Pr(r);r.delegate.proposeVisitIfNavigatedWithAction(r,s),r.src=e.toString()}else this.navigator.proposeVisit(tt(e),t)}refresh(e,t){!(t&&this.recentRequests.has(t))&&!this.navigator.currentVisit&&this.visit(e,{action:"replace",shouldCacheSnapshot:!1})}connectStreamSource(e){this.streamObserver.connectStreamSource(e)}disconnectStreamSource(e){this.streamObserver.disconnectStreamSource(e)}renderStreamMessage(e){this.streamMessageRenderer.render(dr.wrap(e))}clearCache(){this.view.clearSnapshotCache()}setProgressBarDelay(e){console.warn("Please replace `session.setProgressBarDelay(delay)` with `session.progressBarDelay = delay`. The function is deprecated and will be removed in a future version of Turbo.`"),this.progressBarDelay=e}set progressBarDelay(e){et.drive.progressBarDelay=e}get progressBarDelay(){return et.drive.progressBarDelay}set drive(e){et.drive.enabled=e}get drive(){return et.drive.enabled}set formMode(e){et.forms.mode=e}get formMode(){return et.forms.mode}get location(){return this.history.location}get restorationIdentifier(){return this.history.restorationIdentifier}get pageRefreshDebouncePeriod(){return this.#e}set pageRefreshDebouncePeriod(e){this.refresh=gb(this.debouncedRefresh.bind(this),e),this.#e=e}shouldPreloadLink(e){let t=e.hasAttribute("data-turbo-method"),r=e.hasAttribute("data-turbo-stream"),s=e.getAttribute("data-turbo-frame"),n=s=="_top"?null:document.getElementById(s)||xs(e,"turbo-frame:not([disabled])");if(t||r||n instanceof si)return!1;{let o=new URL(e.href);return this.elementIsNavigatable(e)&&ur(o,this.snapshot.rootLocation)}}historyPoppedToLocationWithRestorationIdentifierAndDirection(e,t,r){this.enabled?this.navigator.startVisit(e,t,{action:"restore",historyChanged:!0,direction:r}):this.adapter.pageInvalidated({reason:"turbo_disabled"})}scrollPositionChanged(e){this.history.updateRestorationData({scrollPosition:e})}willSubmitFormLinkToLocation(e,t){return this.elementIsNavigatable(e)&&ur(t,this.snapshot.rootLocation)}submittedFormLinkToLocation(){}canPrefetchRequestToLocation(e,t){return this.elementIsNavigatable(e)&&ur(t,this.snapshot.rootLocation)}willFollowLinkToLocation(e,t,r){return this.elementIsNavigatable(e)&&ur(t,this.snapshot.rootLocation)&&this.applicationAllowsFollowingLinkToLocation(e,t,r)}followedLinkToLocation(e,t){let r=this.getActionForLink(e),s=e.hasAttribute("data-turbo-stream");this.visit(t.href,{action:r,acceptsStreamResponse:s})}allowsVisitingLocationWithAction(e,t){return this.locationWithActionIsSamePage(e,t)||this.applicationAllowsVisitingLocation(e)}visitProposedToLocation(e,t){Nd(e),this.adapter.visitProposedToLocation(e,t)}visitStarted(e){e.acceptsStreamResponse||(Vo(document.documentElement),this.view.markVisitDirection(e.direction)),Nd(e.location),e.silent||this.notifyApplicationAfterVisitingLocation(e.location,e.action)}visitCompleted(e){this.view.unmarkVisitDirection(),jo(document.documentElement),this.notifyApplicationAfterPageLoad(e.getTimingMetrics())}locationWithActionIsSamePage(e,t){return this.navigator.locationWithActionIsSamePage(e,t)}visitScrolledToSamePageLocation(e,t){this.notifyApplicationAfterVisitingSamePageLocation(e,t)}willSubmitForm(e,t){let r=Tc(e,t);return this.submissionIsNavigatable(e,t)&&ur(tt(r),this.snapshot.rootLocation)}formSubmitted(e,t){this.navigator.submitForm(e,t)}pageBecameInteractive(){this.view.lastRenderedLocation=this.location,this.notifyApplicationAfterPageLoad()}pageLoaded(){this.history.assumeControlOfScrollRestoration()}pageWillUnload(){this.history.relinquishControlOfScrollRestoration()}receivedMessageFromStream(e){this.renderStreamMessage(e)}viewWillCacheSnapshot(){this.navigator.currentVisit?.silent||this.notifyApplicationBeforeCachingSnapshot()}allowsImmediateRender({element:e},t){let r=this.notifyApplicationBeforeRender(e,t),{defaultPrevented:s,detail:{render:n}}=r;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(e,t,r){this.view.lastRenderedLocation=this.history.location,this.notifyApplicationAfterRender(r)}preloadOnLoadLinksForView(e){this.preloader.preloadOnLoadLinksForView(e)}viewInvalidated(e){this.adapter.pageInvalidated(e)}frameLoaded(e){this.notifyApplicationAfterFrameLoad(e)}frameRendered(e,t){this.notifyApplicationAfterFrameRender(e,t)}applicationAllowsFollowingLinkToLocation(e,t,r){return!this.notifyApplicationAfterClickingLinkToLocation(e,t,r).defaultPrevented}applicationAllowsVisitingLocation(e){return!this.notifyApplicationBeforeVisitingLocation(e).defaultPrevented}notifyApplicationAfterClickingLinkToLocation(e,t,r){return _e("turbo:click",{target:e,detail:{url:t.href,originalEvent:r},cancelable:!0})}notifyApplicationBeforeVisitingLocation(e){return _e("turbo:before-visit",{detail:{url:e.href},cancelable:!0})}notifyApplicationAfterVisitingLocation(e,t){return _e("turbo:visit",{detail:{url:e.href,action:t}})}notifyApplicationBeforeCachingSnapshot(){return _e("turbo:before-cache")}notifyApplicationBeforeRender(e,t){return _e("turbo:before-render",{detail:{newBody:e,...t},cancelable:!0})}notifyApplicationAfterRender(e){return _e("turbo:render",{detail:{renderMethod:e}})}notifyApplicationAfterPageLoad(e={}){return _e("turbo:load",{detail:{url:this.location.href,timing:e}})}notifyApplicationAfterVisitingSamePageLocation(e,t){dispatchEvent(new HashChangeEvent("hashchange",{oldURL:e.toString(),newURL:t.toString()}))}notifyApplicationAfterFrameLoad(e){return _e("turbo:frame-load",{target:e})}notifyApplicationAfterFrameRender(e,t){return _e("turbo:frame-render",{detail:{fetchResponse:e},target:t,cancelable:!0})}submissionIsNavigatable(e,t){if(et.forms.mode=="off")return!1;{let r=t?this.elementIsNavigatable(t):!0;return et.forms.mode=="optin"?r&&e.closest('[data-turbo="true"]')!=null:r&&this.elementIsNavigatable(e)}}elementIsNavigatable(e){let t=xs(e,"[data-turbo]"),r=xs(e,"turbo-frame");return et.drive.enabled||r?t?t.getAttribute("data-turbo")!="false":!0:t?t.getAttribute("data-turbo")=="true":!1}getActionForLink(e){return Pr(e)||"advance"}get snapshot(){return this.view.snapshot}};function Nd(i){Object.defineProperties(i,dy)}var dy={absoluteURL:{get(){return this.toString()}}},Be=new gc(Zd),{cache:py,navigator:fy}=Be;function rp(){Be.start()}function my(i){Be.registerAdapter(i)}function gy(i,e){Be.visit(i,e)}function sp(i){Be.connectStreamSource(i)}function np(i){Be.disconnectStreamSource(i)}function vy(i){Be.renderStreamMessage(i)}function by(){console.warn("Please replace `Turbo.clearCache()` with `Turbo.cache.clear()`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),Be.clearCache()}function yy(i){console.warn("Please replace `Turbo.setProgressBarDelay(delay)` with `Turbo.config.drive.progressBarDelay = delay`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),et.drive.progressBarDelay=i}function wy(i){console.warn("Please replace `Turbo.setConfirmMethod(confirmMethod)` with `Turbo.config.forms.confirm = confirmMethod`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),et.forms.confirm=i}function Sy(i){console.warn("Please replace `Turbo.setFormMode(mode)` with `Turbo.config.forms.mode = mode`. The top-level function is deprecated and will be removed in a future version of Turbo.`"),et.forms.mode=i}var Ey=Object.freeze({__proto__:null,navigator:fy,session:Be,cache:py,PageRenderer:un,PageSnapshot:ri,FrameRenderer:cn,fetch:Qd,config:et,start:rp,registerAdapter:my,visit:gy,connectStreamSource:sp,disconnectStreamSource:np,renderStreamMessage:vy,clearCache:by,setProgressBarDelay:yy,setConfirmMethod:wy,setFormMode:Sy}),vc=class extends Error{},bc=class{fetchResponseLoaded=e=>Promise.resolve();#e=null;#t=()=>{};#i=!1;#n=!1;#o=new Set;#a=!1;action=null;constructor(e){this.element=e,this.view=new Gl(this,this.element),this.appearanceObserver=new jl(this,this.element),this.formLinkClickObserver=new Zo(this,this.element),this.linkInterceptor=new Xo(this,this.element),this.restorationIdentifier=hr(),this.formSubmitObserver=new an(this,this.element)}connect(){this.#i||(this.#i=!0,this.loadingStyle==Es.lazy?this.appearanceObserver.start():this.#r(),this.formLinkClickObserver.start(),this.linkInterceptor.start(),this.formSubmitObserver.start())}disconnect(){this.#i&&(this.#i=!1,this.appearanceObserver.stop(),this.formLinkClickObserver.stop(),this.linkInterceptor.stop(),this.formSubmitObserver.stop())}disabledChanged(){this.loadingStyle==Es.eager&&this.#r()}sourceURLChanged(){this.#y("src")||(this.element.isConnected&&(this.complete=!1),(this.loadingStyle==Es.eager||this.#n)&&this.#r())}sourceURLReloaded(){let{refresh:e,src:t}=this.element;return this.#a=t&&e==="morph",this.element.removeAttribute("complete"),this.element.src=null,this.element.src=t,this.element.loaded}loadingStyleChanged(){this.loadingStyle==Es.lazy?this.appearanceObserver.start():(this.appearanceObserver.stop(),this.#r())}async#r(){this.enabled&&this.isActive&&!this.complete&&this.sourceURL&&(this.element.loaded=this.#s(tt(this.sourceURL)),this.appearanceObserver.stop(),await this.element.loaded,this.#n=!0)}async loadResponse(e){(e.redirected||e.succeeded&&e.isHTML)&&(this.sourceURL=e.response.url);try{let t=await e.responseHTML;if(t){let r=qd(t);ri.fromDocument(r).isVisitable?await this.#u(e,r):await this.#l(e)}}finally{this.#a=!1,this.fetchResponseLoaded=()=>Promise.resolve()}}elementAppearedInViewport(e){this.proposeVisitIfNavigatedWithAction(e,Pr(e)),this.#r()}willSubmitFormLinkToLocation(e){return this.#f(e)}submittedFormLinkToLocation(e,t,r){let s=this.#d(e);s&&r.setAttribute("data-turbo-frame",s.id)}shouldInterceptLinkClick(e,t,r){return this.#f(e)}linkClickIntercepted(e,t){this.#p(e,t)}willSubmitForm(e,t){return e.closest("turbo-frame")==this.element&&this.#f(e,t)}formSubmitted(e,t){this.formSubmission&&this.formSubmission.stop(),this.formSubmission=new Go(this,e,t);let{fetchRequest:r}=this.formSubmission;this.prepareRequest(r),this.formSubmission.start()}prepareRequest(e){e.headers["Turbo-Frame"]=this.id,this.currentNavigationElement?.hasAttribute("data-turbo-stream")&&e.acceptResponseType(dr.contentType)}requestStarted(e){Vo(this.element)}requestPreventedHandlingResponse(e,t){this.#t()}async requestSucceededWithResponse(e,t){await this.loadResponse(t),this.#t()}async requestFailedWithResponse(e,t){await this.loadResponse(t),this.#t()}requestErrored(e,t){console.error(t),this.#t()}requestFinished(e){jo(this.element)}formSubmissionStarted({formElement:e}){Vo(e,this.#d(e))}formSubmissionSucceededWithResponse(e,t){let r=this.#d(e.formElement,e.submitter);r.delegate.proposeVisitIfNavigatedWithAction(r,Pr(e.submitter,e.formElement,r)),r.delegate.loadResponse(t),e.isSafe||Be.clearCache()}formSubmissionFailedWithResponse(e,t){this.element.delegate.loadResponse(t),Be.clearCache()}formSubmissionErrored(e,t){console.error(t)}formSubmissionFinished({formElement:e}){jo(e,this.#d(e))}allowsImmediateRender({element:e},t){let r=_e("turbo:before-frame-render",{target:this.element,detail:{newFrame:e,...t},cancelable:!0}),{defaultPrevented:s,detail:{render:n}}=r;return this.view.renderer&&n&&(this.view.renderer.renderElement=n),!s}viewRenderedSnapshot(e,t,r){}preloadOnLoadLinksForView(e){Be.preloadOnLoadLinksForView(e)}viewInvalidated(){}willRenderFrame(e,t){this.previousFrameElement=e.cloneNode(!0)}visitCachedSnapshot=({element:e})=>{let t=e.querySelector("#"+this.element.id);t&&this.previousFrameElement&&t.replaceChildren(...this.previousFrameElement.children),delete this.previousFrameElement};async#u(e,t){let r=await this.extractForeignFrameElement(t.body),s=this.#a?Xl:cn;if(r){let n=new As(r),o=new s(this,this.view.snapshot,n,!1,!1);this.view.renderPromise&&await this.view.renderPromise,this.changeHistory(),await this.view.render(o),this.complete=!0,Be.frameRendered(e,this.element),Be.frameLoaded(this.element),await this.fetchResponseLoaded(e)}else this.#h(e)&&this.#c(e)}async#s(e){let t=new _r(this,Vt.get,e,new URLSearchParams,this.element);return this.#e?.cancel(),this.#e=t,new Promise(r=>{this.#t=()=>{this.#t=()=>{},this.#e=null,r()},t.perform()})}#p(e,t,r){let s=this.#d(e,r);s.delegate.proposeVisitIfNavigatedWithAction(s,Pr(r,e,s)),this.#m(e,()=>{s.src=t})}proposeVisitIfNavigatedWithAction(e,t=null){if(this.action=t,this.action){let r=ri.fromElement(e).clone(),{visitCachedSnapshot:s}=e.delegate;e.delegate.fetchResponseLoaded=async n=>{if(e.src){let{statusCode:o,redirected:a}=n,l=await n.responseHTML,d={response:{statusCode:o,redirected:a,responseHTML:l},visitCachedSnapshot:s,willRender:!1,updateHistory:!1,restorationIdentifier:this.restorationIdentifier,snapshot:r};this.action&&(d.action=this.action),Be.visit(e.src,d)}}}}changeHistory(){if(this.action){let e=jd(this.action);Be.history.update(e,tt(this.element.src||""),this.restorationIdentifier)}}async#l(e){console.warn(`The response (${e.statusCode}) from <turbo-frame id="${this.element.id}"> is performing a full page visit due to turbo-visit-control.`),await this.#v(e.response)}#h(e){this.element.setAttribute("complete","");let t=e.response,r=async(n,o)=>{n instanceof Response?this.#v(n):Be.visit(n,o)};return!_e("turbo:frame-missing",{target:this.element,detail:{response:t,visit:r},cancelable:!0}).defaultPrevented}#c(e){this.view.missing(),this.#g(e)}#g(e){let t=`The response (${e.statusCode}) did not contain the expected <turbo-frame id="${this.element.id}"> and will be ignored. To perform a full page visit instead, set turbo-visit-control to reload.`;throw new vc(t)}async#v(e){let t=new on(e),r=await t.responseHTML,{location:s,redirected:n,statusCode:o}=t;return Be.visit(s,{response:{redirected:n,statusCode:o,responseHTML:r}})}#d(e,t){let r=qo("data-turbo-frame",t,e)||this.element.getAttribute("target");return Bd(r)??this.element}async extractForeignFrameElement(e){let t,r=CSS.escape(this.id);try{if(t=Ud(e.querySelector(`turbo-frame#${r}`),this.sourceURL),t)return t;if(t=Ud(e.querySelector(`turbo-frame[src][recurse~=${r}]`),this.sourceURL),t)return await t.loaded,await this.extractForeignFrameElement(t)}catch(s){return console.error(s),new si}return null}#b(e,t){let r=Tc(e,t);return ur(tt(r),this.rootLocation)}#f(e,t){let r=qo("data-turbo-frame",t,e)||this.element.getAttribute("target");if(e instanceof HTMLFormElement&&!this.#b(e,t)||!this.enabled||r=="_top")return!1;if(r){let s=Bd(r);if(s)return!s.disabled}return!(!Be.elementIsNavigatable(e)||t&&!Be.elementIsNavigatable(t))}get id(){return this.element.id}get enabled(){return!this.element.disabled}get sourceURL(){if(this.element.src)return this.element.src}set sourceURL(e){this.#w("src",()=>{this.element.src=e??null})}get loadingStyle(){return this.element.loading}get isLoading(){return this.formSubmission!==void 0||this.#t()!==void 0}get complete(){return this.element.hasAttribute("complete")}set complete(e){e?this.element.setAttribute("complete",""):this.element.removeAttribute("complete")}get isActive(){return this.element.isActive&&this.#i}get rootLocation(){let t=this.element.ownerDocument.querySelector('meta[name="turbo-root"]')?.content??"/";return tt(t)}#y(e){return this.#o.has(e)}#w(e,t){this.#o.add(e),t(),this.#o.delete(e)}#m(e,t){this.currentNavigationElement=e,t(),delete this.currentNavigationElement}};function Bd(i){if(i!=null){let e=document.getElementById(i);if(e instanceof si)return e}}function Ud(i,e){if(i){let t=i.getAttribute("src");if(t!=null&&e!=null&&Sb(t,e))throw new Error(`Matching <turbo-frame id="${i.id}"> element has a source URL which references itself`);if(i.ownerDocument!==document&&(i=document.importNode(i,!0)),i instanceof si)return i.connectedCallback(),i.disconnectedCallback(),i}}var op={after(){this.targetElements.forEach(i=>i.parentElement?.insertBefore(this.templateContent,i.nextSibling))},append(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(i=>i.append(this.templateContent))},before(){this.targetElements.forEach(i=>i.parentElement?.insertBefore(this.templateContent,i))},prepend(){this.removeDuplicateTargetChildren(),this.targetElements.forEach(i=>i.prepend(this.templateContent))},remove(){this.targetElements.forEach(i=>i.remove())},replace(){let i=this.getAttribute("method");this.targetElements.forEach(e=>{i==="morph"?Ac(e,this.templateContent):e.replaceWith(this.templateContent)})},update(){let i=this.getAttribute("method");this.targetElements.forEach(e=>{i==="morph"?ip(e,this.templateContent):(e.innerHTML="",e.append(this.templateContent))})},refresh(){Be.refresh(this.baseURI,this.requestId)}},yc=class i extends HTMLElement{static async renderElement(e){await e.performAction()}async connectedCallback(){try{await this.render()}catch(e){console.error(e)}finally{this.disconnect()}}async render(){return this.renderPromise??=(async()=>{let e=this.beforeRenderEvent;this.dispatchEvent(e)&&(await sn(),await e.detail.render(this))})()}disconnect(){try{this.remove()}catch{}}removeDuplicateTargetChildren(){this.duplicateChildren.forEach(e=>e.remove())}get duplicateChildren(){let e=this.targetElements.flatMap(r=>[...r.children]).filter(r=>!!r.id),t=[...this.templateContent?.children||[]].filter(r=>!!r.id).map(r=>r.id);return e.filter(r=>t.includes(r.id))}get performAction(){if(this.action){let e=op[this.action];if(e)return e;this.#e("unknown action")}this.#e("action attribute is missing")}get targetElements(){if(this.target)return this.targetElementsById;if(this.targets)return this.targetElementsByQuery;this.#e("target or targets attribute is missing")}get templateContent(){return this.templateElement.content.cloneNode(!0)}get templateElement(){if(this.firstElementChild===null){let e=this.ownerDocument.createElement("template");return this.appendChild(e),e}else if(this.firstElementChild instanceof HTMLTemplateElement)return this.firstElementChild;this.#e("first child element must be a <template> element")}get action(){return this.getAttribute("action")}get target(){return this.getAttribute("target")}get targets(){return this.getAttribute("targets")}get requestId(){return this.getAttribute("request-id")}#e(e){throw new Error(`${this.description}: ${e}`)}get description(){return(this.outerHTML.match(/<[^>]+>/)??[])[0]??"<turbo-stream>"}get beforeRenderEvent(){return new CustomEvent("turbo:before-stream-render",{bubbles:!0,cancelable:!0,detail:{newStream:this,render:i.renderElement}})}get targetElementsById(){let e=this.ownerDocument?.getElementById(this.target);return e!==null?[e]:[]}get targetElementsByQuery(){let e=this.ownerDocument?.querySelectorAll(this.targets);return e.length!==0?Array.prototype.slice.call(e):[]}},wc=class extends HTMLElement{streamSource=null;connectedCallback(){this.streamSource=this.src.match(/^ws{1,2}:/)?new WebSocket(this.src):new EventSource(this.src),sp(this.streamSource)}disconnectedCallback(){this.streamSource&&(this.streamSource.close(),np(this.streamSource))}get src(){return this.getAttribute("src")||""}};si.delegateConstructor=bc;customElements.get("turbo-frame")===void 0&&customElements.define("turbo-frame",si);customElements.get("turbo-stream")===void 0&&customElements.define("turbo-stream",yc);customElements.get("turbo-stream-source")===void 0&&customElements.define("turbo-stream-source",wc);(()=>{let i=document.currentScript;if(i&&!i.hasAttribute("data-turbo-suppress-warning"))for(i=i.parentElement;i;){if(i==document.body)return console.warn(Vd`
|
|
19
19
|
You are loading Turbo from a <script> element inside the <body> element. This is probably not what you meant to do!
|
|
20
20
|
|
|
21
21
|
Load your application’s JavaScript bundle inside the <head> element instead. <script> elements in <body> are evaluated with each page change.
|
|
@@ -24,38 +24,38 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
24
24
|
|
|
25
25
|
——
|
|
26
26
|
Suppress this warning by adding a "data-turbo-suppress-warning" attribute to: %s
|
|
27
|
-
`,i.outerHTML);i=i.parentElement}})();window.Turbo={...Hy,StreamActions:pp};up();var Oc=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=$y(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 r<s?-1:r>s?1:0})}};function $y(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 Rc=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 Oc(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(":")}},qy={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}},Vy=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function jy(i){let t=i.trim().match(Vy)||[],r=t[2],s=t[3];return s&&!["keydown","keyup","keypress"].includes(r)&&(r+=`.${s}`,s=""),{eventTarget:Wy(t[4]),eventName:r,eventOptions:t[7]?Gy(t[7]):{},identifier:t[5],methodName:t[6],keyFilter:t[1]||s}}function Wy(i){if(i=="window")return window;if(i=="document")return document}function Gy(i){return i.split(":").reduce((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)}),{})}function Ky(i){if(i==window)return"window";if(i==document)return"document"}function eu(i){return i.replace(/(?:[_-])([a-z0-9])/g,(e,t)=>t.toUpperCase())}function Lc(i){return eu(i.replace(/--/g,"-").replace(/__/g,"_"))}function un(i){return i.charAt(0).toUpperCase()+i.slice(1)}function Tp(i){return i.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`)}function Xy(i){return i.match(/[^\s]+/g)||[]}function fp(i){return i!=null}function Mc(i,e){return Object.prototype.hasOwnProperty.call(i,e)}var mp=["meta","ctrl","alt","shift"],Ic=class{constructor(e,t,r,s){this.element=e,this.index=t,this.eventTarget=r.eventTarget||e,this.eventName=r.eventName||Yy(e)||Jo("missing event name"),this.eventOptions=r.eventOptions||{},this.identifier=r.identifier||Jo("missing identifier"),this.methodName=r.methodName||Jo("missing method name"),this.keyFilter=r.keyFilter||"",this.schema=s}static forToken(e,t){return new this(e.element,e.index,jy(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=>!mp.includes(s))[0];return r?(Mc(this.keyMappings,r)||Jo(`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[eu(o)]=Zy(s))}return e}get eventTargetName(){return Ky(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(e,t){let[r,s,n,o]=mp.map(a=>t.includes(a));return e.metaKey!==r||e.ctrlKey!==s||e.altKey!==n||e.shiftKey!==o}},gp={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:i=>i.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function Yy(i){let e=i.tagName.toLowerCase();if(e in gp)return gp[e](i)}function Jo(i){throw new Error(i)}function Zy(i){try{return JSON.parse(i)}catch{return i}}var Dc=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}},ea=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))}},ta=class{constructor(e,t,r){this.attributeName=t,this.delegate=r,this.elementObserver=new ea(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 Qy(i,e,t){xp(i,e).add(t)}function Jy(i,e,t){xp(i,e).delete(t),e0(i,e)}function xp(i,e){let t=i.get(e);return t||(t=new Set,i.set(e,t)),t}function e0(i,e){let t=i.get(e);t!=null&&t.size==0&&i.delete(e)}var Di=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){Qy(this.valuesByKey,e,t)}delete(e,t){Jy(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 Nc=class{constructor(e,t,r,s){this._selector=t,this.details=s,this.elementObserver=new ea(e,this),this.delegate=r,this.matchesByElement=new Di}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)}},Bc=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())}},ia=class{constructor(e,t,r){this.attributeObserver=new ta(e,t,this),this.delegate=r,this.tokensByElement=new Di}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=i0(t,r).findIndex(([n,o])=>!r0(n,o));return s==-1?[[],[]]:[t.slice(s),r.slice(s)]}readTokensForElement(e){let t=this.attributeName,r=e.getAttribute(t)||"";return t0(r,e,t)}};function t0(i,e,t){return i.trim().split(/\s+/).filter(r=>r.length).map((r,s)=>({element:e,attributeName:t,content:r,index:s}))}function i0(i,e){let t=Math.max(i.length,e.length);return Array.from({length:t},(r,s)=>[i[s],e[s]])}function r0(i,e){return i&&e&&i.index==e.index&&i.content==e.content}var ra=class{constructor(e,t,r){this.tokenListObserver=new ia(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}}}},Uc=class{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new ra(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 Dc(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=Ic.forToken(e,this.schema);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}},zc=class{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new Bc(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${un(t.name)}`;return this.receiver[r]}},Hc=class{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new Di}start(){this.tokenListObserver||(this.tokenListObserver=new ia(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 hn(i,e){let t=kp(i);return Array.from(t.reduce((r,s)=>(n0(s,e).forEach(n=>r.add(n)),r),new Set))}function s0(i,e){return kp(i).reduce((r,s)=>(r.push(...o0(s,e)),r),[])}function kp(i){let e=[];for(;i;)e.push(i),i=Object.getPrototypeOf(i);return e.reverse()}function n0(i,e){let t=i[e];return Array.isArray(t)?t:[]}function o0(i,e){let t=i[e];return t?Object.keys(t).map(r=>[r,t[r]]):[]}var $c=class{constructor(e,t){this.started=!1,this.context=e,this.delegate=t,this.outletsByName=new Di,this.outletElementsByName=new Di,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 Nc(document.body,t,this,{outletName:e});this.selectorObserverMap.set(e,r),r.start()}setupAttributeObserverForOutlet(e){let t=this.attributeNameForOutletName(e),r=new ta(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 Di;return this.router.modules.forEach(t=>{let r=t.definition.controllerConstructor;hn(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}},qc=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 Uc(this,this.dispatcher),this.valueObserver=new zc(this,this.controller),this.targetObserver=new Hc(this,this),this.outletObserver=new $c(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(`${Lc(r)}OutletConnected`,e,t)}outletDisconnected(e,t,r){this.invokeControllerMethod(`${Lc(r)}OutletDisconnected`,e,t)}invokeControllerMethod(e,...t){let r=this.controller;typeof r[e]=="function"&&r[e](...t)}};function a0(i){return l0(i,c0(i))}function l0(i,e){let t=p0(i),r=u0(i.prototype,e);return Object.defineProperties(t.prototype,r),t}function c0(i){return hn(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 u0(i,e){return d0(e).reduce((t,r)=>{let s=h0(i,e,r);return s&&Object.assign(t,{[r]:s}),t},{})}function h0(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 d0=typeof Object.getOwnPropertySymbols=="function"?i=>[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)]:Object.getOwnPropertyNames,p0=(()=>{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 f0(i){return{identifier:i.identifier,controllerConstructor:a0(i.controllerConstructor)}}var Vc=class{constructor(e,t){this.application=e,this.definition=f0(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 qc(this,e),this.contextsByScope.set(e,t)),t}},jc=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 Xy(t)}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}},Wc=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}-${Tp(e)}`}},Gc=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 Kc(i,e){return`[${i}~="${e}"]`}var Xc=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 Kc(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 Kc(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}},Yc=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)}},Zc=class i{constructor(e,t,r,s){this.targets=new Xc(this),this.classes=new jc(this),this.data=new Wc(this),this.containsElement=n=>n.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=r,this.guide=new Gc(s),this.outlets=new Yc(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 Kc(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)}},Qc=class{constructor(e,t,r){this.element=e,this.schema=t,this.delegate=r,this.valueListObserver=new ra(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}},Jc=class{constructor(e){this.application=e,this.scopeObserver=new Qc(this.element,this.schema,this),this.scopesByIdentifier=new Di,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 Vc(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 Zc(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))}},m0={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"},vp("abcdefghijklmnopqrstuvwxyz".split("").map(i=>[i,i]))),vp("0123456789".split("").map(i=>[i,i])))};function vp(i){return i.reduce((e,[t,r])=>Object.assign(Object.assign({},e),{[t]:r}),{})}var sa=class{constructor(e=document.documentElement,t=m0){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 Rc(this),this.router=new Jc(this),this.actionDescriptorFilters=Object.assign({},qy)}static start(e,t){let r=new this(e,t);return r.start(),r}async start(){await g0(),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
|
|
27
|
+
`,i.outerHTML);i=i.parentElement}})();window.Turbo={...Ey,StreamActions:op};rp();var Cc=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=Ty(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 r<s?-1:r>s?1:0})}};function Ty(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 Pc=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 Cc(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(":")}},xy={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}},ky=/^(?:(?:([^.]+?)\+)?(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function Ay(i){let t=i.trim().match(ky)||[],r=t[2],s=t[3];return s&&!["keydown","keyup","keypress"].includes(r)&&(r+=`.${s}`,s=""),{eventTarget:Cy(t[4]),eventName:r,eventOptions:t[7]?Py(t[7]):{},identifier:t[5],methodName:t[6],keyFilter:t[1]||s}}function Cy(i){if(i=="window")return window;if(i=="document")return document}function Py(i){return i.split(":").reduce((e,t)=>Object.assign(e,{[t.replace(/^!/,"")]:!/^!/.test(t)}),{})}function Fy(i){if(i==window)return"window";if(i==document)return"document"}function Yc(i){return i.replace(/(?:[_-])([a-z0-9])/g,(e,t)=>t.toUpperCase())}function Fc(i){return Yc(i.replace(/--/g,"-").replace(/__/g,"_"))}function dn(i){return i.charAt(0).toUpperCase()+i.slice(1)}function gp(i){return i.replace(/([A-Z])/g,(e,t)=>`-${t.toLowerCase()}`)}function _y(i){return i.match(/[^\s]+/g)||[]}function ap(i){return i!=null}function _c(i,e){return Object.prototype.hasOwnProperty.call(i,e)}var lp=["meta","ctrl","alt","shift"],Oc=class{constructor(e,t,r,s){this.element=e,this.index=t,this.eventTarget=r.eventTarget||e,this.eventName=r.eventName||Oy(e)||Jo("missing event name"),this.eventOptions=r.eventOptions||{},this.identifier=r.identifier||Jo("missing identifier"),this.methodName=r.methodName||Jo("missing method name"),this.keyFilter=r.keyFilter||"",this.schema=s}static forToken(e,t){return new this(e.element,e.index,Ay(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=>!lp.includes(s))[0];return r?(_c(this.keyMappings,r)||Jo(`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[Yc(o)]=Ly(s))}return e}get eventTargetName(){return Fy(this.eventTarget)}get keyMappings(){return this.schema.keyMappings}keyFilterDissatisfied(e,t){let[r,s,n,o]=lp.map(a=>t.includes(a));return e.metaKey!==r||e.ctrlKey!==s||e.altKey!==n||e.shiftKey!==o}},cp={a:()=>"click",button:()=>"click",form:()=>"submit",details:()=>"toggle",input:i=>i.getAttribute("type")=="submit"?"click":"input",select:()=>"change",textarea:()=>"input"};function Oy(i){let e=i.tagName.toLowerCase();if(e in cp)return cp[e](i)}function Jo(i){throw new Error(i)}function Ly(i){try{return JSON.parse(i)}catch{return i}}var Lc=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}},ea=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))}},ta=class{constructor(e,t,r){this.attributeName=t,this.delegate=r,this.elementObserver=new ea(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 Ry(i,e,t){vp(i,e).add(t)}function My(i,e,t){vp(i,e).delete(t),Iy(i,e)}function vp(i,e){let t=i.get(e);return t||(t=new Set,i.set(e,t)),t}function Iy(i,e){let t=i.get(e);t!=null&&t.size==0&&i.delete(e)}var Ni=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){Ry(this.valuesByKey,e,t)}delete(e,t){My(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 Rc=class{constructor(e,t,r,s){this._selector=t,this.details=s,this.elementObserver=new ea(e,this),this.delegate=r,this.matchesByElement=new Ni}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)}},Mc=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())}},ia=class{constructor(e,t,r){this.attributeObserver=new ta(e,t,this),this.delegate=r,this.tokensByElement=new Ni}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=Ny(t,r).findIndex(([n,o])=>!By(n,o));return s==-1?[[],[]]:[t.slice(s),r.slice(s)]}readTokensForElement(e){let t=this.attributeName,r=e.getAttribute(t)||"";return Dy(r,e,t)}};function Dy(i,e,t){return i.trim().split(/\s+/).filter(r=>r.length).map((r,s)=>({element:e,attributeName:t,content:r,index:s}))}function Ny(i,e){let t=Math.max(i.length,e.length);return Array.from({length:t},(r,s)=>[i[s],e[s]])}function By(i,e){return i&&e&&i.index==e.index&&i.content==e.content}var ra=class{constructor(e,t,r){this.tokenListObserver=new ia(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}}}},Ic=class{constructor(e,t){this.context=e,this.delegate=t,this.bindingsByAction=new Map}start(){this.valueListObserver||(this.valueListObserver=new ra(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 Lc(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=Oc.forToken(e,this.schema);if(t.identifier==this.identifier)return t}elementMatchedValue(e,t){this.connectAction(t)}elementUnmatchedValue(e,t){this.disconnectAction(t)}},Dc=class{constructor(e,t){this.context=e,this.receiver=t,this.stringMapObserver=new Mc(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${dn(t.name)}`;return this.receiver[r]}},Nc=class{constructor(e,t){this.context=e,this.delegate=t,this.targetsByName=new Ni}start(){this.tokenListObserver||(this.tokenListObserver=new ia(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 pn(i,e){let t=bp(i);return Array.from(t.reduce((r,s)=>(zy(s,e).forEach(n=>r.add(n)),r),new Set))}function Uy(i,e){return bp(i).reduce((r,s)=>(r.push(...Hy(s,e)),r),[])}function bp(i){let e=[];for(;i;)e.push(i),i=Object.getPrototypeOf(i);return e.reverse()}function zy(i,e){let t=i[e];return Array.isArray(t)?t:[]}function Hy(i,e){let t=i[e];return t?Object.keys(t).map(r=>[r,t[r]]):[]}var Bc=class{constructor(e,t){this.started=!1,this.context=e,this.delegate=t,this.outletsByName=new Ni,this.outletElementsByName=new Ni,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 Rc(document.body,t,this,{outletName:e});this.selectorObserverMap.set(e,r),r.start()}setupAttributeObserverForOutlet(e){let t=this.attributeNameForOutletName(e),r=new ta(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 Ni;return this.router.modules.forEach(t=>{let r=t.definition.controllerConstructor;pn(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}},Uc=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 Ic(this,this.dispatcher),this.valueObserver=new Dc(this,this.controller),this.targetObserver=new Nc(this,this),this.outletObserver=new Bc(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(`${Fc(r)}OutletConnected`,e,t)}outletDisconnected(e,t,r){this.invokeControllerMethod(`${Fc(r)}OutletDisconnected`,e,t)}invokeControllerMethod(e,...t){let r=this.controller;typeof r[e]=="function"&&r[e](...t)}};function $y(i){return qy(i,Vy(i))}function qy(i,e){let t=Ky(i),r=jy(i.prototype,e);return Object.defineProperties(t.prototype,r),t}function Vy(i){return pn(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 jy(i,e){return Gy(e).reduce((t,r)=>{let s=Wy(i,e,r);return s&&Object.assign(t,{[r]:s}),t},{})}function Wy(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 Gy=typeof Object.getOwnPropertySymbols=="function"?i=>[...Object.getOwnPropertyNames(i),...Object.getOwnPropertySymbols(i)]:Object.getOwnPropertyNames,Ky=(()=>{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 Xy(i){return{identifier:i.identifier,controllerConstructor:$y(i.controllerConstructor)}}var zc=class{constructor(e,t){this.application=e,this.definition=Xy(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 Uc(this,e),this.contextsByScope.set(e,t)),t}},Hc=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 _y(t)}getAttributeName(e){return this.data.getAttributeNameForKey(this.getDataKey(e))}getDataKey(e){return`${e}-class`}get data(){return this.scope.data}},$c=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}-${gp(e)}`}},qc=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 Vc(i,e){return`[${i}~="${e}"]`}var jc=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 Vc(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 Vc(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}},Wc=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)}},Gc=class i{constructor(e,t,r,s){this.targets=new jc(this),this.classes=new Hc(this),this.data=new $c(this),this.containsElement=n=>n.closest(this.controllerSelector)===this.element,this.schema=e,this.element=t,this.identifier=r,this.guide=new qc(s),this.outlets=new Wc(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 Vc(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)}},Kc=class{constructor(e,t,r){this.element=e,this.schema=t,this.delegate=r,this.valueListObserver=new ra(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}},Xc=class{constructor(e){this.application=e,this.scopeObserver=new Kc(this.element,this.schema,this),this.scopesByIdentifier=new Ni,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 zc(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 Gc(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))}},Yy={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"},up("abcdefghijklmnopqrstuvwxyz".split("").map(i=>[i,i]))),up("0123456789".split("").map(i=>[i,i])))};function up(i){return i.reduce((e,[t,r])=>Object.assign(Object.assign({},e),{[t]:r}),{})}var sa=class{constructor(e=document.documentElement,t=Yy){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 Pc(this),this.router=new Xc(this),this.actionDescriptorFilters=Object.assign({},xy)}static start(e,t){let r=new this(e,t);return r.start(),r}async start(){await Zy(),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
|
|
28
28
|
|
|
29
29
|
%o
|
|
30
30
|
|
|
31
|
-
%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 g0(){return new Promise(i=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>i()):i()})}function v0(i){return hn(i,"classes").reduce((t,r)=>Object.assign(t,b0(r)),{})}function b0(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${un(i)}Class`]:{get(){return this.classes.has(i)}}}}function y0(i){return hn(i,"outlets").reduce((t,r)=>Object.assign(t,w0(r)),{})}function bp(i,e,t){return i.application.getControllerForElementAndIdentifier(e,t)}function yp(i,e,t){let r=bp(i,e,t);if(r||(i.application.router.proposeToConnectScopeForElementAndIdentifier(e,t),r=bp(i,e,t),r))return r}function w0(i){let e=Lc(i);return{[`${e}Outlet`]:{get(){let t=this.outlets.find(i),r=this.outlets.getSelectorForOutletName(i);if(t){let s=yp(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=yp(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${un(e)}Outlet`]:{get(){return this.outlets.has(i)}}}}function S0(i){return hn(i,"targets").reduce((t,r)=>Object.assign(t,E0(r)),{})}function E0(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${un(i)}Target`]:{get(){return this.targets.has(i)}}}}function T0(i){let e=s0(i,"values"),t={valueDescriptorMap:{get(){return e.reduce((r,s)=>{let n=Ap(s,this.identifier),o=this.data.getAttributeNameForKey(n.key);return Object.assign(r,{[o]:n})},{})}}};return e.reduce((r,s)=>Object.assign(r,x0(s)),t)}function x0(i,e){let t=Ap(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${un(s)}`]:{get(){return this.data.has(r)||t.hasCustomDefaultValue}}}}function Ap([i,e],t){return C0({controller:t,token:i,typeDefinition:e})}function na(i){switch(i){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function cn(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 k0(i){let{controller:e,token:t,typeObject:r}=i,s=fp(r.type),n=fp(r.default),o=s&&n,a=s&&!n,l=!s&&n,c=na(r.type),d=cn(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 A0(i){let{controller:e,token:t,typeDefinition:r}=i,n=k0({controller:e,token:t,typeObject:r}),o=cn(r),a=na(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 _0(i){let e=na(i);if(e)return wp[e];let t=Mc(i,"default"),r=Mc(i,"type"),s=i;if(t)return s.default;if(r){let{type:n}=s,o=na(n);if(o)return wp[o]}return i}function C0(i){let{token:e,typeDefinition:t}=i,r=`${Tp(e)}-value`,s=A0(i);return{type:s,key:r,name:eu(r),get defaultValue(){return _0(t)},get hasCustomDefaultValue(){return cn(t)!==void 0},reader:P0[s],writer:Sp[s]||Sp.default}}var wp={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},P0={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 "${cn(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 "${cn(e)}"`);return e},string(i){return i}},Sp={default:F0,array:Ep,object:Ep};function Ep(i){return JSON.stringify(i)}function F0(i){return`${i}`}var K=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}};K.blessings=[v0,S0,T0,y0];K.targets=[];K.outlets=[];K.values={};var oa=class extends K{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.#n(this.placementValue).base.forEach(e=>{i.classList.add(e)})}toggleDrawer(){this.visible?this.hideDrawer():this.showDrawer()}showDrawer(){this.edgeValue?this.#a(`${this.placementValue}-edge`,!0):this.#o(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.#a(`${this.placementValue}-edge`,!1):this.#o(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()}#n(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}#o(i,e){let t=this.#n(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)))}#a(i,e){this.#o(i,e)}};var aa=class extends K{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 la=class extends K{connect(){}preSubmit(){let i=document.createElement("input");i.type="hidden",i.name="pre_submit",i.value="true",this.element.appendChild(i),this.element.setAttribute("novalidate",""),this.submit()}submit(){this.element.requestSubmit()}};var Pe="top",$e="bottom",De="right",Re="left",ca="auto",fr=[Pe,$e,De,Re],Ni="start",Ir="end",_p="clippingParents",ua="viewport",_s="popper",Cp="reference",tu=fr.reduce(function(i,e){return i.concat([e+"-"+Ni,e+"-"+Ir])},[]),ha=[].concat(fr,[ca]).reduce(function(i,e){return i.concat([e,e+"-"+Ni,e+"-"+Ir])},[]),O0="beforeRead",R0="read",L0="afterRead",M0="beforeMain",I0="main",D0="afterMain",N0="beforeWrite",B0="write",U0="afterWrite",Pp=[O0,R0,L0,M0,I0,D0,N0,B0,U0];function Xe(i){return i?(i.nodeName||"").toLowerCase():null}function Se(i){if(i==null)return window;if(i.toString()!=="[object Window]"){var e=i.ownerDocument;return e&&e.defaultView||window}return i}function jt(i){var e=Se(i).Element;return i instanceof e||i instanceof Element}function qe(i){var e=Se(i).HTMLElement;return i instanceof e||i instanceof HTMLElement}function Cs(i){if(typeof ShadowRoot>"u")return!1;var e=Se(i).ShadowRoot;return i instanceof e||i instanceof ShadowRoot}function z0(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];!qe(n)||!Xe(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 H0(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},{});!qe(s)||!Xe(s)||(Object.assign(s.style,a),Object.keys(n).forEach(function(l){s.removeAttribute(l)}))})}}var Fp={name:"applyStyles",enabled:!0,phase:"write",fn:z0,effect:H0,requires:["computeStyles"]};function Ye(i){return i.split("-")[0]}var ai=Math.max,Dr=Math.min,Bi=Math.round;function Ps(){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 dn(){return!/^((?!chrome|android).)*safari/i.test(Ps())}function Wt(i,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var r=i.getBoundingClientRect(),s=1,n=1;e&&qe(i)&&(s=i.offsetWidth>0&&Bi(r.width)/i.offsetWidth||1,n=i.offsetHeight>0&&Bi(r.height)/i.offsetHeight||1);var o=jt(i)?Se(i):window,a=o.visualViewport,l=!dn()&&t,c=(r.left+(l&&a?a.offsetLeft:0))/s,d=(r.top+(l&&a?a.offsetTop:0))/n,f=r.width/s,g=r.height/n;return{width:f,height:g,top:d,right:c+f,bottom:d+g,left:c,x:c,y:d}}function Nr(i){var e=Wt(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 pn(i,e){var t=e.getRootNode&&e.getRootNode();if(i.contains(e))return!0;if(t&&Cs(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 Se(i).getComputedStyle(i)}function iu(i){return["table","td","th"].indexOf(Xe(i))>=0}function Je(i){return((jt(i)?i.ownerDocument:i.document)||window.document).documentElement}function Ui(i){return Xe(i)==="html"?i:i.assignedSlot||i.parentNode||(Cs(i)?i.host:null)||Je(i)}function Op(i){return!qe(i)||ft(i).position==="fixed"?null:i.offsetParent}function $0(i){var e=/firefox/i.test(Ps()),t=/Trident/i.test(Ps());if(t&&qe(i)){var r=ft(i);if(r.position==="fixed")return null}var s=Ui(i);for(Cs(s)&&(s=s.host);qe(s)&&["html","body"].indexOf(Xe(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 li(i){for(var e=Se(i),t=Op(i);t&&iu(t)&&ft(t).position==="static";)t=Op(t);return t&&(Xe(t)==="html"||Xe(t)==="body"&&ft(t).position==="static")?e:t||$0(i)||e}function Br(i){return["top","bottom"].indexOf(i)>=0?"x":"y"}function Ur(i,e,t){return ai(i,Dr(e,t))}function Rp(i,e,t){var r=Ur(i,e,t);return r>t?t:r}function fn(){return{top:0,right:0,bottom:0,left:0}}function mn(i){return Object.assign({},fn(),i)}function gn(i,e){return e.reduce(function(t,r){return t[r]=i,t},{})}var q0=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,mn(typeof e!="number"?e:gn(e,fr))};function V0(i){var e,t=i.state,r=i.name,s=i.options,n=t.elements.arrow,o=t.modifiersData.popperOffsets,a=Ye(t.placement),l=Br(a),c=[Re,De].indexOf(a)>=0,d=c?"height":"width";if(!(!n||!o)){var f=q0(s.padding,t),g=Nr(n),b=l==="y"?Pe:Re,w=l==="y"?$e:De,P=t.rects.reference[d]+t.rects.reference[l]-o[l]-t.rects.popper[d],R=o[l]-t.rects.reference[l],C=li(n),k=C?l==="y"?C.clientHeight||0:C.clientWidth||0:0,_=P/2-R/2,E=f[b],A=k-g[d]-f[w],F=k/2-g[d]/2+_,O=Ur(E,F,A),M=l;t.modifiersData[r]=(e={},e[M]=O,e.centerOffset=O-F,e)}}function j0(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)||pn(e.elements.popper,s)&&(e.elements.arrow=s))}var Lp={name:"arrow",enabled:!0,phase:"main",fn:V0,effect:j0,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Gt(i){return i.split("-")[1]}var W0={top:"auto",right:"auto",bottom:"auto",left:"auto"};function G0(i,e){var t=i.x,r=i.y,s=e.devicePixelRatio||1;return{x:Bi(t*s)/s||0,y:Bi(r*s)/s||0}}function Mp(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,g=o.x,b=g===void 0?0:g,w=o.y,P=w===void 0?0:w,R=typeof d=="function"?d({x:b,y:P}):{x:b,y:P};b=R.x,P=R.y;var C=o.hasOwnProperty("x"),k=o.hasOwnProperty("y"),_=Re,E=Pe,A=window;if(c){var F=li(t),O="clientHeight",M="clientWidth";if(F===Se(t)&&(F=Je(t),ft(F).position!=="static"&&a==="absolute"&&(O="scrollHeight",M="scrollWidth")),F=F,s===Pe||(s===Re||s===De)&&n===Ir){E=$e;var H=f&&F===A&&A.visualViewport?A.visualViewport.height:F[O];P-=H-r.height,P*=l?1:-1}if(s===Re||(s===Pe||s===$e)&&n===Ir){_=De;var W=f&&F===A&&A.visualViewport?A.visualViewport.width:F[M];b-=W-r.width,b*=l?1:-1}}var q=Object.assign({position:a},c&&W0),Y=d===!0?G0({x:b,y:P},Se(t)):{x:b,y:P};if(b=Y.x,P=Y.y,l){var ne;return Object.assign({},q,(ne={},ne[E]=k?"0":"",ne[_]=C?"0":"",ne.transform=(A.devicePixelRatio||1)<=1?"translate("+b+"px, "+P+"px)":"translate3d("+b+"px, "+P+"px, 0)",ne))}return Object.assign({},q,(e={},e[E]=k?P+"px":"",e[_]=C?b+"px":"",e.transform="",e))}function K0(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:Ye(e.placement),variation:Gt(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,Mp(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,Mp(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 Ip={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:K0,data:{}};var da={passive:!0};function X0(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=Se(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return n&&c.forEach(function(d){d.addEventListener("scroll",t.update,da)}),a&&l.addEventListener("resize",t.update,da),function(){n&&c.forEach(function(d){d.removeEventListener("scroll",t.update,da)}),a&&l.removeEventListener("resize",t.update,da)}}var Dp={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:X0,data:{}};var Y0={left:"right",right:"left",bottom:"top",top:"bottom"};function Fs(i){return i.replace(/left|right|bottom|top/g,function(e){return Y0[e]})}var Z0={start:"end",end:"start"};function pa(i){return i.replace(/start|end/g,function(e){return Z0[e]})}function zr(i){var e=Se(i),t=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:t,scrollTop:r}}function Hr(i){return Wt(Je(i)).left+zr(i).scrollLeft}function ru(i,e){var t=Se(i),r=Je(i),s=t.visualViewport,n=r.clientWidth,o=r.clientHeight,a=0,l=0;if(s){n=s.width,o=s.height;var c=dn();(c||!c&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:n,height:o,x:a+Hr(i),y:l}}function su(i){var e,t=Je(i),r=zr(i),s=(e=i.ownerDocument)==null?void 0:e.body,n=ai(t.scrollWidth,t.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=ai(t.scrollHeight,t.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-r.scrollLeft+Hr(i),l=-r.scrollTop;return ft(s||t).direction==="rtl"&&(a+=ai(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 fa(i){return["html","body","#document"].indexOf(Xe(i))>=0?i.ownerDocument.body:qe(i)&&$r(i)?i:fa(Ui(i))}function mr(i,e){var t;e===void 0&&(e=[]);var r=fa(i),s=r===((t=i.ownerDocument)==null?void 0:t.body),n=Se(r),o=s?[n].concat(n.visualViewport||[],$r(r)?r:[]):r,a=e.concat(o);return s?a:a.concat(mr(Ui(o)))}function Os(i){return Object.assign({},i,{left:i.x,top:i.y,right:i.x+i.width,bottom:i.y+i.height})}function Q0(i,e){var t=Wt(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 Np(i,e,t){return e===ua?Os(ru(i,t)):jt(e)?Q0(e,t):Os(su(Je(i)))}function J0(i){var e=mr(Ui(i)),t=["absolute","fixed"].indexOf(ft(i).position)>=0,r=t&&qe(i)?li(i):i;return jt(r)?e.filter(function(s){return jt(s)&&pn(s,r)&&Xe(s)!=="body"}):[]}function nu(i,e,t,r){var s=e==="clippingParents"?J0(i):[].concat(e),n=[].concat(s,[t]),o=n[0],a=n.reduce(function(l,c){var d=Np(i,c,r);return l.top=ai(d.top,l.top),l.right=Dr(d.right,l.right),l.bottom=Dr(d.bottom,l.bottom),l.left=ai(d.left,l.left),l},Np(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 vn(i){var e=i.reference,t=i.element,r=i.placement,s=r?Ye(r):null,n=r?Gt(r):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(s){case Pe:l={x:o,y:e.y-t.height};break;case $e:l={x:o,y:e.y+e.height};break;case De:l={x:e.x+e.width,y:a};break;case Re:l={x:e.x-t.width,y:a};break;default:l={x:e.x,y:e.y}}var c=s?Br(s):null;if(c!=null){var d=c==="y"?"height":"width";switch(n){case Ni:l[c]=l[c]-(e[d]/2-t[d]/2);break;case Ir:l[c]=l[c]+(e[d]/2-t[d]/2);break;default:}}return l}function ci(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?_p:a,c=t.rootBoundary,d=c===void 0?ua:c,f=t.elementContext,g=f===void 0?_s:f,b=t.altBoundary,w=b===void 0?!1:b,P=t.padding,R=P===void 0?0:P,C=mn(typeof R!="number"?R:gn(R,fr)),k=g===_s?Cp:_s,_=i.rects.popper,E=i.elements[w?k:g],A=nu(jt(E)?E:E.contextElement||Je(i.elements.popper),l,d,o),F=Wt(i.elements.reference),O=vn({reference:F,element:_,strategy:"absolute",placement:s}),M=Os(Object.assign({},_,O)),H=g===_s?M:F,W={top:A.top-H.top+C.top,bottom:H.bottom-A.bottom+C.bottom,left:A.left-H.left+C.left,right:H.right-A.right+C.right},q=i.modifiersData.offset;if(g===_s&&q){var Y=q[s];Object.keys(W).forEach(function(ne){var se=[De,$e].indexOf(ne)>=0?1:-1,Qe=[Pe,$e].indexOf(ne)>=0?"y":"x";W[ne]+=Y[Qe]*se})}return W}function ou(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?ha:l,d=Gt(r),f=d?a?tu:tu.filter(function(w){return Gt(w)===d}):fr,g=f.filter(function(w){return c.indexOf(w)>=0});g.length===0&&(g=f);var b=g.reduce(function(w,P){return w[P]=ci(i,{placement:P,boundary:s,rootBoundary:n,padding:o})[Ye(P)],w},{});return Object.keys(b).sort(function(w,P){return b[w]-b[P]})}function ew(i){if(Ye(i)===ca)return[];var e=Fs(i);return[pa(i),e,pa(e)]}function tw(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,g=t.altBoundary,b=t.flipVariations,w=b===void 0?!0:b,P=t.allowedAutoPlacements,R=e.options.placement,C=Ye(R),k=C===R,_=l||(k||!w?[Fs(R)]:ew(R)),E=[R].concat(_).reduce(function(nt,J){return nt.concat(Ye(J)===ca?ou(e,{placement:J,boundary:d,rootBoundary:f,padding:c,flipVariations:w,allowedAutoPlacements:P}):J)},[]),A=e.rects.reference,F=e.rects.popper,O=new Map,M=!0,H=E[0],W=0;W<E.length;W++){var q=E[W],Y=Ye(q),ne=Gt(q)===Ni,se=[Pe,$e].indexOf(Y)>=0,Qe=se?"width":"height",Ee=ci(e,{placement:q,boundary:d,rootBoundary:f,altBoundary:g,padding:c}),Me=se?ne?De:Re:ne?$e:Pe;A[Qe]>F[Qe]&&(Me=Fs(Me));var be=Fs(Me),ct=[];if(n&&ct.push(Ee[Y]<=0),a&&ct.push(Ee[Me]<=0,Ee[be]<=0),ct.every(function(nt){return nt})){H=q,M=!1;break}O.set(q,ct)}if(M)for(var Ut=w?3:1,oe=function(J){var ht=E.find(function(zt){var dt=O.get(zt);if(dt)return dt.slice(0,J).every(function(ot){return ot})});if(ht)return H=ht,"break"},ut=Ut;ut>0;ut--){var ae=oe(ut);if(ae==="break")break}e.placement!==H&&(e.modifiersData[r]._skip=!0,e.placement=H,e.reset=!0)}}var Bp={name:"flip",enabled:!0,phase:"main",fn:tw,requiresIfExists:["offset"],data:{_skip:!1}};function Up(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 zp(i){return[Pe,De,$e,Re].some(function(e){return i[e]>=0})}function iw(i){var e=i.state,t=i.name,r=e.rects.reference,s=e.rects.popper,n=e.modifiersData.preventOverflow,o=ci(e,{elementContext:"reference"}),a=ci(e,{altBoundary:!0}),l=Up(o,r),c=Up(a,s,n),d=zp(l),f=zp(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 Hp={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:iw};function rw(i,e,t){var r=Ye(i),s=[Re,Pe].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,[Re,De].indexOf(r)>=0?{x:a,y:o}:{x:o,y:a}}function sw(i){var e=i.state,t=i.options,r=i.name,s=t.offset,n=s===void 0?[0,0]:s,o=ha.reduce(function(d,f){return d[f]=rw(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 $p={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:sw};function nw(i){var e=i.state,t=i.name;e.modifiersData[t]=vn({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}var qp={name:"popperOffsets",enabled:!0,phase:"read",fn:nw,data:{}};function au(i){return i==="x"?"y":"x"}function ow(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,g=t.tether,b=g===void 0?!0:g,w=t.tetherOffset,P=w===void 0?0:w,R=ci(e,{boundary:l,rootBoundary:c,padding:f,altBoundary:d}),C=Ye(e.placement),k=Gt(e.placement),_=!k,E=Br(C),A=au(E),F=e.modifiersData.popperOffsets,O=e.rects.reference,M=e.rects.popper,H=typeof P=="function"?P(Object.assign({},e.rects,{placement:e.placement})):P,W=typeof H=="number"?{mainAxis:H,altAxis:H}:Object.assign({mainAxis:0,altAxis:0},H),q=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,Y={x:0,y:0};if(F){if(n){var ne,se=E==="y"?Pe:Re,Qe=E==="y"?$e:De,Ee=E==="y"?"height":"width",Me=F[E],be=Me+R[se],ct=Me-R[Qe],Ut=b?-M[Ee]/2:0,oe=k===Ni?O[Ee]:M[Ee],ut=k===Ni?-M[Ee]:-O[Ee],ae=e.elements.arrow,nt=b&&ae?Nr(ae):{width:0,height:0},J=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:fn(),ht=J[se],zt=J[Qe],dt=Ur(0,O[Ee],nt[Ee]),ot=_?O[Ee]/2-Ut-dt-ht-W.mainAxis:oe-dt-ht-W.mainAxis,rr=_?-O[Ee]/2+Ut+dt+zt+W.mainAxis:ut+dt+zt+W.mainAxis,gi=e.elements.arrow&&li(e.elements.arrow),Qt=gi?E==="y"?gi.clientTop||0:gi.clientLeft||0:0,Ai=(ne=q?.[E])!=null?ne:0,Jt=Me+ot-Ai-Qt,kr=Me+rr-Ai,_i=Ur(b?Dr(be,Jt):be,Me,b?ai(ct,kr):ct);F[E]=_i,Y[E]=_i-Me}if(a){var Ht,Ci=E==="x"?Pe:Re,Pi=E==="x"?$e:De,Ft=F[A],vi=A==="y"?"height":"width",sr=Ft+R[Ci],Fi=Ft-R[Pi],ei=[Pe,Re].indexOf(C)!==-1,ti=(Ht=q?.[A])!=null?Ht:0,ii=ei?sr:Ft-O[vi]-M[vi]-ti+W.altAxis,Ar=ei?Ft+O[vi]+M[vi]-ti-W.altAxis:Fi,nr=b&&ei?Rp(ii,Ft,Ar):Ur(b?ii:sr,Ft,b?Ar:Fi);F[A]=nr,Y[A]=nr-Ft}e.modifiersData[r]=Y}}var Vp={name:"preventOverflow",enabled:!0,phase:"main",fn:ow,requiresIfExists:["offset"]};function lu(i){return{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}}function cu(i){return i===Se(i)||!qe(i)?zr(i):lu(i)}function aw(i){var e=i.getBoundingClientRect(),t=Bi(e.width)/i.offsetWidth||1,r=Bi(e.height)/i.offsetHeight||1;return t!==1||r!==1}function uu(i,e,t){t===void 0&&(t=!1);var r=qe(e),s=qe(e)&&aw(e),n=Je(e),o=Wt(i,s,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!t)&&((Xe(e)!=="body"||$r(n))&&(a=cu(e)),qe(e)?(l=Wt(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):n&&(l.x=Hr(n))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function lw(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 hu(i){var e=lw(i);return Pp.reduce(function(t,r){return t.concat(e.filter(function(s){return s.phase===r}))},[])}function du(i){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(i())})})),e}}function pu(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 jp={placement:"bottom",modifiers:[],strategy:"absolute"};function Wp(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return!e.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function Gp(i){i===void 0&&(i={});var e=i,t=e.defaultModifiers,r=t===void 0?[]:t,s=e.defaultOptions,n=s===void 0?jp:s;return function(a,l,c){c===void 0&&(c=n);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},jp,n),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},f=[],g=!1,b={state:d,setOptions:function(C){var k=typeof C=="function"?C(d.options):C;P(),d.options=Object.assign({},n,d.options,k),d.scrollParents={reference:jt(a)?mr(a):a.contextElement?mr(a.contextElement):[],popper:mr(l)};var _=hu(pu([].concat(r,d.options.modifiers)));return d.orderedModifiers=_.filter(function(E){return E.enabled}),w(),b.update()},forceUpdate:function(){if(!g){var C=d.elements,k=C.reference,_=C.popper;if(Wp(k,_)){d.rects={reference:uu(k,li(_),d.options.strategy==="fixed"),popper:Nr(_)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(W){return d.modifiersData[W.name]=Object.assign({},W.data)});for(var E=0;E<d.orderedModifiers.length;E++){if(d.reset===!0){d.reset=!1,E=-1;continue}var A=d.orderedModifiers[E],F=A.fn,O=A.options,M=O===void 0?{}:O,H=A.name;typeof F=="function"&&(d=F({state:d,options:M,name:H,instance:b})||d)}}}},update:du(function(){return new Promise(function(R){b.forceUpdate(),R(d)})}),destroy:function(){P(),g=!0}};if(!Wp(a,l))return b;b.setOptions(c).then(function(R){!g&&c.onFirstUpdate&&c.onFirstUpdate(R)});function w(){d.orderedModifiers.forEach(function(R){var C=R.name,k=R.options,_=k===void 0?{}:k,E=R.effect;if(typeof E=="function"){var A=E({state:d,name:C,instance:b,options:_}),F=function(){};f.push(A||F)}})}function P(){f.forEach(function(R){return R()}),f=[]}return b}}var cw=[Dp,qp,Ip,Fp,$p,Bp,Vp,Lp,Hp],fu=Gp({defaultModifiers:cw});var ma=class extends K{static targets=["trigger","menu"];static values={placement:{type:String,default:"bottom"}};connect(){this.visible=!1,this.initialized=!1,this.options={placement:this.placementValue,triggerType:"click",offsetSkidding:0,offsetDistance:10,delay:300,ignoreClickOutsideClass:!1},this.init()}init(){this.triggerTarget&&this.menuTarget&&!this.initialized&&(this.popperInstance=fu(this.triggerTarget,this.menuTarget,{strategy:"fixed",placement:this.options.placement,modifiers:[{name:"offset",options:{offset:[this.options.offsetSkidding,this.options.offsetDistance]}},{name:"flip",options:{fallbackPlacements:["left-end","right-start","right-end","bottom-start","bottom-end","top-start","top-end"],boundary:"clippingParents"}},{name:"preventOverflow",options:{boundary:"clippingParents",altAxis:!0,padding:8}}]}),this.setupEventListeners(),this.initialized=!0)}disconnect(){this.initialized&&(this.options.triggerType==="click"&&this.triggerTarget.removeEventListener("click",this.clickHandler),this.options.triggerType==="hover"&&(this.triggerTarget.removeEventListener("mouseenter",this.hoverShowTriggerHandler),this.menuTarget.removeEventListener("mouseenter",this.hoverShowMenuHandler),this.triggerTarget.removeEventListener("mouseleave",this.hoverHideHandler),this.menuTarget.removeEventListener("mouseleave",this.hoverHideHandler)),this.removeClickOutsideListener(),this.popperInstance.destroy(),this.initialized=!1)}setupEventListeners(){this.clickHandler=this.toggle.bind(this),this.hoverShowTriggerHandler=i=>{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(o=>{if(o.contains(e)){r=!0;return}});let s=e.closest(".flatpickr-calendar, .ss-main, .ss-content");e!==this.menuTarget&&!this.menuTarget.contains(e)&&!this.triggerTarget.contains(e)&&!r&&!s&&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 ga=class extends K{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 va=class extends K{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 ba=class extends K{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.#n(),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")}#n(){this.hasHomeButtonTarget&&(this.homeButtonTarget.style.display=this.srcHistory.length>2?"":"none"),this.hasBackButtonTarget&&(this.backButtonTarget.style.display=this.srcHistory.length>1?"":"none")}};var ya=class extends K{static values={current:String};connect(){let i=localStorage.getItem("theme")||"light";this.setMode(i),this.handleStorageChange=e=>{console.log("Storage event received in color-mode controller:",e.key,e.newValue,e.oldValue),e.key==="theme"&&e.newValue&&(console.log("Updating color-mode theme to:",e.newValue),this.setMode(e.newValue))},window.addEventListener("storage",this.handleStorageChange)}disconnect(){window.removeEventListener("storage",this.handleStorageChange)}toggleMode(){let e=(this.currentValue||"light")==="light"?"dark":"light";this.setMode(e)}setMode(i){i==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),this.currentValue=i,this.toggleIcons(i),localStorage.setItem("theme",i)}toggleIcons(i){let e=this.element.querySelector(".color-mode-icon-light"),t=this.element.querySelector(".color-mode-icon-dark");e&&t&&(i==="light"?(e.classList.remove("hidden"),t.classList.add("hidden")):(e.classList.add("hidden"),t.classList.remove("hidden")))}};var{entries:sf,setPrototypeOf:Kp,isFrozen:uw,getPrototypeOf:hw,getOwnPropertyDescriptor:dw}=Object,{freeze:gt,seal:Kt,create:nf}=Object,{apply:wu,construct:Su}=typeof Reflect<"u"&&Reflect;gt||(gt=function(e){return e});Kt||(Kt=function(e){return e});wu||(wu=function(e,t,r){return e.apply(t,r)});Su||(Su=function(e,t){return new e(...t)});var wa=vt(Array.prototype.forEach),pw=vt(Array.prototype.lastIndexOf),Xp=vt(Array.prototype.pop),bn=vt(Array.prototype.push),fw=vt(Array.prototype.splice),Ea=vt(String.prototype.toLowerCase),mu=vt(String.prototype.toString),Yp=vt(String.prototype.match),yn=vt(String.prototype.replace),mw=vt(String.prototype.indexOf),gw=vt(String.prototype.trim),ui=vt(Object.prototype.hasOwnProperty),mt=vt(RegExp.prototype.test),wn=vw(TypeError);function vt(i){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];return wu(i,e,r)}}function vw(i){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return Su(i,t)}}function ee(i,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ea;Kp&&Kp(i,null);let r=e.length;for(;r--;){let s=e[r];if(typeof s=="string"){let n=t(s);n!==s&&(uw(e)||(e[r]=n),s=n)}i[s]=!0}return i}function bw(i){for(let e=0;e<i.length;e++)ui(i,e)||(i[e]=null);return i}function zi(i){let e=nf(null);for(let[t,r]of sf(i))ui(i,t)&&(Array.isArray(r)?e[t]=bw(r):r&&typeof r=="object"&&r.constructor===Object?e[t]=zi(r):e[t]=r);return e}function Sn(i,e){for(;i!==null;){let r=dw(i,e);if(r){if(r.get)return vt(r.get);if(typeof r.value=="function")return vt(r.value)}i=hw(i)}function t(){return null}return t}var Zp=gt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),gu=gt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),vu=gt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),yw=gt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),bu=gt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),ww=gt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Qp=gt(["#text"]),Jp=gt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),yu=gt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),ef=gt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Sa=gt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Sw=Kt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),Ew=Kt(/<%[\w\W]*|[\w\W]*%>/gm),Tw=Kt(/\$\{[\w\W]*/gm),xw=Kt(/^data-[\-\w.\u00B7-\uFFFF]+$/),kw=Kt(/^aria-[\-\w]+$/),of=Kt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Aw=Kt(/^(?:\w+script|data):/i),_w=Kt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),af=Kt(/^html$/i),Cw=Kt(/^[a-z][.\w]*(-[.\w]+)+$/i),tf=Object.freeze({__proto__:null,ARIA_ATTR:kw,ATTR_WHITESPACE:_w,CUSTOM_ELEMENT:Cw,DATA_ATTR:xw,DOCTYPE_NAME:af,ERB_EXPR:Ew,IS_ALLOWED_URI:of,IS_SCRIPT_OR_DATA:Aw,MUSTACHE_EXPR:Sw,TMPLIT_EXPR:Tw}),En={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Pw=function(){return typeof window>"u"?null:window},Fw=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}},rf=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function lf(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Pw(),e=G=>lf(G);if(e.version="3.2.6",e.removed=[],!i||!i.document||i.document.nodeType!==En.document||!i.Element)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:g,trustedTypes:b}=i,w=l.prototype,P=Sn(w,"cloneNode"),R=Sn(w,"remove"),C=Sn(w,"nextSibling"),k=Sn(w,"childNodes"),_=Sn(w,"parentNode");if(typeof o=="function"){let G=t.createElement("template");G.content&&G.content.ownerDocument&&(t=G.content.ownerDocument)}let E,A="",{implementation:F,createNodeIterator:O,createDocumentFragment:M,getElementsByTagName:H}=t,{importNode:W}=r,q=rf();e.isSupported=typeof sf=="function"&&typeof _=="function"&&F&&F.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:Y,ERB_EXPR:ne,TMPLIT_EXPR:se,DATA_ATTR:Qe,ARIA_ATTR:Ee,IS_SCRIPT_OR_DATA:Me,ATTR_WHITESPACE:be,CUSTOM_ELEMENT:ct}=tf,{IS_ALLOWED_URI:Ut}=tf,oe=null,ut=ee({},[...Zp,...gu,...vu,...bu,...Qp]),ae=null,nt=ee({},[...Jp,...yu,...ef,...Sa]),J=Object.seal(nf(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}})),ht=null,zt=null,dt=!0,ot=!0,rr=!1,gi=!0,Qt=!1,Ai=!0,Jt=!1,kr=!1,_i=!1,Ht=!1,Ci=!1,Pi=!1,Ft=!0,vi=!1,sr="user-content-",Fi=!0,ei=!1,ti={},ii=null,Ar=ee({},["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"]),nr=null,Ys=ee({},["audio","video","img","source","image","track"]),gs=null,Mo=ee({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),vs="http://www.w3.org/1998/Math/MathML",Z="http://www.w3.org/2000/svg",$t="http://www.w3.org/1999/xhtml",bi=$t,ri=!1,Zs=null,or=ee({},[vs,Z,$t],mu),Ue=ee({},["mi","mo","mn","ms","mtext"]),bs=ee({},["annotation-xml"]),Io=ee({},["title","style","font","a","script"]),ge=null,ve=["application/xhtml+xml","text/html"],Hl="text/html",ye=null,ar=null,yi=t.createElement("form"),Do=function(S){return S instanceof RegExp||S instanceof Function},_e=function(){let S=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(ar&&ar===S)){if((!S||typeof S!="object")&&(S={}),S=zi(S),ge=ve.indexOf(S.PARSER_MEDIA_TYPE)===-1?Hl:S.PARSER_MEDIA_TYPE,ye=ge==="application/xhtml+xml"?mu:Ea,oe=ui(S,"ALLOWED_TAGS")?ee({},S.ALLOWED_TAGS,ye):ut,ae=ui(S,"ALLOWED_ATTR")?ee({},S.ALLOWED_ATTR,ye):nt,Zs=ui(S,"ALLOWED_NAMESPACES")?ee({},S.ALLOWED_NAMESPACES,mu):or,gs=ui(S,"ADD_URI_SAFE_ATTR")?ee(zi(Mo),S.ADD_URI_SAFE_ATTR,ye):Mo,nr=ui(S,"ADD_DATA_URI_TAGS")?ee(zi(Ys),S.ADD_DATA_URI_TAGS,ye):Ys,ii=ui(S,"FORBID_CONTENTS")?ee({},S.FORBID_CONTENTS,ye):Ar,ht=ui(S,"FORBID_TAGS")?ee({},S.FORBID_TAGS,ye):zi({}),zt=ui(S,"FORBID_ATTR")?ee({},S.FORBID_ATTR,ye):zi({}),ti=ui(S,"USE_PROFILES")?S.USE_PROFILES:!1,dt=S.ALLOW_ARIA_ATTR!==!1,ot=S.ALLOW_DATA_ATTR!==!1,rr=S.ALLOW_UNKNOWN_PROTOCOLS||!1,gi=S.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Qt=S.SAFE_FOR_TEMPLATES||!1,Ai=S.SAFE_FOR_XML!==!1,Jt=S.WHOLE_DOCUMENT||!1,Ht=S.RETURN_DOM||!1,Ci=S.RETURN_DOM_FRAGMENT||!1,Pi=S.RETURN_TRUSTED_TYPE||!1,_i=S.FORCE_BODY||!1,Ft=S.SANITIZE_DOM!==!1,vi=S.SANITIZE_NAMED_PROPS||!1,Fi=S.KEEP_CONTENT!==!1,ei=S.IN_PLACE||!1,Ut=S.ALLOWED_URI_REGEXP||of,bi=S.NAMESPACE||$t,Ue=S.MATHML_TEXT_INTEGRATION_POINTS||Ue,bs=S.HTML_INTEGRATION_POINTS||bs,J=S.CUSTOM_ELEMENT_HANDLING||{},S.CUSTOM_ELEMENT_HANDLING&&Do(S.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(J.tagNameCheck=S.CUSTOM_ELEMENT_HANDLING.tagNameCheck),S.CUSTOM_ELEMENT_HANDLING&&Do(S.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(J.attributeNameCheck=S.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),S.CUSTOM_ELEMENT_HANDLING&&typeof S.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(J.allowCustomizedBuiltInElements=S.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Qt&&(ot=!1),Ci&&(Ht=!0),ti&&(oe=ee({},Qp),ae=[],ti.html===!0&&(ee(oe,Zp),ee(ae,Jp)),ti.svg===!0&&(ee(oe,gu),ee(ae,yu),ee(ae,Sa)),ti.svgFilters===!0&&(ee(oe,vu),ee(ae,yu),ee(ae,Sa)),ti.mathMl===!0&&(ee(oe,bu),ee(ae,ef),ee(ae,Sa))),S.ADD_TAGS&&(oe===ut&&(oe=zi(oe)),ee(oe,S.ADD_TAGS,ye)),S.ADD_ATTR&&(ae===nt&&(ae=zi(ae)),ee(ae,S.ADD_ATTR,ye)),S.ADD_URI_SAFE_ATTR&&ee(gs,S.ADD_URI_SAFE_ATTR,ye),S.FORBID_CONTENTS&&(ii===Ar&&(ii=zi(ii)),ee(ii,S.FORBID_CONTENTS,ye)),Fi&&(oe["#text"]=!0),Jt&&ee(oe,["html","head","body"]),oe.table&&(ee(oe,["tbody"]),delete ht.tbody),S.TRUSTED_TYPES_POLICY){if(typeof S.TRUSTED_TYPES_POLICY.createHTML!="function")throw wn('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof S.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw wn('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');E=S.TRUSTED_TYPES_POLICY,A=E.createHTML("")}else E===void 0&&(E=Fw(b,s)),E!==null&&typeof A=="string"&&(A=E.createHTML(""));gt&>(S),ar=S}},Ot=ee({},[...gu,...vu,...yw]),Oi=ee({},[...bu,...ww]),$l=function(S){let B=_(S);(!B||!B.tagName)&&(B={namespaceURI:bi,tagName:"template"});let j=Ea(S.tagName),pe=Ea(B.tagName);return Zs[S.namespaceURI]?S.namespaceURI===Z?B.namespaceURI===$t?j==="svg":B.namespaceURI===vs?j==="svg"&&(pe==="annotation-xml"||Ue[pe]):!!Ot[j]:S.namespaceURI===vs?B.namespaceURI===$t?j==="math":B.namespaceURI===Z?j==="math"&&bs[pe]:!!Oi[j]:S.namespaceURI===$t?B.namespaceURI===Z&&!bs[pe]||B.namespaceURI===vs&&!Ue[pe]?!1:!Oi[j]&&(Io[j]||!Ot[j]):!!(ge==="application/xhtml+xml"&&Zs[S.namespaceURI]):!1},kt=function(S){bn(e.removed,{element:S});try{_(S).removeChild(S)}catch{R(S)}},wi=function(S,B){try{bn(e.removed,{attribute:B.getAttributeNode(S),from:B})}catch{bn(e.removed,{attribute:null,from:B})}if(B.removeAttribute(S),S==="is")if(Ht||Ci)try{kt(B)}catch{}else try{B.setAttribute(S,"")}catch{}},lr=function(S){let B=null,j=null;if(_i)S="<remove></remove>"+S;else{let fe=Yp(S,/^[\r\n\t ]+/);j=fe&&fe[0]}ge==="application/xhtml+xml"&&bi===$t&&(S='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+S+"</body></html>");let pe=E?E.createHTML(S):S;if(bi===$t)try{B=new g().parseFromString(pe,ge)}catch{}if(!B||!B.documentElement){B=F.createDocument(bi,"template",null);try{B.documentElement.innerHTML=ri?A:pe}catch{}}let Ve=B.body||B.documentElement;return S&&j&&Ve.insertBefore(t.createTextNode(j),Ve.childNodes[0]||null),bi===$t?H.call(B,Jt?"html":"body")[0]:Jt?B.documentElement:Ve},No=function(S){return O.call(S.ownerDocument||S,S,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},ys=function(S){return S instanceof f&&(typeof S.nodeName!="string"||typeof S.textContent!="string"||typeof S.removeChild!="function"||!(S.attributes instanceof d)||typeof S.removeAttribute!="function"||typeof S.setAttribute!="function"||typeof S.namespaceURI!="string"||typeof S.insertBefore!="function"||typeof S.hasChildNodes!="function")},Qs=function(S){return typeof a=="function"&&S instanceof a};function Fe(G,S,B){wa(G,j=>{j.call(e,S,B,ar)})}let pt=function(S){let B=null;if(Fe(q.beforeSanitizeElements,S,null),ys(S))return kt(S),!0;let j=ye(S.nodeName);if(Fe(q.uponSanitizeElement,S,{tagName:j,allowedTags:oe}),Ai&&S.hasChildNodes()&&!Qs(S.firstElementChild)&&mt(/<[/\w!]/g,S.innerHTML)&&mt(/<[/\w!]/g,S.textContent)||S.nodeType===En.progressingInstruction||Ai&&S.nodeType===En.comment&&mt(/<[/\w]/g,S.data))return kt(S),!0;if(!oe[j]||ht[j]){if(!ht[j]&&Js(j)&&(J.tagNameCheck instanceof RegExp&&mt(J.tagNameCheck,j)||J.tagNameCheck instanceof Function&&J.tagNameCheck(j)))return!1;if(Fi&&!ii[j]){let pe=_(S)||S.parentNode,Ve=k(S)||S.childNodes;if(Ve&&pe){let fe=Ve.length;for(let at=fe-1;at>=0;--at){let si=P(Ve[at],!0);si.__removalCount=(S.__removalCount||0)+1,pe.insertBefore(si,C(S))}}}return kt(S),!0}return S instanceof l&&!$l(S)||(j==="noscript"||j==="noembed"||j==="noframes")&&mt(/<\/no(script|embed|frames)/i,S.innerHTML)?(kt(S),!0):(Qt&&S.nodeType===En.text&&(B=S.textContent,wa([Y,ne,se],pe=>{B=yn(B,pe," ")}),S.textContent!==B&&(bn(e.removed,{element:S.cloneNode()}),S.textContent=B)),Fe(q.afterSanitizeElements,S,null),!1)},Ri=function(S,B,j){if(Ft&&(B==="id"||B==="name")&&(j in t||j in yi))return!1;if(!(ot&&!zt[B]&&mt(Qe,B))){if(!(dt&&mt(Ee,B))){if(!ae[B]||zt[B]){if(!(Js(S)&&(J.tagNameCheck instanceof RegExp&&mt(J.tagNameCheck,S)||J.tagNameCheck instanceof Function&&J.tagNameCheck(S))&&(J.attributeNameCheck instanceof RegExp&&mt(J.attributeNameCheck,B)||J.attributeNameCheck instanceof Function&&J.attributeNameCheck(B))||B==="is"&&J.allowCustomizedBuiltInElements&&(J.tagNameCheck instanceof RegExp&&mt(J.tagNameCheck,j)||J.tagNameCheck instanceof Function&&J.tagNameCheck(j))))return!1}else if(!gs[B]){if(!mt(Ut,yn(j,be,""))){if(!((B==="src"||B==="xlink:href"||B==="href")&&S!=="script"&&mw(j,"data:")===0&&nr[S])){if(!(rr&&!mt(Me,yn(j,be,"")))){if(j)return!1}}}}}}return!0},Js=function(S){return S!=="annotation-xml"&&Yp(S,ct)},ws=function(S){Fe(q.beforeSanitizeAttributes,S,null);let{attributes:B}=S;if(!B||ys(S))return;let j={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:ae,forceKeepAttr:void 0},pe=B.length;for(;pe--;){let Ve=B[pe],{name:fe,namespaceURI:at,value:si}=Ve,cr=ye(fe),en=si,je=fe==="value"?en:gw(en);if(j.attrName=cr,j.attrValue=je,j.keepAttr=!0,j.forceKeepAttr=void 0,Fe(q.uponSanitizeAttribute,S,j),je=j.attrValue,vi&&(cr==="id"||cr==="name")&&(wi(fe,S),je=sr+je),Ai&&mt(/((--!?|])>)|<\/(style|title)/i,je)){wi(fe,S);continue}if(j.forceKeepAttr)continue;if(!j.keepAttr){wi(fe,S);continue}if(!gi&&mt(/\/>/i,je)){wi(fe,S);continue}Qt&&wa([Y,ne,se],Uo=>{je=yn(je,Uo," ")});let Bo=ye(S.nodeName);if(!Ri(Bo,cr,je)){wi(fe,S);continue}if(E&&typeof b=="object"&&typeof b.getAttributeType=="function"&&!at)switch(b.getAttributeType(Bo,cr)){case"TrustedHTML":{je=E.createHTML(je);break}case"TrustedScriptURL":{je=E.createScriptURL(je);break}}if(je!==en)try{at?S.setAttributeNS(at,fe,je):S.setAttribute(fe,je),ys(S)?kt(S):Xp(e.removed)}catch{wi(fe,S)}}Fe(q.afterSanitizeAttributes,S,null)},ql=function G(S){let B=null,j=No(S);for(Fe(q.beforeSanitizeShadowDOM,S,null);B=j.nextNode();)Fe(q.uponSanitizeShadowNode,B,null),pt(B),ws(B),B.content instanceof n&&G(B.content);Fe(q.afterSanitizeShadowDOM,S,null)};return e.sanitize=function(G){let S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},B=null,j=null,pe=null,Ve=null;if(ri=!G,ri&&(G="<!-->"),typeof G!="string"&&!Qs(G))if(typeof G.toString=="function"){if(G=G.toString(),typeof G!="string")throw wn("dirty is not a string, aborting")}else throw wn("toString is not a function");if(!e.isSupported)return G;if(kr||_e(S),e.removed=[],typeof G=="string"&&(ei=!1),ei){if(G.nodeName){let si=ye(G.nodeName);if(!oe[si]||ht[si])throw wn("root node is forbidden and cannot be sanitized in-place")}}else if(G instanceof a)B=lr("<!---->"),j=B.ownerDocument.importNode(G,!0),j.nodeType===En.element&&j.nodeName==="BODY"||j.nodeName==="HTML"?B=j:B.appendChild(j);else{if(!Ht&&!Qt&&!Jt&&G.indexOf("<")===-1)return E&&Pi?E.createHTML(G):G;if(B=lr(G),!B)return Ht?null:Pi?A:""}B&&_i&&kt(B.firstChild);let fe=No(ei?G:B);for(;pe=fe.nextNode();)pt(pe),ws(pe),pe.content instanceof n&&ql(pe.content);if(ei)return G;if(Ht){if(Ci)for(Ve=M.call(B.ownerDocument);B.firstChild;)Ve.appendChild(B.firstChild);else Ve=B;return(ae.shadowroot||ae.shadowrootmode)&&(Ve=W.call(r,Ve,!0)),Ve}let at=Jt?B.outerHTML:B.innerHTML;return Jt&&oe["!doctype"]&&B.ownerDocument&&B.ownerDocument.doctype&&B.ownerDocument.doctype.name&&mt(af,B.ownerDocument.doctype.name)&&(at="<!DOCTYPE "+B.ownerDocument.doctype.name+`>
|
|
32
|
-
`+
|
|
33
|
-
]`).replace("lheading",
|
|
31
|
+
%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 Zy(){return new Promise(i=>{document.readyState=="loading"?document.addEventListener("DOMContentLoaded",()=>i()):i()})}function Qy(i){return pn(i,"classes").reduce((t,r)=>Object.assign(t,Jy(r)),{})}function Jy(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${dn(i)}Class`]:{get(){return this.classes.has(i)}}}}function e0(i){return pn(i,"outlets").reduce((t,r)=>Object.assign(t,t0(r)),{})}function hp(i,e,t){return i.application.getControllerForElementAndIdentifier(e,t)}function dp(i,e,t){let r=hp(i,e,t);if(r||(i.application.router.proposeToConnectScopeForElementAndIdentifier(e,t),r=hp(i,e,t),r))return r}function t0(i){let e=Fc(i);return{[`${e}Outlet`]:{get(){let t=this.outlets.find(i),r=this.outlets.getSelectorForOutletName(i);if(t){let s=dp(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=dp(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${dn(e)}Outlet`]:{get(){return this.outlets.has(i)}}}}function i0(i){return pn(i,"targets").reduce((t,r)=>Object.assign(t,r0(r)),{})}function r0(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${dn(i)}Target`]:{get(){return this.targets.has(i)}}}}function s0(i){let e=Uy(i,"values"),t={valueDescriptorMap:{get(){return e.reduce((r,s)=>{let n=yp(s,this.identifier),o=this.data.getAttributeNameForKey(n.key);return Object.assign(r,{[o]:n})},{})}}};return e.reduce((r,s)=>Object.assign(r,n0(s)),t)}function n0(i,e){let t=yp(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${dn(s)}`]:{get(){return this.data.has(r)||t.hasCustomDefaultValue}}}}function yp([i,e],t){return c0({controller:t,token:i,typeDefinition:e})}function na(i){switch(i){case Array:return"array";case Boolean:return"boolean";case Number:return"number";case Object:return"object";case String:return"string"}}function hn(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 o0(i){let{controller:e,token:t,typeObject:r}=i,s=ap(r.type),n=ap(r.default),o=s&&n,a=s&&!n,l=!s&&n,c=na(r.type),d=hn(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 a0(i){let{controller:e,token:t,typeDefinition:r}=i,n=o0({controller:e,token:t,typeObject:r}),o=hn(r),a=na(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 l0(i){let e=na(i);if(e)return pp[e];let t=_c(i,"default"),r=_c(i,"type"),s=i;if(t)return s.default;if(r){let{type:n}=s,o=na(n);if(o)return pp[o]}return i}function c0(i){let{token:e,typeDefinition:t}=i,r=`${gp(e)}-value`,s=a0(i);return{type:s,key:r,name:Yc(r),get defaultValue(){return l0(t)},get hasCustomDefaultValue(){return hn(t)!==void 0},reader:u0[s],writer:fp[s]||fp.default}}var pp={get array(){return[]},boolean:!1,number:0,get object(){return{}},string:""},u0={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 "${hn(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 "${hn(e)}"`);return e},string(i){return i}},fp={default:h0,array:mp,object:mp};function mp(i){return JSON.stringify(i)}function h0(i){return`${i}`}var J=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}};J.blessings=[Qy,i0,s0,e0];J.targets=[];J.outlets=[];J.values={};var oa=class extends J{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.#n(this.placementValue).base.forEach(e=>{i.classList.add(e)})}toggleDrawer(){this.visible?this.hideDrawer():this.showDrawer()}showDrawer(){this.edgeValue?this.#a(`${this.placementValue}-edge`,!0):this.#o(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.#a(`${this.placementValue}-edge`,!1):this.#o(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()}#n(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}#o(i,e){let t=this.#n(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)))}#a(i,e){this.#o(i,e)}};var aa=class extends J{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 la=class extends J{connect(){}preSubmit(){let i=document.createElement("input");i.type="hidden",i.name="pre_submit",i.value="true",this.element.appendChild(i),this.element.setAttribute("novalidate",""),this.submit()}submit(){this.element.requestSubmit()}};var Ie="top",Ye="bottom",qe="right",Ue="left",ca="auto",pr=[Ie,Ye,qe,Ue],Bi="start",Or="end",wp="clippingParents",ua="viewport",Cs="popper",Sp="reference",Zc=pr.reduce(function(i,e){return i.concat([e+"-"+Bi,e+"-"+Or])},[]),ha=[].concat(pr,[ca]).reduce(function(i,e){return i.concat([e,e+"-"+Bi,e+"-"+Or])},[]),d0="beforeRead",p0="read",f0="afterRead",m0="beforeMain",g0="main",v0="afterMain",b0="beforeWrite",y0="write",w0="afterWrite",Ep=[d0,p0,f0,m0,g0,v0,b0,y0,w0];function it(i){return i?(i.nodeName||"").toLowerCase():null}function Pe(i){if(i==null)return window;if(i.toString()!=="[object Window]"){var e=i.ownerDocument;return e&&e.defaultView||window}return i}function jt(i){var e=Pe(i).Element;return i instanceof e||i instanceof Element}function Ze(i){var e=Pe(i).HTMLElement;return i instanceof e||i instanceof HTMLElement}function Ps(i){if(typeof ShadowRoot>"u")return!1;var e=Pe(i).ShadowRoot;return i instanceof e||i instanceof ShadowRoot}function S0(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)||!it(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 E0(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)||!it(s)||(Object.assign(s.style,a),Object.keys(n).forEach(function(l){s.removeAttribute(l)}))})}}var Tp={name:"applyStyles",enabled:!0,phase:"write",fn:S0,effect:E0,requires:["computeStyles"]};function rt(i){return i.split("-")[0]}var ni=Math.max,Lr=Math.min,Ui=Math.round;function Fs(){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 fn(){return!/^((?!chrome|android).)*safari/i.test(Fs())}function Wt(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&&Ui(r.width)/i.offsetWidth||1,n=i.offsetHeight>0&&Ui(r.height)/i.offsetHeight||1);var o=jt(i)?Pe(i):window,a=o.visualViewport,l=!fn()&&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 Rr(i){var e=Wt(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 mn(i,e){var t=e.getRootNode&&e.getRootNode();if(i.contains(e))return!0;if(t&&Ps(t)){var r=e;do{if(r&&i.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function mt(i){return Pe(i).getComputedStyle(i)}function Qc(i){return["table","td","th"].indexOf(it(i))>=0}function ot(i){return((jt(i)?i.ownerDocument:i.document)||window.document).documentElement}function zi(i){return it(i)==="html"?i:i.assignedSlot||i.parentNode||(Ps(i)?i.host:null)||ot(i)}function xp(i){return!Ze(i)||mt(i).position==="fixed"?null:i.offsetParent}function T0(i){var e=/firefox/i.test(Fs()),t=/Trident/i.test(Fs());if(t&&Ze(i)){var r=mt(i);if(r.position==="fixed")return null}var s=zi(i);for(Ps(s)&&(s=s.host);Ze(s)&&["html","body"].indexOf(it(s))<0;){var n=mt(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 oi(i){for(var e=Pe(i),t=xp(i);t&&Qc(t)&&mt(t).position==="static";)t=xp(t);return t&&(it(t)==="html"||it(t)==="body"&&mt(t).position==="static")?e:t||T0(i)||e}function Mr(i){return["top","bottom"].indexOf(i)>=0?"x":"y"}function Ir(i,e,t){return ni(i,Lr(e,t))}function kp(i,e,t){var r=Ir(i,e,t);return r>t?t:r}function gn(){return{top:0,right:0,bottom:0,left:0}}function vn(i){return Object.assign({},gn(),i)}function bn(i,e){return e.reduce(function(t,r){return t[r]=i,t},{})}var x0=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,vn(typeof e!="number"?e:bn(e,pr))};function k0(i){var e,t=i.state,r=i.name,s=i.options,n=t.elements.arrow,o=t.modifiersData.popperOffsets,a=rt(t.placement),l=Mr(a),c=[Ue,qe].indexOf(a)>=0,d=c?"height":"width";if(!(!n||!o)){var f=x0(s.padding,t),y=Rr(n),v=l==="y"?Ie:Ue,x=l==="y"?Ye:qe,C=t.rects.reference[d]+t.rects.reference[l]-o[l]-t.rects.popper[d],F=o[l]-t.rects.reference[l],L=oi(n),D=L?l==="y"?L.clientHeight||0:L.clientWidth||0:0,V=C/2-F/2,M=f[v],$=D-y[d]-f[x],z=D/2-y[d]/2+V,G=Ir(M,z,$),K=l;t.modifiersData[r]=(e={},e[K]=G,e.centerOffset=G-z,e)}}function A0(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)||mn(e.elements.popper,s)&&(e.elements.arrow=s))}var Ap={name:"arrow",enabled:!0,phase:"main",fn:k0,effect:A0,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Gt(i){return i.split("-")[1]}var C0={top:"auto",right:"auto",bottom:"auto",left:"auto"};function P0(i,e){var t=i.x,r=i.y,s=e.devicePixelRatio||1;return{x:Ui(t*s)/s||0,y:Ui(r*s)/s||0}}function Cp(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,C=x===void 0?0:x,F=typeof d=="function"?d({x:v,y:C}):{x:v,y:C};v=F.x,C=F.y;var L=o.hasOwnProperty("x"),D=o.hasOwnProperty("y"),V=Ue,M=Ie,$=window;if(c){var z=oi(t),G="clientHeight",K="clientWidth";if(z===Pe(t)&&(z=ot(t),mt(z).position!=="static"&&a==="absolute"&&(G="scrollHeight",K="scrollWidth")),z=z,s===Ie||(s===Ue||s===qe)&&n===Or){M=Ye;var Q=f&&z===$&&$.visualViewport?$.visualViewport.height:z[G];C-=Q-r.height,C*=l?1:-1}if(s===Ue||(s===Ie||s===Ye)&&n===Or){V=qe;var ne=f&&z===$&&$.visualViewport?$.visualViewport.width:z[K];v-=ne-r.width,v*=l?1:-1}}var Y=Object.assign({position:a},c&&C0),re=d===!0?P0({x:v,y:C},Pe(t)):{x:v,y:C};if(v=re.x,C=re.y,l){var le;return Object.assign({},Y,(le={},le[M]=D?"0":"",le[V]=L?"0":"",le.transform=($.devicePixelRatio||1)<=1?"translate("+v+"px, "+C+"px)":"translate3d("+v+"px, "+C+"px, 0)",le))}return Object.assign({},Y,(e={},e[M]=D?C+"px":"",e[V]=L?v+"px":"",e.transform="",e))}function F0(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:rt(e.placement),variation:Gt(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,Cp(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,Cp(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 Pp={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:F0,data:{}};var da={passive:!0};function _0(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=Pe(e.elements.popper),c=[].concat(e.scrollParents.reference,e.scrollParents.popper);return n&&c.forEach(function(d){d.addEventListener("scroll",t.update,da)}),a&&l.addEventListener("resize",t.update,da),function(){n&&c.forEach(function(d){d.removeEventListener("scroll",t.update,da)}),a&&l.removeEventListener("resize",t.update,da)}}var Fp={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:_0,data:{}};var O0={left:"right",right:"left",bottom:"top",top:"bottom"};function _s(i){return i.replace(/left|right|bottom|top/g,function(e){return O0[e]})}var L0={start:"end",end:"start"};function pa(i){return i.replace(/start|end/g,function(e){return L0[e]})}function Dr(i){var e=Pe(i),t=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:t,scrollTop:r}}function Nr(i){return Wt(ot(i)).left+Dr(i).scrollLeft}function Jc(i,e){var t=Pe(i),r=ot(i),s=t.visualViewport,n=r.clientWidth,o=r.clientHeight,a=0,l=0;if(s){n=s.width,o=s.height;var c=fn();(c||!c&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:n,height:o,x:a+Nr(i),y:l}}function eu(i){var e,t=ot(i),r=Dr(i),s=(e=i.ownerDocument)==null?void 0:e.body,n=ni(t.scrollWidth,t.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=ni(t.scrollHeight,t.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),a=-r.scrollLeft+Nr(i),l=-r.scrollTop;return mt(s||t).direction==="rtl"&&(a+=ni(t.clientWidth,s?s.clientWidth:0)-n),{width:n,height:o,x:a,y:l}}function Br(i){var e=mt(i),t=e.overflow,r=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+s+r)}function fa(i){return["html","body","#document"].indexOf(it(i))>=0?i.ownerDocument.body:Ze(i)&&Br(i)?i:fa(zi(i))}function fr(i,e){var t;e===void 0&&(e=[]);var r=fa(i),s=r===((t=i.ownerDocument)==null?void 0:t.body),n=Pe(r),o=s?[n].concat(n.visualViewport||[],Br(r)?r:[]):r,a=e.concat(o);return s?a:a.concat(fr(zi(o)))}function Os(i){return Object.assign({},i,{left:i.x,top:i.y,right:i.x+i.width,bottom:i.y+i.height})}function R0(i,e){var t=Wt(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 _p(i,e,t){return e===ua?Os(Jc(i,t)):jt(e)?R0(e,t):Os(eu(ot(i)))}function M0(i){var e=fr(zi(i)),t=["absolute","fixed"].indexOf(mt(i).position)>=0,r=t&&Ze(i)?oi(i):i;return jt(r)?e.filter(function(s){return jt(s)&&mn(s,r)&&it(s)!=="body"}):[]}function tu(i,e,t,r){var s=e==="clippingParents"?M0(i):[].concat(e),n=[].concat(s,[t]),o=n[0],a=n.reduce(function(l,c){var d=_p(i,c,r);return l.top=ni(d.top,l.top),l.right=Lr(d.right,l.right),l.bottom=Lr(d.bottom,l.bottom),l.left=ni(d.left,l.left),l},_p(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 yn(i){var e=i.reference,t=i.element,r=i.placement,s=r?rt(r):null,n=r?Gt(r):null,o=e.x+e.width/2-t.width/2,a=e.y+e.height/2-t.height/2,l;switch(s){case Ie: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?Mr(s):null;if(c!=null){var d=c==="y"?"height":"width";switch(n){case Bi:l[c]=l[c]-(e[d]/2-t[d]/2);break;case Or:l[c]=l[c]+(e[d]/2-t[d]/2);break;default:}}return l}function ai(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?wp:a,c=t.rootBoundary,d=c===void 0?ua:c,f=t.elementContext,y=f===void 0?Cs:f,v=t.altBoundary,x=v===void 0?!1:v,C=t.padding,F=C===void 0?0:C,L=vn(typeof F!="number"?F:bn(F,pr)),D=y===Cs?Sp:Cs,V=i.rects.popper,M=i.elements[x?D:y],$=tu(jt(M)?M:M.contextElement||ot(i.elements.popper),l,d,o),z=Wt(i.elements.reference),G=yn({reference:z,element:V,strategy:"absolute",placement:s}),K=Os(Object.assign({},V,G)),Q=y===Cs?K:z,ne={top:$.top-Q.top+L.top,bottom:Q.bottom-$.bottom+L.bottom,left:$.left-Q.left+L.left,right:Q.right-$.right+L.right},Y=i.modifiersData.offset;if(y===Cs&&Y){var re=Y[s];Object.keys(ne).forEach(function(le){var ke=[qe,Ye].indexOf(le)>=0?1:-1,We=[Ie,Ye].indexOf(le)>=0?"y":"x";ne[le]+=re[We]*ke})}return ne}function iu(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?ha:l,d=Gt(r),f=d?a?Zc:Zc.filter(function(x){return Gt(x)===d}):pr,y=f.filter(function(x){return c.indexOf(x)>=0});y.length===0&&(y=f);var v=y.reduce(function(x,C){return x[C]=ai(i,{placement:C,boundary:s,rootBoundary:n,padding:o})[rt(C)],x},{});return Object.keys(v).sort(function(x,C){return v[x]-v[C]})}function I0(i){if(rt(i)===ca)return[];var e=_s(i);return[pa(i),e,pa(e)]}function D0(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,C=t.allowedAutoPlacements,F=e.options.placement,L=rt(F),D=L===F,V=l||(D||!x?[_s(F)]:I0(F)),M=[F].concat(V).reduce(function(Ae,oe){return Ae.concat(rt(oe)===ca?iu(e,{placement:oe,boundary:d,rootBoundary:f,padding:c,flipVariations:x,allowedAutoPlacements:C}):oe)},[]),$=e.rects.reference,z=e.rects.popper,G=new Map,K=!0,Q=M[0],ne=0;ne<M.length;ne++){var Y=M[ne],re=rt(Y),le=Gt(Y)===Bi,ke=[Ie,Ye].indexOf(re)>=0,We=ke?"width":"height",T=ai(e,{placement:Y,boundary:d,rootBoundary:f,altBoundary:y,padding:c}),k=ke?le?qe:Ue:le?Ye:Ie;$[We]>z[We]&&(k=_s(k));var A=_s(k),H=[];if(n&&H.push(T[re]<=0),a&&H.push(T[k]<=0,T[A]<=0),H.every(function(Ae){return Ae})){Q=Y,K=!1;break}G.set(Y,H)}if(K)for(var j=x?3:1,U=function(oe){var ce=M.find(function(Le){var De=G.get(Le);if(De)return De.slice(0,oe).every(function(He){return He})});if(ce)return Q=ce,"break"},ee=j;ee>0;ee--){var te=U(ee);if(te==="break")break}e.placement!==Q&&(e.modifiersData[r]._skip=!0,e.placement=Q,e.reset=!0)}}var Op={name:"flip",enabled:!0,phase:"main",fn:D0,requiresIfExists:["offset"],data:{_skip:!1}};function Lp(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 Rp(i){return[Ie,qe,Ye,Ue].some(function(e){return i[e]>=0})}function N0(i){var e=i.state,t=i.name,r=e.rects.reference,s=e.rects.popper,n=e.modifiersData.preventOverflow,o=ai(e,{elementContext:"reference"}),a=ai(e,{altBoundary:!0}),l=Lp(o,r),c=Lp(a,s,n),d=Rp(l),f=Rp(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 Mp={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:N0};function B0(i,e,t){var r=rt(i),s=[Ue,Ie].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 U0(i){var e=i.state,t=i.options,r=i.name,s=t.offset,n=s===void 0?[0,0]:s,o=ha.reduce(function(d,f){return d[f]=B0(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 Ip={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:U0};function z0(i){var e=i.state,t=i.name;e.modifiersData[t]=yn({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}var Dp={name:"popperOffsets",enabled:!0,phase:"read",fn:z0,data:{}};function ru(i){return i==="x"?"y":"x"}function H0(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,C=x===void 0?0:x,F=ai(e,{boundary:l,rootBoundary:c,padding:f,altBoundary:d}),L=rt(e.placement),D=Gt(e.placement),V=!D,M=Mr(L),$=ru(M),z=e.modifiersData.popperOffsets,G=e.rects.reference,K=e.rects.popper,Q=typeof C=="function"?C(Object.assign({},e.rects,{placement:e.placement})):C,ne=typeof Q=="number"?{mainAxis:Q,altAxis:Q}:Object.assign({mainAxis:0,altAxis:0},Q),Y=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,re={x:0,y:0};if(z){if(n){var le,ke=M==="y"?Ie:Ue,We=M==="y"?Ye:qe,T=M==="y"?"height":"width",k=z[M],A=k+F[ke],H=k-F[We],j=v?-K[T]/2:0,U=D===Bi?G[T]:K[T],ee=D===Bi?-K[T]:-G[T],te=e.elements.arrow,Ae=v&&te?Rr(te):{width:0,height:0},oe=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:gn(),ce=oe[ke],Le=oe[We],De=Ir(0,G[T],Ae[T]),He=V?G[T]/2-j-De-ce-ne.mainAxis:U-De-ce-ne.mainAxis,gi=V?-G[T]/2+j+De+Le+ne.mainAxis:ee+De+Le+ne.mainAxis,vi=e.elements.arrow&&oi(e.elements.arrow),Zt=vi?M==="y"?vi.clientTop||0:vi.clientLeft||0:0,tr=(le=Y?.[M])!=null?le:0,Qt=k+He-tr-Zt,Sr=k+gi-tr,Pi=Ir(v?Lr(A,Qt):A,k,v?ni(H,Sr):H);z[M]=Pi,re[M]=Pi-k}if(a){var zt,Fi=M==="x"?Ie:Ue,_i=M==="x"?Ye:qe,_t=z[$],bi=$==="y"?"height":"width",ir=_t+F[Fi],Oi=_t-F[_i],Jt=[Ie,Ue].indexOf(L)!==-1,ei=(zt=Y?.[$])!=null?zt:0,ti=Jt?ir:_t-G[bi]-K[bi]-ei+ne.altAxis,Er=Jt?_t+G[bi]+K[bi]-ei-ne.altAxis:Oi,rr=v&&Jt?kp(ti,_t,Er):Ir(v?ti:ir,_t,v?Er:Oi);z[$]=rr,re[$]=rr-_t}e.modifiersData[r]=re}}var Np={name:"preventOverflow",enabled:!0,phase:"main",fn:H0,requiresIfExists:["offset"]};function su(i){return{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}}function nu(i){return i===Pe(i)||!Ze(i)?Dr(i):su(i)}function $0(i){var e=i.getBoundingClientRect(),t=Ui(e.width)/i.offsetWidth||1,r=Ui(e.height)/i.offsetHeight||1;return t!==1||r!==1}function ou(i,e,t){t===void 0&&(t=!1);var r=Ze(e),s=Ze(e)&&$0(e),n=ot(e),o=Wt(i,s,t),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!t)&&((it(e)!=="body"||Br(n))&&(a=nu(e)),Ze(e)?(l=Wt(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):n&&(l.x=Nr(n))),{x:o.left+a.scrollLeft-l.x,y:o.top+a.scrollTop-l.y,width:o.width,height:o.height}}function q0(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 au(i){var e=q0(i);return Ep.reduce(function(t,r){return t.concat(e.filter(function(s){return s.phase===r}))},[])}function lu(i){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(i())})})),e}}function cu(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 Bp={placement:"bottom",modifiers:[],strategy:"absolute"};function Up(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return!e.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function zp(i){i===void 0&&(i={});var e=i,t=e.defaultModifiers,r=t===void 0?[]:t,s=e.defaultOptions,n=s===void 0?Bp:s;return function(a,l,c){c===void 0&&(c=n);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},Bp,n),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},f=[],y=!1,v={state:d,setOptions:function(L){var D=typeof L=="function"?L(d.options):L;C(),d.options=Object.assign({},n,d.options,D),d.scrollParents={reference:jt(a)?fr(a):a.contextElement?fr(a.contextElement):[],popper:fr(l)};var V=au(cu([].concat(r,d.options.modifiers)));return d.orderedModifiers=V.filter(function(M){return M.enabled}),x(),v.update()},forceUpdate:function(){if(!y){var L=d.elements,D=L.reference,V=L.popper;if(Up(D,V)){d.rects={reference:ou(D,oi(V),d.options.strategy==="fixed"),popper:Rr(V)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(ne){return d.modifiersData[ne.name]=Object.assign({},ne.data)});for(var M=0;M<d.orderedModifiers.length;M++){if(d.reset===!0){d.reset=!1,M=-1;continue}var $=d.orderedModifiers[M],z=$.fn,G=$.options,K=G===void 0?{}:G,Q=$.name;typeof z=="function"&&(d=z({state:d,options:K,name:Q,instance:v})||d)}}}},update:lu(function(){return new Promise(function(F){v.forceUpdate(),F(d)})}),destroy:function(){C(),y=!0}};if(!Up(a,l))return v;v.setOptions(c).then(function(F){!y&&c.onFirstUpdate&&c.onFirstUpdate(F)});function x(){d.orderedModifiers.forEach(function(F){var L=F.name,D=F.options,V=D===void 0?{}:D,M=F.effect;if(typeof M=="function"){var $=M({state:d,name:L,instance:v,options:V}),z=function(){};f.push($||z)}})}function C(){f.forEach(function(F){return F()}),f=[]}return v}}var V0=[Fp,Dp,Pp,Tp,Ip,Op,Np,Ap,Mp],uu=zp({defaultModifiers:V0});var ma=class extends J{static targets=["trigger","menu"];static values={placement:{type:String,default:"bottom"}};connect(){this.visible=!1,this.initialized=!1,this.options={placement:this.placementValue,triggerType:"click",offsetSkidding:0,offsetDistance:10,delay:300,ignoreClickOutsideClass:!1},this.init()}init(){this.triggerTarget&&this.menuTarget&&!this.initialized&&(this.popperInstance=uu(this.triggerTarget,this.menuTarget,{strategy:"fixed",placement:this.options.placement,modifiers:[{name:"offset",options:{offset:[this.options.offsetSkidding,this.options.offsetDistance]}},{name:"flip",options:{fallbackPlacements:["left-end","right-start","right-end","bottom-start","bottom-end","top-start","top-end"],boundary:"clippingParents"}},{name:"preventOverflow",options:{boundary:"clippingParents",altAxis:!0,padding:8}}]}),this.setupEventListeners(),this.initialized=!0)}disconnect(){this.initialized&&(this.options.triggerType==="click"&&this.triggerTarget.removeEventListener("click",this.clickHandler),this.options.triggerType==="hover"&&(this.triggerTarget.removeEventListener("mouseenter",this.hoverShowTriggerHandler),this.menuTarget.removeEventListener("mouseenter",this.hoverShowMenuHandler),this.triggerTarget.removeEventListener("mouseleave",this.hoverHideHandler),this.menuTarget.removeEventListener("mouseleave",this.hoverHideHandler)),this.removeClickOutsideListener(),this.popperInstance.destroy(),this.initialized=!1)}setupEventListeners(){this.clickHandler=this.toggle.bind(this),this.hoverShowTriggerHandler=i=>{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(o=>{if(o.contains(e)){r=!0;return}});let s=e.closest(".flatpickr-calendar, .ss-main, .ss-content");e!==this.menuTarget&&!this.menuTarget.contains(e)&&!this.triggerTarget.contains(e)&&!r&&!s&&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 ga=class extends J{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 va=class extends J{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 ba=class extends J{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.#n(),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")}#n(){this.hasHomeButtonTarget&&(this.homeButtonTarget.style.display=this.srcHistory.length>2?"":"none"),this.hasBackButtonTarget&&(this.backButtonTarget.style.display=this.srcHistory.length>1?"":"none")}};var ya=class extends J{static values={current:String};connect(){let i=localStorage.getItem("theme")||"light";this.setMode(i),this.handleStorageChange=e=>{console.log("Storage event received in color-mode controller:",e.key,e.newValue,e.oldValue),e.key==="theme"&&e.newValue&&(console.log("Updating color-mode theme to:",e.newValue),this.setMode(e.newValue))},window.addEventListener("storage",this.handleStorageChange)}disconnect(){window.removeEventListener("storage",this.handleStorageChange)}toggleMode(){let e=(this.currentValue||"light")==="light"?"dark":"light";this.setMode(e)}setMode(i){i==="dark"?document.documentElement.classList.add("dark"):document.documentElement.classList.remove("dark"),this.currentValue=i,this.toggleIcons(i),localStorage.setItem("theme",i)}toggleIcons(i){let e=this.element.querySelector(".color-mode-icon-light"),t=this.element.querySelector(".color-mode-icon-dark");e&&t&&(i==="light"?(e.classList.remove("hidden"),t.classList.add("hidden")):(e.classList.add("hidden"),t.classList.remove("hidden")))}};var{entries:Yp,setPrototypeOf:Hp,isFrozen:j0,getPrototypeOf:W0,getOwnPropertyDescriptor:G0}=Object,{freeze:vt,seal:Kt,create:Zp}=Object,{apply:gu,construct:vu}=typeof Reflect<"u"&&Reflect;vt||(vt=function(e){return e});Kt||(Kt=function(e){return e});gu||(gu=function(e,t,r){return e.apply(t,r)});vu||(vu=function(e,t){return new e(...t)});var wa=bt(Array.prototype.forEach),K0=bt(Array.prototype.lastIndexOf),$p=bt(Array.prototype.pop),wn=bt(Array.prototype.push),X0=bt(Array.prototype.splice),Ea=bt(String.prototype.toLowerCase),hu=bt(String.prototype.toString),qp=bt(String.prototype.match),Sn=bt(String.prototype.replace),Y0=bt(String.prototype.indexOf),Z0=bt(String.prototype.trim),li=bt(Object.prototype.hasOwnProperty),gt=bt(RegExp.prototype.test),En=Q0(TypeError);function bt(i){return function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];return gu(i,e,r)}}function Q0(i){return function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return vu(i,t)}}function ae(i,e){let t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ea;Hp&&Hp(i,null);let r=e.length;for(;r--;){let s=e[r];if(typeof s=="string"){let n=t(s);n!==s&&(j0(e)||(e[r]=n),s=n)}i[s]=!0}return i}function J0(i){for(let e=0;e<i.length;e++)li(i,e)||(i[e]=null);return i}function Ur(i){let e=Zp(null);for(let[t,r]of Yp(i))li(i,t)&&(Array.isArray(r)?e[t]=J0(r):r&&typeof r=="object"&&r.constructor===Object?e[t]=Ur(r):e[t]=r);return e}function Tn(i,e){for(;i!==null;){let r=G0(i,e);if(r){if(r.get)return bt(r.get);if(typeof r.value=="function")return bt(r.value)}i=W0(i)}function t(){return null}return t}var Vp=vt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","shadow","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),du=vt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","filter","font","g","glyph","glyphref","hkern","image","line","lineargradient","marker","mask","metadata","mpath","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),pu=vt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),ew=vt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),fu=vt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),tw=vt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),jp=vt(["#text"]),Wp=vt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","face","for","headers","height","hidden","high","href","hreflang","id","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),mu=vt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Gp=vt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),Sa=vt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),iw=Kt(/\{\{[\w\W]*|[\w\W]*\}\}/gm),rw=Kt(/<%[\w\W]*|[\w\W]*%>/gm),sw=Kt(/\$\{[\w\W]*/gm),nw=Kt(/^data-[\-\w.\u00B7-\uFFFF]+$/),ow=Kt(/^aria-[\-\w]+$/),Qp=Kt(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),aw=Kt(/^(?:\w+script|data):/i),lw=Kt(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Jp=Kt(/^html$/i),cw=Kt(/^[a-z][.\w]*(-[.\w]+)+$/i),Kp=Object.freeze({__proto__:null,ARIA_ATTR:ow,ATTR_WHITESPACE:lw,CUSTOM_ELEMENT:cw,DATA_ATTR:nw,DOCTYPE_NAME:Jp,ERB_EXPR:rw,IS_ALLOWED_URI:Qp,IS_SCRIPT_OR_DATA:aw,MUSTACHE_EXPR:iw,TMPLIT_EXPR:sw}),xn={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,progressingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},uw=function(){return typeof window>"u"?null:window},hw=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}},Xp=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function ef(){let i=arguments.length>0&&arguments[0]!==void 0?arguments[0]:uw(),e=Z=>ef(Z);if(e.version="3.2.4",e.removed=[],!i||!i.document||i.document.nodeType!==xn.document||!i.Element)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,C=Tn(x,"cloneNode"),F=Tn(x,"remove"),L=Tn(x,"nextSibling"),D=Tn(x,"childNodes"),V=Tn(x,"parentNode");if(typeof o=="function"){let Z=t.createElement("template");Z.content&&Z.content.ownerDocument&&(t=Z.content.ownerDocument)}let M,$="",{implementation:z,createNodeIterator:G,createDocumentFragment:K,getElementsByTagName:Q}=t,{importNode:ne}=r,Y=Xp();e.isSupported=typeof Yp=="function"&&typeof V=="function"&&z&&z.createHTMLDocument!==void 0;let{MUSTACHE_EXPR:re,ERB_EXPR:le,TMPLIT_EXPR:ke,DATA_ATTR:We,ARIA_ATTR:T,IS_SCRIPT_OR_DATA:k,ATTR_WHITESPACE:A,CUSTOM_ELEMENT:H}=Kp,{IS_ALLOWED_URI:j}=Kp,U=null,ee=ae({},[...Vp,...du,...pu,...fu,...jp]),te=null,Ae=ae({},[...Wp,...mu,...Gp,...Sa]),oe=Object.seal(Zp(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,Le=null,De=!0,He=!0,gi=!1,vi=!0,Zt=!1,tr=!0,Qt=!1,Sr=!1,Pi=!1,zt=!1,Fi=!1,_i=!1,_t=!0,bi=!1,ir="user-content-",Oi=!0,Jt=!1,ei={},ti=null,Er=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"]),rr=null,Js=ae({},["audio","video","img","source","image","track"]),gs=null,Mo=ae({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),vs="http://www.w3.org/1998/Math/MathML",se="http://www.w3.org/2000/svg",Ht="http://www.w3.org/1999/xhtml",yi=Ht,ii=!1,en=null,sr=ae({},[vs,se,Ht],hu),Ge=ae({},["mi","mo","mn","ms","mtext"]),bs=ae({},["annotation-xml"]),Io=ae({},["title","style","font","a","script"]),ye=null,we=["application/xhtml+xml","text/html"],Nl="text/html",Te=null,nr=null,wi=t.createElement("form"),Do=function(w){return w instanceof RegExp||w instanceof Function},Re=function(){let w=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(nr&&nr===w)){if((!w||typeof w!="object")&&(w={}),w=Ur(w),ye=we.indexOf(w.PARSER_MEDIA_TYPE)===-1?Nl:w.PARSER_MEDIA_TYPE,Te=ye==="application/xhtml+xml"?hu:Ea,U=li(w,"ALLOWED_TAGS")?ae({},w.ALLOWED_TAGS,Te):ee,te=li(w,"ALLOWED_ATTR")?ae({},w.ALLOWED_ATTR,Te):Ae,en=li(w,"ALLOWED_NAMESPACES")?ae({},w.ALLOWED_NAMESPACES,hu):sr,gs=li(w,"ADD_URI_SAFE_ATTR")?ae(Ur(Mo),w.ADD_URI_SAFE_ATTR,Te):Mo,rr=li(w,"ADD_DATA_URI_TAGS")?ae(Ur(Js),w.ADD_DATA_URI_TAGS,Te):Js,ti=li(w,"FORBID_CONTENTS")?ae({},w.FORBID_CONTENTS,Te):Er,ce=li(w,"FORBID_TAGS")?ae({},w.FORBID_TAGS,Te):{},Le=li(w,"FORBID_ATTR")?ae({},w.FORBID_ATTR,Te):{},ei=li(w,"USE_PROFILES")?w.USE_PROFILES:!1,De=w.ALLOW_ARIA_ATTR!==!1,He=w.ALLOW_DATA_ATTR!==!1,gi=w.ALLOW_UNKNOWN_PROTOCOLS||!1,vi=w.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Zt=w.SAFE_FOR_TEMPLATES||!1,tr=w.SAFE_FOR_XML!==!1,Qt=w.WHOLE_DOCUMENT||!1,zt=w.RETURN_DOM||!1,Fi=w.RETURN_DOM_FRAGMENT||!1,_i=w.RETURN_TRUSTED_TYPE||!1,Pi=w.FORCE_BODY||!1,_t=w.SANITIZE_DOM!==!1,bi=w.SANITIZE_NAMED_PROPS||!1,Oi=w.KEEP_CONTENT!==!1,Jt=w.IN_PLACE||!1,j=w.ALLOWED_URI_REGEXP||Qp,yi=w.NAMESPACE||Ht,Ge=w.MATHML_TEXT_INTEGRATION_POINTS||Ge,bs=w.HTML_INTEGRATION_POINTS||bs,oe=w.CUSTOM_ELEMENT_HANDLING||{},w.CUSTOM_ELEMENT_HANDLING&&Do(w.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(oe.tagNameCheck=w.CUSTOM_ELEMENT_HANDLING.tagNameCheck),w.CUSTOM_ELEMENT_HANDLING&&Do(w.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(oe.attributeNameCheck=w.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),w.CUSTOM_ELEMENT_HANDLING&&typeof w.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(oe.allowCustomizedBuiltInElements=w.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Zt&&(He=!1),Fi&&(zt=!0),ei&&(U=ae({},jp),te=[],ei.html===!0&&(ae(U,Vp),ae(te,Wp)),ei.svg===!0&&(ae(U,du),ae(te,mu),ae(te,Sa)),ei.svgFilters===!0&&(ae(U,pu),ae(te,mu),ae(te,Sa)),ei.mathMl===!0&&(ae(U,fu),ae(te,Gp),ae(te,Sa))),w.ADD_TAGS&&(U===ee&&(U=Ur(U)),ae(U,w.ADD_TAGS,Te)),w.ADD_ATTR&&(te===Ae&&(te=Ur(te)),ae(te,w.ADD_ATTR,Te)),w.ADD_URI_SAFE_ATTR&&ae(gs,w.ADD_URI_SAFE_ATTR,Te),w.FORBID_CONTENTS&&(ti===Er&&(ti=Ur(ti)),ae(ti,w.FORBID_CONTENTS,Te)),Oi&&(U["#text"]=!0),Qt&&ae(U,["html","head","body"]),U.table&&(ae(U,["tbody"]),delete ce.tbody),w.TRUSTED_TYPES_POLICY){if(typeof w.TRUSTED_TYPES_POLICY.createHTML!="function")throw En('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof w.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw En('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');M=w.TRUSTED_TYPES_POLICY,$=M.createHTML("")}else M===void 0&&(M=hw(v,s)),M!==null&&typeof $=="string"&&($=M.createHTML(""));vt&&vt(w),nr=w}},Ot=ae({},[...du,...pu,...ew]),Li=ae({},[...fu,...tw]),Bl=function(w){let I=V(w);(!I||!I.tagName)&&(I={namespaceURI:yi,tagName:"template"});let X=Ea(w.tagName),be=Ea(I.tagName);return en[w.namespaceURI]?w.namespaceURI===se?I.namespaceURI===Ht?X==="svg":I.namespaceURI===vs?X==="svg"&&(be==="annotation-xml"||Ge[be]):!!Ot[X]:w.namespaceURI===vs?I.namespaceURI===Ht?X==="math":I.namespaceURI===se?X==="math"&&bs[be]:!!Li[X]:w.namespaceURI===Ht?I.namespaceURI===se&&!bs[be]||I.namespaceURI===vs&&!Ge[be]?!1:!Li[X]&&(Io[X]||!Ot[X]):!!(ye==="application/xhtml+xml"&&en[w.namespaceURI]):!1},At=function(w){wn(e.removed,{element:w});try{V(w).removeChild(w)}catch{F(w)}},or=function(w,I){try{wn(e.removed,{attribute:I.getAttributeNode(w),from:I})}catch{wn(e.removed,{attribute:null,from:I})}if(I.removeAttribute(w),w==="is")if(zt||Fi)try{At(I)}catch{}else try{I.setAttribute(w,"")}catch{}},ar=function(w){let I=null,X=null;if(Pi)w="<remove></remove>"+w;else{let Se=qp(w,/^[\r\n\t ]+/);X=Se&&Se[0]}ye==="application/xhtml+xml"&&yi===Ht&&(w='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+w+"</body></html>");let be=M?M.createHTML(w):w;if(yi===Ht)try{I=new y().parseFromString(be,ye)}catch{}if(!I||!I.documentElement){I=z.createDocument(yi,"template",null);try{I.documentElement.innerHTML=ii?$:be}catch{}}let Qe=I.body||I.documentElement;return w&&X&&Qe.insertBefore(t.createTextNode(X),Qe.childNodes[0]||null),yi===Ht?Q.call(I,Qt?"html":"body")[0]:Qt?I.documentElement:Qe},No=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)},ys=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")},tn=function(w){return typeof a=="function"&&w instanceof a};function Ne(Z,w,I){wa(Z,X=>{X.call(e,w,I,nr)})}let ft=function(w){let I=null;if(Ne(Y.beforeSanitizeElements,w,null),ys(w))return At(w),!0;let X=Te(w.nodeName);if(Ne(Y.uponSanitizeElement,w,{tagName:X,allowedTags:U}),w.hasChildNodes()&&!tn(w.firstElementChild)&>(/<[/\w]/g,w.innerHTML)&>(/<[/\w]/g,w.textContent)||w.nodeType===xn.progressingInstruction||tr&&w.nodeType===xn.comment&>(/<[/\w]/g,w.data))return At(w),!0;if(!U[X]||ce[X]){if(!ce[X]&&rn(X)&&(oe.tagNameCheck instanceof RegExp&>(oe.tagNameCheck,X)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(X)))return!1;if(Oi&&!ti[X]){let be=V(w)||w.parentNode,Qe=D(w)||w.childNodes;if(Qe&&be){let Se=Qe.length;for(let ht=Se-1;ht>=0;--ht){let $t=C(Qe[ht],!0);$t.__removalCount=(w.__removalCount||0)+1,be.insertBefore($t,L(w))}}}return At(w),!0}return w instanceof l&&!Bl(w)||(X==="noscript"||X==="noembed"||X==="noframes")&>(/<\/no(script|embed|frames)/i,w.innerHTML)?(At(w),!0):(Zt&&w.nodeType===xn.text&&(I=w.textContent,wa([re,le,ke],be=>{I=Sn(I,be," ")}),w.textContent!==I&&(wn(e.removed,{element:w.cloneNode()}),w.textContent=I)),Ne(Y.afterSanitizeElements,w,null),!1)},Ri=function(w,I,X){if(_t&&(I==="id"||I==="name")&&(X in t||X in wi))return!1;if(!(He&&!Le[I]&>(We,I))){if(!(De&>(T,I))){if(!te[I]||Le[I]){if(!(rn(w)&&(oe.tagNameCheck instanceof RegExp&>(oe.tagNameCheck,w)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(w))&&(oe.attributeNameCheck instanceof RegExp&>(oe.attributeNameCheck,I)||oe.attributeNameCheck instanceof Function&&oe.attributeNameCheck(I))||I==="is"&&oe.allowCustomizedBuiltInElements&&(oe.tagNameCheck instanceof RegExp&>(oe.tagNameCheck,X)||oe.tagNameCheck instanceof Function&&oe.tagNameCheck(X))))return!1}else if(!gs[I]){if(!gt(j,Sn(X,A,""))){if(!((I==="src"||I==="xlink:href"||I==="href")&&w!=="script"&&Y0(X,"data:")===0&&rr[w])){if(!(gi&&!gt(k,Sn(X,A,"")))){if(X)return!1}}}}}}return!0},rn=function(w){return w!=="annotation-xml"&&qp(w,H)},ws=function(w){Ne(Y.beforeSanitizeAttributes,w,null);let{attributes:I}=w;if(!I||ys(w))return;let X={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:te,forceKeepAttr:void 0},be=I.length;for(;be--;){let Qe=I[be],{name:Se,namespaceURI:ht,value:$t}=Qe,lr=Te(Se),nt=Se==="value"?$t:Z0($t);if(X.attrName=lr,X.attrValue=nt,X.keepAttr=!0,X.forceKeepAttr=void 0,Ne(Y.uponSanitizeAttribute,w,X),nt=X.attrValue,bi&&(lr==="id"||lr==="name")&&(or(Se,w),nt=ir+nt),tr&>(/((--!?|])>)|<\/(style|title)/i,nt)){or(Se,w);continue}if(X.forceKeepAttr||(or(Se,w),!X.keepAttr))continue;if(!vi&>(/\/>/i,nt)){or(Se,w);continue}Zt&&wa([re,le,ke],Uo=>{nt=Sn(nt,Uo," ")});let Bo=Te(w.nodeName);if(Ri(Bo,lr,nt)){if(M&&typeof v=="object"&&typeof v.getAttributeType=="function"&&!ht)switch(v.getAttributeType(Bo,lr)){case"TrustedHTML":{nt=M.createHTML(nt);break}case"TrustedScriptURL":{nt=M.createScriptURL(nt);break}}try{ht?w.setAttributeNS(ht,Se,nt):w.setAttribute(Se,nt),ys(w)?At(w):$p(e.removed)}catch{}}}Ne(Y.afterSanitizeAttributes,w,null)},Ul=function Z(w){let I=null,X=No(w);for(Ne(Y.beforeSanitizeShadowDOM,w,null);I=X.nextNode();)Ne(Y.uponSanitizeShadowNode,I,null),ft(I),ws(I),I.content instanceof n&&Z(I.content);Ne(Y.afterSanitizeShadowDOM,w,null)};return e.sanitize=function(Z){let w=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},I=null,X=null,be=null,Qe=null;if(ii=!Z,ii&&(Z="<!-->"),typeof Z!="string"&&!tn(Z))if(typeof Z.toString=="function"){if(Z=Z.toString(),typeof Z!="string")throw En("dirty is not a string, aborting")}else throw En("toString is not a function");if(!e.isSupported)return Z;if(Sr||Re(w),e.removed=[],typeof Z=="string"&&(Jt=!1),Jt){if(Z.nodeName){let $t=Te(Z.nodeName);if(!U[$t]||ce[$t])throw En("root node is forbidden and cannot be sanitized in-place")}}else if(Z instanceof a)I=ar("<!---->"),X=I.ownerDocument.importNode(Z,!0),X.nodeType===xn.element&&X.nodeName==="BODY"||X.nodeName==="HTML"?I=X:I.appendChild(X);else{if(!zt&&!Zt&&!Qt&&Z.indexOf("<")===-1)return M&&_i?M.createHTML(Z):Z;if(I=ar(Z),!I)return zt?null:_i?$:""}I&&Pi&&At(I.firstChild);let Se=No(Jt?Z:I);for(;be=Se.nextNode();)ft(be),ws(be),be.content instanceof n&&Ul(be.content);if(Jt)return Z;if(zt){if(Fi)for(Qe=K.call(I.ownerDocument);I.firstChild;)Qe.appendChild(I.firstChild);else Qe=I;return(te.shadowroot||te.shadowrootmode)&&(Qe=ne.call(r,Qe,!0)),Qe}let ht=Qt?I.outerHTML:I.innerHTML;return Qt&&U["!doctype"]&&I.ownerDocument&&I.ownerDocument.doctype&&I.ownerDocument.doctype.name&>(Jp,I.ownerDocument.doctype.name)&&(ht="<!DOCTYPE "+I.ownerDocument.doctype.name+`>
|
|
32
|
+
`+ht),Zt&&wa([re,le,ke],$t=>{ht=Sn(ht,$t," ")}),M&&_i?M.createHTML(ht):ht},e.setConfig=function(){let Z=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Re(Z),Sr=!0},e.clearConfig=function(){nr=null,Sr=!1},e.isValidAttribute=function(Z,w,I){nr||Re({});let X=Te(Z),be=Te(w);return Ri(X,be,I)},e.addHook=function(Z,w){typeof w=="function"&&wn(Y[Z],w)},e.removeHook=function(Z,w){if(w!==void 0){let I=K0(Y[Z],w);return I===-1?void 0:X0(Y[Z],I,1)[0]}return $p(Y[Z])},e.removeHooks=function(Z){Y[Z]=[]},e.removeAllHooks=function(){Y=Xp()},e}var Ls=ef();function wu(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Hr=wu();function af(i){Hr=i}var Cn={exec:()=>null};function ge(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(yt.caret,"$1"),t=t.replace(s,o),r},getRegex:()=>new RegExp(t,e)};return r}var yt={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:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,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")},dw=/^(?:[ \t]*(?:\n|$))+/,pw=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,fw=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Fn=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,mw=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Su=/(?:[*+-]|\d{1,9}[.)])/,lf=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,cf=ge(lf).replace(/bull/g,Su).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/).replace(/\|table/g,"").getRegex(),gw=ge(lf).replace(/bull/g,Su).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/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Eu=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,vw=/^[^\n]+/,Tu=/(?!\s*\])(?:\\.|[^\[\]\\])+/,bw=ge(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Tu).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),yw=ge(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Su).getRegex(),ka="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",xu=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ww=ge("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",xu).replace("tag",ka).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),uf=ge(Eu).replace("hr",Fn).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","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ka).getRegex(),Sw=ge(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",uf).getRegex(),ku={blockquote:Sw,code:pw,def:bw,fences:fw,heading:mw,hr:Fn,html:ww,lheading:cf,list:yw,newline:dw,paragraph:uf,table:Cn,text:vw},tf=ge("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Fn).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","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ka).getRegex(),Ew={...ku,lheading:gw,table:tf,paragraph:ge(Eu).replace("hr",Fn).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",tf).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",ka).getRegex()},Tw={...ku,html:ge(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",xu).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:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Cn,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:ge(Eu).replace("hr",Fn).replace("heading",` *#{1,6} *[^
|
|
33
|
+
]`).replace("lheading",cf).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},xw=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,kw=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,hf=/^( {2,}|\\)\n(?!\s*$)/,Aw=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,Aa=/[\p{P}\p{S}]/u,Au=/[\s\p{P}\p{S}]/u,df=/[^\s\p{P}\p{S}]/u,Cw=ge(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Au).getRegex(),pf=/(?!~)[\p{P}\p{S}]/u,Pw=/(?!~)[\s\p{P}\p{S}]/u,Fw=/(?:[^\s\p{P}\p{S}]|~)/u,_w=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,ff=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,Ow=ge(ff,"u").replace(/punct/g,Aa).getRegex(),Lw=ge(ff,"u").replace(/punct/g,pf).getRegex(),mf="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Rw=ge(mf,"gu").replace(/notPunctSpace/g,df).replace(/punctSpace/g,Au).replace(/punct/g,Aa).getRegex(),Mw=ge(mf,"gu").replace(/notPunctSpace/g,Fw).replace(/punctSpace/g,Pw).replace(/punct/g,pf).getRegex(),Iw=ge("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,df).replace(/punctSpace/g,Au).replace(/punct/g,Aa).getRegex(),Dw=ge(/\\(punct)/,"gu").replace(/punct/g,Aa).getRegex(),Nw=ge(/^<(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(),Bw=ge(xu).replace("(?:-->|$)","-->").getRegex(),Uw=ge("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",Bw).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),xa=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,zw=ge(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace("label",xa).replace("href",/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),gf=ge(/^!?\[(label)\]\[(ref)\]/).replace("label",xa).replace("ref",Tu).getRegex(),vf=ge(/^!?\[(ref)\](?:\[\])?/).replace("ref",Tu).getRegex(),Hw=ge("reflink|nolink(?!\\()","g").replace("reflink",gf).replace("nolink",vf).getRegex(),Cu={_backpedal:Cn,anyPunctuation:Dw,autolink:Nw,blockSkip:_w,br:hf,code:kw,del:Cn,emStrongLDelim:Ow,emStrongRDelimAst:Rw,emStrongRDelimUnd:Iw,escape:xw,link:zw,nolink:vf,punctuation:Cw,reflink:gf,reflinkSearch:Hw,tag:Uw,text:Aw,url:Cn},$w={...Cu,link:ge(/^!?\[(label)\]\((.*?)\)/).replace("label",xa).getRegex(),reflink:ge(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",xa).getRegex()},bu={...Cu,emStrongRDelimAst:Mw,emStrongLDelim:Lw,url:ge(/^((?: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]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},qw={...bu,br:ge(hf).replace("{2,}","*").getRegex(),text:ge(bu.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},Ta={normal:ku,gfm:Ew,pedantic:Tw},kn={normal:Cu,gfm:bu,breaks:qw,pedantic:$w},Vw={"&":"&","<":"<",">":">",'"':""","'":"'"},rf=i=>Vw[i];function Ei(i,e){if(e){if(yt.escapeTest.test(i))return i.replace(yt.escapeReplace,rf)}else if(yt.escapeTestNoEncode.test(i))return i.replace(yt.escapeReplaceNoEncode,rf);return i}function sf(i){try{i=encodeURI(i).replace(yt.percentDecode,"%")}catch{return null}return i}function nf(i,e){let t=i.replace(yt.findPipe,(n,o,a)=>{let l=!1,c=o;for(;--c>=0&&a[c]==="\\";)l=!l;return l?"|":" |"}),r=t.split(yt.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<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(yt.slashPipe,"|");return r}function An(i,e,t){let r=i.length;if(r===0)return"";let s=0;for(;s<r&&i.charAt(r-s-1)===e;)s++;return i.slice(0,r-s)}function jw(i,e){if(i.indexOf(e[1])===-1)return-1;let t=0;for(let r=0;r<i.length;r++)if(i[r]==="\\")r++;else if(i[r]===e[0])t++;else if(i[r]===e[1]&&(t--,t<0))return r;return-1}function of(i,e,t,r,s){let n=e.href,o=e.title||null,a=i[1].replace(s.other.outputLinkReplace,"$1");if(i[0].charAt(0)!=="!"){r.state.inLink=!0;let l={type:"link",raw:t,href:n,title:o,text:a,tokens:r.inlineTokens(a)};return r.state.inLink=!1,l}return{type:"image",raw:t,href:n,title:o,text:a}}function Ww(i,e,t){let r=i.match(t.other.indentCodeCompensation);if(r===null)return e;let s=r[1];return e.split(`
|
|
34
34
|
`).map(n=>{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(`
|
|
35
|
-
`)}var
|
|
36
|
-
`)}}}fences(
|
|
37
|
-
`)}}blockquote(
|
|
35
|
+
`)}var Ms=class{options;rules;lexer;constructor(e){this.options=e||Hr}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:An(r,`
|
|
36
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let r=t[0],s=Ww(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=An(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:An(t[0],`
|
|
37
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let r=An(t[0],`
|
|
38
38
|
`).split(`
|
|
39
|
-
`),
|
|
40
|
-
`),d
|
|
41
|
-
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");
|
|
42
|
-
${
|
|
43
|
-
${
|
|
44
|
-
`+
|
|
45
|
-
`),
|
|
46
|
-
`+
|
|
47
|
-
`),
|
|
48
|
-
`);continue}}return{type:"blockquote",raw:
|
|
49
|
-
`,1)[0].replace(this.rules.other.listReplaceTabs,
|
|
50
|
-
`,1)[0],
|
|
51
|
-
`,
|
|
52
|
-
`,1)[0],
|
|
53
|
-
`+
|
|
54
|
-
`+
|
|
55
|
-
`,
|
|
56
|
-
`):[],
|
|
57
|
-
`?
|
|
58
|
-
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let r=this.inlineQueue[t];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],r=!1){for(this.options.pedantic&&(e=e.replace(
|
|
39
|
+
`),s="",n="",o=[];for(;r.length>0;){let a=!1,l=[],c;for(c=0;c<r.length;c++)if(this.rules.other.blockquoteStart.test(r[c]))l.push(r[c]),a=!0;else if(!a)l.push(r[c]);else break;r=r.slice(c);let d=l.join(`
|
|
40
|
+
`),f=d.replace(this.rules.other.blockquoteSetextReplace,`
|
|
41
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");s=s?`${s}
|
|
42
|
+
${d}`:d,n=n?`${n}
|
|
43
|
+
${f}`:f;let y=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(f,o,!0),this.lexer.state.top=y,r.length===0)break;let v=o.at(-1);if(v?.type==="code")break;if(v?.type==="blockquote"){let x=v,C=x.raw+`
|
|
44
|
+
`+r.join(`
|
|
45
|
+
`),F=this.blockquote(C);o[o.length-1]=F,s=s.substring(0,s.length-x.raw.length)+F.raw,n=n.substring(0,n.length-x.text.length)+F.text;break}else if(v?.type==="list"){let x=v,C=x.raw+`
|
|
46
|
+
`+r.join(`
|
|
47
|
+
`),F=this.list(C);o[o.length-1]=F,s=s.substring(0,s.length-v.raw.length)+F.raw,n=n.substring(0,n.length-x.raw.length)+F.raw,r=C.substring(o.at(-1).raw.length).split(`
|
|
48
|
+
`);continue}}return{type:"blockquote",raw:s,tokens:o,text:n}}}list(e){let t=this.rules.block.list.exec(e);if(t){let r=t[1].trim(),s=r.length>1,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(`
|
|
49
|
+
`,1)[0].replace(this.rules.other.listReplaceTabs,D=>" ".repeat(3*D.length)),v=e.split(`
|
|
50
|
+
`,1)[0],x=!y.trim(),C=0;if(this.options.pedantic?(C=2,f=y.trimStart()):x?C=t[1].length+1:(C=t[2].search(this.rules.other.nonSpaceChar),C=C>4?1:C,f=y.slice(C),C+=t[1].length),x&&this.rules.other.blankLine.test(v)&&(d+=v+`
|
|
51
|
+
`,e=e.substring(v.length+1),c=!0),!c){let D=this.rules.other.nextBulletRegex(C),V=this.rules.other.hrRegex(C),M=this.rules.other.fencesBeginRegex(C),$=this.rules.other.headingBeginRegex(C),z=this.rules.other.htmlBeginRegex(C);for(;e;){let G=e.split(`
|
|
52
|
+
`,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)||$.test(v)||z.test(v)||D.test(v)||V.test(v))break;if(K.search(this.rules.other.nonSpaceChar)>=C||!v.trim())f+=`
|
|
53
|
+
`+K.slice(C);else{if(x||y.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||M.test(y)||$.test(y)||V.test(y))break;f+=`
|
|
54
|
+
`+v}!x&&!v.trim()&&(x=!0),d+=G+`
|
|
55
|
+
`,e=e.substring(G.length+1),y=K.slice(C)}}n.loose||(a?n.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(a=!0));let F=null,L;this.options.gfm&&(F=this.rules.other.listIsTask.exec(f),F&&(L=F[0]!=="[ ] ",f=f.replace(this.rules.other.listReplaceTask,""))),n.items.push({type:"list_item",raw:d,task:!!F,checked:L,loose:!1,text:f,tokens:[]}),n.raw+=d}let l=n.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;n.raw=n.raw.trimEnd();for(let c=0;c<n.items.length;c++)if(this.lexer.state.top=!1,n.items[c].tokens=this.lexer.blockTokens(n.items[c].text,[]),!n.loose){let d=n.items[c].tokens.filter(y=>y.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<n.items.length;c++)n.items[c].loose=!0;return n}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let r=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),s=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",n=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:r,raw:t[0],href:s,title:n}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let r=nf(t[1]),s=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),n=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
56
|
+
`):[],o={type:"table",raw:t[0],header:[],align:[],rows:[]};if(r.length===s.length){for(let a of s)this.rules.other.tableAlignRight.test(a)?o.align.push("right"):this.rules.other.tableAlignCenter.test(a)?o.align.push("center"):this.rules.other.tableAlignLeft.test(a)?o.align.push("left"):o.align.push(null);for(let a=0;a<r.length;a++)o.header.push({text:r[a],tokens:this.lexer.inline(r[a]),header:!0,align:o.align[a]});for(let a of n)o.rows.push(nf(a,o.header.length).map((l,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)===`
|
|
57
|
+
`?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=An(r.slice(0,-1),"\\");if((r.length-o.length)%2===0)return}else{let o=jw(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)),of(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 of(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 C=v.slice(1,-1);return{type:"em",raw:v,text:C,tokens:this.lexer.inlineTokens(C)}}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}}}},ci=class i{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Hr,this.options.tokenizer=this.options.tokenizer||new Ms,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:yt,block:Ta.normal,inline:kn.normal};this.options.pedantic?(t.block=Ta.pedantic,t.inline=kn.pedantic):this.options.gfm&&(t.block=Ta.gfm,this.options.breaks?t.inline=kn.breaks:t.inline=kn.gfm),this.tokenizer.rules=t}static get rules(){return{block:Ta,inline:kn}}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(yt.carriageReturn,`
|
|
58
|
+
`),this.blockTokens(e,this.tokens);for(let t=0;t<this.inlineQueue.length;t++){let r=this.inlineQueue[t];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],r=!1){for(this.options.pedantic&&(e=e.replace(yt.tabCharGlobal," ").replace(yt.spaceLine,""));e;){let s;if(this.options.extensions?.block?.some(o=>(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+=`
|
|
59
59
|
`: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+=`
|
|
60
60
|
`+s.raw,o.text+=`
|
|
61
61
|
`+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+=`
|
|
@@ -64,44 +64,44 @@ ${d}`:d;let f=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
|
|
|
64
64
|
`+s.raw,o.text+=`
|
|
65
65
|
`+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+=`
|
|
66
66
|
`+s.raw,o.text+=`
|
|
67
|
-
`+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.
|
|
68
|
-
`;return
|
|
69
|
-
`:"<pre><code>"+(
|
|
70
|
-
`}blockquote({tokens:
|
|
71
|
-
${this.parser.parse(
|
|
72
|
-
`}html({text:
|
|
73
|
-
`}hr(
|
|
74
|
-
`}list(
|
|
75
|
-
`+
|
|
76
|
-
`}listitem(
|
|
77
|
-
`}checkbox({checked:
|
|
78
|
-
`}table(
|
|
67
|
+
`+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}},Is=class{options;parser;constructor(e){this.options=e||Hr}space(e){return""}code({text:e,lang:t,escaped:r}){let s=(t||"").match(yt.notSpaceStart)?.[0],n=e.replace(yt.endingNewline,"")+`
|
|
68
|
+
`;return s?'<pre><code class="language-'+Ei(s)+'">'+(r?n:Ei(n,!0))+`</code></pre>
|
|
69
|
+
`:"<pre><code>"+(r?n:Ei(n,!0))+`</code></pre>
|
|
70
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
71
|
+
${this.parser.parse(e)}</blockquote>
|
|
72
|
+
`}html({text:e}){return e}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
73
|
+
`}hr(e){return`<hr>
|
|
74
|
+
`}list(e){let t=e.ordered,r=e.start,s="";for(let a=0;a<e.items.length;a++){let l=e.items[a];s+=this.listitem(l)}let n=t?"ol":"ul",o=t&&r!==1?' start="'+r+'"':"";return"<"+n+o+`>
|
|
75
|
+
`+s+"</"+n+`>
|
|
76
|
+
`}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+" "+Ei(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),`<li>${t}</li>
|
|
77
|
+
`}checkbox({checked:e}){return"<input "+(e?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
78
|
+
`}table(e){let t="",r="";for(let n=0;n<e.header.length;n++)r+=this.tablecell(e.header[n]);t+=this.tablerow({text:r});let s="";for(let n=0;n<e.rows.length;n++){let o=e.rows[n];r="";for(let a=0;a<o.length;a++)r+=this.tablecell(o[a]);s+=this.tablerow({text:r})}return s&&(s=`<tbody>${s}</tbody>`),`<table>
|
|
79
79
|
<thead>
|
|
80
|
-
`+
|
|
81
|
-
`+
|
|
82
|
-
`}tablerow({text:
|
|
83
|
-
${
|
|
84
|
-
`}tablecell(
|
|
85
|
-
`}strong({tokens:
|
|
86
|
-
`+this.renderer.text(a);t?r+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:!0}]}):r+=l;continue}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}parseInline(e,t=this.renderer){let r="";for(let s=0;s<e.length;s++){let n=e[s];if(this.options.extensions?.renderers?.[n.type]){let a=this.options.extensions.renderers[n.type].call({parser:this},n);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){r+=a||"";continue}}let o=n;switch(o.type){case"escape":{r+=t.text(o);break}case"html":{r+=t.html(o);break}case"link":{r+=t.link(o);break}case"image":{r+=t.image(o);break}case"strong":{r+=t.strong(o);break}case"em":{r+=t.em(o);break}case"codespan":{r+=t.codespan(o);break}case"br":{r+=t.br(o);break}case"del":{r+=t.del(o);break}case"text":{r+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}},
|
|
87
|
-
Please report this to https://github.com/markedjs/marked.`,i){let r="<p>An error occurred:</p><pre>"+Ei(t.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(t);throw t}}},qr=new d1;function ue(i,e){return qr.parse(i,e)}ue.options=ue.setOptions=function(i){return qr.setOptions(i),ue.defaults=qr.defaults,ff(ue.defaults),ue};ue.getDefaults=ku;ue.defaults=Vr;ue.use=function(...i){return qr.use(...i),ue.defaults=qr.defaults,ff(ue.defaults),ue};ue.walkTokens=function(i,e){return qr.walkTokens(i,e)};ue.parseInline=qr.parseInline;ue.Parser=$i;ue.parser=$i.parse;ue.Renderer=_a;ue.TextRenderer=Lu;ue.Lexer=Hi;ue.lexer=Hi.lex;ue.Tokenizer=Aa;ue.Hooks=xa;ue.parse=ue;var mP=ue.options,gP=ue.setOptions,vP=ue.use,bP=ue.walkTokens,yP=ue.parseInline;var wP=$i.parse,SP=Hi.lex;var Fa=class extends K{static targets=["textarea"];connect(){this.easyMDE||(this.originalValue=this.element.value,this.easyMDE=new EasyMDE(this.#t()),this.element.addEventListener("turbo:before-morph-element",i=>{i.target===this.element&&this.easyMDE&&(this.storedValue=this.easyMDE.value())}),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&requestAnimationFrame(()=>this.#e())}))}disconnect(){if(this.easyMDE){try{this.element.isConnected&&this.element.parentNode&&this.easyMDE.toTextArea()}catch(i){console.warn("EasyMDE cleanup error:",i)}this.easyMDE=null}}#e(){this.element.isConnected&&(this.easyMDE&&(this.easyMDE=null),this.easyMDE=new EasyMDE(this.#t()),this.storedValue!==void 0&&(this.easyMDE.value(this.storedValue),this.storedValue=void 0))}#t(){let i={element:this.element,promptURLs:!0,spellChecker:!1,previewRender:e=>{let t=Rs.sanitize(e,{ALLOWED_TAGS:["strong","em","sub","sup","details","summary"],ALLOWED_ATTR:[]}),r=ue(t);return Rs.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 Oa=class extends K{connect(){this.slimSelect||(this.#e(),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#t(),this.morphing=!1}))}))}#e(){let i={};if(document.querySelector('[data-controller="remote-modal"]')){this.dropdownContainer=document.createElement("div"),this.dropdownContainer.className="ss-dropdown-container";let t=this.element.parentNode;getComputedStyle(t).position==="static"&&(t.style.position="relative",this.modifiedSelectWrapper=t),this.element.parentNode.insertBefore(this.dropdownContainer,this.element.nextSibling),i.contentLocation=this.dropdownContainer,i.contentPosition="absolute",i.openPosition="auto"}this.slimSelect=new SlimSelect({select:this.element,settings:i}),this.handleDropdownPosition(),this.boundHandleDropdownOpen=this.handleDropdownOpen.bind(this),this.boundHandleDropdownClose=this.handleDropdownClose.bind(this),this.element.addEventListener("ss:open",this.boundHandleDropdownOpen),this.element.addEventListener("ss:close",this.boundHandleDropdownClose),this.setupAriaObserver()}handleDropdownPosition(){if(this.dropdownContainer){let i=()=>{let e=this.element.getBoundingClientRect(),t=window.innerHeight-e.bottom,r=e.top;t<200&&r>t?(this.dropdownContainer.style.top="auto",this.dropdownContainer.style.bottom="100%",this.dropdownContainer.style.borderRadius="0.375rem 0.375rem 0 0"):(this.dropdownContainer.style.bottom="auto",this.dropdownContainer.style.borderRadius="0 0 0.375rem 0.375rem")};setTimeout(i,0),window.addEventListener("resize",i),window.addEventListener("scroll",i),this.repositionDropdown=i}}handleDropdownOpen(){this.dropdownContainer&&(this.dropdownContainer.style.height="auto",this.dropdownContainer.style.overflow="visible",this.dropdownContainer.classList.add("ss-active"),document.querySelectorAll(".ss-dropdown-container").forEach(e=>{e!==this.dropdownContainer&&(e.style.zIndex="9999")}),this.dropdownContainer.style.zIndex="10000")}handleDropdownClose(){this.dropdownContainer&&this.dropdownContainer.classList.remove("ss-active")}setupAriaObserver(){if(this.element){this.ariaObserver=new MutationObserver(t=>{t.forEach(r=>{r.attributeName==="aria-expanded"&&(r.target.getAttribute("aria-expanded")==="true"?this.handleDropdownOpen():this.handleDropdownClose())})});let e=[this.element,this.element.parentNode.querySelector(".ss-main"),this.element.parentNode.querySelector("[aria-expanded]")].find(t=>t&&t.hasAttribute&&t.hasAttribute("aria-expanded"));e&&(this.ariaObserver.observe(e,{attributes:!0,attributeFilter:["aria-expanded"]}),e.getAttribute("aria-expanded")==="true"?this.handleDropdownOpen():this.handleDropdownClose())}}disconnect(){this.#i()}#t(){this.element.isConnected&&(this.#i(),this.#e())}#i(){this.element&&(this.boundHandleDropdownOpen&&this.element.removeEventListener("ss:open",this.boundHandleDropdownOpen),this.boundHandleDropdownClose&&this.element.removeEventListener("ss:close",this.boundHandleDropdownClose)),this.ariaObserver&&(this.ariaObserver.disconnect(),this.ariaObserver=null),this.slimSelect&&(this.slimSelect.destroy(),this.slimSelect=null),this.repositionDropdown&&(window.removeEventListener("resize",this.repositionDropdown),window.removeEventListener("scroll",this.repositionDropdown),this.repositionDropdown=null),this.dropdownContainer&&this.dropdownContainer.parentNode&&(this.dropdownContainer.parentNode.removeChild(this.dropdownContainer),this.dropdownContainer=null),this.modifiedSelectWrapper&&(this.modifiedSelectWrapper.style.position="",this.modifiedSelectWrapper=null)}};var Ra=class extends K{connect(){this.picker||(this.modal=document.querySelector("[data-controller=remote-modal]"),this.picker=new flatpickr(this.element,this.#t()),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}disconnect(){this.picker&&(this.picker.destroy(),this.picker=null)}#e(){this.element.isConnected&&(this.picker&&(this.picker.destroy(),this.picker=null),this.modal=document.querySelector("[data-controller=remote-modal]"),this.picker=new flatpickr(this.element,this.#t()))}#t(){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),this.modal&&(i.appendTo=this.modal),i}};var La=class extends K{static targets=["input"];connect(){}disconnect(){this.inputTargetDisconnected()}inputTargetConnected(){!this.hasInputTarget||this.iti||(this.iti=window.intlTelInput(this.inputTarget,this.#t()),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}inputTargetDisconnected(){this.iti&&(this.iti.destroy(),this.iti=null)}#e(){!this.inputTarget||!this.inputTarget.isConnected||(this.iti&&(this.iti.destroy(),this.iti=null),this.iti=window.intlTelInput(this.inputTarget,this.#t()))}#t(){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 Ma=class extends K{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 Ia=class extends K{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 Da(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var p1=0;function Af(i){return"__private_"+p1+++"_"+i}function f1(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<a.length-1&&r.push(t)})),r}function kf(i,e){let t=/\$/g,r="$$$$",s=[i];if(e==null)return s;for(let n of Object.keys(e))if(n!=="_"){let o=e[n];typeof o=="string"&&(o=t[Symbol.replace](o,r)),s=f1(s,new RegExp(`%\\{${n}\\}`,"g"),o)}return s}var m1=i=>{throw new Error(`missing string: ${i}`)},_n=Af("onMissingKey"),Cn=Af("apply"),jr=class{constructor(e,t){let{onMissingKey:r=m1}=t===void 0?{}:t;Object.defineProperty(this,Cn,{value:g1}),Object.defineProperty(this,_n,{writable:!0,value:void 0}),this.locale={strings:{},pluralize(s){return s===1?0:1}},Array.isArray(e)?e.forEach(Da(this,Cn)[Cn],this):Da(this,Cn)[Cn](e),Da(this,_n)[_n]=r}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){let r=this.locale.strings[e];if(r==null&&(Da(this,_n)[_n](e),r=e),typeof r=="object"){if(t&&typeof t.smart_count<"u"){let n=this.locale.pluralize(t.smart_count);return kf(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 kf(r,t)}};function g1(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 Tm=Te(Cf(),1);var v1="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var gr=(i=21)=>{let e="",t=i|0;for(;t--;)e+=v1[Math.random()*64|0];return e};var xm=Te(am(),1);function Ba(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var uS=0;function lm(i){return"__private_"+uS+++"_"+i}var hS={version:"4.2.0"},Wr=lm("callbacks"),Bu=lm("publish"),Ua=class{constructor(){Object.defineProperty(this,Bu,{value:dS}),this.state={},Object.defineProperty(this,Wr,{writable:!0,value:new Set})}getState(){return this.state}setState(e){let t={...this.state},r={...this.state,...e};this.state=r,Ba(this,Bu)[Bu](t,r,e)}subscribe(e){return Ba(this,Wr)[Wr].add(e),()=>{Ba(this,Wr)[Wr].delete(e)}}};function dS(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];Ba(this,Wr)[Wr].forEach(r=>{r(...e)})}Ua.VERSION=hS.version;var cm=Ua;function Gr(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 Uu={__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",msg:"application/vnd.ms-outlook",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 Fn(i){var e;if(i.type)return i.type;let t=i.name?(e=Gr(i.name).extension)==null?void 0:e.toLowerCase():null;return t&&t in Uu?Uu[t]:"application/octet-stream"}function pS(i){return i.charCodeAt(0).toString(32)}function um(i){let e="";return i.replace(/[^A-Z0-9]/gi,t=>(e+=`-${pS(t)}`,"/"))+e}function hm(i,e){let t=e||"uppy";return typeof i.name=="string"&&(t+=`-${um(i.name.toLowerCase())}`),i.type!==void 0&&(t+=`-${i.type}`),i.meta&&typeof i.meta.relativePath=="string"&&(t+=`-${um(i.meta.relativePath.toLowerCase())}`),i.data.size!==void 0&&(t+=`-${i.data.size}`),i.data.lastModified!==void 0&&(t+=`-${i.data.lastModified}`),t}function fS(i){return!i.isRemote||!i.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(i.remote.provider)}function za(i,e){if(fS(i))return i.id;let t=Fn(i);return hm({...i,type:t},e)}function zu(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 Hu(i,e){return e.name?e.name:i.split("/")[0]==="image"?`${i.split("/")[0]}.${i.split("/")[1]}`:"noname"}function $u(i){return i<10?`0${i}`:i.toString()}function Ls(){let i=new Date,e=$u(i.getHours()),t=$u(i.getMinutes()),r=$u(i.getSeconds());return`${e}:${t}:${r}`}var dm={debug:()=>{},warn:()=>{},error:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.error(`[Uppy] [${Ls()}]`,...e)}},pm={debug:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.debug(`[Uppy] [${Ls()}]`,...e)},warn:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.warn(`[Uppy] [${Ls()}]`,...e)},error:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.error(`[Uppy] [${Ls()}]`,...e)}};var On=Te(Ha(),1),wm=Te(ym(),1),Sm={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]},_t=class extends Error{constructor(e,t){var r;super(e),this.isRestriction=!0,this.isUserFacing=(r=t?.isUserFacing)!=null?r:!0,t!=null&&t.file&&(this.file=t.file)}},$a=class{constructor(e,t){this.getI18n=t,this.getOpts=()=>{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 _t(`${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 _t(this.getI18n()("aggregateExceedsSize",{sizeAllowed:(0,On.default)(r),size:(0,On.default)(n)}))}}validateSingleFile(e){let{maxFileSize:t,minFileSize:r,allowedFileTypes:s}=this.getOpts().restrictions;if(s&&!s.some(a=>a.includes("/")?e.type?(0,wm.default)(e.type.replace(/;.*?$/,""),a):!1:a[0]==="."&&e.extension?e.extension.toLowerCase()===a.slice(1).toLowerCase():!1)){let a=s.join(", ");throw new _t(this.getI18n()("youCanOnlyUploadFileTypes",{types:a}),{file:e})}if(t&&e.size!=null&&e.size>t){var n;throw new _t(this.getI18n()("exceedsSize",{size:(0,On.default)(t),file:(n=e.name)!=null?n:this.getI18n()("unnamed")}),{file:e})}if(r&&e.size!=null&&e.size<r)throw new _t(this.getI18n()("inferiorSize",{size:(0,On.default)(r)}),{file:e})}validate(e,t){t.forEach(r=>{this.validateSingleFile(r)}),this.validateAggregateRestrictions(e,t)}validateMinNumberOfFiles(e){let{minNumberOfFiles:t}=this.getOpts().restrictions;if(t&&Object.keys(e).length<t)throw new _t(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){var t;let r=new _t(this.getI18n()("missingRequiredMetaFieldOnFile",{fileName:(t=e.name)!=null?t:this.getI18n()("unnamed")})),{requiredMetaFields:s}=this.getOpts().restrictions,n=[];for(let o of s)(!Object.hasOwn(e.meta,o)||e.meta[o]==="")&&n.push(o);return{missingFields:n,error:r}}};var Em={strings:{addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},aggregateExceedsSize:"You selected %{size} of files, but maximum allowed size is %{sizeAllowed}",exceedsSize:"%{file} exceeds maximum allowed size of %{size}",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",inferiorSize:"This file is smaller than the allowed size of %{size}",youCanOnlyUploadFileTypes:"You can only upload: %{types}",noMoreFilesAllowed:"Cannot add more files",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",companionError:"Connection with Companion failed",authAborted:"Authentication aborted",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",noSearchResults:"Unfortunately, there are no results for this search",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},allFilesFromFolderNamed:"All files from folder %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",logIn:"Log in",pickFiles:"Pick files",pickPhotos:"Pick photos",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",loadedXFiles:"Loaded %{numFiles} files",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",signInWithGoogle:"Sign in with Google",searchImages:"Search for images",enterTextToSearch:"Enter text to search for images",search:"Search",resetSearch:"Reset search",emptyFolderAdded:"No files were added from empty folder",addedNumFiles:"Added %{numFiles} file(s)",folderAlreadyAdded:'The folder "%{folder}" was already added',folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"},additionalRestrictionsFailed:"%{count} additional restrictions were not fulfilled",unnamed:"Unnamed",pleaseWait:"Please wait"}};function V(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var vS=0;function me(i){return"__private_"+vS+++"_"+i}var bS={version:"4.4.7"},qa={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null},et=me("plugins"),tt=me("restricter"),Rn=me("storeUnsubscribe"),qi=me("emitter"),Kr=me("preProcessors"),Xr=me("uploaders"),Wi=me("postProcessors"),Lt=me("informAndEmit"),zn=me("checkRequiredMetaFieldsOnFile"),qu=me("checkRequiredMetaFields"),Ln=me("assertNewUploadAllowed"),Wu=me("transformFile"),Mn=me("startIfAutoProceed"),In=me("checkAndUpdateFileState"),Un=me("getFilesToRetry"),Dn=me("doRetryAll"),Gu=me("handleUploadProgress"),Nn=me("updateTotalProgress"),Gi=me("updateTotalProgressThrottled"),Ku=me("calculateTotalProgress"),Vu=me("addListeners"),hi=me("updateOnlineStatus"),Bn=me("requestClientById"),Vi=me("createUpload"),ju=me("getUpload"),Yr=me("removeUpload"),ji=me("runUpload"),Va=class i{constructor(e){Object.defineProperty(this,ji,{value:MS}),Object.defineProperty(this,Yr,{value:LS}),Object.defineProperty(this,ju,{value:RS}),Object.defineProperty(this,Vi,{value:OS}),Object.defineProperty(this,Vu,{value:FS}),Object.defineProperty(this,Ku,{value:PS}),Object.defineProperty(this,Nn,{value:CS}),Object.defineProperty(this,Dn,{value:_S}),Object.defineProperty(this,Un,{value:AS}),Object.defineProperty(this,In,{value:kS}),Object.defineProperty(this,Mn,{value:xS}),Object.defineProperty(this,Wu,{value:TS}),Object.defineProperty(this,Ln,{value:ES}),Object.defineProperty(this,qu,{value:SS}),Object.defineProperty(this,zn,{value:wS}),Object.defineProperty(this,Lt,{value:yS}),Object.defineProperty(this,et,{writable:!0,value:Object.create(null)}),Object.defineProperty(this,tt,{writable:!0,value:void 0}),Object.defineProperty(this,Rn,{writable:!0,value:void 0}),Object.defineProperty(this,qi,{writable:!0,value:(0,Tm.default)()}),Object.defineProperty(this,Kr,{writable:!0,value:new Set}),Object.defineProperty(this,Xr,{writable:!0,value:new Set}),Object.defineProperty(this,Wi,{writable:!0,value:new Set}),this.scheduledAutoProceed=null,this.wasOffline=!1,Object.defineProperty(this,Gu,{writable:!0,value:(s,n)=>{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}}),V(this,Gi)[Gi]()}}),Object.defineProperty(this,Gi,{writable:!0,value:(0,xm.default)(()=>V(this,Nn)[Nn](),500,{leading:!0,trailing:!0})}),Object.defineProperty(this,hi,{writable:!0,value:this.updateOnlineStatus.bind(this)}),Object.defineProperty(this,Bn,{writable:!0,value:new Map}),this.defaultLocale=Em;let t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:Sm,meta:{},onBeforeFileAdded:(s,n)=>!Object.hasOwn(n,s.id),onBeforeUpload:s=>s,store:new cm,logger:dm,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=pm),this.log(`Using Core v${i.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...qa,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:zu(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),V(this,tt)[tt]=new $a(()=>this.opts,()=>this.i18n),V(this,Rn)[Rn]=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),V(this,Vu)[Vu]()}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];V(this,qi)[qi].emit(e,...r)}on(e,t){return V(this,qi)[qi].on(e,t),this}once(e,t){return V(this,qi)[qi].once(e,t),this}off(e,t){return V(this,qi)[qi].off(e,t),this}updateAll(e){this.iteratePlugins(t=>{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 jr([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,...qa})}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({...qa,files:{}})}addPreProcessor(e){V(this,Kr)[Kr].add(e)}removePreProcessor(e){return V(this,Kr)[Kr].delete(e)}addPostProcessor(e){V(this,Wi)[Wi].add(e)}removePostProcessor(e){return V(this,Wi)[Wi].delete(e)}addUploader(e){V(this,Xr)[Xr].add(e)}removeUploader(e){return V(this,Xr)[Xr].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=[],g=[],b=[];for(let w of s){let{progress:P}=w;!P.uploadComplete&&P.uploadStarted&&(n.push(w),w.isPaused||g.push(w)),P.uploadStarted||o.push(w),(P.uploadStarted||P.preprocess||P.postprocess)&&a.push(w),P.uploadStarted&&l.push(w),w.isPaused&&c.push(w),P.uploadComplete&&d.push(w),w.error&&f.push(w),(P.preprocess||P.postprocess)&&b.push(w)}return{newFiles:o,startedFiles:a,uploadStartedFiles:l,pausedFiles:c,completeFiles:d,erroredFiles:f,inProgressFiles:n,inProgressNotPausedFiles:g,processingFiles:b,isUploadStarted:l.length>0,isAllComplete:t===100&&d.length===s.length&&b.length===0,isAllErrored:!!r&&f.length===s.length,isAllPaused:n.length!==0&&c.length===n.length,isUploadInProgress:n.length>0,isSomeGhost:s.some(w=>w.isGhost)}}validateRestrictions(e,t){t===void 0&&(t=this.getFiles());try{V(this,tt)[tt].validate(t,[e])}catch(r){return r}return null}validateSingleFile(e){try{V(this,tt)[tt].validateSingleFile(e)}catch(t){return t.message}return null}validateAggregateRestrictions(e){let t=this.getFiles();try{V(this,tt)[tt].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){V(this,Ln)[Ln](e);let{nextFilesState:t,validFilesToAdd:r,errors:s}=V(this,In)[In]([e]),n=s.filter(a=>a.isRestriction);if(V(this,Lt)[Lt](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}`),V(this,Mn)[Mn](),o.id}addFiles(e){V(this,Ln)[Ln]();let{nextFilesState:t,validFilesToAdd:r,errors:s}=V(this,In)[In](e),n=s.filter(a=>a.isRestriction);V(this,Lt)[Lt](n);let o=s.filter(a=>!a.isRestriction);if(o.length>0){let a=`Multiple errors occurred while adding files:
|
|
80
|
+
`+t+`</thead>
|
|
81
|
+
`+s+`</table>
|
|
82
|
+
`}tablerow({text:e}){return`<tr>
|
|
83
|
+
${e}</tr>
|
|
84
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),r=e.header?"th":"td";return(e.align?`<${r} align="${e.align}">`:`<${r}>`)+t+`</${r}>
|
|
85
|
+
`}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${Ei(e,!0)}</code>`}br(e){return"<br>"}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,tokens:r}){let s=this.parser.parseInline(r),n=sf(e);if(n===null)return s;e=n;let o='<a href="'+e+'"';return t&&(o+=' title="'+Ei(t)+'"'),o+=">"+s+"</a>",o}image({href:e,title:t,text:r}){let s=sf(e);if(s===null)return Ei(r);e=s;let n=`<img src="${e}" alt="${r}"`;return t&&(n+=` title="${Ei(t)}"`),n+=">",n}text(e){return"tokens"in e&&e.tokens?this.parser.parseInline(e.tokens):"escaped"in e&&e.escaped?e.text:Ei(e.text)}},Pn=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return""+e}image({text:e}){return""+e}br(){return""}},ui=class i{options;renderer;textRenderer;constructor(e){this.options=e||Hr,this.options.renderer=this.options.renderer||new Is,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Pn}static parse(e,t){return new i(t).parse(e)}static parseInline(e,t){return new i(t).parseInline(e)}parse(e,t=!0){let r="";for(let s=0;s<e.length;s++){let n=e[s];if(this.options.extensions?.renderers?.[n.type]){let a=n,l=this.options.extensions.renderers[a.type].call({parser:this},a);if(l!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(a.type)){r+=l||"";continue}}let o=n;switch(o.type){case"space":{r+=this.renderer.space(o);continue}case"hr":{r+=this.renderer.hr(o);continue}case"heading":{r+=this.renderer.heading(o);continue}case"code":{r+=this.renderer.code(o);continue}case"table":{r+=this.renderer.table(o);continue}case"blockquote":{r+=this.renderer.blockquote(o);continue}case"list":{r+=this.renderer.list(o);continue}case"html":{r+=this.renderer.html(o);continue}case"paragraph":{r+=this.renderer.paragraph(o);continue}case"text":{let a=o,l=this.renderer.text(a);for(;s+1<e.length&&e[s+1].type==="text";)a=e[++s],l+=`
|
|
86
|
+
`+this.renderer.text(a);t?r+=this.renderer.paragraph({type:"paragraph",raw:l,text:l,tokens:[{type:"text",raw:l,text:l,escaped:!0}]}):r+=l;continue}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}parseInline(e,t=this.renderer){let r="";for(let s=0;s<e.length;s++){let n=e[s];if(this.options.extensions?.renderers?.[n.type]){let a=this.options.extensions.renderers[n.type].call({parser:this},n);if(a!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(n.type)){r+=a||"";continue}}let o=n;switch(o.type){case"escape":{r+=t.text(o);break}case"html":{r+=t.html(o);break}case"link":{r+=t.link(o);break}case"image":{r+=t.image(o);break}case"strong":{r+=t.strong(o);break}case"em":{r+=t.em(o);break}case"codespan":{r+=t.codespan(o);break}case"br":{r+=t.br(o);break}case"del":{r+=t.del(o);break}case"text":{r+=t.text(o);break}default:{let a='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(a),"";throw new Error(a)}}}return r}},Rs=class{options;block;constructor(e){this.options=e||Hr}static passThroughHooks=new Set(["preprocess","postprocess","processAllTokens"]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}provideLexer(){return this.block?ci.lex:ci.lexInline}provideParser(){return this.block?ui.parse:ui.parseInline}},yu=class{defaults=wu();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=ui;Renderer=Is;TextRenderer=Pn;Lexer=ci;Tokenizer=Ms;Hooks=Rs;constructor(...e){this.use(...e)}walkTokens(e,t){let r=[];for(let s of e)switch(r=r.concat(t.call(this,s)),s.type){case"table":{let n=s;for(let o of n.header)r=r.concat(this.walkTokens(o.tokens,t));for(let o of n.rows)for(let a of o)r=r.concat(this.walkTokens(a.tokens,t));break}case"list":{let n=s;r=r.concat(this.walkTokens(n.items,t));break}default:{let n=s;this.defaults.extensions?.childTokens?.[n.type]?this.defaults.extensions.childTokens[n.type].forEach(o=>{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 Is(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 Ms(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 Rs;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];Rs.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 ci.lex(e,t??this.defaults)}parser(e,t){return ui.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?ci.lex:ci.lexInline,c=o.hooks?o.hooks.provideParser():e?ui.parse:ui.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+=`
|
|
87
|
+
Please report this to https://github.com/markedjs/marked.`,e){let s="<p>An error occurred:</p><pre>"+Ei(r.message+"",!0)+"</pre>";return t?Promise.resolve(s):s}if(t)return Promise.reject(r);throw r}}},zr=new yu;function me(i,e){return zr.parse(i,e)}me.options=me.setOptions=function(i){return zr.setOptions(i),me.defaults=zr.defaults,af(me.defaults),me};me.getDefaults=wu;me.defaults=Hr;me.use=function(...i){return zr.use(...i),me.defaults=zr.defaults,af(me.defaults),me};me.walkTokens=function(i,e){return zr.walkTokens(i,e)};me.parseInline=zr.parseInline;me.Parser=ui;me.parser=ui.parse;me.Renderer=Is;me.TextRenderer=Pn;me.Lexer=ci;me.lexer=ci.lex;me.Tokenizer=Ms;me.Hooks=Rs;me.parse=me;var IP=me.options,DP=me.setOptions,NP=me.use,BP=me.walkTokens,UP=me.parseInline;var zP=ui.parse,HP=ci.lex;var Ca=class extends J{static targets=["textarea"];connect(){this.easyMDE||(this.originalValue=this.element.value,this.easyMDE=new EasyMDE(this.#t()),this.element.addEventListener("turbo:before-morph-element",i=>{i.target===this.element&&this.easyMDE&&(this.storedValue=this.easyMDE.value())}),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&requestAnimationFrame(()=>this.#e())}))}disconnect(){if(this.easyMDE){try{this.element.isConnected&&this.element.parentNode&&this.easyMDE.toTextArea()}catch(i){console.warn("EasyMDE cleanup error:",i)}this.easyMDE=null}}#e(){this.element.isConnected&&(this.easyMDE&&(this.easyMDE=null),this.easyMDE=new EasyMDE(this.#t()),this.storedValue!==void 0&&(this.easyMDE.value(this.storedValue),this.storedValue=void 0))}#t(){let i={element:this.element,promptURLs:!0,spellChecker:!1,previewRender:e=>{let t=Ls.sanitize(e,{ALLOWED_TAGS:["strong","em","sub","sup","details","summary"],ALLOWED_ATTR:[]}),r=me(t);return Ls.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 Pa=class extends J{connect(){this.slimSelect||(this.#e(),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#t(),this.morphing=!1}))}))}#e(){let i={};if(document.querySelector('[data-controller="remote-modal"]')){this.dropdownContainer=document.createElement("div"),this.dropdownContainer.className="ss-dropdown-container";let t=this.element.parentNode;getComputedStyle(t).position==="static"&&(t.style.position="relative",this.modifiedSelectWrapper=t),this.element.parentNode.insertBefore(this.dropdownContainer,this.element.nextSibling),i.contentLocation=this.dropdownContainer,i.contentPosition="absolute",i.openPosition="auto"}this.slimSelect=new SlimSelect({select:this.element,settings:i}),this.handleDropdownPosition(),this.boundHandleDropdownOpen=this.handleDropdownOpen.bind(this),this.boundHandleDropdownClose=this.handleDropdownClose.bind(this),this.element.addEventListener("ss:open",this.boundHandleDropdownOpen),this.element.addEventListener("ss:close",this.boundHandleDropdownClose),this.setupAriaObserver()}handleDropdownPosition(){if(this.dropdownContainer){let i=()=>{let e=this.element.getBoundingClientRect(),t=window.innerHeight-e.bottom,r=e.top;t<200&&r>t?(this.dropdownContainer.style.top="auto",this.dropdownContainer.style.bottom="100%",this.dropdownContainer.style.borderRadius="0.375rem 0.375rem 0 0"):(this.dropdownContainer.style.bottom="auto",this.dropdownContainer.style.borderRadius="0 0 0.375rem 0.375rem")};setTimeout(i,0),window.addEventListener("resize",i),window.addEventListener("scroll",i),this.repositionDropdown=i}}handleDropdownOpen(){this.dropdownContainer&&(this.dropdownContainer.style.height="auto",this.dropdownContainer.style.overflow="visible",this.dropdownContainer.classList.add("ss-active"),document.querySelectorAll(".ss-dropdown-container").forEach(e=>{e!==this.dropdownContainer&&(e.style.zIndex="9999")}),this.dropdownContainer.style.zIndex="10000")}handleDropdownClose(){this.dropdownContainer&&this.dropdownContainer.classList.remove("ss-active")}setupAriaObserver(){if(this.element){this.ariaObserver=new MutationObserver(t=>{t.forEach(r=>{r.attributeName==="aria-expanded"&&(r.target.getAttribute("aria-expanded")==="true"?this.handleDropdownOpen():this.handleDropdownClose())})});let e=[this.element,this.element.parentNode.querySelector(".ss-main"),this.element.parentNode.querySelector("[aria-expanded]")].find(t=>t&&t.hasAttribute&&t.hasAttribute("aria-expanded"));e&&(this.ariaObserver.observe(e,{attributes:!0,attributeFilter:["aria-expanded"]}),e.getAttribute("aria-expanded")==="true"?this.handleDropdownOpen():this.handleDropdownClose())}}disconnect(){this.#i()}#t(){this.element.isConnected&&(this.#i(),this.#e())}#i(){this.element&&(this.boundHandleDropdownOpen&&this.element.removeEventListener("ss:open",this.boundHandleDropdownOpen),this.boundHandleDropdownClose&&this.element.removeEventListener("ss:close",this.boundHandleDropdownClose)),this.ariaObserver&&(this.ariaObserver.disconnect(),this.ariaObserver=null),this.slimSelect&&(this.slimSelect.destroy(),this.slimSelect=null),this.repositionDropdown&&(window.removeEventListener("resize",this.repositionDropdown),window.removeEventListener("scroll",this.repositionDropdown),this.repositionDropdown=null),this.dropdownContainer&&this.dropdownContainer.parentNode&&(this.dropdownContainer.parentNode.removeChild(this.dropdownContainer),this.dropdownContainer=null),this.modifiedSelectWrapper&&(this.modifiedSelectWrapper.style.position="",this.modifiedSelectWrapper=null)}};var Fa=class extends J{connect(){this.picker||(this.modal=document.querySelector("[data-controller=remote-modal]"),this.picker=new flatpickr(this.element,this.#t()),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}disconnect(){this.picker&&(this.picker.destroy(),this.picker=null)}#e(){this.element.isConnected&&(this.picker&&(this.picker.destroy(),this.picker=null),this.modal=document.querySelector("[data-controller=remote-modal]"),this.picker=new flatpickr(this.element,this.#t()))}#t(){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),this.modal&&(i.appendTo=this.modal),i}};var _a=class extends J{static targets=["input"];connect(){}disconnect(){this.inputTargetDisconnected()}inputTargetConnected(){!this.hasInputTarget||this.iti||(this.iti=window.intlTelInput(this.inputTarget,this.#t()),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}inputTargetDisconnected(){this.iti&&(this.iti.destroy(),this.iti=null)}#e(){!this.inputTarget||!this.inputTarget.isConnected||(this.iti&&(this.iti.destroy(),this.iti=null),this.iti=window.intlTelInput(this.inputTarget,this.#t()))}#t(){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 Oa=class extends J{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 La=class extends J{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 Ra(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var Gw=0;function yf(i){return"__private_"+Gw+++"_"+i}function Kw(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<a.length-1&&r.push(t)})),r}function bf(i,e){let t=/\$/g,r="$$$$",s=[i];if(e==null)return s;for(let n of Object.keys(e))if(n!=="_"){let o=e[n];typeof o=="string"&&(o=t[Symbol.replace](o,r)),s=Kw(s,new RegExp(`%\\{${n}\\}`,"g"),o)}return s}var Xw=i=>{throw new Error(`missing string: ${i}`)},_n=yf("onMissingKey"),On=yf("apply"),$r=class{constructor(e,t){let{onMissingKey:r=Xw}=t===void 0?{}:t;Object.defineProperty(this,On,{value:Yw}),Object.defineProperty(this,_n,{writable:!0,value:void 0}),this.locale={strings:{},pluralize(s){return s===1?0:1}},Array.isArray(e)?e.forEach(Ra(this,On)[On],this):Ra(this,On)[On](e),Ra(this,_n)[_n]=r}translate(e,t){return this.translateArray(e,t).join("")}translateArray(e,t){let r=this.locale.strings[e];if(r==null&&(Ra(this,_n)[_n](e),r=e),typeof r=="object"){if(t&&typeof t.smart_count<"u"){let n=this.locale.pluralize(t.smart_count);return bf(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 bf(r,t)}};function Yw(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 gm=Fe(Sf(),1);var Zw="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";var mr=(i=21)=>{let e="",t=i|0;for(;t--;)e+=Zw[Math.random()*64|0];return e};var vm=Fe(em(),1);function Ia(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var V1=0;function tm(i){return"__private_"+V1+++"_"+i}var j1={version:"4.2.0"},qr=tm("callbacks"),Lu=tm("publish"),Da=class{constructor(){Object.defineProperty(this,Lu,{value:W1}),this.state={},Object.defineProperty(this,qr,{writable:!0,value:new Set})}getState(){return this.state}setState(e){let t={...this.state},r={...this.state,...e};this.state=r,Ia(this,Lu)[Lu](t,r,e)}subscribe(e){return Ia(this,qr)[qr].add(e),()=>{Ia(this,qr)[qr].delete(e)}}};function W1(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];Ia(this,qr)[qr].forEach(r=>{r(...e)})}Da.VERSION=j1.version;var im=Da;function Vr(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 Ru={__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 Rn(i){var e;if(i.type)return i.type;let t=i.name?(e=Vr(i.name).extension)==null?void 0:e.toLowerCase():null;return t&&t in Ru?Ru[t]:"application/octet-stream"}function G1(i){return i.charCodeAt(0).toString(32)}function rm(i){let e="";return i.replace(/[^A-Z0-9]/gi,t=>(e+=`-${G1(t)}`,"/"))+e}function sm(i,e){let t=e||"uppy";return typeof i.name=="string"&&(t+=`-${rm(i.name.toLowerCase())}`),i.type!==void 0&&(t+=`-${i.type}`),i.meta&&typeof i.meta.relativePath=="string"&&(t+=`-${rm(i.meta.relativePath.toLowerCase())}`),i.data.size!==void 0&&(t+=`-${i.data.size}`),i.data.lastModified!==void 0&&(t+=`-${i.data.lastModified}`),t}function K1(i){return!i.isRemote||!i.remote?!1:new Set(["box","dropbox","drive","facebook","unsplash"]).has(i.remote.provider)}function Na(i,e){if(K1(i))return i.id;let t=Rn(i);return sm({...i,type:t},e)}function Mu(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 Iu(i,e){return e.name?e.name:i.split("/")[0]==="image"?`${i.split("/")[0]}.${i.split("/")[1]}`:"noname"}function Du(i){return i<10?`0${i}`:i.toString()}function Ds(){let i=new Date,e=Du(i.getHours()),t=Du(i.getMinutes()),r=Du(i.getSeconds());return`${e}:${t}:${r}`}var nm={debug:()=>{},warn:()=>{},error:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.error(`[Uppy] [${Ds()}]`,...e)}},om={debug:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.debug(`[Uppy] [${Ds()}]`,...e)},warn:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.warn(`[Uppy] [${Ds()}]`,...e)},error:function(){for(var i=arguments.length,e=new Array(i),t=0;t<i;t++)e[t]=arguments[t];return console.error(`[Uppy] [${Ds()}]`,...e)}};var Mn=Fe(Ba(),1),pm=Fe(dm(),1),fm={maxFileSize:null,minFileSize:null,maxTotalFileSize:null,maxNumberOfFiles:null,minNumberOfFiles:null,allowedFileTypes:null,requiredMetaFields:[]},Pt=class extends Error{constructor(e,t){var r;super(e),this.isRestriction=!0,this.isUserFacing=(r=t?.isUserFacing)!=null?r:!0,t!=null&&t.file&&(this.file=t.file)}},Ua=class{constructor(e,t){this.getI18n=t,this.getOpts=()=>{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 Pt(`${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 Pt(this.getI18n()("aggregateExceedsSize",{sizeAllowed:(0,Mn.default)(r),size:(0,Mn.default)(n)}))}}validateSingleFile(e){let{maxFileSize:t,minFileSize:r,allowedFileTypes:s}=this.getOpts().restrictions;if(s&&!s.some(a=>a.includes("/")?e.type?(0,pm.default)(e.type.replace(/;.*?$/,""),a):!1:a[0]==="."&&e.extension?e.extension.toLowerCase()===a.slice(1).toLowerCase():!1)){let a=s.join(", ");throw new Pt(this.getI18n()("youCanOnlyUploadFileTypes",{types:a}),{file:e})}if(t&&e.size!=null&&e.size>t){var n;throw new Pt(this.getI18n()("exceedsSize",{size:(0,Mn.default)(t),file:(n=e.name)!=null?n:this.getI18n()("unnamed")}),{file:e})}if(r&&e.size!=null&&e.size<r)throw new Pt(this.getI18n()("inferiorSize",{size:(0,Mn.default)(r)}),{file:e})}validate(e,t){t.forEach(r=>{this.validateSingleFile(r)}),this.validateAggregateRestrictions(e,t)}validateMinNumberOfFiles(e){let{minNumberOfFiles:t}=this.getOpts().restrictions;if(t&&Object.keys(e).length<t)throw new Pt(this.getI18n()("youHaveToAtLeastSelectX",{smart_count:t}))}getMissingRequiredMetaFields(e){var t;let r=new Pt(this.getI18n()("missingRequiredMetaFieldOnFile",{fileName:(t=e.name)!=null?t:this.getI18n()("unnamed")})),{requiredMetaFields:s}=this.getOpts().restrictions,n=[];for(let o of s)(!Object.hasOwn(e.meta,o)||e.meta[o]==="")&&n.push(o);return{missingFields:n,error:r}}};var mm={strings:{addBulkFilesFailed:{0:"Failed to add %{smart_count} file due to an internal error",1:"Failed to add %{smart_count} files due to internal errors"},youCanOnlyUploadX:{0:"You can only upload %{smart_count} file",1:"You can only upload %{smart_count} files"},youHaveToAtLeastSelectX:{0:"You have to select at least %{smart_count} file",1:"You have to select at least %{smart_count} files"},aggregateExceedsSize:"You selected %{size} of files, but maximum allowed size is %{sizeAllowed}",exceedsSize:"%{file} exceeds maximum allowed size of %{size}",missingRequiredMetaField:"Missing required meta fields",missingRequiredMetaFieldOnFile:"Missing required meta fields in %{fileName}",inferiorSize:"This file is smaller than the allowed size of %{size}",youCanOnlyUploadFileTypes:"You can only upload: %{types}",noMoreFilesAllowed:"Cannot add more files",noDuplicates:"Cannot add the duplicate file '%{fileName}', it already exists",companionError:"Connection with Companion failed",authAborted:"Authentication aborted",companionUnauthorizeHint:"To unauthorize to your %{provider} account, please go to %{url}",failedToUpload:"Failed to upload %{file}",noInternetConnection:"No Internet connection",connectedToInternet:"Connected to the Internet",noFilesFound:"You have no files or folders here",noSearchResults:"Unfortunately, there are no results for this search",selectX:{0:"Select %{smart_count}",1:"Select %{smart_count}"},allFilesFromFolderNamed:"All files from folder %{name}",openFolderNamed:"Open folder %{name}",cancel:"Cancel",logOut:"Log out",logIn:"Log in",pickFiles:"Pick files",pickPhotos:"Pick photos",filter:"Filter",resetFilter:"Reset filter",loading:"Loading...",loadedXFiles:"Loaded %{numFiles} files",authenticateWithTitle:"Please authenticate with %{pluginName} to select files",authenticateWith:"Connect to %{pluginName}",signInWithGoogle:"Sign in with Google",searchImages:"Search for images",enterTextToSearch:"Enter text to search for images",search:"Search",resetSearch:"Reset search",emptyFolderAdded:"No files were added from empty folder",addedNumFiles:"Added %{numFiles} file(s)",folderAlreadyAdded:'The folder "%{folder}" was already added',folderAdded:{0:"Added %{smart_count} file from %{folder}",1:"Added %{smart_count} files from %{folder}"},additionalRestrictionsFailed:"%{count} additional restrictions were not fulfilled",unnamed:"Unnamed",pleaseWait:"Please wait"}};function W(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var Z1=0;function xe(i){return"__private_"+Z1+++"_"+i}var Q1={version:"4.4.2"},za={totalProgress:0,allowNewUpload:!0,error:null,recoveredState:null},at=xe("plugins"),lt=xe("restricter"),In=xe("storeUnsubscribe"),Hi=xe("emitter"),jr=xe("preProcessors"),Wr=xe("uploaders"),Vi=xe("postProcessors"),Rt=xe("informAndEmit"),Hn=xe("checkRequiredMetaFieldsOnFile"),Nu=xe("checkRequiredMetaFields"),Dn=xe("assertNewUploadAllowed"),zu=xe("transformFile"),Nn=xe("startIfAutoProceed"),Bn=xe("checkAndUpdateFileState"),Hu=xe("handleUploadProgress"),Un=xe("updateTotalProgress"),ji=xe("updateTotalProgressThrottled"),$u=xe("calculateTotalProgress"),Bu=xe("addListeners"),hi=xe("updateOnlineStatus"),zn=xe("requestClientById"),$i=xe("createUpload"),Uu=xe("getUpload"),Gr=xe("removeUpload"),qi=xe("runUpload"),Ha=class i{constructor(e){Object.defineProperty(this,qi,{value:dS}),Object.defineProperty(this,Gr,{value:hS}),Object.defineProperty(this,Uu,{value:uS}),Object.defineProperty(this,$i,{value:cS}),Object.defineProperty(this,Bu,{value:lS}),Object.defineProperty(this,$u,{value:aS}),Object.defineProperty(this,Un,{value:oS}),Object.defineProperty(this,Bn,{value:nS}),Object.defineProperty(this,Nn,{value:sS}),Object.defineProperty(this,zu,{value:rS}),Object.defineProperty(this,Dn,{value:iS}),Object.defineProperty(this,Nu,{value:tS}),Object.defineProperty(this,Hn,{value:eS}),Object.defineProperty(this,Rt,{value:J1}),Object.defineProperty(this,at,{writable:!0,value:Object.create(null)}),Object.defineProperty(this,lt,{writable:!0,value:void 0}),Object.defineProperty(this,In,{writable:!0,value:void 0}),Object.defineProperty(this,Hi,{writable:!0,value:(0,gm.default)()}),Object.defineProperty(this,jr,{writable:!0,value:new Set}),Object.defineProperty(this,Wr,{writable:!0,value:new Set}),Object.defineProperty(this,Vi,{writable:!0,value:new Set}),this.scheduledAutoProceed=null,this.wasOffline=!1,Object.defineProperty(this,Hu,{writable:!0,value:(s,n)=>{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,ji)[ji]()}}),Object.defineProperty(this,ji,{writable:!0,value:(0,vm.default)(()=>W(this,Un)[Un](),500,{leading:!0,trailing:!0})}),Object.defineProperty(this,hi,{writable:!0,value:this.updateOnlineStatus.bind(this)}),Object.defineProperty(this,zn,{writable:!0,value:new Map}),this.defaultLocale=mm;let t={id:"uppy",autoProceed:!1,allowMultipleUploadBatches:!0,debug:!1,restrictions:fm,meta:{},onBeforeFileAdded:(s,n)=>!Object.hasOwn(n,s.id),onBeforeUpload:s=>s,store:new im,logger:nm,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=om),this.log(`Using Core v${i.VERSION}`),this.i18nInit(),this.store=this.opts.store,this.setState({...za,plugins:{},files:{},currentUploads:{},capabilities:{uploadProgress:Mu(),individualCancellation:!0,resumableUploads:!1},meta:{...this.opts.meta},info:[]}),W(this,lt)[lt]=new Ua(()=>this.opts,()=>this.i18n),W(this,In)[In]=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,Bu)[Bu]()}emit(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),s=1;s<t;s++)r[s-1]=arguments[s];W(this,Hi)[Hi].emit(e,...r)}on(e,t){return W(this,Hi)[Hi].on(e,t),this}once(e,t){return W(this,Hi)[Hi].once(e,t),this}off(e,t){return W(this,Hi)[Hi].off(e,t),this}updateAll(e){this.iteratePlugins(t=>{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 $r([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,...za})}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({...za,files:{}})}addPreProcessor(e){W(this,jr)[jr].add(e)}removePreProcessor(e){return W(this,jr)[jr].delete(e)}addPostProcessor(e){W(this,Vi)[Vi].add(e)}removePostProcessor(e){return W(this,Vi)[Vi].delete(e)}addUploader(e){W(this,Wr)[Wr].add(e)}removeUploader(e){return W(this,Wr)[Wr].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:C}=x;!C.uploadComplete&&C.uploadStarted&&(n.push(x),x.isPaused||y.push(x)),C.uploadStarted||o.push(x),(C.uploadStarted||C.preprocess||C.postprocess)&&a.push(x),C.uploadStarted&&l.push(x),x.isPaused&&c.push(x),C.uploadComplete&&d.push(x),x.error&&f.push(x),(C.preprocess||C.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,lt)[lt].validate(t,[e])}catch(r){return r}return null}validateSingleFile(e){try{W(this,lt)[lt].validateSingleFile(e)}catch(t){return t.message}return null}validateAggregateRestrictions(e){let t=this.getFiles();try{W(this,lt)[lt].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,Dn)[Dn](e);let{nextFilesState:t,validFilesToAdd:r,errors:s}=W(this,Bn)[Bn]([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,Nn)[Nn](),o.id}addFiles(e){W(this,Dn)[Dn]();let{nextFilesState:t,validFilesToAdd:r,errors:s}=W(this,Bn)[Bn](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:
|
|
88
88
|
`;if(o.forEach(l=>{a+=`
|
|
89
89
|
* ${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}
|
|
90
90
|
id: ${a.id}
|
|
91
|
-
type: ${a.type}`)}),r.length>0&&
|
|
92
|
-
Uppy plugins must have unique \`id\` options.`;throw new Error(l)}return e.VERSION&&this.log(`Using ${o} v${e.VERSION}`),n.type in V(this,et)[et]?V(this,et)[et][n.type].push(n):V(this,et)[et][n.type]=[n],n.install(),this.emit("plugin-added",n),this}getPlugin(e){for(let t of Object.values(V(this,et)[et])){let r=t.find(s=>s.id===e);if(r!=null)return r}}[Symbol.for("uppy test: getPlugins")](e){return V(this,et)[et][e]}iteratePlugins(e){Object.values(V(this,et)[et]).flat(1).forEach(e)}removePlugin(e){this.log(`Removing plugin ${e.id}`),this.emit("plugin-remove",e),e.uninstall&&e.uninstall();let t=V(this,et)[et][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(),V(this,Rn)[Rn](),this.iteratePlugins(e=>{this.removePlugin(e)}),typeof window<"u"&&window.removeEventListener&&(window.removeEventListener("online",V(this,hi)[hi]),window.removeEventListener("offline",V(this,hi)[hi]))}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){V(this,Bn)[Bn].set(e,t)}getRequestClientForFile(e){if(!e.remote)throw new Error(`Tried to get RequestClient for a non-remote file ${e.id}`);let t=V(this,Bn)[Bn].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]?V(this,ji)[ji](e):(V(this,Yr)[Yr](e),Promise.reject(new Error("Nonexistent upload")))}[Symbol.for("uppy test: createUpload")](){return V(this,Vi)[Vi](...arguments)}addResultData(e,t){if(!V(this,ju)[ju](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}})}async upload(){var e;(e=V(this,et)[et].uploader)!=null&&e.length||this.log("No uploader type plugins are used","warning");let{files:t}=this.getState();if(V(this,Un)[Un]().length>0){let n=await V(this,Dn)[Dn]();if(!(this.getFiles().filter(a=>a.progress.uploadStarted==null).length>0))return this.emit("complete",n),n;({files:t}=this.getState())}let s=this.opts.onBeforeUpload(t);return s===!1?Promise.reject(new Error("Not starting the upload because onBeforeUpload returned false")):(s&&typeof s=="object"&&(t=s,this.setState({files:t})),Promise.resolve().then(()=>V(this,tt)[tt].validateMinNumberOfFiles(t)).catch(n=>{throw V(this,Lt)[Lt]([n]),n}).then(()=>{if(!V(this,qu)[qu](t))throw new _t(this.i18n("missingRequiredMetaField"))}).catch(n=>{throw n}).then(async()=>{let{currentUploads:n}=this.getState(),o=Object.values(n).flatMap(d=>d.fileIDs),a=[];Object.keys(t).forEach(d=>{let f=this.getFile(d);!f.progress.uploadStarted&&o.indexOf(d)===-1&&a.push(f.id)});let l=V(this,Vi)[Vi](a),c=await V(this,ji)[ji](l);return this.emit("complete",c),c}).catch(n=>{throw this.emit("error",n),this.log(n,"error"),n}))}};function yS(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 wS(i){let{missingFields:e,error:t}=V(this,tt)[tt].getMissingRequiredMetaFields(i);return e.length>0?(this.setFileState(i.id,{missingRequiredMetaFields:e}),this.log(t.message),this.emit("restriction-failed",i,t),!1):(e.length===0&&i.missingRequiredMetaFields&&this.setFileState(i.id,{missingRequiredMetaFields:[]}),!0)}function SS(i){let e=!0;for(let t of Object.values(i))V(this,zn)[zn](t)||(e=!1);return e}function ES(i){let{allowNewUpload:e}=this.getState();if(e===!1){let t=new _t(this.i18n("noMoreFilesAllowed"),{file:i});throw V(this,Lt)[Lt]([t]),t}}function TS(i){let e=i instanceof File?{name:i.name,type:i.type,size:i.size,data:i}:i,t=Fn(e),r=Hu(t,e),s=Gr(r).extension,n=za(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 xS(){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 kS(i){let{files:e}=this.getState(),t={...e},r=[],s=[];for(let a of i)try{var n;let l=V(this,Wu)[Wu](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 _t(this.i18n("noDuplicates",{fileName:(o=l.name)!=null?o:this.i18n("unnamed")}),{file:a})}if(d===!1&&!c)throw new _t("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:a});typeof d=="object"&&d!==null&&(l=d),V(this,tt)[tt].validateSingleFile(l),t[l.id]=l,r.push(l)}catch(l){s.push(l)}try{V(this,tt)[tt].validateAggregateRestrictions(Object.values(e),r)}catch(a){return s.push(a),{nextFilesState:e,validFilesToAdd:[],errors:s}}return{nextFilesState:t,validFilesToAdd:r,errors:s}}function AS(){let{files:i}=this.getState();return Object.keys(i).filter(e=>i[e].error)}async function _S(){let i=V(this,Un)[Un](),e={...this.getState().files};if(i.forEach(r=>{e[r]={...e[r],isPaused:!1,error:null}}),this.setState({files:e,error:null}),this.emit("retry-all",this.getFilesByIds(i)),i.length===0)return{successful:[],failed:[]};let t=V(this,Vi)[Vi](i,{forceAllowNewUpload:!0});return V(this,ji)[ji](t)}function CS(){var i,e;let t=V(this,Ku)[Ku](),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 PS(){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 FS(){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}`),V(this,Lt)[Lt]([a])}else V(this,Lt)[Lt]([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",V(this,Gu)[Gu]),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:V(this,Wi)[Wi].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}),V(this,Gi)[Gi]()}),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",()=>{V(this,Gi)[Gi]()}),this.on("dashboard:file-edit-complete",r=>{r&&V(this,zn)[zn](r)}),typeof window<"u"&&window.addEventListener&&(window.addEventListener("online",V(this,hi)[hi]),window.addEventListener("offline",V(this,hi)[hi]),setTimeout(V(this,hi)[hi],3e3))}function OS(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=gr();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 RS(i){let{currentUploads:e}=this.getState();return e[i]}function LS(i){let e={...this.getState().currentUploads};delete e[i],this.setState({currentUploads:e})}async function MS(i){let e=()=>{let{currentUploads:n}=this.getState();return n[i]},t=e(),r=[...V(this,Kr)[Kr],...V(this,Xr)[Xr],...V(this,Wi)[Wi]];try{for(let n=t.step||0;n<r.length&&t;n++){let o=r[n];this.setState({currentUploads:{...this.getState().currentUploads,[i]:{...t,step:n}}});let{fileIDs:a}=t;await o(a,i),t=e()}}catch(n){throw V(this,Yr)[Yr](i),n}if(t){t.fileIDs.forEach(l=>{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,V(this,Yr)[Yr](i)),s==null&&(this.log(`Not setting result for an upload that has been removed: ${i}`),s={successful:[],failed:[],uploadID:i}),s}Va.VERSION=bS.version;var ja=Va;var qn,Q,Pm,IS,Zr,km,Fm,Om,Rm,Zu,Xu,Yu,DS,$n={},Lm=[],NS=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Vn=Array.isArray;function Ti(i,e){for(var t in e)i[t]=e[t];return i}function Qu(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?qn.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 Hn(i,o,r,s,null)}function Hn(i,e,t,r,s){var n={type:i,props:e,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++Pm,__i:-1,__u:0};return s==null&&Q.vnode!=null&&Q.vnode(n),n}function Ka(){return{current:null}}function it(i){return i.children}function ke(i,e){this.props=i,this.context=e}function Ms(i,e){if(e==null)return i.__?Ms(i.__,i.__i+1):null;for(var t;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null)return t.__e;return typeof i.type=="function"?Ms(i):null}function Mm(i){var e,t;if((i=i.__)!=null&&i.__c!=null){for(i.__e=i.__c.base=null,e=0;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null){i.__e=i.__c.base=t.__e;break}return Mm(i)}}function Am(i){(!i.__d&&(i.__d=!0)&&Zr.push(i)&&!Ga.__r++||km!=Q.debounceRendering)&&((km=Q.debounceRendering)||Fm)(Ga)}function Ga(){for(var i,e,t,r,s,n,o,a=1;Zr.length;)Zr.length>a&&Zr.sort(Om),i=Zr.shift(),a=Zr.length,i.__d&&(t=void 0,s=(r=(e=i).__v).__e,n=[],o=[],e.__P&&((t=Ti({},r)).__v=r.__v+1,Q.vnode&&Q.vnode(t),Ju(e.__P,t,r,e.__n,e.__P.namespaceURI,32&r.__u?[s]:null,n,s??Ms(r),!!(32&r.__u),o),t.__v=r.__v,t.__.__k[t.__i]=t,Nm(n,t,o),t.__e!=s&&Mm(t)));Ga.__r=0}function Im(i,e,t,r,s,n,o,a,l,c,d){var f,g,b,w,P,R,C=r&&r.__k||Lm,k=e.length;for(l=BS(t,e,C,l,k),f=0;f<k;f++)(b=t.__k[f])!=null&&(g=b.__i==-1?$n:C[b.__i]||$n,b.__i=f,R=Ju(i,b,g,s,n,o,a,l,c,d),w=b.__e,b.ref&&g.ref!=b.ref&&(g.ref&&eh(g.ref,null,b),d.push(b.ref,b.__c||w,b)),P==null&&w!=null&&(P=w),4&b.__u||g.__k===b.__k?l=Dm(b,l,i):typeof b.type=="function"&&R!==void 0?l=R:w&&(l=w.nextSibling),b.__u&=-7);return t.__e=P,l}function BS(i,e,t,r,s){var n,o,a,l,c,d=t.length,f=d,g=0;for(i.__k=new Array(s),n=0;n<s;n++)(o=e[n])!=null&&typeof o!="boolean"&&typeof o!="function"?(l=n+g,(o=i.__k[n]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?Hn(null,o,null,null,null):Vn(o)?Hn(it,{children:o},null,null,null):o.constructor==null&&o.__b>0?Hn(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=i,o.__b=i.__b+1,a=null,(c=o.__i=US(o,t,l,f))!=-1&&(f--,(a=t[c])&&(a.__u|=2)),a==null||a.__v==null?(c==-1&&(s>d?g--:s<d&&g++),typeof o.type!="function"&&(o.__u|=4)):c!=l&&(c==l-1?g--:c==l+1?g++:(c>l?g--:g++,o.__u|=4))):i.__k[n]=null;if(f)for(n=0;n<d;n++)(a=t[n])!=null&&!(2&a.__u)&&(a.__e==r&&(r=Ms(a)),Um(a,a));return r}function Dm(i,e,t){var r,s;if(typeof i.type=="function"){for(r=i.__k,s=0;r&&s<r.length;s++)r[s]&&(r[s].__=i,e=Dm(r[s],e,t));return e}i.__e!=e&&(e&&i.type&&!t.contains(e)&&(e=Ms(i)),t.insertBefore(i.__e,e||null),e=i.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function Ct(i,e){return e=e||[],i==null||typeof i=="boolean"||(Vn(i)?i.some(function(t){Ct(t,e)}):e.push(i)),e}function US(i,e,t,r){var s,n,o=i.key,a=i.type,l=e[t];if(l===null&&i.key==null||l&&o==l.key&&a==l.type&&!(2&l.__u))return t;if(r>(l!=null&&!(2&l.__u)?1:0))for(s=t-1,n=t+1;s>=0||n<e.length;){if(s>=0){if((l=e[s])&&!(2&l.__u)&&o==l.key&&a==l.type)return s;s--}if(n<e.length){if((l=e[n])&&!(2&l.__u)&&o==l.key&&a==l.type)return n;n++}}return-1}function _m(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||NS.test(e)?t:t+"px"}function Wa(i,e,t,r,s){var n,o;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof r=="string"&&(i.style.cssText=r=""),r)for(e in r)t&&e in t||_m(i.style,e,"");if(t)for(e in t)r&&t[e]==r[e]||_m(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")n=e!=(e=e.replace(Rm,"$1")),o=e.toLowerCase(),e=o in i||e=="onFocusOut"||e=="onFocusIn"?o.slice(2):e.slice(2),i.l||(i.l={}),i.l[e+n]=t,t?r?t.u=r.u:(t.u=Zu,i.addEventListener(e,n?Yu:Xu,n)):i.removeEventListener(e,n?Yu:Xu,n);else{if(s=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}function Cm(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e.t==null)e.t=Zu++;else if(e.t<t.u)return;return t(Q.event?Q.event(e):e)}}}function Ju(i,e,t,r,s,n,o,a,l,c){var d,f,g,b,w,P,R,C,k,_,E,A,F,O,M,H,W,q=e.type;if(e.constructor!=null)return null;128&t.__u&&(l=!!(32&t.__u),n=[a=e.__e=t.__e]),(d=Q.__b)&&d(e);e:if(typeof q=="function")try{if(C=e.props,k="prototype"in q&&q.prototype.render,_=(d=q.contextType)&&r[d.__c],E=d?_?_.props.value:d.__:r,t.__c?R=(f=e.__c=t.__c).__=f.__E:(k?e.__c=f=new q(C,E):(e.__c=f=new ke(C,E),f.constructor=q,f.render=HS),_&&_.sub(f),f.props=C,f.state||(f.state={}),f.context=E,f.__n=r,g=f.__d=!0,f.__h=[],f._sb=[]),k&&f.__s==null&&(f.__s=f.state),k&&q.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Ti({},f.__s)),Ti(f.__s,q.getDerivedStateFromProps(C,f.__s))),b=f.props,w=f.state,f.__v=e,g)k&&q.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),k&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(k&&q.getDerivedStateFromProps==null&&C!==b&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(C,E),!f.__e&&f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(C,f.__s,E)===!1||e.__v==t.__v){for(e.__v!=t.__v&&(f.props=C,f.state=f.__s,f.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(Y){Y&&(Y.__=e)}),A=0;A<f._sb.length;A++)f.__h.push(f._sb[A]);f._sb=[],f.__h.length&&o.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(C,f.__s,E),k&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(b,w,P)})}if(f.context=E,f.props=C,f.__P=i,f.__e=!1,F=Q.__r,O=0,k){for(f.state=f.__s,f.__d=!1,F&&F(e),d=f.render(f.props,f.state,f.context),M=0;M<f._sb.length;M++)f.__h.push(f._sb[M]);f._sb=[]}else do f.__d=!1,F&&F(e),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++O<25);f.state=f.__s,f.getChildContext!=null&&(r=Ti(Ti({},r),f.getChildContext())),k&&!g&&f.getSnapshotBeforeUpdate!=null&&(P=f.getSnapshotBeforeUpdate(b,w)),H=d,d!=null&&d.type===it&&d.key==null&&(H=Bm(d.props.children)),a=Im(i,Vn(H)?H:[H],e,t,r,s,n,o,a,l,c),f.base=e.__e,e.__u&=-161,f.__h.length&&o.push(f),R&&(f.__E=f.__=null)}catch(Y){if(e.__v=null,l||n!=null)if(Y.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;n[n.indexOf(a)]=null,e.__e=a}else for(W=n.length;W--;)Qu(n[W]);else e.__e=t.__e,e.__k=t.__k;Q.__e(Y,e,t)}else n==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=zS(t.__e,e,t,r,s,n,o,l,c);return(d=Q.diffed)&&d(e),128&e.__u?void 0:a}function Nm(i,e,t){for(var r=0;r<t.length;r++)eh(t[r],t[++r],t[++r]);Q.__c&&Q.__c(e,i),i.some(function(s){try{i=s.__h,s.__h=[],i.some(function(n){n.call(s)})}catch(n){Q.__e(n,s.__v)}})}function Bm(i){return typeof i!="object"||i==null||i.__b&&i.__b>0?i:Vn(i)?i.map(Bm):Ti({},i)}function zS(i,e,t,r,s,n,o,a,l){var c,d,f,g,b,w,P,R=t.props,C=e.props,k=e.type;if(k=="svg"?s="http://www.w3.org/2000/svg":k=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),n!=null){for(c=0;c<n.length;c++)if((b=n[c])&&"setAttribute"in b==!!k&&(k?b.localName==k:b.nodeType==3)){i=b,n[c]=null;break}}if(i==null){if(k==null)return document.createTextNode(C);i=document.createElementNS(s,k,C.is&&C),a&&(Q.__m&&Q.__m(e,n),a=!1),n=null}if(k==null)R===C||a&&i.data==C||(i.data=C);else{if(n=n&&qn.call(i.childNodes),R=t.props||$n,!a&&n!=null)for(R={},c=0;c<i.attributes.length;c++)R[(b=i.attributes[c]).name]=b.value;for(c in R)if(b=R[c],c!="children"){if(c=="dangerouslySetInnerHTML")f=b;else if(!(c in C)){if(c=="value"&&"defaultValue"in C||c=="checked"&&"defaultChecked"in C)continue;Wa(i,c,null,b,s)}}for(c in C)b=C[c],c=="children"?g=b:c=="dangerouslySetInnerHTML"?d=b:c=="value"?w=b:c=="checked"?P=b:a&&typeof b!="function"||R[c]===b||Wa(i,c,b,R[c],s);if(d)a||f&&(d.__html==f.__html||d.__html==i.innerHTML)||(i.innerHTML=d.__html),e.__k=[];else if(f&&(i.innerHTML=""),Im(e.type=="template"?i.content:i,Vn(g)?g:[g],e,t,r,k=="foreignObject"?"http://www.w3.org/1999/xhtml":s,n,o,n?n[0]:t.__k&&Ms(t,0),a,l),n!=null)for(c=n.length;c--;)Qu(n[c]);a||(c="value",k=="progress"&&w==null?i.removeAttribute("value"):w!=null&&(w!==i[c]||k=="progress"&&!w||k=="option"&&w!=R[c])&&Wa(i,c,w,R[c],s),c="checked",P!=null&&P!=i[c]&&Wa(i,c,P,R[c],s))}return i}function eh(i,e,t){try{if(typeof i=="function"){var r=typeof i.__u=="function";r&&i.__u(),r&&e==null||(i.__u=i(e))}else i.current=e}catch(s){Q.__e(s,t)}}function Um(i,e,t){var r,s;if(Q.unmount&&Q.unmount(i),(r=i.ref)&&(r.current&&r.current!=i.__e||eh(r,null,e)),(r=i.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(n){Q.__e(n,e)}r.base=r.__P=null}if(r=i.__k)for(s=0;s<r.length;s++)r[s]&&Um(r[s],e,t||typeof i.type!="function");t||Qu(i.__e),i.__c=i.__=i.__e=void 0}function HS(i,e,t){return this.constructor(i,t)}function zm(i,e,t){var r,s,n,o;e==document&&(e=document.documentElement),Q.__&&Q.__(i,e),s=(r=typeof t=="function")?null:t&&t.__k||e.__k,n=[],o=[],Ju(e,i=(!r&&t||e).__k=u(it,null,[i]),s||$n,$n,e.namespaceURI,!r&&t?[t]:s?null:e.firstChild?qn.call(e.childNodes):null,n,!r&&t?t:s?s.__e:e.firstChild,r,o),Nm(n,i,o)}function jn(i,e,t){var r,s,n,o,a=Ti({},i.props);for(n in i.type&&i.type.defaultProps&&(o=i.type.defaultProps),e)n=="key"?r=e[n]:n=="ref"?s=e[n]:a[n]=e[n]===void 0&&o!=null?o[n]:e[n];return arguments.length>2&&(a.children=arguments.length>3?qn.call(arguments,2):t),Hn(i.type,a,r||i.key,s||i.ref,null)}qn=Lm.slice,Q={__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}},Pm=0,IS=function(i){return i!=null&&i.constructor==null},ke.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ti({},this.state),typeof i=="function"&&(i=i(Ti({},t),this.props)),i&&Ti(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),Am(this))},ke.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),Am(this))},ke.prototype.render=it,Zr=[],Fm=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Om=function(i,e){return i.__v.__b-e.__v.__b},Ga.__r=0,Rm=/(PointerCapture)$|Capture$/i,Zu=0,Xu=Cm(!1),Yu=Cm(!0),DS=0;var Wn,Le,th,Hm,Gn=0,Xm=[],Ne=Q,$m=Ne.__b,qm=Ne.__r,Vm=Ne.diffed,jm=Ne.__c,Wm=Ne.unmount,Gm=Ne.__;function rh(i,e){Ne.__h&&Ne.__h(Le,i,Gn||e),Gn=0;var t=Le.__H||(Le.__H={__:[],__h:[]});return i>=t.__.length&&t.__.push({}),t.__[i]}function Xt(i){return Gn=1,Ym(Qm,i)}function Ym(i,e,t){var r=rh(Wn++,2);if(r.t=i,!r.__c&&(r.__=[t?t(e):Qm(void 0,e),function(a){var l=r.__N?r.__N[0]:r.__[0],c=r.t(l,a);l!==c&&(r.__N=[c,r.__[1]],r.__c.setState({}))}],r.__c=Le,!Le.__f)){var s=function(a,l,c){if(!r.__c.__H)return!0;var d=r.__c.__H.__.filter(function(g){return!!g.__c});if(d.every(function(g){return!g.__N}))return!n||n.call(this,a,l,c);var f=r.__c.props!==a;return d.forEach(function(g){if(g.__N){var b=g.__[0];g.__=g.__N,g.__N=void 0,b!==g.__[0]&&(f=!0)}}),n&&n.call(this,a,l,c)||f};Le.__f=!0;var n=Le.shouldComponentUpdate,o=Le.componentWillUpdate;Le.componentWillUpdate=function(a,l,c){if(this.__e){var d=n;n=void 0,s(a,l,c),n=d}o&&o.call(this,a,l,c)},Le.shouldComponentUpdate=s}return r.__N||r.__}function di(i,e){var t=rh(Wn++,3);!Ne.__s&&Zm(t.__H,e)&&(t.__=i,t.u=e,Le.__H.__h.push(t))}function vr(i){return Gn=5,br(function(){return{current:i}},[])}function br(i,e){var t=rh(Wn++,7);return Zm(t.__H,e)&&(t.__=i(),t.__H=e,t.__h=i),t.__}function yr(i,e){return Gn=8,br(function(){return i},e)}function $S(){for(var i;i=Xm.shift();)if(i.__P&&i.__H)try{i.__H.__h.forEach(Xa),i.__H.__h.forEach(ih),i.__H.__h=[]}catch(e){i.__H.__h=[],Ne.__e(e,i.__v)}}Ne.__b=function(i){Le=null,$m&&$m(i)},Ne.__=function(i,e){i&&e.__k&&e.__k.__m&&(i.__m=e.__k.__m),Gm&&Gm(i,e)},Ne.__r=function(i){qm&&qm(i),Wn=0;var e=(Le=i.__c).__H;e&&(th===Le?(e.__h=[],Le.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.forEach(Xa),e.__h.forEach(ih),e.__h=[],Wn=0)),th=Le},Ne.diffed=function(i){Vm&&Vm(i);var e=i.__c;e&&e.__H&&(e.__H.__h.length&&(Xm.push(e)!==1&&Hm===Ne.requestAnimationFrame||((Hm=Ne.requestAnimationFrame)||qS)($S)),e.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),th=Le=null},Ne.__c=function(i,e){e.some(function(t){try{t.__h.forEach(Xa),t.__h=t.__h.filter(function(r){return!r.__||ih(r)})}catch(r){e.some(function(s){s.__h&&(s.__h=[])}),e=[],Ne.__e(r,t.__v)}}),jm&&jm(i,e)},Ne.unmount=function(i){Wm&&Wm(i);var e,t=i.__c;t&&t.__H&&(t.__H.__.forEach(function(r){try{Xa(r)}catch(s){e=s}}),t.__H=void 0,e&&Ne.__e(e,t.__v))};var Km=typeof requestAnimationFrame=="function";function qS(i){var e,t=function(){clearTimeout(r),Km&&cancelAnimationFrame(e),setTimeout(i)},r=setTimeout(t,35);Km&&(e=requestAnimationFrame(t))}function Xa(i){var e=Le,t=i.__c;typeof t=="function"&&(i.__c=void 0,t()),Le=e}function ih(i){var e=Le;i.__c=i.__(),Le=e}function Zm(i,e){return!i||i.length!==e.length||e.some(function(t,r){return t!==i[r]})}function Qm(i,e){return typeof e=="function"?e(i):e}function jS(i,e){for(var t in e)i[t]=e[t];return i}function Jm(i,e){for(var t in i)if(t!=="__source"&&!(t in e))return!0;for(var r in e)if(r!=="__source"&&i[r]!==e[r])return!0;return!1}function eg(i,e){this.props=i,this.context=e}(eg.prototype=new ke).isPureReactComponent=!0,eg.prototype.shouldComponentUpdate=function(i,e){return Jm(this.props,i)||Jm(this.state,e)};var tg=Q.__b;Q.__b=function(i){i.type&&i.type.__f&&i.ref&&(i.props.ref=i.ref,i.ref=null),tg&&tg(i)};var J5=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var WS=Q.__e;Q.__e=function(i,e,t,r){if(i.then){for(var s,n=e;n=n.__;)if((s=n.__c)&&s.__c)return e.__e==null&&(e.__e=t.__e,e.__k=t.__k),s.__c(i,e)}WS(i,e,t,r)};var ig=Q.unmount;function lg(i,e,t){return i&&(i.__c&&i.__c.__H&&(i.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),i.__c.__H=null),(i=jS({},i)).__c!=null&&(i.__c.__P===t&&(i.__c.__P=e),i.__c.__e=!0,i.__c=null),i.__k=i.__k&&i.__k.map(function(r){return lg(r,e,t)})),i}function cg(i,e,t){return i&&t&&(i.__v=null,i.__k=i.__k&&i.__k.map(function(r){return cg(r,e,t)}),i.__c&&i.__c.__P===e&&(i.__e&&t.appendChild(i.__e),i.__c.__e=!0,i.__c.__P=t)),i}function sh(){this.__u=0,this.o=null,this.__b=null}function ug(i){var e=i.__.__c;return e&&e.__a&&e.__a(i)}function Ya(){this.i=null,this.l=null}Q.unmount=function(i){var e=i.__c;e&&e.__R&&e.__R(),e&&32&i.__u&&(i.type=null),ig&&ig(i)},(sh.prototype=new ke).__c=function(i,e){var t=e.__c,r=this;r.o==null&&(r.o=[]),r.o.push(t);var s=ug(r.__v),n=!1,o=function(){n||(n=!0,t.__R=null,s?s(a):a())};t.__R=o;var a=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=cg(l,l.__c.__P,l.__c.__O)}var c;for(r.setState({__a:r.__b=null});c=r.o.pop();)c.forceUpdate()}};r.__u++||32&e.__u||r.setState({__a:r.__b=r.__v.__k[0]}),i.then(o,o)},sh.prototype.componentWillUnmount=function(){this.o=[]},sh.prototype.render=function(i,e){if(this.__b){if(this.__v.__k){var t=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=lg(this.__b,t,r.__O=r.__P)}this.__b=null}var s=e.__a&&u(it,null,i.fallback);return s&&(s.__u&=-33),[u(it,null,e.__a?null:i.children),s]};var rg=function(i,e,t){if(++t[1]===t[0]&&i.l.delete(e),i.props.revealOrder&&(i.props.revealOrder[0]!=="t"||!i.l.size))for(t=i.i;t;){for(;t.length>3;)t.pop()();if(t[1]<t[0])break;i.i=t=t[2]}};(Ya.prototype=new ke).__a=function(i){var e=this,t=ug(e.__v),r=e.l.get(i);return r[0]++,function(s){var n=function(){e.props.revealOrder?(r.push(s),rg(e,i,r)):s()};t?t(n):n()}},Ya.prototype.render=function(i){this.i=null,this.l=new Map;var e=Ct(i.children);i.revealOrder&&i.revealOrder[0]==="b"&&e.reverse();for(var t=e.length;t--;)this.l.set(e[t],this.i=[1,0,this.i]);return i.children},Ya.prototype.componentDidUpdate=Ya.prototype.componentDidMount=function(){var i=this;this.l.forEach(function(e,t){rg(i,t,e)})};var GS=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,KS=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,XS=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,YS=/[A-Z0-9]/g,ZS=typeof document<"u",QS=function(i){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(i)};function nh(i,e,t){return e.__k==null&&(e.textContent=""),zm(i,e),typeof t=="function"&&t(),i?i.__c:null}ke.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(i){Object.defineProperty(ke.prototype,i,{configurable:!0,get:function(){return this["UNSAFE_"+i]},set:function(e){Object.defineProperty(this,i,{configurable:!0,writable:!0,value:e})}})});var sg=Q.event;function JS(){}function eE(){return this.cancelBubble}function tE(){return this.defaultPrevented}Q.event=function(i){return sg&&(i=sg(i)),i.persist=JS,i.isPropagationStopped=eE,i.isDefaultPrevented=tE,i.nativeEvent=i};var hg,iE={enumerable:!1,configurable:!0,get:function(){return this.class}},ng=Q.vnode;Q.vnode=function(i){typeof i.type=="string"&&function(e){var t=e.props,r=e.type,s={},n=r.indexOf("-")===-1;for(var o in t){var a=t[o];if(!(o==="value"&&"defaultValue"in t&&a==null||ZS&&o==="children"&&r==="noscript"||o==="class"||o==="className")){var l=o.toLowerCase();o==="defaultValue"&&"value"in t&&t.value==null?o="value":o==="download"&&a===!0?a="":l==="translate"&&a==="no"?a=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?o="ondblclick":l!=="onchange"||r!=="input"&&r!=="textarea"||QS(t.type)?l==="onfocus"?o="onfocusin":l==="onblur"?o="onfocusout":XS.test(o)&&(o=l):l=o="oninput":n&&KS.test(o)?o=o.replace(YS,"-$&").toLowerCase():a===null&&(a=void 0),l==="oninput"&&s[o=l]&&(o="oninputCapture"),s[o]=a}}r=="select"&&s.multiple&&Array.isArray(s.value)&&(s.value=Ct(t.children).forEach(function(c){c.props.selected=s.value.indexOf(c.props.value)!=-1})),r=="select"&&s.defaultValue!=null&&(s.value=Ct(t.children).forEach(function(c){c.props.selected=s.multiple?s.defaultValue.indexOf(c.props.value)!=-1:s.defaultValue==c.props.value})),t.class&&!t.className?(s.class=t.class,Object.defineProperty(s,"className",iE)):(t.className&&!t.class||t.class&&t.className)&&(s.class=s.className=t.className),e.props=s}(i),i.$$typeof=GS,ng&&ng(i)};var og=Q.__r;Q.__r=function(i){og&&og(i),hg=i.__c};var ag=Q.diffed;Q.diffed=function(i){ag&&ag(i);var e=i.props,t=i.__e;t!=null&&i.type==="textarea"&&"value"in e&&e.value!==t.value&&(t.value=e.value==null?"":e.value),hg=null};function Kn(i){return typeof i!="object"||i===null||!("nodeType"in i)?!1:i.nodeType===Node.ELEMENT_NODE}function rE(i,e){return e===void 0&&(e=document),typeof i=="string"?e.querySelector(i):Kn(i)?i:null}var dg=rE;function sE(i){for(var e;i&&!i.dir;)i=i.parentNode;return(e=i)==null?void 0:e.dir}var Za=sE;var wr=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 jr([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 pg(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var nE=0;function oE(i){return"__private_"+nE+++"_"+i}function aE(i){let e=null,t;return function(){for(var r=arguments.length,s=new Array(r),n=0;n<r;n++)s[n]=arguments[n];return t=s,e||(e=Promise.resolve().then(()=>(e=null,i(...t)))),e}}var Xn=oE("updateUI"),oh=class i extends wr{constructor(){super(...arguments),Object.defineProperty(this,Xn,{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=dg(e);if(s){this.isTargetDOMEl=!0;let a=document.createElement("div");return a.classList.add("uppy-Root"),pg(this,Xn)[Xn]=aE(l=>{this.uppy.getPlugin(this.id)&&(nh(this.render(l,a),a),this.afterUpdate())}),this.uppy.log(`Installing ${r} to a DOM element '${e}'`),this.opts.replaceTargetContent&&(s.innerHTML=""),nh(this.render(this.uppy.getState(),a),a),this.el=a,s.appendChild(a),a.dir=this.opts.direction||Za(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 <script> tag initializing Uppy is right before the closing </body> tag at the end of the page. (see https://github.com/transloadit/uppy/issues/1042)\n\nIf you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.",new Error(o)}render(e,t){throw new Error("Extend the render method to add your plugin to a DOM element")}update(e){if(this.el!=null){var t,r;(t=(r=pg(this,Xn))[Xn])==null||t.call(r,e)}}unmount(){if(this.isTargetDOMEl){var e;(e=this.el)==null||e.remove()}this.onUnmount()}onMount(){}onUnmount(){}},pi=oh;function Qa(i,e,t,r){return t===0||i===e?i:r===0?e:i+(e-i)*2**(-r/t)}var Mt={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete"};var ph=Te(yt(),1);function Yn(i){let e=[],t="indeterminate",r;for(let{progress:n}of Object.values(i)){let{preprocess:o,postprocess:a}=n;r==null&&(o||a)&&({mode:t,message:r}=o||a),o?.mode==="determinate"&&e.push(o.value),a?.mode==="determinate"&&e.push(a.value)}let s=e.reduce((n,o)=>n+o/e.length,0);return{mode:t,message:r,value:s}}var uh=Te(yt(),1),ch=Te(Ha(),1);function ah(i){let e=Math.floor(i/3600)%24,t=Math.floor(i/60)%60,r=Math.floor(i%60);return{hours:e,minutes:t,seconds:r}}function lh(i){let e=ah(i),t=e.hours===0?"":`${e.hours}h`,r=e.minutes===0?"":`${e.hours===0?e.minutes:` ${e.minutes.toString(10).padStart(2,"0")}`}m`,s=e.hours!==0?"":`${e.minutes===0?e.seconds:` ${e.seconds.toString(10).padStart(2,"0")}`}s`;return`${t}${r}${s}`}var lE="\xB7",fg=()=>` ${lE} `;function mg(i){let{newFiles:e,isUploadStarted:t,recoveredState:r,i18n:s,uploadState:n,isSomeGhost:o,startUpload:a}=i,l=(0,uh.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--upload",{"uppy-c-btn-primary":n===Mt.STATE_WAITING},{"uppy-StatusBar-actionBtn--disabled":o}),c=e&&t&&!r?s("uploadXNewFiles",{smart_count:e}):s("uploadXFiles",{smart_count:e});return u("button",{type:"button",className:l,"aria-label":s("uploadXFiles",{smart_count:e}),onClick:a,disabled:o,"data-uppy-super-focusable":!0},c)}function gg(i){let{i18n:e,uppy:t}=i;return u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--retry","aria-label":e("retryUpload"),onClick:()=>t.retryAll().catch(()=>{}),"data-uppy-super-focusable":!0,"data-cy":"retry"},u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"8",height:"10",viewBox:"0 0 8 10"},u("path",{d:"M4 2.408a2.75 2.75 0 1 0 2.75 2.75.626.626 0 0 1 1.25.018v.023a4 4 0 1 1-4-4.041V.25a.25.25 0 0 1 .389-.208l2.299 1.533a.25.25 0 0 1 0 .416l-2.3 1.533A.25.25 0 0 1 4 3.316v-.908z"})),e("retry"))}function vg(i){let{i18n:e,uppy:t}=i;return u("button",{type:"button",className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",title:e("cancel"),"aria-label":e("cancel"),onClick:()=>t.cancelAll(),"data-cy":"cancel","data-uppy-super-focusable":!0},u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16"},u("g",{fill:"none",fillRule:"evenodd"},u("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),u("path",{fill:"#FFF",d:"M9.283 8l2.567 2.567-1.283 1.283L8 9.283 5.433 11.85 4.15 10.567 6.717 8 4.15 5.433 5.433 4.15 8 6.717l2.567-2.567 1.283 1.283z"}))))}function bg(i){let{isAllPaused:e,i18n:t,isAllComplete:r,resumableUploads:s,uppy:n}=i,o=t(e?"resume":"pause");function a(){if(!r){if(!s){n.cancelAll();return}if(e){n.resumeAll();return}n.pauseAll()}}return u("button",{title:o,"aria-label":o,className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",type:"button",onClick:a,"data-cy":"togglePauseResume","data-uppy-super-focusable":!0},u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16"},u("g",{fill:"none",fillRule:"evenodd"},u("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),u("path",{fill:"#FFF",d:e?"M6 4.25L11.5 8 6 11.75z":"M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z"}))))}function yg(i){let{i18n:e,doneButtonHandler:t}=i;return u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--done",onClick:t,"data-uppy-super-focusable":!0},e("done"))}function wg(){return u("svg",{className:"uppy-StatusBar-spinner","aria-hidden":"true",focusable:"false",width:"14",height:"14"},u("path",{d:"M13.983 6.547c-.12-2.509-1.64-4.893-3.939-5.936-2.48-1.127-5.488-.656-7.556 1.094C.524 3.367-.398 6.048.162 8.562c.556 2.495 2.46 4.52 4.94 5.183 2.932.784 5.61-.602 7.256-3.015-1.493 1.993-3.745 3.309-6.298 2.868-2.514-.434-4.578-2.349-5.153-4.84a6.226 6.226 0 0 1 2.98-6.778C6.34.586 9.74 1.1 11.373 3.493c.407.596.693 1.282.842 1.988.127.598.073 1.197.161 1.794.078.525.543 1.257 1.15.864.525-.341.49-1.05.456-1.592-.007-.15.02.3 0 0",fillRule:"evenodd"}))}function Sg(i){let{progress:e}=i,{value:t,mode:r,message:s}=e;return u("div",{className:"uppy-StatusBar-content"},u(wg,null),r==="determinate"?`${Math.round(t*100)}% \xB7 `:"",s)}function cE(i){let{numUploads:e,complete:t,totalUploadedSize:r,totalSize:s,totalETA:n,i18n:o}=i,a=e>1,l=(0,ch.default)(r);return u("div",{className:"uppy-StatusBar-statusSecondary"},a&&o("filesUploadedOfTotal",{complete:t,smart_count:e}),u("span",{className:"uppy-StatusBar-additionalInfo"},a&&fg(),s!=null?o("dataUploadedOfTotal",{complete:l,total:(0,ch.default)(s)}):o("dataUploadedOfUnknown",{complete:l}),fg(),n!=null&&o("xTimeLeft",{time:lh(n)})))}function Eg(i){let{i18n:e,complete:t,numUploads:r}=i;return u("div",{className:"uppy-StatusBar-statusSecondary"},e("filesUploadedOfTotal",{complete:t,smart_count:r}))}function uE(i){let{i18n:e,newFiles:t,startUpload:r}=i,s=(0,uh.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--uploadNewlyAdded");return u("div",{className:"uppy-StatusBar-statusSecondary"},u("div",{className:"uppy-StatusBar-statusSecondaryHint"},e("xMoreFilesAdded",{smart_count:t})),u("button",{type:"button",className:s,"aria-label":e("uploadXFiles",{smart_count:t}),onClick:r},e("upload")))}function Tg(i){let{i18n:e,supportsUploadProgress:t,totalProgress:r,showProgressDetails:s,isUploadStarted:n,isAllComplete:o,isAllPaused:a,newFiles:l,numUploads:c,complete:d,totalUploadedSize:f,totalSize:g,totalETA:b,startUpload:w}=i,P=l&&n;if(!n||o)return null;let R=e(a?"paused":"uploading");function C(){return!a&&!P&&s?t?u(cE,{numUploads:c,complete:d,totalUploadedSize:f,totalSize:g,totalETA:b,i18n:e}):u(Eg,{i18n:e,complete:d,numUploads:c}):null}return u("div",{className:"uppy-StatusBar-content","aria-label":R,title:R},a?null:u(wg,null),u("div",{className:"uppy-StatusBar-status"},u("div",{className:"uppy-StatusBar-statusPrimary"},t&&r!==0?`${R}: ${r}%`:R),C(),P?u(uE,{i18n:e,newFiles:l,startUpload:w}):null))}function xg(i){let{i18n:e}=i;return u("div",{className:"uppy-StatusBar-content",role:"status",title:e("complete")},u("div",{className:"uppy-StatusBar-status"},u("div",{className:"uppy-StatusBar-statusPrimary"},u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"15",height:"11",viewBox:"0 0 15 11"},u("path",{d:"M.414 5.843L1.627 4.63l3.472 3.472L13.202 0l1.212 1.213L5.1 10.528z"})),e("complete"))))}function kg(i){let{error:e,i18n:t,complete:r,numUploads:s}=i;function n(){let o=`${t("uploadFailed")}
|
|
91
|
+
type: ${a.type}`)}),r.length>0&&W(this,Nn)[Nn]()}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,ji)[ji]();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,$i)[$i](t,{forceAllowNewUpload:!0});return W(this,qi)[qi](r)}cancelAll(){this.emit("cancel-all");let{files:e}=this.getState(),t=Object.keys(e);t.length&&this.removeFiles(t),this.setState(za)}retryUpload(e){this.setFileState(e,{error:null,isPaused:!1}),this.emit("upload-retry",this.getFile(e));let t=W(this,$i)[$i]([e],{forceAllowNewUpload:!0});return W(this,qi)[qi](t)}logout(){this.iteratePlugins(e=>{var t;(t=e.provider)==null||t.logout==null||t.logout()})}[Symbol.for("uppy test: updateTotalProgress")](){return W(this,Un)[Un]()}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;s<t;s++)r[s-1]=arguments[s];let n=new e(this,...r),o=n.id;if(!o)throw new Error("Your plugin must have an id");if(!n.type)throw new Error("Your plugin must have a type");let a=this.getPlugin(o);if(a){let l=`Already found a plugin named '${a.id}'. Tried to use: '${o}'.
|
|
92
|
+
Uppy plugins must have unique \`id\` options.`;throw new Error(l)}return e.VERSION&&this.log(`Using ${o} v${e.VERSION}`),n.type in W(this,at)[at]?W(this,at)[at][n.type].push(n):W(this,at)[at][n.type]=[n],n.install(),this.emit("plugin-added",n),this}getPlugin(e){for(let t of Object.values(W(this,at)[at])){let r=t.find(s=>s.id===e);if(r!=null)return r}}[Symbol.for("uppy test: getPlugins")](e){return W(this,at)[at][e]}iteratePlugins(e){Object.values(W(this,at)[at]).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,at)[at][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,In)[In](),this.iteratePlugins(e=>{this.removePlugin(e)}),typeof window<"u"&&window.removeEventListener&&(window.removeEventListener("online",W(this,hi)[hi]),window.removeEventListener("offline",W(this,hi)[hi]))}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,zn)[zn].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,zn)[zn].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,qi)[qi](e):(W(this,Gr)[Gr](e),Promise.reject(new Error("Nonexistent upload")))}[Symbol.for("uppy test: createUpload")](){return W(this,$i)[$i](...arguments)}addResultData(e,t){if(!W(this,Uu)[Uu](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,at)[at].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,lt)[lt].validateMinNumberOfFiles(t)).catch(s=>{throw W(this,Rt)[Rt]([s]),s}).then(()=>{if(!W(this,Nu)[Nu](t))throw new Pt(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,$i)[$i](o);return W(this,qi)[qi](a)}).catch(s=>{throw this.emit("error",s),this.log(s,"error"),s}))}};function J1(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 eS(i){let{missingFields:e,error:t}=W(this,lt)[lt].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 tS(i){let e=!0;for(let t of Object.values(i))W(this,Hn)[Hn](t)||(e=!1);return e}function iS(i){let{allowNewUpload:e}=this.getState();if(e===!1){let t=new Pt(this.i18n("noMoreFilesAllowed"),{file:i});throw W(this,Rt)[Rt]([t]),t}}function rS(i){let e=i instanceof File?{name:i.name,type:i.type,size:i.size,data:i}:i,t=Rn(e),r=Iu(t,e),s=Vr(r).extension,n=Na(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 sS(){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 nS(i){let{files:e}=this.getState(),t={...e},r=[],s=[];for(let a of i)try{var n;let l=W(this,zu)[zu](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 Pt(this.i18n("noDuplicates",{fileName:(o=l.name)!=null?o:this.i18n("unnamed")}),{file:a})}if(d===!1&&!c)throw new Pt("Cannot add the file because onBeforeFileAdded returned false.",{isUserFacing:!1,file:a});typeof d=="object"&&d!==null&&(l=d),W(this,lt)[lt].validateSingleFile(l),t[l.id]=l,r.push(l)}catch(l){s.push(l)}try{W(this,lt)[lt].validateAggregateRestrictions(Object.values(e),r)}catch(a){return s.push(a),{nextFilesState:e,validFilesToAdd:[],errors:s}}return{nextFilesState:t,validFilesToAdd:r,errors:s}}function oS(){var i,e;let t=W(this,$u)[$u](),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 aS(){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 lS(){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,Hu)[Hu]),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,Vi)[Vi].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,ji)[ji]()}),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,ji)[ji]()}),this.on("dashboard:file-edit-complete",r=>{r&&W(this,Hn)[Hn](r)}),typeof window<"u"&&window.addEventListener&&(window.addEventListener("online",W(this,hi)[hi]),window.addEventListener("offline",W(this,hi)[hi]),setTimeout(W(this,hi)[hi],3e3))}function cS(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=mr();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 uS(i){let{currentUploads:e}=this.getState();return e[i]}function hS(i){let e={...this.getState().currentUploads};delete e[i],this.setState({currentUploads:e})}async function dS(i){let e=()=>{let{currentUploads:n}=this.getState();return n[i]},t=e(),r=[...W(this,jr)[jr],...W(this,Wr)[Wr],...W(this,Vi)[Vi]];try{for(let n=t.step||0;n<r.length&&t;n++){let o=r[n];this.setState({currentUploads:{...this.getState().currentUploads,[i]:{...t,step:n}}});let{fileIDs:a}=t;await o(a,i),t=e()}}catch(n){throw W(this,Gr)[Gr](i),n}if(t){t.fileIDs.forEach(l=>{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,Gr)[Gr](i)),s==null&&this.log(`Not setting result for an upload that has been removed: ${i}`),s}Ha.VERSION=Q1.version;var $a=Ha;var Vn,Ee,Em,pS,Kr,bm,Tm,xm,km,ju,qu,Vu,fS,qn={},Am=[],mS=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,jn=Array.isArray;function Ti(i,e){for(var t in e)i[t]=e[t];return i}function Wu(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?Vn.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 $n(i,o,r,s,null)}function $n(i,e,t,r,s){var n={type:i,props:e,key:t,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:s??++Em,__i:-1,__u:0};return s==null&&Ee.vnode!=null&&Ee.vnode(n),n}function Cm(){return{current:null}}function Mt(i){return i.children}function dt(i,e){this.props=i,this.context=e}function Ns(i,e){if(e==null)return i.__?Ns(i.__,i.__i+1):null;for(var t;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null)return t.__e;return typeof i.type=="function"?Ns(i):null}function Pm(i){var e,t;if((i=i.__)!=null&&i.__c!=null){for(i.__e=i.__c.base=null,e=0;e<i.__k.length;e++)if((t=i.__k[e])!=null&&t.__e!=null){i.__e=i.__c.base=t.__e;break}return Pm(i)}}function ym(i){(!i.__d&&(i.__d=!0)&&Kr.push(i)&&!Va.__r++||bm!==Ee.debounceRendering)&&((bm=Ee.debounceRendering)||Tm)(Va)}function Va(){for(var i,e,t,r,s,n,o,a=1;Kr.length;)Kr.length>a&&Kr.sort(xm),i=Kr.shift(),a=Kr.length,i.__d&&(t=void 0,s=(r=(e=i).__v).__e,n=[],o=[],e.__P&&((t=Ti({},r)).__v=r.__v+1,Ee.vnode&&Ee.vnode(t),Gu(e.__P,t,r,e.__n,e.__P.namespaceURI,32&r.__u?[s]:null,n,s??Ns(r),!!(32&r.__u),o),t.__v=r.__v,t.__.__k[t.__i]=t,Om(n,t,o),t.__e!=s&&Pm(t)));Va.__r=0}function Fm(i,e,t,r,s,n,o,a,l,c,d){var f,y,v,x,C,F,L=r&&r.__k||Am,D=e.length;for(l=gS(t,e,L,l,D),f=0;f<D;f++)(v=t.__k[f])!=null&&(y=v.__i===-1?qn:L[v.__i]||qn,v.__i=f,F=Gu(i,v,y,s,n,o,a,l,c,d),x=v.__e,v.ref&&y.ref!=v.ref&&(y.ref&&Ku(y.ref,null,v),d.push(v.ref,v.__c||x,v)),C==null&&x!=null&&(C=x),4&v.__u||y.__k===v.__k?l=_m(v,l,i):typeof v.type=="function"&&F!==void 0?l=F:x&&(l=x.nextSibling),v.__u&=-7);return t.__e=C,l}function gS(i,e,t,r,s){var n,o,a,l,c,d=t.length,f=d,y=0;for(i.__k=new Array(s),n=0;n<s;n++)(o=e[n])!=null&&typeof o!="boolean"&&typeof o!="function"?(l=n+y,(o=i.__k[n]=typeof o=="string"||typeof o=="number"||typeof o=="bigint"||o.constructor==String?$n(null,o,null,null,null):jn(o)?$n(Mt,{children:o},null,null,null):o.constructor===void 0&&o.__b>0?$n(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):o).__=i,o.__b=i.__b+1,a=null,(c=o.__i=vS(o,t,l,f))!==-1&&(f--,(a=t[c])&&(a.__u|=2)),a==null||a.__v===null?(c==-1&&(s>d?y--:s<d&&y++),typeof o.type!="function"&&(o.__u|=4)):c!=l&&(c==l-1?y--:c==l+1?y++:(c>l?y--:y++,o.__u|=4))):i.__k[n]=null;if(f)for(n=0;n<d;n++)(a=t[n])!=null&&!(2&a.__u)&&(a.__e==r&&(r=Ns(a)),Rm(a,a));return r}function _m(i,e,t){var r,s;if(typeof i.type=="function"){for(r=i.__k,s=0;r&&s<r.length;s++)r[s]&&(r[s].__=i,e=_m(r[s],e,t));return e}i.__e!=e&&(e&&i.type&&!t.contains(e)&&(e=Ns(i)),t.insertBefore(i.__e,e||null),e=i.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function xi(i,e){return e=e||[],i==null||typeof i=="boolean"||(jn(i)?i.some(function(t){xi(t,e)}):e.push(i)),e}function vS(i,e,t,r){var s,n,o=i.key,a=i.type,l=e[t];if(l===null&&i.key==null||l&&o==l.key&&a===l.type&&!(2&l.__u))return t;if(r>(l!=null&&!(2&l.__u)?1:0))for(s=t-1,n=t+1;s>=0||n<e.length;){if(s>=0){if((l=e[s])&&!(2&l.__u)&&o==l.key&&a===l.type)return s;s--}if(n<e.length){if((l=e[n])&&!(2&l.__u)&&o==l.key&&a===l.type)return n;n++}}return-1}function wm(i,e,t){e[0]=="-"?i.setProperty(e,t??""):i[e]=t==null?"":typeof t!="number"||mS.test(e)?t:t+"px"}function qa(i,e,t,r,s){var n;e:if(e=="style")if(typeof t=="string")i.style.cssText=t;else{if(typeof r=="string"&&(i.style.cssText=r=""),r)for(e in r)t&&e in t||wm(i.style,e,"");if(t)for(e in t)r&&t[e]===r[e]||wm(i.style,e,t[e])}else if(e[0]=="o"&&e[1]=="n")n=e!=(e=e.replace(km,"$1")),e=e.toLowerCase()in i||e=="onFocusOut"||e=="onFocusIn"?e.toLowerCase().slice(2):e.slice(2),i.l||(i.l={}),i.l[e+n]=t,t?r?t.t=r.t:(t.t=ju,i.addEventListener(e,n?Vu:qu,n)):i.removeEventListener(e,n?Vu:qu,n);else{if(s=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in i)try{i[e]=t??"";break e}catch{}typeof t=="function"||(t==null||t===!1&&e[4]!="-"?i.removeAttribute(e):i.setAttribute(e,e=="popover"&&t==1?"":t))}}function Sm(i){return function(e){if(this.l){var t=this.l[e.type+i];if(e.u==null)e.u=ju++;else if(e.u<t.t)return;return t(Ee.event?Ee.event(e):e)}}}function Gu(i,e,t,r,s,n,o,a,l,c){var d,f,y,v,x,C,F,L,D,V,M,$,z,G,K,Q,ne,Y=e.type;if(e.constructor!==void 0)return null;128&t.__u&&(l=!!(32&t.__u),n=[a=e.__e=t.__e]),(d=Ee.__b)&&d(e);e:if(typeof Y=="function")try{if(L=e.props,D="prototype"in Y&&Y.prototype.render,V=(d=Y.contextType)&&r[d.__c],M=d?V?V.props.value:d.__:r,t.__c?F=(f=e.__c=t.__c).__=f.__E:(D?e.__c=f=new Y(L,M):(e.__c=f=new dt(L,M),f.constructor=Y,f.render=yS),V&&V.sub(f),f.props=L,f.state||(f.state={}),f.context=M,f.__n=r,y=f.__d=!0,f.__h=[],f._sb=[]),D&&f.__s==null&&(f.__s=f.state),D&&Y.getDerivedStateFromProps!=null&&(f.__s==f.state&&(f.__s=Ti({},f.__s)),Ti(f.__s,Y.getDerivedStateFromProps(L,f.__s))),v=f.props,x=f.state,f.__v=e,y)D&&Y.getDerivedStateFromProps==null&&f.componentWillMount!=null&&f.componentWillMount(),D&&f.componentDidMount!=null&&f.__h.push(f.componentDidMount);else{if(D&&Y.getDerivedStateFromProps==null&&L!==v&&f.componentWillReceiveProps!=null&&f.componentWillReceiveProps(L,M),!f.__e&&(f.shouldComponentUpdate!=null&&f.shouldComponentUpdate(L,f.__s,M)===!1||e.__v==t.__v)){for(e.__v!=t.__v&&(f.props=L,f.state=f.__s,f.__d=!1),e.__e=t.__e,e.__k=t.__k,e.__k.some(function(re){re&&(re.__=e)}),$=0;$<f._sb.length;$++)f.__h.push(f._sb[$]);f._sb=[],f.__h.length&&o.push(f);break e}f.componentWillUpdate!=null&&f.componentWillUpdate(L,f.__s,M),D&&f.componentDidUpdate!=null&&f.__h.push(function(){f.componentDidUpdate(v,x,C)})}if(f.context=M,f.props=L,f.__P=i,f.__e=!1,z=Ee.__r,G=0,D){for(f.state=f.__s,f.__d=!1,z&&z(e),d=f.render(f.props,f.state,f.context),K=0;K<f._sb.length;K++)f.__h.push(f._sb[K]);f._sb=[]}else do f.__d=!1,z&&z(e),d=f.render(f.props,f.state,f.context),f.state=f.__s;while(f.__d&&++G<25);f.state=f.__s,f.getChildContext!=null&&(r=Ti(Ti({},r),f.getChildContext())),D&&!y&&f.getSnapshotBeforeUpdate!=null&&(C=f.getSnapshotBeforeUpdate(v,x)),Q=d,d!=null&&d.type===Mt&&d.key==null&&(Q=Lm(d.props.children)),a=Fm(i,jn(Q)?Q:[Q],e,t,r,s,n,o,a,l,c),f.base=e.__e,e.__u&=-161,f.__h.length&&o.push(f),F&&(f.__E=f.__=null)}catch(re){if(e.__v=null,l||n!=null)if(re.then){for(e.__u|=l?160:128;a&&a.nodeType==8&&a.nextSibling;)a=a.nextSibling;n[n.indexOf(a)]=null,e.__e=a}else for(ne=n.length;ne--;)Wu(n[ne]);else e.__e=t.__e,e.__k=t.__k;Ee.__e(re,e,t)}else n==null&&e.__v==t.__v?(e.__k=t.__k,e.__e=t.__e):a=e.__e=bS(t.__e,e,t,r,s,n,o,l,c);return(d=Ee.diffed)&&d(e),128&e.__u?void 0:a}function Om(i,e,t){for(var r=0;r<t.length;r++)Ku(t[r],t[++r],t[++r]);Ee.__c&&Ee.__c(e,i),i.some(function(s){try{i=s.__h,s.__h=[],i.some(function(n){n.call(s)})}catch(n){Ee.__e(n,s.__v)}})}function Lm(i){return typeof i!="object"||i==null?i:jn(i)?i.map(Lm):Ti({},i)}function bS(i,e,t,r,s,n,o,a,l){var c,d,f,y,v,x,C,F=t.props,L=e.props,D=e.type;if(D=="svg"?s="http://www.w3.org/2000/svg":D=="math"?s="http://www.w3.org/1998/Math/MathML":s||(s="http://www.w3.org/1999/xhtml"),n!=null){for(c=0;c<n.length;c++)if((v=n[c])&&"setAttribute"in v==!!D&&(D?v.localName==D:v.nodeType==3)){i=v,n[c]=null;break}}if(i==null){if(D==null)return document.createTextNode(L);i=document.createElementNS(s,D,L.is&&L),a&&(Ee.__m&&Ee.__m(e,n),a=!1),n=null}if(D===null)F===L||a&&i.data===L||(i.data=L);else{if(n=n&&Vn.call(i.childNodes),F=t.props||qn,!a&&n!=null)for(F={},c=0;c<i.attributes.length;c++)F[(v=i.attributes[c]).name]=v.value;for(c in F)if(v=F[c],c!="children"){if(c=="dangerouslySetInnerHTML")f=v;else if(!(c in L)){if(c=="value"&&"defaultValue"in L||c=="checked"&&"defaultChecked"in L)continue;qa(i,c,null,v,s)}}for(c in L)v=L[c],c=="children"?y=v:c=="dangerouslySetInnerHTML"?d=v:c=="value"?x=v:c=="checked"?C=v:a&&typeof v!="function"||F[c]===v||qa(i,c,v,F[c],s);if(d)a||f&&(d.__html===f.__html||d.__html===i.innerHTML)||(i.innerHTML=d.__html),e.__k=[];else if(f&&(i.innerHTML=""),Fm(e.type==="template"?i.content:i,jn(y)?y:[y],e,t,r,D=="foreignObject"?"http://www.w3.org/1999/xhtml":s,n,o,n?n[0]:t.__k&&Ns(t,0),a,l),n!=null)for(c=n.length;c--;)Wu(n[c]);a||(c="value",D=="progress"&&x==null?i.removeAttribute("value"):x!==void 0&&(x!==i[c]||D=="progress"&&!x||D=="option"&&x!==F[c])&&qa(i,c,x,F[c],s),c="checked",C!==void 0&&C!==i[c]&&qa(i,c,C,F[c],s))}return i}function Ku(i,e,t){try{if(typeof i=="function"){var r=typeof i.__u=="function";r&&i.__u(),r&&e==null||(i.__u=i(e))}else i.current=e}catch(s){Ee.__e(s,t)}}function Rm(i,e,t){var r,s;if(Ee.unmount&&Ee.unmount(i),(r=i.ref)&&(r.current&&r.current!==i.__e||Ku(r,null,e)),(r=i.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(n){Ee.__e(n,e)}r.base=r.__P=null}if(r=i.__k)for(s=0;s<r.length;s++)r[s]&&Rm(r[s],e,t||typeof i.type!="function");t||Wu(i.__e),i.__c=i.__=i.__e=void 0}function yS(i,e,t){return this.constructor(i,t)}function Xu(i,e,t){var r,s,n,o;e==document&&(e=document.documentElement),Ee.__&&Ee.__(i,e),s=(r=typeof t=="function")?null:t&&t.__k||e.__k,n=[],o=[],Gu(e,i=(!r&&t||e).__k=u(Mt,null,[i]),s||qn,qn,e.namespaceURI,!r&&t?[t]:s?null:e.firstChild?Vn.call(e.childNodes):null,n,!r&&t?t:s?s.__e:e.firstChild,r,o),Om(n,i,o)}function ja(i,e,t){var r,s,n,o,a=Ti({},i.props);for(n in i.type&&i.type.defaultProps&&(o=i.type.defaultProps),e)n=="key"?r=e[n]:n=="ref"?s=e[n]:a[n]=e[n]===void 0&&o!==void 0?o[n]:e[n];return arguments.length>2&&(a.children=arguments.length>3?Vn.call(arguments,2):t),$n(i.type,a,r||i.key,s||i.ref,null)}Vn=Am.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}},Em=0,pS=function(i){return i!=null&&i.constructor==null},dt.prototype.setState=function(i,e){var t;t=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=Ti({},this.state),typeof i=="function"&&(i=i(Ti({},t),this.props)),i&&Ti(t,i),i!=null&&this.__v&&(e&&this._sb.push(e),ym(this))},dt.prototype.forceUpdate=function(i){this.__v&&(this.__e=!0,i&&this.__h.push(i),ym(this))},dt.prototype.render=Mt,Kr=[],Tm=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,xm=function(i,e){return i.__v.__b-e.__v.__b},Va.__r=0,km=/(PointerCapture)$|Capture$/i,ju=0,qu=Sm(!1),Vu=Sm(!0),fS=0;function Wn(i){return typeof i!="object"||i===null||!("nodeType"in i)?!1:i.nodeType===Node.ELEMENT_NODE}function wS(i,e){return e===void 0&&(e=document),typeof i=="string"?e.querySelector(i):Wn(i)?i:null}var Mm=wS;function SS(i){for(var e;i&&!i.dir;)i=i.parentNode;return(e=i)==null?void 0:e.dir}var Wa=SS;var gr=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 $r([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 Im(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var ES=0;function TS(i){return"__private_"+ES+++"_"+i}function xS(i){let e=null,t;return function(){for(var r=arguments.length,s=new Array(r),n=0;n<r;n++)s[n]=arguments[n];return t=s,e||(e=Promise.resolve().then(()=>(e=null,i(...t)))),e}}var Gn=TS("updateUI"),Yu=class i extends gr{constructor(){super(...arguments),Object.defineProperty(this,Gn,{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=Mm(e);if(s){this.isTargetDOMEl=!0;let a=document.createElement("div");return a.classList.add("uppy-Root"),Im(this,Gn)[Gn]=xS(l=>{this.uppy.getPlugin(this.id)&&(Xu(this.render(l,a),a),this.afterUpdate())}),this.uppy.log(`Installing ${r} to a DOM element '${e}'`),this.opts.replaceTargetContent&&(s.innerHTML=""),Xu(this.render(this.uppy.getState(),a),a),this.el=a,s.appendChild(a),a.dir=this.opts.direction||Wa(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 <script> tag initializing Uppy is right before the closing </body> tag at the end of the page. (see https://github.com/transloadit/uppy/issues/1042)\n\nIf you meant to target a plugin, please confirm that your `import` statements or `require` calls are correct.",new Error(o)}render(e,t){throw new Error("Extend the render method to add your plugin to a DOM element")}update(e){if(this.el!=null){var t,r;(t=(r=Im(this,Gn))[Gn])==null||t.call(r,e)}}unmount(){if(this.isTargetDOMEl){var e;(e=this.el)==null||e.remove()}this.onUnmount()}onMount(){}onUnmount(){}},di=Yu;function Ga(i,e,t,r){return t===0||i===e?i:r===0?e:i+(e-i)*2**(-r/t)}var It={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete"};var rh=Fe(wt(),1);function Kn(i){let e=[],t="indeterminate",r;for(let{progress:n}of Object.values(i)){let{preprocess:o,postprocess:a}=n;r==null&&(o||a)&&({mode:t,message:r}=o||a),o?.mode==="determinate"&&e.push(o.value),a?.mode==="determinate"&&e.push(a.value)}let s=e.reduce((n,o)=>n+o/e.length,0);return{mode:t,message:r,value:s}}var eh=Fe(wt(),1),Ju=Fe(Ba(),1);function Zu(i){let e=Math.floor(i/3600)%24,t=Math.floor(i/60)%60,r=Math.floor(i%60);return{hours:e,minutes:t,seconds:r}}function Qu(i){let e=Zu(i),t=e.hours===0?"":`${e.hours}h`,r=e.minutes===0?"":`${e.hours===0?e.minutes:` ${e.minutes.toString(10).padStart(2,"0")}`}m`,s=e.hours!==0?"":`${e.minutes===0?e.seconds:` ${e.seconds.toString(10).padStart(2,"0")}`}s`;return`${t}${r}${s}`}var kS="\xB7",Dm=()=>` ${kS} `;function Nm(i){let{newFiles:e,isUploadStarted:t,recoveredState:r,i18n:s,uploadState:n,isSomeGhost:o,startUpload:a}=i,l=(0,eh.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--upload",{"uppy-c-btn-primary":n===It.STATE_WAITING},{"uppy-StatusBar-actionBtn--disabled":o}),c=e&&t&&!r?s("uploadXNewFiles",{smart_count:e}):s("uploadXFiles",{smart_count:e});return u("button",{type:"button",className:l,"aria-label":s("uploadXFiles",{smart_count:e}),onClick:a,disabled:o,"data-uppy-super-focusable":!0},c)}function Bm(i){let{i18n:e,uppy:t}=i;return u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--retry","aria-label":e("retryUpload"),onClick:()=>t.retryAll().catch(()=>{}),"data-uppy-super-focusable":!0,"data-cy":"retry"},u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"8",height:"10",viewBox:"0 0 8 10"},u("path",{d:"M4 2.408a2.75 2.75 0 1 0 2.75 2.75.626.626 0 0 1 1.25.018v.023a4 4 0 1 1-4-4.041V.25a.25.25 0 0 1 .389-.208l2.299 1.533a.25.25 0 0 1 0 .416l-2.3 1.533A.25.25 0 0 1 4 3.316v-.908z"})),e("retry"))}function Um(i){let{i18n:e,uppy:t}=i;return u("button",{type:"button",className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",title:e("cancel"),"aria-label":e("cancel"),onClick:()=>t.cancelAll(),"data-cy":"cancel","data-uppy-super-focusable":!0},u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16"},u("g",{fill:"none",fillRule:"evenodd"},u("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),u("path",{fill:"#FFF",d:"M9.283 8l2.567 2.567-1.283 1.283L8 9.283 5.433 11.85 4.15 10.567 6.717 8 4.15 5.433 5.433 4.15 8 6.717l2.567-2.567 1.283 1.283z"}))))}function zm(i){let{isAllPaused:e,i18n:t,isAllComplete:r,resumableUploads:s,uppy:n}=i,o=t(e?"resume":"pause");function a(){if(!r){if(!s){n.cancelAll();return}if(e){n.resumeAll();return}n.pauseAll()}}return u("button",{title:o,"aria-label":o,className:"uppy-u-reset uppy-StatusBar-actionCircleBtn",type:"button",onClick:a,"data-cy":"togglePauseResume","data-uppy-super-focusable":!0},u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"16",height:"16",viewBox:"0 0 16 16"},u("g",{fill:"none",fillRule:"evenodd"},u("circle",{fill:"#888",cx:"8",cy:"8",r:"8"}),u("path",{fill:"#FFF",d:e?"M6 4.25L11.5 8 6 11.75z":"M5 4.5h2v7H5v-7zm4 0h2v7H9v-7z"}))))}function Hm(i){let{i18n:e,doneButtonHandler:t}=i;return u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-StatusBar-actionBtn uppy-StatusBar-actionBtn--done",onClick:t,"data-uppy-super-focusable":!0},e("done"))}function $m(){return u("svg",{className:"uppy-StatusBar-spinner","aria-hidden":"true",focusable:"false",width:"14",height:"14"},u("path",{d:"M13.983 6.547c-.12-2.509-1.64-4.893-3.939-5.936-2.48-1.127-5.488-.656-7.556 1.094C.524 3.367-.398 6.048.162 8.562c.556 2.495 2.46 4.52 4.94 5.183 2.932.784 5.61-.602 7.256-3.015-1.493 1.993-3.745 3.309-6.298 2.868-2.514-.434-4.578-2.349-5.153-4.84a6.226 6.226 0 0 1 2.98-6.778C6.34.586 9.74 1.1 11.373 3.493c.407.596.693 1.282.842 1.988.127.598.073 1.197.161 1.794.078.525.543 1.257 1.15.864.525-.341.49-1.05.456-1.592-.007-.15.02.3 0 0",fillRule:"evenodd"}))}function qm(i){let{progress:e}=i,{value:t,mode:r,message:s}=e;return u("div",{className:"uppy-StatusBar-content"},u($m,null),r==="determinate"?`${Math.round(t*100)}% \xB7 `:"",s)}function AS(i){let{numUploads:e,complete:t,totalUploadedSize:r,totalSize:s,totalETA:n,i18n:o}=i,a=e>1,l=(0,Ju.default)(r);return u("div",{className:"uppy-StatusBar-statusSecondary"},a&&o("filesUploadedOfTotal",{complete:t,smart_count:e}),u("span",{className:"uppy-StatusBar-additionalInfo"},a&&Dm(),s!=null?o("dataUploadedOfTotal",{complete:l,total:(0,Ju.default)(s)}):o("dataUploadedOfUnknown",{complete:l}),Dm(),n!=null&&o("xTimeLeft",{time:Qu(n)})))}function Vm(i){let{i18n:e,complete:t,numUploads:r}=i;return u("div",{className:"uppy-StatusBar-statusSecondary"},e("filesUploadedOfTotal",{complete:t,smart_count:r}))}function CS(i){let{i18n:e,newFiles:t,startUpload:r}=i,s=(0,eh.default)("uppy-u-reset","uppy-c-btn","uppy-StatusBar-actionBtn","uppy-StatusBar-actionBtn--uploadNewlyAdded");return u("div",{className:"uppy-StatusBar-statusSecondary"},u("div",{className:"uppy-StatusBar-statusSecondaryHint"},e("xMoreFilesAdded",{smart_count:t})),u("button",{type:"button",className:s,"aria-label":e("uploadXFiles",{smart_count:t}),onClick:r},e("upload")))}function jm(i){let{i18n:e,supportsUploadProgress:t,totalProgress:r,showProgressDetails:s,isUploadStarted:n,isAllComplete:o,isAllPaused:a,newFiles:l,numUploads:c,complete:d,totalUploadedSize:f,totalSize:y,totalETA:v,startUpload:x}=i,C=l&&n;if(!n||o)return null;let F=e(a?"paused":"uploading");function L(){return!a&&!C&&s?t?u(AS,{numUploads:c,complete:d,totalUploadedSize:f,totalSize:y,totalETA:v,i18n:e}):u(Vm,{i18n:e,complete:d,numUploads:c}):null}return u("div",{className:"uppy-StatusBar-content","aria-label":F,title:F},a?null:u($m,null),u("div",{className:"uppy-StatusBar-status"},u("div",{className:"uppy-StatusBar-statusPrimary"},t&&r!==0?`${F}: ${r}%`:F),L(),C?u(CS,{i18n:e,newFiles:l,startUpload:x}):null))}function Wm(i){let{i18n:e}=i;return u("div",{className:"uppy-StatusBar-content",role:"status",title:e("complete")},u("div",{className:"uppy-StatusBar-status"},u("div",{className:"uppy-StatusBar-statusPrimary"},u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"15",height:"11",viewBox:"0 0 15 11"},u("path",{d:"M.414 5.843L1.627 4.63l3.472 3.472L13.202 0l1.212 1.213L5.1 10.528z"})),e("complete"))))}function Gm(i){let{error:e,i18n:t,complete:r,numUploads:s}=i;function n(){let o=`${t("uploadFailed")}
|
|
93
93
|
|
|
94
|
-
${e}`;alert(o)}return u("div",{className:"uppy-StatusBar-content",title:t("uploadFailed")},u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"11",height:"11",viewBox:"0 0 11 11"},u("path",{d:"M4.278 5.5L0 1.222 1.222 0 5.5 4.278 9.778 0 11 1.222 6.722 5.5 11 9.778 9.778 11 5.5 6.722 1.222 11 0 9.778z"})),u("div",{className:"uppy-StatusBar-status"},u("div",{className:"uppy-StatusBar-statusPrimary"},t("uploadFailed"),u("button",{className:"uppy-u-reset uppy-StatusBar-details","aria-label":t("showErrorDetails"),"data-microtip-position":"top-right","data-microtip-size":"medium",onClick:n,type:"button"},"?")),u(Eg,{i18n:t,complete:r,numUploads:s})))}var{STATE_ERROR:Ag,STATE_WAITING:hE,STATE_PREPROCESSING:hh,STATE_UPLOADING:el,STATE_POSTPROCESSING:dh,STATE_COMPLETE:tl}=Mt;function fh(i){let{newFiles:e,allowNewUpload:t,isUploadInProgress:r,isAllPaused:s,resumableUploads:n,error:o,hideUploadButton:a=void 0,hidePauseResumeButton:l=!1,hideCancelButton:c=!1,hideRetryButton:d=!1,recoveredState:f,uploadState:g,totalProgress:b,files:w,supportsUploadProgress:P,hideAfterFinish:R=!1,isSomeGhost:C,doneButtonHandler:k=void 0,isUploadStarted:_,i18n:E,startUpload:A,uppy:F,isAllComplete:O,showProgressDetails:M=void 0,numUploads:H,complete:W,totalSize:q,totalETA:Y,totalUploadedSize:ne}=i;function se(){switch(g){case dh:case hh:{let ot=Yn(w);return ot.mode==="determinate"?ot.value*100:b}case Ag:return null;case el:return P?b:null;default:return b}}function Qe(){switch(g){case dh:case hh:{let{mode:ot}=Yn(w);return ot==="indeterminate"}case el:return!P;default:return!1}}let Ee=se(),Me=Ee??100,be=!o&&e&&(!r&&!s||f)&&t&&!a,ct=!c&&g!==hE&&g!==tl,Ut=n&&!l&&g===el,oe=o&&!O&&!d,ut=k&&g===tl,ae=(0,ph.default)("uppy-StatusBar-progress",{"is-indeterminate":Qe()}),nt=(0,ph.default)("uppy-StatusBar",`is-${g}`,{"has-ghosts":C}),J=(()=>{switch(g){case hh:case dh:return u(Sg,{progress:Yn(w)});case tl:return u(xg,{i18n:E});case Ag:return u(kg,{error:o,i18n:E,numUploads:H,complete:W});case el:return u(Tg,{i18n:E,supportsUploadProgress:P,totalProgress:b,showProgressDetails:M,isUploadStarted:_,isAllComplete:O,isAllPaused:s,newFiles:e,numUploads:H,complete:W,totalUploadedSize:ne,totalSize:q,totalETA:Y,startUpload:A});default:return null}})();return!(be||oe||Ut||ct||ut)&&!J||g===tl&&R?null:u("div",{className:nt},u("div",{className:ae,style:{width:`${Me}%`},role:"progressbar","aria-label":`${Me}%`,"aria-valuetext":`${Me}%`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":Ee}),J,u("div",{className:"uppy-StatusBar-actions"},be?u(mg,{newFiles:e,isUploadStarted:_,recoveredState:f,i18n:E,isSomeGhost:C,startUpload:A,uploadState:g}):null,oe?u(gg,{i18n:E,uppy:F}):null,Ut?u(bg,{isAllPaused:s,i18n:E,isAllComplete:O,resumableUploads:n,uppy:F}):null,ct?u(vg,{i18n:E,uppy:F}):null,ut?u(yg,{i18n:E,doneButtonHandler:k}):null))}var _g={strings:{uploading:"Uploading",complete:"Complete",uploadFailed:"Upload failed",paused:"Paused",retry:"Retry",cancel:"Cancel",pause:"Pause",resume:"Resume",done:"Done",filesUploadedOfTotal:{0:"%{complete} of %{smart_count} file uploaded",1:"%{complete} of %{smart_count} files uploaded"},dataUploadedOfTotal:"%{complete} of %{total}",dataUploadedOfUnknown:"%{complete} of unknown",xTimeLeft:"%{time} left",uploadXFiles:{0:"Upload %{smart_count} file",1:"Upload %{smart_count} files"},uploadXNewFiles:{0:"Upload +%{smart_count} file",1:"Upload +%{smart_count} files"},upload:"Upload",retryUpload:"Retry upload",xMoreFilesAdded:{0:"%{smart_count} more file added",1:"%{smart_count} more files added"},showErrorDetails:"Show error details"}};function Ae(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var dE=0;function Is(i){return"__private_"+dE+++"_"+i}var pE={version:"4.1.3"},fE=2e3,mE=2e3;function gE(i,e,t,r){if(i)return Mt.STATE_ERROR;if(e)return Mt.STATE_COMPLETE;if(t)return Mt.STATE_WAITING;let s=Mt.STATE_WAITING,n=Object.keys(r);for(let o=0;o<n.length;o++){let{progress:a}=r[n[o]];if(a.uploadStarted&&!a.uploadComplete)return Mt.STATE_UPLOADING;a.preprocess&&(s=Mt.STATE_PREPROCESSING),a.postprocess&&s!==Mt.STATE_PREPROCESSING&&(s=Mt.STATE_POSTPROCESSING)}return s}var vE={hideUploadButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideCancelButton:!1,showProgressDetails:!1,hideAfterFinish:!0,doneButtonHandler:null},Yt=Is("lastUpdateTime"),fi=Is("previousUploadedBytes"),Ki=Is("previousSpeed"),It=Is("previousETA"),mh=Is("computeSmoothETA"),Zn=Is("onUploadStart"),Qr=class extends pi{constructor(e,t){super(e,{...vE,...t}),Object.defineProperty(this,mh,{value:bE}),Object.defineProperty(this,Yt,{writable:!0,value:void 0}),Object.defineProperty(this,fi,{writable:!0,value:void 0}),Object.defineProperty(this,Ki,{writable:!0,value:void 0}),Object.defineProperty(this,It,{writable:!0,value:void 0}),this.startUpload=()=>this.uppy.upload().catch(()=>{}),Object.defineProperty(this,Zn,{writable:!0,value:()=>{let{recoveredState:r}=this.uppy.getState();if(Ae(this,Ki)[Ki]=null,Ae(this,It)[It]=null,r){Ae(this,fi)[fi]=Object.values(r.files).reduce((s,n)=>{let{progress:o}=n;return s+o.bytesUploaded},0),this.uppy.emit("restore-confirmed");return}Ae(this,Yt)[Yt]=performance.now(),Ae(this,fi)[fi]=0}}),this.id=this.opts.id||"StatusBar",this.title="StatusBar",this.type="progressindicator",this.defaultLocale=_g,this.i18nInit(),this.render=this.render.bind(this),this.install=this.install.bind(this)}render(e){let{capabilities:t,files:r,allowNewUpload:s,totalProgress:n,error:o,recoveredState:a}=e,{newFiles:l,startedFiles:c,completeFiles:d,isUploadStarted:f,isAllComplete:g,isAllPaused:b,isUploadInProgress:w,isSomeGhost:P}=this.uppy.getObjectOfFilesPerState(),R=a?Object.values(r):l,C=!!t.resumableUploads,k=t.uploadProgress!==!1,_=null,E=0;c.every(F=>F.progress.bytesTotal!=null&&F.progress.bytesTotal!==0)?(_=0,c.forEach(F=>{_+=F.progress.bytesTotal||0,E+=F.progress.bytesUploaded||0})):c.forEach(F=>{E+=F.progress.bytesUploaded||0});let A=Ae(this,mh)[mh]({uploaded:E,total:_});return fh({error:o,uploadState:gE(o,g,a,e.files||{}),allowNewUpload:s,totalProgress:n,totalSize:_,totalUploadedSize:E,isAllComplete:!1,isAllPaused:b,isUploadStarted:f,isUploadInProgress:w,isSomeGhost:P,recoveredState:a,complete:d.length,newFiles:R.length,numUploads:c.length,totalETA:A,files:r,i18n:this.i18n,uppy:this.uppy,startUpload:this.startUpload,doneButtonHandler:this.opts.doneButtonHandler,resumableUploads:C,supportsUploadProgress:k,showProgressDetails:this.opts.showProgressDetails,hideUploadButton:this.opts.hideUploadButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,hideCancelButton:this.opts.hideCancelButton,hideAfterFinish:this.opts.hideAfterFinish})}onMount(){let e=this.el;Za(e)||(e.dir="ltr")}install(){let{target:e}=this.opts;e&&this.mount(e,this),this.uppy.on("upload",Ae(this,Zn)[Zn]),Ae(this,Yt)[Yt]=performance.now(),Ae(this,fi)[fi]=this.uppy.getFiles().reduce((t,r)=>t+r.progress.bytesUploaded,0)}uninstall(){this.unmount(),this.uppy.off("upload",Ae(this,Zn)[Zn])}};function bE(i){var e,t;if(i.total==null||i.total===0)return null;let r=i.total-i.uploaded;if(r<=0)return null;(t=(e=Ae(this,Yt))[Yt])!=null||(e[Yt]=performance.now());let s=performance.now()-Ae(this,Yt)[Yt];if(s===0){var n;return Math.round(((n=Ae(this,It)[It])!=null?n:0)/100)/10}let o=i.uploaded-Ae(this,fi)[fi];if(Ae(this,fi)[fi]=i.uploaded,o<=0){var a;return Math.round(((a=Ae(this,It)[It])!=null?a:0)/100)/10}let l=o/s,c=Ae(this,Ki)[Ki]==null?l:Qa(l,Ae(this,Ki)[Ki],fE,s);Ae(this,Ki)[Ki]=c;let d=r/c,f=Math.max(Ae(this,It)[It]-s,0),g=Ae(this,It)[It]==null?d:Qa(d,f,mE,s);return Ae(this,It)[It]=g,Ae(this,Yt)[Yt]=performance.now(),Math.round(g/100)/10}Qr.VERSION=pE.version;var Cg=300,Qn=class extends ke{constructor(){super(...arguments),this.ref=Ka()}componentWillEnter(e){this.ref.current.style.opacity="1",this.ref.current.style.transform="none",setTimeout(e,Cg)}componentWillLeave(e){this.ref.current.style.opacity="0",this.ref.current.style.transform="translateY(350%)",setTimeout(e,Cg)}render(){let{children:e}=this.props;return u("div",{className:"uppy-Informer-animated",ref:this.ref},e)}};function yE(i,e){return Object.assign(i,e)}function wE(i,e){var t;return(t=i?.key)!=null?t:e}function SE(i,e){let t=i._ptgLinkedRefs||(i._ptgLinkedRefs={});return t[e]||(t[e]=r=>{i.refs[e]=r})}function Jn(i){let e={};for(let t=0;t<i.length;t++)if(i[t]!=null){let r=wE(i[t],t.toString(36));e[r]=i[t]}return e}function EE(i,e){i=i||{},e=e||{};let t=o=>e.hasOwnProperty(o)?e[o]:i[o],r={},s=[];for(let o in i)e.hasOwnProperty(o)?s.length&&(r[o]=s,s=[]):s.push(o);let n={};for(let o in e){if(r.hasOwnProperty(o))for(let a=0;a<r[o].length;a++){let l=r[o][a];n[r[o][a]]=t(l)}n[o]=t(o)}for(let o=0;o<s.length;o++)n[s[o]]=t(s[o]);return n}var TE=i=>i,il=class extends ke{constructor(e,t){super(e,t),this.refs={},this.state={children:Jn(Ct(Ct(this.props.children))||[])},this.performAppear=this.performAppear.bind(this),this.performEnter=this.performEnter.bind(this),this.performLeave=this.performLeave.bind(this)}componentWillMount(){this.currentlyTransitioningKeys={},this.keysToAbortLeave=[],this.keysToEnter=[],this.keysToLeave=[]}componentDidMount(){let e=this.state.children;for(let t in e)e[t]&&this.performAppear(t)}componentWillReceiveProps(e){let t=Jn(Ct(e.children)||[]),r=this.state.children;this.setState(n=>({children:EE(n.children,t)}));let s;for(s in t)if(t.hasOwnProperty(s)){let n=r&&r.hasOwnProperty(s);t[s]&&n&&this.currentlyTransitioningKeys[s]?(this.keysToEnter.push(s),this.keysToAbortLeave.push(s)):t[s]&&!n&&!this.currentlyTransitioningKeys[s]&&this.keysToEnter.push(s)}for(s in r)if(r.hasOwnProperty(s)){let n=t&&t.hasOwnProperty(s);r[s]&&!n&&!this.currentlyTransitioningKeys[s]&&this.keysToLeave.push(s)}}componentDidUpdate(){let{keysToEnter:e}=this;this.keysToEnter=[],e.forEach(this.performEnter);let{keysToLeave:t}=this;this.keysToLeave=[],t.forEach(this.performLeave)}_finishAbort(e){let t=this.keysToAbortLeave.indexOf(e);t!==-1&&this.keysToAbortLeave.splice(t,1)}performAppear(e){this.currentlyTransitioningKeys[e]=!0;let t=this.refs[e];t!=null&&t.componentWillAppear?t.componentWillAppear(this._handleDoneAppearing.bind(this,e)):this._handleDoneAppearing(e)}_handleDoneAppearing(e){let t=this.refs[e];t!=null&&t.componentDidAppear&&t.componentDidAppear(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);let r=Jn(Ct(this.props.children)||[]);(!r||!r.hasOwnProperty(e))&&this.performLeave(e)}performEnter(e){this.currentlyTransitioningKeys[e]=!0;let t=this.refs[e];t!=null&&t.componentWillEnter?t.componentWillEnter(this._handleDoneEntering.bind(this,e)):this._handleDoneEntering(e)}_handleDoneEntering(e){let t=this.refs[e];t!=null&&t.componentDidEnter&&t.componentDidEnter(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);let r=Jn(Ct(this.props.children)||[]);(!r||!r.hasOwnProperty(e))&&this.performLeave(e)}performLeave(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;this.currentlyTransitioningKeys[e]=!0;let r=this.refs[e];r!=null&&r.componentWillLeave?r.componentWillLeave(this._handleDoneLeaving.bind(this,e)):this._handleDoneLeaving(e)}_handleDoneLeaving(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;let r=this.refs[e];r!=null&&r.componentDidLeave&&r.componentDidLeave(),delete this.currentlyTransitioningKeys[e];let s=Jn(Ct(this.props.children)||[]);if(s&&s.hasOwnProperty(e))this.performEnter(e);else{let n=yE({},this.state.children);delete n[e],this.setState({children:n})}}render(e,t){let{childFactory:r,transitionLeave:s,transitionName:n,transitionAppear:o,transitionEnter:a,transitionLeaveTimeout:l,transitionEnterTimeout:c,transitionAppearTimeout:d,component:f,...g}=e,{children:b}=t,w=Object.entries(b).map(P=>{let[R,C]=P;if(!C)return;let k=SE(this,R);return jn(r(C),{ref:k,key:R})}).filter(Boolean);return u(f,g,w)}};il.defaultProps={component:"span",childFactory:TE};var Pg=il;var xE={version:"4.2.1"},Jr=class extends pi{constructor(e,t){super(e,t),this.render=r=>u("div",{className:"uppy uppy-Informer"},u(Pg,null,r.info.map(s=>u(Qn,{key:s.message},u("p",{role:"alert"},s.message," ",s.details&&u("span",{"aria-label":s.details,"data-microtip-position":"top-left","data-microtip-size":"medium",role:"tooltip",onClick:()=>alert(`${s.message}
|
|
94
|
+
${e}`;alert(o)}return u("div",{className:"uppy-StatusBar-content",title:t("uploadFailed")},u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-StatusBar-statusIndicator uppy-c-icon",width:"11",height:"11",viewBox:"0 0 11 11"},u("path",{d:"M4.278 5.5L0 1.222 1.222 0 5.5 4.278 9.778 0 11 1.222 6.722 5.5 11 9.778 9.778 11 5.5 6.722 1.222 11 0 9.778z"})),u("div",{className:"uppy-StatusBar-status"},u("div",{className:"uppy-StatusBar-statusPrimary"},t("uploadFailed"),u("button",{className:"uppy-u-reset uppy-StatusBar-details","aria-label":t("showErrorDetails"),"data-microtip-position":"top-right","data-microtip-size":"medium",onClick:n,type:"button"},"?")),u(Vm,{i18n:t,complete:r,numUploads:s})))}var{STATE_ERROR:Km,STATE_WAITING:PS,STATE_PREPROCESSING:th,STATE_UPLOADING:Xa,STATE_POSTPROCESSING:ih,STATE_COMPLETE:Ya}=It;function sh(i){let{newFiles:e,allowNewUpload:t,isUploadInProgress:r,isAllPaused:s,resumableUploads:n,error:o,hideUploadButton:a=void 0,hidePauseResumeButton:l=!1,hideCancelButton:c=!1,hideRetryButton:d=!1,recoveredState:f,uploadState:y,totalProgress:v,files:x,supportsUploadProgress:C,hideAfterFinish:F=!1,isSomeGhost:L,doneButtonHandler:D=void 0,isUploadStarted:V,i18n:M,startUpload:$,uppy:z,isAllComplete:G,showProgressDetails:K=void 0,numUploads:Q,complete:ne,totalSize:Y,totalETA:re,totalUploadedSize:le}=i;function ke(){switch(y){case ih:case th:{let He=Kn(x);return He.mode==="determinate"?He.value*100:v}case Km:return null;case Xa:return C?v:null;default:return v}}function We(){switch(y){case ih:case th:{let{mode:He}=Kn(x);return He==="indeterminate"}case Xa:return!C;default:return!1}}let T=ke(),k=T??100,A=!o&&e&&(!r&&!s||f)&&t&&!a,H=!c&&y!==PS&&y!==Ya,j=n&&!l&&y===Xa,U=o&&!G&&!d,ee=D&&y===Ya,te=(0,rh.default)("uppy-StatusBar-progress",{"is-indeterminate":We()}),Ae=(0,rh.default)("uppy-StatusBar",`is-${y}`,{"has-ghosts":L}),oe=(()=>{switch(y){case th:case ih:return u(qm,{progress:Kn(x)});case Ya:return u(Wm,{i18n:M});case Km:return u(Gm,{error:o,i18n:M,numUploads:Q,complete:ne});case Xa:return u(jm,{i18n:M,supportsUploadProgress:C,totalProgress:v,showProgressDetails:K,isUploadStarted:V,isAllComplete:G,isAllPaused:s,newFiles:e,numUploads:Q,complete:ne,totalUploadedSize:le,totalSize:Y,totalETA:re,startUpload:$});default:return null}})();return!(A||U||j||H||ee)&&!oe||y===Ya&&F?null:u("div",{className:Ae},u("div",{className:te,style:{width:`${k}%`},role:"progressbar","aria-label":`${k}%`,"aria-valuetext":`${k}%`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":T}),oe,u("div",{className:"uppy-StatusBar-actions"},A?u(Nm,{newFiles:e,isUploadStarted:V,recoveredState:f,i18n:M,isSomeGhost:L,startUpload:$,uploadState:y}):null,U?u(Bm,{i18n:M,uppy:z}):null,j?u(zm,{isAllPaused:s,i18n:M,isAllComplete:G,resumableUploads:n,uppy:z}):null,H?u(Um,{i18n:M,uppy:z}):null,ee?u(Hm,{i18n:M,doneButtonHandler:D}):null))}var Xm={strings:{uploading:"Uploading",complete:"Complete",uploadFailed:"Upload failed",paused:"Paused",retry:"Retry",cancel:"Cancel",pause:"Pause",resume:"Resume",done:"Done",filesUploadedOfTotal:{0:"%{complete} of %{smart_count} file uploaded",1:"%{complete} of %{smart_count} files uploaded"},dataUploadedOfTotal:"%{complete} of %{total}",dataUploadedOfUnknown:"%{complete} of unknown",xTimeLeft:"%{time} left",uploadXFiles:{0:"Upload %{smart_count} file",1:"Upload %{smart_count} files"},uploadXNewFiles:{0:"Upload +%{smart_count} file",1:"Upload +%{smart_count} files"},upload:"Upload",retryUpload:"Retry upload",xMoreFilesAdded:{0:"%{smart_count} more file added",1:"%{smart_count} more files added"},showErrorDetails:"Show error details"}};function Oe(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var FS=0;function Bs(i){return"__private_"+FS+++"_"+i}var _S={version:"4.1.2"},OS=2e3,LS=2e3;function RS(i,e,t,r){if(i)return It.STATE_ERROR;if(e)return It.STATE_COMPLETE;if(t)return It.STATE_WAITING;let s=It.STATE_WAITING,n=Object.keys(r);for(let o=0;o<n.length;o++){let{progress:a}=r[n[o]];if(a.uploadStarted&&!a.uploadComplete)return It.STATE_UPLOADING;a.preprocess&&(s=It.STATE_PREPROCESSING),a.postprocess&&s!==It.STATE_PREPROCESSING&&(s=It.STATE_POSTPROCESSING)}return s}var MS={hideUploadButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideCancelButton:!1,showProgressDetails:!1,hideAfterFinish:!0,doneButtonHandler:null},Xt=Bs("lastUpdateTime"),pi=Bs("previousUploadedBytes"),Wi=Bs("previousSpeed"),Dt=Bs("previousETA"),nh=Bs("computeSmoothETA"),Xn=Bs("onUploadStart"),Xr=class extends di{constructor(e,t){super(e,{...MS,...t}),Object.defineProperty(this,nh,{value:IS}),Object.defineProperty(this,Xt,{writable:!0,value:void 0}),Object.defineProperty(this,pi,{writable:!0,value:void 0}),Object.defineProperty(this,Wi,{writable:!0,value:void 0}),Object.defineProperty(this,Dt,{writable:!0,value:void 0}),this.startUpload=()=>this.uppy.upload().catch(()=>{}),Object.defineProperty(this,Xn,{writable:!0,value:()=>{let{recoveredState:r}=this.uppy.getState();if(Oe(this,Wi)[Wi]=null,Oe(this,Dt)[Dt]=null,r){Oe(this,pi)[pi]=Object.values(r.files).reduce((s,n)=>{let{progress:o}=n;return s+o.bytesUploaded},0),this.uppy.emit("restore-confirmed");return}Oe(this,Xt)[Xt]=performance.now(),Oe(this,pi)[pi]=0}}),this.id=this.opts.id||"StatusBar",this.title="StatusBar",this.type="progressindicator",this.defaultLocale=Xm,this.i18nInit(),this.render=this.render.bind(this),this.install=this.install.bind(this)}render(e){let{capabilities:t,files:r,allowNewUpload:s,totalProgress:n,error:o,recoveredState:a}=e,{newFiles:l,startedFiles:c,completeFiles:d,isUploadStarted:f,isAllComplete:y,isAllPaused:v,isUploadInProgress:x,isSomeGhost:C}=this.uppy.getObjectOfFilesPerState(),F=a?Object.values(r):l,L=!!t.resumableUploads,D=t.uploadProgress!==!1,V=null,M=0;c.every(z=>z.progress.bytesTotal!=null&&z.progress.bytesTotal!==0)?(V=0,c.forEach(z=>{V+=z.progress.bytesTotal||0,M+=z.progress.bytesUploaded||0})):c.forEach(z=>{M+=z.progress.bytesUploaded||0});let $=Oe(this,nh)[nh]({uploaded:M,total:V});return sh({error:o,uploadState:RS(o,y,a,e.files||{}),allowNewUpload:s,totalProgress:n,totalSize:V,totalUploadedSize:M,isAllComplete:!1,isAllPaused:v,isUploadStarted:f,isUploadInProgress:x,isSomeGhost:C,recoveredState:a,complete:d.length,newFiles:F.length,numUploads:c.length,totalETA:$,files:r,i18n:this.i18n,uppy:this.uppy,startUpload:this.startUpload,doneButtonHandler:this.opts.doneButtonHandler,resumableUploads:L,supportsUploadProgress:D,showProgressDetails:this.opts.showProgressDetails,hideUploadButton:this.opts.hideUploadButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,hideCancelButton:this.opts.hideCancelButton,hideAfterFinish:this.opts.hideAfterFinish})}onMount(){let e=this.el;Wa(e)||(e.dir="ltr")}install(){let{target:e}=this.opts;e&&this.mount(e,this),this.uppy.on("upload",Oe(this,Xn)[Xn]),Oe(this,Xt)[Xt]=performance.now(),Oe(this,pi)[pi]=this.uppy.getFiles().reduce((t,r)=>t+r.progress.bytesUploaded,0)}uninstall(){this.unmount(),this.uppy.off("upload",Oe(this,Xn)[Xn])}};function IS(i){var e,t;if(i.total==null||i.total===0)return null;let r=i.total-i.uploaded;if(r<=0)return null;(t=(e=Oe(this,Xt))[Xt])!=null||(e[Xt]=performance.now());let s=performance.now()-Oe(this,Xt)[Xt];if(s===0){var n;return Math.round(((n=Oe(this,Dt)[Dt])!=null?n:0)/100)/10}let o=i.uploaded-Oe(this,pi)[pi];if(Oe(this,pi)[pi]=i.uploaded,o<=0){var a;return Math.round(((a=Oe(this,Dt)[Dt])!=null?a:0)/100)/10}let l=o/s,c=Oe(this,Wi)[Wi]==null?l:Ga(l,Oe(this,Wi)[Wi],OS,s);Oe(this,Wi)[Wi]=c;let d=r/c,f=Math.max(Oe(this,Dt)[Dt]-s,0),y=Oe(this,Dt)[Dt]==null?d:Ga(d,f,LS,s);return Oe(this,Dt)[Dt]=y,Oe(this,Xt)[Xt]=performance.now(),Math.round(y/100)/10}Xr.VERSION=_S.version;var Ym=300,Yn=class extends dt{constructor(){super(...arguments),this.ref=Cm()}componentWillEnter(e){this.ref.current.style.opacity="1",this.ref.current.style.transform="none",setTimeout(e,Ym)}componentWillLeave(e){this.ref.current.style.opacity="0",this.ref.current.style.transform="translateY(350%)",setTimeout(e,Ym)}render(){let{children:e}=this.props;return u("div",{className:"uppy-Informer-animated",ref:this.ref},e)}};function DS(i,e){return Object.assign(i,e)}function NS(i,e){var t;return(t=i?.key)!=null?t:e}function BS(i,e){let t=i._ptgLinkedRefs||(i._ptgLinkedRefs={});return t[e]||(t[e]=r=>{i.refs[e]=r})}function Zn(i){let e={};for(let t=0;t<i.length;t++)if(i[t]!=null){let r=NS(i[t],t.toString(36));e[r]=i[t]}return e}function US(i,e){i=i||{},e=e||{};let t=o=>e.hasOwnProperty(o)?e[o]:i[o],r={},s=[];for(let o in i)e.hasOwnProperty(o)?s.length&&(r[o]=s,s=[]):s.push(o);let n={};for(let o in e){if(r.hasOwnProperty(o))for(let a=0;a<r[o].length;a++){let l=r[o][a];n[r[o][a]]=t(l)}n[o]=t(o)}for(let o=0;o<s.length;o++)n[s[o]]=t(s[o]);return n}var zS=i=>i,Za=class extends dt{constructor(e,t){super(e,t),this.refs={},this.state={children:Zn(xi(xi(this.props.children))||[])},this.performAppear=this.performAppear.bind(this),this.performEnter=this.performEnter.bind(this),this.performLeave=this.performLeave.bind(this)}componentWillMount(){this.currentlyTransitioningKeys={},this.keysToAbortLeave=[],this.keysToEnter=[],this.keysToLeave=[]}componentDidMount(){let e=this.state.children;for(let t in e)e[t]&&this.performAppear(t)}componentWillReceiveProps(e){let t=Zn(xi(e.children)||[]),r=this.state.children;this.setState(n=>({children:US(n.children,t)}));let s;for(s in t)if(t.hasOwnProperty(s)){let n=r&&r.hasOwnProperty(s);t[s]&&n&&this.currentlyTransitioningKeys[s]?(this.keysToEnter.push(s),this.keysToAbortLeave.push(s)):t[s]&&!n&&!this.currentlyTransitioningKeys[s]&&this.keysToEnter.push(s)}for(s in r)if(r.hasOwnProperty(s)){let n=t&&t.hasOwnProperty(s);r[s]&&!n&&!this.currentlyTransitioningKeys[s]&&this.keysToLeave.push(s)}}componentDidUpdate(){let{keysToEnter:e}=this;this.keysToEnter=[],e.forEach(this.performEnter);let{keysToLeave:t}=this;this.keysToLeave=[],t.forEach(this.performLeave)}_finishAbort(e){let t=this.keysToAbortLeave.indexOf(e);t!==-1&&this.keysToAbortLeave.splice(t,1)}performAppear(e){this.currentlyTransitioningKeys[e]=!0;let t=this.refs[e];t!=null&&t.componentWillAppear?t.componentWillAppear(this._handleDoneAppearing.bind(this,e)):this._handleDoneAppearing(e)}_handleDoneAppearing(e){let t=this.refs[e];t!=null&&t.componentDidAppear&&t.componentDidAppear(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);let r=Zn(xi(this.props.children)||[]);(!r||!r.hasOwnProperty(e))&&this.performLeave(e)}performEnter(e){this.currentlyTransitioningKeys[e]=!0;let t=this.refs[e];t!=null&&t.componentWillEnter?t.componentWillEnter(this._handleDoneEntering.bind(this,e)):this._handleDoneEntering(e)}_handleDoneEntering(e){let t=this.refs[e];t!=null&&t.componentDidEnter&&t.componentDidEnter(),delete this.currentlyTransitioningKeys[e],this._finishAbort(e);let r=Zn(xi(this.props.children)||[]);(!r||!r.hasOwnProperty(e))&&this.performLeave(e)}performLeave(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;this.currentlyTransitioningKeys[e]=!0;let r=this.refs[e];r!=null&&r.componentWillLeave?r.componentWillLeave(this._handleDoneLeaving.bind(this,e)):this._handleDoneLeaving(e)}_handleDoneLeaving(e){if(this.keysToAbortLeave.indexOf(e)!==-1)return;let r=this.refs[e];r!=null&&r.componentDidLeave&&r.componentDidLeave(),delete this.currentlyTransitioningKeys[e];let s=Zn(xi(this.props.children)||[]);if(s&&s.hasOwnProperty(e))this.performEnter(e);else{let n=DS({},this.state.children);delete n[e],this.setState({children:n})}}render(e,t){let{childFactory:r,transitionLeave:s,transitionName:n,transitionAppear:o,transitionEnter:a,transitionLeaveTimeout:l,transitionEnterTimeout:c,transitionAppearTimeout:d,component:f,...y}=e,{children:v}=t,x=Object.entries(v).map(C=>{let[F,L]=C;if(!L)return;let D=BS(this,F);return ja(r(L),{ref:D,key:F})}).filter(Boolean);return u(f,y,x)}};Za.defaultProps={component:"span",childFactory:zS};var Zm=Za;var HS={version:"4.2.1"},Yr=class extends di{constructor(e,t){super(e,t),this.render=r=>u("div",{className:"uppy uppy-Informer"},u(Zm,null,r.info.map(s=>u(Yn,{key:s.message},u("p",{role:"alert"},s.message," ",s.details&&u("span",{"aria-label":s.details,"data-microtip-position":"top-left","data-microtip-size":"medium",role:"tooltip",onClick:()=>alert(`${s.message}
|
|
95
95
|
|
|
96
|
-
${s.details}`)},"?")))))),this.type="progressindicator",this.id=this.opts.id||"Informer",this.title="Informer"}install(){let{target:e}=this.opts;e&&this.mount(e,this)}};Jr.VERSION=xE.version;var kE=/^data:([^/]+\/[^,;]+(?:[^,]*?))(;base64)?,([\s\S]*)$/;function AE(i,e,t){var r,s;let n=kE.exec(i),o=(r=(s=e.mimeType)!=null?s:n?.[1])!=null?r:"plain/text",a;if(n?.[2]!=null){let l=atob(decodeURIComponent(n[3])),c=new Uint8Array(l.length);for(let d=0;d<l.length;d++)c[d]=l.charCodeAt(d);a=[c]}else n?.[3]!=null&&(a=[decodeURIComponent(n[3])]);return t?new File(a,e.name||"",{type:o}):new Blob(a,{type:o})}var Fg=AE;function rl(i){return i.startsWith("blob:")}function sl(i){return i?/^[^/]+\/(jpe?g|gif|png|svg|svg\+xml|bmp|webp|avif)$/.test(i):!1}function de(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}var Ug=typeof self<"u"?self:global,ro=typeof navigator<"u",_E=ro&&typeof HTMLImageElement>"u",Og=!(typeof global>"u"||typeof process>"u"||!process.versions||!process.versions.node),zg=Ug.Buffer,Hg=!!zg,CE=i=>i!==void 0;function $g(i){return i===void 0||(i instanceof Map?i.size===0:Object.values(i).filter(CE).length===0)}function Ze(i){let e=new Error(i);throw delete e.stack,e}function Rg(i){let e=function(t){let r=0;return t.ifd0.enabled&&(r+=1024),t.exif.enabled&&(r+=2048),t.makerNote&&(r+=2048),t.userComment&&(r+=1024),t.gps.enabled&&(r+=512),t.interop.enabled&&(r+=100),t.ifd1.enabled&&(r+=1024),r+2048}(i);return i.jfif.enabled&&(e+=50),i.xmp.enabled&&(e+=2e4),i.iptc.enabled&&(e+=14e3),i.icc.enabled&&(e+=6e3),e}var gh=i=>String.fromCharCode.apply(null,i),Lg=typeof TextDecoder<"u"?new TextDecoder("utf-8"):void 0,ts=class i{static from(e,t){return e instanceof this&&e.le===t?e:new i(e,void 0,void 0,t)}constructor(e,t=0,r,s){if(typeof s=="boolean"&&(this.le=s),Array.isArray(e)&&(e=new Uint8Array(e)),e===0)this.byteOffset=0,this.byteLength=0;else if(e instanceof ArrayBuffer){r===void 0&&(r=e.byteLength-t);let n=new DataView(e,t,r);this._swapDataView(n)}else if(e instanceof Uint8Array||e instanceof DataView||e instanceof i){r===void 0&&(r=e.byteLength-t),(t+=e.byteOffset)+r>e.byteOffset+e.byteLength&&Ze("Creating view outside of available memory in ArrayBuffer");let n=new DataView(e.buffer,t,r);this._swapDataView(n)}else if(typeof e=="number"){let n=new DataView(new ArrayBuffer(e));this._swapDataView(n)}else Ze("Invalid input argument for BufferView: "+e)}_swapArrayBuffer(e){this._swapDataView(new DataView(e))}_swapBuffer(e){this._swapDataView(new DataView(e.buffer,e.byteOffset,e.byteLength))}_swapDataView(e){this.dataView=e,this.buffer=e.buffer,this.byteOffset=e.byteOffset,this.byteLength=e.byteLength}_lengthToEnd(e){return this.byteLength-e}set(e,t,r=i){return e instanceof DataView||e instanceof i?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e instanceof Uint8Array||Ze("BufferView.set(): Invalid data argument."),this.toUint8().set(e,t),new r(this,t,e.byteLength)}subarray(e,t){return t=t||this._lengthToEnd(e),new i(this,e,t)}toUint8(){return new Uint8Array(this.buffer,this.byteOffset,this.byteLength)}getUint8Array(e,t){return new Uint8Array(this.buffer,this.byteOffset+e,t)}getString(e=0,t=this.byteLength){return s=this.getUint8Array(e,t),Lg?Lg.decode(s):Hg?Buffer.from(s).toString("utf8"):decodeURIComponent(escape(gh(s)));var s}getLatin1String(e=0,t=this.byteLength){let r=this.getUint8Array(e,t);return gh(r)}getUnicodeString(e=0,t=this.byteLength){let r=[];for(let s=0;s<t&&e+s<this.byteLength;s+=2)r.push(this.getUint16(e+s));return gh(r)}getInt8(e){return this.dataView.getInt8(e)}getUint8(e){return this.dataView.getUint8(e)}getInt16(e,t=this.le){return this.dataView.getInt16(e,t)}getInt32(e,t=this.le){return this.dataView.getInt32(e,t)}getUint16(e,t=this.le){return this.dataView.getUint16(e,t)}getUint32(e,t=this.le){return this.dataView.getUint32(e,t)}getFloat32(e,t=this.le){return this.dataView.getFloat32(e,t)}getFloat64(e,t=this.le){return this.dataView.getFloat64(e,t)}getFloat(e,t=this.le){return this.dataView.getFloat32(e,t)}getDouble(e,t=this.le){return this.dataView.getFloat64(e,t)}getUintBytes(e,t,r){switch(t){case 1:return this.getUint8(e,r);case 2:return this.getUint16(e,r);case 4:return this.getUint32(e,r);case 8:return this.getUint64&&this.getUint64(e,r)}}getUint(e,t,r){switch(t){case 8:return this.getUint8(e,r);case 16:return this.getUint16(e,r);case 32:return this.getUint32(e,r);case 64:return this.getUint64&&this.getUint64(e,r)}}toString(e){return this.dataView.toString(e,this.constructor.name)}ensureChunk(){}};function bh(i,e){Ze(`${i} '${e}' was not loaded, try using full build of exifr.`)}var so=class extends Map{constructor(e){super(),this.kind=e}get(e,t){return this.has(e)||bh(this.kind,e),t&&(e in t||function(r,s){Ze(`Unknown ${r} '${s}'.`)}(this.kind,e),t[e].enabled||bh(this.kind,e)),super.get(e)}keyList(){return Array.from(this.keys())}},cl=new so("file parser"),Dt=new so("segment parser"),ao=new so("file reader"),PE=Ug.fetch;function Mg(i,e){return(t=i).startsWith("data:")||t.length>1e4?wh(i,e,"base64"):Og&&i.includes("://")?yh(i,e,"url",nl):Og?wh(i,e,"fs"):ro?yh(i,e,"url",nl):void Ze("Invalid input argument");var t}async function yh(i,e,t,r){return ao.has(t)?wh(i,e,t):r?async function(s,n){let o=await n(s);return new ts(o)}(i,r):void Ze(`Parser ${t} is not loaded`)}async function wh(i,e,t){let r=new(ao.get(t))(i,e);return await r.read(),r}var nl=i=>PE(i).then(e=>e.arrayBuffer()),no=i=>new Promise((e,t)=>{let r=new FileReader;r.onloadend=()=>e(r.result||new ArrayBuffer),r.onerror=t,r.readAsArrayBuffer(i)}),Sh=class extends Map{get tagKeys(){return this.allKeys||(this.allKeys=Array.from(this.keys())),this.allKeys}get tagValues(){return this.allValues||(this.allValues=Array.from(this.values())),this.allValues}};function qg(i,e,t){let r=new Sh;for(let[s,n]of t)r.set(s,n);if(Array.isArray(e))for(let s of e)i.set(s,r);else i.set(e,r);return r}function Vg(i,e,t){let r,s=i.get(e);for(r of t)s.set(r[0],r[1])}var lo=new Map,Ah=new Map,_h=new Map,Ds=["chunked","firstChunkSize","firstChunkSizeNode","firstChunkSizeBrowser","chunkSize","chunkLimit"],ul=["jfif","xmp","icc","iptc","ihdr"],oo=["tiff",...ul],Be=["ifd0","ifd1","exif","gps","interop"],Ns=[...oo,...Be],Bs=["makerNote","userComment"],hl=["translateKeys","translateValues","reviveValues","multiSegment"],Us=[...hl,"sanitize","mergeOutput","silentErrors"],ol=class{get translate(){return this.translateKeys||this.translateValues||this.reviveValues}},es=class extends ol{get needed(){return this.enabled||this.deps.size>0}constructor(e,t,r,s){if(super(),de(this,"enabled",!1),de(this,"skip",new Set),de(this,"pick",new Set),de(this,"deps",new Set),de(this,"translateKeys",!1),de(this,"translateValues",!1),de(this,"reviveValues",!1),this.key=e,this.enabled=t,this.parse=this.enabled,this.applyInheritables(s),this.canBeFiltered=Be.includes(e),this.canBeFiltered&&(this.dict=lo.get(e)),r!==void 0)if(Array.isArray(r))this.parse=this.enabled=!0,this.canBeFiltered&&r.length>0&&this.translateTagSet(r,this.pick);else if(typeof r=="object"){if(this.enabled=!0,this.parse=r.parse!==!1,this.canBeFiltered){let{pick:n,skip:o}=r;n&&n.length>0&&this.translateTagSet(n,this.pick),o&&o.length>0&&this.translateTagSet(o,this.skip)}this.applyInheritables(r)}else r===!0||r===!1?this.parse=this.enabled=r:Ze(`Invalid options argument: ${r}`)}applyInheritables(e){let t,r;for(t of hl)r=e[t],r!==void 0&&(this[t]=r)}translateTagSet(e,t){if(this.dict){let r,s,{tagKeys:n,tagValues:o}=this.dict;for(r of e)typeof r=="string"?(s=o.indexOf(r),s===-1&&(s=n.indexOf(Number(r))),s!==-1&&t.add(Number(n[s]))):t.add(r)}else for(let r of e)t.add(r)}finalizeFilters(){!this.enabled&&this.deps.size>0?(this.enabled=!0,al(this.pick,this.deps)):this.enabled&&this.pick.size>0&&al(this.pick,this.deps)}},wt={jfif:!1,tiff:!0,xmp:!1,icc:!1,iptc:!1,ifd0:!0,ifd1:!1,exif:!0,gps:!0,interop:!1,ihdr:void 0,makerNote:!1,userComment:!1,multiSegment:!1,skip:[],pick:[],translateKeys:!0,translateValues:!0,reviveValues:!0,sanitize:!0,mergeOutput:!0,silentErrors:!0,chunked:!0,firstChunkSize:void 0,firstChunkSizeNode:512,firstChunkSizeBrowser:65536,chunkSize:65536,chunkLimit:5},Ig=new Map,is=class extends ol{static useCached(e){let t=Ig.get(e);return t!==void 0||(t=new this(e),Ig.set(e,t)),t}constructor(e){super(),e===!0?this.setupFromTrue():e===void 0?this.setupFromUndefined():Array.isArray(e)?this.setupFromArray(e):typeof e=="object"?this.setupFromObject(e):Ze(`Invalid options argument ${e}`),this.firstChunkSize===void 0&&(this.firstChunkSize=ro?this.firstChunkSizeBrowser:this.firstChunkSizeNode),this.mergeOutput&&(this.ifd1.enabled=!1),this.filterNestedSegmentTags(),this.traverseTiffDependencyTree(),this.checkLoadedPlugins()}setupFromUndefined(){let e;for(e of Ds)this[e]=wt[e];for(e of Us)this[e]=wt[e];for(e of Bs)this[e]=wt[e];for(e of Ns)this[e]=new es(e,wt[e],void 0,this)}setupFromTrue(){let e;for(e of Ds)this[e]=wt[e];for(e of Us)this[e]=wt[e];for(e of Bs)this[e]=!0;for(e of Ns)this[e]=new es(e,!0,void 0,this)}setupFromArray(e){let t;for(t of Ds)this[t]=wt[t];for(t of Us)this[t]=wt[t];for(t of Bs)this[t]=wt[t];for(t of Ns)this[t]=new es(t,!1,void 0,this);this.setupGlobalFilters(e,void 0,Be)}setupFromObject(e){let t;for(t of(Be.ifd0=Be.ifd0||Be.image,Be.ifd1=Be.ifd1||Be.thumbnail,Object.assign(this,e),Ds))this[t]=vh(e[t],wt[t]);for(t of Us)this[t]=vh(e[t],wt[t]);for(t of Bs)this[t]=vh(e[t],wt[t]);for(t of oo)this[t]=new es(t,wt[t],e[t],this);for(t of Be)this[t]=new es(t,wt[t],e[t],this.tiff);this.setupGlobalFilters(e.pick,e.skip,Be,Ns),e.tiff===!0?this.batchEnableWithBool(Be,!0):e.tiff===!1?this.batchEnableWithUserValue(Be,e):Array.isArray(e.tiff)?this.setupGlobalFilters(e.tiff,void 0,Be):typeof e.tiff=="object"&&this.setupGlobalFilters(e.tiff.pick,e.tiff.skip,Be)}batchEnableWithBool(e,t){for(let r of e)this[r].enabled=t}batchEnableWithUserValue(e,t){for(let r of e){let s=t[r];this[r].enabled=s!==!1&&s!==void 0}}setupGlobalFilters(e,t,r,s=r){if(e&&e.length){for(let o of s)this[o].enabled=!1;let n=Dg(e,r);for(let[o,a]of n)al(this[o].pick,a),this[o].enabled=!0}else if(t&&t.length){let n=Dg(t,r);for(let[o,a]of n)al(this[o].skip,a)}}filterNestedSegmentTags(){let{ifd0:e,exif:t,xmp:r,iptc:s,icc:n}=this;this.makerNote?t.deps.add(37500):t.skip.add(37500),this.userComment?t.deps.add(37510):t.skip.add(37510),r.enabled||e.skip.add(700),s.enabled||e.skip.add(33723),n.enabled||e.skip.add(34675)}traverseTiffDependencyTree(){let{ifd0:e,exif:t,gps:r,interop:s}=this;s.needed&&(t.deps.add(40965),e.deps.add(40965)),t.needed&&e.deps.add(34665),r.needed&&e.deps.add(34853),this.tiff.enabled=Be.some(n=>this[n].enabled===!0)||this.makerNote||this.userComment;for(let n of Be)this[n].finalizeFilters()}get onlyTiff(){return!ul.map(e=>this[e].enabled).some(e=>e===!0)&&this.tiff.enabled}checkLoadedPlugins(){for(let e of oo)this[e].enabled&&!Dt.has(e)&&bh("segment parser",e)}};function Dg(i,e){let t,r,s,n,o=[];for(s of e){for(n of(t=lo.get(s),r=[],t))(i.includes(n[0])||i.includes(n[1]))&&r.push(n[0]);r.length&&o.push([s,r])}return o}function vh(i,e){return i!==void 0?i:e!==void 0?e:void 0}function al(i,e){for(let t of e)i.add(t)}de(is,"default",wt);var zs=class{constructor(e){de(this,"parsers",{}),de(this,"output",{}),de(this,"errors",[]),de(this,"pushToErrors",t=>this.errors.push(t)),this.options=is.useCached(e)}async read(e){this.file=await function(t,r){return typeof t=="string"?Mg(t,r):ro&&!_E&&t instanceof HTMLImageElement?Mg(t.src,r):t instanceof Uint8Array||t instanceof ArrayBuffer||t instanceof DataView?new ts(t):ro&&t instanceof Blob?yh(t,r,"blob",no):void Ze("Invalid input argument")}(e,this.options)}setup(){if(this.fileParser)return;let{file:e}=this,t=e.getUint16(0);for(let[r,s]of cl)if(s.canHandle(e,t))return this.fileParser=new s(this.options,this.file,this.parsers),e[r]=!0;this.file.close&&this.file.close(),Ze("Unknown file format")}async parse(){let{output:e,errors:t}=this;return this.setup(),this.options.silentErrors?(await this.executeParsers().catch(this.pushToErrors),t.push(...this.fileParser.errors)):await this.executeParsers(),this.file.close&&this.file.close(),this.options.silentErrors&&t.length>0&&(e.errors=t),$g(r=e)?void 0:r;var r}async executeParsers(){let{output:e}=this;await this.fileParser.parse();let t=Object.values(this.parsers).map(async r=>{let s=await r.parse();r.assignToOutput(e,s)});this.options.silentErrors&&(t=t.map(r=>r.catch(this.pushToErrors))),await Promise.all(t)}async extractThumbnail(){this.setup();let{options:e,file:t}=this,r=Dt.get("tiff",e);var s;if(t.tiff?s={start:0,type:"tiff"}:t.jpeg&&(s=await this.fileParser.getOrFindSegment("tiff")),s===void 0)return;let n=await this.fileParser.ensureSegmentChunk(s),o=this.parsers.tiff=new r(n,e,t),a=await o.extractThumbnail();return t.close&&t.close(),a}};async function jg(i,e){let t=new zs(e);return await t.read(i),t.parse()}var FE=Object.freeze({__proto__:null,parse:jg,Exifr:zs,fileParsers:cl,segmentParsers:Dt,fileReaders:ao,tagKeys:lo,tagValues:Ah,tagRevivers:_h,createDictionary:qg,extendDictionary:Vg,fetchUrlAsArrayBuffer:nl,readBlobAsArrayBuffer:no,chunkedProps:Ds,otherSegments:ul,segments:oo,tiffBlocks:Be,segmentsAndBlocks:Ns,tiffExtractables:Bs,inheritables:hl,allFormatters:Us,Options:is}),Sr=class{static findPosition(e,t){let r=e.getUint16(t+2)+2,s=typeof this.headerLength=="function"?this.headerLength(e,t,r):this.headerLength,n=t+s,o=r-s;return{offset:t,length:r,headerLength:s,start:n,size:o,end:n+o}}static parse(e,t={}){return new this(e,new is({[this.type]:t}),e).parse()}normalizeInput(e){return e instanceof ts?e:new ts(e)}constructor(e,t={},r){de(this,"errors",[]),de(this,"raw",new Map),de(this,"handleError",s=>{if(!this.options.silentErrors)throw s;this.errors.push(s.message)}),this.chunk=this.normalizeInput(e),this.file=r,this.type=this.constructor.type,this.globalOptions=this.options=t,this.localOptions=t[this.type],this.canTranslate=this.localOptions&&this.localOptions.translate}translate(){this.canTranslate&&(this.translated=this.translateBlock(this.raw,this.type))}get output(){return this.translated?this.translated:this.raw?Object.fromEntries(this.raw):void 0}translateBlock(e,t){let r=_h.get(t),s=Ah.get(t),n=lo.get(t),o=this.options[t],a=o.reviveValues&&!!r,l=o.translateValues&&!!s,c=o.translateKeys&&!!n,d={};for(let[f,g]of e)a&&r.has(f)?g=r.get(f)(g):l&&s.has(f)&&(g=this.translateValue(g,s.get(f))),c&&n.has(f)&&(f=n.get(f)||f),d[f]=g;return d}translateValue(e,t){return t[e]||t.DEFAULT||e}assignToOutput(e,t){this.assignObjectToOutput(e,this.constructor.type,t)}assignObjectToOutput(e,t,r){if(this.globalOptions.mergeOutput)return Object.assign(e,r);e[t]?Object.assign(e[t],r):e[t]=r}};de(Sr,"headerLength",4),de(Sr,"type",void 0),de(Sr,"multiSegment",!1),de(Sr,"canHandle",()=>!1);function OE(i){return i===192||i===194||i===196||i===219||i===221||i===218||i===254}function RE(i){return i>=224&&i<=239}function LE(i,e,t){for(let[r,s]of Dt)if(s.canHandle(i,e,t))return r}var ll=class extends class{constructor(e,t,r){de(this,"errors",[]),de(this,"ensureSegmentChunk",async s=>{let n=s.start,o=s.size||65536;if(this.file.chunked)if(this.file.available(n,o))s.chunk=this.file.subarray(n,o);else try{s.chunk=await this.file.readChunk(n,o)}catch(a){Ze(`Couldn't read segment: ${JSON.stringify(s)}. ${a.message}`)}else this.file.byteLength>n+o?s.chunk=this.file.subarray(n,o):s.size===void 0?s.chunk=this.file.subarray(n):Ze("Segment unreachable: "+JSON.stringify(s));return s.chunk}),this.extendOptions&&this.extendOptions(e),this.options=e,this.file=t,this.parsers=r}injectSegment(e,t){this.options[e].enabled&&this.createParser(e,t)}createParser(e,t){let r=new(Dt.get(e))(t,this.options,this.file);return this.parsers[e]=r}createParsers(e){for(let t of e){let{type:r,chunk:s}=t,n=this.options[r];if(n&&n.enabled){let o=this.parsers[r];o&&o.append||o||this.createParser(r,s)}}}async readSegments(e){let t=e.map(this.ensureSegmentChunk);await Promise.all(t)}}{constructor(...e){super(...e),de(this,"appSegments",[]),de(this,"jpegSegments",[]),de(this,"unknownSegments",[])}static canHandle(e,t){return t===65496}async parse(){await this.findAppSegments(),await this.readSegments(this.appSegments),this.mergeMultiSegments(),this.createParsers(this.mergedAppSegments||this.appSegments)}setupSegmentFinderArgs(e){e===!0?(this.findAll=!0,this.wanted=new Set(Dt.keyList())):(e=e===void 0?Dt.keyList().filter(t=>this.options[t].enabled):e.filter(t=>this.options[t].enabled&&Dt.has(t)),this.findAll=!1,this.remaining=new Set(e),this.wanted=new Set(e)),this.unfinishedMultiSegment=!1}async findAppSegments(e=0,t){this.setupSegmentFinderArgs(t);let{file:r,findAll:s,wanted:n,remaining:o}=this;if(!s&&this.file.chunked&&(s=Array.from(n).some(a=>{let l=Dt.get(a),c=this.options[a];return l.multiSegment&&c.multiSegment}),s&&await this.file.readWhole()),e=this.findAppSegmentsInRange(e,r.byteLength),!this.options.onlyTiff&&r.chunked){let a=!1;for(;o.size>0&&!a&&(r.canReadNextChunk||this.unfinishedMultiSegment);){let{nextChunkOffset:l}=r,c=this.appSegments.some(d=>!this.file.available(d.offset||d.start,d.length||d.size));if(a=e>l&&!c?!await r.readNextChunk(e):!await r.readNextChunk(l),(e=this.findAppSegmentsInRange(e,r.byteLength))===void 0)return}}}findAppSegmentsInRange(e,t){t-=2;let r,s,n,o,a,l,{file:c,findAll:d,wanted:f,remaining:g,options:b}=this;for(;e<t;e++)if(c.getUint8(e)===255){if(r=c.getUint8(e+1),RE(r)){if(s=c.getUint16(e+2),n=LE(c,e,s),n&&f.has(n)&&(o=Dt.get(n),a=o.findPosition(c,e),l=b[n],a.type=n,this.appSegments.push(a),!d&&(o.multiSegment&&l.multiSegment?(this.unfinishedMultiSegment=a.chunkNumber<a.chunkCount,this.unfinishedMultiSegment||g.delete(n)):g.delete(n),g.size===0)))break;b.recordUnknownSegments&&(a=Sr.findPosition(c,e),a.marker=r,this.unknownSegments.push(a)),e+=s+1}else if(OE(r)){if(s=c.getUint16(e+2),r===218&&b.stopAfterSos!==!1)return;b.recordJpegSegments&&this.jpegSegments.push({offset:e,length:s,marker:r}),e+=s+1}}return e}mergeMultiSegments(){if(!this.appSegments.some(t=>t.multiSegment))return;let e=function(t,r){let s,n,o,a=new Map;for(let l=0;l<t.length;l++)s=t[l],n=s[r],a.has(n)?o=a.get(n):a.set(n,o=[]),o.push(s);return Array.from(a)}(this.appSegments,"type");this.mergedAppSegments=e.map(([t,r])=>{let s=Dt.get(t,this.options);return s.handleMultiSegments?{type:t,chunk:s.handleMultiSegments(r)}:r[0]})}getSegment(e){return this.appSegments.find(t=>t.type===e)}async getOrFindSegment(e){let t=this.getSegment(e);return t===void 0&&(await this.findAppSegments(0,[e]),t=this.getSegment(e)),t}};de(ll,"type","jpeg"),cl.set("jpeg",ll);var ME=[void 0,1,1,2,4,8,1,1,2,4,8,4,8,4],Eh=class extends Sr{parseHeader(){var e=this.chunk.getUint16();e===18761?this.le=!0:e===19789&&(this.le=!1),this.chunk.le=this.le,this.headerParsed=!0}parseTags(e,t,r=new Map){let{pick:s,skip:n}=this.options[t];s=new Set(s);let o=s.size>0,a=n.size===0,l=this.chunk.getUint16(e);e+=2;for(let c=0;c<l;c++){let d=this.chunk.getUint16(e);if(o){if(s.has(d)&&(r.set(d,this.parseTag(e,d,t)),s.delete(d),s.size===0))break}else!a&&n.has(d)||r.set(d,this.parseTag(e,d,t));e+=12}return r}parseTag(e,t,r){let{chunk:s}=this,n=s.getUint16(e+2),o=s.getUint32(e+4),a=ME[n];if(a*o<=4?e+=8:e=s.getUint32(e+8),(n<1||n>13)&&Ze(`Invalid TIFF value type. block: ${r.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e}`),e>s.byteLength&&Ze(`Invalid TIFF value offset. block: ${r.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e} is outside of chunk size ${s.byteLength}`),n===1)return s.getUint8Array(e,o);if(n===2)return(l=function(c){for(;c.endsWith("\0");)c=c.slice(0,-1);return c}(l=s.getString(e,o)).trim())===""?void 0:l;var l;if(n===7)return s.getUint8Array(e,o);if(o===1)return this.parseTagValue(n,e);{let c=new(function(f){switch(f){case 1:return Uint8Array;case 3:return Uint16Array;case 4:return Uint32Array;case 5:return Array;case 6:return Int8Array;case 8:return Int16Array;case 9:return Int32Array;case 10:return Array;case 11:return Float32Array;case 12:return Float64Array;default:return Array}}(n))(o),d=a;for(let f=0;f<o;f++)c[f]=this.parseTagValue(n,e),e+=d;return c}}parseTagValue(e,t){let{chunk:r}=this;switch(e){case 1:return r.getUint8(t);case 3:return r.getUint16(t);case 4:return r.getUint32(t);case 5:return r.getUint32(t)/r.getUint32(t+4);case 6:return r.getInt8(t);case 8:return r.getInt16(t);case 9:return r.getInt32(t);case 10:return r.getInt32(t)/r.getInt32(t+4);case 11:return r.getFloat(t);case 12:return r.getDouble(t);case 13:return r.getUint32(t);default:Ze(`Invalid tiff type ${e}`)}}},io=class extends Eh{static canHandle(e,t){return e.getUint8(t+1)===225&&e.getUint32(t+4)===1165519206&&e.getUint16(t+8)===0}async parse(){this.parseHeader();let{options:e}=this;return e.ifd0.enabled&&await this.parseIfd0Block(),e.exif.enabled&&await this.safeParse("parseExifBlock"),e.gps.enabled&&await this.safeParse("parseGpsBlock"),e.interop.enabled&&await this.safeParse("parseInteropBlock"),e.ifd1.enabled&&await this.safeParse("parseThumbnailBlock"),this.createOutput()}safeParse(e){let t=this[e]();return t.catch!==void 0&&(t=t.catch(this.handleError)),t}findIfd0Offset(){this.ifd0Offset===void 0&&(this.ifd0Offset=this.chunk.getUint32(4))}findIfd1Offset(){if(this.ifd1Offset===void 0){this.findIfd0Offset();let e=this.chunk.getUint16(this.ifd0Offset),t=this.ifd0Offset+2+12*e;this.ifd1Offset=this.chunk.getUint32(t)}}parseBlock(e,t){let r=new Map;return this[t]=r,this.parseTags(e,t,r),r}async parseIfd0Block(){if(this.ifd0)return;let{file:e}=this;this.findIfd0Offset(),this.ifd0Offset<8&&Ze("Malformed EXIF data"),!e.chunked&&this.ifd0Offset>e.byteLength&&Ze(`IFD0 offset points to outside of file.
|
|
97
|
-
this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&await e.ensureChunk(this.ifd0Offset,Rg(this.options));let t=this.parseBlock(this.ifd0Offset,"ifd0");return t.size!==0?(this.exifOffset=t.get(34665),this.interopOffset=t.get(40965),this.gpsOffset=t.get(34853),this.xmp=t.get(700),this.iptc=t.get(33723),this.icc=t.get(34675),this.options.sanitize&&(t.delete(34665),t.delete(40965),t.delete(34853),t.delete(700),t.delete(33723),t.delete(34675)),t):void 0}async parseExifBlock(){if(this.exif||(this.ifd0||await this.parseIfd0Block(),this.exifOffset===void 0))return;this.file.tiff&&await this.file.ensureChunk(this.exifOffset,Rg(this.options));let e=this.parseBlock(this.exifOffset,"exif");return this.interopOffset||(this.interopOffset=e.get(40965)),this.makerNote=e.get(37500),this.userComment=e.get(37510),this.options.sanitize&&(e.delete(40965),e.delete(37500),e.delete(37510)),this.unpack(e,41728),this.unpack(e,41729),e}unpack(e,t){let r=e.get(t);r&&r.length===1&&e.set(t,r[0])}async parseGpsBlock(){if(this.gps||(this.ifd0||await this.parseIfd0Block(),this.gpsOffset===void 0))return;let e=this.parseBlock(this.gpsOffset,"gps");return e&&e.has(2)&&e.has(4)&&(e.set("latitude",Ng(...e.get(2),e.get(1))),e.set("longitude",Ng(...e.get(4),e.get(3)))),e}async parseInteropBlock(){if(!this.interop&&(this.ifd0||await this.parseIfd0Block(),this.interopOffset!==void 0||this.exif||await this.parseExifBlock(),this.interopOffset!==void 0))return this.parseBlock(this.interopOffset,"interop")}async parseThumbnailBlock(e=!1){if(!this.ifd1&&!this.ifd1Parsed&&(!this.options.mergeOutput||e))return this.findIfd1Offset(),this.ifd1Offset>0&&(this.parseBlock(this.ifd1Offset,"ifd1"),this.ifd1Parsed=!0),this.ifd1}async extractThumbnail(){if(this.headerParsed||this.parseHeader(),this.ifd1Parsed||await this.parseThumbnailBlock(!0),this.ifd1===void 0)return;let e=this.ifd1.get(513),t=this.ifd1.get(514);return this.chunk.getUint8Array(e,t)}get image(){return this.ifd0}get thumbnail(){return this.ifd1}createOutput(){let e,t,r,s={};for(t of Be)if(e=this[t],!$g(e))if(r=this.canTranslate?this.translateBlock(e,t):Object.fromEntries(e),this.options.mergeOutput){if(t==="ifd1")continue;Object.assign(s,r)}else s[t]=r;return this.makerNote&&(s.makerNote=this.makerNote),this.userComment&&(s.userComment=this.userComment),s}assignToOutput(e,t){if(this.globalOptions.mergeOutput)Object.assign(e,t);else for(let[r,s]of Object.entries(t))this.assignObjectToOutput(e,r,s)}};function Ng(i,e,t,r){var s=i+e/60+t/3600;return r!=="S"&&r!=="W"||(s*=-1),s}de(io,"type","tiff"),de(io,"headerLength",10),Dt.set("tiff",io);var sF=Object.freeze({__proto__:null,default:FE,Exifr:zs,fileParsers:cl,segmentParsers:Dt,fileReaders:ao,tagKeys:lo,tagValues:Ah,tagRevivers:_h,createDictionary:qg,extendDictionary:Vg,fetchUrlAsArrayBuffer:nl,readBlobAsArrayBuffer:no,chunkedProps:Ds,otherSegments:ul,segments:oo,tiffBlocks:Be,segmentsAndBlocks:Ns,tiffExtractables:Bs,inheritables:hl,allFormatters:Us,Options:is,parse:jg}),Ch={ifd0:!1,ifd1:!1,exif:!1,gps:!1,interop:!1,sanitize:!1,reviveValues:!0,translateKeys:!1,translateValues:!1,mergeOutput:!1},nF=Object.assign({},Ch,{firstChunkSize:4e4,gps:[1,2,3,4]});var oF=Object.assign({},Ch,{tiff:!1,ifd1:!0,mergeOutput:!1});var IE=Object.assign({},Ch,{firstChunkSize:4e4,ifd0:[274]});async function DE(i){let e=new zs(IE);await e.read(i);let t=await e.parse();if(t&&t.ifd0)return t.ifd0[274]}var NE=Object.freeze({1:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:0,rad:0},2:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:0,rad:0},3:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:180,rad:180*Math.PI/180},4:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:180,rad:180*Math.PI/180},5:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:90,rad:90*Math.PI/180},6:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:90,rad:90*Math.PI/180},7:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:270,rad:270*Math.PI/180},8:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:270,rad:270*Math.PI/180}}),eo=!0,to=!0;if(typeof navigator=="object"){let i=navigator.userAgent;if(i.includes("iPad")||i.includes("iPhone")){let e=i.match(/OS (\d+)_(\d+)/);if(e){let[,t,r]=e;eo=Number(t)+.1*Number(r)<13.4,to=!1}}else if(i.includes("OS X 10")){let[,e]=i.match(/OS X 10[_.](\d+)/);eo=to=Number(e)<15}if(i.includes("Chrome/")){let[,e]=i.match(/Chrome\/(\d+)/);eo=to=Number(e)<81}else if(i.includes("Firefox/")){let[,e]=i.match(/Firefox\/(\d+)/);eo=to=Number(e)<77}}async function Wg(i){let e=await DE(i);return Object.assign({canvas:eo,css:to},NE[e])}var Th=class extends ts{constructor(...e){super(...e),de(this,"ranges",new xh),this.byteLength!==0&&this.ranges.add(0,this.byteLength)}_tryExtend(e,t,r){if(e===0&&this.byteLength===0&&r){let s=new DataView(r.buffer||r,r.byteOffset,r.byteLength);this._swapDataView(s)}else{let s=e+t;if(s>this.byteLength){let{dataView:n}=this._extend(s);this._swapDataView(n)}}}_extend(e){let t;t=Hg?zg.allocUnsafe(e):new Uint8Array(e);let r=new DataView(t.buffer,t.byteOffset,t.byteLength);return t.set(new Uint8Array(this.buffer,this.byteOffset,this.byteLength),0),{uintView:t,dataView:r}}subarray(e,t,r=!1){return t=t||this._lengthToEnd(e),r&&this._tryExtend(e,t),this.ranges.add(e,t),super.subarray(e,t)}set(e,t,r=!1){r&&this._tryExtend(t,e.byteLength,e);let s=super.set(e,t);return this.ranges.add(t,s.byteLength),s}async ensureChunk(e,t){this.chunked&&(this.ranges.available(e,t)||await this.readChunk(e,t))}available(e,t){return this.ranges.available(e,t)}},xh=class{constructor(){de(this,"list",[])}get length(){return this.list.length}add(e,t,r=0){let s=e+t,n=this.list.filter(o=>Bg(e,o.offset,s)||Bg(e,o.end,s));if(n.length>0){e=Math.min(e,...n.map(a=>a.offset)),s=Math.max(s,...n.map(a=>a.end)),t=s-e;let o=n.shift();o.offset=e,o.length=t,o.end=s,this.list=this.list.filter(a=>!n.includes(a))}else this.list.push({offset:e,length:t,end:s})}available(e,t){let r=e+t;return this.list.some(s=>s.offset<=e&&r<=s.end)}};function Bg(i,e,t){return i<=e&&e<=t}var kh=class extends Th{constructor(e,t){super(0),de(this,"chunksRead",0),this.input=e,this.options=t}async readWhole(){this.chunked=!1,await this.readChunk(this.nextChunkOffset)}async readChunked(){this.chunked=!0,await this.readChunk(0,this.options.firstChunkSize)}async readNextChunk(e=this.nextChunkOffset){if(this.fullyRead)return this.chunksRead++,!1;let t=this.options.chunkSize,r=await this.readChunk(e,t);return!!r&&r.byteLength===t}async readChunk(e,t){if(this.chunksRead++,(t=this.safeWrapAddress(e,t))!==0)return this._readChunk(e,t)}safeWrapAddress(e,t){return this.size!==void 0&&e+t>this.size?Math.max(0,this.size-e):t}get nextChunkOffset(){if(this.ranges.list.length!==0)return this.ranges.list[0].length}get canReadNextChunk(){return this.chunksRead<this.options.chunkLimit}get fullyRead(){return this.size!==void 0&&this.nextChunkOffset===this.size}read(){return this.options.chunked?this.readChunked():this.readWhole()}close(){}};ao.set("blob",class extends kh{async readWhole(){this.chunked=!1;let i=await no(this.input);this._swapArrayBuffer(i)}readChunked(){return this.chunked=!0,this.size=this.input.size,super.readChunked()}async _readChunk(i,e){let t=e?i+e:void 0,r=this.input.slice(i,t),s=await no(r);return this.set(s,i,!0)}});var Gg={strings:{generatingThumbnails:"Generating thumbnails..."}};var BE={version:"4.1.1"};function UE(i,e,t){try{i.getContext("2d").getImageData(0,0,1,1)}catch(r){if(r.code===18)return Promise.reject(new Error("cannot read image, probably an svg with external resources"))}return i.toBlob?new Promise(r=>{i.toBlob(r,e,t)}).then(r=>{if(r===null)throw new Error("cannot read image, probably an svg with external resources");return r}):Promise.resolve().then(()=>Fg(i.toDataURL(e,t),{})).then(r=>{if(r===null)throw new Error("could not extract blob, probably an old browser");return r})}function zE(i,e){let t=i.width,r=i.height;(e.deg===90||e.deg===270)&&(t=i.height,r=i.width);let s=document.createElement("canvas");s.width=t,s.height=r;let n=s.getContext("2d");return n.translate(t/2,r/2),e.canvas&&(n.rotate(e.rad),n.scale(e.scaleX,e.scaleY)),n.drawImage(i,-i.width/2,-i.height/2,i.width,i.height),s}function HE(i){let e=i.width/i.height,t=5e6,r=4096,s=Math.floor(Math.sqrt(t*e)),n=Math.floor(t/Math.sqrt(t*e));if(s>r&&(s=r,n=Math.round(s/e)),n>r&&(n=r,s=Math.round(e*n)),i.width>s){let o=document.createElement("canvas");return o.width=s,o.height=n,o.getContext("2d").drawImage(i,0,0,s,n),o}return i}var $E={thumbnailWidth:null,thumbnailHeight:null,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,lazy:!1},Hs=class extends pi{constructor(e,t){if(super(e,{...$E,...t}),this.onFileAdded=r=>{!r.preview&&r.data&&sl(r.type)&&!r.isRemote&&this.addToQueue(r.id)},this.onCancelRequest=r=>{let s=this.queue.indexOf(r.id);s!==-1&&this.queue.splice(s,1)},this.onFileRemoved=r=>{let s=this.queue.indexOf(r.id);s!==-1&&this.queue.splice(s,1),r.preview&&rl(r.preview)&&URL.revokeObjectURL(r.preview)},this.onRestored=()=>{this.uppy.getFiles().filter(s=>s.isRestored).forEach(s=>{(!s.preview||rl(s.preview))&&this.addToQueue(s.id)})},this.onAllFilesRemoved=()=>{this.queue=[]},this.waitUntilAllProcessed=r=>{r.forEach(n=>{let o=this.uppy.getFile(n);this.uppy.emit("preprocess-progress",o,{mode:"indeterminate",message:this.i18n("generatingThumbnails")})});let s=()=>{r.forEach(n=>{let o=this.uppy.getFile(n);this.uppy.emit("preprocess-complete",o)})};return new Promise(n=>{this.queueProcessing?this.uppy.once("thumbnail:all-generated",()=>{s(),n()}):(s(),n())})},this.type="modifier",this.id=this.opts.id||"ThumbnailGenerator",this.title="Thumbnail Generator",this.queue=[],this.queueProcessing=!1,this.defaultThumbnailDimension=200,this.thumbnailType=this.opts.thumbnailType,this.defaultLocale=Gg,this.i18nInit(),this.opts.lazy&&this.opts.waitForThumbnailsBeforeUpload)throw new Error("ThumbnailGenerator: The `lazy` and `waitForThumbnailsBeforeUpload` options are mutually exclusive. Please ensure at most one of them is set to `true`.")}createThumbnail(e,t,r){let s=URL.createObjectURL(e.data),n=new Promise((a,l)=>{let c=new Image;c.src=s,c.addEventListener("load",()=>{URL.revokeObjectURL(s),a(c)}),c.addEventListener("error",d=>{URL.revokeObjectURL(s),l(d.error||new Error("Could not create thumbnail"))})}),o=Wg(e.data).catch(()=>1);return Promise.all([n,o]).then(a=>{let[l,c]=a,d=this.getProportionalDimensions(l,t,r,c.deg),f=zE(l,c),g=this.resizeImage(f,d.width,d.height);return UE(g,this.thumbnailType,80)}).then(a=>URL.createObjectURL(a))}getProportionalDimensions(e,t,r,s){let n=e.width/e.height;return(s===90||s===270)&&(n=e.height/e.width),t!=null?{width:t,height:Math.round(t/n)}:r!=null?{width:Math.round(r*n),height:r}:{width:this.defaultThumbnailDimension,height:Math.round(this.defaultThumbnailDimension/n)}}resizeImage(e,t,r){let s=HE(e),n=Math.ceil(Math.log2(s.width/t));n<1&&(n=1);let o=t*2**(n-1),a=r*2**(n-1),l=2;for(;n--;){let c=document.createElement("canvas");c.width=o,c.height=a,c.getContext("2d").drawImage(s,0,0,o,a),s=c,o=Math.round(o/l),a=Math.round(a/l)}return s}setPreviewURL(e,t){this.uppy.setFileState(e,{preview:t})}addToQueue(e){this.queue.push(e),this.queueProcessing===!1&&this.processQueue()}processQueue(){if(this.queueProcessing=!0,this.queue.length>0){let e=this.uppy.getFile(this.queue.shift());return e?this.requestThumbnail(e).catch(()=>{}).then(()=>this.processQueue()):(this.uppy.log("[ThumbnailGenerator] file was removed before a thumbnail could be generated, but not removed from the queue. This is probably a bug","error"),Promise.resolve())}return this.queueProcessing=!1,this.uppy.log("[ThumbnailGenerator] Emptied thumbnail queue"),this.uppy.emit("thumbnail:all-generated"),Promise.resolve()}requestThumbnail(e){return sl(e.type)&&!e.isRemote?this.createThumbnail(e,this.opts.thumbnailWidth,this.opts.thumbnailHeight).then(t=>{this.setPreviewURL(e.id,t),this.uppy.log(`[ThumbnailGenerator] Generated thumbnail for ${e.id}`),this.uppy.emit("thumbnail:generated",this.uppy.getFile(e.id),t)}).catch(t=>{this.uppy.log(`[ThumbnailGenerator] Failed thumbnail for ${e.id}:`,"warning"),this.uppy.log(t,"warning"),this.uppy.emit("thumbnail:error",this.uppy.getFile(e.id),t)}):Promise.resolve()}install(){this.uppy.on("file-removed",this.onFileRemoved),this.uppy.on("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("thumbnail:cancel",this.onCancelRequest)):(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("file-added",this.onFileAdded),this.uppy.on("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.addPreProcessor(this.waitUntilAllProcessed)}uninstall(){this.uppy.off("file-removed",this.onFileRemoved),this.uppy.off("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("thumbnail:cancel",this.onCancelRequest)):(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("file-added",this.onFileAdded),this.uppy.off("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.removePreProcessor(this.waitUntilAllProcessed)}};Hs.VERSION=BE.version;function qE(i){if(typeof i=="string"){let e=document.querySelectorAll(i);return e.length===0?null:Array.from(e)}return typeof i=="object"&&Kn(i)?[i]:null}var Ph=qE;var Er=Array.from;function dl(i,e,t,r){let{onSuccess:s}=r;i.readEntries(n=>{let o=[...e,...n];n.length?queueMicrotask(()=>{dl(i,o,t,{onSuccess:s})}):s(o)},n=>{t(n),s(e)})}function Kg(i,e){return i==null?i:{kind:i.isFile?"file":i.isDirectory?"directory":void 0,name:i.name,getFile(){return new Promise((t,r)=>i.file(t,r))},async*values(){let t=i.createReader();yield*await new Promise(s=>{dl(t,[],e,{onSuccess:n=>s(n.map(o=>Kg(o,e)))})})},isSameEntry:void 0}}function Xg(i,e,t){try{return t===void 0&&(t=void 0),async function*(){let r=()=>`${e}/${i.name}`;if(i.kind==="file"){let s=await i.getFile();s!=null?(s.relativePath=e?r():null,yield s):t!=null&&(yield t)}else if(i.kind==="directory")for await(let s of i.values())yield*Xg(s,e?r():i.name);else t!=null&&(yield t)}()}catch(r){return Promise.reject(r)}}async function*Fh(i,e){let t=await Promise.all(Array.from(i.items,async r=>{let s;return s??(s=Kg(typeof r.getAsEntry=="function"?r.getAsEntry():r.webkitGetAsEntry(),e)),{fileSystemHandle:s,lastResortFile:r.getAsFile()}}));for(let{lastResortFile:r,fileSystemHandle:s}of t)if(s!=null)try{yield*Xg(s,"",r)}catch(n){r!=null?yield r:e(n)}else r!=null&&(yield r)}function Oh(i){let e=Er(i.files);return Promise.resolve(e)}async function Rh(i,e){var t;let r=(t=e?.logDropError)!=null?t:Function.prototype;try{let s=[];for await(let n of Fh(i,r))s.push(n);return s}catch{return Oh(i)}}var pv=Te(yt(),1);function co(i){return{...i,type:i.mimeType,extension:i.name?Gr(i.name).extension:null}}function VE(){return u("svg",{width:"26",height:"26",viewBox:"0 0 26 26",xmlns:"http://www.w3.org/2000/svg"},u("g",{fill:"none","fill-rule":"evenodd"},u("circle",{fill:"#FFF",cx:"13",cy:"13",r:"13"}),u("path",{d:"M21.64 13.205c0-.639-.057-1.252-.164-1.841H13v3.481h4.844a4.14 4.14 0 01-1.796 2.716v2.259h2.908c1.702-1.567 2.684-3.875 2.684-6.615z",fill:"#4285F4","fill-rule":"nonzero"}),u("path",{d:"M13 22c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H4.957v2.332A8.997 8.997 0 0013 22z",fill:"#34A853","fill-rule":"nonzero"}),u("path",{d:"M7.964 14.71A5.41 5.41 0 017.682 13c0-.593.102-1.17.282-1.71V8.958H4.957A8.996 8.996 0 004 13c0 1.452.348 2.827.957 4.042l3.007-2.332z",fill:"#FBBC05","fill-rule":"nonzero"}),u("path",{d:"M13 7.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C17.463 4.891 15.426 4 13 4a8.997 8.997 0 00-8.043 4.958l3.007 2.332C8.672 9.163 10.656 7.58 13 7.58z",fill:"#EA4335","fill-rule":"nonzero"}),u("path",{d:"M4 4h18v18H4z"})))}function jE(i){let{pluginName:e,i18n:t,onAuth:r}=i,s=e==="Google Drive",n=yr(o=>{o.preventDefault(),r()},[r]);return u("form",{onSubmit:n},s?u("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn uppy-Provider-btn-google","data-uppy-super-focusable":!0},u(VE,null),t("signInWithGoogle")):u("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn","data-uppy-super-focusable":!0},t("authenticateWith",{pluginName:e})))}var WE=i=>{let{pluginName:e,i18n:t,onAuth:r}=i;return u(jE,{pluginName:e,i18n:t,onAuth:r})};function pl(i){let{loading:e,pluginName:t,pluginIcon:r,i18n:s,handleAuth:n,renderForm:o=WE}=i;return u("div",{className:"uppy-Provider-auth"},u("div",{className:"uppy-Provider-authIcon"},r()),u("div",{className:"uppy-Provider-authTitle"},s("authenticateWithTitle",{pluginName:t})),o({pluginName:t,i18n:s,loading:e,onAuth:n}))}var Yg=Te(yt(),1);function Lh(i){let{i18n:e,logout:t,username:r}=i;return u(it,null,r&&u("span",{className:"uppy-ProviderBrowser-user",key:"username"},r),u("button",{type:"button",onClick:t,className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowser-userLogout",key:"logout"},e("logOut")))}function Mh(i){let{openFolder:e,title:t,breadcrumbsIcon:r,breadcrumbs:s,i18n:n}=i;return u("div",{className:"uppy-Provider-breadcrumbs"},u("div",{className:"uppy-Provider-breadcrumbsIcon"},r),s.map((o,a)=>{var l;return u(it,null,u("button",{key:o.id,type:"button",className:"uppy-u-reset uppy-c-btn",onClick:()=>e(o.id)},o.type==="root"?t:(l=o.data.name)!=null?l:n("unnamed")),s.length===a+1?"":" / ")}))}function Ih(i){return u("div",{className:"uppy-ProviderBrowser-header"},u("div",{className:(0,Yg.default)("uppy-ProviderBrowser-headerBar",!i.showBreadcrumbs&&"uppy-ProviderBrowser-headerBar--simple")},i.showBreadcrumbs&&u(Mh,{openFolder:i.openFolder,breadcrumbs:i.breadcrumbs,breadcrumbsIcon:i.pluginIcon&&i.pluginIcon(),title:i.title,i18n:i.i18n}),u(Lh,{logout:i.logout,username:i.username,i18n:i.i18n})))}function Dh(){return Dh=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},Dh.apply(null,arguments)}var GE={position:"relative",width:"100%",minHeight:"100%"},KE={position:"absolute",top:0,left:0,width:"100%",overflow:"visible"},Nh=class extends ke{constructor(e){super(e),this.handleScroll=()=>{this.setState({offset:this.base.scrollTop})},this.handleResize=()=>{this.resize()},this.focusElement=null,this.state={offset:0,height:0}}componentDidMount(){this.resize(),window.addEventListener("resize",this.handleResize)}componentWillUpdate(){this.base.contains(document.activeElement)&&(this.focusElement=document.activeElement)}componentDidUpdate(){this.focusElement&&this.focusElement.parentNode&&document.activeElement!==this.focusElement&&this.focusElement.focus(),this.focusElement=null,this.resize()}componentWillUnmount(){window.removeEventListener("resize",this.handleResize)}resize(){let{height:e}=this.state;e!==this.base.offsetHeight&&this.setState({height:this.base.offsetHeight})}render(e){let{data:t,rowHeight:r,renderRow:s,overscanCount:n=10,...o}=e,{offset:a,height:l}=this.state,c=Math.floor(a/r),d=Math.floor(l/r);n&&(c=Math.max(0,c-c%n),d+=n);let f=c+d+4,g=t.slice(c,f),b={...GE,height:t.length*r},w={...KE,top:c*r};return u("div",Dh({onScroll:this.handleScroll},o),u("div",{role:"presentation",style:b},u("div",{role:"presentation",style:w},g.map(s))))}},fl=Nh;var Zg=Te(yt(),1);function XE(){return u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:11,height:14.5,viewBox:"0 0 44 58"},u("path",{d:"M27.437.517a1 1 0 0 0-.094.03H4.25C2.037.548.217 2.368.217 4.58v48.405c0 2.212 1.82 4.03 4.03 4.03H39.03c2.21 0 4.03-1.818 4.03-4.03V15.61a1 1 0 0 0-.03-.28 1 1 0 0 0 0-.093 1 1 0 0 0-.03-.032 1 1 0 0 0 0-.03 1 1 0 0 0-.032-.063 1 1 0 0 0-.03-.063 1 1 0 0 0-.032 0 1 1 0 0 0-.03-.063 1 1 0 0 0-.032-.03 1 1 0 0 0-.03-.063 1 1 0 0 0-.063-.062l-14.593-14a1 1 0 0 0-.062-.062A1 1 0 0 0 28 .708a1 1 0 0 0-.374-.157 1 1 0 0 0-.156 0 1 1 0 0 0-.03-.03l-.003-.003zM4.25 2.547h22.218v9.97c0 2.21 1.82 4.03 4.03 4.03h10.564v36.438a2.02 2.02 0 0 1-2.032 2.032H4.25c-1.13 0-2.032-.9-2.032-2.032V4.58c0-1.13.902-2.032 2.03-2.032zm24.218 1.345l10.375 9.937.75.718H30.5c-1.13 0-2.032-.9-2.032-2.03V3.89z"}))}function YE(){return u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",style:{minWidth:16,marginRight:3},viewBox:"0 0 276.157 276.157"},u("path",{d:"M273.08 101.378c-3.3-4.65-8.86-7.32-15.254-7.32h-24.34V67.59c0-10.2-8.3-18.5-18.5-18.5h-85.322c-3.63 0-9.295-2.875-11.436-5.805l-6.386-8.735c-4.982-6.814-15.104-11.954-23.546-11.954H58.73c-9.292 0-18.638 6.608-21.737 15.372l-2.033 5.752c-.958 2.71-4.72 5.37-7.596 5.37H18.5C8.3 49.09 0 57.39 0 67.59v167.07c0 .886.16 1.73.443 2.52.152 3.306 1.18 6.424 3.053 9.064 3.3 4.652 8.86 7.32 15.255 7.32h188.487c11.395 0 23.27-8.425 27.035-19.18l40.677-116.188c2.11-6.035 1.43-12.164-1.87-16.816zM18.5 64.088h8.864c9.295 0 18.64-6.607 21.738-15.37l2.032-5.75c.96-2.712 4.722-5.373 7.597-5.373h29.565c3.63 0 9.295 2.876 11.437 5.806l6.386 8.735c4.982 6.815 15.104 11.954 23.546 11.954h85.322c1.898 0 3.5 1.602 3.5 3.5v26.47H69.34c-11.395 0-23.27 8.423-27.035 19.178L15 191.23V67.59c0-1.898 1.603-3.5 3.5-3.5zm242.29 49.15l-40.676 116.188c-1.674 4.78-7.812 9.135-12.877 9.135H18.75c-1.447 0-2.576-.372-3.02-.997-.442-.625-.422-1.814.057-3.18l40.677-116.19c1.674-4.78 7.812-9.134 12.877-9.134h188.487c1.448 0 2.577.372 3.02.997.443.625.423 1.814-.056 3.18z"}))}function ZE(){return u("svg",{"aria-hidden":"true",focusable:"false",style:{width:16,marginRight:4},viewBox:"0 0 58 58"},u("path",{d:"M36.537 28.156l-11-7a1.005 1.005 0 0 0-1.02-.033C24.2 21.3 24 21.635 24 22v14a1 1 0 0 0 1.537.844l11-7a1.002 1.002 0 0 0 0-1.688zM26 34.18V23.82L34.137 29 26 34.18z"}),u("path",{d:"M57 6H1a1 1 0 0 0-1 1v44a1 1 0 0 0 1 1h56a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1zM10 28H2v-9h8v9zm-8 2h8v9H2v-9zm10 10V8h34v42H12V40zm44-12h-8v-9h8v9zm-8 2h8v9h-8v-9zm8-22v9h-8V8h8zM2 8h8v9H2V8zm0 42v-9h8v9H2zm54 0h-8v-9h8v9z"}))}function $s(i){let{itemIconString:e,alt:t=void 0}=i;if(e===null)return null;switch(e){case"file":return u(XE,null);case"folder":return u(YE,null);case"video":return u(ZE,null);default:return u("img",{src:e,alt:t,referrerPolicy:"no-referrer",loading:"lazy",width:16,height:16})}}function QE(i){var e,t;let{file:r,toggleCheckbox:s,className:n,isDisabled:o,restrictionError:a,showTitles:l,children:c=null,i18n:d}=i;return u("li",{className:n,title:o&&a?a:void 0},u("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox uppy-ProviderBrowserItem-checkbox--grid",onChange:s,name:"listitem",id:r.id,checked:r.status==="checked",disabled:o,"data-uppy-super-focusable":!0}),u("label",{htmlFor:r.id,"aria-label":(e=r.data.name)!=null?e:d("unnamed"),className:"uppy-u-reset uppy-ProviderBrowserItem-inner"},u($s,{itemIconString:r.data.thumbnail||r.data.icon}),l&&((t=r.data.name)!=null?t:d("unnamed")),c))}var Bh=QE;function Uh(i){var e,t,r;let{file:s,openFolder:n,className:o,isDisabled:a,restrictionError:l,toggleCheckbox:c,showTitles:d,i18n:f}=i;return u("li",{className:o,title:s.status!=="checked"&&l?l:void 0},u("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox",onChange:c,name:"listitem",id:s.id,checked:s.status==="checked","aria-label":s.data.isFolder?f("allFilesFromFolderNamed",{name:(e=s.data.name)!=null?e:f("unnamed")}):null,disabled:a,"data-uppy-super-focusable":!0}),s.data.isFolder?u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowserItem-inner",onClick:()=>n(s.id),"aria-label":f("openFolderNamed",{name:(t=s.data.name)!=null?t:f("unnamed")})},u("div",{className:"uppy-ProviderBrowserItem-iconWrap"},u($s,{itemIconString:s.data.icon})),d&&s.data.name?u("span",null,s.data.name):f("unnamed")):u("label",{htmlFor:s.id,className:"uppy-u-reset uppy-ProviderBrowserItem-inner"},u("div",{className:"uppy-ProviderBrowserItem-iconWrap"},u($s,{itemIconString:s.data.icon})),d&&((r=s.data.name)!=null?r:f("unnamed"))))}function zh(i){let{viewType:e,toggleCheckbox:t,showTitles:r,i18n:s,openFolder:n,file:o,utmSource:a}=i,l=o.type==="folder"?null:o.restrictionError,c=!!l&&o.status!=="checked",d={file:o,openFolder:n,toggleCheckbox:t,utmSource:a,i18n:s,viewType:e,showTitles:r,className:(0,Zg.default)("uppy-ProviderBrowserItem",{"uppy-ProviderBrowserItem--disabled":c},{"uppy-ProviderBrowserItem--noPreview":o.data.icon==="video"},{"uppy-ProviderBrowserItem--is-checked":o.status==="checked"},{"uppy-ProviderBrowserItem--is-partial":o.status==="partial"}),isDisabled:c,restrictionError:l};switch(e){case"grid":return u(Bh,d);case"list":return u(Uh,d);case"unsplash":return u(Bh,d,u("a",{href:`${o.data.author.url}?utm_source=${a}&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",className:"uppy-ProviderBrowserItem-author",tabIndex:-1},o.data.author.name));default:throw new Error(`There is no such type ${e}`)}}function JE(i){let{displayedPartialTree:e,viewType:t,toggleCheckbox:r,handleScroll:s,showTitles:n,i18n:o,isLoading:a,openFolder:l,noResultsLabel:c,virtualList:d,utmSource:f}=i,[g,b]=Xt(!1);if(di(()=>{let P=C=>{C.key==="Shift"&&b(!1)},R=C=>{C.key==="Shift"&&b(!0)};return document.addEventListener("keyup",P),document.addEventListener("keydown",R),()=>{document.removeEventListener("keyup",P),document.removeEventListener("keydown",R)}},[]),a)return u("div",{className:"uppy-Provider-loading"},typeof a=="string"?a:o("loading"));if(e.length===0)return u("div",{className:"uppy-Provider-empty"},c);let w=P=>u(zh,{viewType:t,toggleCheckbox:R=>{var C;R.stopPropagation(),R.preventDefault(),(C=document.getSelection())==null||C.removeAllRanges(),r(P,g)},showTitles:n,i18n:o,openFolder:l,file:P,utmSource:f});return d?u("div",{className:"uppy-ProviderBrowser-body"},u("ul",{className:"uppy-ProviderBrowser-list"},u(fl,{data:e,renderRow:w,rowHeight:31}))):u("div",{className:"uppy-ProviderBrowser-body"},u("ul",{className:"uppy-ProviderBrowser-list",onScroll:s,role:"listbox",tabIndex:-1},e.map(w)))}var ml=JE;var eT=(i,e,t,r,s)=>{let n=e.filter(b=>b.isFolder===!0),o=e.filter(b=>b.isFolder===!1),a=t.type==="folder"&&t.status==="checked",l=n.map(b=>({type:"folder",id:b.requestPath,cached:!1,nextPagePath:null,status:a?"checked":"unchecked",parentId:t.id,data:b})),c=o.map(b=>{let w=s(b);return{type:"file",id:b.requestPath,restrictionError:w,status:a&&!w?"checked":"unchecked",parentId:t.id,data:b}}),d={...t,cached:!0,nextPagePath:r};return[...i.map(b=>b.id===d.id?d:b),...l,...c]},Qg=eT;var tT=(i,e,t,r,s)=>{let n=i.find(w=>w.id===e),o=t.filter(w=>w.isFolder===!0),a=t.filter(w=>w.isFolder===!1),l={...n,nextPagePath:r},c=i.map(w=>w.id===l.id?l:w),d=l.type==="folder"&&l.status==="checked",f=o.map(w=>({type:"folder",id:w.requestPath,cached:!1,nextPagePath:null,status:d?"checked":"unchecked",parentId:l.id,data:w})),g=a.map(w=>{let P=s(w);return{type:"file",id:w.requestPath,restrictionError:P,status:d&&!P?"checked":"unchecked",parentId:l.id,data:w}});return[...c,...f,...g]},Jg=tT;var iT=i=>i.map(e=>({...e})),gl=iT;var Hh=(i,e,t)=>{i.filter(s=>s.type!=="root"&&s.parentId===e).forEach(s=>{s.status=t&&!(s.type==="file"&&s.restrictionError)?"checked":"unchecked",Hh(i,s.id,t)})},$h=(i,e)=>{let t=i.find(o=>o.id===e);if(t.type==="root")return;let r=i.filter(o=>o.type!=="root"&&o.parentId===t.id&&!(o.type==="file"&&o.restrictionError)),s=r.every(o=>o.status==="checked"),n=r.every(o=>o.status==="unchecked");s?t.status="checked":n?t.status="unchecked":t.status="partial",$h(i,t.parentId)},rT=(i,e)=>{let t=gl(i);if(e.length>=2){let r=t.filter(s=>s.type!=="root"&&e.includes(s.id));r.forEach(s=>{s.type==="file"?s.status=s.restrictionError?"unchecked":"checked":s.status="checked"}),r.forEach(s=>{Hh(t,s.id,!0)}),$h(t,r[0].parentId)}else{let r=t.find(s=>s.id===e[0]);r.status=r.status==="checked"?"unchecked":"checked",Hh(t,r.id,r.status==="checked"),$h(t,r.parentId)}return t},ev=rT;var Vh=Te(iv(),1);var ho=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},jh=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}},rv=i=>globalThis.DOMException===void 0?new jh(i):new DOMException(i),sv=i=>{let e=i.reason===void 0?rv("This operation was aborted."):i.reason;return e instanceof Error?e:rv(e)};function Wh(i,e){let{milliseconds:t,fallback:r,message:s,customTimers:n={setTimeout,clearTimeout}}=e,o,a,c=new Promise((d,f)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(e.signal){let{signal:b}=e;b.aborted&&f(sv(b)),a=()=>{f(sv(b))},b.addEventListener("abort",a,{once:!0})}if(t===Number.POSITIVE_INFINITY){i.then(d,f);return}let g=new ho;o=n.setTimeout.call(void 0,()=>{if(r){try{d(r())}catch(b){f(b)}return}typeof i.cancel=="function"&&i.cancel(),s===!1?d():s instanceof Error?f(s):(g.message=s??`Promise timed out after ${t} milliseconds`,f(g))},t),(async()=>{try{d(await i)}catch(b){f(b)}})()}).finally(()=>{c.clear(),a&&e.signal&&e.signal.removeEventListener("abort",a)});return c.clear=()=>{n.clearTimeout.call(void 0,o),o=void 0},c}function Gh(i,e,t){let r=0,s=i.length;for(;s>0;){let n=Math.trunc(s/2),o=r+n;t(i[o],e)<=0?(r=++o,s-=n+1):s=n}return r}var po=class{#e=[];enqueue(e,t){t={priority:0,...t};let r={priority:t.priority,id:t.id,run:e};if(this.size===0||this.#e[this.size-1].priority>=t.priority){this.#e.push(r);return}let s=Gh(this.#e,r,(n,o)=>o.priority-n.priority);this.#e.splice(s,0,r)}setPriority(e,t){let r=this.#e.findIndex(n=>n.id===e);if(r===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);let[s]=this.#e.splice(r,1);this.enqueue(s.run,{priority:t,id:e})}dequeue(){return this.#e.shift()?.run}filter(e){return this.#e.filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return this.#e.length}};var fo=class extends Vh.default{#e;#t;#i=0;#n;#o;#a=0;#r;#u;#s;#p;#l=0;#h;#c;#g;#v=1n;timeout;constructor(e){if(super(),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:po,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#e=e.carryoverConcurrencyCount,this.#t=e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,this.#n=e.intervalCap,this.#o=e.interval,this.#s=new e.queueClass,this.#p=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#g=e.throwOnTimeout===!0,this.#c=e.autoStart===!1}get#d(){return this.#t||this.#i<this.#n}get#b(){return this.#l<this.#h}#f(){this.#l--,this.#m(),this.emit("next")}#y(){this.#x(),this.#T(),this.#u=void 0}get#w(){let e=Date.now();if(this.#r===void 0){let t=this.#a-e;if(t<0)this.#i=this.#e?this.#l:0;else return this.#u===void 0&&(this.#u=setTimeout(()=>{this.#y()},t)),!0}return!1}#m(){if(this.#s.size===0)return this.#r&&clearInterval(this.#r),this.#r=void 0,this.emit("empty"),this.#l===0&&this.emit("idle"),!1;if(!this.#c){let e=!this.#w;if(this.#d&&this.#b){let t=this.#s.dequeue();return t?(this.emit("active"),t(),e&&this.#T(),!0):!1}}return!1}#T(){this.#t||this.#r!==void 0||(this.#r=setInterval(()=>{this.#x()},this.#o),this.#a=Date.now()+this.#o)}#x(){this.#i===0&&this.#l===0&&this.#r&&(clearInterval(this.#r),this.#r=void 0),this.#i=this.#e?this.#l:0,this.#S()}#S(){for(;this.#m(););}get concurrency(){return this.#h}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#h=e,this.#S()}async#k(e){return new Promise((t,r)=>{e.addEventListener("abort",()=>{r(e.reason)},{once:!0})})}setPriority(e,t){this.#s.setPriority(e,t)}async add(e,t={}){return t.id??=(this.#v++).toString(),t={timeout:this.timeout,throwOnTimeout:this.#g,...t},new Promise((r,s)=>{this.#s.enqueue(async()=>{this.#l++,this.#i++;try{t.signal?.throwIfAborted();let n=e({signal:t.signal});t.timeout&&(n=Wh(Promise.resolve(n),{milliseconds:t.timeout})),t.signal&&(n=Promise.race([n,this.#k(t.signal)]));let o=await n;r(o),this.emit("completed",o)}catch(n){if(n instanceof ho&&!t.throwOnTimeout){r();return}s(n),this.emit("error",n)}finally{this.#f()}},t),this.emit("add"),this.#m()})}async addAll(e,t){return Promise.all(e.map(async r=>this.add(r,t)))}start(){return this.#c?(this.#c=!1,this.#S(),this):this}pause(){this.#c=!0}clear(){this.#s=new this.#p}async onEmpty(){this.#s.size!==0&&await this.#E("empty")}async onSizeLessThan(e){this.#s.size<e||await this.#E("next",()=>this.#s.size<e)}async onIdle(){this.#l===0&&this.#s.size===0||await this.#E("idle")}async#E(e,t){return new Promise(r=>{let s=()=>{t&&!t()||(this.off(e,s),r())};this.on(e,s)})}get size(){return this.#s.size}sizeBy(e){return this.#s.filter(e).length}get pending(){return this.#l}get isPaused(){return this.#c}};var nv=async(i,e,t,r,s)=>{let n=[],o=t.cached?t.nextPagePath:t.id;for(;o;){let f=await r(o);n=n.concat(f.items),o=f.nextPagePath}let a=n.filter(f=>f.isFolder===!0),l=n.filter(f=>f.isFolder===!1),c=a.map(f=>({type:"folder",id:f.requestPath,cached:!1,nextPagePath:null,status:"checked",parentId:t.id,data:f})),d=l.map(f=>{let g=s(f);return{type:"file",id:f.requestPath,restrictionError:g,status:g?"unchecked":"checked",parentId:t.id,data:f}});t.cached=!0,t.nextPagePath=null,e.push(...d,...c),c.forEach(async f=>{i.add(()=>nv(i,e,f,r,s))})},oT=async(i,e,t,r)=>{let s=new fo({concurrency:6}),n=gl(i);return n.filter(a=>a.type==="folder"&&a.status==="checked"&&(a.cached===!1||a.nextPagePath)).forEach(a=>{s.add(()=>nv(s,n,a,e,t))}),s.on("completed",()=>{let a=n.filter(l=>l.type==="file"&&l.status==="checked").length;r(a)}),await s.onIdle(),n},ov=oT;var rs={afterOpenFolder:Qg,afterScrollFolder:Jg,afterToggleCheckbox:ev,afterFill:ov};var aT=i=>{let{scrollHeight:e,scrollTop:t,offsetHeight:r}=i.target;return e-(t+r)<50},bl=aT;var lT=i=>e=>{if(!e.isAuthError){if(e.name==="AbortError"){i.log("Aborting request","warning");return}i.log(e,"error"),e.name==="UserFacingApiError"&&i.info({message:i.i18n("companionError"),details:i.i18n(e.message)},"warning",5e3)}},Xi=lT;var cT=(i,e,t,r)=>{let s=e.findIndex(n=>n.id===r);if(s!==-1&&t){let n=e.findIndex(a=>a.id===i);return e.slice(Math.min(s,n),Math.max(s,n)+1).map(a=>a.id)}return[i]},yl=cT;function uT(i){let{searchString:e,setSearchString:t,submitSearchString:r,wrapperClassName:s,inputClassName:n,inputLabel:o,clearSearchLabel:a="",showButton:l=!1,buttonLabel:c="",buttonCSSClassName:d=""}=i,f=w=>{t(w.target.value)},g=yr(w=>{w.preventDefault(),r()},[r]),[b]=Xt(()=>{let w=document.createElement("form");return w.setAttribute("tabindex","-1"),w.id=gr(),w});return di(()=>(document.body.appendChild(b),b.addEventListener("submit",g),()=>{b.removeEventListener("submit",g),document.body.removeChild(b)}),[b,g]),u("section",{className:s},u("input",{className:`uppy-u-reset ${n}`,type:"search","aria-label":o,placeholder:o,value:e,onInput:f,form:b.id,"data-uppy-super-focusable":!0}),!l&&u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-ProviderBrowser-searchFilterIcon",width:"12",height:"12",viewBox:"0 0 12 12"},u("path",{d:"M8.638 7.99l3.172 3.172a.492.492 0 1 1-.697.697L7.91 8.656a4.977 4.977 0 0 1-2.983.983C2.206 9.639 0 7.481 0 4.819 0 2.158 2.206 0 4.927 0c2.721 0 4.927 2.158 4.927 4.82a4.74 4.74 0 0 1-1.216 3.17zm-3.71.685c2.176 0 3.94-1.726 3.94-3.856 0-2.129-1.764-3.855-3.94-3.855C2.75.964.984 2.69.984 4.819c0 2.13 1.765 3.856 3.942 3.856z"})),!l&&e&&u("button",{className:"uppy-u-reset uppy-ProviderBrowser-searchFilterReset",type:"button","aria-label":a,title:a,onClick:()=>t("")},u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",viewBox:"0 0 19 19"},u("path",{d:"M17.318 17.232L9.94 9.854 9.586 9.5l-.354.354-7.378 7.378h.707l-.62-.62v.706L9.318 9.94l.354-.354-.354-.354L1.94 1.854v.707l.62-.62h-.706l7.378 7.378.354.354.354-.354 7.378-7.378h-.707l.622.62v-.706L9.854 9.232l-.354.354.354.354 7.378 7.378.708-.707-7.38-7.378v.708l7.38-7.38.353-.353-.353-.353-.622-.622-.353-.353-.354.352-7.378 7.38h.708L2.56 1.23 2.208.88l-.353.353-.622.62-.353.355.352.353 7.38 7.38v-.708l-7.38 7.38-.353.353.352.353.622.622.353.353.354-.353 7.38-7.38h-.708l7.38 7.38z"}))),l&&u("button",{className:`uppy-u-reset uppy-c-btn uppy-c-btn-primary ${d}`,type:"submit",form:b.id},c))}var qs=uT;var av=Te(yt(),1);var hT=i=>i.filter(t=>t.type==="file"&&t.status==="checked"?!0:t.type==="folder"&&t.status==="checked"?!i.some(s=>s.type!=="root"&&s.parentId===t.id):!1).length,wl=hT;function mo(i){let{cancelSelection:e,donePicking:t,i18n:r,partialTree:s,validateAggregateRestrictions:n}=i,o=br(()=>n(s),[s,n]),a=br(()=>wl(s),[s]);return a===0?null:u("div",{className:"uppy-ProviderBrowser-footer"},u("div",{className:"uppy-ProviderBrowser-footer-buttons"},u("button",{className:(0,av.default)("uppy-u-reset uppy-c-btn uppy-c-btn-primary",{"uppy-c-btn--disabled":o}),disabled:!!o,onClick:t,type:"button"},r("selectX",{smart_count:a})),u("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link",onClick:e,type:"button"},r("cancel"))),o&&u("div",{className:"uppy-ProviderBrowser-footer-error"},o))}var dT=(i,e,t)=>{var r,s;return{id:i.id,source:e.id,name:i.name||i.id,type:i.mimeType,isRemote:!0,data:i,preview:i.thumbnail||void 0,meta:{authorName:(r=i.author)==null?void 0:r.name,authorUrl:(s=i.author)==null?void 0:s.url,relativePath:i.relDirPath||null,absolutePath:i.absDirPath},body:{fileId:i.id},remote:{companionUrl:e.opts.companionUrl,url:`${t.fileUrl(i.requestPath)}`,body:{fileId:i.id},providerName:t.name,provider:t.provider,requestClientId:t.provider}}},lv=dT;var pT=(i,e,t)=>{let r=i.map(o=>lv(o,e,t)),s=[],n=[];r.forEach(o=>{e.uppy.checkIfFileAlreadyExists(za(o,e.uppy.getID()))?n.push(o):s.push(o)}),s.length>0&&e.uppy.info(e.uppy.i18n("addedNumFiles",{numFiles:s.length})),n.length>0&&e.uppy.info(`Not adding ${n.length} files because they already exist`),e.uppy.addFiles(s)},Sl=pT;var cv=(i,e,t)=>{let r=e===null?"null":e;if(t[r])return t[r];let s=i.find(o=>o.id===e);if(s.type==="root")return[];let n=[...cv(i,s.parentId,t),s];return t[r]=n,n},fT=i=>{let e=Object.create(null);return i.filter(s=>s.type==="file"&&s.status==="checked").map(s=>{let n=cv(i,s.id,e),o=n.findIndex(d=>d.type==="folder"&&d.status==="checked"),a=n.slice(o),l=`/${n.map(d=>d.data.name).join("/")}`,c=a.length===1?void 0:a.map(d=>d.data.name).join("/");return{...s.data,absDirPath:l,relDirPath:c}})},El=fT;var mT=(i,e)=>{let t=i.find(s=>s.id===e),r=[];for(;r=[t,...r],t.type!=="root";){let s=t.parentId;t=i.find(n=>n.id===s)}return r},uv=mT;function Tr(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var gT=0;function dv(i){return"__private_"+gT+++"_"+i}var vT={version:"4.4.5"};function go(){return u("svg",{"aria-hidden":"true",focusable:"false",width:"30",height:"30",viewBox:"0 0 30 30"},u("path",{d:"M15 30c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15C6.716 0 0 6.716 0 15c0 8.284 6.716 15 15 15zm4.258-12.676v6.846h-8.426v-6.846H5.204l9.82-12.364 9.82 12.364H19.26z"}))}var hv=i=>({authenticated:void 0,partialTree:[{type:"root",id:i,cached:!1,nextPagePath:null}],currentFolderId:i,searchString:"",didFirstRender:!1,username:null,loading:!1}),ss=dv("abortController"),mi=dv("withAbort"),Vs=class{constructor(e,t){Object.defineProperty(this,mi,{value:bT}),this.isHandlingScroll=!1,this.lastCheckbox=null,Object.defineProperty(this,ss,{writable:!0,value:void 0}),this.validateSingleFile=s=>{let n=co(s);return this.plugin.uppy.validateSingleFile(n)},this.getDisplayedPartialTree=()=>{let{partialTree:s,currentFolderId:n,searchString:o}=this.plugin.getPluginState(),a=s.filter(c=>c.type!=="root"&&c.parentId===n);return o===""?a:a.filter(c=>{var d;return((d=c.data.name)!=null?d:this.plugin.uppy.i18n("unnamed")).toLowerCase().indexOf(o.toLowerCase())!==-1})},this.getBreadcrumbs=()=>{let{partialTree:s,currentFolderId:n}=this.plugin.getPluginState();return uv(s,n)},this.getSelectedAmount=()=>{let{partialTree:s}=this.plugin.getPluginState();return wl(s)},this.validateAggregateRestrictions=s=>{let o=s.filter(a=>a.type==="file"&&a.status==="checked").map(a=>a.data);return this.plugin.uppy.validateAggregateRestrictions(o)},this.plugin=e,this.provider=t.provider;let r={viewType:"list",showTitles:!0,showFilter:!0,showBreadcrumbs:!0,loadAllFiles:!1,virtualList:!1};this.opts={...r,...t},this.openFolder=this.openFolder.bind(this),this.logout=this.logout.bind(this),this.handleAuth=this.handleAuth.bind(this),this.handleScroll=this.handleScroll.bind(this),this.resetPluginState=this.resetPluginState.bind(this),this.donePicking=this.donePicking.bind(this),this.render=this.render.bind(this),this.cancelSelection=this.cancelSelection.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.resetPluginState(),this.plugin.uppy.on("dashboard:close-panel",this.resetPluginState),this.plugin.uppy.registerRequestClient(this.provider.provider,this.provider)}resetPluginState(){this.plugin.setPluginState(hv(this.plugin.rootFolderId))}tearDown(){}setLoading(e){this.plugin.setPluginState({loading:e})}cancelSelection(){let{partialTree:e}=this.plugin.getPluginState(),t=e.map(r=>r.type==="root"?r:{...r,status:"unchecked"});this.plugin.setPluginState({partialTree:t})}async openFolder(e){this.lastCheckbox=null;let{partialTree:t}=this.plugin.getPluginState(),r=t.find(s=>s.id===e);if(r.cached){this.plugin.setPluginState({currentFolderId:e,searchString:""});return}this.setLoading(!0),await Tr(this,mi)[mi](async s=>{let n=e,o=[];do{let{username:l,nextPagePath:c,items:d}=await this.provider.list(n,{signal:s});this.plugin.setPluginState({username:l}),n=c,o=o.concat(d),this.setLoading(this.plugin.uppy.i18n("loadedXFiles",{numFiles:o.length}))}while(this.opts.loadAllFiles&&n);let a=rs.afterOpenFolder(t,o,r,n,this.validateSingleFile);this.plugin.setPluginState({partialTree:a,currentFolderId:e,searchString:""})}).catch(Xi(this.plugin.uppy)),this.setLoading(!1)}async logout(){await Tr(this,mi)[mi](async e=>{let t=await this.provider.logout({signal:e});if(t.ok){if(!t.revoked){let r=this.plugin.uppy.i18n("companionUnauthorizeHint",{provider:this.plugin.title,url:t.manual_revoke_url});this.plugin.uppy.info(r,"info",7e3)}this.plugin.setPluginState({...hv(this.plugin.rootFolderId),authenticated:!1})}}).catch(Xi(this.plugin.uppy))}async handleAuth(e){await Tr(this,mi)[mi](async t=>{this.setLoading(!0),await this.provider.login({authFormData:e,signal:t}),this.plugin.setPluginState({authenticated:!0}),await Promise.all([this.provider.fetchPreAuthToken(),this.openFolder(this.plugin.rootFolderId)])}).catch(Xi(this.plugin.uppy)),this.setLoading(!1)}async handleScroll(e){let{partialTree:t,currentFolderId:r}=this.plugin.getPluginState(),s=t.find(n=>n.id===r);bl(e)&&!this.isHandlingScroll&&s.nextPagePath&&(this.isHandlingScroll=!0,await Tr(this,mi)[mi](async n=>{let{nextPagePath:o,items:a}=await this.provider.list(s.nextPagePath,{signal:n}),l=rs.afterScrollFolder(t,r,a,o,this.validateSingleFile);this.plugin.setPluginState({partialTree:l})}).catch(Xi(this.plugin.uppy)),this.isHandlingScroll=!1)}async donePicking(){let{partialTree:e}=this.plugin.getPluginState();this.setLoading(!0),await Tr(this,mi)[mi](async t=>{let r=await rs.afterFill(e,o=>this.provider.list(o,{signal:t}),this.validateSingleFile,o=>{this.setLoading(this.plugin.uppy.i18n("addedNumFiles",{numFiles:o}))});if(this.validateAggregateRestrictions(r)){this.plugin.setPluginState({partialTree:r});return}let n=El(r);Sl(n,this.plugin,this.provider),this.resetPluginState()}).catch(Xi(this.plugin.uppy)),this.setLoading(!1)}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=yl(e.id,this.getDisplayedPartialTree(),t,this.lastCheckbox),n=rs.afterToggleCheckbox(r,s);this.plugin.setPluginState({partialTree:n}),this.lastCheckbox=e.id}render(e,t){t===void 0&&(t={});let{didFirstRender:r}=this.plugin.getPluginState(),{i18n:s}=this.plugin.uppy;r||(this.plugin.setPluginState({didFirstRender:!0}),this.provider.fetchPreAuthToken(),this.openFolder(this.plugin.rootFolderId));let n={...this.opts,...t},{authenticated:o,loading:a}=this.plugin.getPluginState(),l=this.plugin.icon||go;if(o===!1)return u(pl,{pluginName:this.plugin.title,pluginIcon:l,handleAuth:this.handleAuth,i18n:this.plugin.uppy.i18n,renderForm:n.renderAuthForm,loading:a});let{partialTree:c,username:d,searchString:f}=this.plugin.getPluginState(),g=this.getBreadcrumbs();return u("div",{className:(0,pv.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${n.viewType}`)},u(Ih,{showBreadcrumbs:n.showBreadcrumbs,openFolder:this.openFolder,breadcrumbs:g,pluginIcon:l,title:this.plugin.title,logout:this.logout,username:d,i18n:s}),n.showFilter&&u(qs,{searchString:f,setSearchString:b=>{this.plugin.setPluginState({searchString:b})},submitSearchString:()=>{},inputLabel:s("filter"),clearSearchLabel:s("resetFilter"),wrapperClassName:"uppy-ProviderBrowser-searchFilter",inputClassName:"uppy-ProviderBrowser-searchFilterInput"}),u(ml,{toggleCheckbox:this.toggleCheckbox,displayedPartialTree:this.getDisplayedPartialTree(),openFolder:this.openFolder,virtualList:n.virtualList,noResultsLabel:s("noFilesFound"),handleScroll:this.handleScroll,viewType:n.viewType,showTitles:n.showTitles,i18n:this.plugin.uppy.i18n,isLoading:a,utmSource:"Companion"}),u(mo,{partialTree:c,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:s,validateAggregateRestrictions:this.validateAggregateRestrictions}))}};async function bT(i){var e;(e=Tr(this,ss)[ss])==null||e.abort();let t=new AbortController;Tr(this,ss)[ss]=t;let r=()=>{t.abort()};try{this.plugin.uppy.on("dashboard:close-panel",r),this.plugin.uppy.on("cancel-all",r),await i(t.signal)}finally{this.plugin.uppy.off("dashboard:close-panel",r),this.plugin.uppy.off("cancel-all",r),Tr(this,ss)[ss]=void 0}}Vs.VERSION=vT.version;var fv=Te(yt(),1);var yT={version:"4.4.5"},wT={loading:!1,searchString:"",partialTree:[{type:"root",id:null,cached:!1,nextPagePath:null}],currentFolderId:null,isInputMode:!0},ST={viewType:"grid",showTitles:!0,showFilter:!0,utmSource:"Companion"},js=class{constructor(e,t){this.isHandlingScroll=!1,this.lastCheckbox=null,this.validateSingleFile=r=>{let s=co(r);return this.plugin.uppy.validateSingleFile(s)},this.getDisplayedPartialTree=()=>{let{partialTree:r}=this.plugin.getPluginState();return r.filter(s=>s.type!=="root")},this.setSearchString=r=>{this.plugin.setPluginState({searchString:r}),r===""&&this.plugin.setPluginState({partialTree:[]})},this.validateAggregateRestrictions=r=>{let n=r.filter(o=>o.type==="file"&&o.status==="checked").map(o=>o.data);return this.plugin.uppy.validateAggregateRestrictions(n)},this.plugin=e,this.provider=t.provider,this.opts={...ST,...t},this.setSearchString=this.setSearchString.bind(this),this.search=this.search.bind(this),this.resetPluginState=this.resetPluginState.bind(this),this.handleScroll=this.handleScroll.bind(this),this.donePicking=this.donePicking.bind(this),this.cancelSelection=this.cancelSelection.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.render=this.render.bind(this),this.resetPluginState(),this.plugin.uppy.on("dashboard:close-panel",this.resetPluginState),this.plugin.uppy.registerRequestClient(this.provider.provider,this.provider)}tearDown(){}setLoading(e){this.plugin.setPluginState({loading:e})}resetPluginState(){this.plugin.setPluginState(wT)}cancelSelection(){let{partialTree:e}=this.plugin.getPluginState(),t=e.map(r=>r.type==="root"?r:{...r,status:"unchecked"});this.plugin.setPluginState({partialTree:t})}async search(){let{searchString:e}=this.plugin.getPluginState();if(e!==""){this.setLoading(!0);try{let t=await this.provider.search(e),r=[{type:"root",id:null,cached:!1,nextPagePath:t.nextPageQuery},...t.items.map(s=>({type:"file",id:s.requestPath,status:"unchecked",parentId:null,data:s}))];this.plugin.setPluginState({partialTree:r,isInputMode:!1})}catch(t){Xi(this.plugin.uppy)(t)}this.setLoading(!1)}}async handleScroll(e){let{partialTree:t,searchString:r}=this.plugin.getPluginState(),s=t.find(n=>n.type==="root");if(bl(e)&&!this.isHandlingScroll&&s.nextPagePath){this.isHandlingScroll=!0;try{let n=await this.provider.search(r,s.nextPagePath),o={...s,nextPagePath:n.nextPageQuery},a=t.filter(c=>c.type!=="root"),l=[o,...a,...n.items.map(c=>({type:"file",id:c.requestPath,status:"unchecked",parentId:null,data:c}))];this.plugin.setPluginState({partialTree:l})}catch(n){Xi(this.plugin.uppy)(n)}this.isHandlingScroll=!1}}async donePicking(){let{partialTree:e}=this.plugin.getPluginState(),t=El(e);Sl(t,this.plugin,this.provider),this.resetPluginState()}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=yl(e.id,this.getDisplayedPartialTree(),t,this.lastCheckbox),n=rs.afterToggleCheckbox(r,s);this.plugin.setPluginState({partialTree:n}),this.lastCheckbox=e.id}render(e,t){t===void 0&&(t={});let{isInputMode:r,searchString:s,loading:n,partialTree:o}=this.plugin.getPluginState(),{i18n:a}=this.plugin.uppy,l={...this.opts,...t};return r?u(qs,{searchString:s,setSearchString:this.setSearchString,submitSearchString:this.search,inputLabel:a("enterTextToSearch"),buttonLabel:a("searchImages"),wrapperClassName:"uppy-SearchProvider",inputClassName:"uppy-c-textInput uppy-SearchProvider-input",showButton:!0,buttonCSSClassName:"uppy-SearchProvider-searchButton"}):u("div",{className:(0,fv.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${l.viewType}`)},l.showFilter&&u(qs,{searchString:s,setSearchString:this.setSearchString,submitSearchString:this.search,inputLabel:a("search"),clearSearchLabel:a("resetSearch"),wrapperClassName:"uppy-ProviderBrowser-searchFilter",inputClassName:"uppy-ProviderBrowser-searchFilterInput"}),u(ml,{toggleCheckbox:this.toggleCheckbox,displayedPartialTree:this.getDisplayedPartialTree(),handleScroll:this.handleScroll,openFolder:async()=>{},noResultsLabel:a("noSearchResults"),viewType:l.viewType,showTitles:l.showTitles,isLoading:n,i18n:a,virtualList:!1,utmSource:this.opts.utmSource}),u(mo,{partialTree:o,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:a,validateAggregateRestrictions:this.validateAggregateRestrictions}))}};js.VERSION=yT.version;var mv=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function ET(i,e){return!!(i===e||mv(i)&&mv(e))}function TT(i,e){if(i.length!==e.length)return!1;for(var t=0;t<i.length;t++)if(!ET(i[t],e[t]))return!1;return!0}function Kh(i,e){e===void 0&&(e=TT);var t=null;function r(){for(var s=[],n=0;n<arguments.length;n++)s[n]=arguments[n];if(t&&t.lastThis===this&&e(s,t.lastArgs))return t.lastResult;var o=i.apply(this,s);return t={lastResult:o,lastArgs:s,lastThis:this},o}return r.clear=function(){t=null},r}var Tl=['a[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','area[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])',"input:not([disabled]):not([inert]):not([aria-hidden])","select:not([disabled]):not([inert]):not([aria-hidden])","textarea:not([disabled]):not([inert]):not([aria-hidden])","button:not([disabled]):not([inert]):not([aria-hidden])",'iframe:not([tabindex^="-"]):not([inert]):not([aria-hidden])','object:not([tabindex^="-"]):not([inert]):not([aria-hidden])','embed:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[contenteditable]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[tabindex]:not([tabindex^="-"]):not([inert]):not([aria-hidden])'];function vo(i,e){if(e){let t=i.querySelector(`[data-uppy-paneltype="${e}"]`);if(t)return t}return i}function gv(i,e){let t=e[0];t&&(t.focus(),i.preventDefault())}function xT(i,e){let t=e[e.length-1];t&&(t.focus(),i.preventDefault())}function kT(i){return i.contains(document.activeElement)}function Xh(i,e,t){let r=vo(t,e),s=Er(r.querySelectorAll(Tl)),n=s.indexOf(document.activeElement);kT(r)?i.shiftKey&&n===0?xT(i,s):!i.shiftKey&&n===s.length-1&&gv(i,s):gv(i,s)}function vv(i,e,t){e===null||Xh(i,e,t)}var bv=Te(Nu(),1);function Yh(){let i=!1;return(0,bv.default)((t,r)=>{let s=vo(t,r),n=s.contains(document.activeElement);if(n&&i)return;let o=s.querySelector("[data-uppy-super-focusable]");if(!(n&&!o))if(o)o.focus({preventScroll:!0}),i=!0;else{let a=s.querySelector(Tl);a?.focus({preventScroll:!0}),i=!1}},260)}var Dv=Te(yt(),1);function Zh(){let i=document.body;return!(!("draggable"in i)||!("ondragstart"in i&&"ondrop"in i)||!("FormData"in window)||!("FileReader"in window))}var Ev=Te(yt(),1);function yv(i,e){if(i===e)return!0;if(!i||!e)return!1;let t=Object.keys(i),r=Object.keys(e),s=t.length;if(r.length!==s)return!1;for(let n=0;n<s;n++){let o=t[n];if(i[o]!==e[o]||!Object.prototype.hasOwnProperty.call(e,o))return!1}return!0}function _T(){return u("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25"},u("g",{fill:"#686DE0",fillRule:"evenodd"},u("path",{d:"M5 7v10h15V7H5zm0-1h15a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z",fillRule:"nonzero"}),u("path",{d:"M6.35 17.172l4.994-5.026a.5.5 0 0 1 .707 0l2.16 2.16 3.505-3.505a.5.5 0 0 1 .707 0l2.336 2.31-.707.72-1.983-1.97-3.505 3.505a.5.5 0 0 1-.707 0l-2.16-2.159-3.938 3.939-1.409.026z",fillRule:"nonzero"}),u("circle",{cx:"7.5",cy:"9.5",r:"1.5"})))}function CT(){return u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25"},u("path",{d:"M9.5 18.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V7.25a.5.5 0 0 1 .379-.485l9-2.25A.5.5 0 0 1 18.5 5v11.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V8.67l-8 2v7.97zm8-11v-2l-8 2v2l8-2zM7 19.64c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1zm9-2c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1z",fill:"#049BCF",fillRule:"nonzero"}))}function PT(){return u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25"},u("path",{d:"M16 11.834l4.486-2.691A1 1 0 0 1 22 10v6a1 1 0 0 1-1.514.857L16 14.167V17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v2.834zM15 9H5v8h10V9zm1 4l5 3v-6l-5 3z",fill:"#19AF67",fillRule:"nonzero"}))}function FT(){return u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25"},u("path",{d:"M9.766 8.295c-.691-1.843-.539-3.401.747-3.726 1.643-.414 2.505.938 2.39 3.299-.039.79-.194 1.662-.537 3.148.324.49.66.967 1.055 1.51.17.231.382.488.629.757 1.866-.128 3.653.114 4.918.655 1.487.635 2.192 1.685 1.614 2.84-.566 1.133-1.839 1.084-3.416.249-1.141-.604-2.457-1.634-3.51-2.707a13.467 13.467 0 0 0-2.238.426c-1.392 4.051-4.534 6.453-5.707 4.572-.986-1.58 1.38-4.206 4.914-5.375.097-.322.185-.656.264-1.001.08-.353.306-1.31.407-1.737-.678-1.059-1.2-2.031-1.53-2.91zm2.098 4.87c-.033.144-.068.287-.104.427l.033-.01-.012.038a14.065 14.065 0 0 1 1.02-.197l-.032-.033.052-.004a7.902 7.902 0 0 1-.208-.271c-.197-.27-.38-.526-.555-.775l-.006.028-.002-.003c-.076.323-.148.632-.186.8zm5.77 2.978c1.143.605 1.832.632 2.054.187.26-.519-.087-1.034-1.113-1.473-.911-.39-2.175-.608-3.55-.608.845.766 1.787 1.459 2.609 1.894zM6.559 18.789c.14.223.693.16 1.425-.413.827-.648 1.61-1.747 2.208-3.206-2.563 1.064-4.102 2.867-3.633 3.62zm5.345-10.97c.088-1.793-.351-2.48-1.146-2.28-.473.119-.564 1.05-.056 2.405.213.566.52 1.188.908 1.859.18-.858.268-1.453.294-1.984z",fill:"#E2514A",fillRule:"nonzero"}))}function OT(){return u("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25"},u("path",{d:"M10.45 2.05h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V2.55a.5.5 0 0 1 .5-.5zm2.05 1.024h1.05a.5.5 0 0 1 .5.5V3.6a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5v-.001zM10.45 0h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V.5a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 3.074h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 1.024h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm-2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-1.656 3.074l-.82 5.946c.52.302 1.174.458 1.976.458.803 0 1.455-.156 1.975-.458l-.82-5.946h-2.311zm0-1.025h2.312c.512 0 .946.378 1.015.885l.82 5.946c.056.412-.142.817-.501 1.026-.686.398-1.515.597-2.49.597-.974 0-1.804-.199-2.49-.597a1.025 1.025 0 0 1-.5-1.026l.819-5.946c.07-.507.503-.885 1.015-.885zm.545 6.6a.5.5 0 0 1-.397-.561l.143-.999a.5.5 0 0 1 .495-.429h.74a.5.5 0 0 1 .495.43l.143.998a.5.5 0 0 1-.397.561c-.404.08-.819.08-1.222 0z",fill:"#00C469",fillRule:"nonzero"}))}function RT(){return u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25"},u("g",{fill:"#A7AFB7",fillRule:"nonzero"},u("path",{d:"M5.5 22a.5.5 0 0 1-.5-.5v-18a.5.5 0 0 1 .5-.5h10.719a.5.5 0 0 1 .367.16l3.281 3.556a.5.5 0 0 1 .133.339V21.5a.5.5 0 0 1-.5.5h-14zm.5-1h13V7.25L16 4H6v17z"}),u("path",{d:"M15 4v3a1 1 0 0 0 1 1h3V7h-3V4h-1z"})))}function LT(){return u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25"},u("path",{d:"M4.5 7h13a.5.5 0 1 1 0 1h-13a.5.5 0 0 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h10a.5.5 0 1 1 0 1h-10a.5.5 0 1 1 0-1z",fill:"#5A5E69",fillRule:"nonzero"}))}function ns(i){let e={color:"#838999",icon:RT()};if(!i)return e;let t=i.split("/")[0],r=i.split("/")[1];return t==="text"?{color:"#5a5e69",icon:LT()}:t==="image"?{color:"#686de0",icon:_T()}:t==="audio"?{color:"#068dbb",icon:CT()}:t==="video"?{color:"#19af67",icon:PT()}:t==="application"&&r==="pdf"?{color:"#e25149",icon:FT()}:t==="application"&&["zip","x-7z-compressed","x-zip-compressed","x-rar-compressed","x-tar","x-gzip","x-apple-diskimage"].indexOf(r)!==-1?{color:"#00C469",icon:OT()}:e}function bo(i){let{file:e}=i;if(e.preview)return u("img",{draggable:!1,className:"uppy-Dashboard-Item-previewImg",alt:e.name,src:e.preview});let{color:t,icon:r}=ns(e.type);return u("div",{className:"uppy-Dashboard-Item-previewIconWrap"},u("span",{className:"uppy-Dashboard-Item-previewIcon",style:{color:t}},r),u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-Dashboard-Item-previewIconBg",width:"58",height:"76",viewBox:"0 0 58 76"},u("rect",{fill:"#FFF",width:"58",height:"76",rx:"3",fillRule:"evenodd"})))}var MT=(i,e)=>(typeof e=="function"?e():e).filter(s=>s.id===i)[0].name;function yo(i){let{file:e,toggleFileCard:t,i18n:r,metaFields:s}=i,{missingRequiredMetaFields:n}=e;if(!(n!=null&&n.length))return null;let o=n.map(a=>MT(a,s)).join(", ");return u("div",{className:"uppy-Dashboard-Item-errorMessage"},r("missingRequiredMetaFields",{smart_count:n.length,fields:o})," ",u("button",{type:"button",class:"uppy-u-reset uppy-Dashboard-Item-errorMessageBtn",onClick:()=>t(!0,e.id)},r("editFile")))}function Qh(i){let{file:e,i18n:t,toggleFileCard:r,metaFields:s,showLinkToFileUploadResult:n}=i,a=e.preview?"rgba(255, 255, 255, 0.5)":ns(e.type).color;return u("div",{className:"uppy-Dashboard-Item-previewInnerWrap",style:{backgroundColor:a}},n&&e.uploadURL&&u("a",{className:"uppy-Dashboard-Item-previewLink",href:e.uploadURL,rel:"noreferrer noopener",target:"_blank","aria-label":e.meta.name},u("span",{hidden:!0},e.meta.name)),u(bo,{file:e}),u(yo,{file:e,i18n:t,toggleFileCard:r,metaFields:s}))}function IT(i){if(!i.isUploaded){if(i.error&&!i.hideRetryButton){i.uppy.retryUpload(i.file.id);return}i.resumableUploads&&!i.hidePauseResumeButton?i.uppy.pauseResume(i.file.id):i.individualCancellation&&!i.hideCancelButton&&i.uppy.removeFile(i.file.id)}}function wv(i){return i.isUploaded?i.i18n("uploadComplete"):i.error?i.i18n("retryUpload"):i.resumableUploads?i.file.isPaused?i.i18n("resumeUpload"):i.i18n("pauseUpload"):i.individualCancellation?i.i18n("cancelUpload"):""}function Jh(i){return u("div",{className:"uppy-Dashboard-Item-progress"},u("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-progressIndicator",type:"button","aria-label":wv(i),title:wv(i),onClick:()=>IT(i)},i.children))}function xl(i){let{children:e}=i;return u("svg",{"aria-hidden":"true",focusable:"false",width:"70",height:"70",viewBox:"0 0 36 36",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--circle"},e)}function ed(i){let{progress:e}=i,t=2*Math.PI*15;return u("g",null,u("circle",{className:"uppy-Dashboard-Item-progressIcon--bg",r:"15",cx:"18",cy:"18","stroke-width":"2",fill:"none"}),u("circle",{className:"uppy-Dashboard-Item-progressIcon--progress",r:"15",cx:"18",cy:"18",transform:"rotate(-90, 18, 18)",fill:"none","stroke-width":"2","stroke-dasharray":t,"stroke-dashoffset":t-t/100*e}))}function td(i){return!i.file.progress.uploadStarted||i.file.progress.percentage===void 0?null:i.isUploaded?u("div",{className:"uppy-Dashboard-Item-progress"},u("div",{className:"uppy-Dashboard-Item-progressIndicator"},u(xl,null,u("circle",{r:"15",cx:"18",cy:"18",fill:"#1bb240"}),u("polygon",{className:"uppy-Dashboard-Item-progressIcon--check",transform:"translate(2, 3)",points:"14 22.5 7 15.2457065 8.99985857 13.1732815 14 18.3547104 22.9729883 9 25 11.1005634"})))):i.recoveredState?null:i.error&&!i.hideRetryButton?u(Jh,i,u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--retry",width:"28",height:"31",viewBox:"0 0 16 19"},u("path",{d:"M16 11a8 8 0 1 1-8-8v2a6 6 0 1 0 6 6h2z"}),u("path",{d:"M7.9 3H10v2H7.9z"}),u("path",{d:"M8.536.5l3.535 3.536-1.414 1.414L7.12 1.914z"}),u("path",{d:"M10.657 2.621l1.414 1.415L8.536 7.57 7.12 6.157z"}))):i.resumableUploads&&!i.hidePauseResumeButton?u(Jh,i,u(xl,null,u(ed,{progress:i.file.progress.percentage}),i.file.isPaused?u("polygon",{className:"uppy-Dashboard-Item-progressIcon--play",transform:"translate(3, 3)",points:"12 20 12 10 20 15"}):u("g",{className:"uppy-Dashboard-Item-progressIcon--pause",transform:"translate(14.5, 13)"},u("rect",{x:"0",y:"0",width:"2",height:"10",rx:"0"}),u("rect",{x:"5",y:"0",width:"2",height:"10",rx:"0"})))):!i.resumableUploads&&i.individualCancellation&&!i.hideCancelButton?u(Jh,i,u(xl,null,u(ed,{progress:i.file.progress.percentage}),u("polygon",{className:"cancel",transform:"translate(2, 2)",points:"19.8856516 11.0625 16 14.9481516 12.1019737 11.0625 11.0625 12.1143484 14.9481516 16 11.0625 19.8980263 12.1019737 20.9375 16 17.0518484 19.8856516 20.9375 20.9375 19.8980263 17.0518484 16 20.9375 12"}))):u("div",{className:"uppy-Dashboard-Item-progress"},u("div",{className:"uppy-Dashboard-Item-progressIndicator"},u(xl,null,u(ed,{progress:i.file.progress.percentage}))))}var Sv=Te(Ha(),1);var id="...";function kl(i,e){if(e===0)return"";if(i.length<=e)return i;if(e<=id.length+1)return`${i.slice(0,e-1)}\u2026`;let t=e-id.length,r=Math.ceil(t/2),s=Math.floor(t/2);return i.slice(0,r)+id+i.slice(-s)}var DT=i=>{let{author:e,name:t}=i.file.meta;function r(){return i.isSingleFile&&i.containerHeight>=350?90:i.containerWidth<=352?35:i.containerWidth<=576?60:e?20:30}return u("div",{className:"uppy-Dashboard-Item-name",title:t},kl(t,r()))},NT=i=>{var e;let{author:t}=i.file.meta,r=(e=i.file.remote)==null?void 0:e.providerName,s="\xB7";return t?u("div",{className:"uppy-Dashboard-Item-author"},u("a",{href:`${t.url}?utm_source=Companion&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer"},kl(t.name,13)),r?u(Fragment,null,` ${s} `,r,` ${s} `):null):null},BT=i=>i.file.size&&u("div",{className:"uppy-Dashboard-Item-statusSize"},(0,Sv.default)(i.file.size)),UT=i=>i.file.isGhost&&u("span",null," \u2022 ",u("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-reSelect",type:"button",onClick:()=>i.toggleAddFilesPanel(!0)},i.i18n("reSelect"))),zT=i=>{let{file:e,onClick:t}=i;return e.error?u("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-errorDetails","aria-label":e.error,"data-microtip-position":"bottom","data-microtip-size":"medium",onClick:t,type:"button"},"?"):null};function rd(i){let{file:e,i18n:t,toggleFileCard:r,metaFields:s,toggleAddFilesPanel:n,isSingleFile:o,containerHeight:a,containerWidth:l}=i;return u("div",{className:"uppy-Dashboard-Item-fileInfo","data-uppy-file-source":e.source},u("div",{className:"uppy-Dashboard-Item-fileName"},DT({file:e,isSingleFile:o,containerHeight:a,containerWidth:l}),u(zT,{file:e,onClick:()=>alert(e.error)})),u("div",{className:"uppy-Dashboard-Item-status"},NT({file:e}),BT({file:e}),UT({file:e,toggleAddFilesPanel:n,i18n:t})),u(yo,{file:e,i18n:t,toggleFileCard:r,metaFields:s}))}function sd(i,e){return e===void 0&&(e="Copy the URL below"),new Promise(t=>{let r=document.createElement("textarea");r.setAttribute("style",{position:"fixed",top:0,left:0,width:"2em",height:"2em",padding:0,border:"none",outline:"none",boxShadow:"none",background:"transparent"}),r.value=i,document.body.appendChild(r),r.select();let s=()=>{document.body.removeChild(r),window.prompt(e,i),t()};try{return document.execCommand("copy")?(document.body.removeChild(r),t()):s()}catch{return document.body.removeChild(r),s()}})}function HT(i){let{file:e,uploadInProgressOrComplete:t,metaFields:r,canEditFile:s,i18n:n,onClick:o}=i;return!t&&r&&r.length>0||!t&&s(e)?u("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-action uppy-Dashboard-Item-action--edit",type:"button","aria-label":n("editFileWithFilename",{file:e.meta.name}),title:n("editFileWithFilename",{file:e.meta.name}),onClick:()=>o()},u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 14"},u("g",{fillRule:"evenodd"},u("path",{d:"M1.5 10.793h2.793A1 1 0 0 0 5 10.5L11.5 4a1 1 0 0 0 0-1.414L9.707.793a1 1 0 0 0-1.414 0l-6.5 6.5A1 1 0 0 0 1.5 8v2.793zm1-1V8L9 1.5l1.793 1.793-6.5 6.5H2.5z",fillRule:"nonzero"}),u("rect",{x:"1",y:"12.293",width:"11",height:"1",rx:".5"}),u("path",{fillRule:"nonzero",d:"M6.793 2.5L9.5 5.207l.707-.707L7.5 1.793z"})))):null}function $T(i){let{i18n:e,onClick:t,file:r}=i;return u("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--remove",type:"button","aria-label":e("removeFile",{file:r.meta.name}),title:e("removeFile",{file:r.meta.name}),onClick:()=>t()},u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"18",height:"18",viewBox:"0 0 18 18"},u("path",{d:"M9 0C4.034 0 0 4.034 0 9s4.034 9 9 9 9-4.034 9-9-4.034-9-9-9z"}),u("path",{fill:"#FFF",d:"M13 12.222l-.778.778L9 9.778 5.778 13 5 12.222 8.222 9 5 5.778 5.778 5 9 8.222 12.222 5l.778.778L9.778 9z"})))}function qT(i){let{file:e,uppy:t,i18n:r}=i,s=n=>{sd(e.uploadURL,r("copyLinkToClipboardFallback")).then(()=>{t.log("Link copied to clipboard."),t.info(r("copyLinkToClipboardSuccess"),"info",3e3)}).catch(t.log).then(()=>n.target.focus({preventScroll:!0}))};return u("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--copyLink",type:"button","aria-label":r("copyLink"),title:r("copyLink"),onClick:n=>s(n)},u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 12"},u("path",{d:"M7.94 7.703a2.613 2.613 0 0 1-.626 2.681l-.852.851a2.597 2.597 0 0 1-1.849.766A2.616 2.616 0 0 1 2.764 7.54l.852-.852a2.596 2.596 0 0 1 2.69-.625L5.267 7.099a1.44 1.44 0 0 0-.833.407l-.852.851a1.458 1.458 0 0 0 1.03 2.486c.39 0 .755-.152 1.03-.426l.852-.852c.231-.231.363-.522.406-.824l1.04-1.038zm4.295-5.937A2.596 2.596 0 0 0 10.387 1c-.698 0-1.355.272-1.849.766l-.852.851a2.614 2.614 0 0 0-.624 2.688l1.036-1.036c.041-.304.173-.6.407-.833l.852-.852c.275-.275.64-.426 1.03-.426a1.458 1.458 0 0 1 1.03 2.486l-.852.851a1.442 1.442 0 0 1-.824.406l-1.04 1.04a2.596 2.596 0 0 0 2.683-.628l.851-.85a2.616 2.616 0 0 0 0-3.697zm-6.88 6.883a.577.577 0 0 0 .82 0l3.474-3.474a.579.579 0 1 0-.819-.82L5.355 7.83a.579.579 0 0 0 0 .819z"})))}function nd(i){let{uppy:e,file:t,uploadInProgressOrComplete:r,canEditFile:s,metaFields:n,showLinkToFileUploadResult:o,showRemoveButton:a,i18n:l,toggleFileCard:c,openFileEditor:d}=i;return u("div",{className:"uppy-Dashboard-Item-actionWrapper"},u(HT,{i18n:l,file:t,uploadInProgressOrComplete:r,canEditFile:s,metaFields:n,onClick:()=>{n&&n.length>0?c(!0,t.id):d(t)}}),o&&t.uploadURL?u(qT,{file:t,uppy:e,i18n:l}):null,a?u($T,{i18n:l,file:t,onClick:()=>e.removeFile(t.id)}):null)}var wo=class extends ke{componentDidMount(){let{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}shouldComponentUpdate(e){return!yv(this.props,e)}componentDidUpdate(){let{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}componentWillUnmount(){let{file:e}=this.props;e.preview||this.props.handleCancelThumbnail(e)}render(){let{file:e}=this.props,t=e.progress.preprocess||e.progress.postprocess,r=!!e.progress.uploadComplete&&!t&&!e.error,s=!!e.progress.uploadStarted||!!t,n=e.progress.uploadStarted&&!e.progress.uploadComplete||t,o=e.error||!1,{isGhost:a}=e,l=(this.props.individualCancellation||!n)&&!r;r&&this.props.showRemoveButtonAfterComplete&&(l=!0);let c=(0,Ev.default)({"uppy-Dashboard-Item":!0,"is-inprogress":n&&!this.props.recoveredState,"is-processing":t,"is-complete":r,"is-error":!!o,"is-resumable":this.props.resumableUploads,"is-noIndividualCancellation":!this.props.individualCancellation,"is-ghost":a});return u("div",{className:c,id:`uppy_${e.id}`,role:this.props.role},u("div",{className:"uppy-Dashboard-Item-preview"},u(Qh,{file:e,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,i18n:this.props.i18n,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields}),u(td,{uppy:this.props.uppy,file:e,error:o,isUploaded:r,hideRetryButton:this.props.hideRetryButton,hideCancelButton:this.props.hideCancelButton,hidePauseResumeButton:this.props.hidePauseResumeButton,recoveredState:this.props.recoveredState,resumableUploads:this.props.resumableUploads,individualCancellation:this.props.individualCancellation,i18n:this.props.i18n})),u("div",{className:"uppy-Dashboard-Item-fileInfoAndButtons"},u(rd,{file:e,containerWidth:this.props.containerWidth,containerHeight:this.props.containerHeight,i18n:this.props.i18n,toggleAddFilesPanel:this.props.toggleAddFilesPanel,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields,isSingleFile:this.props.isSingleFile}),u(nd,{file:e,metaFields:this.props.metaFields,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,showRemoveButton:l,canEditFile:this.props.canEditFile,uploadInProgressOrComplete:s,toggleFileCard:this.props.toggleFileCard,openFileEditor:this.props.openFileEditor,uppy:this.props.uppy,i18n:this.props.i18n})))}};function VT(i,e){let t=[],r=[];return i.forEach(s=>{r.length<e?r.push(s):(t.push(r),r=[s])}),r.length&&t.push(r),t}function od(i){let{id:e,i18n:t,uppy:r,files:s,resumableUploads:n,hideRetryButton:o,hidePauseResumeButton:a,hideCancelButton:l,showLinkToFileUploadResult:c,showRemoveButtonAfterComplete:d,metaFields:f,isSingleFile:g,toggleFileCard:b,handleRequestThumbnail:w,handleCancelThumbnail:P,recoveredState:R,individualCancellation:C,itemsPerRow:k,openFileEditor:_,canEditFile:E,toggleAddFilesPanel:A,containerWidth:F,containerHeight:O}=i,M=k===1?71:200,H=br(()=>{let q=(ne,se)=>Number(s[se].isGhost)-Number(s[ne].isGhost),Y=Object.keys(s);return R&&Y.sort(q),VT(Y,k)},[s,k,R]),W=q=>u("div",{class:"uppy-Dashboard-filesInner",role:"presentation",key:q[0]},q.map(Y=>u(wo,{key:Y,uppy:r,id:e,i18n:t,resumableUploads:n,individualCancellation:C,hideRetryButton:o,hidePauseResumeButton:a,hideCancelButton:l,showLinkToFileUploadResult:c,showRemoveButtonAfterComplete:d,metaFields:f,recoveredState:R,isSingleFile:g,containerWidth:F,containerHeight:O,toggleFileCard:b,handleRequestThumbnail:w,handleCancelThumbnail:P,role:"listitem",openFileEditor:_,canEditFile:E,toggleAddFilesPanel:A,file:s[Y]})));return g?u("div",{class:"uppy-Dashboard-files"},W(H[0])):u(fl,{class:"uppy-Dashboard-files",role:"list",data:H,renderRow:W,rowHeight:M})}var ad=class extends ke{constructor(){super(...arguments),this.fileInput=null,this.folderInput=null,this.mobilePhotoFileInput=null,this.mobileVideoFileInput=null,this.triggerFileInputClick=()=>{var e;(e=this.fileInput)==null||e.click()},this.triggerFolderInputClick=()=>{var e;(e=this.folderInput)==null||e.click()},this.triggerVideoCameraInputClick=()=>{var e;(e=this.mobileVideoFileInput)==null||e.click()},this.triggerPhotoCameraInputClick=()=>{var e;(e=this.mobilePhotoFileInput)==null||e.click()},this.onFileInputChange=e=>{this.props.handleInputChange(e),e.currentTarget.value=""},this.renderHiddenInput=(e,t)=>{var r;return u("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,webkitdirectory:e,type:"file",name:"files[]",multiple:this.props.maxNumberOfFiles!==1,onChange:this.onFileInputChange,accept:(r=this.props.allowedFileTypes)==null?void 0:r.join(", "),ref:t})},this.renderHiddenCameraInput=(e,t,r)=>{let n={photo:"image/*",video:"video/*"}[e];return u("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,type:"file",name:`camera-${e}`,onChange:this.onFileInputChange,capture:t,accept:n,ref:r})},this.renderMyDeviceAcquirer=()=>u("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MyDevice"},u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerFileInputClick},u("div",{className:"uppy-DashboardTab-inner"},u("svg",{className:"uppy-DashboardTab-iconMyDevice","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32"},u("path",{d:"M8.45 22.087l-1.305-6.674h17.678l-1.572 6.674H8.45zm4.975-12.412l1.083 1.765a.823.823 0 00.715.386h7.951V13.5H8.587V9.675h4.838zM26.043 13.5h-1.195v-2.598c0-.463-.336-.75-.798-.75h-8.356l-1.082-1.766A.823.823 0 0013.897 8H7.728c-.462 0-.815.256-.815.718V13.5h-.956a.97.97 0 00-.746.37.972.972 0 00-.19.81l1.724 8.565c.095.44.484.755.933.755H24c.44 0 .824-.3.929-.727l2.043-8.568a.972.972 0 00-.176-.825.967.967 0 00-.753-.38z",fill:"currentcolor","fill-rule":"evenodd"}))),u("div",{className:"uppy-DashboardTab-name"},this.props.i18n("myDevice")))),this.renderPhotoCamera=()=>u("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobilePhotoCamera"},u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerPhotoCameraInputClick},u("div",{className:"uppy-DashboardTab-inner"},u("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32"},u("path",{d:"M23.5 9.5c1.417 0 2.5 1.083 2.5 2.5v9.167c0 1.416-1.083 2.5-2.5 2.5h-15c-1.417 0-2.5-1.084-2.5-2.5V12c0-1.417 1.083-2.5 2.5-2.5h2.917l1.416-2.167C13 7.167 13.25 7 13.5 7h5c.25 0 .5.167.667.333L20.583 9.5H23.5zM16 11.417a4.706 4.706 0 00-4.75 4.75 4.704 4.704 0 004.75 4.75 4.703 4.703 0 004.75-4.75c0-2.663-2.09-4.75-4.75-4.75zm0 7.825c-1.744 0-3.076-1.332-3.076-3.074 0-1.745 1.333-3.077 3.076-3.077 1.744 0 3.074 1.333 3.074 3.076s-1.33 3.075-3.074 3.075z",fill:"#02B383","fill-rule":"nonzero"}))),u("div",{className:"uppy-DashboardTab-name"},this.props.i18n("takePictureBtn")))),this.renderVideoCamera=()=>u("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobileVideoCamera"},u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerVideoCameraInputClick},u("div",{className:"uppy-DashboardTab-inner"},u("svg",{"aria-hidden":"true",width:"32",height:"32",viewBox:"0 0 32 32"},u("path",{fill:"#FF675E",fillRule:"nonzero",d:"m21.254 14.277 2.941-2.588c.797-.313 1.243.818 1.09 1.554-.01 2.094.02 4.189-.017 6.282-.126.915-1.145 1.08-1.58.34l-2.434-2.142c-.192.287-.504 1.305-.738.468-.104-1.293-.028-2.596-.05-3.894.047-.312.381.823.426 1.069.063-.384.206-.744.362-1.09zm-12.939-3.73c3.858.013 7.717-.025 11.574.02.912.129 1.492 1.237 1.351 2.217-.019 2.412.04 4.83-.03 7.239-.17 1.025-1.166 1.59-2.029 1.429-3.705-.012-7.41.025-11.114-.019-.913-.129-1.492-1.237-1.352-2.217.018-2.404-.036-4.813.029-7.214.136-.82.83-1.473 1.571-1.454z "}))),u("div",{className:"uppy-DashboardTab-name"},this.props.i18n("recordVideoBtn")))),this.renderBrowseButton=(e,t)=>{let r=this.props.acquirers.length;return u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-browse",onClick:t,"data-uppy-super-focusable":r===0},e)},this.renderDropPasteBrowseTagline=e=>{let t=this.renderBrowseButton(this.props.i18n("browseFiles"),this.triggerFileInputClick),r=this.renderBrowseButton(this.props.i18n("browseFolders"),this.triggerFolderInputClick),s=this.props.fileManagerSelectionType,n=s.charAt(0).toUpperCase()+s.slice(1);return u("div",{class:"uppy-Dashboard-AddFiles-title"},this.props.disableLocalFiles?this.props.i18n("importFiles"):e>0?this.props.i18nArray(`dropPasteImport${n}`,{browseFiles:t,browseFolders:r,browse:t}):this.props.i18nArray(`dropPaste${n}`,{browseFiles:t,browseFolders:r,browse:t}))},this.renderAcquirer=e=>{var t;return u("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":e.id},u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-cy":e.id,"aria-controls":`uppy-DashboardContent-panel--${e.id}`,"aria-selected":((t=this.props.activePickerPanel)==null?void 0:t.id)===e.id,"data-uppy-super-focusable":!0,onClick:()=>this.props.showPanel(e.id)},u("div",{className:"uppy-DashboardTab-inner"},e.icon()),u("div",{className:"uppy-DashboardTab-name"},e.name)))},this.renderAcquirers=e=>{let t=[...e],r=t.splice(e.length-2,e.length);return u(it,null,t.map(s=>this.renderAcquirer(s)),u("span",{role:"presentation",style:{"white-space":"nowrap"}},r.map(s=>this.renderAcquirer(s))))},this.renderSourcesList=(e,t)=>{let{showNativePhotoCameraButton:r,showNativeVideoCameraButton:s}=this.props,n=[],o="myDevice";t||n.push({key:o,elements:this.renderMyDeviceAcquirer()}),r&&n.push({key:"nativePhotoCameraButton",elements:this.renderPhotoCamera()}),s&&n.push({key:"nativePhotoCameraButton",elements:this.renderVideoCamera()}),n.push(...e.map(d=>({key:d.id,elements:this.renderAcquirer(d)}))),n.length===1&&n[0].key===o&&(n=[]);let l=[...n],c=l.splice(n.length-2,n.length);return u(it,null,this.renderDropPasteBrowseTagline(n.length),u("div",{className:"uppy-Dashboard-AddFiles-list",role:"tablist"},l.map(d=>{let{key:f,elements:g}=d;return u(it,{key:f},g)}),u("span",{role:"presentation",style:{"white-space":"nowrap"}},c.map(d=>{let{key:f,elements:g}=d;return u(it,{key:f},g)}))))}}[Symbol.for("uppy test: disable unused locale key warning")](){this.props.i18nArray("dropPasteBoth"),this.props.i18nArray("dropPasteFiles"),this.props.i18nArray("dropPasteFolders"),this.props.i18nArray("dropPasteImportBoth"),this.props.i18nArray("dropPasteImportFiles"),this.props.i18nArray("dropPasteImportFolders")}renderPoweredByUppy(){let{i18nArray:e}=this.props,t=u("span",null,u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-poweredByIcon",width:"11",height:"11",viewBox:"0 0 11 11"},u("path",{d:"M7.365 10.5l-.01-4.045h2.612L5.5.806l-4.467 5.65h2.604l.01 4.044h3.718z",fillRule:"evenodd"})),u("span",{className:"uppy-Dashboard-poweredByUppy"},"Uppy")),r=e("poweredBy",{uppy:t});return u("a",{tabIndex:-1,href:"https://uppy.io",rel:"noreferrer noopener",target:"_blank",className:"uppy-Dashboard-poweredBy"},r)}render(){let{showNativePhotoCameraButton:e,showNativeVideoCameraButton:t,nativeCameraFacingMode:r}=this.props;return u("div",{className:"uppy-Dashboard-AddFiles"},this.renderHiddenInput(!1,s=>{this.fileInput=s}),this.renderHiddenInput(!0,s=>{this.folderInput=s}),e&&this.renderHiddenCameraInput("photo",r,s=>{this.mobilePhotoFileInput=s}),t&&this.renderHiddenCameraInput("video",r,s=>{this.mobileVideoFileInput=s}),this.renderSourcesList(this.props.acquirers,this.props.disableLocalFiles),u("div",{className:"uppy-Dashboard-AddFiles-info"},this.props.note&&u("div",{className:"uppy-Dashboard-note"},this.props.note),this.props.proudlyDisplayPoweredByUppy&&this.renderPoweredByUppy()))}},Al=ad;var Tv=Te(yt(),1);var jT=i=>u("div",{className:(0,Tv.default)("uppy-Dashboard-AddFilesPanel",i.className),"data-uppy-panelType":"AddFiles","aria-hidden":!i.showAddFilesPanel},u("div",{className:"uppy-DashboardContent-bar"},u("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},i.i18n("addingMoreFiles")),u("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>i.toggleAddFilesPanel(!1)},i.i18n("back"))),u(Al,i)),xv=jT;var kv=Te(yt(),1);function WT(i){let{tagName:e}=i.target;if(e==="INPUT"||e==="TEXTAREA"){i.stopPropagation();return}i.preventDefault(),i.stopPropagation()}var xi=WT;function GT(i){let{activePickerPanel:e,className:t,hideAllPanels:r,i18n:s,state:n,uppy:o}=i,a=vr(null);return u("div",{className:(0,kv.default)("uppy-DashboardContent-panel",t),role:"tabpanel","data-uppy-panelType":"PickerPanel",id:`uppy-DashboardContent-panel--${e.id}`,onDragOver:xi,onDragLeave:xi,onDrop:xi,onPaste:xi},u("div",{className:"uppy-DashboardContent-bar"},u("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},s("importFrom",{name:e.name})),u("button",{className:"uppy-DashboardContent-back",type:"button",onClick:r},s("cancel"))),u("div",{ref:a,className:"uppy-DashboardContent-panelBody"},o.getPlugin(e.id).render(n,a.current)))}var Av=GT;var _v=Te(yt(),1);function KT(i){let e=i.files[i.fileCardFor],t=()=>{i.uppy.emit("file-editor:cancel",e),i.closeFileEditor()};return u("div",{className:(0,_v.default)("uppy-DashboardContent-panel",i.className),role:"tabpanel","data-uppy-panelType":"FileEditor",id:"uppy-DashboardContent-panel--editor"},u("div",{className:"uppy-DashboardContent-bar"},u("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},i.i18nArray("editing",{file:u("span",{className:"uppy-DashboardContent-titleFile"},e.meta?e.meta.name:e.name)})),u("button",{className:"uppy-DashboardContent-back",type:"button",onClick:t},i.i18n("cancel")),u("button",{className:"uppy-DashboardContent-save",type:"button",onClick:i.saveFileEditor},i.i18n("save"))),u("div",{className:"uppy-DashboardContent-panelBody"},i.editors.map(r=>i.uppy.getPlugin(r.id).render(i.state))))}var Cv=KT;var ki={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete",STATE_PAUSED:"paused"};function XT(i,e,t,r){if(r===void 0&&(r={}),i)return ki.STATE_ERROR;if(e)return ki.STATE_COMPLETE;if(t)return ki.STATE_PAUSED;let s=ki.STATE_WAITING,n=Object.keys(r);for(let o=0;o<n.length;o++){let{progress:a}=r[n[o]];if(a.uploadStarted&&!a.uploadComplete)return ki.STATE_UPLOADING;a.preprocess&&s!==ki.STATE_UPLOADING&&(s=ki.STATE_PREPROCESSING),a.postprocess&&s!==ki.STATE_UPLOADING&&s!==ki.STATE_PREPROCESSING&&(s=ki.STATE_POSTPROCESSING)}return s}function YT(i){let{files:e,i18n:t,isAllComplete:r,isAllErrored:s,isAllPaused:n,inProgressNotPausedFiles:o,newFiles:a,processingFiles:l}=i;switch(XT(s,r,n,e)){case"uploading":return t("uploadingXFiles",{smart_count:o.length});case"preprocessing":case"postprocessing":return t("processingXFiles",{smart_count:l.length});case"paused":return t("uploadPaused");case"waiting":return t("xFilesSelected",{smart_count:a.length});case"complete":return t("uploadComplete");case"error":return t("error");default:}}function ZT(i){let{i18n:e,isAllComplete:t,hideCancelButton:r,maxNumberOfFiles:s,toggleAddFilesPanel:n,uppy:o}=i,{allowNewUpload:a}=i;return a&&s&&(a=i.totalFileCount<i.maxNumberOfFiles),u("div",{className:"uppy-DashboardContent-bar"},!t&&!r?u("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>o.cancelAll()},e("cancel")):u("div",null),u("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},u(YT,i)),a?u("button",{className:"uppy-DashboardContent-addMore",type:"button","aria-label":e("addMoreFiles"),title:e("addMoreFiles"),onClick:()=>n(!0)},u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"15",height:"15",viewBox:"0 0 15 15"},u("path",{d:"M8 6.5h6a.5.5 0 0 1 .5.5v.5a.5.5 0 0 1-.5.5H8v6a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V8h-6a.5.5 0 0 1-.5-.5V7a.5.5 0 0 1 .5-.5h6v-6A.5.5 0 0 1 7 0h.5a.5.5 0 0 1 .5.5v6z"})),u("span",{className:"uppy-DashboardContent-addMoreCaption"},e("addMore"))):u("div",null))}var Pv=ZT;var Fv=Te(yt(),1);function ld(i){let{computedMetaFields:e,requiredMetaFields:t,updateMeta:r,form:s,formState:n}=i,o={text:"uppy-u-reset uppy-c-textInput uppy-Dashboard-FileCard-input"};return e.map(a=>{let l=`uppy-Dashboard-FileCard-input-${a.id}`,c=t.includes(a.id);return u("fieldset",{key:a.id,className:"uppy-Dashboard-FileCard-fieldset"},u("label",{className:"uppy-Dashboard-FileCard-label",htmlFor:l},a.name),a.render!==void 0?a.render({value:n[a.id],onChange:d=>r(d,a.id),fieldCSSClasses:o,required:c,form:s.id},u):u("input",{className:o.text,id:l,form:s.id,type:a.type||"text",required:c,value:n[a.id],placeholder:a.placeholder,onInput:d=>r(d.target.value,a.id),"data-uppy-super-focusable":!0}))})}function cd(i){var e;let{files:t,fileCardFor:r,toggleFileCard:s,saveFileCard:n,metaFields:o,requiredMetaFields:a,openFileEditor:l,i18n:c,i18nArray:d,className:f,canEditFile:g}=i,b=()=>typeof o=="function"?o(t[r]):o,w=t[r],P=(e=b())!=null?e:[],R=g(w),C={};P.forEach(M=>{var H;C[M.id]=(H=w.meta[M.id])!=null?H:""});let[k,_]=Xt(C),E=yr(M=>{M.preventDefault(),n(k,r)},[n,k,r]),A=(M,H)=>{_({...k,[H]:M})},F=()=>{s(!1)},[O]=Xt(()=>{let M=document.createElement("form");return M.setAttribute("tabindex","-1"),M.id=gr(),M});return di(()=>(document.body.appendChild(O),O.addEventListener("submit",E),()=>{O.removeEventListener("submit",E),document.body.removeChild(O)}),[O,E]),u("div",{className:(0,Fv.default)("uppy-Dashboard-FileCard",f),"data-uppy-panelType":"FileCard",onDragOver:xi,onDragLeave:xi,onDrop:xi,onPaste:xi},u("div",{className:"uppy-DashboardContent-bar"},u("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},d("editing",{file:u("span",{className:"uppy-DashboardContent-titleFile"},w.meta?w.meta.name:w.name)})),u("button",{className:"uppy-DashboardContent-back",type:"button",form:O.id,title:c("finishEditingFile"),onClick:F},c("cancel"))),u("div",{className:"uppy-Dashboard-FileCard-inner"},u("div",{className:"uppy-Dashboard-FileCard-preview",style:{backgroundColor:ns(w.type).color}},u(bo,{file:w}),R&&u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-FileCard-edit",onClick:M=>{E(M),l(w)}},c("editImage"))),u("div",{className:"uppy-Dashboard-FileCard-info"},u(ld,{computedMetaFields:P,requiredMetaFields:a,updateMeta:A,form:O,formState:k})),u("div",{className:"uppy-Dashboard-FileCard-actions"},u("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Dashboard-FileCard-actionsBtn",type:"submit",form:O.id},c("saveChanges")),u("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link uppy-Dashboard-FileCard-actionsBtn",type:"button",onClick:F,form:O.id},c("cancel")))))}var Rv=Te(yt(),1),Ws="uppy-transition-slideDownUp",Ov=250;function QT(i){let{children:e}=i,[t,r]=Xt(null),[s,n]=Xt(""),o=vr(),a=vr(),l=vr(),c=()=>{n(`${Ws}-enter`),cancelAnimationFrame(l.current),clearTimeout(a.current),a.current=void 0,l.current=requestAnimationFrame(()=>{n(`${Ws}-enter ${Ws}-enter-active`),o.current=setTimeout(()=>{n("")},Ov)})},d=()=>{n(`${Ws}-leave`),cancelAnimationFrame(l.current),clearTimeout(o.current),o.current=void 0,l.current=requestAnimationFrame(()=>{n(`${Ws}-leave ${Ws}-leave-active`),a.current=setTimeout(()=>{r(null),n("")},Ov)})};return di(()=>{let f=Ct(e)[0];t!==f&&(f&&!t?c():t&&!f&&!a.current&&d(),r(f))},[e,t]),di(()=>()=>{clearTimeout(o.current),clearTimeout(a.current),cancelAnimationFrame(l.current)},[]),t?jn(t,{className:(0,Rv.default)(s,t.props.className)}):null}var So=QT;function Gs(){return Gs=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},Gs.apply(null,arguments)}var Lv=900,Mv=700,ud=576,Iv=330;function hd(i){let e=i.totalFileCount===0,t=i.totalFileCount===1,r=i.containerWidth>ud,s=i.containerHeight>Iv,n=(0,Dv.default)({"uppy-Dashboard":!0,"uppy-Dashboard--isDisabled":i.disabled,"uppy-Dashboard--animateOpenClose":i.animateOpenClose,"uppy-Dashboard--isClosing":i.isClosing,"uppy-Dashboard--isDraggingOver":i.isDraggingOver,"uppy-Dashboard--modal":!i.inline,"uppy-size--md":i.containerWidth>ud,"uppy-size--lg":i.containerWidth>Mv,"uppy-size--xl":i.containerWidth>Lv,"uppy-size--height-md":i.containerHeight>Iv,"uppy-Dashboard--isAddFilesPanelVisible":i.showAddFilesPanel,"uppy-Dashboard--isInnerWrapVisible":i.areInsidesReadyToBeVisible,"uppy-Dashboard--singleFile":i.singleFileFullScreen&&t&&s}),o=1;i.containerWidth>Lv?o=5:i.containerWidth>Mv?o=4:i.containerWidth>ud&&(o=3);let a=i.showSelectedFiles&&!e,l=i.recoveredState?Object.keys(i.recoveredState.files).length:null,c=i.files?Object.keys(i.files).filter(g=>i.files[g].isGhost).length:0,d=()=>c>0?i.i18n("recoveredXFiles",{smart_count:c}):i.i18n("recoveredAllFiles");return u("div",{className:n,"data-uppy-theme":i.theme,"data-uppy-num-acquirers":i.acquirers.length,"data-uppy-drag-drop-supported":!i.disableLocalFiles&&Zh(),"aria-hidden":i.inline?"false":i.isHidden,"aria-disabled":i.disabled,"aria-label":i.inline?i.i18n("dashboardTitle"):i.i18n("dashboardWindowTitle"),onPaste:i.handlePaste,onDragOver:i.handleDragOver,onDragLeave:i.handleDragLeave,onDrop:i.handleDrop},u("div",{"aria-hidden":"true",className:"uppy-Dashboard-overlay",tabIndex:-1,onClick:i.handleClickOutside}),u("div",{className:"uppy-Dashboard-inner","aria-modal":!i.inline&&"true",role:i.inline?void 0:"dialog",style:{width:i.inline&&i.width?i.width:"",height:i.inline&&i.height?i.height:""}},i.inline?null:u("button",{className:"uppy-u-reset uppy-Dashboard-close",type:"button","aria-label":i.i18n("closeModal"),title:i.i18n("closeModal"),onClick:i.closeModal},u("span",{"aria-hidden":"true"},"\xD7")),u("div",{className:"uppy-Dashboard-innerWrap"},u("div",{className:"uppy-Dashboard-dropFilesHereHint"},i.i18n("dropHint")),a&&u(Pv,i),l&&u("div",{className:"uppy-Dashboard-serviceMsg"},u("svg",{className:"uppy-Dashboard-serviceMsg-icon","aria-hidden":"true",focusable:"false",width:"21",height:"16",viewBox:"0 0 24 19"},u("g",{transform:"translate(0 -1)",fill:"none",fillRule:"evenodd"},u("path",{d:"M12.857 1.43l10.234 17.056A1 1 0 0122.234 20H1.766a1 1 0 01-.857-1.514L11.143 1.429a1 1 0 011.714 0z",fill:"#FFD300"}),u("path",{fill:"#000",d:"M11 6h2l-.3 8h-1.4z"}),u("circle",{fill:"#000",cx:"12",cy:"17",r:"1"}))),u("strong",{className:"uppy-Dashboard-serviceMsg-title"},i.i18n("sessionRestored")),u("div",{className:"uppy-Dashboard-serviceMsg-text"},d())),a?u(od,{id:i.id,i18n:i.i18n,uppy:i.uppy,files:i.files,resumableUploads:i.resumableUploads,hideRetryButton:i.hideRetryButton,hidePauseResumeButton:i.hidePauseResumeButton,hideCancelButton:i.hideCancelButton,showLinkToFileUploadResult:i.showLinkToFileUploadResult,showRemoveButtonAfterComplete:i.showRemoveButtonAfterComplete,metaFields:i.metaFields,toggleFileCard:i.toggleFileCard,handleRequestThumbnail:i.handleRequestThumbnail,handleCancelThumbnail:i.handleCancelThumbnail,recoveredState:i.recoveredState,individualCancellation:i.individualCancellation,openFileEditor:i.openFileEditor,canEditFile:i.canEditFile,toggleAddFilesPanel:i.toggleAddFilesPanel,isSingleFile:t,itemsPerRow:o,containerWidth:i.containerWidth,containerHeight:i.containerHeight}):u(Al,{i18n:i.i18n,i18nArray:i.i18nArray,acquirers:i.acquirers,handleInputChange:i.handleInputChange,maxNumberOfFiles:i.maxNumberOfFiles,allowedFileTypes:i.allowedFileTypes,showNativePhotoCameraButton:i.showNativePhotoCameraButton,showNativeVideoCameraButton:i.showNativeVideoCameraButton,nativeCameraFacingMode:i.nativeCameraFacingMode,showPanel:i.showPanel,activePickerPanel:i.activePickerPanel,disableLocalFiles:i.disableLocalFiles,fileManagerSelectionType:i.fileManagerSelectionType,note:i.note,proudlyDisplayPoweredByUppy:i.proudlyDisplayPoweredByUppy}),u(So,null,i.showAddFilesPanel?u(xv,Gs({key:"AddFiles"},i,{isSizeMD:r})):null),u(So,null,i.fileCardFor?u(cd,Gs({key:"FileCard"},i)):null),u(So,null,i.activePickerPanel?u(Av,Gs({key:"Picker"},i)):null),u(So,null,i.showFileEditor?u(Cv,Gs({key:"Editor"},i)):null),u("div",{className:"uppy-Dashboard-progressindicators"},i.progressindicators.map(g=>i.uppy.getPlugin(g.id).render(i.state))))))}var Nv={strings:{closeModal:"Close Modal",addMoreFiles:"Add more files",addingMoreFiles:"Adding more files",importFrom:"Import from %{name}",dashboardWindowTitle:"Uppy Dashboard Window (Press escape to close)",dashboardTitle:"Uppy Dashboard",copyLinkToClipboardSuccess:"Link copied to clipboard.",copyLinkToClipboardFallback:"Copy the URL below",copyLink:"Copy link",back:"Back",removeFile:"Remove file",editFile:"Edit file",editImage:"Edit image",editing:"Editing %{file}",error:"Error",finishEditingFile:"Finish editing file",saveChanges:"Save changes",myDevice:"My Device",dropHint:"Drop your files here",uploadComplete:"Upload complete",uploadPaused:"Upload paused",resumeUpload:"Resume upload",pauseUpload:"Pause upload",retryUpload:"Retry upload",cancelUpload:"Cancel upload",xFilesSelected:{0:"%{smart_count} file selected",1:"%{smart_count} files selected"},uploadingXFiles:{0:"Uploading %{smart_count} file",1:"Uploading %{smart_count} files"},processingXFiles:{0:"Processing %{smart_count} file",1:"Processing %{smart_count} files"},poweredBy:"Powered by %{uppy}",addMore:"Add more",editFileWithFilename:"Edit file %{file}",save:"Save",cancel:"Cancel",dropPasteFiles:"Drop files here or %{browseFiles}",dropPasteFolders:"Drop files here or %{browseFolders}",dropPasteBoth:"Drop files here, %{browseFiles} or %{browseFolders}",dropPasteImportFiles:"Drop files here, %{browseFiles} or import from:",dropPasteImportFolders:"Drop files here, %{browseFolders} or import from:",dropPasteImportBoth:"Drop files here, %{browseFiles}, %{browseFolders} or import from:",importFiles:"Import files from:",browseFiles:"browse files",browseFolders:"browse folders",recoveredXFiles:{0:"We could not fully recover 1 file. Please re-select it and resume the upload.",1:"We could not fully recover %{smart_count} files. Please re-select them and resume the upload."},recoveredAllFiles:"We restored all files. You can now resume the upload.",sessionRestored:"Session restored",reSelect:"Re-select",missingRequiredMetaFields:{0:"Missing required meta field: %{fields}.",1:"Missing required meta fields: %{fields}."},takePictureBtn:"Take Picture",recordVideoBtn:"Record Video"}};function re(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var JT=0;function rt(i){return"__private_"+JT+++"_"+i}var ex={version:"4.3.4"},dd=Kh.default||Kh,Bv=9,tx=27;function Uv(){let i={};return i.promise=new Promise((e,t)=>{i.resolve=e,i.reject=t}),i}var ix={target:"body",metaFields:[],thumbnailWidth:280,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,defaultPickerIcon:go,showLinkToFileUploadResult:!1,showProgressDetails:!1,hideUploadButton:!1,hideCancelButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideProgressAfterFinish:!1,note:null,singleFileFullScreen:!0,disableStatusBar:!1,disableInformer:!1,disableThumbnailGenerator:!1,fileManagerSelectionType:"files",proudlyDisplayPoweredByUppy:!0,showSelectedFiles:!0,showRemoveButtonAfterComplete:!1,showNativePhotoCameraButton:!1,showNativeVideoCameraButton:!1,theme:"light",autoOpen:null,disabled:!1,disableLocalFiles:!1,nativeCameraFacingMode:"",onDragLeave:()=>{},onDragOver:()=>{},onDrop:()=>{},plugins:[],doneButtonHandler:void 0,onRequestCloseModal:null,inline:!1,animateOpenClose:!0,browserBackButtonClose:!1,closeAfterFinish:!1,closeModalOnClickOutside:!1,disablePageScrollWhenModalOpen:!0,trigger:null,width:750,height:550},os=rt("disabledNodes"),Yi=rt("generateLargeThumbnailIfSingleFile"),Eo=rt("openFileEditorWhenFilesAdded"),as=rt("attachRenderFunctionToTarget"),pd=rt("isTargetSupported"),fd=rt("getAcquirers"),md=rt("getProgressIndicators"),Zi=rt("getEditors"),gd=rt("addSpecifiedPluginsFromOptions"),vd=rt("autoDiscoverPlugins"),ls=rt("addSupportedPluginIfNoTarget"),To=rt("getStatusBarOpts"),xo=rt("getThumbnailGeneratorOpts"),bd=rt("getInformerOpts"),ko=rt("getStatusBarId"),Ao=rt("getThumbnailGeneratorId"),yd=rt("getInformerId"),xr=class extends pi{constructor(e,t){var r,s,n;let o=(r=t?.autoOpen)!=null?r:null;super(e,{...ix,...t,autoOpen:o}),Object.defineProperty(this,yd,{value:lx}),Object.defineProperty(this,Ao,{value:ax}),Object.defineProperty(this,ko,{value:ox}),Object.defineProperty(this,bd,{value:nx}),Object.defineProperty(this,xo,{value:sx}),Object.defineProperty(this,To,{value:rx}),Object.defineProperty(this,os,{writable:!0,value:void 0}),this.modalName=`uppy-Dashboard-${gr()}`,this.superFocus=Yh(),this.ifFocusedOnUppyRecently=!1,this.removeTarget=a=>{let c=this.getPluginState().targets.filter(d=>d.id!==a.id);this.setPluginState({targets:c})},this.addTarget=a=>{let l=a.id||a.constructor.name,c=a.title||l,d=a.type;if(d!=="acquirer"&&d!=="progressindicator"&&d!=="editor")return this.uppy.log("Dashboard: can only be targeted by plugins of types: acquirer, progressindicator, editor","error"),null;let f={id:l,name:c,type:d},b=this.getPluginState().targets.slice();return b.push(f),this.setPluginState({targets:b}),this.el},this.hideAllPanels=()=>{var a;let l=this.getPluginState(),c={activePickerPanel:void 0,showAddFilesPanel:!1,activeOverlayType:null,fileCardFor:null,showFileEditor:!1};l.activePickerPanel===c.activePickerPanel&&l.showAddFilesPanel===c.showAddFilesPanel&&l.showFileEditor===c.showFileEditor&&l.activeOverlayType===c.activeOverlayType||(this.setPluginState(c),this.uppy.emit("dashboard:close-panel",(a=l.activePickerPanel)==null?void 0:a.id))},this.showPanel=a=>{let{targets:l}=this.getPluginState(),c=l.find(d=>d.type==="acquirer"&&d.id===a);this.setPluginState({activePickerPanel:c,activeOverlayType:"PickerPanel"}),this.uppy.emit("dashboard:show-panel",a)},this.canEditFile=a=>{let{targets:l}=this.getPluginState();return re(this,Zi)[Zi](l).some(d=>this.uppy.getPlugin(d.id).canEditFile(a))},this.openFileEditor=a=>{let{targets:l}=this.getPluginState(),c=re(this,Zi)[Zi](l);this.setPluginState({showFileEditor:!0,fileCardFor:a.id||null,activeOverlayType:"FileEditor"}),c.forEach(d=>{this.uppy.getPlugin(d.id).selectFile(a)})},this.closeFileEditor=()=>{let{metaFields:a}=this.getPluginState();a&&a.length>0?this.setPluginState({showFileEditor:!1,activeOverlayType:"FileCard"}):this.setPluginState({showFileEditor:!1,fileCardFor:null,activeOverlayType:"AddFiles"})},this.saveFileEditor=()=>{let{targets:a}=this.getPluginState();re(this,Zi)[Zi](a).forEach(c=>{this.uppy.getPlugin(c.id).save()}),this.closeFileEditor()},this.openModal=()=>{let{promise:a,resolve:l}=Uv();if(this.savedScrollPosition=window.pageYOffset,this.savedActiveElement=document.activeElement,this.opts.disablePageScrollWhenModalOpen&&document.body.classList.add("uppy-Dashboard-isFixed"),this.opts.animateOpenClose&&this.getPluginState().isClosing){let c=()=>{this.setPluginState({isHidden:!1}),this.el.removeEventListener("animationend",c,!1),l()};this.el.addEventListener("animationend",c,!1)}else this.setPluginState({isHidden:!1}),l();return this.opts.browserBackButtonClose&&this.updateBrowserHistory(),document.addEventListener("keydown",this.handleKeyDownInModal),this.uppy.emit("dashboard:modal-open"),a},this.closeModal=a=>{var l;let c=(l=a?.manualClose)!=null?l:!0,{isHidden:d,isClosing:f}=this.getPluginState();if(d||f)return;let{promise:g,resolve:b}=Uv();if(this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.opts.animateOpenClose){this.setPluginState({isClosing:!0});let P=()=>{this.setPluginState({isHidden:!0,isClosing:!1}),this.superFocus.cancel(),this.savedActiveElement.focus(),this.el.removeEventListener("animationend",P,!1),b()};this.el.addEventListener("animationend",P,!1)}else this.setPluginState({isHidden:!0}),this.superFocus.cancel(),this.savedActiveElement.focus(),b();if(document.removeEventListener("keydown",this.handleKeyDownInModal),c&&this.opts.browserBackButtonClose){var w;(w=history.state)!=null&&w[this.modalName]&&history.back()}return this.uppy.emit("dashboard:modal-closed"),g},this.isModalOpen=()=>!this.getPluginState().isHidden||!1,this.requestCloseModal=()=>this.opts.onRequestCloseModal?this.opts.onRequestCloseModal():this.closeModal(),this.setDarkModeCapability=a=>{let{capabilities:l}=this.uppy.getState();this.uppy.setState({capabilities:{...l,darkMode:a}})},this.handleSystemDarkModeChange=a=>{let l=a.matches;this.uppy.log(`[Dashboard] Dark mode is ${l?"on":"off"}`),this.setDarkModeCapability(l)},this.toggleFileCard=(a,l)=>{let c=this.uppy.getFile(l);a?this.uppy.emit("dashboard:file-edit-start",c):this.uppy.emit("dashboard:file-edit-complete",c),this.setPluginState({fileCardFor:a?l:null,activeOverlayType:a?"FileCard":null})},this.toggleAddFilesPanel=a=>{this.setPluginState({showAddFilesPanel:a,activeOverlayType:a?"AddFiles":null})},this.addFiles=a=>{let l=a.map(c=>({source:this.id,name:c.name,type:c.type,data:c,meta:{relativePath:c.relativePath||c.webkitRelativePath||null}}));try{this.uppy.addFiles(l)}catch(c){this.uppy.log(c)}},this.startListeningToResize=()=>{this.resizeObserver=new ResizeObserver(a=>{let l=a[0],{width:c,height:d}=l.contentRect;this.setPluginState({containerWidth:c,containerHeight:d,areInsidesReadyToBeVisible:!0})}),this.resizeObserver.observe(this.el.querySelector(".uppy-Dashboard-inner")),this.makeDashboardInsidesVisibleAnywayTimeout=setTimeout(()=>{let a=this.getPluginState(),l=!this.opts.inline&&a.isHidden;!a.areInsidesReadyToBeVisible&&!l&&(this.uppy.log("[Dashboard] resize event didn\u2019t fire on time: defaulted to mobile layout","warning"),this.setPluginState({areInsidesReadyToBeVisible:!0}))},1e3)},this.stopListeningToResize=()=>{this.resizeObserver.disconnect(),clearTimeout(this.makeDashboardInsidesVisibleAnywayTimeout)},this.recordIfFocusedOnUppyRecently=a=>{this.el.contains(a.target)?this.ifFocusedOnUppyRecently=!0:(this.ifFocusedOnUppyRecently=!1,this.superFocus.cancel())},this.disableInteractiveElements=a=>{var l;let c=["a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])",'[role="button"]:not([disabled])'],d=(l=re(this,os)[os])!=null?l:Er(this.el.querySelectorAll(c)).filter(f=>!f.classList.contains("uppy-Dashboard-close"));for(let f of d)f.tagName==="A"?f.setAttribute("aria-disabled",a):f.disabled=a;a?re(this,os)[os]=d:re(this,os)[os]=null,this.dashboardIsDisabled=a},this.updateBrowserHistory=()=>{var a;(a=history.state)!=null&&a[this.modalName]||history.pushState({...history.state,[this.modalName]:!0},""),window.addEventListener("popstate",this.handlePopState,!1)},this.handlePopState=a=>{var l;this.isModalOpen()&&(!a.state||!a.state[this.modalName])&&this.closeModal({manualClose:!1}),!this.isModalOpen()&&(l=a.state)!=null&&l[this.modalName]&&history.back()},this.handleKeyDownInModal=a=>{a.keyCode===tx&&this.requestCloseModal(),a.keyCode===Bv&&Xh(a,this.getPluginState().activeOverlayType,this.el)},this.handleClickOutside=()=>{this.opts.closeModalOnClickOutside&&this.requestCloseModal()},this.handlePaste=a=>{this.uppy.iteratePlugins(c=>{c.type==="acquirer"&&(c.handleRootPaste==null||c.handleRootPaste(a))});let l=Er(a.clipboardData.files);l.length>0&&(this.uppy.log("[Dashboard] Files pasted"),this.addFiles(l))},this.handleInputChange=a=>{a.preventDefault();let l=Er(a.currentTarget.files||[]);l.length>0&&(this.uppy.log("[Dashboard] Files selected through input"),this.addFiles(l))},this.handleDragOver=a=>{a.preventDefault(),a.stopPropagation();let l=()=>{let g=!0;return this.uppy.iteratePlugins(b=>{b.canHandleRootDrop!=null&&b.canHandleRootDrop(a)&&(g=!0)}),g},c=()=>{let{types:g}=a.dataTransfer;return g.some(b=>b==="Files")},d=l(),f=c();if(!d&&!f||this.opts.disabled||this.opts.disableLocalFiles&&(f||!d)||!this.uppy.getState().allowNewUpload){a.dataTransfer.dropEffect="none";return}a.dataTransfer.dropEffect="copy",this.setPluginState({isDraggingOver:!0}),this.opts.onDragOver(a)},this.handleDragLeave=a=>{a.preventDefault(),a.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.opts.onDragLeave(a)},this.handleDrop=async a=>{a.preventDefault(),a.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.uppy.iteratePlugins(f=>{f.type==="acquirer"&&(f.handleRootDrop==null||f.handleRootDrop(a))});let l=!1,c=f=>{this.uppy.log(f,"error"),l||(this.uppy.info(f.message,"error"),l=!0)};this.uppy.log("[Dashboard] Processing dropped files");let d=await Rh(a.dataTransfer,{logDropError:c});d.length>0&&(this.uppy.log("[Dashboard] Files dropped"),this.addFiles(d)),this.opts.onDrop(a)},this.handleRequestThumbnail=a=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:request",a)},this.handleCancelThumbnail=a=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:cancel",a)},this.handleKeyDownInInline=a=>{a.keyCode===Bv&&vv(a,this.getPluginState().activeOverlayType,this.el)},this.handlePasteOnBody=a=>{this.el.contains(document.activeElement)&&this.handlePaste(a)},this.handleComplete=a=>{let{failed:l}=a;this.opts.closeAfterFinish&&!(l!=null&&l.length)&&this.requestCloseModal()},this.handleCancelRestore=()=>{this.uppy.emit("restore-canceled")},Object.defineProperty(this,Yi,{writable:!0,value:()=>{if(this.opts.disableThumbnailGenerator)return;let a=600,l=this.uppy.getFiles();if(l.length===1){let c=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);c?.setOptions({thumbnailWidth:a});let d={...l[0],preview:void 0};c?.requestThumbnail(d).then(()=>{c?.setOptions({thumbnailWidth:this.opts.thumbnailWidth})})}}}),Object.defineProperty(this,Eo,{writable:!0,value:a=>{let l=a[0],{metaFields:c}=this.getPluginState(),d=c&&c.length>0,f=this.canEditFile(l);d&&this.opts.autoOpen==="metaEditor"?this.toggleFileCard(!0,l.id):f&&this.opts.autoOpen==="imageEditor"&&this.openFileEditor(l)}}),this.initEvents=()=>{if(this.opts.trigger&&!this.opts.inline){let a=Ph(this.opts.trigger);a?a.forEach(l=>l.addEventListener("click",this.openModal)):this.uppy.log("Dashboard modal trigger not found. Make sure `trigger` is set in Dashboard options, unless you are planning to call `dashboard.openModal()` method yourself","warning")}this.startListeningToResize(),document.addEventListener("paste",this.handlePasteOnBody),this.uppy.on("plugin-added",re(this,ls)[ls]),this.uppy.on("plugin-remove",this.removeTarget),this.uppy.on("file-added",this.hideAllPanels),this.uppy.on("dashboard:modal-closed",this.hideAllPanels),this.uppy.on("complete",this.handleComplete),this.uppy.on("files-added",re(this,Yi)[Yi]),this.uppy.on("file-removed",re(this,Yi)[Yi]),document.addEventListener("focus",this.recordIfFocusedOnUppyRecently,!0),document.addEventListener("click",this.recordIfFocusedOnUppyRecently,!0),this.opts.inline&&this.el.addEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.on("files-added",re(this,Eo)[Eo])},this.removeEvents=()=>{let a=Ph(this.opts.trigger);!this.opts.inline&&a&&a.forEach(l=>l.removeEventListener("click",this.openModal)),this.stopListeningToResize(),document.removeEventListener("paste",this.handlePasteOnBody),window.removeEventListener("popstate",this.handlePopState,!1),this.uppy.off("plugin-added",re(this,ls)[ls]),this.uppy.off("plugin-remove",this.removeTarget),this.uppy.off("file-added",this.hideAllPanels),this.uppy.off("dashboard:modal-closed",this.hideAllPanels),this.uppy.off("complete",this.handleComplete),this.uppy.off("files-added",re(this,Yi)[Yi]),this.uppy.off("file-removed",re(this,Yi)[Yi]),document.removeEventListener("focus",this.recordIfFocusedOnUppyRecently),document.removeEventListener("click",this.recordIfFocusedOnUppyRecently),this.opts.inline&&this.el.removeEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.off("files-added",re(this,Eo)[Eo])},this.superFocusOnEachUpdate=()=>{let a=this.el.contains(document.activeElement),l=document.activeElement===document.body||document.activeElement===null,c=this.uppy.getState().info.length===0,d=!this.opts.inline;c&&(d||a||l&&this.ifFocusedOnUppyRecently)?this.superFocus(this.el,this.getPluginState().activeOverlayType):this.superFocus.cancel()},this.afterUpdate=()=>{if(this.opts.disabled&&!this.dashboardIsDisabled){this.disableInteractiveElements(!0);return}!this.opts.disabled&&this.dashboardIsDisabled&&this.disableInteractiveElements(!1),this.superFocusOnEachUpdate()},this.saveFileCard=(a,l)=>{this.uppy.setFileMeta(l,a),this.toggleFileCard(!1,l)},Object.defineProperty(this,as,{writable:!0,value:a=>{let l=this.uppy.getPlugin(a.id);return{...a,icon:l.icon||this.opts.defaultPickerIcon,render:l.render}}}),Object.defineProperty(this,pd,{writable:!0,value:a=>{let l=this.uppy.getPlugin(a.id);return typeof l.isSupported!="function"?!0:l.isSupported()}}),Object.defineProperty(this,fd,{writable:!0,value:dd(a=>a.filter(l=>l.type==="acquirer"&&re(this,pd)[pd](l)).map(re(this,as)[as]))}),Object.defineProperty(this,md,{writable:!0,value:dd(a=>a.filter(l=>l.type==="progressindicator").map(re(this,as)[as]))}),Object.defineProperty(this,Zi,{writable:!0,value:dd(a=>a.filter(l=>l.type==="editor").map(re(this,as)[as]))}),this.render=a=>{let l=this.getPluginState(),{files:c,capabilities:d,allowNewUpload:f}=a,{newFiles:g,uploadStartedFiles:b,completeFiles:w,erroredFiles:P,inProgressFiles:R,inProgressNotPausedFiles:C,processingFiles:k,isUploadStarted:_,isAllComplete:E,isAllPaused:A}=this.uppy.getObjectOfFilesPerState(),F=re(this,fd)[fd](l.targets),O=re(this,md)[md](l.targets),M=re(this,Zi)[Zi](l.targets),H;return this.opts.theme==="auto"?H=d.darkMode?"dark":"light":H=this.opts.theme,["files","folders","both"].indexOf(this.opts.fileManagerSelectionType)<0&&(this.opts.fileManagerSelectionType="files",console.warn(`Unsupported option for "fileManagerSelectionType". Using default of "${this.opts.fileManagerSelectionType}".`)),hd({state:a,isHidden:l.isHidden,files:c,newFiles:g,uploadStartedFiles:b,completeFiles:w,erroredFiles:P,inProgressFiles:R,inProgressNotPausedFiles:C,processingFiles:k,isUploadStarted:_,isAllComplete:E,isAllPaused:A,totalFileCount:Object.keys(c).length,totalProgress:a.totalProgress,allowNewUpload:f,acquirers:F,theme:H,disabled:this.opts.disabled,disableLocalFiles:this.opts.disableLocalFiles,direction:this.opts.direction,activePickerPanel:l.activePickerPanel,showFileEditor:l.showFileEditor,saveFileEditor:this.saveFileEditor,closeFileEditor:this.closeFileEditor,disableInteractiveElements:this.disableInteractiveElements,animateOpenClose:this.opts.animateOpenClose,isClosing:l.isClosing,progressindicators:O,editors:M,autoProceed:this.uppy.opts.autoProceed,id:this.id,closeModal:this.requestCloseModal,handleClickOutside:this.handleClickOutside,handleInputChange:this.handleInputChange,handlePaste:this.handlePaste,inline:this.opts.inline,showPanel:this.showPanel,hideAllPanels:this.hideAllPanels,i18n:this.i18n,i18nArray:this.i18nArray,uppy:this.uppy,note:this.opts.note,recoveredState:a.recoveredState,metaFields:l.metaFields,resumableUploads:d.resumableUploads||!1,individualCancellation:d.individualCancellation,isMobileDevice:d.isMobileDevice,fileCardFor:l.fileCardFor,toggleFileCard:this.toggleFileCard,toggleAddFilesPanel:this.toggleAddFilesPanel,showAddFilesPanel:l.showAddFilesPanel,saveFileCard:this.saveFileCard,openFileEditor:this.openFileEditor,canEditFile:this.canEditFile,width:this.opts.width,height:this.opts.height,showLinkToFileUploadResult:this.opts.showLinkToFileUploadResult,fileManagerSelectionType:this.opts.fileManagerSelectionType,proudlyDisplayPoweredByUppy:this.opts.proudlyDisplayPoweredByUppy,hideCancelButton:this.opts.hideCancelButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,showRemoveButtonAfterComplete:this.opts.showRemoveButtonAfterComplete,containerWidth:l.containerWidth,containerHeight:l.containerHeight,areInsidesReadyToBeVisible:l.areInsidesReadyToBeVisible,parentElement:this.el,allowedFileTypes:this.uppy.opts.restrictions.allowedFileTypes,maxNumberOfFiles:this.uppy.opts.restrictions.maxNumberOfFiles,requiredMetaFields:this.uppy.opts.restrictions.requiredMetaFields,showSelectedFiles:this.opts.showSelectedFiles,showNativePhotoCameraButton:this.opts.showNativePhotoCameraButton,showNativeVideoCameraButton:this.opts.showNativeVideoCameraButton,nativeCameraFacingMode:this.opts.nativeCameraFacingMode,singleFileFullScreen:this.opts.singleFileFullScreen,handleCancelRestore:this.handleCancelRestore,handleRequestThumbnail:this.handleRequestThumbnail,handleCancelThumbnail:this.handleCancelThumbnail,isDraggingOver:l.isDraggingOver,handleDragOver:this.handleDragOver,handleDragLeave:this.handleDragLeave,handleDrop:this.handleDrop})},Object.defineProperty(this,gd,{writable:!0,value:()=>{let{plugins:a}=this.opts;a.forEach(l=>{let c=this.uppy.getPlugin(l);c?c.mount(this,c):this.uppy.log(`[Uppy] Dashboard could not find plugin '${l}', make sure to uppy.use() the plugins you are specifying`,"warning")})}}),Object.defineProperty(this,vd,{writable:!0,value:()=>{this.uppy.iteratePlugins(re(this,ls)[ls])}}),Object.defineProperty(this,ls,{writable:!0,value:a=>{var l;let c=["acquirer","editor"];a&&!((l=a.opts)!=null&&l.target)&&c.includes(a.type)&&(this.getPluginState().targets.some(f=>a.id===f.id)||a.mount(this,a))}}),this.install=()=>{this.setPluginState({isHidden:!0,fileCardFor:null,activeOverlayType:null,showAddFilesPanel:!1,activePickerPanel:void 0,showFileEditor:!1,metaFields:this.opts.metaFields,targets:[],areInsidesReadyToBeVisible:!1,isDraggingOver:!1});let{inline:a,closeAfterFinish:l}=this.opts;if(a&&l)throw new Error("[Dashboard] `closeAfterFinish: true` cannot be used on an inline Dashboard, because an inline Dashboard cannot be closed at all. Either set `inline: false`, or disable the `closeAfterFinish` option.");let{allowMultipleUploads:c,allowMultipleUploadBatches:d}=this.uppy.opts;(c||d)&&l&&this.uppy.log("[Dashboard] When using `closeAfterFinish`, we recommended setting the `allowMultipleUploadBatches` option to `false` in the Uppy constructor. See https://uppy.io/docs/uppy/#allowMultipleUploads-true","warning");let{target:f}=this.opts;f&&this.mount(f,this),this.opts.disableStatusBar||this.uppy.use(Qr,{id:re(this,ko)[ko](),target:this,...re(this,To)[To]()}),this.opts.disableInformer||this.uppy.use(Jr,{id:re(this,yd)[yd](),target:this,...re(this,bd)[bd]()}),this.opts.disableThumbnailGenerator||this.uppy.use(Hs,{id:re(this,Ao)[Ao](),...re(this,xo)[xo]()}),this.darkModeMediaQuery=typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null;let g=this.darkModeMediaQuery?this.darkModeMediaQuery.matches:!1;if(this.uppy.log(`[Dashboard] Dark mode is ${g?"on":"off"}`),this.setDarkModeCapability(g),this.opts.theme==="auto"){var b;(b=this.darkModeMediaQuery)==null||b.addListener(this.handleSystemDarkModeChange)}re(this,gd)[gd](),re(this,vd)[vd](),this.initEvents()},this.uninstall=()=>{if(!this.opts.disableInformer){let c=this.uppy.getPlugin(`${this.id}:Informer`);c&&this.uppy.removePlugin(c)}if(!this.opts.disableStatusBar){let c=this.uppy.getPlugin(`${this.id}:StatusBar`);c&&this.uppy.removePlugin(c)}if(!this.opts.disableThumbnailGenerator){let c=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);c&&this.uppy.removePlugin(c)}let{plugins:a}=this.opts;if(a.forEach(c=>{let d=this.uppy.getPlugin(c);d&&d.unmount()}),this.opts.theme==="auto"){var l;(l=this.darkModeMediaQuery)==null||l.removeListener(this.handleSystemDarkModeChange)}this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.unmount(),this.removeEvents()},this.id=this.opts.id||"Dashboard",this.title="Dashboard",this.type="orchestrator",this.defaultLocale=Nv,this.opts.doneButtonHandler===void 0&&(this.opts.doneButtonHandler=()=>{this.uppy.clear(),this.requestCloseModal()}),(n=(s=this.opts).onRequestCloseModal)!=null||(s.onRequestCloseModal=()=>this.closeModal()),this.i18nInit()}setOptions(e){var t,r;super.setOptions(e),(t=this.uppy.getPlugin(re(this,ko)[ko]()))==null||t.setOptions(re(this,To)[To]()),(r=this.uppy.getPlugin(re(this,Ao)[Ao]()))==null||r.setOptions(re(this,xo)[xo]())}};function rx(){let{hideUploadButton:i,hideRetryButton:e,hidePauseResumeButton:t,hideCancelButton:r,showProgressDetails:s,hideProgressAfterFinish:n,locale:o,doneButtonHandler:a}=this.opts;return{hideUploadButton:i,hideRetryButton:e,hidePauseResumeButton:t,hideCancelButton:r,showProgressDetails:s,hideAfterFinish:n,locale:o,doneButtonHandler:a}}function sx(){let{thumbnailWidth:i,thumbnailHeight:e,thumbnailType:t,waitForThumbnailsBeforeUpload:r}=this.opts;return{thumbnailWidth:i,thumbnailHeight:e,thumbnailType:t,waitForThumbnailsBeforeUpload:r,lazy:!r}}function nx(){return{}}function ox(){return`${this.id}:StatusBar`}function ax(){return`${this.id}:ThumbnailGenerator`}function lx(){return`${this.id}:Informer`}xr.VERSION=ex.version;var jv=Te(zv(),1);function cx(i,e){let t=i.width/e.width,r=i.height/e.height,s=Math.min(t,r),n=e.width*s,o=e.height*s,a=(i.width-n)/2,l=(i.height-o)/2;return{width:n,height:o,left:a,top:l}}var Hv=cx;function ux(i){return i*(Math.PI/180)}function hx(i,e,t){let r=Math.abs(ux(t));return Math.max((Math.sin(r)*i+Math.cos(r)*e)/e,(Math.sin(r)*e+Math.cos(r)*i)/i)}var $v=hx;function dx(i,e,t){return e.left<i.left?{left:i.left,width:t.width}:e.top<i.top?{top:i.top,height:t.height}:e.left+e.width>i.left+i.width?{left:i.left+i.width-t.width,width:t.width}:e.top+e.height>i.top+i.height?{top:i.top+i.height-t.height,height:t.height}:null}var qv=dx;function px(i,e,t){return e.left<i.left?{left:i.left,width:t.left+t.width-i.left}:e.top<i.top?{top:i.top,height:t.top+t.height-i.top}:e.left+e.width>i.left+i.width?{left:t.left,width:i.left+i.width-t.left}:e.top+e.height>i.top+i.height?{top:t.top,height:i.top+i.height-t.top}:null}var Vv=px;var _o=class extends ke{constructor(e){super(e),this.onRotate90Deg=()=>{let{angle90Deg:t}=this.state,r=t-90;this.setState({angle90Deg:r,angleGranular:0}),this.cropper.scale(1),this.cropper.rotateTo(r);let s=this.cropper.getCanvasData(),n=this.cropper.getContainerData(),o=Hv(n,s);this.cropper.setCanvasData(o),this.cropper.setCropBoxData(o)},this.onRotateGranular=t=>{let r=Number(t.target.value);this.setState({angleGranular:r});let{angle90Deg:s}=this.state,n=s+r;this.cropper.rotateTo(n);let o=this.cropper.getImageData(),a=$v(o.naturalWidth,o.naturalHeight,r),l=this.cropper.getImageData().scaleX<0?-a:a;this.cropper.scale(l,a)},this.state={angle90Deg:0,angleGranular:0,prevCropboxData:null},this.storePrevCropboxData=this.storePrevCropboxData.bind(this),this.limitCropboxMovement=this.limitCropboxMovement.bind(this)}componentDidMount(){let{opts:e,storeCropperInstance:t}=this.props;this.cropper=new jv.default(this.imgElement,e.cropperOptions),this.imgElement.addEventListener("cropstart",this.storePrevCropboxData),this.imgElement.addEventListener("cropend",this.limitCropboxMovement),t(this.cropper)}componentWillUnmount(){this.cropper.destroy(),this.imgElement.removeEventListener("cropstart",this.storePrevCropboxData),this.imgElement.removeEventListener("cropend",this.limitCropboxMovement)}storePrevCropboxData(){this.setState({prevCropboxData:this.cropper.getCropBoxData()})}limitCropboxMovement(e){let t=this.cropper.getCanvasData(),r=this.cropper.getCropBoxData(),{prevCropboxData:s}=this.state;if(e.detail.action==="all"){let n=qv(t,r,s);n&&this.cropper.setCropBoxData(n)}else{let n=Vv(t,r,s);n&&this.cropper.setCropBoxData(n)}}renderGranularRotate(){let{i18n:e}=this.props,{angleGranular:t}=this.state;return u("label",{role:"tooltip","aria-label":`${t}\xBA`,"data-microtip-position":"top",className:"uppy-ImageCropper-rangeWrapper"},u("input",{className:"uppy-ImageCropper-range uppy-u-reset",type:"range",onInput:this.onRotateGranular,onChange:this.onRotateGranular,value:t,min:"-45",max:"45","aria-label":e("rotate")}))}renderRevert(){let{i18n:e,opts:t}=this.props;return u("button",{role:"button tooltip","data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("revert"),onClick:()=>{this.cropper.reset(),this.cropper.setAspectRatio(t.cropperOptions.initialAspectRatio),this.setState({angle90Deg:0,angleGranular:0})}},u("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},u("path",{d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"})))}renderRotate(){let{i18n:e}=this.props;return u("button",{role:"button tooltip","data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("rotate"),onClick:this.onRotate90Deg},u("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},u("path",{d:"M0 0h24v24H0V0zm0 0h24v24H0V0z",fill:"none"}),u("path",{d:"M14 10a2 2 0 012 2v7a2 2 0 01-2 2H6a2 2 0 01-2-2v-7a2 2 0 012-2h8zm0 1.75H6a.25.25 0 00-.243.193L5.75 12v7a.25.25 0 00.193.243L6 19.25h8a.25.25 0 00.243-.193L14.25 19v-7a.25.25 0 00-.193-.243L14 11.75zM12 .76V4c2.3 0 4.61.88 6.36 2.64a8.95 8.95 0 012.634 6.025L21 13a1 1 0 01-1.993.117L19 13h-.003a6.979 6.979 0 00-2.047-4.95 6.97 6.97 0 00-4.652-2.044L12 6v3.24L7.76 5 12 .76z"})))}renderFlip(){let{i18n:e}=this.props;return u("button",{role:"button tooltip","data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("flipHorizontal"),onClick:()=>this.cropper.scaleX(-this.cropper.getData().scaleX||-1)},u("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},u("path",{d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"})))}renderZoomIn(){let{i18n:e}=this.props;return u("button",{role:"button tooltip","data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("zoomIn"),onClick:()=>this.cropper.zoom(.1)},u("svg",{"aria-hidden":"true",className:"uppy-c-icon",height:"24",viewBox:"0 0 24 24",width:"24"},u("path",{d:"M0 0h24v24H0V0z",fill:"none"}),u("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),u("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"})))}renderZoomOut(){let{i18n:e}=this.props;return u("button",{role:"button tooltip","data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("zoomOut"),onClick:()=>this.cropper.zoom(-.1)},u("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},u("path",{d:"M0 0h24v24H0V0z",fill:"none"}),u("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"})))}renderCropSquare(){let{i18n:e}=this.props;return u("button",{role:"button tooltip","data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("aspectRatioSquare"),onClick:()=>this.cropper.setAspectRatio(1)},u("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},u("path",{d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})))}renderCropWidescreen(){let{i18n:e}=this.props;return u("button",{role:"button tooltip","data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("aspectRatioLandscape"),onClick:()=>this.cropper.setAspectRatio(16/9)},u("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},u("path",{d:"M 19,4.9999992 V 17.000001 H 4.9999998 V 6.9999992 H 19 m 0,-2 H 4.9999998 c -1.0999999,0 -1.9999999,0.9000001 -1.9999999,2 V 17.000001 c 0,1.1 0.9,2 1.9999999,2 H 19 c 1.1,0 2,-0.9 2,-2 V 6.9999992 c 0,-1.0999999 -0.9,-2 -2,-2 z"}),u("path",{fill:"none",d:"M0 0h24v24H0z"})))}renderCropWidescreenVertical(){let{i18n:e}=this.props;return u("button",{role:"button tooltip","data-microtip-position":"top",type:"button","aria-label":e("aspectRatioPortrait"),className:"uppy-u-reset uppy-c-btn",onClick:()=>this.cropper.setAspectRatio(9/16)},u("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},u("path",{d:"M 19.000001,19 H 6.999999 V 5 h 10.000002 v 14 m 2,0 V 5 c 0,-1.0999999 -0.9,-1.9999999 -2,-1.9999999 H 6.999999 c -1.1,0 -2,0.9 -2,1.9999999 v 14 c 0,1.1 0.9,2 2,2 h 10.000002 c 1.1,0 2,-0.9 2,-2 z"}),u("path",{d:"M0 0h24v24H0z",fill:"none"})))}render(){let{currentImage:e,opts:t}=this.props,{actions:r}=t,s=URL.createObjectURL(e.data);return u("div",{className:"uppy-ImageCropper"},u("div",{className:"uppy-ImageCropper-container"},u("img",{className:"uppy-ImageCropper-image",alt:e.name,src:s,ref:n=>{this.imgElement=n}})),u("div",{className:"uppy-ImageCropper-controls"},r.revert&&this.renderRevert(),r.rotate&&this.renderRotate(),r.granularRotate&&this.renderGranularRotate(),r.flip&&this.renderFlip(),r.zoomIn&&this.renderZoomIn(),r.zoomOut&&this.renderZoomOut(),r.cropSquare&&this.renderCropSquare(),r.cropWidescreen&&this.renderCropWidescreen(),r.cropWidescreenVertical&&this.renderCropWidescreenVertical()))}};var Wv={strings:{revert:"Reset",rotate:"Rotate 90\xB0",zoomIn:"Zoom in",zoomOut:"Zoom out",flipHorizontal:"Flip horizontally",aspectRatioSquare:"Crop square",aspectRatioLandscape:"Crop landscape (16:9)",aspectRatioPortrait:"Crop portrait (9:16)"}};var fx={version:"3.3.3"},Gv={viewMode:0,background:!1,autoCropArea:1,responsive:!0,minCropBoxWidth:70,minCropBoxHeight:70,croppedCanvasOptions:{},initialAspectRatio:0},Kv={revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!0,cropWidescreen:!0,cropWidescreenVertical:!0},mx={quality:.8,actions:Kv,cropperOptions:Gv},cs=class extends pi{constructor(e,t){super(e,{...mx,...t,actions:{...Kv,...t?.actions},cropperOptions:{...Gv,...t?.cropperOptions}}),this.save=()=>{let r=o=>{var a;let{currentImage:l}=this.getPluginState();this.uppy.setFileState(l.id,{data:new File([o],(a=l.name)!=null?a:this.i18n("unnamed"),{type:o.type}),size:o.size,preview:void 0});let c=this.uppy.getFile(l.id);this.uppy.emit("thumbnail:request",c),this.setPluginState({currentImage:c}),this.uppy.emit("file-editor:complete",c)},{currentImage:s}=this.getPluginState(),n=this.cropper.getCroppedCanvas({});n.width%2!==0&&this.cropper.setData({width:n.width-1}),n.height%2!==0&&this.cropper.setData({height:n.height-1}),this.cropper.getCroppedCanvas(this.opts.cropperOptions.croppedCanvasOptions).toBlob(r,s.type,this.opts.quality)},this.storeCropperInstance=r=>{this.cropper=r},this.selectFile=r=>{this.uppy.emit("file-editor:start",r),this.setPluginState({currentImage:r})},this.id=this.opts.id||"ImageEditor",this.title="Image Editor",this.type="editor",this.defaultLocale=Wv,this.i18nInit()}canEditFile(e){if(!e.type||e.isRemote)return!1;let t=e.type.split("/")[1];return!!/^(jpe?g|gif|png|bmp|webp)$/.test(t)}install(){this.setPluginState({currentImage:null});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){let{currentImage:e}=this.getPluginState();if(e){let t=this.uppy.getFile(e.id);this.uppy.emit("file-editor:cancel",t)}this.unmount()}render(){let{currentImage:e}=this.getPluginState();return e===null||e.isRemote?null:u(_o,{currentImage:e,storeCropperInstance:this.storeCropperInstance,save:this.save,opts:this.opts,i18n:this.i18n})}};cs.VERSION=fx.version;function Qi(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var gx=0;function Xv(i){return"__private_"+gx+++"_"+i}var Et=Xv("uppy"),Co=Xv("events"),Po=class{constructor(e){Object.defineProperty(this,Et,{writable:!0,value:void 0}),Object.defineProperty(this,Co,{writable:!0,value:[]}),Qi(this,Et)[Et]=e}on(e,t){return Qi(this,Co)[Co].push([e,t]),Qi(this,Et)[Et].on(e,t)}remove(){for(let[e,t]of Qi(this,Co)[Co].splice(0))Qi(this,Et)[Et].off(e,t)}onFilePause(e,t){this.on("upload-pause",(r,s)=>{e===r?.id&&t(s)})}onFileRemove(e,t){this.on("file-removed",r=>{e===r.id&&t(r.id)})}onPause(e,t){this.on("upload-pause",(r,s)=>{e===r?.id&&t(s)})}onRetry(e,t){this.on("upload-retry",r=>{e===r?.id&&t()})}onRetryAll(e,t){this.on("retry-all",()=>{Qi(this,Et)[Et].getFile(e)&&t()})}onPauseAll(e,t){this.on("pause-all",()=>{Qi(this,Et)[Et].getFile(e)&&t()})}onCancelAll(e,t){var r=this;this.on("cancel-all",function(){Qi(r,Et)[Et].getFile(e)&&t(...arguments)})}onResumeAll(e,t){this.on("resume-all",()=>{Qi(this,Et)[Et].getFile(e)&&t()})}};function X(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var vx=0;function Pt(i){return"__private_"+vx+++"_"+i}function bx(i){return new Error("Cancelled",{cause:i})}function Yv(i){if(i!=null){var e;let t=()=>this.abort(i.reason);i.addEventListener("abort",t,{once:!0});let r=()=>{i.removeEventListener("abort",t)};(e=this.then)==null||e.call(this,r,r)}return this}var Bt=Pt("activeRequests"),xt=Pt("queuedHandlers"),Nt=Pt("paused"),us=Pt("pauseTimer"),Tt=Pt("downLimit"),hs=Pt("upperLimit"),Ji=Pt("rateLimitingTimer"),Fo=Pt("call"),er=Pt("queueNext"),xd=Pt("next"),Ed=Pt("queue"),kd=Pt("dequeue"),Td=Pt("resume"),ds=Pt("increaseLimit"),_l=class{constructor(e){Object.defineProperty(this,kd,{value:Tx}),Object.defineProperty(this,Ed,{value:Ex}),Object.defineProperty(this,xd,{value:Sx}),Object.defineProperty(this,er,{value:wx}),Object.defineProperty(this,Fo,{value:yx}),Object.defineProperty(this,Bt,{writable:!0,value:0}),Object.defineProperty(this,xt,{writable:!0,value:[]}),Object.defineProperty(this,Nt,{writable:!0,value:!1}),Object.defineProperty(this,us,{writable:!0,value:void 0}),Object.defineProperty(this,Tt,{writable:!0,value:1}),Object.defineProperty(this,hs,{writable:!0,value:void 0}),Object.defineProperty(this,Ji,{writable:!0,value:void 0}),Object.defineProperty(this,Td,{writable:!0,value:()=>this.resume()}),Object.defineProperty(this,ds,{writable:!0,value:()=>{if(X(this,Nt)[Nt]){X(this,Ji)[Ji]=setTimeout(X(this,ds)[ds],0);return}X(this,Tt)[Tt]=this.limit,this.limit=Math.ceil((X(this,hs)[hs]+X(this,Tt)[Tt])/2);for(let t=X(this,Tt)[Tt];t<=this.limit;t++)X(this,er)[er]();X(this,hs)[hs]-X(this,Tt)[Tt]>3?X(this,Ji)[Ji]=setTimeout(X(this,ds)[ds],2e3):X(this,Tt)[Tt]=Math.floor(X(this,Tt)[Tt]/2)}}),typeof e!="number"||e===0?this.limit=1/0:this.limit=e}run(e,t){return!X(this,Nt)[Nt]&&X(this,Bt)[Bt]<this.limit?X(this,Fo)[Fo](e):X(this,Ed)[Ed](e,t)}wrapSyncFunction(e,t){var r=this;return function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];let a=r.run(()=>(e(...n),queueMicrotask(()=>a.done()),()=>{}),t);return{abortOn:Yv,abort(){a.abort()}}}}wrapPromiseFunction(e,t){var r=this;return function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];let a,l=new Promise((c,d)=>{a=r.run(()=>{let f,g;try{g=Promise.resolve(e(...n))}catch(b){g=Promise.reject(b)}return g.then(b=>{f?d(f):(a.done(),c(b))},b=>{f?d(f):(a.done(),d(b))}),b=>{f=bx(b)}},t)});return l.abort=c=>{a.abort(c)},l.abortOn=Yv,l}}resume(){X(this,Nt)[Nt]=!1,clearTimeout(X(this,us)[us]);for(let e=0;e<this.limit;e++)X(this,er)[er]()}pause(e){e===void 0&&(e=null),X(this,Nt)[Nt]=!0,clearTimeout(X(this,us)[us]),e!=null&&(X(this,us)[us]=setTimeout(X(this,Td)[Td],e))}rateLimit(e){clearTimeout(X(this,Ji)[Ji]),this.pause(e),this.limit>1&&Number.isFinite(this.limit)&&(X(this,hs)[hs]=this.limit-1,this.limit=X(this,Tt)[Tt],X(this,Ji)[Ji]=setTimeout(X(this,ds)[ds],e))}get isPaused(){return X(this,Nt)[Nt]}};function yx(i){X(this,Bt)[Bt]+=1;let e=!1,t;try{t=i()}catch(r){throw X(this,Bt)[Bt]-=1,r}return{abort:r=>{e||(e=!0,X(this,Bt)[Bt]-=1,t?.(r),X(this,er)[er]())},done:()=>{e||(e=!0,X(this,Bt)[Bt]-=1,X(this,er)[er]())}}}function wx(){queueMicrotask(()=>X(this,xd)[xd]())}function Sx(){if(X(this,Nt)[Nt]||X(this,Bt)[Bt]>=this.limit||X(this,xt)[xt].length===0)return;let i=X(this,xt)[xt].shift();if(i==null)throw new Error("Invariant violation: next is null");let e=X(this,Fo)[Fo](i.fn);i.abort=e.abort,i.done=e.done}function Ex(i,e){let t={fn:i,priority:e?.priority||0,abort:()=>{X(this,kd)[kd](t)},done:()=>{throw new Error("Cannot mark a queued request as done: this indicates a bug")}},r=X(this,xt)[xt].findIndex(s=>t.priority>s.priority);return r===-1?X(this,xt)[xt].push(t):X(this,xt)[xt].splice(r,0,t),t}function Tx(i){let e=X(this,xt)[xt].indexOf(i);e!==-1&&X(this,xt)[xt].splice(e,1)}var Cl=Symbol("__queue");var Ad=class extends Error{constructor(e,t){t===void 0&&(t=null),super("This looks like a network error, the endpoint might be blocked by an internet provider or a firewall."),this.cause=e,this.isNetworkError=!0,this.request=t}},Oo=Ad;function xx(i){return i?i.readyState!==0&&i.readyState!==4||i.status===0:!1}var Zv=xx;function Zt(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var kx=0;function Pl(i){return"__private_"+kx+++"_"+i}var tr=Pl("aliveTimer"),ps=Pl("isDone"),Ro=Pl("onTimedOut"),fs=Pl("timeout"),_d=class{constructor(e,t){Object.defineProperty(this,tr,{writable:!0,value:void 0}),Object.defineProperty(this,ps,{writable:!0,value:!1}),Object.defineProperty(this,Ro,{writable:!0,value:void 0}),Object.defineProperty(this,fs,{writable:!0,value:void 0}),Zt(this,fs)[fs]=e,Zt(this,Ro)[Ro]=()=>t(e)}progress(){Zt(this,ps)[ps]||Zt(this,fs)[fs]>0&&(clearTimeout(Zt(this,tr)[tr]),Zt(this,tr)[tr]=setTimeout(Zt(this,Ro)[Ro],Zt(this,fs)[fs]))}done(){Zt(this,ps)[ps]||(clearTimeout(Zt(this,tr)[tr]),Zt(this,tr)[tr]=void 0,Zt(this,ps)[ps]=!0)}},Qv=_d;var Fl=()=>{};function Jv(i,e){e===void 0&&(e={});let{body:t=null,headers:r={},method:s="GET",onBeforeRequest:n=Fl,onUploadProgress:o=Fl,shouldRetry:a=()=>!0,onAfterResponse:l=Fl,onTimeout:c=Fl,responseType:d,retries:f=3,signal:g=null,timeout:b=3e4,withCredentials:w=!1}=e,P=k=>.3*2**(k-1)*1e3,R=new Qv(b,c);function C(k){return k===void 0&&(k=0),new Promise(async(_,E)=>{let A=new XMLHttpRequest,F=O=>{a(A)&&k<f?setTimeout(()=>{C(k+1).then(_,E)},P(k)):(R.done(),E(O))};A.open(s,i,!0),A.withCredentials=w,d&&(A.responseType=d),g?.addEventListener("abort",()=>{A.abort(),E(new DOMException("Aborted","AbortError"))}),A.onload=async()=>{try{await l(A,k)}catch(O){O.request=A,F(O);return}A.status>=200&&A.status<300?(R.done(),_(A)):a(A)&&k<f?setTimeout(()=>{C(k+1).then(_,E)},P(k)):(R.done(),E(new Oo(A.statusText,A)))},A.onerror=()=>F(new Oo(A.statusText,A)),A.upload.onprogress=O=>{R.progress(),o(O)},r&&Object.keys(r).forEach(O=>{A.setRequestHeader(O,r[O])}),await n(A,k),A.send(t)})}return C()}function eb(i){let e=t=>"error"in t&&!!t.error;return i.filter(t=>!e(t))}function tb(i){return i.filter(e=>{var t;return!((t=e.progress)!=null&&t.uploadStarted)||!e.isRestored})}function Ol(i,e){return i===!0?Object.keys(e):Array.isArray(i)?i:[]}var ib={strings:{uploadStalled:"Upload has not made any progress for %{seconds} seconds. You may want to retry it."}};function ir(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var Ax=0;function Xs(i){return"__private_"+Ax+++"_"+i}var _x={version:"4.3.3"};function Cx(i,e){let t=e;return t||(t=new Error("Upload error")),typeof t=="string"&&(t=new Error(t)),t instanceof Error||(t=Object.assign(new Error("Upload error"),{data:t})),Zv(i)?(t=new Oo(t,i),t):(t.request=i,t)}function rb(i){return i.data.slice(0,i.data.size,i.meta.type)}var Px={formData:!0,fieldName:"file",method:"post",allowedMetaFields:!0,bundle:!1,headers:{},timeout:30*1e3,limit:5,withCredentials:!1,responseType:""},ms=Xs("getFetcher"),Fd=Xs("uploadLocalFile"),Cd=Xs("uploadBundle"),Od=Xs("getCompanionClientArgs"),Pd=Xs("uploadFiles"),Lo=Xs("handleUpload"),Ks=class extends wr{constructor(e,t){if(super(e,{...Px,fieldName:t.bundle?"files[]":"file",...t}),Object.defineProperty(this,Pd,{value:Lx}),Object.defineProperty(this,Od,{value:Rx}),Object.defineProperty(this,Cd,{value:Ox}),Object.defineProperty(this,Fd,{value:Fx}),Object.defineProperty(this,ms,{writable:!0,value:void 0}),Object.defineProperty(this,Lo,{writable:!0,value:async r=>{if(r.length===0){this.uppy.log("[XHRUpload] No files to upload!");return}this.opts.limit===0&&!this.opts[Cl]&&this.uppy.log("[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0","warning"),this.uppy.log("[XHRUpload] Uploading...");let s=this.uppy.getFilesByIds(r),n=eb(s),o=tb(n);if(this.uppy.emit("upload-start",o),this.opts.bundle){if(n.some(l=>l.isRemote))throw new Error("Can\u2019t upload remote files when the `bundle: true` option is set");if(typeof this.opts.headers=="function")throw new TypeError("`headers` may not be a function when the `bundle: true` option is set");await ir(this,Cd)[Cd](n)}else await ir(this,Pd)[Pd](n)}}),this.type="uploader",this.id=this.opts.id||"XHRUpload",this.defaultLocale=ib,this.i18nInit(),Cl in this.opts?this.requests=this.opts[Cl]:this.requests=new _l(this.opts.limit),this.opts.bundle&&!this.opts.formData)throw new Error("`opts.formData` must be true when `opts.bundle` is enabled.");if(this.opts.bundle&&typeof this.opts.headers=="function")throw new Error("`opts.headers` can not be a function when the `bundle: true` option is set.");if(t?.allowedMetaFields===void 0&&"metaFields"in this.opts)throw new Error("The `metaFields` option has been renamed to `allowedMetaFields`.");this.uploaderEvents=Object.create(null),ir(this,ms)[ms]=r=>async(s,n)=>{try{var o,a,l;let f=await Jv(s,{...n,onBeforeRequest:(w,P)=>{var R,C;return(R=(C=this.opts).onBeforeRequest)==null?void 0:R.call(C,w,P,r)},shouldRetry:this.opts.shouldRetry,onAfterResponse:this.opts.onAfterResponse,onTimeout:w=>{let P=Math.ceil(w/1e3),R=new Error(this.i18n("uploadStalled",{seconds:P}));this.uppy.emit("upload-stalled",R,r)},onUploadProgress:w=>{if(w.lengthComputable)for(let{id:R}of r){var P;let C=this.uppy.getFile(R);this.uppy.emit("upload-progress",C,{uploadStarted:(P=C.progress.uploadStarted)!=null?P:0,bytesUploaded:w.loaded/w.total*C.size,bytesTotal:C.size})}}}),g=await((o=(a=this.opts).getResponseData)==null?void 0:o.call(a,f));if(f.responseType==="json"){var c;(c=g)!=null||(g=f.response)}else try{var d;(d=g)!=null||(g=JSON.parse(f.responseText))}catch(w){throw new Error("@uppy/xhr-upload expects a JSON response (with a `url` property). To parse non-JSON responses, use `getResponseData` to turn your response into JSON.",{cause:w})}let b=typeof((l=g)==null?void 0:l.url)=="string"?g.url:void 0;for(let{id:w}of r)this.uppy.emit("upload-success",this.uppy.getFile(w),{status:f.status,body:g,uploadURL:b});return f}catch(f){if(f.name==="AbortError")return;let g=f.request;for(let b of r)this.uppy.emit("upload-error",this.uppy.getFile(b.id),Cx(g,f),g);throw f}}}getOptions(e){let t=this.uppy.getState().xhrUpload,{headers:r}=this.opts,s={...this.opts,...t||{},...e.xhrUpload||{},headers:{}};return typeof r=="function"?s.headers=r(e):Object.assign(s.headers,this.opts.headers),t&&Object.assign(s.headers,t.headers),e.xhrUpload&&Object.assign(s.headers,e.xhrUpload.headers),s}addMetadata(e,t,r){Ol(r.allowedMetaFields,t).forEach(n=>{let o=t[n];Array.isArray(o)?o.forEach(a=>e.append(n,a)):e.append(n,o)})}createFormDataUpload(e,t){let r=new FormData;this.addMetadata(r,e.meta,t);let s=rb(e);return e.name?r.append(t.fieldName,s,e.meta.name):r.append(t.fieldName,s),r}createBundledUpload(e,t){let r=new FormData,{meta:s}=this.uppy.getState();return this.addMetadata(r,s,t),e.forEach(n=>{let o=this.getOptions(n),a=rb(n);n.name?r.append(o.fieldName,a,n.name):r.append(o.fieldName,a)}),r}install(){if(this.opts.bundle){let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!1}})}this.uppy.addUploader(ir(this,Lo)[Lo])}uninstall(){if(this.opts.bundle){let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!0}})}this.uppy.removeUploader(ir(this,Lo)[Lo])}};async function Fx(i){let e=new Po(this.uppy),t=new AbortController,r=this.requests.wrapPromiseFunction(async()=>{let s=this.getOptions(i),n=ir(this,ms)[ms]([i]),o=s.formData?this.createFormDataUpload(i,s):i.data;return n(s.endpoint,{...s,body:o,signal:t.signal})});e.onFileRemove(i.id,()=>t.abort()),e.onCancelAll(i.id,()=>{t.abort()});try{await r().abortOn(t.signal)}catch(s){if(s.message!=="Cancelled")throw s}finally{e.remove()}}async function Ox(i){let e=new AbortController,t=this.requests.wrapPromiseFunction(async()=>{var s;let n=(s=this.uppy.getState().xhrUpload)!=null?s:{},o=ir(this,ms)[ms](i),a=this.createBundledUpload(i,{...this.opts,...n});return o(this.opts.endpoint,{...this.opts,body:a,signal:e.signal})});function r(){e.abort()}this.uppy.once("cancel-all",r);try{await t().abortOn(e.signal)}catch(s){if(s.message!=="Cancelled")throw s}finally{this.uppy.off("cancel-all",r)}}function Rx(i){var e;let t=this.getOptions(i),r=Ol(t.allowedMetaFields,i.meta);return{...(e=i.remote)==null?void 0:e.body,protocol:"multipart",endpoint:t.endpoint,size:i.data.size,fieldname:t.fieldName,metadata:Object.fromEntries(r.map(s=>[s,i.meta[s]])),httpMethod:t.method,useFormData:t.formData,headers:t.headers}}async function Lx(i){await Promise.allSettled(i.map(e=>{if(e.isRemote){let t=()=>this.requests,r=new AbortController,s=o=>{o.id===e.id&&r.abort()};this.uppy.on("file-removed",s);let n=this.uppy.getRequestClientForFile(e).uploadRemoteFile(e,ir(this,Od)[Od](e),{signal:r.signal,getQueue:t});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",s)},{priority:-1})(),n}return ir(this,Fd)[Fd](e)}))}Ks.VERSION=_x.version;var st=class{static fromTemplate(i){if(Rs.isSupported)return Rs.sanitize(i,{USE_PROFILES:{html:!0,svg:!0},RETURN_DOM:!0}).children[0];{let e=new DOMParser().parseFromString(i,"text/html").body.children[0];return Mx(e)}}};function Mx(i){return Ix(i),sb(i),i}function Ix(i){let e=i.querySelectorAll("script");for(let t of e)t.remove()}function Dx(i,e){let t=e.replace(/\s+/g,"").toLowerCase();if(["src","href","xlink:href"].includes(i)&&(t.includes("javascript:")||t.includes("data:"))||i.startsWith("on"))return!0}function Nx(i){let e=i.attributes;for(let{name:t,value:r}of e)Dx(t,r)&&i.removeAttribute(t)}function sb(i){let e=i.children;for(let t of e)Nx(t),sb(t)}var Rl=class extends K{static values={identifier:String,endpoint:String,maxFileSize:{type:Number,default:null},minFileSize:{type:Number,default:null},maxTotalSize:{type:Number,default:null},maxFileNum:{type:Number,default:null},minFileNum:{type:Number,default:null},allowedFileTypes:{type:Array,default:null},requiredMetaFields:{type:Array,default:[]}};static outlets=["attachment-preview","attachment-preview-container"];connect(){this.uppy||(this.uploadedFiles=[],this.element.style.display="none",this.configureUppy(),this.#u(),this.#r(),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}disconnect(){this.#t()}#e(){this.element.isConnected&&(this.#t(),this.uploadedFiles=[],this.element.style.display="none",this.configureUppy(),this.#u(),this.#r())}#t(){this.uppy&&(this.uppy.destroy(),this.uppy=null),this.triggerContainer&&this.triggerContainer.parentNode&&(this.triggerContainer.parentNode.removeChild(this.triggerContainer),this.triggerContainer=null)}attachmentPreviewOutletConnected(i,e){this.#r()}attachmentPreviewOutletDisconnected(i,e){this.#r()}configureUppy(){this.uppy=new ja({restrictions:{maxFileSize:this.maxFileSizeValue,minFileSize:this.minFileSizeValue,maxTotalFileSize:this.maxTotalSizeValue,maxNumberOfFiles:this.maxFileNumValue,minNumberOfFiles:this.minFileNumValue,allowedFileTypes:this.allowedFileTypesValue,requiredMetaFields:this.requiredMetaFieldsValue}}).use(xr,{inline:!1,closeAfterFinish:!0}).use(cs,{target:xr}),this.#i(),this.#n()}#i(){this.uppy.use(Ks,{endpoint:this.endpointValue})}#n(){this.uppy.on("upload-success",this.#a.bind(this))}#o(){let i=document.documentElement.getAttribute("data-bs-theme")||"auto";this.#c.setOptions({theme:i});let e=null;for(;e=this.uploadedFiles.pop();)this.uppy.removeFile(e.id);this.#c.openModal()}#a(i,e){this.uploadedFiles.push(i),this.multiple||this.attachmentPreviewOutlets.forEach(s=>s.remove());let t=e.body.data,r=e.body.url;this.attachmentPreviewContainerOutlet.element.appendChild(this.#l(t,r))}#r(){if(!this.deleteAllTrigger)return;this.attachmentPreviewOutlets.length>1?(this.deleteAllTrigger.style.display="initial",this.deleteAllTrigger.textContent=`Delete ${this.attachmentPreviewOutlets.length}`):this.deleteAllTrigger.style.display="none"}#u(){this.triggerContainer=document.createElement("div"),this.triggerContainer.className="flex items-center gap-2",this.element.insertAdjacentElement("afterend",this.triggerContainer),this.#s(),this.uploadTrigger&&this.triggerContainer.append(this.uploadTrigger),this.deleteAllTrigger&&this.triggerContainer.append(this.deleteAllTrigger)}#s(){let i=this.multiple?"Choose files":"Choose file";this.uploadTrigger=st.fromTemplate(`<button type="button" class="text-gray-900 bg-white border border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-200 font-medium rounded-lg text-sm px-5 py-2.5 dark:bg-gray-800 dark:text-white dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-600 dark:focus:ring-gray-700 inline-flex items-center">
|
|
96
|
+
${s.details}`)},"?")))))),this.type="progressindicator",this.id=this.opts.id||"Informer",this.title="Informer"}install(){let{target:e}=this.opts;e&&this.mount(e,this)}};Yr.VERSION=HS.version;var $S=/^data:([^/]+\/[^,;]+(?:[^,]*?))(;base64)?,([\s\S]*)$/;function qS(i,e,t){var r,s;let n=$S.exec(i),o=(r=(s=e.mimeType)!=null?s:n?.[1])!=null?r:"plain/text",a;if(n?.[2]!=null){let l=atob(decodeURIComponent(n[3])),c=new Uint8Array(l.length);for(let d=0;d<l.length;d++)c[d]=l.charCodeAt(d);a=[c]}else n?.[3]!=null&&(a=[decodeURIComponent(n[3])]);return t?new File(a,e.name||"",{type:o}):new Blob(a,{type:o})}var Qm=qS;function Qa(i){return i.startsWith("blob:")}function Ja(i){return i?/^[^/]+\/(jpe?g|gif|png|svg|svg\+xml|bmp|webp|avif)$/.test(i):!1}function ve(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}var ag=typeof self<"u"?self:global,to=typeof navigator<"u",VS=to&&typeof HTMLImageElement>"u",Jm=!(typeof global>"u"||typeof process>"u"||!process.versions||!process.versions.node),lg=ag.Buffer,cg=!!lg,jS=i=>i!==void 0;function ug(i){return i===void 0||(i instanceof Map?i.size===0:Object.values(i).filter(jS).length===0)}function st(i){let e=new Error(i);throw delete e.stack,e}function eg(i){let e=function(t){let r=0;return t.ifd0.enabled&&(r+=1024),t.exif.enabled&&(r+=2048),t.makerNote&&(r+=2048),t.userComment&&(r+=1024),t.gps.enabled&&(r+=512),t.interop.enabled&&(r+=100),t.ifd1.enabled&&(r+=1024),r+2048}(i);return i.jfif.enabled&&(e+=50),i.xmp.enabled&&(e+=2e4),i.iptc.enabled&&(e+=14e3),i.icc.enabled&&(e+=6e3),e}var oh=i=>String.fromCharCode.apply(null,i),tg=typeof TextDecoder<"u"?new TextDecoder("utf-8"):void 0,Qr=class i{static from(e,t){return e instanceof this&&e.le===t?e:new i(e,void 0,void 0,t)}constructor(e,t=0,r,s){if(typeof s=="boolean"&&(this.le=s),Array.isArray(e)&&(e=new Uint8Array(e)),e===0)this.byteOffset=0,this.byteLength=0;else if(e instanceof ArrayBuffer){r===void 0&&(r=e.byteLength-t);let n=new DataView(e,t,r);this._swapDataView(n)}else if(e instanceof Uint8Array||e instanceof DataView||e instanceof i){r===void 0&&(r=e.byteLength-t),(t+=e.byteOffset)+r>e.byteOffset+e.byteLength&&st("Creating view outside of available memory in ArrayBuffer");let n=new DataView(e.buffer,t,r);this._swapDataView(n)}else if(typeof e=="number"){let n=new DataView(new ArrayBuffer(e));this._swapDataView(n)}else st("Invalid input argument for BufferView: "+e)}_swapArrayBuffer(e){this._swapDataView(new DataView(e))}_swapBuffer(e){this._swapDataView(new DataView(e.buffer,e.byteOffset,e.byteLength))}_swapDataView(e){this.dataView=e,this.buffer=e.buffer,this.byteOffset=e.byteOffset,this.byteLength=e.byteLength}_lengthToEnd(e){return this.byteLength-e}set(e,t,r=i){return e instanceof DataView||e instanceof i?e=new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer&&(e=new Uint8Array(e)),e instanceof Uint8Array||st("BufferView.set(): Invalid data argument."),this.toUint8().set(e,t),new r(this,t,e.byteLength)}subarray(e,t){return t=t||this._lengthToEnd(e),new i(this,e,t)}toUint8(){return new Uint8Array(this.buffer,this.byteOffset,this.byteLength)}getUint8Array(e,t){return new Uint8Array(this.buffer,this.byteOffset+e,t)}getString(e=0,t=this.byteLength){return s=this.getUint8Array(e,t),tg?tg.decode(s):cg?Buffer.from(s).toString("utf8"):decodeURIComponent(escape(oh(s)));var s}getLatin1String(e=0,t=this.byteLength){let r=this.getUint8Array(e,t);return oh(r)}getUnicodeString(e=0,t=this.byteLength){let r=[];for(let s=0;s<t&&e+s<this.byteLength;s+=2)r.push(this.getUint16(e+s));return oh(r)}getInt8(e){return this.dataView.getInt8(e)}getUint8(e){return this.dataView.getUint8(e)}getInt16(e,t=this.le){return this.dataView.getInt16(e,t)}getInt32(e,t=this.le){return this.dataView.getInt32(e,t)}getUint16(e,t=this.le){return this.dataView.getUint16(e,t)}getUint32(e,t=this.le){return this.dataView.getUint32(e,t)}getFloat32(e,t=this.le){return this.dataView.getFloat32(e,t)}getFloat64(e,t=this.le){return this.dataView.getFloat64(e,t)}getFloat(e,t=this.le){return this.dataView.getFloat32(e,t)}getDouble(e,t=this.le){return this.dataView.getFloat64(e,t)}getUintBytes(e,t,r){switch(t){case 1:return this.getUint8(e,r);case 2:return this.getUint16(e,r);case 4:return this.getUint32(e,r);case 8:return this.getUint64&&this.getUint64(e,r)}}getUint(e,t,r){switch(t){case 8:return this.getUint8(e,r);case 16:return this.getUint16(e,r);case 32:return this.getUint32(e,r);case 64:return this.getUint64&&this.getUint64(e,r)}}toString(e){return this.dataView.toString(e,this.constructor.name)}ensureChunk(){}};function lh(i,e){st(`${i} '${e}' was not loaded, try using full build of exifr.`)}var io=class extends Map{constructor(e){super(),this.kind=e}get(e,t){return this.has(e)||lh(this.kind,e),t&&(e in t||function(r,s){st(`Unknown ${r} '${s}'.`)}(this.kind,e),t[e].enabled||lh(this.kind,e)),super.get(e)}keyList(){return Array.from(this.keys())}},sl=new io("file parser"),Nt=new io("segment parser"),no=new io("file reader"),WS=ag.fetch;function ig(i,e){return(t=i).startsWith("data:")||t.length>1e4?uh(i,e,"base64"):Jm&&i.includes("://")?ch(i,e,"url",el):Jm?uh(i,e,"fs"):to?ch(i,e,"url",el):void st("Invalid input argument");var t}async function ch(i,e,t,r){return no.has(t)?uh(i,e,t):r?async function(s,n){let o=await n(s);return new Qr(o)}(i,r):void st(`Parser ${t} is not loaded`)}async function uh(i,e,t){let r=new(no.get(t))(i,e);return await r.read(),r}var el=i=>WS(i).then(e=>e.arrayBuffer()),ro=i=>new Promise((e,t)=>{let r=new FileReader;r.onloadend=()=>e(r.result||new ArrayBuffer),r.onerror=t,r.readAsArrayBuffer(i)}),hh=class extends Map{get tagKeys(){return this.allKeys||(this.allKeys=Array.from(this.keys())),this.allKeys}get tagValues(){return this.allValues||(this.allValues=Array.from(this.values())),this.allValues}};function hg(i,e,t){let r=new hh;for(let[s,n]of t)r.set(s,n);if(Array.isArray(e))for(let s of e)i.set(s,r);else i.set(e,r);return r}function dg(i,e,t){let r,s=i.get(e);for(r of t)s.set(r[0],r[1])}var oo=new Map,gh=new Map,vh=new Map,Us=["chunked","firstChunkSize","firstChunkSizeNode","firstChunkSizeBrowser","chunkSize","chunkLimit"],nl=["jfif","xmp","icc","iptc","ihdr"],so=["tiff",...nl],Ve=["ifd0","ifd1","exif","gps","interop"],zs=[...so,...Ve],Hs=["makerNote","userComment"],ol=["translateKeys","translateValues","reviveValues","multiSegment"],$s=[...ol,"sanitize","mergeOutput","silentErrors"],tl=class{get translate(){return this.translateKeys||this.translateValues||this.reviveValues}},Zr=class extends tl{get needed(){return this.enabled||this.deps.size>0}constructor(e,t,r,s){if(super(),ve(this,"enabled",!1),ve(this,"skip",new Set),ve(this,"pick",new Set),ve(this,"deps",new Set),ve(this,"translateKeys",!1),ve(this,"translateValues",!1),ve(this,"reviveValues",!1),this.key=e,this.enabled=t,this.parse=this.enabled,this.applyInheritables(s),this.canBeFiltered=Ve.includes(e),this.canBeFiltered&&(this.dict=oo.get(e)),r!==void 0)if(Array.isArray(r))this.parse=this.enabled=!0,this.canBeFiltered&&r.length>0&&this.translateTagSet(r,this.pick);else if(typeof r=="object"){if(this.enabled=!0,this.parse=r.parse!==!1,this.canBeFiltered){let{pick:n,skip:o}=r;n&&n.length>0&&this.translateTagSet(n,this.pick),o&&o.length>0&&this.translateTagSet(o,this.skip)}this.applyInheritables(r)}else r===!0||r===!1?this.parse=this.enabled=r:st(`Invalid options argument: ${r}`)}applyInheritables(e){let t,r;for(t of ol)r=e[t],r!==void 0&&(this[t]=r)}translateTagSet(e,t){if(this.dict){let r,s,{tagKeys:n,tagValues:o}=this.dict;for(r of e)typeof r=="string"?(s=o.indexOf(r),s===-1&&(s=n.indexOf(Number(r))),s!==-1&&t.add(Number(n[s]))):t.add(r)}else for(let r of e)t.add(r)}finalizeFilters(){!this.enabled&&this.deps.size>0?(this.enabled=!0,il(this.pick,this.deps)):this.enabled&&this.pick.size>0&&il(this.pick,this.deps)}},St={jfif:!1,tiff:!0,xmp:!1,icc:!1,iptc:!1,ifd0:!0,ifd1:!1,exif:!0,gps:!0,interop:!1,ihdr:void 0,makerNote:!1,userComment:!1,multiSegment:!1,skip:[],pick:[],translateKeys:!0,translateValues:!0,reviveValues:!0,sanitize:!0,mergeOutput:!0,silentErrors:!0,chunked:!0,firstChunkSize:void 0,firstChunkSizeNode:512,firstChunkSizeBrowser:65536,chunkSize:65536,chunkLimit:5},rg=new Map,Jr=class extends tl{static useCached(e){let t=rg.get(e);return t!==void 0||(t=new this(e),rg.set(e,t)),t}constructor(e){super(),e===!0?this.setupFromTrue():e===void 0?this.setupFromUndefined():Array.isArray(e)?this.setupFromArray(e):typeof e=="object"?this.setupFromObject(e):st(`Invalid options argument ${e}`),this.firstChunkSize===void 0&&(this.firstChunkSize=to?this.firstChunkSizeBrowser:this.firstChunkSizeNode),this.mergeOutput&&(this.ifd1.enabled=!1),this.filterNestedSegmentTags(),this.traverseTiffDependencyTree(),this.checkLoadedPlugins()}setupFromUndefined(){let e;for(e of Us)this[e]=St[e];for(e of $s)this[e]=St[e];for(e of Hs)this[e]=St[e];for(e of zs)this[e]=new Zr(e,St[e],void 0,this)}setupFromTrue(){let e;for(e of Us)this[e]=St[e];for(e of $s)this[e]=St[e];for(e of Hs)this[e]=!0;for(e of zs)this[e]=new Zr(e,!0,void 0,this)}setupFromArray(e){let t;for(t of Us)this[t]=St[t];for(t of $s)this[t]=St[t];for(t of Hs)this[t]=St[t];for(t of zs)this[t]=new Zr(t,!1,void 0,this);this.setupGlobalFilters(e,void 0,Ve)}setupFromObject(e){let t;for(t of(Ve.ifd0=Ve.ifd0||Ve.image,Ve.ifd1=Ve.ifd1||Ve.thumbnail,Object.assign(this,e),Us))this[t]=ah(e[t],St[t]);for(t of $s)this[t]=ah(e[t],St[t]);for(t of Hs)this[t]=ah(e[t],St[t]);for(t of so)this[t]=new Zr(t,St[t],e[t],this);for(t of Ve)this[t]=new Zr(t,St[t],e[t],this.tiff);this.setupGlobalFilters(e.pick,e.skip,Ve,zs),e.tiff===!0?this.batchEnableWithBool(Ve,!0):e.tiff===!1?this.batchEnableWithUserValue(Ve,e):Array.isArray(e.tiff)?this.setupGlobalFilters(e.tiff,void 0,Ve):typeof e.tiff=="object"&&this.setupGlobalFilters(e.tiff.pick,e.tiff.skip,Ve)}batchEnableWithBool(e,t){for(let r of e)this[r].enabled=t}batchEnableWithUserValue(e,t){for(let r of e){let s=t[r];this[r].enabled=s!==!1&&s!==void 0}}setupGlobalFilters(e,t,r,s=r){if(e&&e.length){for(let o of s)this[o].enabled=!1;let n=sg(e,r);for(let[o,a]of n)il(this[o].pick,a),this[o].enabled=!0}else if(t&&t.length){let n=sg(t,r);for(let[o,a]of n)il(this[o].skip,a)}}filterNestedSegmentTags(){let{ifd0:e,exif:t,xmp:r,iptc:s,icc:n}=this;this.makerNote?t.deps.add(37500):t.skip.add(37500),this.userComment?t.deps.add(37510):t.skip.add(37510),r.enabled||e.skip.add(700),s.enabled||e.skip.add(33723),n.enabled||e.skip.add(34675)}traverseTiffDependencyTree(){let{ifd0:e,exif:t,gps:r,interop:s}=this;s.needed&&(t.deps.add(40965),e.deps.add(40965)),t.needed&&e.deps.add(34665),r.needed&&e.deps.add(34853),this.tiff.enabled=Ve.some(n=>this[n].enabled===!0)||this.makerNote||this.userComment;for(let n of Ve)this[n].finalizeFilters()}get onlyTiff(){return!nl.map(e=>this[e].enabled).some(e=>e===!0)&&this.tiff.enabled}checkLoadedPlugins(){for(let e of so)this[e].enabled&&!Nt.has(e)&&lh("segment parser",e)}};function sg(i,e){let t,r,s,n,o=[];for(s of e){for(n of(t=oo.get(s),r=[],t))(i.includes(n[0])||i.includes(n[1]))&&r.push(n[0]);r.length&&o.push([s,r])}return o}function ah(i,e){return i!==void 0?i:e!==void 0?e:void 0}function il(i,e){for(let t of e)i.add(t)}ve(Jr,"default",St);var qs=class{constructor(e){ve(this,"parsers",{}),ve(this,"output",{}),ve(this,"errors",[]),ve(this,"pushToErrors",t=>this.errors.push(t)),this.options=Jr.useCached(e)}async read(e){this.file=await function(t,r){return typeof t=="string"?ig(t,r):to&&!VS&&t instanceof HTMLImageElement?ig(t.src,r):t instanceof Uint8Array||t instanceof ArrayBuffer||t instanceof DataView?new Qr(t):to&&t instanceof Blob?ch(t,r,"blob",ro):void st("Invalid input argument")}(e,this.options)}setup(){if(this.fileParser)return;let{file:e}=this,t=e.getUint16(0);for(let[r,s]of sl)if(s.canHandle(e,t))return this.fileParser=new s(this.options,this.file,this.parsers),e[r]=!0;this.file.close&&this.file.close(),st("Unknown file format")}async parse(){let{output:e,errors:t}=this;return this.setup(),this.options.silentErrors?(await this.executeParsers().catch(this.pushToErrors),t.push(...this.fileParser.errors)):await this.executeParsers(),this.file.close&&this.file.close(),this.options.silentErrors&&t.length>0&&(e.errors=t),ug(r=e)?void 0:r;var r}async executeParsers(){let{output:e}=this;await this.fileParser.parse();let t=Object.values(this.parsers).map(async r=>{let s=await r.parse();r.assignToOutput(e,s)});this.options.silentErrors&&(t=t.map(r=>r.catch(this.pushToErrors))),await Promise.all(t)}async extractThumbnail(){this.setup();let{options:e,file:t}=this,r=Nt.get("tiff",e);var s;if(t.tiff?s={start:0,type:"tiff"}:t.jpeg&&(s=await this.fileParser.getOrFindSegment("tiff")),s===void 0)return;let n=await this.fileParser.ensureSegmentChunk(s),o=this.parsers.tiff=new r(n,e,t),a=await o.extractThumbnail();return t.close&&t.close(),a}};async function pg(i,e){let t=new qs(e);return await t.read(i),t.parse()}var GS=Object.freeze({__proto__:null,parse:pg,Exifr:qs,fileParsers:sl,segmentParsers:Nt,fileReaders:no,tagKeys:oo,tagValues:gh,tagRevivers:vh,createDictionary:hg,extendDictionary:dg,fetchUrlAsArrayBuffer:el,readBlobAsArrayBuffer:ro,chunkedProps:Us,otherSegments:nl,segments:so,tiffBlocks:Ve,segmentsAndBlocks:zs,tiffExtractables:Hs,inheritables:ol,allFormatters:$s,Options:Jr}),vr=class{static findPosition(e,t){let r=e.getUint16(t+2)+2,s=typeof this.headerLength=="function"?this.headerLength(e,t,r):this.headerLength,n=t+s,o=r-s;return{offset:t,length:r,headerLength:s,start:n,size:o,end:n+o}}static parse(e,t={}){return new this(e,new Jr({[this.type]:t}),e).parse()}normalizeInput(e){return e instanceof Qr?e:new Qr(e)}constructor(e,t={},r){ve(this,"errors",[]),ve(this,"raw",new Map),ve(this,"handleError",s=>{if(!this.options.silentErrors)throw s;this.errors.push(s.message)}),this.chunk=this.normalizeInput(e),this.file=r,this.type=this.constructor.type,this.globalOptions=this.options=t,this.localOptions=t[this.type],this.canTranslate=this.localOptions&&this.localOptions.translate}translate(){this.canTranslate&&(this.translated=this.translateBlock(this.raw,this.type))}get output(){return this.translated?this.translated:this.raw?Object.fromEntries(this.raw):void 0}translateBlock(e,t){let r=vh.get(t),s=gh.get(t),n=oo.get(t),o=this.options[t],a=o.reviveValues&&!!r,l=o.translateValues&&!!s,c=o.translateKeys&&!!n,d={};for(let[f,y]of e)a&&r.has(f)?y=r.get(f)(y):l&&s.has(f)&&(y=this.translateValue(y,s.get(f))),c&&n.has(f)&&(f=n.get(f)||f),d[f]=y;return d}translateValue(e,t){return t[e]||t.DEFAULT||e}assignToOutput(e,t){this.assignObjectToOutput(e,this.constructor.type,t)}assignObjectToOutput(e,t,r){if(this.globalOptions.mergeOutput)return Object.assign(e,r);e[t]?Object.assign(e[t],r):e[t]=r}};ve(vr,"headerLength",4),ve(vr,"type",void 0),ve(vr,"multiSegment",!1),ve(vr,"canHandle",()=>!1);function KS(i){return i===192||i===194||i===196||i===219||i===221||i===218||i===254}function XS(i){return i>=224&&i<=239}function YS(i,e,t){for(let[r,s]of Nt)if(s.canHandle(i,e,t))return r}var rl=class extends class{constructor(e,t,r){ve(this,"errors",[]),ve(this,"ensureSegmentChunk",async s=>{let n=s.start,o=s.size||65536;if(this.file.chunked)if(this.file.available(n,o))s.chunk=this.file.subarray(n,o);else try{s.chunk=await this.file.readChunk(n,o)}catch(a){st(`Couldn't read segment: ${JSON.stringify(s)}. ${a.message}`)}else this.file.byteLength>n+o?s.chunk=this.file.subarray(n,o):s.size===void 0?s.chunk=this.file.subarray(n):st("Segment unreachable: "+JSON.stringify(s));return s.chunk}),this.extendOptions&&this.extendOptions(e),this.options=e,this.file=t,this.parsers=r}injectSegment(e,t){this.options[e].enabled&&this.createParser(e,t)}createParser(e,t){let r=new(Nt.get(e))(t,this.options,this.file);return this.parsers[e]=r}createParsers(e){for(let t of e){let{type:r,chunk:s}=t,n=this.options[r];if(n&&n.enabled){let o=this.parsers[r];o&&o.append||o||this.createParser(r,s)}}}async readSegments(e){let t=e.map(this.ensureSegmentChunk);await Promise.all(t)}}{constructor(...e){super(...e),ve(this,"appSegments",[]),ve(this,"jpegSegments",[]),ve(this,"unknownSegments",[])}static canHandle(e,t){return t===65496}async parse(){await this.findAppSegments(),await this.readSegments(this.appSegments),this.mergeMultiSegments(),this.createParsers(this.mergedAppSegments||this.appSegments)}setupSegmentFinderArgs(e){e===!0?(this.findAll=!0,this.wanted=new Set(Nt.keyList())):(e=e===void 0?Nt.keyList().filter(t=>this.options[t].enabled):e.filter(t=>this.options[t].enabled&&Nt.has(t)),this.findAll=!1,this.remaining=new Set(e),this.wanted=new Set(e)),this.unfinishedMultiSegment=!1}async findAppSegments(e=0,t){this.setupSegmentFinderArgs(t);let{file:r,findAll:s,wanted:n,remaining:o}=this;if(!s&&this.file.chunked&&(s=Array.from(n).some(a=>{let l=Nt.get(a),c=this.options[a];return l.multiSegment&&c.multiSegment}),s&&await this.file.readWhole()),e=this.findAppSegmentsInRange(e,r.byteLength),!this.options.onlyTiff&&r.chunked){let a=!1;for(;o.size>0&&!a&&(r.canReadNextChunk||this.unfinishedMultiSegment);){let{nextChunkOffset:l}=r,c=this.appSegments.some(d=>!this.file.available(d.offset||d.start,d.length||d.size));if(a=e>l&&!c?!await r.readNextChunk(e):!await r.readNextChunk(l),(e=this.findAppSegmentsInRange(e,r.byteLength))===void 0)return}}}findAppSegmentsInRange(e,t){t-=2;let r,s,n,o,a,l,{file:c,findAll:d,wanted:f,remaining:y,options:v}=this;for(;e<t;e++)if(c.getUint8(e)===255){if(r=c.getUint8(e+1),XS(r)){if(s=c.getUint16(e+2),n=YS(c,e,s),n&&f.has(n)&&(o=Nt.get(n),a=o.findPosition(c,e),l=v[n],a.type=n,this.appSegments.push(a),!d&&(o.multiSegment&&l.multiSegment?(this.unfinishedMultiSegment=a.chunkNumber<a.chunkCount,this.unfinishedMultiSegment||y.delete(n)):y.delete(n),y.size===0)))break;v.recordUnknownSegments&&(a=vr.findPosition(c,e),a.marker=r,this.unknownSegments.push(a)),e+=s+1}else if(KS(r)){if(s=c.getUint16(e+2),r===218&&v.stopAfterSos!==!1)return;v.recordJpegSegments&&this.jpegSegments.push({offset:e,length:s,marker:r}),e+=s+1}}return e}mergeMultiSegments(){if(!this.appSegments.some(t=>t.multiSegment))return;let e=function(t,r){let s,n,o,a=new Map;for(let l=0;l<t.length;l++)s=t[l],n=s[r],a.has(n)?o=a.get(n):a.set(n,o=[]),o.push(s);return Array.from(a)}(this.appSegments,"type");this.mergedAppSegments=e.map(([t,r])=>{let s=Nt.get(t,this.options);return s.handleMultiSegments?{type:t,chunk:s.handleMultiSegments(r)}:r[0]})}getSegment(e){return this.appSegments.find(t=>t.type===e)}async getOrFindSegment(e){let t=this.getSegment(e);return t===void 0&&(await this.findAppSegments(0,[e]),t=this.getSegment(e)),t}};ve(rl,"type","jpeg"),sl.set("jpeg",rl);var ZS=[void 0,1,1,2,4,8,1,1,2,4,8,4,8,4],dh=class extends vr{parseHeader(){var e=this.chunk.getUint16();e===18761?this.le=!0:e===19789&&(this.le=!1),this.chunk.le=this.le,this.headerParsed=!0}parseTags(e,t,r=new Map){let{pick:s,skip:n}=this.options[t];s=new Set(s);let o=s.size>0,a=n.size===0,l=this.chunk.getUint16(e);e+=2;for(let c=0;c<l;c++){let d=this.chunk.getUint16(e);if(o){if(s.has(d)&&(r.set(d,this.parseTag(e,d,t)),s.delete(d),s.size===0))break}else!a&&n.has(d)||r.set(d,this.parseTag(e,d,t));e+=12}return r}parseTag(e,t,r){let{chunk:s}=this,n=s.getUint16(e+2),o=s.getUint32(e+4),a=ZS[n];if(a*o<=4?e+=8:e=s.getUint32(e+8),(n<1||n>13)&&st(`Invalid TIFF value type. block: ${r.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e}`),e>s.byteLength&&st(`Invalid TIFF value offset. block: ${r.toUpperCase()}, tag: ${t.toString(16)}, type: ${n}, offset ${e} is outside of chunk size ${s.byteLength}`),n===1)return s.getUint8Array(e,o);if(n===2)return(l=function(c){for(;c.endsWith("\0");)c=c.slice(0,-1);return c}(l=s.getString(e,o)).trim())===""?void 0:l;var l;if(n===7)return s.getUint8Array(e,o);if(o===1)return this.parseTagValue(n,e);{let c=new(function(f){switch(f){case 1:return Uint8Array;case 3:return Uint16Array;case 4:return Uint32Array;case 5:return Array;case 6:return Int8Array;case 8:return Int16Array;case 9:return Int32Array;case 10:return Array;case 11:return Float32Array;case 12:return Float64Array;default:return Array}}(n))(o),d=a;for(let f=0;f<o;f++)c[f]=this.parseTagValue(n,e),e+=d;return c}}parseTagValue(e,t){let{chunk:r}=this;switch(e){case 1:return r.getUint8(t);case 3:return r.getUint16(t);case 4:return r.getUint32(t);case 5:return r.getUint32(t)/r.getUint32(t+4);case 6:return r.getInt8(t);case 8:return r.getInt16(t);case 9:return r.getInt32(t);case 10:return r.getInt32(t)/r.getInt32(t+4);case 11:return r.getFloat(t);case 12:return r.getDouble(t);case 13:return r.getUint32(t);default:st(`Invalid tiff type ${e}`)}}},eo=class extends dh{static canHandle(e,t){return e.getUint8(t+1)===225&&e.getUint32(t+4)===1165519206&&e.getUint16(t+8)===0}async parse(){this.parseHeader();let{options:e}=this;return e.ifd0.enabled&&await this.parseIfd0Block(),e.exif.enabled&&await this.safeParse("parseExifBlock"),e.gps.enabled&&await this.safeParse("parseGpsBlock"),e.interop.enabled&&await this.safeParse("parseInteropBlock"),e.ifd1.enabled&&await this.safeParse("parseThumbnailBlock"),this.createOutput()}safeParse(e){let t=this[e]();return t.catch!==void 0&&(t=t.catch(this.handleError)),t}findIfd0Offset(){this.ifd0Offset===void 0&&(this.ifd0Offset=this.chunk.getUint32(4))}findIfd1Offset(){if(this.ifd1Offset===void 0){this.findIfd0Offset();let e=this.chunk.getUint16(this.ifd0Offset),t=this.ifd0Offset+2+12*e;this.ifd1Offset=this.chunk.getUint32(t)}}parseBlock(e,t){let r=new Map;return this[t]=r,this.parseTags(e,t,r),r}async parseIfd0Block(){if(this.ifd0)return;let{file:e}=this;this.findIfd0Offset(),this.ifd0Offset<8&&st("Malformed EXIF data"),!e.chunked&&this.ifd0Offset>e.byteLength&&st(`IFD0 offset points to outside of file.
|
|
97
|
+
this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&await e.ensureChunk(this.ifd0Offset,eg(this.options));let t=this.parseBlock(this.ifd0Offset,"ifd0");return t.size!==0?(this.exifOffset=t.get(34665),this.interopOffset=t.get(40965),this.gpsOffset=t.get(34853),this.xmp=t.get(700),this.iptc=t.get(33723),this.icc=t.get(34675),this.options.sanitize&&(t.delete(34665),t.delete(40965),t.delete(34853),t.delete(700),t.delete(33723),t.delete(34675)),t):void 0}async parseExifBlock(){if(this.exif||(this.ifd0||await this.parseIfd0Block(),this.exifOffset===void 0))return;this.file.tiff&&await this.file.ensureChunk(this.exifOffset,eg(this.options));let e=this.parseBlock(this.exifOffset,"exif");return this.interopOffset||(this.interopOffset=e.get(40965)),this.makerNote=e.get(37500),this.userComment=e.get(37510),this.options.sanitize&&(e.delete(40965),e.delete(37500),e.delete(37510)),this.unpack(e,41728),this.unpack(e,41729),e}unpack(e,t){let r=e.get(t);r&&r.length===1&&e.set(t,r[0])}async parseGpsBlock(){if(this.gps||(this.ifd0||await this.parseIfd0Block(),this.gpsOffset===void 0))return;let e=this.parseBlock(this.gpsOffset,"gps");return e&&e.has(2)&&e.has(4)&&(e.set("latitude",ng(...e.get(2),e.get(1))),e.set("longitude",ng(...e.get(4),e.get(3)))),e}async parseInteropBlock(){if(!this.interop&&(this.ifd0||await this.parseIfd0Block(),this.interopOffset!==void 0||this.exif||await this.parseExifBlock(),this.interopOffset!==void 0))return this.parseBlock(this.interopOffset,"interop")}async parseThumbnailBlock(e=!1){if(!this.ifd1&&!this.ifd1Parsed&&(!this.options.mergeOutput||e))return this.findIfd1Offset(),this.ifd1Offset>0&&(this.parseBlock(this.ifd1Offset,"ifd1"),this.ifd1Parsed=!0),this.ifd1}async extractThumbnail(){if(this.headerParsed||this.parseHeader(),this.ifd1Parsed||await this.parseThumbnailBlock(!0),this.ifd1===void 0)return;let e=this.ifd1.get(513),t=this.ifd1.get(514);return this.chunk.getUint8Array(e,t)}get image(){return this.ifd0}get thumbnail(){return this.ifd1}createOutput(){let e,t,r,s={};for(t of Ve)if(e=this[t],!ug(e))if(r=this.canTranslate?this.translateBlock(e,t):Object.fromEntries(e),this.options.mergeOutput){if(t==="ifd1")continue;Object.assign(s,r)}else s[t]=r;return this.makerNote&&(s.makerNote=this.makerNote),this.userComment&&(s.userComment=this.userComment),s}assignToOutput(e,t){if(this.globalOptions.mergeOutput)Object.assign(e,t);else for(let[r,s]of Object.entries(t))this.assignObjectToOutput(e,r,s)}};function ng(i,e,t,r){var s=i+e/60+t/3600;return r!=="S"&&r!=="W"||(s*=-1),s}ve(eo,"type","tiff"),ve(eo,"headerLength",10),Nt.set("tiff",eo);var nF=Object.freeze({__proto__:null,default:GS,Exifr:qs,fileParsers:sl,segmentParsers:Nt,fileReaders:no,tagKeys:oo,tagValues:gh,tagRevivers:vh,createDictionary:hg,extendDictionary:dg,fetchUrlAsArrayBuffer:el,readBlobAsArrayBuffer:ro,chunkedProps:Us,otherSegments:nl,segments:so,tiffBlocks:Ve,segmentsAndBlocks:zs,tiffExtractables:Hs,inheritables:ol,allFormatters:$s,Options:Jr,parse:pg}),bh={ifd0:!1,ifd1:!1,exif:!1,gps:!1,interop:!1,sanitize:!1,reviveValues:!0,translateKeys:!1,translateValues:!1,mergeOutput:!1},oF=Object.assign({},bh,{firstChunkSize:4e4,gps:[1,2,3,4]});var aF=Object.assign({},bh,{tiff:!1,ifd1:!0,mergeOutput:!1});var QS=Object.assign({},bh,{firstChunkSize:4e4,ifd0:[274]});async function JS(i){let e=new qs(QS);await e.read(i);let t=await e.parse();if(t&&t.ifd0)return t.ifd0[274]}var eE=Object.freeze({1:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:0,rad:0},2:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:0,rad:0},3:{dimensionSwapped:!1,scaleX:1,scaleY:1,deg:180,rad:180*Math.PI/180},4:{dimensionSwapped:!1,scaleX:-1,scaleY:1,deg:180,rad:180*Math.PI/180},5:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:90,rad:90*Math.PI/180},6:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:90,rad:90*Math.PI/180},7:{dimensionSwapped:!0,scaleX:1,scaleY:-1,deg:270,rad:270*Math.PI/180},8:{dimensionSwapped:!0,scaleX:1,scaleY:1,deg:270,rad:270*Math.PI/180}}),Qn=!0,Jn=!0;if(typeof navigator=="object"){let i=navigator.userAgent;if(i.includes("iPad")||i.includes("iPhone")){let e=i.match(/OS (\d+)_(\d+)/);if(e){let[,t,r]=e;Qn=Number(t)+.1*Number(r)<13.4,Jn=!1}}else if(i.includes("OS X 10")){let[,e]=i.match(/OS X 10[_.](\d+)/);Qn=Jn=Number(e)<15}if(i.includes("Chrome/")){let[,e]=i.match(/Chrome\/(\d+)/);Qn=Jn=Number(e)<81}else if(i.includes("Firefox/")){let[,e]=i.match(/Firefox\/(\d+)/);Qn=Jn=Number(e)<77}}async function fg(i){let e=await JS(i);return Object.assign({canvas:Qn,css:Jn},eE[e])}var ph=class extends Qr{constructor(...e){super(...e),ve(this,"ranges",new fh),this.byteLength!==0&&this.ranges.add(0,this.byteLength)}_tryExtend(e,t,r){if(e===0&&this.byteLength===0&&r){let s=new DataView(r.buffer||r,r.byteOffset,r.byteLength);this._swapDataView(s)}else{let s=e+t;if(s>this.byteLength){let{dataView:n}=this._extend(s);this._swapDataView(n)}}}_extend(e){let t;t=cg?lg.allocUnsafe(e):new Uint8Array(e);let r=new DataView(t.buffer,t.byteOffset,t.byteLength);return t.set(new Uint8Array(this.buffer,this.byteOffset,this.byteLength),0),{uintView:t,dataView:r}}subarray(e,t,r=!1){return t=t||this._lengthToEnd(e),r&&this._tryExtend(e,t),this.ranges.add(e,t),super.subarray(e,t)}set(e,t,r=!1){r&&this._tryExtend(t,e.byteLength,e);let s=super.set(e,t);return this.ranges.add(t,s.byteLength),s}async ensureChunk(e,t){this.chunked&&(this.ranges.available(e,t)||await this.readChunk(e,t))}available(e,t){return this.ranges.available(e,t)}},fh=class{constructor(){ve(this,"list",[])}get length(){return this.list.length}add(e,t,r=0){let s=e+t,n=this.list.filter(o=>og(e,o.offset,s)||og(e,o.end,s));if(n.length>0){e=Math.min(e,...n.map(a=>a.offset)),s=Math.max(s,...n.map(a=>a.end)),t=s-e;let o=n.shift();o.offset=e,o.length=t,o.end=s,this.list=this.list.filter(a=>!n.includes(a))}else this.list.push({offset:e,length:t,end:s})}available(e,t){let r=e+t;return this.list.some(s=>s.offset<=e&&r<=s.end)}};function og(i,e,t){return i<=e&&e<=t}var mh=class extends ph{constructor(e,t){super(0),ve(this,"chunksRead",0),this.input=e,this.options=t}async readWhole(){this.chunked=!1,await this.readChunk(this.nextChunkOffset)}async readChunked(){this.chunked=!0,await this.readChunk(0,this.options.firstChunkSize)}async readNextChunk(e=this.nextChunkOffset){if(this.fullyRead)return this.chunksRead++,!1;let t=this.options.chunkSize,r=await this.readChunk(e,t);return!!r&&r.byteLength===t}async readChunk(e,t){if(this.chunksRead++,(t=this.safeWrapAddress(e,t))!==0)return this._readChunk(e,t)}safeWrapAddress(e,t){return this.size!==void 0&&e+t>this.size?Math.max(0,this.size-e):t}get nextChunkOffset(){if(this.ranges.list.length!==0)return this.ranges.list[0].length}get canReadNextChunk(){return this.chunksRead<this.options.chunkLimit}get fullyRead(){return this.size!==void 0&&this.nextChunkOffset===this.size}read(){return this.options.chunked?this.readChunked():this.readWhole()}close(){}};no.set("blob",class extends mh{async readWhole(){this.chunked=!1;let i=await ro(this.input);this._swapArrayBuffer(i)}readChunked(){return this.chunked=!0,this.size=this.input.size,super.readChunked()}async _readChunk(i,e){let t=e?i+e:void 0,r=this.input.slice(i,t),s=await ro(r);return this.set(s,i,!0)}});var mg={strings:{generatingThumbnails:"Generating thumbnails..."}};var tE={version:"4.1.1"};function iE(i,e,t){try{i.getContext("2d").getImageData(0,0,1,1)}catch(r){if(r.code===18)return Promise.reject(new Error("cannot read image, probably an svg with external resources"))}return i.toBlob?new Promise(r=>{i.toBlob(r,e,t)}).then(r=>{if(r===null)throw new Error("cannot read image, probably an svg with external resources");return r}):Promise.resolve().then(()=>Qm(i.toDataURL(e,t),{})).then(r=>{if(r===null)throw new Error("could not extract blob, probably an old browser");return r})}function rE(i,e){let t=i.width,r=i.height;(e.deg===90||e.deg===270)&&(t=i.height,r=i.width);let s=document.createElement("canvas");s.width=t,s.height=r;let n=s.getContext("2d");return n.translate(t/2,r/2),e.canvas&&(n.rotate(e.rad),n.scale(e.scaleX,e.scaleY)),n.drawImage(i,-i.width/2,-i.height/2,i.width,i.height),s}function sE(i){let e=i.width/i.height,t=5e6,r=4096,s=Math.floor(Math.sqrt(t*e)),n=Math.floor(t/Math.sqrt(t*e));if(s>r&&(s=r,n=Math.round(s/e)),n>r&&(n=r,s=Math.round(e*n)),i.width>s){let o=document.createElement("canvas");return o.width=s,o.height=n,o.getContext("2d").drawImage(i,0,0,s,n),o}return i}var nE={thumbnailWidth:null,thumbnailHeight:null,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,lazy:!1},Vs=class extends di{constructor(e,t){if(super(e,{...nE,...t}),this.onFileAdded=r=>{!r.preview&&r.data&&Ja(r.type)&&!r.isRemote&&this.addToQueue(r.id)},this.onCancelRequest=r=>{let s=this.queue.indexOf(r.id);s!==-1&&this.queue.splice(s,1)},this.onFileRemoved=r=>{let s=this.queue.indexOf(r.id);s!==-1&&this.queue.splice(s,1),r.preview&&Qa(r.preview)&&URL.revokeObjectURL(r.preview)},this.onRestored=()=>{this.uppy.getFiles().filter(s=>s.isRestored).forEach(s=>{(!s.preview||Qa(s.preview))&&this.addToQueue(s.id)})},this.onAllFilesRemoved=()=>{this.queue=[]},this.waitUntilAllProcessed=r=>{r.forEach(n=>{let o=this.uppy.getFile(n);this.uppy.emit("preprocess-progress",o,{mode:"indeterminate",message:this.i18n("generatingThumbnails")})});let s=()=>{r.forEach(n=>{let o=this.uppy.getFile(n);this.uppy.emit("preprocess-complete",o)})};return new Promise(n=>{this.queueProcessing?this.uppy.once("thumbnail:all-generated",()=>{s(),n()}):(s(),n())})},this.type="modifier",this.id=this.opts.id||"ThumbnailGenerator",this.title="Thumbnail Generator",this.queue=[],this.queueProcessing=!1,this.defaultThumbnailDimension=200,this.thumbnailType=this.opts.thumbnailType,this.defaultLocale=mg,this.i18nInit(),this.opts.lazy&&this.opts.waitForThumbnailsBeforeUpload)throw new Error("ThumbnailGenerator: The `lazy` and `waitForThumbnailsBeforeUpload` options are mutually exclusive. Please ensure at most one of them is set to `true`.")}createThumbnail(e,t,r){let s=URL.createObjectURL(e.data),n=new Promise((a,l)=>{let c=new Image;c.src=s,c.addEventListener("load",()=>{URL.revokeObjectURL(s),a(c)}),c.addEventListener("error",d=>{URL.revokeObjectURL(s),l(d.error||new Error("Could not create thumbnail"))})}),o=fg(e.data).catch(()=>1);return Promise.all([n,o]).then(a=>{let[l,c]=a,d=this.getProportionalDimensions(l,t,r,c.deg),f=rE(l,c),y=this.resizeImage(f,d.width,d.height);return iE(y,this.thumbnailType,80)}).then(a=>URL.createObjectURL(a))}getProportionalDimensions(e,t,r,s){let n=e.width/e.height;return(s===90||s===270)&&(n=e.height/e.width),t!=null?{width:t,height:Math.round(t/n)}:r!=null?{width:Math.round(r*n),height:r}:{width:this.defaultThumbnailDimension,height:Math.round(this.defaultThumbnailDimension/n)}}resizeImage(e,t,r){let s=sE(e),n=Math.ceil(Math.log2(s.width/t));n<1&&(n=1);let o=t*2**(n-1),a=r*2**(n-1),l=2;for(;n--;){let c=document.createElement("canvas");c.width=o,c.height=a,c.getContext("2d").drawImage(s,0,0,o,a),s=c,o=Math.round(o/l),a=Math.round(a/l)}return s}setPreviewURL(e,t){this.uppy.setFileState(e,{preview:t})}addToQueue(e){this.queue.push(e),this.queueProcessing===!1&&this.processQueue()}processQueue(){if(this.queueProcessing=!0,this.queue.length>0){let e=this.uppy.getFile(this.queue.shift());return e?this.requestThumbnail(e).catch(()=>{}).then(()=>this.processQueue()):(this.uppy.log("[ThumbnailGenerator] file was removed before a thumbnail could be generated, but not removed from the queue. This is probably a bug","error"),Promise.resolve())}return this.queueProcessing=!1,this.uppy.log("[ThumbnailGenerator] Emptied thumbnail queue"),this.uppy.emit("thumbnail:all-generated"),Promise.resolve()}requestThumbnail(e){return Ja(e.type)&&!e.isRemote?this.createThumbnail(e,this.opts.thumbnailWidth,this.opts.thumbnailHeight).then(t=>{this.setPreviewURL(e.id,t),this.uppy.log(`[ThumbnailGenerator] Generated thumbnail for ${e.id}`),this.uppy.emit("thumbnail:generated",this.uppy.getFile(e.id),t)}).catch(t=>{this.uppy.log(`[ThumbnailGenerator] Failed thumbnail for ${e.id}:`,"warning"),this.uppy.log(t,"warning"),this.uppy.emit("thumbnail:error",this.uppy.getFile(e.id),t)}):Promise.resolve()}install(){this.uppy.on("file-removed",this.onFileRemoved),this.uppy.on("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("thumbnail:cancel",this.onCancelRequest)):(this.uppy.on("thumbnail:request",this.onFileAdded),this.uppy.on("file-added",this.onFileAdded),this.uppy.on("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.addPreProcessor(this.waitUntilAllProcessed)}uninstall(){this.uppy.off("file-removed",this.onFileRemoved),this.uppy.off("cancel-all",this.onAllFilesRemoved),this.opts.lazy?(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("thumbnail:cancel",this.onCancelRequest)):(this.uppy.off("thumbnail:request",this.onFileAdded),this.uppy.off("file-added",this.onFileAdded),this.uppy.off("restored",this.onRestored)),this.opts.waitForThumbnailsBeforeUpload&&this.uppy.removePreProcessor(this.waitUntilAllProcessed)}};Vs.VERSION=tE.version;function oE(i){if(typeof i=="string"){let e=document.querySelectorAll(i);return e.length===0?null:Array.from(e)}return typeof i=="object"&&Wn(i)?[i]:null}var yh=oE;var br=Array.from;function al(i,e,t,r){let{onSuccess:s}=r;i.readEntries(n=>{let o=[...e,...n];n.length?queueMicrotask(()=>{al(i,o,t,{onSuccess:s})}):s(o)},n=>{t(n),s(e)})}function gg(i,e){return i==null?i:{kind:i.isFile?"file":i.isDirectory?"directory":void 0,name:i.name,getFile(){return new Promise((t,r)=>i.file(t,r))},async*values(){let t=i.createReader();yield*await new Promise(s=>{al(t,[],e,{onSuccess:n=>s(n.map(o=>gg(o,e)))})})},isSameEntry:void 0}}function vg(i,e,t){try{return t===void 0&&(t=void 0),async function*(){let r=()=>`${e}/${i.name}`;if(i.kind==="file"){let s=await i.getFile();s!=null?(s.relativePath=e?r():null,yield s):t!=null&&(yield t)}else if(i.kind==="directory")for await(let s of i.values())yield*vg(s,e?r():i.name);else t!=null&&(yield t)}()}catch(r){return Promise.reject(r)}}async function*wh(i,e){let t=await Promise.all(Array.from(i.items,async r=>{var s;let n,o=()=>typeof r.getAsEntry=="function"?r.getAsEntry():r.webkitGetAsEntry();return(s=n)!=null||(n=gg(o(),e)),{fileSystemHandle:n,lastResortFile:r.getAsFile()}}));for(let{lastResortFile:r,fileSystemHandle:s}of t)if(s!=null)try{yield*vg(s,"",r)}catch(n){r!=null?yield r:e(n)}else r!=null&&(yield r)}function Sh(i){let e=br(i.files);return Promise.resolve(e)}async function Eh(i,e){var t;let r=(t=e?.logDropError)!=null?t:Function.prototype;try{let s=[];for await(let n of wh(i,r))s.push(n);return s}catch{return Sh(i)}}var Gg=Fe(wt(),1);function ao(i){return{...i,type:i.mimeType,extension:i.name?Vr(i.name).extension:null}}var lo,ze,Th,bg,co=0,Ag=[],je=Ee,yg=je.__b,wg=je.__r,Sg=je.diffed,Eg=je.__c,Tg=je.unmount,xg=je.__;function kh(i,e){je.__h&&je.__h(ze,i,co||e),co=0;var t=ze.__H||(ze.__H={__:[],__h:[]});return i>=t.__.length&&t.__.push({}),t.__[i]}function fi(i){return co=1,aE(Pg,i)}function aE(i,e,t){var r=kh(lo++,2);if(r.t=i,!r.__c&&(r.__=[t?t(e):Pg(void 0,e),function(a){var l=r.__N?r.__N[0]:r.__[0],c=r.t(l,a);l!==c&&(r.__N=[c,r.__[1]],r.__c.setState({}))}],r.__c=ze,!ze.__f)){var s=function(a,l,c){if(!r.__c.__H)return!0;var d=r.__c.__H.__.filter(function(y){return!!y.__c});if(d.every(function(y){return!y.__N}))return!n||n.call(this,a,l,c);var f=r.__c.props!==a;return d.forEach(function(y){if(y.__N){var v=y.__[0];y.__=y.__N,y.__N=void 0,v!==y.__[0]&&(f=!0)}}),n&&n.call(this,a,l,c)||f};ze.__f=!0;var n=ze.shouldComponentUpdate,o=ze.componentWillUpdate;ze.componentWillUpdate=function(a,l,c){if(this.__e){var d=n;n=void 0,s(a,l,c),n=d}o&&o.call(this,a,l,c)},ze.shouldComponentUpdate=s}return r.__N||r.__}function ki(i,e){var t=kh(lo++,3);!je.__s&&Cg(t.__H,e)&&(t.__=i,t.u=e,ze.__H.__h.push(t))}function es(i){return co=5,ts(function(){return{current:i}},[])}function ts(i,e){var t=kh(lo++,7);return Cg(t.__H,e)&&(t.__=i(),t.__H=e,t.__h=i),t.__}function is(i,e){return co=8,ts(function(){return i},e)}function lE(){for(var i;i=Ag.shift();)if(i.__P&&i.__H)try{i.__H.__h.forEach(ll),i.__H.__h.forEach(xh),i.__H.__h=[]}catch(e){i.__H.__h=[],je.__e(e,i.__v)}}je.__b=function(i){ze=null,yg&&yg(i)},je.__=function(i,e){i&&e.__k&&e.__k.__m&&(i.__m=e.__k.__m),xg&&xg(i,e)},je.__r=function(i){wg&&wg(i),lo=0;var e=(ze=i.__c).__H;e&&(Th===ze?(e.__h=[],ze.__h=[],e.__.forEach(function(t){t.__N&&(t.__=t.__N),t.u=t.__N=void 0})):(e.__h.forEach(ll),e.__h.forEach(xh),e.__h=[],lo=0)),Th=ze},je.diffed=function(i){Sg&&Sg(i);var e=i.__c;e&&e.__H&&(e.__H.__h.length&&(Ag.push(e)!==1&&bg===je.requestAnimationFrame||((bg=je.requestAnimationFrame)||cE)(lE)),e.__H.__.forEach(function(t){t.u&&(t.__H=t.u),t.u=void 0})),Th=ze=null},je.__c=function(i,e){e.some(function(t){try{t.__h.forEach(ll),t.__h=t.__h.filter(function(r){return!r.__||xh(r)})}catch(r){e.some(function(s){s.__h&&(s.__h=[])}),e=[],je.__e(r,t.__v)}}),Eg&&Eg(i,e)},je.unmount=function(i){Tg&&Tg(i);var e,t=i.__c;t&&t.__H&&(t.__H.__.forEach(function(r){try{ll(r)}catch(s){e=s}}),t.__H=void 0,e&&je.__e(e,t.__v))};var kg=typeof requestAnimationFrame=="function";function cE(i){var e,t=function(){clearTimeout(r),kg&&cancelAnimationFrame(e),setTimeout(i)},r=setTimeout(t,100);kg&&(e=requestAnimationFrame(t))}function ll(i){var e=ze,t=i.__c;typeof t=="function"&&(i.__c=void 0,t()),ze=e}function xh(i){var e=ze;i.__c=i.__(),ze=e}function Cg(i,e){return!i||i.length!==e.length||e.some(function(t,r){return t!==i[r]})}function Pg(i,e){return typeof e=="function"?e(i):e}function uE(){return u("svg",{width:"26",height:"26",viewBox:"0 0 26 26",xmlns:"http://www.w3.org/2000/svg"},u("g",{fill:"none","fill-rule":"evenodd"},u("circle",{fill:"#FFF",cx:"13",cy:"13",r:"13"}),u("path",{d:"M21.64 13.205c0-.639-.057-1.252-.164-1.841H13v3.481h4.844a4.14 4.14 0 01-1.796 2.716v2.259h2.908c1.702-1.567 2.684-3.875 2.684-6.615z",fill:"#4285F4","fill-rule":"nonzero"}),u("path",{d:"M13 22c2.43 0 4.467-.806 5.956-2.18l-2.908-2.259c-.806.54-1.837.86-3.048.86-2.344 0-4.328-1.584-5.036-3.711H4.957v2.332A8.997 8.997 0 0013 22z",fill:"#34A853","fill-rule":"nonzero"}),u("path",{d:"M7.964 14.71A5.41 5.41 0 017.682 13c0-.593.102-1.17.282-1.71V8.958H4.957A8.996 8.996 0 004 13c0 1.452.348 2.827.957 4.042l3.007-2.332z",fill:"#FBBC05","fill-rule":"nonzero"}),u("path",{d:"M13 7.58c1.321 0 2.508.454 3.44 1.345l2.582-2.58C17.463 4.891 15.426 4 13 4a8.997 8.997 0 00-8.043 4.958l3.007 2.332C8.672 9.163 10.656 7.58 13 7.58z",fill:"#EA4335","fill-rule":"nonzero"}),u("path",{d:"M4 4h18v18H4z"})))}function hE(i){let{pluginName:e,i18n:t,onAuth:r}=i,s=e==="Google Drive",n=is(o=>{o.preventDefault(),r()},[r]);return u("form",{onSubmit:n},s?u("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn uppy-Provider-btn-google","data-uppy-super-focusable":!0},u(uE,null),t("signInWithGoogle")):u("button",{type:"submit",className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Provider-authBtn","data-uppy-super-focusable":!0},t("authenticateWith",{pluginName:e})))}var dE=i=>{let{pluginName:e,i18n:t,onAuth:r}=i;return u(hE,{pluginName:e,i18n:t,onAuth:r})};function cl(i){let{loading:e,pluginName:t,pluginIcon:r,i18n:s,handleAuth:n,renderForm:o=dE}=i;return u("div",{className:"uppy-Provider-auth"},u("div",{className:"uppy-Provider-authIcon"},r()),u("div",{className:"uppy-Provider-authTitle"},s("authenticateWithTitle",{pluginName:t})),o({pluginName:t,i18n:s,loading:e,onAuth:n}))}var Fg=Fe(wt(),1);function Ah(i){let{i18n:e,logout:t,username:r}=i;return u(Mt,null,r&&u("span",{className:"uppy-ProviderBrowser-user",key:"username"},r),u("button",{type:"button",onClick:t,className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowser-userLogout",key:"logout"},e("logOut")))}function Ch(i){let{openFolder:e,title:t,breadcrumbsIcon:r,breadcrumbs:s,i18n:n}=i;return u("div",{className:"uppy-Provider-breadcrumbs"},u("div",{className:"uppy-Provider-breadcrumbsIcon"},r),s.map((o,a)=>{var l;return u(Mt,null,u("button",{key:o.id,type:"button",className:"uppy-u-reset uppy-c-btn",onClick:()=>e(o.id)},o.type==="root"?t:(l=o.data.name)!=null?l:n("unnamed")),s.length===a+1?"":" / ")}))}function Ph(i){return u("div",{className:"uppy-ProviderBrowser-header"},u("div",{className:(0,Fg.default)("uppy-ProviderBrowser-headerBar",!i.showBreadcrumbs&&"uppy-ProviderBrowser-headerBar--simple")},i.showBreadcrumbs&&u(Ch,{openFolder:i.openFolder,breadcrumbs:i.breadcrumbs,breadcrumbsIcon:i.pluginIcon&&i.pluginIcon(),title:i.title,i18n:i.i18n}),u(Ah,{logout:i.logout,username:i.username,i18n:i.i18n})))}function Fh(){return Fh=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},Fh.apply(null,arguments)}var pE={position:"relative",width:"100%",minHeight:"100%"},fE={position:"absolute",top:0,left:0,width:"100%",overflow:"visible"},_h=class extends dt{constructor(e){super(e),this.handleScroll=()=>{this.setState({offset:this.base.scrollTop})},this.handleResize=()=>{this.resize()},this.focusElement=null,this.state={offset:0,height:0}}componentDidMount(){this.resize(),window.addEventListener("resize",this.handleResize)}componentWillUpdate(){this.base.contains(document.activeElement)&&(this.focusElement=document.activeElement)}componentDidUpdate(){this.focusElement&&this.focusElement.parentNode&&document.activeElement!==this.focusElement&&this.focusElement.focus(),this.focusElement=null,this.resize()}componentWillUnmount(){window.removeEventListener("resize",this.handleResize)}resize(){let{height:e}=this.state;e!==this.base.offsetHeight&&this.setState({height:this.base.offsetHeight})}render(e){let{data:t,rowHeight:r,renderRow:s,overscanCount:n=10,...o}=e,{offset:a,height:l}=this.state,c=Math.floor(a/r),d=Math.floor(l/r);n&&(c=Math.max(0,c-c%n),d+=n);let f=c+d+4,y=t.slice(c,f),v={...pE,height:t.length*r},x={...fE,top:c*r};return u("div",Fh({onScroll:this.handleScroll},o),u("div",{role:"presentation",style:v},u("div",{role:"presentation",style:x},y.map(s))))}},ul=_h;var _g=Fe(wt(),1);function mE(){return u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:11,height:14.5,viewBox:"0 0 44 58"},u("path",{d:"M27.437.517a1 1 0 0 0-.094.03H4.25C2.037.548.217 2.368.217 4.58v48.405c0 2.212 1.82 4.03 4.03 4.03H39.03c2.21 0 4.03-1.818 4.03-4.03V15.61a1 1 0 0 0-.03-.28 1 1 0 0 0 0-.093 1 1 0 0 0-.03-.032 1 1 0 0 0 0-.03 1 1 0 0 0-.032-.063 1 1 0 0 0-.03-.063 1 1 0 0 0-.032 0 1 1 0 0 0-.03-.063 1 1 0 0 0-.032-.03 1 1 0 0 0-.03-.063 1 1 0 0 0-.063-.062l-14.593-14a1 1 0 0 0-.062-.062A1 1 0 0 0 28 .708a1 1 0 0 0-.374-.157 1 1 0 0 0-.156 0 1 1 0 0 0-.03-.03l-.003-.003zM4.25 2.547h22.218v9.97c0 2.21 1.82 4.03 4.03 4.03h10.564v36.438a2.02 2.02 0 0 1-2.032 2.032H4.25c-1.13 0-2.032-.9-2.032-2.032V4.58c0-1.13.902-2.032 2.03-2.032zm24.218 1.345l10.375 9.937.75.718H30.5c-1.13 0-2.032-.9-2.032-2.03V3.89z"}))}function gE(){return u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",style:{minWidth:16,marginRight:3},viewBox:"0 0 276.157 276.157"},u("path",{d:"M273.08 101.378c-3.3-4.65-8.86-7.32-15.254-7.32h-24.34V67.59c0-10.2-8.3-18.5-18.5-18.5h-85.322c-3.63 0-9.295-2.875-11.436-5.805l-6.386-8.735c-4.982-6.814-15.104-11.954-23.546-11.954H58.73c-9.292 0-18.638 6.608-21.737 15.372l-2.033 5.752c-.958 2.71-4.72 5.37-7.596 5.37H18.5C8.3 49.09 0 57.39 0 67.59v167.07c0 .886.16 1.73.443 2.52.152 3.306 1.18 6.424 3.053 9.064 3.3 4.652 8.86 7.32 15.255 7.32h188.487c11.395 0 23.27-8.425 27.035-19.18l40.677-116.188c2.11-6.035 1.43-12.164-1.87-16.816zM18.5 64.088h8.864c9.295 0 18.64-6.607 21.738-15.37l2.032-5.75c.96-2.712 4.722-5.373 7.597-5.373h29.565c3.63 0 9.295 2.876 11.437 5.806l6.386 8.735c4.982 6.815 15.104 11.954 23.546 11.954h85.322c1.898 0 3.5 1.602 3.5 3.5v26.47H69.34c-11.395 0-23.27 8.423-27.035 19.178L15 191.23V67.59c0-1.898 1.603-3.5 3.5-3.5zm242.29 49.15l-40.676 116.188c-1.674 4.78-7.812 9.135-12.877 9.135H18.75c-1.447 0-2.576-.372-3.02-.997-.442-.625-.422-1.814.057-3.18l40.677-116.19c1.674-4.78 7.812-9.134 12.877-9.134h188.487c1.448 0 2.577.372 3.02.997.443.625.423 1.814-.056 3.18z"}))}function vE(){return u("svg",{"aria-hidden":"true",focusable:"false",style:{width:16,marginRight:4},viewBox:"0 0 58 58"},u("path",{d:"M36.537 28.156l-11-7a1.005 1.005 0 0 0-1.02-.033C24.2 21.3 24 21.635 24 22v14a1 1 0 0 0 1.537.844l11-7a1.002 1.002 0 0 0 0-1.688zM26 34.18V23.82L34.137 29 26 34.18z"}),u("path",{d:"M57 6H1a1 1 0 0 0-1 1v44a1 1 0 0 0 1 1h56a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1zM10 28H2v-9h8v9zm-8 2h8v9H2v-9zm10 10V8h34v42H12V40zm44-12h-8v-9h8v9zm-8 2h8v9h-8v-9zm8-22v9h-8V8h8zM2 8h8v9H2V8zm0 42v-9h8v9H2zm54 0h-8v-9h8v9z"}))}function js(i){let{itemIconString:e,alt:t=void 0}=i;if(e===null)return null;switch(e){case"file":return u(mE,null);case"folder":return u(gE,null);case"video":return u(vE,null);default:return u("img",{src:e,alt:t,referrerPolicy:"no-referrer",loading:"lazy",width:16,height:16})}}function bE(i){var e,t;let{file:r,toggleCheckbox:s,className:n,isDisabled:o,restrictionError:a,showTitles:l,children:c=null,i18n:d}=i;return u("li",{className:n,title:o&&a?a:void 0},u("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox uppy-ProviderBrowserItem-checkbox--grid",onChange:s,name:"listitem",id:r.id,checked:r.status==="checked",disabled:o,"data-uppy-super-focusable":!0}),u("label",{htmlFor:r.id,"aria-label":(e=r.data.name)!=null?e:d("unnamed"),className:"uppy-u-reset uppy-ProviderBrowserItem-inner"},u(js,{itemIconString:r.data.thumbnail||r.data.icon}),l&&((t=r.data.name)!=null?t:d("unnamed")),c))}var Oh=bE;function Lh(i){var e,t,r;let{file:s,openFolder:n,className:o,isDisabled:a,restrictionError:l,toggleCheckbox:c,showTitles:d,i18n:f}=i;return u("li",{className:o,title:s.status!=="checked"&&l?l:void 0},u("input",{type:"checkbox",className:"uppy-u-reset uppy-ProviderBrowserItem-checkbox",onChange:c,name:"listitem",id:s.id,checked:s.status==="checked","aria-label":s.data.isFolder?f("allFilesFromFolderNamed",{name:(e=s.data.name)!=null?e:f("unnamed")}):null,disabled:a,"data-uppy-super-focusable":!0}),s.data.isFolder?u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-ProviderBrowserItem-inner",onClick:()=>n(s.id),"aria-label":f("openFolderNamed",{name:(t=s.data.name)!=null?t:f("unnamed")})},u("div",{className:"uppy-ProviderBrowserItem-iconWrap"},u(js,{itemIconString:s.data.icon})),d&&s.data.name?u("span",null,s.data.name):f("unnamed")):u("label",{htmlFor:s.id,className:"uppy-u-reset uppy-ProviderBrowserItem-inner"},u("div",{className:"uppy-ProviderBrowserItem-iconWrap"},u(js,{itemIconString:s.data.icon})),d&&((r=s.data.name)!=null?r:f("unnamed"))))}function Rh(i){let{viewType:e,toggleCheckbox:t,showTitles:r,i18n:s,openFolder:n,file:o,utmSource:a}=i,l=o.type==="folder"?null:o.restrictionError,c=!!l&&o.status!=="checked",d={file:o,openFolder:n,toggleCheckbox:t,utmSource:a,i18n:s,viewType:e,showTitles:r,className:(0,_g.default)("uppy-ProviderBrowserItem",{"uppy-ProviderBrowserItem--disabled":c},{"uppy-ProviderBrowserItem--noPreview":o.data.icon==="video"},{"uppy-ProviderBrowserItem--is-checked":o.status==="checked"},{"uppy-ProviderBrowserItem--is-partial":o.status==="partial"}),isDisabled:c,restrictionError:l};switch(e){case"grid":return u(Oh,d);case"list":return u(Lh,d);case"unsplash":return u(Oh,d,u("a",{href:`${o.data.author.url}?utm_source=${a}&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer",className:"uppy-ProviderBrowserItem-author",tabIndex:-1},o.data.author.name));default:throw new Error(`There is no such type ${e}`)}}function yE(i){let{displayedPartialTree:e,viewType:t,toggleCheckbox:r,handleScroll:s,showTitles:n,i18n:o,isLoading:a,openFolder:l,noResultsLabel:c,virtualList:d,utmSource:f}=i,[y,v]=fi(!1);if(ki(()=>{let C=L=>{L.key==="Shift"&&v(!1)},F=L=>{L.key==="Shift"&&v(!0)};return document.addEventListener("keyup",C),document.addEventListener("keydown",F),()=>{document.removeEventListener("keyup",C),document.removeEventListener("keydown",F)}},[]),a)return u("div",{className:"uppy-Provider-loading"},typeof a=="string"?a:o("loading"));if(e.length===0)return u("div",{className:"uppy-Provider-empty"},c);let x=C=>u(Rh,{viewType:t,toggleCheckbox:F=>{var L;F.stopPropagation(),F.preventDefault(),(L=document.getSelection())==null||L.removeAllRanges(),r(C,y)},showTitles:n,i18n:o,openFolder:l,file:C,utmSource:f});return d?u("div",{className:"uppy-ProviderBrowser-body"},u("ul",{className:"uppy-ProviderBrowser-list"},u(ul,{data:e,renderRow:x,rowHeight:31}))):u("div",{className:"uppy-ProviderBrowser-body"},u("ul",{className:"uppy-ProviderBrowser-list",onScroll:s,role:"listbox",tabIndex:-1},e.map(x)))}var hl=yE;var wE=(i,e,t,r,s)=>{let n=e.filter(v=>v.isFolder===!0),o=e.filter(v=>v.isFolder===!1),a=t.type==="folder"&&t.status==="checked",l=n.map(v=>({type:"folder",id:v.requestPath,cached:!1,nextPagePath:null,status:a?"checked":"unchecked",parentId:t.id,data:v})),c=o.map(v=>{let x=s(v);return{type:"file",id:v.requestPath,restrictionError:x,status:a&&!x?"checked":"unchecked",parentId:t.id,data:v}}),d={...t,cached:!0,nextPagePath:r};return[...i.map(v=>v.id===d.id?d:v),...l,...c]},Og=wE;var SE=(i,e,t,r,s)=>{let n=i.find(x=>x.id===e),o=t.filter(x=>x.isFolder===!0),a=t.filter(x=>x.isFolder===!1),l={...n,nextPagePath:r},c=i.map(x=>x.id===l.id?l:x),d=l.type==="folder"&&l.status==="checked",f=o.map(x=>({type:"folder",id:x.requestPath,cached:!1,nextPagePath:null,status:d?"checked":"unchecked",parentId:l.id,data:x})),y=a.map(x=>{let C=s(x);return{type:"file",id:x.requestPath,restrictionError:C,status:d&&!C?"checked":"unchecked",parentId:l.id,data:x}});return[...c,...f,...y]},Lg=SE;var EE=i=>i.map(e=>({...e})),dl=EE;var Mh=(i,e,t)=>{i.filter(s=>s.type!=="root"&&s.parentId===e).forEach(s=>{s.status=t&&!(s.type==="file"&&s.restrictionError)?"checked":"unchecked",Mh(i,s.id,t)})},Ih=(i,e)=>{let t=i.find(o=>o.id===e);if(t.type==="root")return;let r=i.filter(o=>o.type!=="root"&&o.parentId===t.id&&!(o.type==="file"&&o.restrictionError)),s=r.every(o=>o.status==="checked"),n=r.every(o=>o.status==="unchecked");s?t.status="checked":n?t.status="unchecked":t.status="partial",Ih(i,t.parentId)},TE=(i,e)=>{let t=dl(i);if(e.length>=2){let r=t.filter(s=>s.type!=="root"&&e.includes(s.id));r.forEach(s=>{s.type==="file"?s.status=s.restrictionError?"unchecked":"checked":s.status="checked"}),r.forEach(s=>{Mh(t,s.id,!0)}),Ih(t,r[0].parentId)}else{let r=t.find(s=>s.id===e[0]);r.status=r.status==="checked"?"unchecked":"checked",Mh(t,r.id,r.status==="checked"),Ih(t,r.parentId)}return t},Rg=TE;var Nh=Fe(Ig(),1);var ho=class extends Error{constructor(e){super(e),this.name="TimeoutError"}},Bh=class extends Error{constructor(e){super(),this.name="AbortError",this.message=e}},Dg=i=>globalThis.DOMException===void 0?new Bh(i):new DOMException(i),Ng=i=>{let e=i.reason===void 0?Dg("This operation was aborted."):i.reason;return e instanceof Error?e:Dg(e)};function Uh(i,e){let{milliseconds:t,fallback:r,message:s,customTimers:n={setTimeout,clearTimeout}}=e,o,a,c=new Promise((d,f)=>{if(typeof t!="number"||Math.sign(t)!==1)throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${t}\``);if(e.signal){let{signal:v}=e;v.aborted&&f(Ng(v)),a=()=>{f(Ng(v))},v.addEventListener("abort",a,{once:!0})}if(t===Number.POSITIVE_INFINITY){i.then(d,f);return}let y=new ho;o=n.setTimeout.call(void 0,()=>{if(r){try{d(r())}catch(v){f(v)}return}typeof i.cancel=="function"&&i.cancel(),s===!1?d():s instanceof Error?f(s):(y.message=s??`Promise timed out after ${t} milliseconds`,f(y))},t),(async()=>{try{d(await i)}catch(v){f(v)}})()}).finally(()=>{c.clear(),a&&e.signal&&e.signal.removeEventListener("abort",a)});return c.clear=()=>{n.clearTimeout.call(void 0,o),o=void 0},c}function zh(i,e,t){let r=0,s=i.length;for(;s>0;){let n=Math.trunc(s/2),o=r+n;t(i[o],e)<=0?(r=++o,s-=n+1):s=n}return r}var po=class{#e=[];enqueue(e,t){t={priority:0,...t};let r={priority:t.priority,id:t.id,run:e};if(this.size===0||this.#e[this.size-1].priority>=t.priority){this.#e.push(r);return}let s=zh(this.#e,r,(n,o)=>o.priority-n.priority);this.#e.splice(s,0,r)}setPriority(e,t){let r=this.#e.findIndex(n=>n.id===e);if(r===-1)throw new ReferenceError(`No promise function with the id "${e}" exists in the queue.`);let[s]=this.#e.splice(r,1);this.enqueue(s.run,{priority:t,id:e})}dequeue(){return this.#e.shift()?.run}filter(e){return this.#e.filter(t=>t.priority===e.priority).map(t=>t.run)}get size(){return this.#e.length}};var fo=class extends Nh.default{#e;#t;#i=0;#n;#o;#a=0;#r;#u;#s;#p;#l=0;#h;#c;#g;#v=1n;timeout;constructor(e){if(super(),e={carryoverConcurrencyCount:!1,intervalCap:Number.POSITIVE_INFINITY,interval:0,concurrency:Number.POSITIVE_INFINITY,autoStart:!0,queueClass:po,...e},!(typeof e.intervalCap=="number"&&e.intervalCap>=1))throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${e.intervalCap?.toString()??""}\` (${typeof e.intervalCap})`);if(e.interval===void 0||!(Number.isFinite(e.interval)&&e.interval>=0))throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${e.interval?.toString()??""}\` (${typeof e.interval})`);this.#e=e.carryoverConcurrencyCount,this.#t=e.intervalCap===Number.POSITIVE_INFINITY||e.interval===0,this.#n=e.intervalCap,this.#o=e.interval,this.#s=new e.queueClass,this.#p=e.queueClass,this.concurrency=e.concurrency,this.timeout=e.timeout,this.#g=e.throwOnTimeout===!0,this.#c=e.autoStart===!1}get#d(){return this.#t||this.#i<this.#n}get#b(){return this.#l<this.#h}#f(){this.#l--,this.#m(),this.emit("next")}#y(){this.#x(),this.#T(),this.#u=void 0}get#w(){let e=Date.now();if(this.#r===void 0){let t=this.#a-e;if(t<0)this.#i=this.#e?this.#l:0;else return this.#u===void 0&&(this.#u=setTimeout(()=>{this.#y()},t)),!0}return!1}#m(){if(this.#s.size===0)return this.#r&&clearInterval(this.#r),this.#r=void 0,this.emit("empty"),this.#l===0&&this.emit("idle"),!1;if(!this.#c){let e=!this.#w;if(this.#d&&this.#b){let t=this.#s.dequeue();return t?(this.emit("active"),t(),e&&this.#T(),!0):!1}}return!1}#T(){this.#t||this.#r!==void 0||(this.#r=setInterval(()=>{this.#x()},this.#o),this.#a=Date.now()+this.#o)}#x(){this.#i===0&&this.#l===0&&this.#r&&(clearInterval(this.#r),this.#r=void 0),this.#i=this.#e?this.#l:0,this.#S()}#S(){for(;this.#m(););}get concurrency(){return this.#h}set concurrency(e){if(!(typeof e=="number"&&e>=1))throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${e}\` (${typeof e})`);this.#h=e,this.#S()}async#k(e){return new Promise((t,r)=>{e.addEventListener("abort",()=>{r(e.reason)},{once:!0})})}setPriority(e,t){this.#s.setPriority(e,t)}async add(e,t={}){return t.id??=(this.#v++).toString(),t={timeout:this.timeout,throwOnTimeout:this.#g,...t},new Promise((r,s)=>{this.#s.enqueue(async()=>{this.#l++,this.#i++;try{t.signal?.throwIfAborted();let n=e({signal:t.signal});t.timeout&&(n=Uh(Promise.resolve(n),{milliseconds:t.timeout})),t.signal&&(n=Promise.race([n,this.#k(t.signal)]));let o=await n;r(o),this.emit("completed",o)}catch(n){if(n instanceof ho&&!t.throwOnTimeout){r();return}s(n),this.emit("error",n)}finally{this.#f()}},t),this.emit("add"),this.#m()})}async addAll(e,t){return Promise.all(e.map(async r=>this.add(r,t)))}start(){return this.#c?(this.#c=!1,this.#S(),this):this}pause(){this.#c=!0}clear(){this.#s=new this.#p}async onEmpty(){this.#s.size!==0&&await this.#E("empty")}async onSizeLessThan(e){this.#s.size<e||await this.#E("next",()=>this.#s.size<e)}async onIdle(){this.#l===0&&this.#s.size===0||await this.#E("idle")}async#E(e,t){return new Promise(r=>{let s=()=>{t&&!t()||(this.off(e,s),r())};this.on(e,s)})}get size(){return this.#s.size}sizeBy(e){return this.#s.filter(e).length}get pending(){return this.#l}get isPaused(){return this.#c}};var Bg=async(i,e,t,r,s)=>{let n=[],o=t.cached?t.nextPagePath:t.id;for(;o;){let f=await r(o);n=n.concat(f.items),o=f.nextPagePath}let a=n.filter(f=>f.isFolder===!0),l=n.filter(f=>f.isFolder===!1),c=a.map(f=>({type:"folder",id:f.requestPath,cached:!1,nextPagePath:null,status:"checked",parentId:t.id,data:f})),d=l.map(f=>{let y=s(f);return{type:"file",id:f.requestPath,restrictionError:y,status:y?"unchecked":"checked",parentId:t.id,data:f}});t.cached=!0,t.nextPagePath=null,e.push(...d,...c),c.forEach(async f=>{i.add(()=>Bg(i,e,f,r,s))})},AE=async(i,e,t,r)=>{let s=new fo({concurrency:6}),n=dl(i);return n.filter(a=>a.type==="folder"&&a.status==="checked"&&(a.cached===!1||a.nextPagePath)).forEach(a=>{s.add(()=>Bg(s,n,a,e,t))}),s.on("completed",()=>{let a=n.filter(l=>l.type==="file"&&l.status==="checked").length;r(a)}),await s.onIdle(),n},Ug=AE;var rs={afterOpenFolder:Og,afterScrollFolder:Lg,afterToggleCheckbox:Rg,afterFill:Ug};var CE=i=>{let{scrollHeight:e,scrollTop:t,offsetHeight:r}=i.target;return e-(t+r)<50},fl=CE;var PE=i=>e=>{if(!e.isAuthError){if(e.name==="AbortError"){i.log("Aborting request","warning");return}i.log(e,"error"),e.name==="UserFacingApiError"&&i.info({message:i.i18n("companionError"),details:i.i18n(e.message)},"warning",5e3)}},Gi=PE;var FE=(i,e,t,r)=>{let s=e.findIndex(n=>n.id===r);if(s!==-1&&t){let n=e.findIndex(a=>a.id===i);return e.slice(Math.min(s,n),Math.max(s,n)+1).map(a=>a.id)}return[i]},ml=FE;function _E(i){let{searchString:e,setSearchString:t,submitSearchString:r,wrapperClassName:s,inputClassName:n,inputLabel:o,clearSearchLabel:a="",showButton:l=!1,buttonLabel:c="",buttonCSSClassName:d=""}=i,f=x=>{t(x.target.value)},y=is(x=>{x.preventDefault(),r()},[r]),[v]=fi(()=>{let x=document.createElement("form");return x.setAttribute("tabindex","-1"),x.id=mr(),x});return ki(()=>(document.body.appendChild(v),v.addEventListener("submit",y),()=>{v.removeEventListener("submit",y),document.body.removeChild(v)}),[v,y]),u("section",{className:s},u("input",{className:`uppy-u-reset ${n}`,type:"search","aria-label":o,placeholder:o,value:e,onInput:f,form:v.id,"data-uppy-super-focusable":!0}),!l&&u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-ProviderBrowser-searchFilterIcon",width:"12",height:"12",viewBox:"0 0 12 12"},u("path",{d:"M8.638 7.99l3.172 3.172a.492.492 0 1 1-.697.697L7.91 8.656a4.977 4.977 0 0 1-2.983.983C2.206 9.639 0 7.481 0 4.819 0 2.158 2.206 0 4.927 0c2.721 0 4.927 2.158 4.927 4.82a4.74 4.74 0 0 1-1.216 3.17zm-3.71.685c2.176 0 3.94-1.726 3.94-3.856 0-2.129-1.764-3.855-3.94-3.855C2.75.964.984 2.69.984 4.819c0 2.13 1.765 3.856 3.942 3.856z"})),!l&&e&&u("button",{className:"uppy-u-reset uppy-ProviderBrowser-searchFilterReset",type:"button","aria-label":a,title:a,onClick:()=>t("")},u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",viewBox:"0 0 19 19"},u("path",{d:"M17.318 17.232L9.94 9.854 9.586 9.5l-.354.354-7.378 7.378h.707l-.62-.62v.706L9.318 9.94l.354-.354-.354-.354L1.94 1.854v.707l.62-.62h-.706l7.378 7.378.354.354.354-.354 7.378-7.378h-.707l.622.62v-.706L9.854 9.232l-.354.354.354.354 7.378 7.378.708-.707-7.38-7.378v.708l7.38-7.38.353-.353-.353-.353-.622-.622-.353-.353-.354.352-7.378 7.38h.708L2.56 1.23 2.208.88l-.353.353-.622.62-.353.355.352.353 7.38 7.38v-.708l-7.38 7.38-.353.353.352.353.622.622.353.353.354-.353 7.38-7.38h-.708l7.38 7.38z"}))),l&&u("button",{className:`uppy-u-reset uppy-c-btn uppy-c-btn-primary ${d}`,type:"submit",form:v.id},c))}var Ws=_E;var Hg=Fe(wt(),1);var OE=i=>i.filter(t=>t.type==="file"&&t.status==="checked"?!0:t.type==="folder"&&t.status==="checked"?!i.some(s=>s.type!=="root"&&s.parentId===t.id):!1).length,zg=OE;function mo(i){let{cancelSelection:e,donePicking:t,i18n:r,partialTree:s,validateAggregateRestrictions:n}=i,o=ts(()=>n(s),[s,n]),a=ts(()=>zg(s),[s]);return a===0?null:u("div",{className:"uppy-ProviderBrowser-footer"},u("div",{className:"uppy-ProviderBrowser-footer-buttons"},u("button",{className:(0,Hg.default)("uppy-u-reset uppy-c-btn uppy-c-btn-primary",{"uppy-c-btn--disabled":o}),disabled:!!o,onClick:t,type:"button"},r("selectX",{smart_count:a})),u("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link",onClick:e,type:"button"},r("cancel"))),o&&u("div",{className:"uppy-ProviderBrowser-footer-error"},o))}var LE=(i,e,t)=>{var r,s;return{id:i.id,source:e.id,name:i.name||i.id,type:i.mimeType,isRemote:!0,data:i,preview:i.thumbnail||void 0,meta:{authorName:(r=i.author)==null?void 0:r.name,authorUrl:(s=i.author)==null?void 0:s.url,relativePath:i.relDirPath||null,absolutePath:i.absDirPath},body:{fileId:i.id},remote:{companionUrl:e.opts.companionUrl,url:`${t.fileUrl(i.requestPath)}`,body:{fileId:i.id},providerName:t.name,provider:t.provider,requestClientId:t.provider}}},$g=LE;var RE=(i,e,t)=>{let r=i.map(o=>$g(o,e,t)),s=[],n=[];r.forEach(o=>{e.uppy.checkIfFileAlreadyExists(Na(o,e.uppy.getID()))?n.push(o):s.push(o)}),s.length>0&&e.uppy.info(e.uppy.i18n("addedNumFiles",{numFiles:s.length})),n.length>0&&e.uppy.info(`Not adding ${n.length} files because they already exist`),e.uppy.addFiles(s)},gl=RE;var qg=(i,e,t)=>{let r=e===null?"null":e;if(t[r])return t[r];let s=i.find(o=>o.id===e);if(s.type==="root")return[];let n=[...qg(i,s.parentId,t),s];return t[r]=n,n},ME=i=>{let e=Object.create(null);return i.filter(s=>s.type==="file"&&s.status==="checked").map(s=>{let n=qg(i,s.id,e),o=n.findIndex(d=>d.type==="folder"&&d.status==="checked"),a=n.slice(o),l=`/${n.map(d=>d.data.name).join("/")}`,c=a.length===1?void 0:a.map(d=>d.data.name).join("/");return{...s.data,absDirPath:l,relDirPath:c}})},vl=ME;var IE=(i,e)=>{let t=i.find(s=>s.id===e),r=[];for(;r=[t,...r],t.type!=="root";){let s=t.parentId;t=i.find(n=>n.id===s)}return r},Vg=IE;function yr(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var DE=0;function Wg(i){return"__private_"+DE+++"_"+i}var NE={version:"4.4.2"};function go(){return u("svg",{"aria-hidden":"true",focusable:"false",width:"30",height:"30",viewBox:"0 0 30 30"},u("path",{d:"M15 30c8.284 0 15-6.716 15-15 0-8.284-6.716-15-15-15C6.716 0 0 6.716 0 15c0 8.284 6.716 15 15 15zm4.258-12.676v6.846h-8.426v-6.846H5.204l9.82-12.364 9.82 12.364H19.26z"}))}var jg=i=>({authenticated:void 0,partialTree:[{type:"root",id:i,cached:!1,nextPagePath:null}],currentFolderId:i,searchString:"",didFirstRender:!1,username:null,loading:!1}),ss=Wg("abortController"),mi=Wg("withAbort"),Gs=class{constructor(e,t){Object.defineProperty(this,mi,{value:BE}),this.isHandlingScroll=!1,this.lastCheckbox=null,Object.defineProperty(this,ss,{writable:!0,value:void 0}),this.validateSingleFile=s=>{let n=ao(s);return this.plugin.uppy.validateSingleFile(n)},this.getDisplayedPartialTree=()=>{let{partialTree:s,currentFolderId:n,searchString:o}=this.plugin.getPluginState(),a=s.filter(c=>c.type!=="root"&&c.parentId===n);return o===""?a:a.filter(c=>{var d;return((d=c.data.name)!=null?d:this.plugin.uppy.i18n("unnamed")).toLowerCase().indexOf(o.toLowerCase())!==-1})},this.validateAggregateRestrictions=s=>{let o=s.filter(a=>a.type==="file"&&a.status==="checked").map(a=>a.data);return this.plugin.uppy.validateAggregateRestrictions(o)},this.plugin=e,this.provider=t.provider;let r={viewType:"list",showTitles:!0,showFilter:!0,showBreadcrumbs:!0,loadAllFiles:!1,virtualList:!1};this.opts={...r,...t},this.openFolder=this.openFolder.bind(this),this.logout=this.logout.bind(this),this.handleAuth=this.handleAuth.bind(this),this.handleScroll=this.handleScroll.bind(this),this.resetPluginState=this.resetPluginState.bind(this),this.donePicking=this.donePicking.bind(this),this.render=this.render.bind(this),this.cancelSelection=this.cancelSelection.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.resetPluginState(),this.plugin.uppy.on("dashboard:close-panel",this.resetPluginState),this.plugin.uppy.registerRequestClient(this.provider.provider,this.provider)}resetPluginState(){this.plugin.setPluginState(jg(this.plugin.rootFolderId))}tearDown(){}setLoading(e){this.plugin.setPluginState({loading:e})}cancelSelection(){let{partialTree:e}=this.plugin.getPluginState(),t=e.map(r=>r.type==="root"?r:{...r,status:"unchecked"});this.plugin.setPluginState({partialTree:t})}async openFolder(e){this.lastCheckbox=null;let{partialTree:t}=this.plugin.getPluginState(),r=t.find(s=>s.id===e);if(r.cached){this.plugin.setPluginState({currentFolderId:e,searchString:""});return}this.setLoading(!0),await yr(this,mi)[mi](async s=>{let n=e,o=[];do{let{username:l,nextPagePath:c,items:d}=await this.provider.list(n,{signal:s});this.plugin.setPluginState({username:l}),n=c,o=o.concat(d),this.setLoading(this.plugin.uppy.i18n("loadedXFiles",{numFiles:o.length}))}while(this.opts.loadAllFiles&&n);let a=rs.afterOpenFolder(t,o,r,n,this.validateSingleFile);this.plugin.setPluginState({partialTree:a,currentFolderId:e,searchString:""})}).catch(Gi(this.plugin.uppy)),this.setLoading(!1)}async logout(){await yr(this,mi)[mi](async e=>{let t=await this.provider.logout({signal:e});if(t.ok){if(!t.revoked){let r=this.plugin.uppy.i18n("companionUnauthorizeHint",{provider:this.plugin.title,url:t.manual_revoke_url});this.plugin.uppy.info(r,"info",7e3)}this.plugin.setPluginState({...jg(this.plugin.rootFolderId),authenticated:!1})}}).catch(Gi(this.plugin.uppy))}async handleAuth(e){await yr(this,mi)[mi](async t=>{this.setLoading(!0),await this.provider.login({authFormData:e,signal:t}),this.plugin.setPluginState({authenticated:!0}),await Promise.all([this.provider.fetchPreAuthToken(),this.openFolder(this.plugin.rootFolderId)])}).catch(Gi(this.plugin.uppy)),this.setLoading(!1)}async handleScroll(e){let{partialTree:t,currentFolderId:r}=this.plugin.getPluginState(),s=t.find(n=>n.id===r);fl(e)&&!this.isHandlingScroll&&s.nextPagePath&&(this.isHandlingScroll=!0,await yr(this,mi)[mi](async n=>{let{nextPagePath:o,items:a}=await this.provider.list(s.nextPagePath,{signal:n}),l=rs.afterScrollFolder(t,r,a,o,this.validateSingleFile);this.plugin.setPluginState({partialTree:l})}).catch(Gi(this.plugin.uppy)),this.isHandlingScroll=!1)}async donePicking(){let{partialTree:e}=this.plugin.getPluginState();this.setLoading(!0),await yr(this,mi)[mi](async t=>{let r=await rs.afterFill(e,o=>this.provider.list(o,{signal:t}),this.validateSingleFile,o=>{this.setLoading(this.plugin.uppy.i18n("addedNumFiles",{numFiles:o}))});if(this.validateAggregateRestrictions(r)){this.plugin.setPluginState({partialTree:r});return}let n=vl(r);gl(n,this.plugin,this.provider),this.resetPluginState()}).catch(Gi(this.plugin.uppy)),this.setLoading(!1)}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=ml(e.id,this.getDisplayedPartialTree(),t,this.lastCheckbox),n=rs.afterToggleCheckbox(r,s);this.plugin.setPluginState({partialTree:n}),this.lastCheckbox=e.id}render(e,t){t===void 0&&(t={});let{didFirstRender:r}=this.plugin.getPluginState(),{i18n:s}=this.plugin.uppy;r||(this.plugin.setPluginState({didFirstRender:!0}),this.provider.fetchPreAuthToken(),this.openFolder(this.plugin.rootFolderId));let n={...this.opts,...t},{authenticated:o,loading:a}=this.plugin.getPluginState(),l=this.plugin.icon||go;if(o===!1)return u(cl,{pluginName:this.plugin.title,pluginIcon:l,handleAuth:this.handleAuth,i18n:this.plugin.uppy.i18n,renderForm:n.renderAuthForm,loading:a});let{partialTree:c,currentFolderId:d,username:f,searchString:y}=this.plugin.getPluginState(),v=Vg(c,d);return u("div",{className:(0,Gg.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${n.viewType}`)},u(Ph,{showBreadcrumbs:n.showBreadcrumbs,openFolder:this.openFolder,breadcrumbs:v,pluginIcon:l,title:this.plugin.title,logout:this.logout,username:f,i18n:s}),n.showFilter&&u(Ws,{searchString:y,setSearchString:x=>{this.plugin.setPluginState({searchString:x})},submitSearchString:()=>{},inputLabel:s("filter"),clearSearchLabel:s("resetFilter"),wrapperClassName:"uppy-ProviderBrowser-searchFilter",inputClassName:"uppy-ProviderBrowser-searchFilterInput"}),u(hl,{toggleCheckbox:this.toggleCheckbox,displayedPartialTree:this.getDisplayedPartialTree(),openFolder:this.openFolder,virtualList:n.virtualList,noResultsLabel:s("noFilesFound"),handleScroll:this.handleScroll,viewType:n.viewType,showTitles:n.showTitles,i18n:this.plugin.uppy.i18n,isLoading:a,utmSource:"Companion"}),u(mo,{partialTree:c,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:s,validateAggregateRestrictions:this.validateAggregateRestrictions}))}};async function BE(i){var e;(e=yr(this,ss)[ss])==null||e.abort();let t=new AbortController;yr(this,ss)[ss]=t;let r=()=>{t.abort()};try{this.plugin.uppy.on("dashboard:close-panel",r),this.plugin.uppy.on("cancel-all",r),await i(t.signal)}finally{this.plugin.uppy.off("dashboard:close-panel",r),this.plugin.uppy.off("cancel-all",r),yr(this,ss)[ss]=void 0}}Gs.VERSION=NE.version;var Kg=Fe(wt(),1);var UE={version:"4.4.2"},zE={loading:!1,searchString:"",partialTree:[{type:"root",id:null,cached:!1,nextPagePath:null}],currentFolderId:null,isInputMode:!0},HE={viewType:"grid",showTitles:!0,showFilter:!0,utmSource:"Companion"},Ks=class{constructor(e,t){this.isHandlingScroll=!1,this.lastCheckbox=null,this.validateSingleFile=r=>{let s=ao(r);return this.plugin.uppy.validateSingleFile(s)},this.getDisplayedPartialTree=()=>{let{partialTree:r}=this.plugin.getPluginState();return r.filter(s=>s.type!=="root")},this.setSearchString=r=>{this.plugin.setPluginState({searchString:r}),r===""&&this.plugin.setPluginState({partialTree:[]})},this.validateAggregateRestrictions=r=>{let n=r.filter(o=>o.type==="file"&&o.status==="checked").map(o=>o.data);return this.plugin.uppy.validateAggregateRestrictions(n)},this.plugin=e,this.provider=t.provider,this.opts={...HE,...t},this.setSearchString=this.setSearchString.bind(this),this.search=this.search.bind(this),this.resetPluginState=this.resetPluginState.bind(this),this.handleScroll=this.handleScroll.bind(this),this.donePicking=this.donePicking.bind(this),this.cancelSelection=this.cancelSelection.bind(this),this.toggleCheckbox=this.toggleCheckbox.bind(this),this.render=this.render.bind(this),this.resetPluginState(),this.plugin.uppy.on("dashboard:close-panel",this.resetPluginState),this.plugin.uppy.registerRequestClient(this.provider.provider,this.provider)}tearDown(){}setLoading(e){this.plugin.setPluginState({loading:e})}resetPluginState(){this.plugin.setPluginState(zE)}cancelSelection(){let{partialTree:e}=this.plugin.getPluginState(),t=e.map(r=>r.type==="root"?r:{...r,status:"unchecked"});this.plugin.setPluginState({partialTree:t})}async search(){let{searchString:e}=this.plugin.getPluginState();if(e!==""){this.setLoading(!0);try{let t=await this.provider.search(e),r=[{type:"root",id:null,cached:!1,nextPagePath:t.nextPageQuery},...t.items.map(s=>({type:"file",id:s.requestPath,status:"unchecked",parentId:null,data:s}))];this.plugin.setPluginState({partialTree:r,isInputMode:!1})}catch(t){Gi(this.plugin.uppy)(t)}this.setLoading(!1)}}async handleScroll(e){let{partialTree:t,searchString:r}=this.plugin.getPluginState(),s=t.find(n=>n.type==="root");if(fl(e)&&!this.isHandlingScroll&&s.nextPagePath){this.isHandlingScroll=!0;try{let n=await this.provider.search(r,s.nextPagePath),o={...s,nextPagePath:n.nextPageQuery},a=t.filter(c=>c.type!=="root"),l=[o,...a,...n.items.map(c=>({type:"file",id:c.requestPath,status:"unchecked",parentId:null,data:c}))];this.plugin.setPluginState({partialTree:l})}catch(n){Gi(this.plugin.uppy)(n)}this.isHandlingScroll=!1}}async donePicking(){let{partialTree:e}=this.plugin.getPluginState(),t=vl(e);gl(t,this.plugin,this.provider),this.resetPluginState()}toggleCheckbox(e,t){let{partialTree:r}=this.plugin.getPluginState(),s=ml(e.id,this.getDisplayedPartialTree(),t,this.lastCheckbox),n=rs.afterToggleCheckbox(r,s);this.plugin.setPluginState({partialTree:n}),this.lastCheckbox=e.id}render(e,t){t===void 0&&(t={});let{isInputMode:r,searchString:s,loading:n,partialTree:o}=this.plugin.getPluginState(),{i18n:a}=this.plugin.uppy,l={...this.opts,...t};return r?u(Ws,{searchString:s,setSearchString:this.setSearchString,submitSearchString:this.search,inputLabel:a("enterTextToSearch"),buttonLabel:a("searchImages"),wrapperClassName:"uppy-SearchProvider",inputClassName:"uppy-c-textInput uppy-SearchProvider-input",showButton:!0,buttonCSSClassName:"uppy-SearchProvider-searchButton"}):u("div",{className:(0,Kg.default)("uppy-ProviderBrowser",`uppy-ProviderBrowser-viewType--${l.viewType}`)},l.showFilter&&u(Ws,{searchString:s,setSearchString:this.setSearchString,submitSearchString:this.search,inputLabel:a("search"),clearSearchLabel:a("resetSearch"),wrapperClassName:"uppy-ProviderBrowser-searchFilter",inputClassName:"uppy-ProviderBrowser-searchFilterInput"}),u(hl,{toggleCheckbox:this.toggleCheckbox,displayedPartialTree:this.getDisplayedPartialTree(),handleScroll:this.handleScroll,openFolder:async()=>{},noResultsLabel:a("noSearchResults"),viewType:l.viewType,showTitles:l.showTitles,isLoading:n,i18n:a,virtualList:!1,utmSource:this.opts.utmSource}),u(mo,{partialTree:o,donePicking:this.donePicking,cancelSelection:this.cancelSelection,i18n:a,validateAggregateRestrictions:this.validateAggregateRestrictions}))}};Ks.VERSION=UE.version;var Xg=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function $E(i,e){return!!(i===e||Xg(i)&&Xg(e))}function qE(i,e){if(i.length!==e.length)return!1;for(var t=0;t<i.length;t++)if(!$E(i[t],e[t]))return!1;return!0}function Hh(i,e){e===void 0&&(e=qE);var t=null;function r(){for(var s=[],n=0;n<arguments.length;n++)s[n]=arguments[n];if(t&&t.lastThis===this&&e(s,t.lastArgs))return t.lastResult;var o=i.apply(this,s);return t={lastResult:o,lastArgs:s,lastThis:this},o}return r.clear=function(){t=null},r}var bl=['a[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','area[href]:not([tabindex^="-"]):not([inert]):not([aria-hidden])',"input:not([disabled]):not([inert]):not([aria-hidden])","select:not([disabled]):not([inert]):not([aria-hidden])","textarea:not([disabled]):not([inert]):not([aria-hidden])","button:not([disabled]):not([inert]):not([aria-hidden])",'iframe:not([tabindex^="-"]):not([inert]):not([aria-hidden])','object:not([tabindex^="-"]):not([inert]):not([aria-hidden])','embed:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[contenteditable]:not([tabindex^="-"]):not([inert]):not([aria-hidden])','[tabindex]:not([tabindex^="-"]):not([inert]):not([aria-hidden])'];function vo(i,e){if(e){let t=i.querySelector(`[data-uppy-paneltype="${e}"]`);if(t)return t}return i}function Yg(i,e){let t=e[0];t&&(t.focus(),i.preventDefault())}function VE(i,e){let t=e[e.length-1];t&&(t.focus(),i.preventDefault())}function jE(i){return i.contains(document.activeElement)}function $h(i,e,t){let r=vo(t,e),s=br(r.querySelectorAll(bl)),n=s.indexOf(document.activeElement);jE(r)?i.shiftKey&&n===0?VE(i,s):!i.shiftKey&&n===s.length-1&&Yg(i,s):Yg(i,s)}function Zg(i,e,t){e===null||$h(i,e,t)}var Qg=Fe(Ou(),1);function qh(){let i=!1;return(0,Qg.default)((t,r)=>{let s=vo(t,r),n=s.contains(document.activeElement);if(n&&i)return;let o=s.querySelector("[data-uppy-super-focusable]");if(!(n&&!o))if(o)o.focus({preventScroll:!0}),i=!0;else{let a=s.querySelector(bl);a?.focus({preventScroll:!0}),i=!1}},260)}var gv=Fe(wt(),1);function Vh(){let i=document.body;return!(!("draggable"in i)||!("ondragstart"in i&&"ondrop"in i)||!("FormData"in window)||!("FileReader"in window))}var iv=Fe(wt(),1);function Jg(i,e){if(i===e)return!0;if(!i||!e)return!1;let t=Object.keys(i),r=Object.keys(e),s=t.length;if(r.length!==s)return!1;for(let n=0;n<s;n++){let o=t[n];if(i[o]!==e[o]||!Object.prototype.hasOwnProperty.call(e,o))return!1}return!0}function GE(){return u("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25"},u("g",{fill:"#686DE0",fillRule:"evenodd"},u("path",{d:"M5 7v10h15V7H5zm0-1h15a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z",fillRule:"nonzero"}),u("path",{d:"M6.35 17.172l4.994-5.026a.5.5 0 0 1 .707 0l2.16 2.16 3.505-3.505a.5.5 0 0 1 .707 0l2.336 2.31-.707.72-1.983-1.97-3.505 3.505a.5.5 0 0 1-.707 0l-2.16-2.159-3.938 3.939-1.409.026z",fillRule:"nonzero"}),u("circle",{cx:"7.5",cy:"9.5",r:"1.5"})))}function KE(){return u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25"},u("path",{d:"M9.5 18.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V7.25a.5.5 0 0 1 .379-.485l9-2.25A.5.5 0 0 1 18.5 5v11.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V8.67l-8 2v7.97zm8-11v-2l-8 2v2l8-2zM7 19.64c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1zm9-2c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1z",fill:"#049BCF",fillRule:"nonzero"}))}function XE(){return u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25"},u("path",{d:"M16 11.834l4.486-2.691A1 1 0 0 1 22 10v6a1 1 0 0 1-1.514.857L16 14.167V17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v2.834zM15 9H5v8h10V9zm1 4l5 3v-6l-5 3z",fill:"#19AF67",fillRule:"nonzero"}))}function YE(){return u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25"},u("path",{d:"M9.766 8.295c-.691-1.843-.539-3.401.747-3.726 1.643-.414 2.505.938 2.39 3.299-.039.79-.194 1.662-.537 3.148.324.49.66.967 1.055 1.51.17.231.382.488.629.757 1.866-.128 3.653.114 4.918.655 1.487.635 2.192 1.685 1.614 2.84-.566 1.133-1.839 1.084-3.416.249-1.141-.604-2.457-1.634-3.51-2.707a13.467 13.467 0 0 0-2.238.426c-1.392 4.051-4.534 6.453-5.707 4.572-.986-1.58 1.38-4.206 4.914-5.375.097-.322.185-.656.264-1.001.08-.353.306-1.31.407-1.737-.678-1.059-1.2-2.031-1.53-2.91zm2.098 4.87c-.033.144-.068.287-.104.427l.033-.01-.012.038a14.065 14.065 0 0 1 1.02-.197l-.032-.033.052-.004a7.902 7.902 0 0 1-.208-.271c-.197-.27-.38-.526-.555-.775l-.006.028-.002-.003c-.076.323-.148.632-.186.8zm5.77 2.978c1.143.605 1.832.632 2.054.187.26-.519-.087-1.034-1.113-1.473-.911-.39-2.175-.608-3.55-.608.845.766 1.787 1.459 2.609 1.894zM6.559 18.789c.14.223.693.16 1.425-.413.827-.648 1.61-1.747 2.208-3.206-2.563 1.064-4.102 2.867-3.633 3.62zm5.345-10.97c.088-1.793-.351-2.48-1.146-2.28-.473.119-.564 1.05-.056 2.405.213.566.52 1.188.908 1.859.18-.858.268-1.453.294-1.984z",fill:"#E2514A",fillRule:"nonzero"}))}function ZE(){return u("svg",{"aria-hidden":"true",focusable:"false",width:"25",height:"25",viewBox:"0 0 25 25"},u("path",{d:"M10.45 2.05h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V2.55a.5.5 0 0 1 .5-.5zm2.05 1.024h1.05a.5.5 0 0 1 .5.5V3.6a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5v-.001zM10.45 0h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V.5a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 3.074h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 1.024h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm-2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-1.656 3.074l-.82 5.946c.52.302 1.174.458 1.976.458.803 0 1.455-.156 1.975-.458l-.82-5.946h-2.311zm0-1.025h2.312c.512 0 .946.378 1.015.885l.82 5.946c.056.412-.142.817-.501 1.026-.686.398-1.515.597-2.49.597-.974 0-1.804-.199-2.49-.597a1.025 1.025 0 0 1-.5-1.026l.819-5.946c.07-.507.503-.885 1.015-.885zm.545 6.6a.5.5 0 0 1-.397-.561l.143-.999a.5.5 0 0 1 .495-.429h.74a.5.5 0 0 1 .495.43l.143.998a.5.5 0 0 1-.397.561c-.404.08-.819.08-1.222 0z",fill:"#00C469",fillRule:"nonzero"}))}function QE(){return u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25"},u("g",{fill:"#A7AFB7",fillRule:"nonzero"},u("path",{d:"M5.5 22a.5.5 0 0 1-.5-.5v-18a.5.5 0 0 1 .5-.5h10.719a.5.5 0 0 1 .367.16l3.281 3.556a.5.5 0 0 1 .133.339V21.5a.5.5 0 0 1-.5.5h-14zm.5-1h13V7.25L16 4H6v17z"}),u("path",{d:"M15 4v3a1 1 0 0 0 1 1h3V7h-3V4h-1z"})))}function JE(){return u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"25",height:"25",viewBox:"0 0 25 25"},u("path",{d:"M4.5 7h13a.5.5 0 1 1 0 1h-13a.5.5 0 0 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h10a.5.5 0 1 1 0 1h-10a.5.5 0 1 1 0-1z",fill:"#5A5E69",fillRule:"nonzero"}))}function ns(i){let e={color:"#838999",icon:QE()};if(!i)return e;let t=i.split("/")[0],r=i.split("/")[1];return t==="text"?{color:"#5a5e69",icon:JE()}:t==="image"?{color:"#686de0",icon:GE()}:t==="audio"?{color:"#068dbb",icon:KE()}:t==="video"?{color:"#19af67",icon:XE()}:t==="application"&&r==="pdf"?{color:"#e25149",icon:YE()}:t==="application"&&["zip","x-7z-compressed","x-zip-compressed","x-rar-compressed","x-tar","x-gzip","x-apple-diskimage"].indexOf(r)!==-1?{color:"#00C469",icon:ZE()}:e}function bo(i){let{file:e}=i;if(e.preview)return u("img",{draggable:!1,className:"uppy-Dashboard-Item-previewImg",alt:e.name,src:e.preview});let{color:t,icon:r}=ns(e.type);return u("div",{className:"uppy-Dashboard-Item-previewIconWrap"},u("span",{className:"uppy-Dashboard-Item-previewIcon",style:{color:t}},r),u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-Dashboard-Item-previewIconBg",width:"58",height:"76",viewBox:"0 0 58 76"},u("rect",{fill:"#FFF",width:"58",height:"76",rx:"3",fillRule:"evenodd"})))}var eT=(i,e)=>(typeof e=="function"?e():e).filter(s=>s.id===i)[0].name;function yo(i){let{file:e,toggleFileCard:t,i18n:r,metaFields:s}=i,{missingRequiredMetaFields:n}=e;if(!(n!=null&&n.length))return null;let o=n.map(a=>eT(a,s)).join(", ");return u("div",{className:"uppy-Dashboard-Item-errorMessage"},r("missingRequiredMetaFields",{smart_count:n.length,fields:o})," ",u("button",{type:"button",class:"uppy-u-reset uppy-Dashboard-Item-errorMessageBtn",onClick:()=>t(!0,e.id)},r("editFile")))}function jh(i){let{file:e,i18n:t,toggleFileCard:r,metaFields:s,showLinkToFileUploadResult:n}=i,a=e.preview?"rgba(255, 255, 255, 0.5)":ns(e.type).color;return u("div",{className:"uppy-Dashboard-Item-previewInnerWrap",style:{backgroundColor:a}},n&&e.uploadURL&&u("a",{className:"uppy-Dashboard-Item-previewLink",href:e.uploadURL,rel:"noreferrer noopener",target:"_blank","aria-label":e.meta.name},u("span",{hidden:!0},e.meta.name)),u(bo,{file:e}),u(yo,{file:e,i18n:t,toggleFileCard:r,metaFields:s}))}function tT(i){if(!i.isUploaded){if(i.error&&!i.hideRetryButton){i.uppy.retryUpload(i.file.id);return}i.resumableUploads&&!i.hidePauseResumeButton?i.uppy.pauseResume(i.file.id):i.individualCancellation&&!i.hideCancelButton&&i.uppy.removeFile(i.file.id)}}function ev(i){return i.isUploaded?i.i18n("uploadComplete"):i.error?i.i18n("retryUpload"):i.resumableUploads?i.file.isPaused?i.i18n("resumeUpload"):i.i18n("pauseUpload"):i.individualCancellation?i.i18n("cancelUpload"):""}function Wh(i){return u("div",{className:"uppy-Dashboard-Item-progress"},u("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-progressIndicator",type:"button","aria-label":ev(i),title:ev(i),onClick:()=>tT(i)},i.children))}function yl(i){let{children:e}=i;return u("svg",{"aria-hidden":"true",focusable:"false",width:"70",height:"70",viewBox:"0 0 36 36",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--circle"},e)}function Gh(i){let{progress:e}=i,t=2*Math.PI*15;return u("g",null,u("circle",{className:"uppy-Dashboard-Item-progressIcon--bg",r:"15",cx:"18",cy:"18","stroke-width":"2",fill:"none"}),u("circle",{className:"uppy-Dashboard-Item-progressIcon--progress",r:"15",cx:"18",cy:"18",transform:"rotate(-90, 18, 18)",fill:"none","stroke-width":"2","stroke-dasharray":t,"stroke-dashoffset":t-t/100*e}))}function Kh(i){return!i.file.progress.uploadStarted||i.file.progress.percentage===void 0?null:i.isUploaded?u("div",{className:"uppy-Dashboard-Item-progress"},u("div",{className:"uppy-Dashboard-Item-progressIndicator"},u(yl,null,u("circle",{r:"15",cx:"18",cy:"18",fill:"#1bb240"}),u("polygon",{className:"uppy-Dashboard-Item-progressIcon--check",transform:"translate(2, 3)",points:"14 22.5 7 15.2457065 8.99985857 13.1732815 14 18.3547104 22.9729883 9 25 11.1005634"})))):i.recoveredState?null:i.error&&!i.hideRetryButton?u(Wh,i,u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-Item-progressIcon--retry",width:"28",height:"31",viewBox:"0 0 16 19"},u("path",{d:"M16 11a8 8 0 1 1-8-8v2a6 6 0 1 0 6 6h2z"}),u("path",{d:"M7.9 3H10v2H7.9z"}),u("path",{d:"M8.536.5l3.535 3.536-1.414 1.414L7.12 1.914z"}),u("path",{d:"M10.657 2.621l1.414 1.415L8.536 7.57 7.12 6.157z"}))):i.resumableUploads&&!i.hidePauseResumeButton?u(Wh,i,u(yl,null,u(Gh,{progress:i.file.progress.percentage}),i.file.isPaused?u("polygon",{className:"uppy-Dashboard-Item-progressIcon--play",transform:"translate(3, 3)",points:"12 20 12 10 20 15"}):u("g",{className:"uppy-Dashboard-Item-progressIcon--pause",transform:"translate(14.5, 13)"},u("rect",{x:"0",y:"0",width:"2",height:"10",rx:"0"}),u("rect",{x:"5",y:"0",width:"2",height:"10",rx:"0"})))):!i.resumableUploads&&i.individualCancellation&&!i.hideCancelButton?u(Wh,i,u(yl,null,u(Gh,{progress:i.file.progress.percentage}),u("polygon",{className:"cancel",transform:"translate(2, 2)",points:"19.8856516 11.0625 16 14.9481516 12.1019737 11.0625 11.0625 12.1143484 14.9481516 16 11.0625 19.8980263 12.1019737 20.9375 16 17.0518484 19.8856516 20.9375 20.9375 19.8980263 17.0518484 16 20.9375 12"}))):u("div",{className:"uppy-Dashboard-Item-progress"},u("div",{className:"uppy-Dashboard-Item-progressIndicator"},u(yl,null,u(Gh,{progress:i.file.progress.percentage}))))}var tv=Fe(Ba(),1);var Xh="...";function wl(i,e){if(e===0)return"";if(i.length<=e)return i;if(e<=Xh.length+1)return`${i.slice(0,e-1)}\u2026`;let t=e-Xh.length,r=Math.ceil(t/2),s=Math.floor(t/2);return i.slice(0,r)+Xh+i.slice(-s)}var iT=i=>{let{author:e,name:t}=i.file.meta;function r(){return i.isSingleFile&&i.containerHeight>=350?90:i.containerWidth<=352?35:i.containerWidth<=576?60:e?20:30}return u("div",{className:"uppy-Dashboard-Item-name",title:t},wl(t,r()))},rT=i=>{var e;let{author:t}=i.file.meta,r=(e=i.file.remote)==null?void 0:e.providerName,s="\xB7";return t?u("div",{className:"uppy-Dashboard-Item-author"},u("a",{href:`${t.url}?utm_source=Companion&utm_medium=referral`,target:"_blank",rel:"noopener noreferrer"},wl(t.name,13)),r?u(Fragment,null,` ${s} `,r,` ${s} `):null):null},sT=i=>i.file.size&&u("div",{className:"uppy-Dashboard-Item-statusSize"},(0,tv.default)(i.file.size)),nT=i=>i.file.isGhost&&u("span",null," \u2022 ",u("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-reSelect",type:"button",onClick:()=>i.toggleAddFilesPanel(!0)},i.i18n("reSelect"))),oT=i=>{let{file:e,onClick:t}=i;return e.error?u("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-errorDetails","aria-label":e.error,"data-microtip-position":"bottom","data-microtip-size":"medium",onClick:t,type:"button"},"?"):null};function Yh(i){let{file:e,i18n:t,toggleFileCard:r,metaFields:s,toggleAddFilesPanel:n,isSingleFile:o,containerHeight:a,containerWidth:l}=i;return u("div",{className:"uppy-Dashboard-Item-fileInfo","data-uppy-file-source":e.source},u("div",{className:"uppy-Dashboard-Item-fileName"},iT({file:e,isSingleFile:o,containerHeight:a,containerWidth:l}),u(oT,{file:e,onClick:()=>alert(e.error)})),u("div",{className:"uppy-Dashboard-Item-status"},rT({file:e}),sT({file:e}),nT({file:e,toggleAddFilesPanel:n,i18n:t})),u(yo,{file:e,i18n:t,toggleFileCard:r,metaFields:s}))}function Zh(i,e){return e===void 0&&(e="Copy the URL below"),new Promise(t=>{let r=document.createElement("textarea");r.setAttribute("style",{position:"fixed",top:0,left:0,width:"2em",height:"2em",padding:0,border:"none",outline:"none",boxShadow:"none",background:"transparent"}),r.value=i,document.body.appendChild(r),r.select();let s=()=>{document.body.removeChild(r),window.prompt(e,i),t()};try{return document.execCommand("copy")?(document.body.removeChild(r),t()):s()}catch{return document.body.removeChild(r),s()}})}function aT(i){let{file:e,uploadInProgressOrComplete:t,metaFields:r,canEditFile:s,i18n:n,onClick:o}=i;return!t&&r&&r.length>0||!t&&s(e)?u("button",{className:"uppy-u-reset uppy-c-btn uppy-Dashboard-Item-action uppy-Dashboard-Item-action--edit",type:"button","aria-label":n("editFileWithFilename",{file:e.meta.name}),title:n("editFileWithFilename",{file:e.meta.name}),onClick:()=>o()},u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 14"},u("g",{fillRule:"evenodd"},u("path",{d:"M1.5 10.793h2.793A1 1 0 0 0 5 10.5L11.5 4a1 1 0 0 0 0-1.414L9.707.793a1 1 0 0 0-1.414 0l-6.5 6.5A1 1 0 0 0 1.5 8v2.793zm1-1V8L9 1.5l1.793 1.793-6.5 6.5H2.5z",fillRule:"nonzero"}),u("rect",{x:"1",y:"12.293",width:"11",height:"1",rx:".5"}),u("path",{fillRule:"nonzero",d:"M6.793 2.5L9.5 5.207l.707-.707L7.5 1.793z"})))):null}function lT(i){let{i18n:e,onClick:t,file:r}=i;return u("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--remove",type:"button","aria-label":e("removeFile",{file:r.meta.name}),title:e("removeFile",{file:r.meta.name}),onClick:()=>t()},u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"18",height:"18",viewBox:"0 0 18 18"},u("path",{d:"M9 0C4.034 0 0 4.034 0 9s4.034 9 9 9 9-4.034 9-9-4.034-9-9-9z"}),u("path",{fill:"#FFF",d:"M13 12.222l-.778.778L9 9.778 5.778 13 5 12.222 8.222 9 5 5.778 5.778 5 9 8.222 12.222 5l.778.778L9.778 9z"})))}function cT(i){let{file:e,uppy:t,i18n:r}=i,s=n=>{Zh(e.uploadURL,r("copyLinkToClipboardFallback")).then(()=>{t.log("Link copied to clipboard."),t.info(r("copyLinkToClipboardSuccess"),"info",3e3)}).catch(t.log).then(()=>n.target.focus({preventScroll:!0}))};return u("button",{className:"uppy-u-reset uppy-Dashboard-Item-action uppy-Dashboard-Item-action--copyLink",type:"button","aria-label":r("copyLink"),title:r("copyLink"),onClick:n=>s(n)},u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"14",height:"14",viewBox:"0 0 14 12"},u("path",{d:"M7.94 7.703a2.613 2.613 0 0 1-.626 2.681l-.852.851a2.597 2.597 0 0 1-1.849.766A2.616 2.616 0 0 1 2.764 7.54l.852-.852a2.596 2.596 0 0 1 2.69-.625L5.267 7.099a1.44 1.44 0 0 0-.833.407l-.852.851a1.458 1.458 0 0 0 1.03 2.486c.39 0 .755-.152 1.03-.426l.852-.852c.231-.231.363-.522.406-.824l1.04-1.038zm4.295-5.937A2.596 2.596 0 0 0 10.387 1c-.698 0-1.355.272-1.849.766l-.852.851a2.614 2.614 0 0 0-.624 2.688l1.036-1.036c.041-.304.173-.6.407-.833l.852-.852c.275-.275.64-.426 1.03-.426a1.458 1.458 0 0 1 1.03 2.486l-.852.851a1.442 1.442 0 0 1-.824.406l-1.04 1.04a2.596 2.596 0 0 0 2.683-.628l.851-.85a2.616 2.616 0 0 0 0-3.697zm-6.88 6.883a.577.577 0 0 0 .82 0l3.474-3.474a.579.579 0 1 0-.819-.82L5.355 7.83a.579.579 0 0 0 0 .819z"})))}function Qh(i){let{uppy:e,file:t,uploadInProgressOrComplete:r,canEditFile:s,metaFields:n,showLinkToFileUploadResult:o,showRemoveButton:a,i18n:l,toggleFileCard:c,openFileEditor:d}=i;return u("div",{className:"uppy-Dashboard-Item-actionWrapper"},u(aT,{i18n:l,file:t,uploadInProgressOrComplete:r,canEditFile:s,metaFields:n,onClick:()=>{n&&n.length>0?c(!0,t.id):d(t)}}),o&&t.uploadURL?u(cT,{file:t,uppy:e,i18n:l}):null,a?u(lT,{i18n:l,file:t,onClick:()=>e.removeFile(t.id)}):null)}var wo=class extends dt{componentDidMount(){let{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}shouldComponentUpdate(e){return!Jg(this.props,e)}componentDidUpdate(){let{file:e}=this.props;e.preview||this.props.handleRequestThumbnail(e)}componentWillUnmount(){let{file:e}=this.props;e.preview||this.props.handleCancelThumbnail(e)}render(){let{file:e}=this.props,t=e.progress.preprocess||e.progress.postprocess,r=!!e.progress.uploadComplete&&!t&&!e.error,s=!!e.progress.uploadStarted||!!t,n=e.progress.uploadStarted&&!e.progress.uploadComplete||t,o=e.error||!1,{isGhost:a}=e,l=(this.props.individualCancellation||!n)&&!r;r&&this.props.showRemoveButtonAfterComplete&&(l=!0);let c=(0,iv.default)({"uppy-Dashboard-Item":!0,"is-inprogress":n&&!this.props.recoveredState,"is-processing":t,"is-complete":r,"is-error":!!o,"is-resumable":this.props.resumableUploads,"is-noIndividualCancellation":!this.props.individualCancellation,"is-ghost":a});return u("div",{className:c,id:`uppy_${e.id}`,role:this.props.role},u("div",{className:"uppy-Dashboard-Item-preview"},u(jh,{file:e,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,i18n:this.props.i18n,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields}),u(Kh,{uppy:this.props.uppy,file:e,error:o,isUploaded:r,hideRetryButton:this.props.hideRetryButton,hideCancelButton:this.props.hideCancelButton,hidePauseResumeButton:this.props.hidePauseResumeButton,recoveredState:this.props.recoveredState,resumableUploads:this.props.resumableUploads,individualCancellation:this.props.individualCancellation,i18n:this.props.i18n})),u("div",{className:"uppy-Dashboard-Item-fileInfoAndButtons"},u(Yh,{file:e,containerWidth:this.props.containerWidth,containerHeight:this.props.containerHeight,i18n:this.props.i18n,toggleAddFilesPanel:this.props.toggleAddFilesPanel,toggleFileCard:this.props.toggleFileCard,metaFields:this.props.metaFields,isSingleFile:this.props.isSingleFile}),u(Qh,{file:e,metaFields:this.props.metaFields,showLinkToFileUploadResult:this.props.showLinkToFileUploadResult,showRemoveButton:l,canEditFile:this.props.canEditFile,uploadInProgressOrComplete:s,toggleFileCard:this.props.toggleFileCard,openFileEditor:this.props.openFileEditor,uppy:this.props.uppy,i18n:this.props.i18n})))}};function uT(i,e){let t=[],r=[];return i.forEach(s=>{r.length<e?r.push(s):(t.push(r),r=[s])}),r.length&&t.push(r),t}function Jh(i){let{id:e,i18n:t,uppy:r,files:s,resumableUploads:n,hideRetryButton:o,hidePauseResumeButton:a,hideCancelButton:l,showLinkToFileUploadResult:c,showRemoveButtonAfterComplete:d,metaFields:f,isSingleFile:y,toggleFileCard:v,handleRequestThumbnail:x,handleCancelThumbnail:C,recoveredState:F,individualCancellation:L,itemsPerRow:D,openFileEditor:V,canEditFile:M,toggleAddFilesPanel:$,containerWidth:z,containerHeight:G}=i,K=D===1?71:200,Q=ts(()=>{let Y=(le,ke)=>Number(s[ke].isGhost)-Number(s[le].isGhost),re=Object.keys(s);return F&&re.sort(Y),uT(re,D)},[s,D,F]),ne=Y=>u("div",{class:"uppy-Dashboard-filesInner",role:"presentation",key:Y[0]},Y.map(re=>u(wo,{key:re,uppy:r,id:e,i18n:t,resumableUploads:n,individualCancellation:L,hideRetryButton:o,hidePauseResumeButton:a,hideCancelButton:l,showLinkToFileUploadResult:c,showRemoveButtonAfterComplete:d,metaFields:f,recoveredState:F,isSingleFile:y,containerWidth:z,containerHeight:G,toggleFileCard:v,handleRequestThumbnail:x,handleCancelThumbnail:C,role:"listitem",openFileEditor:V,canEditFile:M,toggleAddFilesPanel:$,file:s[re]})));return y?u("div",{class:"uppy-Dashboard-files"},ne(Q[0])):u(ul,{class:"uppy-Dashboard-files",role:"list",data:Q,renderRow:ne,rowHeight:K})}var ed=class extends dt{constructor(){super(...arguments),this.fileInput=null,this.folderInput=null,this.mobilePhotoFileInput=null,this.mobileVideoFileInput=null,this.triggerFileInputClick=()=>{var e;(e=this.fileInput)==null||e.click()},this.triggerFolderInputClick=()=>{var e;(e=this.folderInput)==null||e.click()},this.triggerVideoCameraInputClick=()=>{var e;(e=this.mobileVideoFileInput)==null||e.click()},this.triggerPhotoCameraInputClick=()=>{var e;(e=this.mobilePhotoFileInput)==null||e.click()},this.onFileInputChange=e=>{this.props.handleInputChange(e),e.currentTarget.value=""},this.renderHiddenInput=(e,t)=>{var r;return u("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,webkitdirectory:e,type:"file",name:"files[]",multiple:this.props.maxNumberOfFiles!==1,onChange:this.onFileInputChange,accept:(r=this.props.allowedFileTypes)==null?void 0:r.join(", "),ref:t})},this.renderHiddenCameraInput=(e,t,r)=>{let n={photo:"image/*",video:"video/*"}[e];return u("input",{className:"uppy-Dashboard-input",hidden:!0,"aria-hidden":"true",tabIndex:-1,type:"file",name:`camera-${e}`,onChange:this.onFileInputChange,capture:t,accept:n,ref:r})},this.renderMyDeviceAcquirer=()=>u("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MyDevice"},u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerFileInputClick},u("div",{className:"uppy-DashboardTab-inner"},u("svg",{className:"uppy-DashboardTab-iconMyDevice","aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32"},u("path",{d:"M8.45 22.087l-1.305-6.674h17.678l-1.572 6.674H8.45zm4.975-12.412l1.083 1.765a.823.823 0 00.715.386h7.951V13.5H8.587V9.675h4.838zM26.043 13.5h-1.195v-2.598c0-.463-.336-.75-.798-.75h-8.356l-1.082-1.766A.823.823 0 0013.897 8H7.728c-.462 0-.815.256-.815.718V13.5h-.956a.97.97 0 00-.746.37.972.972 0 00-.19.81l1.724 8.565c.095.44.484.755.933.755H24c.44 0 .824-.3.929-.727l2.043-8.568a.972.972 0 00-.176-.825.967.967 0 00-.753-.38z",fill:"currentcolor","fill-rule":"evenodd"}))),u("div",{className:"uppy-DashboardTab-name"},this.props.i18n("myDevice")))),this.renderPhotoCamera=()=>u("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobilePhotoCamera"},u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerPhotoCameraInputClick},u("div",{className:"uppy-DashboardTab-inner"},u("svg",{"aria-hidden":"true",focusable:"false",width:"32",height:"32",viewBox:"0 0 32 32"},u("path",{d:"M23.5 9.5c1.417 0 2.5 1.083 2.5 2.5v9.167c0 1.416-1.083 2.5-2.5 2.5h-15c-1.417 0-2.5-1.084-2.5-2.5V12c0-1.417 1.083-2.5 2.5-2.5h2.917l1.416-2.167C13 7.167 13.25 7 13.5 7h5c.25 0 .5.167.667.333L20.583 9.5H23.5zM16 11.417a4.706 4.706 0 00-4.75 4.75 4.704 4.704 0 004.75 4.75 4.703 4.703 0 004.75-4.75c0-2.663-2.09-4.75-4.75-4.75zm0 7.825c-1.744 0-3.076-1.332-3.076-3.074 0-1.745 1.333-3.077 3.076-3.077 1.744 0 3.074 1.333 3.074 3.076s-1.33 3.075-3.074 3.075z",fill:"#02B383","fill-rule":"nonzero"}))),u("div",{className:"uppy-DashboardTab-name"},this.props.i18n("takePictureBtn")))),this.renderVideoCamera=()=>u("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":"MobileVideoCamera"},u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-uppy-super-focusable":!0,onClick:this.triggerVideoCameraInputClick},u("div",{className:"uppy-DashboardTab-inner"},u("svg",{"aria-hidden":"true",width:"32",height:"32",viewBox:"0 0 32 32"},u("path",{fill:"#FF675E",fillRule:"nonzero",d:"m21.254 14.277 2.941-2.588c.797-.313 1.243.818 1.09 1.554-.01 2.094.02 4.189-.017 6.282-.126.915-1.145 1.08-1.58.34l-2.434-2.142c-.192.287-.504 1.305-.738.468-.104-1.293-.028-2.596-.05-3.894.047-.312.381.823.426 1.069.063-.384.206-.744.362-1.09zm-12.939-3.73c3.858.013 7.717-.025 11.574.02.912.129 1.492 1.237 1.351 2.217-.019 2.412.04 4.83-.03 7.239-.17 1.025-1.166 1.59-2.029 1.429-3.705-.012-7.41.025-11.114-.019-.913-.129-1.492-1.237-1.352-2.217.018-2.404-.036-4.813.029-7.214.136-.82.83-1.473 1.571-1.454z "}))),u("div",{className:"uppy-DashboardTab-name"},this.props.i18n("recordVideoBtn")))),this.renderBrowseButton=(e,t)=>{let r=this.props.acquirers.length;return u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-browse",onClick:t,"data-uppy-super-focusable":r===0},e)},this.renderDropPasteBrowseTagline=e=>{let t=this.renderBrowseButton(this.props.i18n("browseFiles"),this.triggerFileInputClick),r=this.renderBrowseButton(this.props.i18n("browseFolders"),this.triggerFolderInputClick),s=this.props.fileManagerSelectionType,n=s.charAt(0).toUpperCase()+s.slice(1);return u("div",{class:"uppy-Dashboard-AddFiles-title"},this.props.disableLocalFiles?this.props.i18n("importFiles"):e>0?this.props.i18nArray(`dropPasteImport${n}`,{browseFiles:t,browseFolders:r,browse:t}):this.props.i18nArray(`dropPaste${n}`,{browseFiles:t,browseFolders:r,browse:t}))},this.renderAcquirer=e=>{var t;return u("div",{className:"uppy-DashboardTab",role:"presentation","data-uppy-acquirer-id":e.id},u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-DashboardTab-btn",role:"tab",tabIndex:0,"data-cy":e.id,"aria-controls":`uppy-DashboardContent-panel--${e.id}`,"aria-selected":((t=this.props.activePickerPanel)==null?void 0:t.id)===e.id,"data-uppy-super-focusable":!0,onClick:()=>this.props.showPanel(e.id)},u("div",{className:"uppy-DashboardTab-inner"},e.icon()),u("div",{className:"uppy-DashboardTab-name"},e.name)))},this.renderAcquirers=e=>{let t=[...e],r=t.splice(e.length-2,e.length);return u(Mt,null,t.map(s=>this.renderAcquirer(s)),u("span",{role:"presentation",style:{"white-space":"nowrap"}},r.map(s=>this.renderAcquirer(s))))},this.renderSourcesList=(e,t)=>{let{showNativePhotoCameraButton:r,showNativeVideoCameraButton:s}=this.props,n=[],o="myDevice";t||n.push({key:o,elements:this.renderMyDeviceAcquirer()}),r&&n.push({key:"nativePhotoCameraButton",elements:this.renderPhotoCamera()}),s&&n.push({key:"nativePhotoCameraButton",elements:this.renderVideoCamera()}),n.push(...e.map(d=>({key:d.id,elements:this.renderAcquirer(d)}))),n.length===1&&n[0].key===o&&(n=[]);let l=[...n],c=l.splice(n.length-2,n.length);return u(Mt,null,this.renderDropPasteBrowseTagline(n.length),u("div",{className:"uppy-Dashboard-AddFiles-list",role:"tablist"},l.map(d=>{let{key:f,elements:y}=d;return u(Mt,{key:f},y)}),u("span",{role:"presentation",style:{"white-space":"nowrap"}},c.map(d=>{let{key:f,elements:y}=d;return u(Mt,{key:f},y)}))))}}[Symbol.for("uppy test: disable unused locale key warning")](){this.props.i18nArray("dropPasteBoth"),this.props.i18nArray("dropPasteFiles"),this.props.i18nArray("dropPasteFolders"),this.props.i18nArray("dropPasteImportBoth"),this.props.i18nArray("dropPasteImportFiles"),this.props.i18nArray("dropPasteImportFolders")}renderPoweredByUppy(){let{i18nArray:e}=this.props,t=u("span",null,u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon uppy-Dashboard-poweredByIcon",width:"11",height:"11",viewBox:"0 0 11 11"},u("path",{d:"M7.365 10.5l-.01-4.045h2.612L5.5.806l-4.467 5.65h2.604l.01 4.044h3.718z",fillRule:"evenodd"})),u("span",{className:"uppy-Dashboard-poweredByUppy"},"Uppy")),r=e("poweredBy",{uppy:t});return u("a",{tabIndex:-1,href:"https://uppy.io",rel:"noreferrer noopener",target:"_blank",className:"uppy-Dashboard-poweredBy"},r)}render(){let{showNativePhotoCameraButton:e,showNativeVideoCameraButton:t,nativeCameraFacingMode:r}=this.props;return u("div",{className:"uppy-Dashboard-AddFiles"},this.renderHiddenInput(!1,s=>{this.fileInput=s}),this.renderHiddenInput(!0,s=>{this.folderInput=s}),e&&this.renderHiddenCameraInput("photo",r,s=>{this.mobilePhotoFileInput=s}),t&&this.renderHiddenCameraInput("video",r,s=>{this.mobileVideoFileInput=s}),this.renderSourcesList(this.props.acquirers,this.props.disableLocalFiles),u("div",{className:"uppy-Dashboard-AddFiles-info"},this.props.note&&u("div",{className:"uppy-Dashboard-note"},this.props.note),this.props.proudlyDisplayPoweredByUppy&&this.renderPoweredByUppy()))}},Sl=ed;var rv=Fe(wt(),1);var hT=i=>u("div",{className:(0,rv.default)("uppy-Dashboard-AddFilesPanel",i.className),"data-uppy-panelType":"AddFiles","aria-hidden":!i.showAddFilesPanel},u("div",{className:"uppy-DashboardContent-bar"},u("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},i.i18n("addingMoreFiles")),u("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>i.toggleAddFilesPanel(!1)},i.i18n("back"))),u(Sl,i)),sv=hT;var nv=Fe(wt(),1);function dT(i){let{tagName:e}=i.target;if(e==="INPUT"||e==="TEXTAREA"){i.stopPropagation();return}i.preventDefault(),i.stopPropagation()}var Ai=dT;function pT(i){let{activePickerPanel:e,className:t,hideAllPanels:r,i18n:s,state:n,uppy:o}=i,a=es(null);return u("div",{className:(0,nv.default)("uppy-DashboardContent-panel",t),role:"tabpanel","data-uppy-panelType":"PickerPanel",id:`uppy-DashboardContent-panel--${e.id}`,onDragOver:Ai,onDragLeave:Ai,onDrop:Ai,onPaste:Ai},u("div",{className:"uppy-DashboardContent-bar"},u("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},s("importFrom",{name:e.name})),u("button",{className:"uppy-DashboardContent-back",type:"button",onClick:r},s("cancel"))),u("div",{ref:a,className:"uppy-DashboardContent-panelBody"},o.getPlugin(e.id).render(n,a.current)))}var ov=pT;var av=Fe(wt(),1);function fT(i){let e=i.files[i.fileCardFor],t=()=>{i.uppy.emit("file-editor:cancel",e),i.closeFileEditor()};return u("div",{className:(0,av.default)("uppy-DashboardContent-panel",i.className),role:"tabpanel","data-uppy-panelType":"FileEditor",id:"uppy-DashboardContent-panel--editor"},u("div",{className:"uppy-DashboardContent-bar"},u("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},i.i18nArray("editing",{file:u("span",{className:"uppy-DashboardContent-titleFile"},e.meta?e.meta.name:e.name)})),u("button",{className:"uppy-DashboardContent-back",type:"button",onClick:t},i.i18n("cancel")),u("button",{className:"uppy-DashboardContent-save",type:"button",onClick:i.saveFileEditor},i.i18n("save"))),u("div",{className:"uppy-DashboardContent-panelBody"},i.editors.map(r=>i.uppy.getPlugin(r.id).render(i.state))))}var lv=fT;var Ci={STATE_ERROR:"error",STATE_WAITING:"waiting",STATE_PREPROCESSING:"preprocessing",STATE_UPLOADING:"uploading",STATE_POSTPROCESSING:"postprocessing",STATE_COMPLETE:"complete",STATE_PAUSED:"paused"};function mT(i,e,t,r){if(r===void 0&&(r={}),i)return Ci.STATE_ERROR;if(e)return Ci.STATE_COMPLETE;if(t)return Ci.STATE_PAUSED;let s=Ci.STATE_WAITING,n=Object.keys(r);for(let o=0;o<n.length;o++){let{progress:a}=r[n[o]];if(a.uploadStarted&&!a.uploadComplete)return Ci.STATE_UPLOADING;a.preprocess&&s!==Ci.STATE_UPLOADING&&(s=Ci.STATE_PREPROCESSING),a.postprocess&&s!==Ci.STATE_UPLOADING&&s!==Ci.STATE_PREPROCESSING&&(s=Ci.STATE_POSTPROCESSING)}return s}function gT(i){let{files:e,i18n:t,isAllComplete:r,isAllErrored:s,isAllPaused:n,inProgressNotPausedFiles:o,newFiles:a,processingFiles:l}=i;switch(mT(s,r,n,e)){case"uploading":return t("uploadingXFiles",{smart_count:o.length});case"preprocessing":case"postprocessing":return t("processingXFiles",{smart_count:l.length});case"paused":return t("uploadPaused");case"waiting":return t("xFilesSelected",{smart_count:a.length});case"complete":return t("uploadComplete");case"error":return t("error");default:}}function vT(i){let{i18n:e,isAllComplete:t,hideCancelButton:r,maxNumberOfFiles:s,toggleAddFilesPanel:n,uppy:o}=i,{allowNewUpload:a}=i;return a&&s&&(a=i.totalFileCount<i.maxNumberOfFiles),u("div",{className:"uppy-DashboardContent-bar"},!t&&!r?u("button",{className:"uppy-DashboardContent-back",type:"button",onClick:()=>o.cancelAll()},e("cancel")):u("div",null),u("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},u(gT,i)),a?u("button",{className:"uppy-DashboardContent-addMore",type:"button","aria-label":e("addMoreFiles"),title:e("addMoreFiles"),onClick:()=>n(!0)},u("svg",{"aria-hidden":"true",focusable:"false",className:"uppy-c-icon",width:"15",height:"15",viewBox:"0 0 15 15"},u("path",{d:"M8 6.5h6a.5.5 0 0 1 .5.5v.5a.5.5 0 0 1-.5.5H8v6a.5.5 0 0 1-.5.5H7a.5.5 0 0 1-.5-.5V8h-6a.5.5 0 0 1-.5-.5V7a.5.5 0 0 1 .5-.5h6v-6A.5.5 0 0 1 7 0h.5a.5.5 0 0 1 .5.5v6z"})),u("span",{className:"uppy-DashboardContent-addMoreCaption"},e("addMore"))):u("div",null))}var cv=vT;var uv=Fe(wt(),1);function td(i){let{computedMetaFields:e,requiredMetaFields:t,updateMeta:r,form:s,formState:n}=i,o={text:"uppy-u-reset uppy-c-textInput uppy-Dashboard-FileCard-input"};return e.map(a=>{let l=`uppy-Dashboard-FileCard-input-${a.id}`,c=t.includes(a.id);return u("fieldset",{key:a.id,className:"uppy-Dashboard-FileCard-fieldset"},u("label",{className:"uppy-Dashboard-FileCard-label",htmlFor:l},a.name),a.render!==void 0?a.render({value:n[a.id],onChange:d=>r(d,a.id),fieldCSSClasses:o,required:c,form:s.id},u):u("input",{className:o.text,id:l,form:s.id,type:a.type||"text",required:c,value:n[a.id],placeholder:a.placeholder,onInput:d=>r(d.target.value,a.id),"data-uppy-super-focusable":!0}))})}function id(i){var e;let{files:t,fileCardFor:r,toggleFileCard:s,saveFileCard:n,metaFields:o,requiredMetaFields:a,openFileEditor:l,i18n:c,i18nArray:d,className:f,canEditFile:y}=i,v=()=>typeof o=="function"?o(t[r]):o,x=t[r],C=(e=v())!=null?e:[],F=y(x),L={};C.forEach(K=>{var Q;L[K.id]=(Q=x.meta[K.id])!=null?Q:""});let[D,V]=fi(L),M=is(K=>{K.preventDefault(),n(D,r)},[n,D,r]),$=(K,Q)=>{V({...D,[Q]:K})},z=()=>{s(!1)},[G]=fi(()=>{let K=document.createElement("form");return K.setAttribute("tabindex","-1"),K.id=mr(),K});return ki(()=>(document.body.appendChild(G),G.addEventListener("submit",M),()=>{G.removeEventListener("submit",M),document.body.removeChild(G)}),[G,M]),u("div",{className:(0,uv.default)("uppy-Dashboard-FileCard",f),"data-uppy-panelType":"FileCard",onDragOver:Ai,onDragLeave:Ai,onDrop:Ai,onPaste:Ai},u("div",{className:"uppy-DashboardContent-bar"},u("div",{className:"uppy-DashboardContent-title",role:"heading","aria-level":"1"},d("editing",{file:u("span",{className:"uppy-DashboardContent-titleFile"},x.meta?x.meta.name:x.name)})),u("button",{className:"uppy-DashboardContent-back",type:"button",form:G.id,title:c("finishEditingFile"),onClick:z},c("cancel"))),u("div",{className:"uppy-Dashboard-FileCard-inner"},u("div",{className:"uppy-Dashboard-FileCard-preview",style:{backgroundColor:ns(x.type).color}},u(bo,{file:x}),F&&u("button",{type:"button",className:"uppy-u-reset uppy-c-btn uppy-Dashboard-FileCard-edit",onClick:K=>{M(K),l(x)}},c("editImage"))),u("div",{className:"uppy-Dashboard-FileCard-info"},u(td,{computedMetaFields:C,requiredMetaFields:a,updateMeta:$,form:G,formState:D})),u("div",{className:"uppy-Dashboard-FileCard-actions"},u("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-primary uppy-Dashboard-FileCard-actionsBtn",type:"submit",form:G.id},c("saveChanges")),u("button",{className:"uppy-u-reset uppy-c-btn uppy-c-btn-link uppy-Dashboard-FileCard-actionsBtn",type:"button",onClick:z,form:G.id},c("cancel")))))}var dv=Fe(wt(),1),Xs="uppy-transition-slideDownUp",hv=250;function bT(i){let{children:e}=i,[t,r]=fi(null),[s,n]=fi(""),o=es(),a=es(),l=es(),c=()=>{n(`${Xs}-enter`),cancelAnimationFrame(l.current),clearTimeout(a.current),a.current=void 0,l.current=requestAnimationFrame(()=>{n(`${Xs}-enter ${Xs}-enter-active`),o.current=setTimeout(()=>{n("")},hv)})},d=()=>{n(`${Xs}-leave`),cancelAnimationFrame(l.current),clearTimeout(o.current),o.current=void 0,l.current=requestAnimationFrame(()=>{n(`${Xs}-leave ${Xs}-leave-active`),a.current=setTimeout(()=>{r(null),n("")},hv)})};return ki(()=>{let f=xi(e)[0];t!==f&&(f&&!t?c():t&&!f&&!a.current&&d(),r(f))},[e,t]),ki(()=>()=>{clearTimeout(o.current),clearTimeout(a.current),cancelAnimationFrame(l.current)},[]),t?ja(t,{className:(0,dv.default)(s,t.props.className)}):null}var So=bT;function Ys(){return Ys=Object.assign?Object.assign.bind():function(i){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var r in t)({}).hasOwnProperty.call(t,r)&&(i[r]=t[r])}return i},Ys.apply(null,arguments)}var pv=900,fv=700,rd=576,mv=330;function sd(i){let e=i.totalFileCount===0,t=i.totalFileCount===1,r=i.containerWidth>rd,s=i.containerHeight>mv,n=(0,gv.default)({"uppy-Dashboard":!0,"uppy-Dashboard--isDisabled":i.disabled,"uppy-Dashboard--animateOpenClose":i.animateOpenClose,"uppy-Dashboard--isClosing":i.isClosing,"uppy-Dashboard--isDraggingOver":i.isDraggingOver,"uppy-Dashboard--modal":!i.inline,"uppy-size--md":i.containerWidth>rd,"uppy-size--lg":i.containerWidth>fv,"uppy-size--xl":i.containerWidth>pv,"uppy-size--height-md":i.containerHeight>mv,"uppy-Dashboard--isAddFilesPanelVisible":i.showAddFilesPanel,"uppy-Dashboard--isInnerWrapVisible":i.areInsidesReadyToBeVisible,"uppy-Dashboard--singleFile":i.singleFileFullScreen&&t&&s}),o=1;i.containerWidth>pv?o=5:i.containerWidth>fv?o=4:i.containerWidth>rd&&(o=3);let a=i.showSelectedFiles&&!e,l=i.recoveredState?Object.keys(i.recoveredState.files).length:null,c=i.files?Object.keys(i.files).filter(y=>i.files[y].isGhost).length:0,d=()=>c>0?i.i18n("recoveredXFiles",{smart_count:c}):i.i18n("recoveredAllFiles");return u("div",{className:n,"data-uppy-theme":i.theme,"data-uppy-num-acquirers":i.acquirers.length,"data-uppy-drag-drop-supported":!i.disableLocalFiles&&Vh(),"aria-hidden":i.inline?"false":i.isHidden,"aria-disabled":i.disabled,"aria-label":i.inline?i.i18n("dashboardTitle"):i.i18n("dashboardWindowTitle"),onPaste:i.handlePaste,onDragOver:i.handleDragOver,onDragLeave:i.handleDragLeave,onDrop:i.handleDrop},u("div",{"aria-hidden":"true",className:"uppy-Dashboard-overlay",tabIndex:-1,onClick:i.handleClickOutside}),u("div",{className:"uppy-Dashboard-inner","aria-modal":!i.inline&&"true",role:i.inline?void 0:"dialog",style:{width:i.inline&&i.width?i.width:"",height:i.inline&&i.height?i.height:""}},i.inline?null:u("button",{className:"uppy-u-reset uppy-Dashboard-close",type:"button","aria-label":i.i18n("closeModal"),title:i.i18n("closeModal"),onClick:i.closeModal},u("span",{"aria-hidden":"true"},"\xD7")),u("div",{className:"uppy-Dashboard-innerWrap"},u("div",{className:"uppy-Dashboard-dropFilesHereHint"},i.i18n("dropHint")),a&&u(cv,i),l&&u("div",{className:"uppy-Dashboard-serviceMsg"},u("svg",{className:"uppy-Dashboard-serviceMsg-icon","aria-hidden":"true",focusable:"false",width:"21",height:"16",viewBox:"0 0 24 19"},u("g",{transform:"translate(0 -1)",fill:"none",fillRule:"evenodd"},u("path",{d:"M12.857 1.43l10.234 17.056A1 1 0 0122.234 20H1.766a1 1 0 01-.857-1.514L11.143 1.429a1 1 0 011.714 0z",fill:"#FFD300"}),u("path",{fill:"#000",d:"M11 6h2l-.3 8h-1.4z"}),u("circle",{fill:"#000",cx:"12",cy:"17",r:"1"}))),u("strong",{className:"uppy-Dashboard-serviceMsg-title"},i.i18n("sessionRestored")),u("div",{className:"uppy-Dashboard-serviceMsg-text"},d())),a?u(Jh,{id:i.id,i18n:i.i18n,uppy:i.uppy,files:i.files,resumableUploads:i.resumableUploads,hideRetryButton:i.hideRetryButton,hidePauseResumeButton:i.hidePauseResumeButton,hideCancelButton:i.hideCancelButton,showLinkToFileUploadResult:i.showLinkToFileUploadResult,showRemoveButtonAfterComplete:i.showRemoveButtonAfterComplete,metaFields:i.metaFields,toggleFileCard:i.toggleFileCard,handleRequestThumbnail:i.handleRequestThumbnail,handleCancelThumbnail:i.handleCancelThumbnail,recoveredState:i.recoveredState,individualCancellation:i.individualCancellation,openFileEditor:i.openFileEditor,canEditFile:i.canEditFile,toggleAddFilesPanel:i.toggleAddFilesPanel,isSingleFile:t,itemsPerRow:o,containerWidth:i.containerWidth,containerHeight:i.containerHeight}):u(Sl,{i18n:i.i18n,i18nArray:i.i18nArray,acquirers:i.acquirers,handleInputChange:i.handleInputChange,maxNumberOfFiles:i.maxNumberOfFiles,allowedFileTypes:i.allowedFileTypes,showNativePhotoCameraButton:i.showNativePhotoCameraButton,showNativeVideoCameraButton:i.showNativeVideoCameraButton,nativeCameraFacingMode:i.nativeCameraFacingMode,showPanel:i.showPanel,activePickerPanel:i.activePickerPanel,disableLocalFiles:i.disableLocalFiles,fileManagerSelectionType:i.fileManagerSelectionType,note:i.note,proudlyDisplayPoweredByUppy:i.proudlyDisplayPoweredByUppy}),u(So,null,i.showAddFilesPanel?u(sv,Ys({key:"AddFiles"},i,{isSizeMD:r})):null),u(So,null,i.fileCardFor?u(id,Ys({key:"FileCard"},i)):null),u(So,null,i.activePickerPanel?u(ov,Ys({key:"Picker"},i)):null),u(So,null,i.showFileEditor?u(lv,Ys({key:"Editor"},i)):null),u("div",{className:"uppy-Dashboard-progressindicators"},i.progressindicators.map(y=>i.uppy.getPlugin(y.id).render(i.state))))))}var vv={strings:{closeModal:"Close Modal",addMoreFiles:"Add more files",addingMoreFiles:"Adding more files",importFrom:"Import from %{name}",dashboardWindowTitle:"Uppy Dashboard Window (Press escape to close)",dashboardTitle:"Uppy Dashboard",copyLinkToClipboardSuccess:"Link copied to clipboard.",copyLinkToClipboardFallback:"Copy the URL below",copyLink:"Copy link",back:"Back",removeFile:"Remove file",editFile:"Edit file",editImage:"Edit image",editing:"Editing %{file}",error:"Error",finishEditingFile:"Finish editing file",saveChanges:"Save changes",myDevice:"My Device",dropHint:"Drop your files here",uploadComplete:"Upload complete",uploadPaused:"Upload paused",resumeUpload:"Resume upload",pauseUpload:"Pause upload",retryUpload:"Retry upload",cancelUpload:"Cancel upload",xFilesSelected:{0:"%{smart_count} file selected",1:"%{smart_count} files selected"},uploadingXFiles:{0:"Uploading %{smart_count} file",1:"Uploading %{smart_count} files"},processingXFiles:{0:"Processing %{smart_count} file",1:"Processing %{smart_count} files"},poweredBy:"Powered by %{uppy}",addMore:"Add more",editFileWithFilename:"Edit file %{file}",save:"Save",cancel:"Cancel",dropPasteFiles:"Drop files here or %{browseFiles}",dropPasteFolders:"Drop files here or %{browseFolders}",dropPasteBoth:"Drop files here, %{browseFiles} or %{browseFolders}",dropPasteImportFiles:"Drop files here, %{browseFiles} or import from:",dropPasteImportFolders:"Drop files here, %{browseFolders} or import from:",dropPasteImportBoth:"Drop files here, %{browseFiles}, %{browseFolders} or import from:",importFiles:"Import files from:",browseFiles:"browse files",browseFolders:"browse folders",recoveredXFiles:{0:"We could not fully recover 1 file. Please re-select it and resume the upload.",1:"We could not fully recover %{smart_count} files. Please re-select them and resume the upload."},recoveredAllFiles:"We restored all files. You can now resume the upload.",sessionRestored:"Session restored",reSelect:"Re-select",missingRequiredMetaFields:{0:"Missing required meta field: %{fields}.",1:"Missing required meta fields: %{fields}."},takePictureBtn:"Take Picture",recordVideoBtn:"Record Video"}};function de(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var yT=0;function ct(i){return"__private_"+yT+++"_"+i}var wT={version:"4.3.2"},nd=Hh.default||Hh,bv=9,ST=27;function yv(){let i={};return i.promise=new Promise((e,t)=>{i.resolve=e,i.reject=t}),i}var ET={target:"body",metaFields:[],thumbnailWidth:280,thumbnailType:"image/jpeg",waitForThumbnailsBeforeUpload:!1,defaultPickerIcon:go,showLinkToFileUploadResult:!1,showProgressDetails:!1,hideUploadButton:!1,hideCancelButton:!1,hideRetryButton:!1,hidePauseResumeButton:!1,hideProgressAfterFinish:!1,note:null,singleFileFullScreen:!0,disableStatusBar:!1,disableInformer:!1,disableThumbnailGenerator:!1,fileManagerSelectionType:"files",proudlyDisplayPoweredByUppy:!0,showSelectedFiles:!0,showRemoveButtonAfterComplete:!1,showNativePhotoCameraButton:!1,showNativeVideoCameraButton:!1,theme:"light",autoOpen:null,disabled:!1,disableLocalFiles:!1,nativeCameraFacingMode:"",onDragLeave:()=>{},onDragOver:()=>{},onDrop:()=>{},plugins:[],doneButtonHandler:void 0,onRequestCloseModal:null,inline:!1,animateOpenClose:!0,browserBackButtonClose:!1,closeAfterFinish:!1,closeModalOnClickOutside:!1,disablePageScrollWhenModalOpen:!0,trigger:null,width:750,height:550},os=ct("disabledNodes"),Ki=ct("generateLargeThumbnailIfSingleFile"),Eo=ct("openFileEditorWhenFilesAdded"),as=ct("attachRenderFunctionToTarget"),od=ct("isTargetSupported"),ad=ct("getAcquirers"),ld=ct("getProgressIndicators"),Xi=ct("getEditors"),cd=ct("addSpecifiedPluginsFromOptions"),ud=ct("autoDiscoverPlugins"),ls=ct("addSupportedPluginIfNoTarget"),To=ct("getStatusBarOpts"),xo=ct("getThumbnailGeneratorOpts"),hd=ct("getInformerOpts"),ko=ct("getStatusBarId"),Ao=ct("getThumbnailGeneratorId"),dd=ct("getInformerId"),wr=class extends di{constructor(e,t){var r,s,n;let o=(r=t?.autoOpen)!=null?r:null;super(e,{...ET,...t,autoOpen:o}),Object.defineProperty(this,dd,{value:PT}),Object.defineProperty(this,Ao,{value:CT}),Object.defineProperty(this,ko,{value:AT}),Object.defineProperty(this,hd,{value:kT}),Object.defineProperty(this,xo,{value:xT}),Object.defineProperty(this,To,{value:TT}),Object.defineProperty(this,os,{writable:!0,value:void 0}),this.modalName=`uppy-Dashboard-${mr()}`,this.superFocus=qh(),this.ifFocusedOnUppyRecently=!1,this.removeTarget=a=>{let c=this.getPluginState().targets.filter(d=>d.id!==a.id);this.setPluginState({targets:c})},this.addTarget=a=>{let l=a.id||a.constructor.name,c=a.title||l,d=a.type;if(d!=="acquirer"&&d!=="progressindicator"&&d!=="editor")return this.uppy.log("Dashboard: can only be targeted by plugins of types: acquirer, progressindicator, editor","error"),null;let f={id:l,name:c,type:d},v=this.getPluginState().targets.slice();return v.push(f),this.setPluginState({targets:v}),this.el},this.hideAllPanels=()=>{var a;let l=this.getPluginState(),c={activePickerPanel:void 0,showAddFilesPanel:!1,activeOverlayType:null,fileCardFor:null,showFileEditor:!1};l.activePickerPanel===c.activePickerPanel&&l.showAddFilesPanel===c.showAddFilesPanel&&l.showFileEditor===c.showFileEditor&&l.activeOverlayType===c.activeOverlayType||(this.setPluginState(c),this.uppy.emit("dashboard:close-panel",(a=l.activePickerPanel)==null?void 0:a.id))},this.showPanel=a=>{let{targets:l}=this.getPluginState(),c=l.find(d=>d.type==="acquirer"&&d.id===a);this.setPluginState({activePickerPanel:c,activeOverlayType:"PickerPanel"}),this.uppy.emit("dashboard:show-panel",a)},this.canEditFile=a=>{let{targets:l}=this.getPluginState();return de(this,Xi)[Xi](l).some(d=>this.uppy.getPlugin(d.id).canEditFile(a))},this.openFileEditor=a=>{let{targets:l}=this.getPluginState(),c=de(this,Xi)[Xi](l);this.setPluginState({showFileEditor:!0,fileCardFor:a.id||null,activeOverlayType:"FileEditor"}),c.forEach(d=>{this.uppy.getPlugin(d.id).selectFile(a)})},this.closeFileEditor=()=>{let{metaFields:a}=this.getPluginState();a&&a.length>0?this.setPluginState({showFileEditor:!1,activeOverlayType:"FileCard"}):this.setPluginState({showFileEditor:!1,fileCardFor:null,activeOverlayType:"AddFiles"})},this.saveFileEditor=()=>{let{targets:a}=this.getPluginState();de(this,Xi)[Xi](a).forEach(c=>{this.uppy.getPlugin(c.id).save()}),this.closeFileEditor()},this.openModal=()=>{let{promise:a,resolve:l}=yv();if(this.savedScrollPosition=window.pageYOffset,this.savedActiveElement=document.activeElement,this.opts.disablePageScrollWhenModalOpen&&document.body.classList.add("uppy-Dashboard-isFixed"),this.opts.animateOpenClose&&this.getPluginState().isClosing){let c=()=>{this.setPluginState({isHidden:!1}),this.el.removeEventListener("animationend",c,!1),l()};this.el.addEventListener("animationend",c,!1)}else this.setPluginState({isHidden:!1}),l();return this.opts.browserBackButtonClose&&this.updateBrowserHistory(),document.addEventListener("keydown",this.handleKeyDownInModal),this.uppy.emit("dashboard:modal-open"),a},this.closeModal=a=>{var l;let c=(l=a?.manualClose)!=null?l:!0,{isHidden:d,isClosing:f}=this.getPluginState();if(d||f)return;let{promise:y,resolve:v}=yv();if(this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.opts.animateOpenClose){this.setPluginState({isClosing:!0});let C=()=>{this.setPluginState({isHidden:!0,isClosing:!1}),this.superFocus.cancel(),this.savedActiveElement.focus(),this.el.removeEventListener("animationend",C,!1),v()};this.el.addEventListener("animationend",C,!1)}else this.setPluginState({isHidden:!0}),this.superFocus.cancel(),this.savedActiveElement.focus(),v();if(document.removeEventListener("keydown",this.handleKeyDownInModal),c&&this.opts.browserBackButtonClose){var x;(x=history.state)!=null&&x[this.modalName]&&history.back()}return this.uppy.emit("dashboard:modal-closed"),y},this.isModalOpen=()=>!this.getPluginState().isHidden||!1,this.requestCloseModal=()=>this.opts.onRequestCloseModal?this.opts.onRequestCloseModal():this.closeModal(),this.setDarkModeCapability=a=>{let{capabilities:l}=this.uppy.getState();this.uppy.setState({capabilities:{...l,darkMode:a}})},this.handleSystemDarkModeChange=a=>{let l=a.matches;this.uppy.log(`[Dashboard] Dark mode is ${l?"on":"off"}`),this.setDarkModeCapability(l)},this.toggleFileCard=(a,l)=>{let c=this.uppy.getFile(l);a?this.uppy.emit("dashboard:file-edit-start",c):this.uppy.emit("dashboard:file-edit-complete",c),this.setPluginState({fileCardFor:a?l:null,activeOverlayType:a?"FileCard":null})},this.toggleAddFilesPanel=a=>{this.setPluginState({showAddFilesPanel:a,activeOverlayType:a?"AddFiles":null})},this.addFiles=a=>{let l=a.map(c=>({source:this.id,name:c.name,type:c.type,data:c,meta:{relativePath:c.relativePath||c.webkitRelativePath||null}}));try{this.uppy.addFiles(l)}catch(c){this.uppy.log(c)}},this.startListeningToResize=()=>{this.resizeObserver=new ResizeObserver(a=>{let l=a[0],{width:c,height:d}=l.contentRect;this.setPluginState({containerWidth:c,containerHeight:d,areInsidesReadyToBeVisible:!0})}),this.resizeObserver.observe(this.el.querySelector(".uppy-Dashboard-inner")),this.makeDashboardInsidesVisibleAnywayTimeout=setTimeout(()=>{let a=this.getPluginState(),l=!this.opts.inline&&a.isHidden;!a.areInsidesReadyToBeVisible&&!l&&(this.uppy.log("[Dashboard] resize event didn\u2019t fire on time: defaulted to mobile layout","warning"),this.setPluginState({areInsidesReadyToBeVisible:!0}))},1e3)},this.stopListeningToResize=()=>{this.resizeObserver.disconnect(),clearTimeout(this.makeDashboardInsidesVisibleAnywayTimeout)},this.recordIfFocusedOnUppyRecently=a=>{this.el.contains(a.target)?this.ifFocusedOnUppyRecently=!0:(this.ifFocusedOnUppyRecently=!1,this.superFocus.cancel())},this.disableInteractiveElements=a=>{var l;let c=["a[href]","input:not([disabled])","select:not([disabled])","textarea:not([disabled])","button:not([disabled])",'[role="button"]:not([disabled])'],d=(l=de(this,os)[os])!=null?l:br(this.el.querySelectorAll(c)).filter(f=>!f.classList.contains("uppy-Dashboard-close"));for(let f of d)f.tagName==="A"?f.setAttribute("aria-disabled",a):f.disabled=a;a?de(this,os)[os]=d:de(this,os)[os]=null,this.dashboardIsDisabled=a},this.updateBrowserHistory=()=>{var a;(a=history.state)!=null&&a[this.modalName]||history.pushState({...history.state,[this.modalName]:!0},""),window.addEventListener("popstate",this.handlePopState,!1)},this.handlePopState=a=>{var l;this.isModalOpen()&&(!a.state||!a.state[this.modalName])&&this.closeModal({manualClose:!1}),!this.isModalOpen()&&(l=a.state)!=null&&l[this.modalName]&&history.back()},this.handleKeyDownInModal=a=>{a.keyCode===ST&&this.requestCloseModal(),a.keyCode===bv&&$h(a,this.getPluginState().activeOverlayType,this.el)},this.handleClickOutside=()=>{this.opts.closeModalOnClickOutside&&this.requestCloseModal()},this.handlePaste=a=>{this.uppy.iteratePlugins(c=>{c.type==="acquirer"&&(c.handleRootPaste==null||c.handleRootPaste(a))});let l=br(a.clipboardData.files);l.length>0&&(this.uppy.log("[Dashboard] Files pasted"),this.addFiles(l))},this.handleInputChange=a=>{a.preventDefault();let l=br(a.currentTarget.files||[]);l.length>0&&(this.uppy.log("[Dashboard] Files selected through input"),this.addFiles(l))},this.handleDragOver=a=>{a.preventDefault(),a.stopPropagation();let l=()=>{let y=!0;return this.uppy.iteratePlugins(v=>{v.canHandleRootDrop!=null&&v.canHandleRootDrop(a)&&(y=!0)}),y},c=()=>{let{types:y}=a.dataTransfer;return y.some(v=>v==="Files")},d=l(),f=c();if(!d&&!f||this.opts.disabled||this.opts.disableLocalFiles&&(f||!d)||!this.uppy.getState().allowNewUpload){a.dataTransfer.dropEffect="none";return}a.dataTransfer.dropEffect="copy",this.setPluginState({isDraggingOver:!0}),this.opts.onDragOver(a)},this.handleDragLeave=a=>{a.preventDefault(),a.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.opts.onDragLeave(a)},this.handleDrop=async a=>{a.preventDefault(),a.stopPropagation(),this.setPluginState({isDraggingOver:!1}),this.uppy.iteratePlugins(f=>{f.type==="acquirer"&&(f.handleRootDrop==null||f.handleRootDrop(a))});let l=!1,c=f=>{this.uppy.log(f,"error"),l||(this.uppy.info(f.message,"error"),l=!0)};this.uppy.log("[Dashboard] Processing dropped files");let d=await Eh(a.dataTransfer,{logDropError:c});d.length>0&&(this.uppy.log("[Dashboard] Files dropped"),this.addFiles(d)),this.opts.onDrop(a)},this.handleRequestThumbnail=a=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:request",a)},this.handleCancelThumbnail=a=>{this.opts.waitForThumbnailsBeforeUpload||this.uppy.emit("thumbnail:cancel",a)},this.handleKeyDownInInline=a=>{a.keyCode===bv&&Zg(a,this.getPluginState().activeOverlayType,this.el)},this.handlePasteOnBody=a=>{this.el.contains(document.activeElement)&&this.handlePaste(a)},this.handleComplete=a=>{let{failed:l}=a;this.opts.closeAfterFinish&&!(l!=null&&l.length)&&this.requestCloseModal()},this.handleCancelRestore=()=>{this.uppy.emit("restore-canceled")},Object.defineProperty(this,Ki,{writable:!0,value:()=>{if(this.opts.disableThumbnailGenerator)return;let a=600,l=this.uppy.getFiles();if(l.length===1){let c=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);c?.setOptions({thumbnailWidth:a});let d={...l[0],preview:void 0};c?.requestThumbnail(d).then(()=>{c?.setOptions({thumbnailWidth:this.opts.thumbnailWidth})})}}}),Object.defineProperty(this,Eo,{writable:!0,value:a=>{let l=a[0],{metaFields:c}=this.getPluginState(),d=c&&c.length>0,f=this.canEditFile(l);d&&this.opts.autoOpen==="metaEditor"?this.toggleFileCard(!0,l.id):f&&this.opts.autoOpen==="imageEditor"&&this.openFileEditor(l)}}),this.initEvents=()=>{if(this.opts.trigger&&!this.opts.inline){let a=yh(this.opts.trigger);a?a.forEach(l=>l.addEventListener("click",this.openModal)):this.uppy.log("Dashboard modal trigger not found. Make sure `trigger` is set in Dashboard options, unless you are planning to call `dashboard.openModal()` method yourself","warning")}this.startListeningToResize(),document.addEventListener("paste",this.handlePasteOnBody),this.uppy.on("plugin-added",de(this,ls)[ls]),this.uppy.on("plugin-remove",this.removeTarget),this.uppy.on("file-added",this.hideAllPanels),this.uppy.on("dashboard:modal-closed",this.hideAllPanels),this.uppy.on("complete",this.handleComplete),this.uppy.on("files-added",de(this,Ki)[Ki]),this.uppy.on("file-removed",de(this,Ki)[Ki]),document.addEventListener("focus",this.recordIfFocusedOnUppyRecently,!0),document.addEventListener("click",this.recordIfFocusedOnUppyRecently,!0),this.opts.inline&&this.el.addEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.on("files-added",de(this,Eo)[Eo])},this.removeEvents=()=>{let a=yh(this.opts.trigger);!this.opts.inline&&a&&a.forEach(l=>l.removeEventListener("click",this.openModal)),this.stopListeningToResize(),document.removeEventListener("paste",this.handlePasteOnBody),window.removeEventListener("popstate",this.handlePopState,!1),this.uppy.off("plugin-added",de(this,ls)[ls]),this.uppy.off("plugin-remove",this.removeTarget),this.uppy.off("file-added",this.hideAllPanels),this.uppy.off("dashboard:modal-closed",this.hideAllPanels),this.uppy.off("complete",this.handleComplete),this.uppy.off("files-added",de(this,Ki)[Ki]),this.uppy.off("file-removed",de(this,Ki)[Ki]),document.removeEventListener("focus",this.recordIfFocusedOnUppyRecently),document.removeEventListener("click",this.recordIfFocusedOnUppyRecently),this.opts.inline&&this.el.removeEventListener("keydown",this.handleKeyDownInInline),this.opts.autoOpen&&this.uppy.off("files-added",de(this,Eo)[Eo])},this.superFocusOnEachUpdate=()=>{let a=this.el.contains(document.activeElement),l=document.activeElement===document.body||document.activeElement===null,c=this.uppy.getState().info.length===0,d=!this.opts.inline;c&&(d||a||l&&this.ifFocusedOnUppyRecently)?this.superFocus(this.el,this.getPluginState().activeOverlayType):this.superFocus.cancel()},this.afterUpdate=()=>{if(this.opts.disabled&&!this.dashboardIsDisabled){this.disableInteractiveElements(!0);return}!this.opts.disabled&&this.dashboardIsDisabled&&this.disableInteractiveElements(!1),this.superFocusOnEachUpdate()},this.saveFileCard=(a,l)=>{this.uppy.setFileMeta(l,a),this.toggleFileCard(!1,l)},Object.defineProperty(this,as,{writable:!0,value:a=>{let l=this.uppy.getPlugin(a.id);return{...a,icon:l.icon||this.opts.defaultPickerIcon,render:l.render}}}),Object.defineProperty(this,od,{writable:!0,value:a=>{let l=this.uppy.getPlugin(a.id);return typeof l.isSupported!="function"?!0:l.isSupported()}}),Object.defineProperty(this,ad,{writable:!0,value:nd(a=>a.filter(l=>l.type==="acquirer"&&de(this,od)[od](l)).map(de(this,as)[as]))}),Object.defineProperty(this,ld,{writable:!0,value:nd(a=>a.filter(l=>l.type==="progressindicator").map(de(this,as)[as]))}),Object.defineProperty(this,Xi,{writable:!0,value:nd(a=>a.filter(l=>l.type==="editor").map(de(this,as)[as]))}),this.render=a=>{let l=this.getPluginState(),{files:c,capabilities:d,allowNewUpload:f}=a,{newFiles:y,uploadStartedFiles:v,completeFiles:x,erroredFiles:C,inProgressFiles:F,inProgressNotPausedFiles:L,processingFiles:D,isUploadStarted:V,isAllComplete:M,isAllPaused:$}=this.uppy.getObjectOfFilesPerState(),z=de(this,ad)[ad](l.targets),G=de(this,ld)[ld](l.targets),K=de(this,Xi)[Xi](l.targets),Q;return this.opts.theme==="auto"?Q=d.darkMode?"dark":"light":Q=this.opts.theme,["files","folders","both"].indexOf(this.opts.fileManagerSelectionType)<0&&(this.opts.fileManagerSelectionType="files",console.warn(`Unsupported option for "fileManagerSelectionType". Using default of "${this.opts.fileManagerSelectionType}".`)),sd({state:a,isHidden:l.isHidden,files:c,newFiles:y,uploadStartedFiles:v,completeFiles:x,erroredFiles:C,inProgressFiles:F,inProgressNotPausedFiles:L,processingFiles:D,isUploadStarted:V,isAllComplete:M,isAllPaused:$,totalFileCount:Object.keys(c).length,totalProgress:a.totalProgress,allowNewUpload:f,acquirers:z,theme:Q,disabled:this.opts.disabled,disableLocalFiles:this.opts.disableLocalFiles,direction:this.opts.direction,activePickerPanel:l.activePickerPanel,showFileEditor:l.showFileEditor,saveFileEditor:this.saveFileEditor,closeFileEditor:this.closeFileEditor,disableInteractiveElements:this.disableInteractiveElements,animateOpenClose:this.opts.animateOpenClose,isClosing:l.isClosing,progressindicators:G,editors:K,autoProceed:this.uppy.opts.autoProceed,id:this.id,closeModal:this.requestCloseModal,handleClickOutside:this.handleClickOutside,handleInputChange:this.handleInputChange,handlePaste:this.handlePaste,inline:this.opts.inline,showPanel:this.showPanel,hideAllPanels:this.hideAllPanels,i18n:this.i18n,i18nArray:this.i18nArray,uppy:this.uppy,note:this.opts.note,recoveredState:a.recoveredState,metaFields:l.metaFields,resumableUploads:d.resumableUploads||!1,individualCancellation:d.individualCancellation,isMobileDevice:d.isMobileDevice,fileCardFor:l.fileCardFor,toggleFileCard:this.toggleFileCard,toggleAddFilesPanel:this.toggleAddFilesPanel,showAddFilesPanel:l.showAddFilesPanel,saveFileCard:this.saveFileCard,openFileEditor:this.openFileEditor,canEditFile:this.canEditFile,width:this.opts.width,height:this.opts.height,showLinkToFileUploadResult:this.opts.showLinkToFileUploadResult,fileManagerSelectionType:this.opts.fileManagerSelectionType,proudlyDisplayPoweredByUppy:this.opts.proudlyDisplayPoweredByUppy,hideCancelButton:this.opts.hideCancelButton,hideRetryButton:this.opts.hideRetryButton,hidePauseResumeButton:this.opts.hidePauseResumeButton,showRemoveButtonAfterComplete:this.opts.showRemoveButtonAfterComplete,containerWidth:l.containerWidth,containerHeight:l.containerHeight,areInsidesReadyToBeVisible:l.areInsidesReadyToBeVisible,parentElement:this.el,allowedFileTypes:this.uppy.opts.restrictions.allowedFileTypes,maxNumberOfFiles:this.uppy.opts.restrictions.maxNumberOfFiles,requiredMetaFields:this.uppy.opts.restrictions.requiredMetaFields,showSelectedFiles:this.opts.showSelectedFiles,showNativePhotoCameraButton:this.opts.showNativePhotoCameraButton,showNativeVideoCameraButton:this.opts.showNativeVideoCameraButton,nativeCameraFacingMode:this.opts.nativeCameraFacingMode,singleFileFullScreen:this.opts.singleFileFullScreen,handleCancelRestore:this.handleCancelRestore,handleRequestThumbnail:this.handleRequestThumbnail,handleCancelThumbnail:this.handleCancelThumbnail,isDraggingOver:l.isDraggingOver,handleDragOver:this.handleDragOver,handleDragLeave:this.handleDragLeave,handleDrop:this.handleDrop})},Object.defineProperty(this,cd,{writable:!0,value:()=>{let{plugins:a}=this.opts;a.forEach(l=>{let c=this.uppy.getPlugin(l);c?c.mount(this,c):this.uppy.log(`[Uppy] Dashboard could not find plugin '${l}', make sure to uppy.use() the plugins you are specifying`,"warning")})}}),Object.defineProperty(this,ud,{writable:!0,value:()=>{this.uppy.iteratePlugins(de(this,ls)[ls])}}),Object.defineProperty(this,ls,{writable:!0,value:a=>{var l;let c=["acquirer","editor"];a&&!((l=a.opts)!=null&&l.target)&&c.includes(a.type)&&(this.getPluginState().targets.some(f=>a.id===f.id)||a.mount(this,a))}}),this.install=()=>{this.setPluginState({isHidden:!0,fileCardFor:null,activeOverlayType:null,showAddFilesPanel:!1,activePickerPanel:void 0,showFileEditor:!1,metaFields:this.opts.metaFields,targets:[],areInsidesReadyToBeVisible:!1,isDraggingOver:!1});let{inline:a,closeAfterFinish:l}=this.opts;if(a&&l)throw new Error("[Dashboard] `closeAfterFinish: true` cannot be used on an inline Dashboard, because an inline Dashboard cannot be closed at all. Either set `inline: false`, or disable the `closeAfterFinish` option.");let{allowMultipleUploads:c,allowMultipleUploadBatches:d}=this.uppy.opts;(c||d)&&l&&this.uppy.log("[Dashboard] When using `closeAfterFinish`, we recommended setting the `allowMultipleUploadBatches` option to `false` in the Uppy constructor. See https://uppy.io/docs/uppy/#allowMultipleUploads-true","warning");let{target:f}=this.opts;f&&this.mount(f,this),this.opts.disableStatusBar||this.uppy.use(Xr,{id:de(this,ko)[ko](),target:this,...de(this,To)[To]()}),this.opts.disableInformer||this.uppy.use(Yr,{id:de(this,dd)[dd](),target:this,...de(this,hd)[hd]()}),this.opts.disableThumbnailGenerator||this.uppy.use(Vs,{id:de(this,Ao)[Ao](),...de(this,xo)[xo]()}),this.darkModeMediaQuery=typeof window<"u"&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)"):null;let y=this.darkModeMediaQuery?this.darkModeMediaQuery.matches:!1;if(this.uppy.log(`[Dashboard] Dark mode is ${y?"on":"off"}`),this.setDarkModeCapability(y),this.opts.theme==="auto"){var v;(v=this.darkModeMediaQuery)==null||v.addListener(this.handleSystemDarkModeChange)}de(this,cd)[cd](),de(this,ud)[ud](),this.initEvents()},this.uninstall=()=>{if(!this.opts.disableInformer){let c=this.uppy.getPlugin(`${this.id}:Informer`);c&&this.uppy.removePlugin(c)}if(!this.opts.disableStatusBar){let c=this.uppy.getPlugin(`${this.id}:StatusBar`);c&&this.uppy.removePlugin(c)}if(!this.opts.disableThumbnailGenerator){let c=this.uppy.getPlugin(`${this.id}:ThumbnailGenerator`);c&&this.uppy.removePlugin(c)}let{plugins:a}=this.opts;if(a.forEach(c=>{let d=this.uppy.getPlugin(c);d&&d.unmount()}),this.opts.theme==="auto"){var l;(l=this.darkModeMediaQuery)==null||l.removeListener(this.handleSystemDarkModeChange)}this.opts.disablePageScrollWhenModalOpen&&document.body.classList.remove("uppy-Dashboard-isFixed"),this.unmount(),this.removeEvents()},this.id=this.opts.id||"Dashboard",this.title="Dashboard",this.type="orchestrator",this.defaultLocale=vv,this.opts.doneButtonHandler===void 0&&(this.opts.doneButtonHandler=()=>{this.uppy.clear(),this.requestCloseModal()}),(n=(s=this.opts).onRequestCloseModal)!=null||(s.onRequestCloseModal=()=>this.closeModal()),this.i18nInit()}setOptions(e){var t,r;super.setOptions(e),(t=this.uppy.getPlugin(de(this,ko)[ko]()))==null||t.setOptions(de(this,To)[To]()),(r=this.uppy.getPlugin(de(this,Ao)[Ao]()))==null||r.setOptions(de(this,xo)[xo]())}};function TT(){let{hideUploadButton:i,hideRetryButton:e,hidePauseResumeButton:t,hideCancelButton:r,showProgressDetails:s,hideProgressAfterFinish:n,locale:o,doneButtonHandler:a}=this.opts;return{hideUploadButton:i,hideRetryButton:e,hidePauseResumeButton:t,hideCancelButton:r,showProgressDetails:s,hideAfterFinish:n,locale:o,doneButtonHandler:a}}function xT(){let{thumbnailWidth:i,thumbnailHeight:e,thumbnailType:t,waitForThumbnailsBeforeUpload:r}=this.opts;return{thumbnailWidth:i,thumbnailHeight:e,thumbnailType:t,waitForThumbnailsBeforeUpload:r,lazy:!r}}function kT(){return{}}function AT(){return`${this.id}:StatusBar`}function CT(){return`${this.id}:ThumbnailGenerator`}function PT(){return`${this.id}:Informer`}wr.VERSION=wT.version;var kv=Fe(wv(),1);function FT(i,e){let t=i.width/e.width,r=i.height/e.height,s=Math.min(t,r),n=e.width*s,o=e.height*s,a=(i.width-n)/2,l=(i.height-o)/2;return{width:n,height:o,left:a,top:l}}var Sv=FT;function _T(i){return i*(Math.PI/180)}function OT(i,e,t){let r=Math.abs(_T(t));return Math.max((Math.sin(r)*i+Math.cos(r)*e)/e,(Math.sin(r)*e+Math.cos(r)*i)/i)}var Ev=OT;function LT(i,e,t){return e.left<i.left?{left:i.left,width:t.width}:e.top<i.top?{top:i.top,height:t.height}:e.left+e.width>i.left+i.width?{left:i.left+i.width-t.width,width:t.width}:e.top+e.height>i.top+i.height?{top:i.top+i.height-t.height,height:t.height}:null}var Tv=LT;function RT(i,e,t){return e.left<i.left?{left:i.left,width:t.left+t.width-i.left}:e.top<i.top?{top:i.top,height:t.top+t.height-i.top}:e.left+e.width>i.left+i.width?{left:t.left,width:i.left+i.width-t.left}:e.top+e.height>i.top+i.height?{top:t.top,height:i.top+i.height-t.top}:null}var xv=RT;var Co=class extends dt{constructor(e){super(e),this.onRotate90Deg=()=>{let{angle90Deg:t}=this.state,r=t-90;this.setState({angle90Deg:r,angleGranular:0}),this.cropper.scale(1),this.cropper.rotateTo(r);let s=this.cropper.getCanvasData(),n=this.cropper.getContainerData(),o=Sv(n,s);this.cropper.setCanvasData(o),this.cropper.setCropBoxData(o)},this.onRotateGranular=t=>{let r=Number(t.target.value);this.setState({angleGranular:r});let{angle90Deg:s}=this.state,n=s+r;this.cropper.rotateTo(n);let o=this.cropper.getImageData(),a=Ev(o.naturalWidth,o.naturalHeight,r),l=this.cropper.getImageData().scaleX<0?-a:a;this.cropper.scale(l,a)},this.state={angle90Deg:0,angleGranular:0,prevCropboxData:null},this.storePrevCropboxData=this.storePrevCropboxData.bind(this),this.limitCropboxMovement=this.limitCropboxMovement.bind(this)}componentDidMount(){let{opts:e,storeCropperInstance:t}=this.props;this.cropper=new kv.default(this.imgElement,e.cropperOptions),this.imgElement.addEventListener("cropstart",this.storePrevCropboxData),this.imgElement.addEventListener("cropend",this.limitCropboxMovement),t(this.cropper)}componentWillUnmount(){this.cropper.destroy(),this.imgElement.removeEventListener("cropstart",this.storePrevCropboxData),this.imgElement.removeEventListener("cropend",this.limitCropboxMovement)}storePrevCropboxData(){this.setState({prevCropboxData:this.cropper.getCropBoxData()})}limitCropboxMovement(e){let t=this.cropper.getCanvasData(),r=this.cropper.getCropBoxData(),{prevCropboxData:s}=this.state;if(e.detail.action==="all"){let n=Tv(t,r,s);n&&this.cropper.setCropBoxData(n)}else{let n=xv(t,r,s);n&&this.cropper.setCropBoxData(n)}}renderGranularRotate(){let{i18n:e}=this.props,{angleGranular:t}=this.state;return u("label",{role:"tooltip","aria-label":`${t}\xBA`,"data-microtip-position":"top",className:"uppy-ImageCropper-rangeWrapper"},u("input",{className:"uppy-ImageCropper-range uppy-u-reset",type:"range",onInput:this.onRotateGranular,onChange:this.onRotateGranular,value:t,min:"-45",max:"45","aria-label":e("rotate")}))}renderRevert(){let{i18n:e,opts:t}=this.props;return u("button",{role:"button tooltip","data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("revert"),onClick:()=>{this.cropper.reset(),this.cropper.setAspectRatio(t.cropperOptions.initialAspectRatio),this.setState({angle90Deg:0,angleGranular:0})}},u("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},u("path",{d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M13 3c-4.97 0-9 4.03-9 9H1l3.89 3.89.07.14L9 12H6c0-3.87 3.13-7 7-7s7 3.13 7 7-3.13 7-7 7c-1.93 0-3.68-.79-4.94-2.06l-1.42 1.42C8.27 19.99 10.51 21 13 21c4.97 0 9-4.03 9-9s-4.03-9-9-9zm-1 5v5l4.28 2.54.72-1.21-3.5-2.08V8H12z"})))}renderRotate(){let{i18n:e}=this.props;return u("button",{role:"button tooltip","data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("rotate"),onClick:this.onRotate90Deg},u("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},u("path",{d:"M0 0h24v24H0V0zm0 0h24v24H0V0z",fill:"none"}),u("path",{d:"M14 10a2 2 0 012 2v7a2 2 0 01-2 2H6a2 2 0 01-2-2v-7a2 2 0 012-2h8zm0 1.75H6a.25.25 0 00-.243.193L5.75 12v7a.25.25 0 00.193.243L6 19.25h8a.25.25 0 00.243-.193L14.25 19v-7a.25.25 0 00-.193-.243L14 11.75zM12 .76V4c2.3 0 4.61.88 6.36 2.64a8.95 8.95 0 012.634 6.025L21 13a1 1 0 01-1.993.117L19 13h-.003a6.979 6.979 0 00-2.047-4.95 6.97 6.97 0 00-4.652-2.044L12 6v3.24L7.76 5 12 .76z"})))}renderFlip(){let{i18n:e}=this.props;return u("button",{role:"button tooltip","data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("flipHorizontal"),onClick:()=>this.cropper.scaleX(-this.cropper.getData().scaleX||-1)},u("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},u("path",{d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M15 21h2v-2h-2v2zm4-12h2V7h-2v2zM3 5v14c0 1.1.9 2 2 2h4v-2H5V5h4V3H5c-1.1 0-2 .9-2 2zm16-2v2h2c0-1.1-.9-2-2-2zm-8 20h2V1h-2v22zm8-6h2v-2h-2v2zM15 5h2V3h-2v2zm4 8h2v-2h-2v2zm0 8c1.1 0 2-.9 2-2h-2v2z"})))}renderZoomIn(){let{i18n:e}=this.props;return u("button",{role:"button tooltip","data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("zoomIn"),onClick:()=>this.cropper.zoom(.1)},u("svg",{"aria-hidden":"true",className:"uppy-c-icon",height:"24",viewBox:"0 0 24 24",width:"24"},u("path",{d:"M0 0h24v24H0V0z",fill:"none"}),u("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"}),u("path",{d:"M12 10h-2v2H9v-2H7V9h2V7h1v2h2v1z"})))}renderZoomOut(){let{i18n:e}=this.props;return u("button",{role:"button tooltip","data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("zoomOut"),onClick:()=>this.cropper.zoom(-.1)},u("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},u("path",{d:"M0 0h24v24H0V0z",fill:"none"}),u("path",{d:"M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14zM7 9h5v1H7z"})))}renderCropSquare(){let{i18n:e}=this.props;return u("button",{role:"button tooltip","data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("aspectRatioSquare"),onClick:()=>this.cropper.setAspectRatio(1)},u("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},u("path",{d:"M0 0h24v24H0z",fill:"none"}),u("path",{d:"M19 5v14H5V5h14m0-2H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2z"})))}renderCropWidescreen(){let{i18n:e}=this.props;return u("button",{role:"button tooltip","data-microtip-position":"top",type:"button",className:"uppy-u-reset uppy-c-btn","aria-label":e("aspectRatioLandscape"),onClick:()=>this.cropper.setAspectRatio(16/9)},u("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},u("path",{d:"M 19,4.9999992 V 17.000001 H 4.9999998 V 6.9999992 H 19 m 0,-2 H 4.9999998 c -1.0999999,0 -1.9999999,0.9000001 -1.9999999,2 V 17.000001 c 0,1.1 0.9,2 1.9999999,2 H 19 c 1.1,0 2,-0.9 2,-2 V 6.9999992 c 0,-1.0999999 -0.9,-2 -2,-2 z"}),u("path",{fill:"none",d:"M0 0h24v24H0z"})))}renderCropWidescreenVertical(){let{i18n:e}=this.props;return u("button",{role:"button tooltip","data-microtip-position":"top",type:"button","aria-label":e("aspectRatioPortrait"),className:"uppy-u-reset uppy-c-btn",onClick:()=>this.cropper.setAspectRatio(9/16)},u("svg",{"aria-hidden":"true",className:"uppy-c-icon",width:"24",height:"24",viewBox:"0 0 24 24"},u("path",{d:"M 19.000001,19 H 6.999999 V 5 h 10.000002 v 14 m 2,0 V 5 c 0,-1.0999999 -0.9,-1.9999999 -2,-1.9999999 H 6.999999 c -1.1,0 -2,0.9 -2,1.9999999 v 14 c 0,1.1 0.9,2 2,2 h 10.000002 c 1.1,0 2,-0.9 2,-2 z"}),u("path",{d:"M0 0h24v24H0z",fill:"none"})))}render(){let{currentImage:e,opts:t}=this.props,{actions:r}=t,s=URL.createObjectURL(e.data);return u("div",{className:"uppy-ImageCropper"},u("div",{className:"uppy-ImageCropper-container"},u("img",{className:"uppy-ImageCropper-image",alt:e.name,src:s,ref:n=>{this.imgElement=n}})),u("div",{className:"uppy-ImageCropper-controls"},r.revert&&this.renderRevert(),r.rotate&&this.renderRotate(),r.granularRotate&&this.renderGranularRotate(),r.flip&&this.renderFlip(),r.zoomIn&&this.renderZoomIn(),r.zoomOut&&this.renderZoomOut(),r.cropSquare&&this.renderCropSquare(),r.cropWidescreen&&this.renderCropWidescreen(),r.cropWidescreenVertical&&this.renderCropWidescreenVertical()))}};var Av={strings:{revert:"Reset",rotate:"Rotate 90\xB0",zoomIn:"Zoom in",zoomOut:"Zoom out",flipHorizontal:"Flip horizontally",aspectRatioSquare:"Crop square",aspectRatioLandscape:"Crop landscape (16:9)",aspectRatioPortrait:"Crop portrait (9:16)"}};var MT={version:"3.3.1"},Cv={viewMode:0,background:!1,autoCropArea:1,responsive:!0,minCropBoxWidth:70,minCropBoxHeight:70,croppedCanvasOptions:{},initialAspectRatio:0},Pv={revert:!0,rotate:!0,granularRotate:!0,flip:!0,zoomIn:!0,zoomOut:!0,cropSquare:!0,cropWidescreen:!0,cropWidescreenVertical:!0},IT={quality:.8,actions:Pv,cropperOptions:Cv},cs=class extends di{constructor(e,t){super(e,{...IT,...t,actions:{...Pv,...t?.actions},cropperOptions:{...Cv,...t?.cropperOptions}}),this.save=()=>{let r=o=>{var a;let{currentImage:l}=this.getPluginState();this.uppy.setFileState(l.id,{data:new File([o],(a=l.name)!=null?a:this.i18n("unnamed"),{type:o.type}),size:o.size,preview:void 0});let c=this.uppy.getFile(l.id);this.uppy.emit("thumbnail:request",c),this.setPluginState({currentImage:c}),this.uppy.emit("file-editor:complete",c)},{currentImage:s}=this.getPluginState(),n=this.cropper.getCroppedCanvas({});n.width%2!==0&&this.cropper.setData({width:n.width-1}),n.height%2!==0&&this.cropper.setData({height:n.height-1}),this.cropper.getCroppedCanvas(this.opts.cropperOptions.croppedCanvasOptions).toBlob(r,s.type,this.opts.quality)},this.storeCropperInstance=r=>{this.cropper=r},this.selectFile=r=>{this.uppy.emit("file-editor:start",r),this.setPluginState({currentImage:r})},this.id=this.opts.id||"ImageEditor",this.title="Image Editor",this.type="editor",this.defaultLocale=Av,this.i18nInit()}canEditFile(e){if(!e.type||e.isRemote)return!1;let t=e.type.split("/")[1];return!!/^(jpe?g|gif|png|bmp|webp)$/.test(t)}install(){this.setPluginState({currentImage:null});let{target:e}=this.opts;e&&this.mount(e,this)}uninstall(){let{currentImage:e}=this.getPluginState();if(e){let t=this.uppy.getFile(e.id);this.uppy.emit("file-editor:cancel",t)}this.unmount()}render(){let{currentImage:e}=this.getPluginState();return e===null||e.isRemote?null:u(Co,{currentImage:e,storeCropperInstance:this.storeCropperInstance,save:this.save,opts:this.opts,i18n:this.i18n})}};cs.VERSION=MT.version;function Yi(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var DT=0;function Fv(i){return"__private_"+DT+++"_"+i}var Tt=Fv("uppy"),Po=Fv("events"),Fo=class{constructor(e){Object.defineProperty(this,Tt,{writable:!0,value:void 0}),Object.defineProperty(this,Po,{writable:!0,value:[]}),Yi(this,Tt)[Tt]=e}on(e,t){return Yi(this,Po)[Po].push([e,t]),Yi(this,Tt)[Tt].on(e,t)}remove(){for(let[e,t]of Yi(this,Po)[Po].splice(0))Yi(this,Tt)[Tt].off(e,t)}onFilePause(e,t){this.on("upload-pause",(r,s)=>{e===r?.id&&t(s)})}onFileRemove(e,t){this.on("file-removed",r=>{e===r.id&&t(r.id)})}onPause(e,t){this.on("upload-pause",(r,s)=>{e===r?.id&&t(s)})}onRetry(e,t){this.on("upload-retry",r=>{e===r?.id&&t()})}onRetryAll(e,t){this.on("retry-all",()=>{Yi(this,Tt)[Tt].getFile(e)&&t()})}onPauseAll(e,t){this.on("pause-all",()=>{Yi(this,Tt)[Tt].getFile(e)&&t()})}onCancelAll(e,t){var r=this;this.on("cancel-all",function(){Yi(r,Tt)[Tt].getFile(e)&&t(...arguments)})}onResumeAll(e,t){this.on("resume-all",()=>{Yi(this,Tt)[Tt].getFile(e)&&t()})}};function ie(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var NT=0;function Ft(i){return"__private_"+NT+++"_"+i}function BT(i){return new Error("Cancelled",{cause:i})}function _v(i){if(i!=null){var e;let t=()=>this.abort(i.reason);i.addEventListener("abort",t,{once:!0});let r=()=>{i.removeEventListener("abort",t)};(e=this.then)==null||e.call(this,r,r)}return this}var Ut=Ft("activeRequests"),kt=Ft("queuedHandlers"),Bt=Ft("paused"),us=Ft("pauseTimer"),xt=Ft("downLimit"),hs=Ft("upperLimit"),Zi=Ft("rateLimitingTimer"),_o=Ft("call"),Qi=Ft("queueNext"),vd=Ft("next"),md=Ft("queue"),bd=Ft("dequeue"),gd=Ft("resume"),ds=Ft("increaseLimit"),El=class{constructor(e){Object.defineProperty(this,bd,{value:qT}),Object.defineProperty(this,md,{value:$T}),Object.defineProperty(this,vd,{value:HT}),Object.defineProperty(this,Qi,{value:zT}),Object.defineProperty(this,_o,{value:UT}),Object.defineProperty(this,Ut,{writable:!0,value:0}),Object.defineProperty(this,kt,{writable:!0,value:[]}),Object.defineProperty(this,Bt,{writable:!0,value:!1}),Object.defineProperty(this,us,{writable:!0,value:void 0}),Object.defineProperty(this,xt,{writable:!0,value:1}),Object.defineProperty(this,hs,{writable:!0,value:void 0}),Object.defineProperty(this,Zi,{writable:!0,value:void 0}),Object.defineProperty(this,gd,{writable:!0,value:()=>this.resume()}),Object.defineProperty(this,ds,{writable:!0,value:()=>{if(ie(this,Bt)[Bt]){ie(this,Zi)[Zi]=setTimeout(ie(this,ds)[ds],0);return}ie(this,xt)[xt]=this.limit,this.limit=Math.ceil((ie(this,hs)[hs]+ie(this,xt)[xt])/2);for(let t=ie(this,xt)[xt];t<=this.limit;t++)ie(this,Qi)[Qi]();ie(this,hs)[hs]-ie(this,xt)[xt]>3?ie(this,Zi)[Zi]=setTimeout(ie(this,ds)[ds],2e3):ie(this,xt)[xt]=Math.floor(ie(this,xt)[xt]/2)}}),typeof e!="number"||e===0?this.limit=1/0:this.limit=e}run(e,t){return!ie(this,Bt)[Bt]&&ie(this,Ut)[Ut]<this.limit?ie(this,_o)[_o](e):ie(this,md)[md](e,t)}wrapSyncFunction(e,t){var r=this;return function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];let a=r.run(()=>(e(...n),queueMicrotask(()=>a.done()),()=>{}),t);return{abortOn:_v,abort(){a.abort()}}}}wrapPromiseFunction(e,t){var r=this;return function(){for(var s=arguments.length,n=new Array(s),o=0;o<s;o++)n[o]=arguments[o];let a,l=new Promise((c,d)=>{a=r.run(()=>{let f,y;try{y=Promise.resolve(e(...n))}catch(v){y=Promise.reject(v)}return y.then(v=>{f?d(f):(a.done(),c(v))},v=>{f?d(f):(a.done(),d(v))}),v=>{f=BT(v)}},t)});return l.abort=c=>{a.abort(c)},l.abortOn=_v,l}}resume(){ie(this,Bt)[Bt]=!1,clearTimeout(ie(this,us)[us]);for(let e=0;e<this.limit;e++)ie(this,Qi)[Qi]()}pause(e){e===void 0&&(e=null),ie(this,Bt)[Bt]=!0,clearTimeout(ie(this,us)[us]),e!=null&&(ie(this,us)[us]=setTimeout(ie(this,gd)[gd],e))}rateLimit(e){clearTimeout(ie(this,Zi)[Zi]),this.pause(e),this.limit>1&&Number.isFinite(this.limit)&&(ie(this,hs)[hs]=this.limit-1,this.limit=ie(this,xt)[xt],ie(this,Zi)[Zi]=setTimeout(ie(this,ds)[ds],e))}get isPaused(){return ie(this,Bt)[Bt]}};function UT(i){ie(this,Ut)[Ut]+=1;let e=!1,t;try{t=i()}catch(r){throw ie(this,Ut)[Ut]-=1,r}return{abort:r=>{e||(e=!0,ie(this,Ut)[Ut]-=1,t?.(r),ie(this,Qi)[Qi]())},done:()=>{e||(e=!0,ie(this,Ut)[Ut]-=1,ie(this,Qi)[Qi]())}}}function zT(){queueMicrotask(()=>ie(this,vd)[vd]())}function HT(){if(ie(this,Bt)[Bt]||ie(this,Ut)[Ut]>=this.limit||ie(this,kt)[kt].length===0)return;let i=ie(this,kt)[kt].shift();if(i==null)throw new Error("Invariant violation: next is null");let e=ie(this,_o)[_o](i.fn);i.abort=e.abort,i.done=e.done}function $T(i,e){let t={fn:i,priority:e?.priority||0,abort:()=>{ie(this,bd)[bd](t)},done:()=>{throw new Error("Cannot mark a queued request as done: this indicates a bug")}},r=ie(this,kt)[kt].findIndex(s=>t.priority>s.priority);return r===-1?ie(this,kt)[kt].push(t):ie(this,kt)[kt].splice(r,0,t),t}function qT(i){let e=ie(this,kt)[kt].indexOf(i);e!==-1&&ie(this,kt)[kt].splice(e,1)}var Tl=Symbol("__queue");var yd=class extends Error{constructor(e,t){t===void 0&&(t=null),super("This looks like a network error, the endpoint might be blocked by an internet provider or a firewall."),this.cause=e,this.isNetworkError=!0,this.request=t}},Oo=yd;function VT(i){return i?i.readyState!==0&&i.readyState!==4||i.status===0:!1}var Ov=VT;function Yt(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var jT=0;function xl(i){return"__private_"+jT+++"_"+i}var Ji=xl("aliveTimer"),ps=xl("isDone"),Lo=xl("onTimedOut"),fs=xl("timeout"),wd=class{constructor(e,t){Object.defineProperty(this,Ji,{writable:!0,value:void 0}),Object.defineProperty(this,ps,{writable:!0,value:!1}),Object.defineProperty(this,Lo,{writable:!0,value:void 0}),Object.defineProperty(this,fs,{writable:!0,value:void 0}),Yt(this,fs)[fs]=e,Yt(this,Lo)[Lo]=()=>t(e)}progress(){Yt(this,ps)[ps]||Yt(this,fs)[fs]>0&&(clearTimeout(Yt(this,Ji)[Ji]),Yt(this,Ji)[Ji]=setTimeout(Yt(this,Lo)[Lo],Yt(this,fs)[fs]))}done(){Yt(this,ps)[ps]||(clearTimeout(Yt(this,Ji)[Ji]),Yt(this,Ji)[Ji]=void 0,Yt(this,ps)[ps]=!0)}},Lv=wd;var kl=()=>{};function Rv(i,e){e===void 0&&(e={});let{body:t=null,headers:r={},method:s="GET",onBeforeRequest:n=kl,onUploadProgress:o=kl,shouldRetry:a=()=>!0,onAfterResponse:l=kl,onTimeout:c=kl,responseType:d,retries:f=3,signal:y=null,timeout:v=3e4,withCredentials:x=!1}=e,C=D=>.3*2**(D-1)*1e3,F=new Lv(v,c);function L(D){return D===void 0&&(D=0),new Promise(async(V,M)=>{let $=new XMLHttpRequest,z=G=>{a($)&&D<f?setTimeout(()=>{L(D+1).then(V,M)},C(D)):(F.done(),M(G))};$.open(s,i,!0),$.withCredentials=x,d&&($.responseType=d),y?.addEventListener("abort",()=>{$.abort(),M(new DOMException("Aborted","AbortError"))}),$.onload=async()=>{try{await l($,D)}catch(G){G.request=$,z(G);return}$.status>=200&&$.status<300?(F.done(),V($)):a($)&&D<f?setTimeout(()=>{L(D+1).then(V,M)},C(D)):(F.done(),M(new Oo($.statusText,$)))},$.onerror=()=>z(new Oo($.statusText,$)),$.upload.onprogress=G=>{F.progress(),o(G)},r&&Object.keys(r).forEach(G=>{$.setRequestHeader(G,r[G])}),await n($,D),$.send(t)})}return L()}function Mv(i){let e=t=>"error"in t&&!!t.error;return i.filter(t=>!e(t))}function Iv(i){return i.filter(e=>{var t;return!((t=e.progress)!=null&&t.uploadStarted)||!e.isRestored})}function Al(i,e){return i===!0?Object.keys(e):Array.isArray(i)?i:[]}var Dv={strings:{uploadStalled:"Upload has not made any progress for %{seconds} seconds. You may want to retry it."}};function er(i,e){if(!{}.hasOwnProperty.call(i,e))throw new TypeError("attempted to use private field on non-instance");return i}var WT=0;function Qs(i){return"__private_"+WT+++"_"+i}var GT={version:"4.3.3"};function KT(i,e){let t=e;return t||(t=new Error("Upload error")),typeof t=="string"&&(t=new Error(t)),t instanceof Error||(t=Object.assign(new Error("Upload error"),{data:t})),Ov(i)?(t=new Oo(t,i),t):(t.request=i,t)}function Nv(i){return i.data.slice(0,i.data.size,i.meta.type)}var XT={formData:!0,fieldName:"file",method:"post",allowedMetaFields:!0,bundle:!1,headers:{},timeout:30*1e3,limit:5,withCredentials:!1,responseType:""},ms=Qs("getFetcher"),Td=Qs("uploadLocalFile"),Sd=Qs("uploadBundle"),xd=Qs("getCompanionClientArgs"),Ed=Qs("uploadFiles"),Ro=Qs("handleUpload"),Zs=class extends gr{constructor(e,t){if(super(e,{...XT,fieldName:t.bundle?"files[]":"file",...t}),Object.defineProperty(this,Ed,{value:JT}),Object.defineProperty(this,xd,{value:QT}),Object.defineProperty(this,Sd,{value:ZT}),Object.defineProperty(this,Td,{value:YT}),Object.defineProperty(this,ms,{writable:!0,value:void 0}),Object.defineProperty(this,Ro,{writable:!0,value:async r=>{if(r.length===0){this.uppy.log("[XHRUpload] No files to upload!");return}this.opts.limit===0&&!this.opts[Tl]&&this.uppy.log("[XHRUpload] When uploading multiple files at once, consider setting the `limit` option (to `10` for example), to limit the number of concurrent uploads, which helps prevent memory and network issues: https://uppy.io/docs/xhr-upload/#limit-0","warning"),this.uppy.log("[XHRUpload] Uploading...");let s=this.uppy.getFilesByIds(r),n=Mv(s),o=Iv(n);if(this.uppy.emit("upload-start",o),this.opts.bundle){if(n.some(l=>l.isRemote))throw new Error("Can\u2019t upload remote files when the `bundle: true` option is set");if(typeof this.opts.headers=="function")throw new TypeError("`headers` may not be a function when the `bundle: true` option is set");await er(this,Sd)[Sd](n)}else await er(this,Ed)[Ed](n)}}),this.type="uploader",this.id=this.opts.id||"XHRUpload",this.defaultLocale=Dv,this.i18nInit(),Tl in this.opts?this.requests=this.opts[Tl]:this.requests=new El(this.opts.limit),this.opts.bundle&&!this.opts.formData)throw new Error("`opts.formData` must be true when `opts.bundle` is enabled.");if(this.opts.bundle&&typeof this.opts.headers=="function")throw new Error("`opts.headers` can not be a function when the `bundle: true` option is set.");if(t?.allowedMetaFields===void 0&&"metaFields"in this.opts)throw new Error("The `metaFields` option has been renamed to `allowedMetaFields`.");this.uploaderEvents=Object.create(null),er(this,ms)[ms]=r=>async(s,n)=>{try{var o,a,l;let f=await Rv(s,{...n,onBeforeRequest:(x,C)=>{var F,L;return(F=(L=this.opts).onBeforeRequest)==null?void 0:F.call(L,x,C,r)},shouldRetry:this.opts.shouldRetry,onAfterResponse:this.opts.onAfterResponse,onTimeout:x=>{let C=Math.ceil(x/1e3),F=new Error(this.i18n("uploadStalled",{seconds:C}));this.uppy.emit("upload-stalled",F,r)},onUploadProgress:x=>{if(x.lengthComputable)for(let{id:F}of r){var C;let L=this.uppy.getFile(F);this.uppy.emit("upload-progress",L,{uploadStarted:(C=L.progress.uploadStarted)!=null?C:0,bytesUploaded:x.loaded/x.total*L.size,bytesTotal:L.size})}}}),y=await((o=(a=this.opts).getResponseData)==null?void 0:o.call(a,f));if(f.responseType==="json"){var c;(c=y)!=null||(y=f.response)}else try{var d;(d=y)!=null||(y=JSON.parse(f.responseText))}catch(x){throw new Error("@uppy/xhr-upload expects a JSON response (with a `url` property). To parse non-JSON responses, use `getResponseData` to turn your response into JSON.",{cause:x})}let v=typeof((l=y)==null?void 0:l.url)=="string"?y.url:void 0;for(let{id:x}of r)this.uppy.emit("upload-success",this.uppy.getFile(x),{status:f.status,body:y,uploadURL:v});return f}catch(f){if(f.name==="AbortError")return;let y=f.request;for(let v of r)this.uppy.emit("upload-error",this.uppy.getFile(v.id),KT(y,f),y);throw f}}}getOptions(e){let t=this.uppy.getState().xhrUpload,{headers:r}=this.opts,s={...this.opts,...t||{},...e.xhrUpload||{},headers:{}};return typeof r=="function"?s.headers=r(e):Object.assign(s.headers,this.opts.headers),t&&Object.assign(s.headers,t.headers),e.xhrUpload&&Object.assign(s.headers,e.xhrUpload.headers),s}addMetadata(e,t,r){Al(r.allowedMetaFields,t).forEach(n=>{let o=t[n];Array.isArray(o)?o.forEach(a=>e.append(n,a)):e.append(n,o)})}createFormDataUpload(e,t){let r=new FormData;this.addMetadata(r,e.meta,t);let s=Nv(e);return e.name?r.append(t.fieldName,s,e.meta.name):r.append(t.fieldName,s),r}createBundledUpload(e,t){let r=new FormData,{meta:s}=this.uppy.getState();return this.addMetadata(r,s,t),e.forEach(n=>{let o=this.getOptions(n),a=Nv(n);n.name?r.append(o.fieldName,a,n.name):r.append(o.fieldName,a)}),r}install(){if(this.opts.bundle){let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!1}})}this.uppy.addUploader(er(this,Ro)[Ro])}uninstall(){if(this.opts.bundle){let{capabilities:e}=this.uppy.getState();this.uppy.setState({capabilities:{...e,individualCancellation:!0}})}this.uppy.removeUploader(er(this,Ro)[Ro])}};async function YT(i){let e=new Fo(this.uppy),t=new AbortController,r=this.requests.wrapPromiseFunction(async()=>{let s=this.getOptions(i),n=er(this,ms)[ms]([i]),o=s.formData?this.createFormDataUpload(i,s):i.data;return n(s.endpoint,{...s,body:o,signal:t.signal})});e.onFileRemove(i.id,()=>t.abort()),e.onCancelAll(i.id,()=>{t.abort()});try{await r().abortOn(t.signal)}catch(s){if(s.message!=="Cancelled")throw s}finally{e.remove()}}async function ZT(i){let e=new AbortController,t=this.requests.wrapPromiseFunction(async()=>{var s;let n=(s=this.uppy.getState().xhrUpload)!=null?s:{},o=er(this,ms)[ms](i),a=this.createBundledUpload(i,{...this.opts,...n});return o(this.opts.endpoint,{...this.opts,body:a,signal:e.signal})});function r(){e.abort()}this.uppy.once("cancel-all",r);try{await t().abortOn(e.signal)}catch(s){if(s.message!=="Cancelled")throw s}finally{this.uppy.off("cancel-all",r)}}function QT(i){var e;let t=this.getOptions(i),r=Al(t.allowedMetaFields,i.meta);return{...(e=i.remote)==null?void 0:e.body,protocol:"multipart",endpoint:t.endpoint,size:i.data.size,fieldname:t.fieldName,metadata:Object.fromEntries(r.map(s=>[s,i.meta[s]])),httpMethod:t.method,useFormData:t.formData,headers:t.headers}}async function JT(i){await Promise.allSettled(i.map(e=>{if(e.isRemote){let t=()=>this.requests,r=new AbortController,s=o=>{o.id===e.id&&r.abort()};this.uppy.on("file-removed",s);let n=this.uppy.getRequestClientForFile(e).uploadRemoteFile(e,er(this,xd)[xd](e),{signal:r.signal,getQueue:t});return this.requests.wrapSyncFunction(()=>{this.uppy.off("file-removed",s)},{priority:-1})(),n}return er(this,Td)[Td](e)}))}Zs.VERSION=GT.version;var ut=class{static fromTemplate(i){if(Ls.isSupported)return Ls.sanitize(i,{USE_PROFILES:{html:!0,svg:!0},RETURN_DOM:!0}).children[0];{let e=new DOMParser().parseFromString(i,"text/html").body.children[0];return ex(e)}}};function ex(i){return tx(i),Bv(i),i}function tx(i){let e=i.querySelectorAll("script");for(let t of e)t.remove()}function ix(i,e){let t=e.replace(/\s+/g,"").toLowerCase();if(["src","href","xlink:href"].includes(i)&&(t.includes("javascript:")||t.includes("data:"))||i.startsWith("on"))return!0}function rx(i){let e=i.attributes;for(let{name:t,value:r}of e)ix(t,r)&&i.removeAttribute(t)}function Bv(i){let e=i.children;for(let t of e)rx(t),Bv(t)}var Cl=class extends J{static values={identifier:String,endpoint:String,maxFileSize:{type:Number,default:null},minFileSize:{type:Number,default:null},maxTotalSize:{type:Number,default:null},maxFileNum:{type:Number,default:null},minFileNum:{type:Number,default:null},allowedFileTypes:{type:Array,default:null},requiredMetaFields:{type:Array,default:[]}};static outlets=["attachment-preview","attachment-preview-container"];connect(){this.uppy||(this.uploadedFiles=[],this.element.style.display="none",this.configureUppy(),this.#u(),this.#r(),this.element.addEventListener("turbo:morph-element",i=>{i.target===this.element&&!this.morphing&&(this.morphing=!0,requestAnimationFrame(()=>{this.#e(),this.morphing=!1}))}))}disconnect(){this.#t()}#e(){this.element.isConnected&&(this.#t(),this.uploadedFiles=[],this.element.style.display="none",this.configureUppy(),this.#u(),this.#r())}#t(){this.uppy&&(this.uppy.destroy(),this.uppy=null),this.triggerContainer&&this.triggerContainer.parentNode&&(this.triggerContainer.parentNode.removeChild(this.triggerContainer),this.triggerContainer=null)}attachmentPreviewOutletConnected(i,e){this.#r()}attachmentPreviewOutletDisconnected(i,e){this.#r()}configureUppy(){this.uppy=new $a({restrictions:{maxFileSize:this.maxFileSizeValue,minFileSize:this.minFileSizeValue,maxTotalFileSize:this.maxTotalSizeValue,maxNumberOfFiles:this.maxFileNumValue,minNumberOfFiles:this.minFileNumValue,allowedFileTypes:this.allowedFileTypesValue,requiredMetaFields:this.requiredMetaFieldsValue}}).use(wr,{inline:!1,closeAfterFinish:!0}).use(cs,{target:wr}),this.#i(),this.#n()}#i(){this.uppy.use(Zs,{endpoint:this.endpointValue})}#n(){this.uppy.on("upload-success",this.#a.bind(this))}#o(){let i=document.documentElement.getAttribute("data-bs-theme")||"auto";this.#c.setOptions({theme:i});let e=null;for(;e=this.uploadedFiles.pop();)this.uppy.removeFile(e.id);this.#c.openModal()}#a(i,e){this.uploadedFiles.push(i),this.multiple||this.attachmentPreviewOutlets.forEach(s=>s.remove());let t=e.body.data,r=e.body.url;this.attachmentPreviewContainerOutlet.element.appendChild(this.#l(t,r))}#r(){if(!this.deleteAllTrigger)return;this.attachmentPreviewOutlets.length>1?(this.deleteAllTrigger.style.display="initial",this.deleteAllTrigger.textContent=`Delete ${this.attachmentPreviewOutlets.length}`):this.deleteAllTrigger.style.display="none"}#u(){this.triggerContainer=document.createElement("div"),this.triggerContainer.className="flex items-center gap-2",this.element.insertAdjacentElement("afterend",this.triggerContainer),this.#s(),this.uploadTrigger&&this.triggerContainer.append(this.uploadTrigger),this.deleteAllTrigger&&this.triggerContainer.append(this.deleteAllTrigger)}#s(){let i=this.multiple?"Choose files":"Choose file";this.uploadTrigger=ut.fromTemplate(`<button type="button" class="text-gray-900 bg-white border border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4 focus:ring-gray-200 font-medium rounded-lg text-sm px-5 py-2.5 dark:bg-gray-800 dark:text-white dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-600 dark:focus:ring-gray-700 inline-flex items-center">
|
|
98
98
|
<svg class="w-4 h-4 mr-2" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 16">
|
|
99
99
|
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 13h3a3 3 0 0 0 0-6h-.025A5.56 5.56 0 0 0 16 6.5 5.5 5.5 0 0 0 5.207 5.021C5.137 5.017 5.071 5 5 5a4 4 0 0 0 0 8h2.167M10 15V6m0 0L8 8m2-2 2 2"/>
|
|
100
100
|
</svg>
|
|
101
101
|
${i}
|
|
102
|
-
</button>`,!1),this.uploadTrigger.addEventListener("click",this.#o.bind(this))}#p(){this.deleteAllTrigger=
|
|
102
|
+
</button>`,!1),this.uploadTrigger.addEventListener("click",this.#o.bind(this))}#p(){this.deleteAllTrigger=ut.fromTemplate(`<button type="button" class="text-white bg-red-700 hover:bg-red-800 focus:ring-4 focus:ring-red-300 font-medium rounded-lg text-sm px-5 py-2.5 dark:bg-red-600 dark:hover:bg-red-700 focus:outline-none dark:focus:ring-red-800 inline-flex items-center">
|
|
103
103
|
Delete ${this.attachmentPreviewOutlets.length}
|
|
104
|
-
</button>`,!1),this.deleteAllTrigger.addEventListener("click",()=>{confirm("Are you sure?")&&this.attachmentPreviewContainerOutlet.clear()})}#l(i,e){let t=i.metadata.filename,r=t.substring(t.lastIndexOf(".")+1,t.length)||t,s=this.multiple?"multiple":"",n=i.metadata.mime_type,a=["image/jpeg","image/png","image/gif","image/webp","image/svg+xml","image/bmp","image/tiff"].includes(n.toLowerCase()),l=
|
|
104
|
+
</button>`,!1),this.deleteAllTrigger.addEventListener("click",()=>{confirm("Are you sure?")&&this.attachmentPreviewContainerOutlet.clear()})}#l(i,e){let t=i.metadata.filename,r=t.substring(t.lastIndexOf(".")+1,t.length)||t,s=this.multiple?"multiple":"",n=i.metadata.mime_type,a=["image/jpeg","image/png","image/gif","image/webp","image/svg+xml","image/bmp","image/tiff"].includes(n.toLowerCase()),l=ut.fromTemplate(this.#h(t,r,n,e,a)),c=ut.fromTemplate(`<input name="${this.element.name}" ${s} type="hidden" autocomplete="off" hidden />`);return c.value=JSON.stringify(i),l.appendChild(c),l}#h(i,e,t,r,s){return`
|
|
105
105
|
<div class="${this.identifierValue} attachment-preview group relative bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg shadow-sm hover:shadow-md transition-all duration-300"
|
|
106
106
|
data-controller="attachment-preview"
|
|
107
107
|
data-attachment-preview-mime-type-value="${t}"
|
|
@@ -123,7 +123,7 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&
|
|
|
123
123
|
Delete
|
|
124
124
|
</button>
|
|
125
125
|
</div>
|
|
126
|
-
`}get#c(){return this.uppy.getPlugin("Dashboard")}get multiple(){return this.maxFileNumValue!=1}};function
|
|
126
|
+
`}get#c(){return this.uppy.getPlugin("Dashboard")}get multiple(){return this.maxFileNumValue!=1}};function sx(){return ut.fromTemplate(`
|
|
127
127
|
<svg aria-hidden="true" focusable="false" width="25" height="25" viewBox="0 0 25 25">
|
|
128
128
|
<g fill="#686DE0" fillRule="evenodd">
|
|
129
129
|
<path d="M5 7v10h15V7H5zm0-1h15a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V7a1 1 0 0 1 1-1z" fillRule="nonzero" />
|
|
@@ -131,36 +131,36 @@ this.ifd0Offset: ${this.ifd0Offset}, file.byteLength: ${e.byteLength}`),e.tiff&&
|
|
|
131
131
|
<circle cx="7.5" cy="9.5" r="1.5" />
|
|
132
132
|
</g>
|
|
133
133
|
</svg>
|
|
134
|
-
`)}function
|
|
134
|
+
`)}function nx(){return ut.fromTemplate(`
|
|
135
135
|
<svg aria-hidden="true" focusable="false" className="uppy-c-icon" width="25" height="25" viewBox="0 0 25 25">
|
|
136
136
|
<path d="M9.5 18.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V7.25a.5.5 0 0 1 .379-.485l9-2.25A.5.5 0 0 1 18.5 5v11.64c0 1.14-1.145 2-2.5 2s-2.5-.86-2.5-2c0-1.14 1.145-2 2.5-2 .557 0 1.079.145 1.5.396V8.67l-8 2v7.97zm8-11v-2l-8 2v2l8-2zM7 19.64c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1zm9-2c.855 0 1.5-.484 1.5-1s-.645-1-1.5-1-1.5.484-1.5 1 .645 1 1.5 1z" fill="#049BCF" fillRule="nonzero" />
|
|
137
137
|
</svg>
|
|
138
|
-
`)}function
|
|
138
|
+
`)}function ox(){return ut.fromTemplate(`
|
|
139
139
|
<svg aria-hidden="true" focusable="false" className="uppy-c-icon" width="25" height="25" viewBox="0 0 25 25">
|
|
140
140
|
<path d="M16 11.834l4.486-2.691A1 1 0 0 1 22 10v6a1 1 0 0 1-1.514.857L16 14.167V17a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V9a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v2.834zM15 9H5v8h10V9zm1 4l5 3v-6l-5 3z" fill="#19AF67" fillRule="nonzero" />
|
|
141
141
|
</svg>
|
|
142
|
-
`)}function
|
|
142
|
+
`)}function ax(){return ut.fromTemplate(`
|
|
143
143
|
<svg aria-hidden="true" focusable="false" className="uppy-c-icon" width="25" height="25" viewBox="0 0 25 25">
|
|
144
144
|
<path d="M9.766 8.295c-.691-1.843-.539-3.401.747-3.726 1.643-.414 2.505.938 2.39 3.299-.039.79-.194 1.662-.537 3.148.324.49.66.967 1.055 1.51.17.231.382.488.629.757 1.866-.128 3.653.114 4.918.655 1.487.635 2.192 1.685 1.614 2.84-.566 1.133-1.839 1.084-3.416.249-1.141-.604-2.457-1.634-3.51-2.707a13.467 13.467 0 0 0-2.238.426c-1.392 4.051-4.534 6.453-5.707 4.572-.986-1.58 1.38-4.206 4.914-5.375.097-.322.185-.656.264-1.001.08-.353.306-1.31.407-1.737-.678-1.059-1.2-2.031-1.53-2.91zm2.098 4.87c-.033.144-.068.287-.104.427l.033-.01-.012.038a14.065 14.065 0 0 1 1.02-.197l-.032-.033.052-.004a7.902 7.902 0 0 1-.208-.271c-.197-.27-.38-.526-.555-.775l-.006.028-.002-.003c-.076.323-.148.632-.186.8zm5.77 2.978c1.143.605 1.832.632 2.054.187.26-.519-.087-1.034-1.113-1.473-.911-.39-2.175-.608-3.55-.608.845.766 1.787 1.459 2.609 1.894zM6.559 18.789c.14.223.693.16 1.425-.413.827-.648 1.61-1.747 2.208-3.206-2.563 1.064-4.102 2.867-3.633 3.62zm5.345-10.97c.088-1.793-.351-2.48-1.146-2.28-.473.119-.564 1.05-.056 2.405.213.566.52 1.188.908 1.859.18-.858.268-1.453.294-1.984z" fill="#E2514A" fillRule="nonzero" />
|
|
145
145
|
</svg>
|
|
146
|
-
`)}function
|
|
146
|
+
`)}function lx(){return ut.fromTemplate(`
|
|
147
147
|
<svg aria-hidden="true" focusable="false" width="25" height="25" viewBox="0 0 25 25">
|
|
148
148
|
<path d="M10.45 2.05h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V2.55a.5.5 0 0 1 .5-.5zm2.05 1.024h1.05a.5.5 0 0 1 .5.5V3.6a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5v-.001zM10.45 0h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5V.5a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 3.074h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-2.05 1.024h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm-2.05 1.025h1.05a.5.5 0 0 1 .5.5v.025a.5.5 0 0 1-.5.5h-1.05a.5.5 0 0 1-.5-.5v-.025a.5.5 0 0 1 .5-.5zm2.05 1.025h1.05a.5.5 0 0 1 .5.5v.024a.5.5 0 0 1-.5.5H12.5a.5.5 0 0 1-.5-.5v-.024a.5.5 0 0 1 .5-.5zm-1.656 3.074l-.82 5.946c.52.302 1.174.458 1.976.458.803 0 1.455-.156 1.975-.458l-.82-5.946h-2.311zm0-1.025h2.312c.512 0 .946.378 1.015.885l.82 5.946c.056.412-.142.817-.501 1.026-.686.398-1.515.597-2.49.597-.974 0-1.804-.199-2.49-.597a1.025 1.025 0 0 1-.5-1.026l.819-5.946c.07-.507.503-.885 1.015-.885zm.545 6.6a.5.5 0 0 1-.397-.561l.143-.999a.5.5 0 0 1 .495-.429h.74a.5.5 0 0 1 .495.43l.143.998a.5.5 0 0 1-.397.561c-.404.08-.819.08-1.222 0z" fill="#00C469" fillRule="nonzero" />
|
|
149
149
|
</svg>
|
|
150
|
-
`)}function
|
|
150
|
+
`)}function cx(){return ut.fromTemplate(`
|
|
151
151
|
<svg aria-hidden="true" focusable="false" className="uppy-c-icon" width="25" height="25" viewBox="0 0 25 25">
|
|
152
152
|
<g fill="#A7AFB7" fillRule="nonzero">
|
|
153
153
|
<path d="M5.5 22a.5.5 0 0 1-.5-.5v-18a.5.5 0 0 1 .5-.5h10.719a.5.5 0 0 1 .367.16l3.281 3.556a.5.5 0 0 1 .133.339V21.5a.5.5 0 0 1-.5.5h-14zm.5-1h13V7.25L16 4H6v17z" />
|
|
154
154
|
<path d="M15 4v3a1 1 0 0 0 1 1h3V7h-3V4h-1z" />
|
|
155
155
|
</g>
|
|
156
156
|
</svg>
|
|
157
|
-
`)}function
|
|
157
|
+
`)}function ux(){return ut.fromTemplate(`
|
|
158
158
|
<svg aria-hidden="true" focusable="false" className="uppy-c-icon" width="25" height="25" viewBox="0 0 25 25">
|
|
159
159
|
<path d="M4.5 7h13a.5.5 0 1 1 0 1h-13a.5.5 0 0 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h15a.5.5 0 1 1 0 1h-15a.5.5 0 1 1 0-1zm0 3h10a.5.5 0 1 1 0 1h-10a.5.5 0 1 1 0-1z" fill="#5A5E69" fillRule="nonzero" />
|
|
160
160
|
</svg>
|
|
161
|
-
`)}function
|
|
161
|
+
`)}function kd(i){let e={color:"#838999",icon:cx()};if(!i)return e;let t=i.split("/")[0],r=i.split("/")[1];return t==="text"?{color:"#5a5e69",icon:ux()}:t==="image"?{color:"#686de0",icon:sx()}:t==="audio"?{color:"#068dbb",icon:nx()}:t==="video"?{color:"#19af67",icon:ox()}:t==="application"&&r==="pdf"?{color:"#e25149",icon:ax()}:t==="application"&&["zip","x-7z-compressed","x-rar-compressed","x-tar","x-gzip","x-apple-diskimage"].indexOf(r)!==-1?{color:"#00C469",icon:lx()}:e}var Pl=class extends J{static targets=["thumbnail","thumbnailLink"];static values={mimeType:String,thumbnailUrl:String};connect(){this.hasThumbnailTarget&&(this.thumbnailUrlValue?this.useThumbnailPreview():this.useMimeIconPreview())}remove(){this.element.remove()}useThumbnailPreview(){let i=ut.fromTemplate(`
|
|
162
162
|
<img src="${this.thumbnailUrlValue}" class="w-full h-full object-cover" />
|
|
163
|
-
`);this.thumbnailLinkTarget.innerHTML=null,this.thumbnailLinkTarget.appendChild(i)}useMimeIconPreview(){let i=
|
|
163
|
+
`);this.thumbnailLinkTarget.innerHTML=null,this.thumbnailLinkTarget.appendChild(i)}useMimeIconPreview(){let i=kd(this.mimeTypeValue);i.icon.classList.add("w-3/5","h-4/5","rounded-lg","shadow-lg","bg-white","p-2"),this.thumbnailLinkTarget.classList.add("flex","items-center","justify-center"),this.thumbnailLinkTarget.style.backgroundColor=i.color,this.thumbnailLinkTarget.innerHTML=null,this.thumbnailLinkTarget.appendChild(i.icon)}};var Fl=class extends J{connect(){}append(i){this.element.appendChild(i)}clear(){this.element.innerHTML=null}};var _l=class extends J{};var Ol=class extends J{static targets=["password","checkbox"];connect(){this.checkboxTarget.checked=!1}toggle(){this.passwordTarget.type=="password"?this.passwordTargets.forEach(i=>i.type="text"):this.passwordTargets.forEach(i=>i.type="password")}};var Ll=class extends J{connect(){this.originalScrollPosition=window.scrollY,this.element.showModal(),this.element.addEventListener("close",this.handleClose.bind(this))}close(){this.element.close(),window.scrollTo(0,this.originalScrollPosition)}disconnect(){this.element.removeEventListener("close",this.handleClose)}handleClose(){window.scrollTo(0,this.originalScrollPosition)}};var Rl=class extends J{static targets=["container","pair","template","addButton","keyInput","valueInput"];static values={limit:Number};connect(){this.updateIndices(),this.updateAddButtonState()}addPair(i){if(i.preventDefault(),this.pairTargets.length>=this.limitValue)return;let t=this.templateTarget.content.cloneNode(!0),r=this.pairTargets.length;this.updatePairIndices(t,r),this.containerTarget.appendChild(t),this.updateAddButtonState();let s=this.containerTarget.lastElementChild.querySelector('[data-key-value-store-target="keyInput"]');s&&s.focus()}removePair(i){i.preventDefault();let e=i.target.closest('[data-key-value-store-target="pair"]');e&&(e.remove(),this.updateIndices(),this.updateAddButtonState())}updateIndices(){this.pairTargets.forEach((i,e)=>{let t=i.querySelector('[data-key-value-store-target="keyInput"]'),r=i.querySelector('[data-key-value-store-target="valueInput"]');t&&(t.name=t.name.replace(/\[\d+\]/,`[${e}]`)),r&&(r.name=r.name.replace(/\[\d+\]/,`[${e}]`))})}updatePairIndices(i,e){i.querySelectorAll("input").forEach(r=>{r.name&&(r.name=r.name.replace("__INDEX__",e))})}updateAddButtonState(){let i=this.addButtonTarget;this.pairTargets.length>=this.limitValue?(i.disabled=!0,i.classList.add("opacity-50","cursor-not-allowed")):(i.disabled=!1,i.classList.remove("opacity-50","cursor-not-allowed"))}toJSON(){let i={};return this.pairTargets.forEach(e=>{let t=e.querySelector('[data-key-value-store-target="keyInput"]'),r=e.querySelector('[data-key-value-store-target="valueInput"]');t&&r&&t.value.trim()&&(i[t.value.trim()]=r.value)}),JSON.stringify(i)}toObject(){let i={};return this.pairTargets.forEach(e=>{let t=e.querySelector('[data-key-value-store-target="keyInput"]'),r=e.querySelector('[data-key-value-store-target="valueInput"]');t&&r&&t.value.trim()&&(i[t.value.trim()]=r.value)}),i}};var Ml=class extends J{static targets=["checkbox","checkboxAll","toolbar","selectedCount","actionButton","selectionCell"];static values={hasActions:{type:Boolean,default:!1}};connect(){this.hasActionsValue&&this.enableSelection()}enableSelection(){this.selectionCellTargets.forEach(i=>i.classList.remove("hidden"))}toggle(){this.updateUI()}toggleAll(i){let e=i.target.checked;this.checkboxTargets.forEach(t=>t.checked=e),this.updateUI()}updateUI(){let i=this.checked,e=this.checkboxTargets.length;this.hasCheckboxAllTarget&&(this.checkboxAllTarget.checked=i.length===e&&e>0,this.checkboxAllTarget.indeterminate=i.length>0&&i.length<e),this.hasToolbarTarget&&this.toolbarTarget.classList.toggle("hidden",i.length===0),this.hasSelectedCountTarget&&(this.selectedCountTarget.textContent=i.length),this.updateActionButtons()}updateActionButtons(){let i=this.checked,t=i.map(s=>s.value).map(s=>`ids[]=${encodeURIComponent(s)}`).join("&"),r=this.computeAllowedActions(i);this.actionButtonTargets.forEach(s=>{let n=s.dataset.bulkActionUrl,o=s.dataset.bulkActionName;n&&(s.href=t?`${n}?${t}`:n),s.style.display=r.has(o)?"":"none"})}computeAllowedActions(i){if(i.length===0)return new Set;let e=new Set(this.getAllowedActionsForCheckbox(i[0]));for(let t=1;t<i.length;t++){let r=this.getAllowedActionsForCheckbox(i[t]);e=new Set([...e].filter(s=>r.includes(s)))}return e}getAllowedActionsForCheckbox(i){let e=i.dataset.allowedActions;return e?e.split(",").filter(t=>t):[]}get checked(){return this.checkboxTargets.filter(i=>i.checked)}get unchecked(){return this.checkboxTargets.filter(i=>!i.checked)}};var Il=class extends J{clear(){this.element.querySelectorAll("input, select, textarea").forEach(e=>{e.type==="checkbox"||e.type==="radio"?e.checked=!1:e.tagName==="SELECT"?e.selectedIndex=0:e.type==="hidden"?e.dataset.controller==="flatpickr"&&(e.value=""):e.value=""}),this.element.querySelectorAll('[data-controller="flatpickr"]').forEach(e=>{let t=this.application.getControllerForElementAndIdentifier(e,"flatpickr");t?.picker&&t.picker.clear()});let i=this.element.closest("form");i&&i.requestSubmit()}};var Dl=class extends J{static values={maxHeight:{type:Number,default:0}};connect(){this.resize(),this.element.addEventListener("input",this.resize),window.addEventListener("resize",this.resize)}disconnect(){this.element.removeEventListener("input",this.resize),window.removeEventListener("resize",this.resize)}resize=()=>{let i=this.element,e=this.#e();i.style.height="auto",i.style.overflow="hidden";let t=i.scrollHeight;e>0&&t>e?(i.style.height=`${e}px`,i.style.overflow="auto"):i.style.height=`${t}px`};#e(){if(this.maxHeightValue>0)return this.maxHeightValue;let e=window.getComputedStyle(this.element).maxHeight;if(e&&e!=="none"){let t=parseFloat(e);if(!isNaN(t)&&t>0)return t}return 300}};function Ad(i){i.register("password-visibility",Ol),i.register("sidebar",_l),i.register("resource-header",oa),i.register("nested-resource-form-fields",aa),i.register("form",la),i.register("resource-drop-down",ma),i.register("resource-collapse",ga),i.register("resource-dismiss",va),i.register("frame-navigator",ba),i.register("color-mode",ya),i.register("easymde",Ca),i.register("slim-select",Pa),i.register("flatpickr",Fa),i.register("intl-tel-input",_a),i.register("select-navigator",Oa),i.register("resource-tab-list",La),i.register("attachment-input",Cl),i.register("attachment-preview",Pl),i.register("attachment-preview-container",Fl),i.register("remote-modal",Ll),i.register("key-value-store",Rl),i.register("bulk-actions",Ml),i.register("filter-panel",Il),i.register("textarea-autogrow",Dl)}Turbo.StreamActions.redirect=function(){Turbo.cache.clear();let i=this.getAttribute("url");Turbo.visit(i)};var hx=sa.start();Ad(hx);})();
|
|
164
164
|
/*!
|
|
165
165
|
* Sanitize an HTML node
|
|
166
166
|
*/
|
|
@@ -186,12 +186,12 @@ cropperjs/dist/cropper.js:
|
|
|
186
186
|
|
|
187
187
|
@hotwired/turbo/dist/turbo.es2017-esm.js:
|
|
188
188
|
(*!
|
|
189
|
-
Turbo 8.0.
|
|
190
|
-
Copyright ©
|
|
189
|
+
Turbo 8.0.12
|
|
190
|
+
Copyright © 2024 37signals LLC
|
|
191
191
|
*)
|
|
192
192
|
|
|
193
193
|
dompurify/dist/purify.es.mjs:
|
|
194
|
-
(*! @license DOMPurify 3.2.
|
|
194
|
+
(*! @license DOMPurify 3.2.4 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.4/LICENSE *)
|
|
195
195
|
|
|
196
196
|
@uppy/utils/lib/Translator.js:
|
|
197
197
|
(**
|