UNPKG

dgz-ui-shared

Version:

Custom ui library using React.js, Shadcn/ui, TailwindCSS, Typescript, dgz-ui library

11 lines 140 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const $e=require("../../MyInput-yriz78UG.cjs"),js=require("../../MySelect-DtdzVlXP.cjs"),S=require("../../jsx-runtime-DUiatUiq.cjs"),Oe=require("../../lodash-C5w_OPmE.cjs"),M=require("../../radio-group-CqPTye2U-CXc2TUFE.cjs"),Re=require("../../popover-HTqpqYpJ-Bx11rWT_.cjs"),Zt=require("../../button-Bp2lHjov-D9UnCnYX.cjs"),me=require("../../DateRangePicker-oodxLnRY.cjs"),we=require("../../utils-B6fNqzRf-BNysSCt9.cjs"),Hs=require("../../createLucideIcon-BnAj0RnC.cjs"),Tt=require("react");/** * @license lucide-react v0.511.0 - ISC * * This source code is licensed under the ISC license. * See the LICENSE file in the root directory of this source tree. */const qs=[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]],Qt=Hs.createLucideIcon("calendar",qs),Ys=({control:e,name:t,label:n,helperText:s,required:r,rules:a,format:i=me.no,placeholder:l,floatingError:o,register:d,...c})=>{const E=n&&S.jsxRuntimeExports.jsxs(M.am,{className:"text-body-xs-medium my-3",children:[n," ",r&&S.jsxRuntimeExports.jsx("span",{className:"text-red-600",children:"*"})]});return S.jsxRuntimeExports.jsx(S.jsxRuntimeExports.Fragment,{children:t&&e?S.jsxRuntimeExports.jsx(M.Nh,{control:e,name:t,rules:a,render:({field:m,formState:p})=>S.jsxRuntimeExports.jsxs(M.im,{className:"relative flex flex-col",children:[E,S.jsxRuntimeExports.jsxs(Re.Oe,{children:[S.jsxRuntimeExports.jsx(Re._e,{asChild:!0,children:S.jsxRuntimeExports.jsx(M.lm,{children:S.jsxRuntimeExports.jsxs(Zt.u,{variant:"secondary",className:we.mo("text-secondary !text-body-sm-regular border-alpha-strong focus:ring-item-primary mb-0 bg-transparent pl-3 text-left font-normal hover:bg-transparent",Oe.lodashExports.get(p.errors,`${t}`)&&"focus:ring-item-destructive border-item-destructive bg-item-destructive-focus text-item-destructive hover:bg-item-destructive-focus dark:bg-transparent",m.value&&"text-primary"),children:[m.value?me.dayjs(m.value).format(i):l||"Pick a date",S.jsxRuntimeExports.jsx(Qt,{className:"ml-auto h-4 w-4"})]})})}),S.jsxRuntimeExports.jsx(Re.ue,{className:"w-auto p-0",align:"start",children:S.jsxRuntimeExports.jsx(me.Ls,{...c,mode:"single",selected:m.value,onSelect:m.onChange})})]}),S.jsxRuntimeExports.jsx(M.cm,{children:s}),S.jsxRuntimeExports.jsx("div",{className:"relative",children:S.jsxRuntimeExports.jsx(M.dm,{})})]})}):S.jsxRuntimeExports.jsxs("div",{className:"relative flex flex-col",children:[E,S.jsxRuntimeExports.jsxs(Re.Oe,{children:[S.jsxRuntimeExports.jsx(Re._e,{asChild:!0,children:S.jsxRuntimeExports.jsxs(Zt.u,{variant:"secondary",className:we.mo("text-secondary !text-body-sm-regular border-border-alpha-strong focus:ring-item-primary mb-0 bg-transparent pl-3 text-left font-normal hover:bg-transparent",c.selected&&"text-primary"),children:[c.selected?me.dayjs(c.selected).format(i):l||"Pick a date",S.jsxRuntimeExports.jsx(Qt,{className:"ml-auto h-4 w-4"})]})}),S.jsxRuntimeExports.jsx(Re.ue,{className:"w-auto p-0",align:"start",children:S.jsxRuntimeExports.jsx(me.Ls,{...c,mode:"single"})})]})]})})},Ws=({control:e,name:t,label:n,helperText:s,required:r,rules:a,format:i=me.no,placeholder:l,...o})=>{const d=n&&S.jsxRuntimeExports.jsxs(M.am,{className:"text-body-xs-medium my-3",children:[n," ",r&&S.jsxRuntimeExports.jsx("span",{className:"text-red-600",children:"*"})]});return S.jsxRuntimeExports.jsx(S.jsxRuntimeExports.Fragment,{children:t&&e&&S.jsxRuntimeExports.jsx(M.Nh,{control:e,name:t,rules:a,render:({field:c,formState:E})=>S.jsxRuntimeExports.jsxs(M.im,{className:"relative flex flex-col",children:[d,S.jsxRuntimeExports.jsx(M.lm,{children:S.jsxRuntimeExports.jsx(me.DateRangePicker,{...o,error:`${Oe.lodashExports.get(E.errors,t,"")}`,selected:c.value,onRangeSelected:c.onChange,format:i,placeholder:l})}),S.jsxRuntimeExports.jsx(M.cm,{children:s}),S.jsxRuntimeExports.jsx("div",{className:"relative",children:S.jsxRuntimeExports.jsx(M.dm,{})})]})})})},$s=({control:e,name:t,label:n,rules:s,helperText:r,...a})=>t&&e?S.jsxRuntimeExports.jsx(M.Nh,{control:e,name:t,rules:s,render:({field:i})=>S.jsxRuntimeExports.jsxs(M.im,{className:"flex flex-row items-start space-x-3",children:[S.jsxRuntimeExports.jsx(M.lm,{children:S.jsxRuntimeExports.jsx(M.Tl,{checked:i.value,onCheckedChange:i.onChange,...a})}),S.jsxRuntimeExports.jsxs("div",{className:"space-y-1 leading-none",children:[n&&S.jsxRuntimeExports.jsx(M.am,{children:n}),S.jsxRuntimeExports.jsx(M.cm,{children:r})]})]})}):S.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-start space-y-0 space-x-3 rounded-md border p-4",children:[S.jsxRuntimeExports.jsx(M.Tl,{...a}),S.jsxRuntimeExports.jsx("div",{className:"space-y-1 leading-none",children:n&&S.jsxRuntimeExports.jsx(M.am,{children:n})})]}),ks=({control:e,name:t,label:n,helperText:s,rules:r,...a})=>t&&e?S.jsxRuntimeExports.jsx(M.Nh,{control:e,name:t,rules:r,render:({field:i})=>S.jsxRuntimeExports.jsxs(M.im,{className:"flex items-center gap-2",children:[S.jsxRuntimeExports.jsx(M.lm,{children:S.jsxRuntimeExports.jsx(M.Em,{className:"m-0",checked:i.value,onCheckedChange:i.onChange,...a})}),S.jsxRuntimeExports.jsxs("div",{className:"mb-1 space-y-1 leading-none",children:[n&&S.jsxRuntimeExports.jsx(M.am,{className:we.mo("text-primary",a.disabled&&"opacity-40"),children:n}),S.jsxRuntimeExports.jsx(M.cm,{children:s})]})]})}):S.jsxRuntimeExports.jsxs("div",{className:"flex flex-row items-center space-x-3",children:[S.jsxRuntimeExports.jsx(M.Em,{...a}),S.jsxRuntimeExports.jsx("div",{className:"mb-1 space-y-1 leading-none",children:n&&S.jsxRuntimeExports.jsx(M.am,{className:we.mo("text-primary",a.disabled&&"opacity-40"),children:n})})]});/*! * FilePond 4.32.8 * Licensed under MIT, https://opensource.org/licenses/MIT/ * Please visit https://pqina.nl/filepond/ for details. */const zs=e=>e instanceof HTMLElement,Xs=(e,t=[],n=[])=>{const s={...e},r=[],a=[],i=()=>({...s}),l=()=>{const u=[...r];return r.length=0,u},o=()=>{const u=[...a];a.length=0,u.forEach(({type:I,data:T})=>{d(I,T)})},d=(u,I,T)=>{if(T&&!document.hidden){a.push({type:u,data:I});return}p[u]&&p[u](I),r.push({type:u,data:I})},c=(u,...I)=>m[u]?m[u](...I):null,E={getState:i,processActionQueue:l,processDispatchQueue:o,dispatch:d,query:c};let m={};t.forEach(u=>{m={...u(s),...m}});let p={};return n.forEach(u=>{p={...u(d,c,s),...p}}),E},Zs=(e,t,n)=>{if(typeof n=="function"){e[t]=n;return}Object.defineProperty(e,t,{...n})},q=(e,t)=>{for(const n in e)e.hasOwnProperty(n)&&t(n,e[n])},he=e=>{const t={};return q(e,n=>{Zs(t,n,e[n])}),t},k=(e,t,n=null)=>{if(n===null)return e.getAttribute(t)||e.hasAttribute(t);e.setAttribute(t,n)},Qs="http://www.w3.org/2000/svg",Ks=["svg","path"],Kt=e=>Ks.includes(e),at=(e,t,n={})=>{typeof t=="object"&&(n=t,t=null);const s=Kt(e)?document.createElementNS(Qs,e):document.createElement(e);return t&&(Kt(e)?k(s,"class",t):s.className=t),q(n,(r,a)=>{k(s,r,a)}),s},Js=e=>(t,n)=>{typeof n<"u"&&e.children[n]?e.insertBefore(t,e.children[n]):e.appendChild(t)},er=(e,t)=>(n,s)=>(typeof s<"u"?t.splice(s,0,n):t.push(n),n),tr=(e,t)=>n=>(t.splice(t.indexOf(n),1),n.element.parentNode&&e.removeChild(n.element),n),nr=typeof window<"u"&&typeof window.document<"u",Xn=()=>nr,sr=Xn()?at("svg"):{},rr="children"in sr?e=>e.children.length:e=>e.childNodes.length,Zn=(e,t,n,s)=>{const r=n[0]||e.left,a=n[1]||e.top,i=r+e.width,l=a+e.height*(s[1]||1),o={element:{...e},inner:{left:e.left,top:e.top,right:e.right,bottom:e.bottom},outer:{left:r,top:a,right:i,bottom:l}};return t.filter(d=>!d.isRectIgnored()).map(d=>d.rect).forEach(d=>{Jt(o.inner,{...d.inner}),Jt(o.outer,{...d.outer})}),en(o.inner),o.outer.bottom+=o.element.marginBottom,o.outer.right+=o.element.marginRight,en(o.outer),o},Jt=(e,t)=>{t.top+=e.top,t.right+=e.left,t.bottom+=e.top,t.left+=e.left,t.bottom>e.bottom&&(e.bottom=t.bottom),t.right>e.right&&(e.right=t.right)},en=e=>{e.width=e.right-e.left,e.height=e.bottom-e.top},Se=e=>typeof e=="number",ir=(e,t,n,s=.001)=>Math.abs(e-t)<s&&Math.abs(n)<s,ar=({stiffness:e=.5,damping:t=.75,mass:n=10}={})=>{let s=null,r=null,a=0,i=!1;const d=he({interpolate:(c,E)=>{if(i)return;if(!(Se(s)&&Se(r))){i=!0,a=0;return}const m=-(r-s)*e;a+=m/n,r+=a,a*=t,ir(r,s,a)||E?(r=s,a=0,i=!0,d.onupdate(r),d.oncomplete(r)):d.onupdate(r)},target:{set:c=>{if(Se(c)&&!Se(r)&&(r=c),s===null&&(s=c,r=c),s=c,r===s||typeof s>"u"){i=!0,a=0,d.onupdate(r),d.oncomplete(r);return}i=!1},get:()=>s},resting:{get:()=>i},onupdate:c=>{},oncomplete:c=>{}});return d},or=e=>e<.5?2*e*e:-1+(4-2*e)*e,lr=({duration:e=500,easing:t=or,delay:n=0}={})=>{let s=null,r,a,i=!0,l=!1,o=null;const c=he({interpolate:(E,m)=>{i||o===null||(s===null&&(s=E),!(E-s<n)&&(r=E-s-n,r>=e||m?(r=1,a=l?0:1,c.onupdate(a*o),c.oncomplete(a*o),i=!0):(a=r/e,c.onupdate((r>=0?t(l?1-a:a):0)*o))))},target:{get:()=>l?0:o,set:E=>{if(o===null){o=E,c.onupdate(E),c.oncomplete(E);return}E<o?(o=1,l=!0):(l=!1,o=E),i=!1,s=null}},resting:{get:()=>i},onupdate:E=>{},oncomplete:E=>{}});return c},tn={spring:ar,tween:lr},cr=(e,t,n)=>{const s=e[t]&&typeof e[t][n]=="object"?e[t][n]:e[t]||e,r=typeof s=="string"?s:s.type,a=typeof s=="object"?{...s}:{};return tn[r]?tn[r](a):null},Ft=(e,t,n,s=!1)=>{t=Array.isArray(t)?t:[t],t.forEach(r=>{e.forEach(a=>{let i=a,l=()=>n[a],o=d=>n[a]=d;typeof a=="object"&&(i=a.key,l=a.getter||l,o=a.setter||o),!(r[i]&&!s)&&(r[i]={get:l,set:o})})})},dr=({mixinConfig:e,viewProps:t,viewInternalAPI:n,viewExternalAPI:s})=>{const r={...t},a=[];return q(e,(i,l)=>{const o=cr(l);if(!o)return;o.onupdate=c=>{t[i]=c},o.target=r[i],Ft([{key:i,setter:c=>{o.target!==c&&(o.target=c)},getter:()=>t[i]}],[n,s],t,!0),a.push(o)}),{write:i=>{let l=document.hidden,o=!0;return a.forEach(d=>{d.resting||(o=!1),d.interpolate(i,l)}),o},destroy:()=>{}}},ur=e=>(t,n)=>{e.addEventListener(t,n)},Er=e=>(t,n)=>{e.removeEventListener(t,n)},fr=({mixinConfig:e,viewProps:t,viewInternalAPI:n,viewExternalAPI:s,viewState:r,view:a})=>{const i=[],l=ur(a.element),o=Er(a.element);return s.on=(d,c)=>{i.push({type:d,fn:c}),l(d,c)},s.off=(d,c)=>{i.splice(i.findIndex(E=>E.type===d&&E.fn===c),1),o(d,c)},{write:()=>!0,destroy:()=>{i.forEach(d=>{o(d.type,d.fn)})}}},pr=({mixinConfig:e,viewProps:t,viewExternalAPI:n})=>{Ft(e,n,t)},Q=e=>e!=null,mr={opacity:1,scaleX:1,scaleY:1,translateX:0,translateY:0,rotateX:0,rotateY:0,rotateZ:0,originX:0,originY:0},Ir=({mixinConfig:e,viewProps:t,viewInternalAPI:n,viewExternalAPI:s,view:r})=>{const a={...t},i={};Ft(e,[n,s],t);const l=()=>[t.translateX||0,t.translateY||0],o=()=>[t.scaleX||0,t.scaleY||0],d=()=>r.rect?Zn(r.rect,r.childViews,l(),o()):null;return n.rect={get:d},s.rect={get:d},e.forEach(c=>{t[c]=typeof a[c]>"u"?mr[c]:a[c]}),{write:()=>{if(_r(i,t))return Tr(r.element,t),Object.assign(i,{...t}),!0},destroy:()=>{}}},_r=(e,t)=>{if(Object.keys(e).length!==Object.keys(t).length)return!0;for(const n in t)if(t[n]!==e[n])return!0;return!1},Tr=(e,{opacity:t,perspective:n,translateX:s,translateY:r,scaleX:a,scaleY:i,rotateX:l,rotateY:o,rotateZ:d,originX:c,originY:E,width:m,height:p})=>{let u="",I="";(Q(c)||Q(E))&&(I+=`transform-origin: ${c||0}px ${E||0}px;`),Q(n)&&(u+=`perspective(${n}px) `),(Q(s)||Q(r))&&(u+=`translate3d(${s||0}px, ${r||0}px, 0) `),(Q(a)||Q(i))&&(u+=`scale3d(${Q(a)?a:1}, ${Q(i)?i:1}, 1) `),Q(d)&&(u+=`rotateZ(${d}rad) `),Q(l)&&(u+=`rotateX(${l}rad) `),Q(o)&&(u+=`rotateY(${o}rad) `),u.length&&(I+=`transform:${u};`),Q(t)&&(I+=`opacity:${t};`,t===0&&(I+="visibility:hidden;"),t<1&&(I+="pointer-events:none;")),Q(p)&&(I+=`height:${p}px;`),Q(m)&&(I+=`width:${m}px;`);const T=e.elementCurrentStyle||"";(I.length!==T.length||I!==T)&&(e.style.cssText=I,e.elementCurrentStyle=I)},hr={styles:Ir,listeners:fr,animations:dr,apis:pr},nn=(e={},t={},n={})=>(t.layoutCalculated||(e.paddingTop=parseInt(n.paddingTop,10)||0,e.marginTop=parseInt(n.marginTop,10)||0,e.marginRight=parseInt(n.marginRight,10)||0,e.marginBottom=parseInt(n.marginBottom,10)||0,e.marginLeft=parseInt(n.marginLeft,10)||0,t.layoutCalculated=!0),e.left=t.offsetLeft||0,e.top=t.offsetTop||0,e.width=t.offsetWidth||0,e.height=t.offsetHeight||0,e.right=e.left+e.width,e.bottom=e.top+e.height,e.scrollTop=t.scrollTop,e.hidden=t.offsetParent===null,e),$=({tag:e="div",name:t=null,attributes:n={},read:s=()=>{},write:r=()=>{},create:a=()=>{},destroy:i=()=>{},filterFrameActionsForChild:l=(p,u)=>u,didCreateView:o=()=>{},didWriteView:d=()=>{},ignoreRect:c=!1,ignoreRectUpdate:E=!1,mixins:m=[]}={})=>(p,u={})=>{const I=at(e,`filepond--${t}`,n),T=window.getComputedStyle(I,null),g=nn();let f=null,_=!1;const R=[],y=[],P={},N={},D=[r],w=[s],G=[i],x=()=>I,C=()=>R.concat(),j=()=>P,L=V=>(Z,pe)=>Z(V,pe),U=()=>f||(f=Zn(g,R,[0,0],[1,1]),f),O=()=>T,A=()=>{f=null,R.forEach(pe=>pe._read()),!(E&&g.width&&g.height)&&nn(g,I,T);const Z={root:le,props:u,rect:g};w.forEach(pe=>pe(Z))},b=(V,Z,pe)=>{let be=Z.length===0;return D.forEach(ee=>{ee({props:u,root:le,actions:Z,timestamp:V,shouldOptimize:pe})===!1&&(be=!1)}),y.forEach(ee=>{ee.write(V)===!1&&(be=!1)}),R.filter(ee=>!!ee.element.parentNode).forEach(ee=>{ee._write(V,l(ee,Z),pe)||(be=!1)}),R.forEach((ee,Xe)=>{ee.element.parentNode||(le.appendChild(ee.element,Xe),ee._read(),ee._write(V,l(ee,Z),pe),be=!1)}),_=be,d({props:u,root:le,actions:Z,timestamp:V}),be},v=()=>{y.forEach(V=>V.destroy()),G.forEach(V=>{V({root:le,props:u})}),R.forEach(V=>V._destroy())},H={element:{get:x},style:{get:O},childViews:{get:C}},B={...H,rect:{get:U},ref:{get:j},is:V=>t===V,appendChild:Js(I),createChildView:L(p),linkView:V=>(R.push(V),V),unlinkView:V=>{R.splice(R.indexOf(V),1)},appendChildView:er(I,R),removeChildView:tr(I,R),registerWriter:V=>D.push(V),registerReader:V=>w.push(V),registerDestroyer:V=>G.push(V),invalidateLayout:()=>I.layoutCalculated=!1,dispatch:p.dispatch,query:p.query},ge={element:{get:x},childViews:{get:C},rect:{get:U},resting:{get:()=>_},isRectIgnored:()=>c,_read:A,_write:b,_destroy:v},Ve={...H,rect:{get:()=>g}};Object.keys(m).sort((V,Z)=>V==="styles"?1:Z==="styles"?-1:0).forEach(V=>{const Z=hr[V]({mixinConfig:m[V],viewProps:u,viewState:N,viewInternalAPI:B,viewExternalAPI:ge,view:he(Ve)});Z&&y.push(Z)});const le=he(B);a({root:le,props:u});const _t=rr(I);return R.forEach((V,Z)=>{le.appendChild(V.element,_t+Z)}),o(le),he(ge)},gr=(e,t,n=60)=>{const s="__framePainter";if(window[s]){window[s].readers.push(e),window[s].writers.push(t);return}window[s]={readers:[e],writers:[t]};const r=window[s],a=1e3/n;let i=null,l=null,o=null,d=null;const c=()=>{document.hidden?(o=()=>window.setTimeout(()=>E(performance.now()),a),d=()=>window.clearTimeout(l)):(o=()=>window.requestAnimationFrame(E),d=()=>window.cancelAnimationFrame(l))};document.addEventListener("visibilitychange",()=>{d&&d(),c(),E(performance.now())});const E=m=>{l=o(E),i||(i=m);const p=m-i;p<=a||(i=m-p%a,r.readers.forEach(u=>u()),r.writers.forEach(u=>u(m)))};return c(),E(performance.now()),{pause:()=>{d(l)}}},J=(e,t)=>({root:n,props:s,actions:r=[],timestamp:a,shouldOptimize:i})=>{r.filter(l=>e[l.type]).forEach(l=>e[l.type]({root:n,props:s,action:l.data,timestamp:a,shouldOptimize:i})),t&&t({root:n,props:s,actions:r,timestamp:a,shouldOptimize:i})},sn=(e,t)=>t.parentNode.insertBefore(e,t),rn=(e,t)=>t.parentNode.insertBefore(e,t.nextSibling),dt=e=>Array.isArray(e),Ie=e=>e==null,Rr=e=>e.trim(),ut=e=>""+e,Or=(e,t=",")=>Ie(e)?[]:dt(e)?e:ut(e).split(t).map(Rr).filter(n=>n.length),Qn=e=>typeof e=="boolean",Kn=e=>Qn(e)?e:e==="true",K=e=>typeof e=="string",Jn=e=>Se(e)?e:K(e)?ut(e).replace(/[a-z]+/gi,""):0,rt=e=>parseInt(Jn(e),10),an=e=>parseFloat(Jn(e)),Ue=e=>Se(e)&&isFinite(e)&&Math.floor(e)===e,on=(e,t=1e3)=>{if(Ue(e))return e;let n=ut(e).trim();return/MB$/i.test(n)?(n=n.replace(/MB$i/,"").trim(),rt(n)*t*t):/KB/i.test(n)?(n=n.replace(/KB$i/,"").trim(),rt(n)*t):rt(n)},ye=e=>typeof e=="function",Sr=e=>{let t=self,n=e.split("."),s=null;for(;s=n.shift();)if(t=t[s],!t)return null;return t},ln={process:"POST",patch:"PATCH",revert:"DELETE",fetch:"GET",restore:"GET",load:"GET"},yr=e=>{const t={};return t.url=K(e)?e:e.url||"",t.timeout=e.timeout?parseInt(e.timeout,10):0,t.headers=e.headers?e.headers:{},q(ln,n=>{t[n]=Dr(n,e[n],ln[n],t.timeout,t.headers)}),t.process=e.process||K(e)||e.url?t.process:null,t.remove=e.remove||null,delete t.headers,t},Dr=(e,t,n,s,r)=>{if(t===null)return null;if(typeof t=="function")return t;const a={url:n==="GET"||n==="PATCH"?`?${e}=`:"",method:n,headers:r,withCredentials:!1,timeout:s,onload:null,ondata:null,onerror:null};if(K(t))return a.url=t,a;if(Object.assign(a,t),K(a.headers)){const i=a.headers.split(/:(.+)/);a.headers={header:i[0],value:i[1]}}return a.withCredentials=Kn(a.withCredentials),a},Ar=e=>yr(e),Mr=e=>e===null,X=e=>typeof e=="object"&&e!==null,Lr=e=>X(e)&&K(e.url)&&X(e.process)&&X(e.revert)&&X(e.restore)&&X(e.fetch),Mt=e=>dt(e)?"array":Mr(e)?"null":Ue(e)?"int":/^[0-9]+ ?(?:GB|MB|KB)$/gi.test(e)?"bytes":Lr(e)?"api":typeof e,Pr=e=>e.replace(/{\s*'/g,'{"').replace(/'\s*}/g,'"}').replace(/'\s*:/g,'":').replace(/:\s*'/g,':"').replace(/,\s*'/g,',"').replace(/'\s*,/g,'",'),wr={array:Or,boolean:Kn,int:e=>Mt(e)==="bytes"?on(e):rt(e),number:an,float:an,bytes:on,string:e=>ye(e)?e:ut(e),function:e=>Sr(e),serverapi:Ar,object:e=>{try{return JSON.parse(Pr(e))}catch{return null}}},xr=(e,t)=>wr[t](e),es=(e,t,n)=>{if(e===t)return e;let s=Mt(e);if(s!==n){const r=xr(e,n);if(s=Mt(r),r===null)throw`Trying to assign value with incorrect type to "${option}", allowed type: "${n}"`;e=r}return e},Cr=(e,t)=>{let n=e;return{enumerable:!0,get:()=>n,set:s=>{n=es(s,e,t)}}},br=e=>{const t={};return q(e,n=>{const s=e[n];t[n]=Cr(s[0],s[1])}),he(t)},Nr=e=>({items:[],listUpdateTimeout:null,itemUpdateTimeout:null,processingQueue:[],options:br(e)}),Et=(e,t="-")=>e.split(/(?=[A-Z])/).map(n=>n.toLowerCase()).join(t),vr=(e,t)=>{const n={};return q(t,s=>{n[s]={get:()=>e.getState().options[s],set:r=>{e.dispatch(`SET_${Et(s,"_").toUpperCase()}`,{value:r})}}}),n},Gr=e=>(t,n,s)=>{const r={};return q(e,a=>{const i=Et(a,"_").toUpperCase();r[`SET_${i}`]=l=>{try{s.options[a]=l.value}catch{}t(`DID_SET_${i}`,{value:s.options[a]})}}),r},Fr=e=>t=>{const n={};return q(e,s=>{n[`GET_${Et(s,"_").toUpperCase()}`]=r=>t.options[s]}),n},oe={API:1,DROP:2,BROWSE:3,PASTE:4,NONE:5},Bt=()=>Math.random().toString(36).substring(2,11),Ut=(e,t)=>e.splice(t,1),Br=(e,t)=>{t?e():document.hidden?Promise.resolve(1).then(e):setTimeout(e,0)},ft=()=>{const e=[],t=(s,r)=>{Ut(e,e.findIndex(a=>a.event===s&&(a.cb===r||!r)))},n=(s,r,a)=>{e.filter(i=>i.event===s).map(i=>i.cb).forEach(i=>Br(()=>i(...r),a))};return{fireSync:(s,...r)=>{n(s,r,!0)},fire:(s,...r)=>{n(s,r,!1)},on:(s,r)=>{e.push({event:s,cb:r})},onOnce:(s,r)=>{e.push({event:s,cb:(...a)=>{t(s,r),r(...a)}})},off:t}},ts=(e,t,n)=>{Object.getOwnPropertyNames(e).filter(s=>!n.includes(s)).forEach(s=>Object.defineProperty(t,s,Object.getOwnPropertyDescriptor(e,s)))},Ur=["fire","process","revert","load","on","off","onOnce","retryLoad","extend","archive","archived","release","released","requestProcessing","freeze"],te=e=>{const t={};return ts(e,t,Ur),t},Vr=e=>{e.forEach((t,n)=>{t.released&&Ut(e,n)})},F={INIT:1,IDLE:2,PROCESSING_QUEUED:9,PROCESSING:3,PROCESSING_COMPLETE:5,PROCESSING_ERROR:6,PROCESSING_REVERT_ERROR:10,LOADING:7,LOAD_ERROR:8},z={INPUT:1,LIMBO:2,LOCAL:3},ns=e=>/[^0-9]+/.exec(e),ss=()=>ns(1.1.toLocaleString())[0],jr=()=>{const e=ss(),t=1e3.toLocaleString();return t!=="1000"?ns(t)[0]:e==="."?",":"."},h={BOOLEAN:"boolean",INT:"int",NUMBER:"number",STRING:"string",ARRAY:"array",OBJECT:"object",FUNCTION:"function",ACTION:"action",SERVER_API:"serverapi",REGEX:"regex"},Vt=[],ce=(e,t,n)=>new Promise((s,r)=>{const a=Vt.filter(l=>l.key===e).map(l=>l.cb);if(a.length===0){s(t);return}const i=a.shift();a.reduce((l,o)=>l.then(d=>o(d,n)),i(t,n)).then(l=>s(l)).catch(l=>r(l))}),xe=(e,t,n)=>Vt.filter(s=>s.key===e).map(s=>s.cb(t,n)),Hr=(e,t)=>Vt.push({key:e,cb:t}),qr=e=>Object.assign(Ne,e),ot=()=>({...Ne}),Yr=e=>{q(e,(t,n)=>{Ne[t]&&(Ne[t][0]=es(n,Ne[t][0],Ne[t][1]))})},Ne={id:[null,h.STRING],name:["filepond",h.STRING],disabled:[!1,h.BOOLEAN],className:[null,h.STRING],required:[!1,h.BOOLEAN],captureMethod:[null,h.STRING],allowSyncAcceptAttribute:[!0,h.BOOLEAN],allowDrop:[!0,h.BOOLEAN],allowBrowse:[!0,h.BOOLEAN],allowPaste:[!0,h.BOOLEAN],allowMultiple:[!1,h.BOOLEAN],allowReplace:[!0,h.BOOLEAN],allowRevert:[!0,h.BOOLEAN],allowRemove:[!0,h.BOOLEAN],allowProcess:[!0,h.BOOLEAN],allowReorder:[!1,h.BOOLEAN],allowDirectoriesOnly:[!1,h.BOOLEAN],storeAsFile:[!1,h.BOOLEAN],forceRevert:[!1,h.BOOLEAN],maxFiles:[null,h.INT],checkValidity:[!1,h.BOOLEAN],itemInsertLocationFreedom:[!0,h.BOOLEAN],itemInsertLocation:["before",h.STRING],itemInsertInterval:[75,h.INT],dropOnPage:[!1,h.BOOLEAN],dropOnElement:[!0,h.BOOLEAN],dropValidation:[!1,h.BOOLEAN],ignoredFiles:[[".ds_store","thumbs.db","desktop.ini"],h.ARRAY],instantUpload:[!0,h.BOOLEAN],maxParallelUploads:[2,h.INT],allowMinimumUploadDuration:[!0,h.BOOLEAN],chunkUploads:[!1,h.BOOLEAN],chunkForce:[!1,h.BOOLEAN],chunkSize:[5e6,h.INT],chunkRetryDelays:[[500,1e3,3e3],h.ARRAY],server:[null,h.SERVER_API],fileSizeBase:[1e3,h.INT],labelFileSizeBytes:["bytes",h.STRING],labelFileSizeKilobytes:["KB",h.STRING],labelFileSizeMegabytes:["MB",h.STRING],labelFileSizeGigabytes:["GB",h.STRING],labelDecimalSeparator:[ss(),h.STRING],labelThousandsSeparator:[jr(),h.STRING],labelIdle:['Drag & Drop your files or <span class="filepond--label-action">Browse</span>',h.STRING],labelInvalidField:["Field contains invalid files",h.STRING],labelFileWaitingForSize:["Waiting for size",h.STRING],labelFileSizeNotAvailable:["Size not available",h.STRING],labelFileCountSingular:["file in list",h.STRING],labelFileCountPlural:["files in list",h.STRING],labelFileLoading:["Loading",h.STRING],labelFileAdded:["Added",h.STRING],labelFileLoadError:["Error during load",h.STRING],labelFileRemoved:["Removed",h.STRING],labelFileRemoveError:["Error during remove",h.STRING],labelFileProcessing:["Uploading",h.STRING],labelFileProcessingComplete:["Upload complete",h.STRING],labelFileProcessingAborted:["Upload cancelled",h.STRING],labelFileProcessingError:["Error during upload",h.STRING],labelFileProcessingRevertError:["Error during revert",h.STRING],labelTapToCancel:["tap to cancel",h.STRING],labelTapToRetry:["tap to retry",h.STRING],labelTapToUndo:["tap to undo",h.STRING],labelButtonRemoveItem:["Remove",h.STRING],labelButtonAbortItemLoad:["Abort",h.STRING],labelButtonRetryItemLoad:["Retry",h.STRING],labelButtonAbortItemProcessing:["Cancel",h.STRING],labelButtonUndoItemProcessing:["Undo",h.STRING],labelButtonRetryItemProcessing:["Retry",h.STRING],labelButtonProcessItem:["Upload",h.STRING],iconRemove:['<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M11.586 13l-2.293 2.293a1 1 0 0 0 1.414 1.414L13 14.414l2.293 2.293a1 1 0 0 0 1.414-1.414L14.414 13l2.293-2.293a1 1 0 0 0-1.414-1.414L13 11.586l-2.293-2.293a1 1 0 0 0-1.414 1.414L11.586 13z" fill="currentColor" fill-rule="nonzero"/></svg>',h.STRING],iconProcess:['<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M14 10.414v3.585a1 1 0 0 1-2 0v-3.585l-1.293 1.293a1 1 0 0 1-1.414-1.415l3-3a1 1 0 0 1 1.414 0l3 3a1 1 0 0 1-1.414 1.415L14 10.414zM9 18a1 1 0 0 1 0-2h8a1 1 0 0 1 0 2H9z" fill="currentColor" fill-rule="evenodd"/></svg>',h.STRING],iconRetry:['<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M10.81 9.185l-.038.02A4.997 4.997 0 0 0 8 13.683a5 5 0 0 0 5 5 5 5 0 0 0 5-5 1 1 0 0 1 2 0A7 7 0 1 1 9.722 7.496l-.842-.21a.999.999 0 1 1 .484-1.94l3.23.806c.535.133.86.675.73 1.21l-.804 3.233a.997.997 0 0 1-1.21.73.997.997 0 0 1-.73-1.21l.23-.928v-.002z" fill="currentColor" fill-rule="nonzero"/></svg>',h.STRING],iconUndo:['<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M9.185 10.81l.02-.038A4.997 4.997 0 0 1 13.683 8a5 5 0 0 1 5 5 5 5 0 0 1-5 5 1 1 0 0 0 0 2A7 7 0 1 0 7.496 9.722l-.21-.842a.999.999 0 1 0-1.94.484l.806 3.23c.133.535.675.86 1.21.73l3.233-.803a.997.997 0 0 0 .73-1.21.997.997 0 0 0-1.21-.73l-.928.23-.002-.001z" fill="currentColor" fill-rule="nonzero"/></svg>',h.STRING],iconDone:['<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M18.293 9.293a1 1 0 0 1 1.414 1.414l-7.002 7a1 1 0 0 1-1.414 0l-3.998-4a1 1 0 1 1 1.414-1.414L12 15.586l6.294-6.293z" fill="currentColor" fill-rule="nonzero"/></svg>',h.STRING],oninit:[null,h.FUNCTION],onwarning:[null,h.FUNCTION],onerror:[null,h.FUNCTION],onactivatefile:[null,h.FUNCTION],oninitfile:[null,h.FUNCTION],onaddfilestart:[null,h.FUNCTION],onaddfileprogress:[null,h.FUNCTION],onaddfile:[null,h.FUNCTION],onprocessfilestart:[null,h.FUNCTION],onprocessfileprogress:[null,h.FUNCTION],onprocessfileabort:[null,h.FUNCTION],onprocessfilerevert:[null,h.FUNCTION],onprocessfile:[null,h.FUNCTION],onprocessfiles:[null,h.FUNCTION],onremovefile:[null,h.FUNCTION],onpreparefile:[null,h.FUNCTION],onupdatefiles:[null,h.FUNCTION],onreorderfiles:[null,h.FUNCTION],beforeDropFile:[null,h.FUNCTION],beforeAddFile:[null,h.FUNCTION],beforeRemoveFile:[null,h.FUNCTION],beforePrepareFile:[null,h.FUNCTION],stylePanelLayout:[null,h.STRING],stylePanelAspectRatio:[null,h.STRING],styleItemPanelAspectRatio:[null,h.STRING],styleButtonRemoveItemPosition:["left",h.STRING],styleButtonProcessItemPosition:["right",h.STRING],styleLoadIndicatorPosition:["right",h.STRING],styleProgressIndicatorPosition:["right",h.STRING],styleButtonRemoveItemAlign:[!1,h.BOOLEAN],files:[[],h.ARRAY],credits:[["https://pqina.nl/","Powered by PQINA"],h.ARRAY]},De=(e,t)=>Ie(t)?e[0]||null:Ue(t)?e[t]||null:(typeof t=="object"&&(t=t.id),e.find(n=>n.id===t)||null),rs=e=>{if(Ie(e))return e;if(/:/.test(e)){const t=e.split(":");return t[1]/t[0]}return parseFloat(e)},de=e=>e.filter(t=>!t.archived),Wr={EMPTY:0,IDLE:1,ERROR:2,BUSY:3,READY:4};let Ze=null;const $r=()=>{if(Ze===null)try{const e=new DataTransfer;e.items.add(new File(["hello world"],"This_Works.txt"));const t=document.createElement("input");t.setAttribute("type","file"),t.files=e.files,Ze=t.files.length===1}catch{Ze=!1}return Ze},kr=[F.LOAD_ERROR,F.PROCESSING_ERROR,F.PROCESSING_REVERT_ERROR],zr=[F.LOADING,F.PROCESSING,F.PROCESSING_QUEUED,F.INIT],Xr=[F.PROCESSING_COMPLETE],Zr=e=>kr.includes(e.status),Qr=e=>zr.includes(e.status),Kr=e=>Xr.includes(e.status),cn=e=>X(e.options.server)&&(X(e.options.server.process)||ye(e.options.server.process)),Jr=e=>({GET_STATUS:()=>{const t=de(e.items),{EMPTY:n,ERROR:s,BUSY:r,IDLE:a,READY:i}=Wr;return t.length===0?n:t.some(Zr)?s:t.some(Qr)?r:t.some(Kr)?i:a},GET_ITEM:t=>De(e.items,t),GET_ACTIVE_ITEM:t=>De(de(e.items),t),GET_ACTIVE_ITEMS:()=>de(e.items),GET_ITEMS:()=>e.items,GET_ITEM_NAME:t=>{const n=De(e.items,t);return n?n.filename:null},GET_ITEM_SIZE:t=>{const n=De(e.items,t);return n?n.fileSize:null},GET_STYLES:()=>Object.keys(e.options).filter(t=>/^style/.test(t)).map(t=>({name:t,value:e.options[t]})),GET_PANEL_ASPECT_RATIO:()=>/circle/.test(e.options.stylePanelLayout)?1:rs(e.options.stylePanelAspectRatio),GET_ITEM_PANEL_ASPECT_RATIO:()=>e.options.styleItemPanelAspectRatio,GET_ITEMS_BY_STATUS:t=>de(e.items).filter(n=>n.status===t),GET_TOTAL_ITEMS:()=>de(e.items).length,SHOULD_UPDATE_FILE_INPUT:()=>e.options.storeAsFile&&$r()&&!cn(e),IS_ASYNC:()=>cn(e),GET_FILE_SIZE_LABELS:t=>({labelBytes:t("GET_LABEL_FILE_SIZE_BYTES")||void 0,labelKilobytes:t("GET_LABEL_FILE_SIZE_KILOBYTES")||void 0,labelMegabytes:t("GET_LABEL_FILE_SIZE_MEGABYTES")||void 0,labelGigabytes:t("GET_LABEL_FILE_SIZE_GIGABYTES")||void 0})}),ei=e=>{const t=de(e.items).length;if(!e.options.allowMultiple)return t===0;const n=e.options.maxFiles;return n===null||t<n},is=(e,t,n)=>Math.max(Math.min(n,e),t),ti=(e,t,n)=>e.splice(t,0,n),ni=(e,t,n)=>Ie(t)?null:typeof n>"u"?(e.push(t),t):(n=is(n,0,e.length),ti(e,n,t),t),Lt=e=>/^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i.test(e),ze=e=>`${e}`.split("/").pop().split("?").shift(),pt=e=>e.split(".").pop(),si=e=>{if(typeof e!="string")return"";const t=e.split("/").pop();return/svg/.test(t)?"svg":/zip|compressed/.test(t)?"zip":/plain/.test(t)?"txt":/msword/.test(t)?"doc":/[a-z]+/.test(t)?t==="jpeg"?"jpg":t:""},je=(e,t="")=>(t+e).slice(-t.length),as=(e=new Date)=>`${e.getFullYear()}-${je(e.getMonth()+1,"00")}-${je(e.getDate(),"00")}_${je(e.getHours(),"00")}-${je(e.getMinutes(),"00")}-${je(e.getSeconds(),"00")}`,Be=(e,t,n=null,s=null)=>{const r=typeof n=="string"?e.slice(0,e.size,n):e.slice(0,e.size,e.type);return r.lastModifiedDate=new Date,e._relativePath&&(r._relativePath=e._relativePath),K(t)||(t=as()),t&&s===null&&pt(t)?r.name=t:(s=s||si(r.type),r.name=t+(s?"."+s:"")),r},ri=()=>window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,os=(e,t)=>{const n=ri();if(n){const s=new n;return s.append(e),s.getBlob(t)}return new Blob([e],{type:t})},ii=(e,t)=>{const n=new ArrayBuffer(e.length),s=new Uint8Array(n);for(let r=0;r<e.length;r++)s[r]=e.charCodeAt(r);return os(n,t)},ls=e=>(/^data:(.+);/.exec(e)||[])[1]||null,ai=e=>e.split(",")[1].replace(/\s/g,""),oi=e=>atob(ai(e)),li=e=>{const t=ls(e),n=oi(e);return ii(n,t)},ci=(e,t,n)=>Be(li(e),t,null,n),di=e=>{if(!/^content-disposition:/i.test(e))return null;const t=e.split(/filename=|filename\*=.+''/).splice(1).map(n=>n.trim().replace(/^["']|[;"']{0,2}$/g,"")).filter(n=>n.length);return t.length?decodeURI(t[t.length-1]):null},ui=e=>{if(/content-length:/i.test(e)){const t=e.match(/[0-9]+/)[0];return t?parseInt(t,10):null}return null},Ei=e=>/x-content-transfer-id:/i.test(e)&&(e.split(":")[1]||"").trim()||null,jt=e=>{const t={source:null,name:null,size:null},n=e.split(` `);for(let s of n){const r=di(s);if(r){t.name=r;continue}const a=ui(s);if(a){t.size=a;continue}const i=Ei(s);if(i){t.source=i;continue}}return t},fi=e=>{const t={source:null,complete:!1,progress:0,size:null,timestamp:null,duration:0,request:null},n=()=>t.progress,s=()=>{t.request&&t.request.abort&&t.request.abort()},r=()=>{const l=t.source;i.fire("init",l),l instanceof File?i.fire("load",l):l instanceof Blob?i.fire("load",Be(l,l.name)):Lt(l)?i.fire("load",ci(l)):a(l)},a=l=>{if(!e){i.fire("error",{type:"error",body:"Can't load URL",code:400});return}t.timestamp=Date.now(),t.request=e(l,o=>{t.duration=Date.now()-t.timestamp,t.complete=!0,o instanceof Blob&&(o=Be(o,o.name||ze(l))),i.fire("load",o instanceof Blob?o:o?o.body:null)},o=>{i.fire("error",typeof o=="string"?{type:"error",code:0,body:o}:o)},(o,d,c)=>{if(c&&(t.size=c),t.duration=Date.now()-t.timestamp,!o){t.progress=null;return}t.progress=d/c,i.fire("progress",t.progress)},()=>{i.fire("abort")},o=>{const d=jt(typeof o=="string"?o:o.headers);i.fire("meta",{size:t.size||d.size,filename:d.name,source:d.source})})},i={...ft(),setSource:l=>t.source=l,getProgress:n,abort:s,load:r};return i},dn=e=>/GET|HEAD/.test(e),Ae=(e,t,n)=>{const s={onheaders:()=>{},onprogress:()=>{},onload:()=>{},ontimeout:()=>{},onerror:()=>{},onabort:()=>{},abort:()=>{r=!0,i.abort()}};let r=!1,a=!1;n={method:"POST",headers:{},withCredentials:!1,...n},t=encodeURI(t),dn(n.method)&&e&&(t=`${t}${encodeURIComponent(typeof e=="string"?e:JSON.stringify(e))}`);const i=new XMLHttpRequest,l=dn(n.method)?i:i.upload;return l.onprogress=o=>{r||s.onprogress(o.lengthComputable,o.loaded,o.total)},i.onreadystatechange=()=>{i.readyState<2||i.readyState===4&&i.status===0||a||(a=!0,s.onheaders(i))},i.onload=()=>{i.status>=200&&i.status<300?s.onload(i):s.onerror(i)},i.onerror=()=>s.onerror(i),i.onabort=()=>{r=!0,s.onabort()},i.ontimeout=()=>s.ontimeout(i),i.open(n.method,t,!0),Ue(n.timeout)&&(i.timeout=n.timeout),Object.keys(n.headers).forEach(o=>{const d=unescape(encodeURIComponent(n.headers[o]));i.setRequestHeader(o,d)}),n.responseType&&(i.responseType=n.responseType),n.withCredentials&&(i.withCredentials=!0),i.send(e),s},Y=(e,t,n,s)=>({type:e,code:t,body:n,headers:s}),Me=e=>t=>{e(Y("error",0,"Timeout",t.getAllResponseHeaders()))},un=e=>/\?/.test(e),Ye=(...e)=>{let t="";return e.forEach(n=>{t+=un(t)&&un(n)?n.replace(/\?/,"&"):n}),t},ht=(e="",t)=>{if(typeof t=="function")return t;if(!t||!K(t.url))return null;const n=t.onload||(r=>r),s=t.onerror||(r=>null);return(r,a,i,l,o,d)=>{const c=Ae(r,Ye(e,t.url),{...t,responseType:"blob"});return c.onload=E=>{const m=E.getAllResponseHeaders(),p=jt(m).name||ze(r);a(Y("load",E.status,t.method==="HEAD"?null:Be(n(E.response),p),m))},c.onerror=E=>{i(Y("error",E.status,s(E.response)||E.statusText,E.getAllResponseHeaders()))},c.onheaders=E=>{d(Y("headers",E.status,null,E.getAllResponseHeaders()))},c.ontimeout=Me(i),c.onprogress=l,c.onabort=o,c}},re={QUEUED:0,COMPLETE:1,PROCESSING:2,ERROR:3,WAITING:4},pi=(e,t,n,s,r,a,i,l,o,d,c)=>{const E=[],{chunkTransferId:m,chunkServer:p,chunkSize:u,chunkRetryDelays:I}=c,T={serverId:m,aborted:!1},g=t.ondata||(L=>L),f=t.onload||((L,U)=>U==="HEAD"?L.getResponseHeader("Upload-Offset"):L.response),_=t.onerror||(L=>null),R=L=>{const U=new FormData;X(r)&&U.append(n,JSON.stringify(r));const O=typeof t.headers=="function"?t.headers(s,r):{...t.headers,"Upload-Length":s.size},A={...t,headers:O},b=Ae(g(U),Ye(e,t.url),A);b.onload=v=>L(f(v,A.method)),b.onerror=v=>i(Y("error",v.status,_(v.response)||v.statusText,v.getAllResponseHeaders())),b.ontimeout=Me(i)},y=L=>{const U=Ye(e,p.url,T.serverId),A={headers:typeof t.headers=="function"?t.headers(T.serverId):{...t.headers},method:"HEAD"},b=Ae(null,U,A);b.onload=v=>L(f(v,A.method)),b.onerror=v=>i(Y("error",v.status,_(v.response)||v.statusText,v.getAllResponseHeaders())),b.ontimeout=Me(i)},P=Math.floor(s.size/u);for(let L=0;L<=P;L++){const U=L*u,O=s.slice(U,U+u,"application/offset+octet-stream");E[L]={index:L,size:O.size,offset:U,data:O,file:s,progress:0,retries:[...I],status:re.QUEUED,error:null,request:null,timeout:null}}const N=()=>a(T.serverId),D=L=>L.status===re.QUEUED||L.status===re.ERROR,w=L=>{if(T.aborted)return;if(L=L||E.find(D),!L){E.every(B=>B.status===re.COMPLETE)&&N();return}L.status=re.PROCESSING,L.progress=null;const U=p.ondata||(B=>B),O=p.onerror||(B=>null),A=p.onload||(()=>{}),b=Ye(e,p.url,T.serverId),v=typeof p.headers=="function"?p.headers(L):{...p.headers,"Content-Type":"application/offset+octet-stream","Upload-Offset":L.offset,"Upload-Length":s.size,"Upload-Name":s.name},H=L.request=Ae(U(L.data),b,{...p,headers:v});H.onload=B=>{A(B,L.index,E.length),L.status=re.COMPLETE,L.request=null,C()},H.onprogress=(B,ge,Ve)=>{L.progress=B?ge:null,x()},H.onerror=B=>{L.status=re.ERROR,L.request=null,L.error=O(B.response)||B.statusText,G(L)||i(Y("error",B.status,O(B.response)||B.statusText,B.getAllResponseHeaders()))},H.ontimeout=B=>{L.status=re.ERROR,L.request=null,G(L)||Me(i)(B)},H.onabort=()=>{L.status=re.QUEUED,L.request=null,o()}},G=L=>L.retries.length===0?!1:(L.status=re.WAITING,clearTimeout(L.timeout),L.timeout=setTimeout(()=>{w(L)},L.retries.shift()),!0),x=()=>{const L=E.reduce((O,A)=>O===null||A.progress===null?null:O+A.progress,0);if(L===null)return l(!1,0,0);const U=E.reduce((O,A)=>O+A.size,0);l(!0,L,U)},C=()=>{E.filter(U=>U.status===re.PROCESSING).length>=1||w()},j=()=>{E.forEach(L=>{clearTimeout(L.timeout),L.request&&L.request.abort()})};return T.serverId?y(L=>{T.aborted||(E.filter(U=>U.offset<L).forEach(U=>{U.status=re.COMPLETE,U.progress=U.size}),C())}):R(L=>{T.aborted||(d(L),T.serverId=L,C())}),{abort:()=>{T.aborted=!0,j()}}},mi=(e,t,n,s)=>(r,a,i,l,o,d,c)=>{if(!r)return;const E=s.chunkUploads,m=E&&r.size>s.chunkSize,p=E&&(m||s.chunkForce);if(r instanceof Blob&&p)return pi(e,t,n,r,a,i,l,o,d,c,s);const u=t.ondata||(y=>y),I=t.onload||(y=>y),T=t.onerror||(y=>null),g=typeof t.headers=="function"?t.headers(r,a)||{}:{...t.headers},f={...t,headers:g};var _=new FormData;X(a)&&_.append(n,JSON.stringify(a)),(r instanceof Blob?[{name:null,file:r}]:r).forEach(y=>{_.append(n,y.file,y.name===null?y.file.name:`${y.name}${y.file.name}`)});const R=Ae(u(_),Ye(e,t.url),f);return R.onload=y=>{i(Y("load",y.status,I(y.response),y.getAllResponseHeaders()))},R.onerror=y=>{l(Y("error",y.status,T(y.response)||y.statusText,y.getAllResponseHeaders()))},R.ontimeout=Me(l),R.onprogress=o,R.onabort=d,R},Ii=(e="",t,n,s)=>typeof t=="function"?(...r)=>t(n,...r,s):!t||!K(t.url)?null:mi(e,t,n,s),He=(e="",t)=>{if(typeof t=="function")return t;if(!t||!K(t.url))return(r,a)=>a();const n=t.onload||(r=>r),s=t.onerror||(r=>null);return(r,a,i)=>{const l=Ae(r,e+t.url,t);return l.onload=o=>{a(Y("load",o.status,n(o.response),o.getAllResponseHeaders()))},l.onerror=o=>{i(Y("error",o.status,s(o.response)||o.statusText,o.getAllResponseHeaders()))},l.ontimeout=Me(i),l}},cs=(e=0,t=1)=>e+Math.random()*(t-e),_i=(e,t=1e3,n=0,s=25,r=250)=>{let a=null;const i=Date.now(),l=()=>{let o=Date.now()-i,d=cs(s,r);o+d>t&&(d=o+d-t);let c=o/t;if(c>=1||document.hidden){e(1);return}e(c),a=setTimeout(l,d)};return t>0&&l(),{clear:()=>{clearTimeout(a)}}},Ti=(e,t)=>{const n={complete:!1,perceivedProgress:0,perceivedPerformanceUpdater:null,progress:null,timestamp:null,perceivedDuration:0,duration:0,request:null,response:null},{allowMinimumUploadDuration:s}=t,r=(c,E)=>{const m=()=>{n.duration===0||n.progress===null||d.fire("progress",d.getProgress())},p=()=>{n.complete=!0,d.fire("load-perceived",n.response.body)};d.fire("start"),n.timestamp=Date.now(),n.perceivedPerformanceUpdater=_i(u=>{n.perceivedProgress=u,n.perceivedDuration=Date.now()-n.timestamp,m(),n.response&&n.perceivedProgress===1&&!n.complete&&p()},s?cs(750,1500):0),n.request=e(c,E,u=>{n.response=X(u)?u:{type:"load",code:200,body:`${u}`,headers:{}},n.duration=Date.now()-n.timestamp,n.progress=1,d.fire("load",n.response.body),(!s||s&&n.perceivedProgress===1)&&p()},u=>{n.perceivedPerformanceUpdater.clear(),d.fire("error",X(u)?u:{type:"error",code:0,body:`${u}`})},(u,I,T)=>{n.duration=Date.now()-n.timestamp,n.progress=u?I/T:null,m()},()=>{n.perceivedPerformanceUpdater.clear(),d.fire("abort",n.response?n.response.body:null)},u=>{d.fire("transfer",u)})},a=()=>{n.request&&(n.perceivedPerformanceUpdater.clear(),n.request.abort&&n.request.abort(),n.complete=!0)},i=()=>{a(),n.complete=!1,n.perceivedProgress=0,n.progress=0,n.timestamp=null,n.perceivedDuration=0,n.duration=0,n.request=null,n.response=null},l=s?()=>n.progress?Math.min(n.progress,n.perceivedProgress):null:()=>n.progress||null,o=s?()=>Math.min(n.duration,n.perceivedDuration):()=>n.duration,d={...ft(),process:r,abort:a,getProgress:l,getDuration:o,reset:i};return d},ds=e=>e.substring(0,e.lastIndexOf("."))||e,hi=e=>{let t=[e.name,e.size,e.type];return e instanceof Blob||Lt(e)?t[0]=e.name||as():Lt(e)?(t[1]=e.length,t[2]=ls(e)):K(e)&&(t[0]=ze(e),t[1]=0,t[2]="application/octet-stream"),{name:t[0],size:t[1],type:t[2]}},Le=e=>!!(e instanceof File||e instanceof Blob&&e.name),us=e=>{if(!X(e))return e;const t=dt(e)?[]:{};for(const n in e){if(!e.hasOwnProperty(n))continue;const s=e[n];t[n]=s&&X(s)?us(s):s}return t},gi=(e=null,t=null,n=null)=>{const s=Bt(),r={archived:!1,frozen:!1,released:!1,source:null,file:n,serverFileReference:t,transferId:null,processingAborted:!1,status:t?F.PROCESSING_COMPLETE:F.INIT,activeLoader:null,activeProcessor:null};let a=null;const i={},l=D=>r.status=D,o=(D,...w)=>{r.released||r.frozen||P.fire(D,...w)},d=()=>pt(r.file.name),c=()=>r.file.type,E=()=>r.file.size,m=()=>r.file,p=(D,w,G)=>{if(r.source=D,P.fireSync("init"),r.file){P.fireSync("load-skip");return}r.file=hi(D),w.on("init",()=>{o("load-init")}),w.on("meta",x=>{r.file.size=x.size,r.file.filename=x.filename,x.source&&(e=z.LIMBO,r.serverFileReference=x.source,r.status=F.PROCESSING_COMPLETE),o("load-meta")}),w.on("progress",x=>{l(F.LOADING),o("load-progress",x)}),w.on("error",x=>{l(F.LOAD_ERROR),o("load-request-error",x)}),w.on("abort",()=>{l(F.INIT),o("load-abort")}),w.on("load",x=>{r.activeLoader=null;const C=L=>{r.file=Le(L)?L:r.file,e===z.LIMBO&&r.serverFileReference?l(F.PROCESSING_COMPLETE):l(F.IDLE),o("load")},j=L=>{r.file=x,o("load-meta"),l(F.LOAD_ERROR),o("load-file-error",L)};if(r.serverFileReference){C(x);return}G(x,C,j)}),w.setSource(D),r.activeLoader=w,w.load()},u=()=>{r.activeLoader&&r.activeLoader.load()},I=()=>{if(r.activeLoader){r.activeLoader.abort();return}l(F.INIT),o("load-abort")},T=(D,w)=>{if(r.processingAborted){r.processingAborted=!1;return}if(l(F.PROCESSING),a=null,!(r.file instanceof Blob)){P.on("load",()=>{T(D,w)});return}D.on("load",C=>{r.transferId=null,r.serverFileReference=C}),D.on("transfer",C=>{r.transferId=C}),D.on("load-perceived",C=>{r.activeProcessor=null,r.transferId=null,r.serverFileReference=C,l(F.PROCESSING_COMPLETE),o("process-complete",C)}),D.on("start",()=>{o("process-start")}),D.on("error",C=>{r.activeProcessor=null,l(F.PROCESSING_ERROR),o("process-error",C)}),D.on("abort",C=>{r.activeProcessor=null,r.serverFileReference=C,l(F.IDLE),o("process-abort"),a&&a()}),D.on("progress",C=>{o("process-progress",C)});const G=C=>{r.archived||D.process(C,{...i})},x=console.error;w(r.file,G,x),r.activeProcessor=D},g=()=>{r.processingAborted=!1,l(F.PROCESSING_QUEUED)},f=()=>new Promise(D=>{if(!r.activeProcessor){r.processingAborted=!0,l(F.IDLE),o("process-abort"),D();return}a=()=>{D()},r.activeProcessor.abort()}),_=(D,w)=>new Promise((G,x)=>{const C=r.serverFileReference!==null?r.serverFileReference:r.transferId;if(C===null){G();return}D(C,()=>{r.serverFileReference=null,r.transferId=null,G()},j=>{if(!w){G();return}l(F.PROCESSING_REVERT_ERROR),o("process-revert-error"),x(j)}),l(F.IDLE),o("process-revert")}),R=(D,w,G)=>{const x=D.split("."),C=x[0],j=x.pop();let L=i;x.forEach(U=>L=L[U]),JSON.stringify(L[j])!==JSON.stringify(w)&&(L[j]=w,o("metadata-update",{key:C,value:i[C],silent:G}))},P={id:{get:()=>s},origin:{get:()=>e,set:D=>e=D},serverId:{get:()=>r.serverFileReference},transferId:{get:()=>r.transferId},status:{get:()=>r.status},filename:{get:()=>r.file.name},filenameWithoutExtension:{get:()=>ds(r.file.name)},fileExtension:{get:d},fileType:{get:c},fileSize:{get:E},file:{get:m},relativePath:{get:()=>r.file._relativePath},source:{get:()=>r.source},getMetadata:D=>us(D?i[D]:i),setMetadata:(D,w,G)=>{if(X(D)){const x=D;return Object.keys(x).forEach(C=>{R(C,x[C],w)}),D}return R(D,w,G),w},extend:(D,w)=>N[D]=w,abortLoad:I,retryLoad:u,requestProcessing:g,abortProcessing:f,load:p,process:T,revert:_,...ft(),freeze:()=>r.frozen=!0,release:()=>r.released=!0,released:{get:()=>r.released},archive:()=>r.archived=!0,archived:{get:()=>r.archived},setFile:D=>r.file=D},N=he(P);return N},Ri=(e,t)=>Ie(t)?0:K(t)?e.findIndex(n=>n.id===t):-1,En=(e,t)=>{const n=Ri(e,t);if(!(n<0))return e[n]||null},fn=(e,t,n,s,r,a)=>{const i=Ae(null,e,{method:"GET",responseType:"blob"});return i.onload=l=>{const o=l.getAllResponseHeaders(),d=jt(o).name||ze(e);t(Y("load",l.status,Be(l.response,d),o))},i.onerror=l=>{n(Y("error",l.status,l.statusText,l.getAllResponseHeaders()))},i.onheaders=l=>{a(Y("headers",l.status,null,l.getAllResponseHeaders()))},i.ontimeout=Me(n),i.onprogress=s,i.onabort=r,i},pn=e=>(e.indexOf("//")===0&&(e=location.protocol+e),e.toLowerCase().replace("blob:","").replace(/([a-z])?:\/\//,"$1").split("/")[0]),Oi=e=>(e.indexOf(":")>-1||e.indexOf("//")>-1)&&pn(location.href)!==pn(e),Qe=e=>(...t)=>ye(e)?e(...t):e,Si=e=>!Le(e.file),gt=(e,t)=>{clearTimeout(t.listUpdateTimeout),t.listUpdateTimeout=setTimeout(()=>{e("DID_UPDATE_ITEMS",{items:de(t.items)})},0)},mn=(e,...t)=>new Promise(n=>{if(!e)return n(!0);const s=e(...t);if(s==null)return n(!0);if(typeof s=="boolean")return n(s);typeof s.then=="function"&&s.then(n)}),Rt=(e,t)=>{e.items.sort((n,s)=>t(te(n),te(s)))},ie=(e,t)=>({query:n,success:s=()=>{},failure:r=()=>{},...a}={})=>{const i=De(e.items,n);if(!i){r({error:Y("error",0,"Item not found"),file:null});return}t(i,s,r,a||{})},yi=(e,t,n)=>({ABORT_ALL:()=>{de(n.items).forEach(s=>{s.freeze(),s.abortLoad(),s.abortProcessing()})},DID_SET_FILES:({value:s=[]})=>{const r=s.map(i=>({source:i.source?i.source:i,options:i.options}));let a=de(n.items);a.forEach(i=>{r.find(l=>l.source===i.source||l.source===i.file)||e("REMOVE_ITEM",{query:i,remove:!1})}),a=de(n.items),r.forEach((i,l)=>{a.find(o=>o.source===i.source||o.file===i.source)||e("ADD_ITEM",{...i,interactionMethod:oe.NONE,index:l})})},DID_UPDATE_ITEM_METADATA:({id:s,action:r,change:a})=>{a.silent||(clearTimeout(n.itemUpdateTimeout),n.itemUpdateTimeout=setTimeout(()=>{const i=En(n.items,s);if(!t("IS_ASYNC")){ce("SHOULD_PREPARE_OUTPUT",!1,{item:i,query:t,action:r,change:a}).then(c=>{const E=t("GET_BEFORE_PREPARE_FILE");E&&(c=E(i,c)),c&&e("REQUEST_PREPARE_OUTPUT",{query:s,item:i,success:m=>{e("DID_PREPARE_OUTPUT",{id:s,file:m})}},!0)});return}i.origin===z.LOCAL&&e("DID_LOAD_ITEM",{id:i.id,error:null,serverFileReference:i.source});const l=()=>{setTimeout(()=>{e("REQUEST_ITEM_PROCESSING",{query:s})},32)},o=c=>{i.revert(He(n.options.server.url,n.options.server.revert),t("GET_FORCE_REVERT")).then(c?l:()=>{}).catch(()=>{})},d=c=>{i.abortProcessing().then(c?l:()=>{})};if(i.status===F.PROCESSING_COMPLETE)return o(n.options.instantUpload);if(i.status===F.PROCESSING)return d(n.options.instantUpload);n.options.instantUpload&&l()},0))},MOVE_ITEM:({query:s,index:r})=>{const a=De(n.items,s);if(!a)return;const i=n.items.indexOf(a);r=is(r,0,n.items.length-1),i!==r&&n.items.splice(r,0,n.items.splice(i,1)[0])},SORT:({compare:s})=>{Rt(n,s),e("DID_SORT_ITEMS",{items:t("GET_ACTIVE_ITEMS")})},ADD_ITEMS:({items:s,index:r,interactionMethod:a,success:i=()=>{},failure:l=()=>{}})=>{let o=r;if(r===-1||typeof r>"u"){const p=t("GET_ITEM_INSERT_LOCATION"),u=t("GET_TOTAL_ITEMS");o=p==="before"?0:u}const d=t("GET_IGNORED_FILES"),c=p=>Le(p)?!d.includes(p.name.toLowerCase()):!Ie(p),m=s.filter(c).map(p=>new Promise((u,I)=>{e("ADD_ITEM",{interactionMethod:a,source:p.source||p,success:u,failure:I,index:o++,options:p.options||{}})}));Promise.all(m).then(i).catch(l)},ADD_ITEM:({source:s,index:r=-1,interactionMethod:a,success:i=()=>{},failure:l=()=>{},options:o={}})=>{if(Ie(s)){l({error:Y("error",0,"No source"),file:null});return}if(Le(s)&&n.options.ignoredFiles.includes(s.name.toLowerCase()))return;if(!ei(n)){if(n.options.allowMultiple||!n.options.allowMultiple&&!n.options.allowReplace){const f=Y("warning",0,"Max files");e("DID_THROW_MAX_FILES",{source:s,error:f}),l({error:f,file:null});return}const g=de(n.items)[0];if(g.status===F.PROCESSING_COMPLETE||g.status===F.PROCESSING_REVERT_ERROR){const f=t("GET_FORCE_REVERT");if(g.revert(He(n.options.server.url,n.options.server.revert),f).then(()=>{f&&e("ADD_ITEM",{source:s,index:r,interactionMethod:a,success:i,failure:l,options:o})}).catch(()=>{}),f)return}e("REMOVE_ITEM",{query:g.id})}const d=o.type==="local"?z.LOCAL:o.type==="limbo"?z.LIMBO:z.INPUT,c=gi(d,d===z.INPUT?null:s,o.file);Object.keys(o.metadata||{}).forEach(g=>{c.setMetadata(g,o.metadata[g])}),xe("DID_CREATE_ITEM",c,{query:t,dispatch:e});const E=t("GET_ITEM_INSERT_LOCATION");n.options.itemInsertLocationFreedom||(r=E==="before"?-1:n.items.length),ni(n.items,c,r),ye(E)&&s&&Rt(n,E);const m=c.id;c.on("init",()=>{e("DID_INIT_ITEM",{id:m})}),c.on("load-init",()=>{e("DID_START_ITEM_LOAD",{id:m})}),c.on("load-meta",()=>{e("DID_UPDATE_ITEM_META",{id:m})}),c.on("load-progress",g=>{e("DID_UPDATE_ITEM_LOAD_PROGRESS",{id:m,progress:g})}),c.on("load-request-error",g=>{const f=Qe(n.options.labelFileLoadError)(g);if(g.code>=400&&g.code<500){e("DID_THROW_ITEM_INVALID",{id:m,error:g,status:{main:f,sub:`${g.code} (${g.body})`}}),l({error:g,file:te(c)});return}e("DID_THROW_ITEM_LOAD_ERROR",{id:m,error:g,status:{main:f,sub:n.options.labelTapToRetry}})}),c.on("load-file-error",g=>{e("DID_THROW_ITEM_INVALID",{id:m,error:g.status,status:g.status}),l({error:g.status,file:te(c)})}),c.on("load-abort",()=>{e("REMOVE_ITEM",{query:m})}),c.on("load-skip",()=>{c.on("metadata-update",g=>{Le(c.file)&&e("DID_UPDATE_ITEM_METADATA",{id:m,change:g})}),e("COMPLETE_LOAD_ITEM",{query:m,item:c,data:{source:s,success:i}})}),c.on("load",()=>{const g=f=>{if(!f){e("REMOVE_ITEM",{query:m});return}c.on("metadata-update",_=>{e("DID_UPDATE_ITEM_METADATA",{id:m,change:_})}),ce("SHOULD_PREPARE_OUTPUT",!1,{item:c,query:t}).then(_=>{const R=t("GET_BEFORE_PREPARE_FILE");R&&(_=R(c,_));const y=()=>{e("COMPLETE_LOAD_ITEM",{query:m,item:c,data:{source:s,success:i}}),gt(e,n)};if(_){e("REQUEST_PREPARE_OUTPUT",{query:m,item:c,success:P=>{e("DID_PREPARE_OUTPUT",{id:m,file:P}),y()}},!0);return}y()})};ce("DID_LOAD_ITEM",c,{query:t,dispatch:e}).then(()=>{mn(t("GET_BEFORE_ADD_FILE"),te(c)).then(g)}).catch(f=>{if(!f||!f.error||!f.status)return g(!1);e("DID_THROW_ITEM_INVALID",{id:m,error:f.error,status:f.status})})}),c.on("process-start",()=>{e("DID_START_ITEM_PROCESSING",{id:m})}),c.on("process-progress",g=>{e("DID_UPDATE_ITEM_PROCESS_PROGRESS",{id:m,progress:g})}),c.on("process-error",g=>{e("DID_THROW_ITEM_PROCESSING_ERROR",{id:m,error:g,status:{main:Qe(n.options.labelFileProcessingError)(g),sub:n.options.labelTapToRetry}})}),c.on("process-revert-error",g=>{e("DID_THROW_ITEM_PROCESSING_REVERT_ERROR",{id:m,error:g,status:{main:Qe(n.options.labelFileProcessingRevertError)(g),sub:n.options.labelTapToRetry}})}),c.on("process-complete",g=>{e("DID_COMPLETE_ITEM_PROCESSING",{id:m,error:null,serverFileReference:g}),e("DID_DEFINE_VALUE",{id:m,value:g})}),c.on("process-abort",()=>{e("DID_ABORT_ITEM_PROCESSING",{id:m})}),c.on("process-revert",()=>{e("DID_REVERT_ITEM_PROCESSING",{id:m}),e("DID_DEFINE_VALUE",{id:m,value:null})}),e("DID_ADD_ITEM",{id:m,index:r,interactionMethod:a}),gt(e,n);const{url:p,load:u,restore:I,fetch:T}=n.options.server||{};c.load(s,fi(d===z.INPUT?K(s)&&Oi(s)&&T?ht(p,T):fn:d===z.LIMBO?ht(p,I):ht(p,u)),(g,f,_)=>{ce("LOAD_FILE",g,{query:t}).then(f).catch(_)})},REQUEST_PREPARE_OUTPUT:({item:s,success:r,failure:a=()=>{}})=>{const i={error:Y("error",0,"Item not found"),file:null};if(s.archived)return a(i);ce("PREPARE_OUTPUT",s.file,{query:t,item:s}).then(l=>{ce("COMPLETE_PREPARE_OUTPUT",l,{query:t,item:s}).then(o=>{if(s.archived)return a(i);r(o)})})},COMPLETE_LOAD_ITEM:({item:s,data:r})=>{const{success:a,source:i}=r,l=t("GET_ITEM_INSERT_LOCATION");if(ye(l)&&i&&Rt(n,l),e("DID_LOAD_ITEM",{id:s.id,error:null,serverFileReference:s.origin===z.INPUT?null:i}),a(te(s)