From b2ff1f4c9ee8e3cd6b82e6fb9930b43a0a7c321f Mon Sep 17 00:00:00 2001 From: Rik Schennink Date: Mon, 13 Apr 2020 09:49:10 +0200 Subject: [PATCH] fix issue where background uploads took way too long --- CHANGELOG.md | 5 +++ dist/filepond.css | 2 +- dist/filepond.esm.js | 42 ++++++++------------ dist/filepond.esm.min.js | 4 +- dist/filepond.js | 46 +++++++++------------- dist/filepond.min.css | 2 +- dist/filepond.min.js | 4 +- package.json | 2 +- src/js/app/actions.js | 2 +- src/js/app/frame/mixins/animations.js | 11 ++---- src/js/app/frame/utils/animators/spring.js | 8 ++-- src/js/app/frame/utils/animators/tween.js | 23 +++++------ src/js/app/utils/createFileProcessor.js | 1 + 13 files changed, 67 insertions(+), 85 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a56580a..c2cdde45 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 4.13.2 + +- Fix issue where FilePond running in an inactive tab would be very slow to pick up new files. + + ## 4.13.1 - Fix issue where HEAD fetch request would try turn response into zero byte file. diff --git a/dist/filepond.css b/dist/filepond.css index 9cca953c..74f09295 100755 --- a/dist/filepond.css +++ b/dist/filepond.css @@ -1,5 +1,5 @@ /*! - * FilePond 4.13.1 + * FilePond 4.13.2 * Licensed under MIT, https://opensource.org/licenses/MIT/ * Please visit https://pqina.nl/filepond/ for details. */ diff --git a/dist/filepond.esm.js b/dist/filepond.esm.js index 06430ddc..8525ef9d 100755 --- a/dist/filepond.esm.js +++ b/dist/filepond.esm.js @@ -1,5 +1,5 @@ /*! - * FilePond 4.13.1 + * FilePond 4.13.2 * Licensed under MIT, https://opensource.org/licenses/MIT/ * Please visit https://pqina.nl/filepond/ for details. */ @@ -302,11 +302,9 @@ const spring = let resting = false; // updates spring state - const interpolate = () => { + const interpolate = (ts, skipToEndState) => { // in rest, don't animate - if (resting) { - return; - } + if (resting) return; // need at least a target or position to do springy things if (!(isNumber(target) && isNumber(position))) { @@ -328,7 +326,7 @@ const spring = velocity *= damping; // we've arrived if we're near target and our velocity is near zero - if (thereYet(position, target, velocity)) { + if (thereYet(position, target, velocity) || skipToEndState) { position = target; velocity = 0; resting = true; @@ -409,30 +407,26 @@ const tween = let reverse = false; let target = null; - const interpolate = ts => { - if (resting || target === null) { - return; - } + const interpolate = (ts, skipToEndState) => { + if (resting || target === null) return; if (start === null) { start = ts; } - if (ts - start < delay) { - return; - } + if (ts - start < delay) return; t = ts - start - delay; - if (t < duration) { - p = t / duration; - api.onupdate((t >= 0 ? easing(reverse ? 1 - p : p) : 0) * target); - } else { + if (t >= duration || skipToEndState) { t = 1; p = reverse ? 0 : 1; api.onupdate(p * target); api.oncomplete(p * target); resting = true; + } else { + p = t / duration; + api.onupdate((t >= 0 ? easing(reverse ? 1 - p : p) : 0) * target); } }; @@ -525,8 +519,6 @@ const addGetSet = (keys, obj, props, overwrite = false) => { }); }; -const isDefined = value => value != null; - // add to state, // add getters and setters to internal and external api (if not set) // setup animators @@ -535,8 +527,7 @@ const animations = ({ mixinConfig, viewProps, viewInternalAPI, - viewExternalAPI, - viewState + viewExternalAPI }) => { // initial properties const initialProps = { ...viewProps }; @@ -583,12 +574,11 @@ const animations = ({ // expose internal write api return { write: ts => { + let skipToEndState = document.hidden; let resting = true; animations.forEach(animation => { - if (!animation.resting) { - resting = false; - } - animation.interpolate(ts); + if (!animation.resting) resting = false; + animation.interpolate(ts, skipToEndState); }); return resting; }, @@ -653,6 +643,8 @@ const apis = ({ mixinConfig, viewProps, viewExternalAPI }) => { addGetSet(mixinConfig, viewExternalAPI, viewProps); }; +const isDefined = value => value != null; + // add to state, // add getters and setters to internal and external api (if not set) // set initial state based on props in viewProps diff --git a/dist/filepond.esm.min.js b/dist/filepond.esm.min.js index c8a8dd02..c0ef054e 100755 --- a/dist/filepond.esm.min.js +++ b/dist/filepond.esm.min.js @@ -1,9 +1,9 @@ /*! - * FilePond 4.13.1 + * FilePond 4.13.2 * Licensed under MIT, https://opensource.org/licenses/MIT/ * Please visit https://pqina.nl/filepond/ for details. */ /* eslint-disable */ -const e=(e,t)=>{for(const r in e)e.hasOwnProperty(r)&&t(r,e[r])},t=t=>{const r={};return e(t,e=>{((e,t,r)=>{"function"!=typeof r?Object.defineProperty(e,t,{...r}):e[t]=r})(r,e,t[e])}),r},r=(e,t,r=null)=>{if(null===r)return e.getAttribute(t)||e.hasAttribute(t);e.setAttribute(t,r)},o=["svg","path"],n=e=>o.includes(e),s=(t,o,s={})=>{"object"==typeof o&&(s=o,o=null);const i=n(t)?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t);return o&&(n(t)?r(i,"class",o):i.className=o),e(s,(e,t)=>{r(i,e,t)}),i},i=e=>(t,r)=>{void 0!==r&&e.children[r]?e.insertBefore(t,e.children[r]):e.appendChild(t)},a=(e,t)=>(e,r)=>(void 0!==r?t.splice(r,0,e):t.push(e),e),l=(e,t)=>r=>(t.splice(t.indexOf(r),1),r.element.parentNode&&e.removeChild(r.element),r),c=(()=>"undefined"!=typeof window&&void 0!==window.document)(),d=()=>c,p="children"in(d()?s("svg"):{})?e=>e.children.length:e=>e.childNodes.length,E=(e,t,r,o)=>{const n=r[0]||e.left,s=r[1]||e.top,i=n+e.width,a=s+e.height*(o[1]||1),l={element:{...e},inner:{left:e.left,top:e.top,right:e.right,bottom:e.bottom},outer:{left:n,top:s,right:i,bottom:a}};return t.filter(e=>!e.isRectIgnored()).map(e=>e.rect).forEach(e=>{u(l.inner,{...e.inner}),u(l.outer,{...e.outer})}),_(l.inner),l.outer.bottom+=l.element.marginBottom,l.outer.right+=l.element.marginRight,_(l.outer),l},u=(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)},_=e=>{e.width=e.right-e.left,e.height=e.bottom-e.top},T=e=>"number"==typeof e,f=e=>e<.5?2*e*e:(4-2*e)*e-1,I={spring:({stiffness:e=.5,damping:r=.75,mass:o=10}={})=>{let n=null,s=null,i=0,a=!1;const l=t({interpolate:()=>{if(!a)return T(n)&&T(s)?void(((e,t,r,o=.001)=>Math.abs(e-t){if(T(e)&&!T(s)&&(s=e),null===n&&(n=e,s=e),s===(n=e)||void 0===n)return a=!0,i=0,l.onupdate(s),void l.oncomplete(s);a=!1},get:()=>n},resting:{get:()=>a},onupdate:e=>{},oncomplete:e=>{}});return l},tween:({duration:e=500,easing:r=f,delay:o=0}={})=>{let n,s,i=null,a=!0,l=!1,c=null;const d=t({interpolate:t=>{a||null===c||(null===i&&(i=t),t-i=0?r(l?1-s:s):0)*c)):(n=1,s=l?0:1,d.onupdate(s*c),d.oncomplete(s*c),a=!0)))},target:{get:()=>l?0:c,set:e=>{if(null===c)return c=e,d.onupdate(e),void d.oncomplete(e);ea},onupdate:e=>{},oncomplete:e=>{}});return d}},m=(e,t,r)=>{const o=e[t]&&"object"==typeof e[t][r]?e[t][r]:e[t]||e,n="string"==typeof o?o:o.type,s="object"==typeof o?{...o}:{};return I[n]?I[n](s):null},R=(e,t,r,o=!1)=>{(t=Array.isArray(t)?t:[t]).forEach(t=>{e.forEach(e=>{let n=e,s=()=>r[e],i=t=>r[e]=t;"object"==typeof e&&(n=e.key,s=e.getter||s,i=e.setter||i),t[n]&&!o||(t[n]={get:s,set:i})})})},h=e=>null!=e,g={opacity:1,scaleX:1,scaleY:1,translateX:0,translateY:0,rotateX:0,rotateY:0,rotateZ:0,originX:0,originY:0},O=(e,t)=>{if(Object.keys(e).length!==Object.keys(t).length)return!0;for(const r in t)if(t[r]!==e[r])return!0;return!1},D=(e,{opacity:t,perspective:r,translateX:o,translateY:n,scaleX:s,scaleY:i,rotateX:a,rotateY:l,rotateZ:c,originX:d,originY:p,width:E,height:u})=>{let _="",T="";(h(d)||h(p))&&(T+=`transform-origin: ${d||0}px ${p||0}px;`),h(r)&&(_+=`perspective(${r}px) `),(h(o)||h(n))&&(_+=`translate3d(${o||0}px, ${n||0}px, 0) `),(h(s)||h(i))&&(_+=`scale3d(${h(s)?s:1}, ${h(i)?i:1}, 1) `),h(c)&&(_+=`rotateZ(${c}rad) `),h(a)&&(_+=`rotateX(${a}rad) `),h(l)&&(_+=`rotateY(${l}rad) `),_.length&&(T+=`transform:${_};`),h(t)&&(T+=`opacity:${t};`,0===t&&(T+="visibility:hidden;"),t<1&&(T+="pointer-events:none;")),h(u)&&(T+=`height:${u}px;`),h(E)&&(T+=`width:${E}px;`);const f=e.elementCurrentStyle||"";T.length===f.length&&T===f||(e.style.cssText=T,e.elementCurrentStyle=T)},S={styles:({mixinConfig:e,viewProps:t,viewInternalAPI:r,viewExternalAPI:o,view:n})=>{const s={...t},i={};R(e,[r,o],t);const a=()=>n.rect?E(n.rect,n.childViews,(()=>[t.translateX||0,t.translateY||0])(),(()=>[t.scaleX||0,t.scaleY||0])()):null;return r.rect={get:a},o.rect={get:a},e.forEach(e=>{t[e]=void 0===s[e]?g[e]:s[e]}),{write:()=>{if(O(i,t))return D(n.element,t),Object.assign(i,{...t}),!0},destroy:()=>{}}},listeners:({mixinConfig:e,viewProps:t,viewInternalAPI:r,viewExternalAPI:o,viewState:n,view:s})=>{const i=[],a=(e=>(t,r)=>{e.addEventListener(t,r)})(s.element),l=(e=>(t,r)=>{e.removeEventListener(t,r)})(s.element);return o.on=((e,t)=>{i.push({type:e,fn:t}),a(e,t)}),o.off=((e,t)=>{i.splice(i.findIndex(r=>r.type===e&&r.fn===t),1),l(e,t)}),{write:()=>!0,destroy:()=>{i.forEach(e=>{l(e.type,e.fn)})}}},animations:({mixinConfig:t,viewProps:r,viewInternalAPI:o,viewExternalAPI:n,viewState:s})=>{const i={...r},a=[];return e(t,(e,t)=>{const s=m(t);s&&(s.onupdate=(t=>{r[e]=t}),s.target=i[e],R([{key:e,setter:e=>{s.target!==e&&(s.target=e)},getter:()=>r[e]}],[o,n],r,!0),a.push(s))}),{write:e=>{let t=!0;return a.forEach(r=>{r.resting||(t=!1),r.interpolate(e)}),t},destroy:()=>{}}},apis:({mixinConfig:e,viewProps:t,viewExternalAPI:r})=>{R(e,r,t)}},y=(e={},t={},r={})=>(t.layoutCalculated||(e.paddingTop=parseInt(r.paddingTop,10)||0,e.marginTop=parseInt(r.marginTop,10)||0,e.marginRight=parseInt(r.marginRight,10)||0,e.marginBottom=parseInt(r.marginBottom,10)||0,e.marginLeft=parseInt(r.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=null===t.offsetParent,e),A=({tag:e="div",name:r=null,attributes:o={},read:n=(()=>{}),write:c=(()=>{}),create:d=(()=>{}),destroy:u=(()=>{}),filterFrameActionsForChild:_=((e,t)=>t),didCreateView:T=(()=>{}),didWriteView:f=(()=>{}),ignoreRect:I=!1,ignoreRectUpdate:m=!1,mixins:R=[]}={})=>(h,g={})=>{const O=s(e,`filepond--${r}`,o),D=window.getComputedStyle(O,null),A=y();let L=null,P=!1;const v=[],M=[],b={},C={},N=[c],w=[n],G=[u],U=()=>O,B=()=>v.concat(),q=()=>L||(L=E(A,v,[0,0],[1,1])),V={element:{get:U},style:{get:()=>D},childViews:{get:B}},F={...V,rect:{get:q},ref:{get:()=>b},is:e=>r===e,appendChild:i(O),createChildView:(e=>(t,r)=>t(e,r))(h),linkView:e=>(v.push(e),e),unlinkView:e=>{v.splice(v.indexOf(e),1)},appendChildView:a(0,v),removeChildView:l(O,v),registerWriter:e=>N.push(e),registerReader:e=>w.push(e),registerDestroyer:e=>G.push(e),invalidateLayout:()=>O.layoutCalculated=!1,dispatch:h.dispatch,query:h.query},x={element:{get:U},childViews:{get:B},rect:{get:q},resting:{get:()=>P},isRectIgnored:()=>I,_read:()=>{L=null,v.forEach(e=>e._read()),!(m&&A.width&&A.height)&&y(A,O,D);const e={root:H,props:g,rect:A};w.forEach(t=>t(e))},_write:(e,t,r)=>{let o=0===t.length;return N.forEach(n=>{!1===n({props:g,root:H,actions:t,timestamp:e,shouldOptimize:r})&&(o=!1)}),M.forEach(t=>{!1===t.write(e)&&(o=!1)}),v.filter(e=>!!e.element.parentNode).forEach(n=>{n._write(e,_(n,t),r)||(o=!1)}),v.forEach((n,s)=>{n.element.parentNode||(H.appendChild(n.element,s),n._read(),n._write(e,_(n,t),r),o=!1)}),P=o,f({props:g,root:H,actions:t,timestamp:e}),o},_destroy:()=>{M.forEach(e=>e.destroy()),G.forEach(e=>{e({root:H,props:g})}),v.forEach(e=>e._destroy())}},Y={...V,rect:{get:()=>A}};Object.keys(R).sort((e,t)=>"styles"===e?1:"styles"===t?-1:0).forEach(e=>{const r=S[e]({mixinConfig:R[e],viewProps:g,viewState:C,viewInternalAPI:F,viewExternalAPI:x,view:t(Y)});r&&M.push(r)});const H=t(F);d({root:H,props:g});const X=p(O);return v.forEach((e,t)=>{H.appendChild(e.element,X+t)}),T(H),t(x)},L=(e,t)=>({root:r,props:o,actions:n=[],timestamp:s,shouldOptimize:i})=>{n.filter(t=>e[t.type]).forEach(t=>e[t.type]({root:r,props:o,action:t.data,timestamp:s,shouldOptimize:i})),t&&t({root:r,props:o,actions:n,timestamp:s,shouldOptimize:i})},P=(e,t)=>t.parentNode.insertBefore(e,t),v=(e,t)=>t.parentNode.insertBefore(e,t.nextSibling),M=e=>Array.isArray(e),b=e=>null==e,C=e=>e.trim(),N=e=>""+e,w=e=>"boolean"==typeof e,G=e=>w(e)?e:"true"===e,U=e=>"string"==typeof e,B=e=>T(e)?e:U(e)?N(e).replace(/[a-z]+/gi,""):0,q=e=>parseInt(B(e),10),V=e=>parseFloat(B(e)),F=e=>T(e)&&isFinite(e)&&Math.floor(e)===e,x=e=>{if(F(e))return e;let t=N(e).trim();return/MB$/i.test(t)?(t=t.replace(/MB$i/,"").trim(),1e3*q(t)*1e3):/KB/i.test(t)?(t=t.replace(/KB$i/,"").trim(),1e3*q(t)):q(t)},Y=e=>"function"==typeof e,H={process:"POST",patch:"PATCH",revert:"DELETE",fetch:"GET",restore:"GET",load:"GET"},X=(e,t,r,o,n)=>{if(null===t)return null;if("function"==typeof t)return t;const s={url:"GET"===r||"PATCH"===r?`?${e}=`:"",method:r,headers:n,withCredentials:!1,timeout:o,onload:null,ondata:null,onerror:null};if(U(t))return s.url=t,s;if(Object.assign(s,t),U(s.headers)){const e=s.headers.split(/:(.+)/);s.headers={header:e[0],value:e[1]}}return s.withCredentials=G(s.withCredentials),s},k=e=>"object"==typeof e&&null!==e,$=e=>M(e)?"array":(e=>null===e)(e)?"null":F(e)?"int":/^[0-9]+ ?(?:GB|MB|KB)$/gi.test(e)?"bytes":(e=>k(e)&&U(e.url)&&k(e.process)&&k(e.revert)&&k(e.restore)&&k(e.fetch))(e)?"api":typeof e,z={array:(e,t=",")=>b(e)?[]:M(e)?e:N(e).split(t).map(C).filter(e=>e.length),boolean:G,int:e=>"bytes"===$(e)?x(e):q(e),number:V,float:V,bytes:x,string:e=>Y(e)?e:N(e),function:e=>(e=>{let t=self,r=e.split("."),o=null;for(;o=r.shift();)if(!(t=t[o]))return null;return t})(e),serverapi:t=>(t=>{const r={};return r.url=U(t)?t:t.url||"",r.timeout=t.timeout?parseInt(t.timeout,10):0,r.headers=t.headers?t.headers:{},e(H,e=>{r[e]=X(e,t[e],H[e],r.timeout,r.headers)}),r.remove=t.remove||null,delete r.headers,r})(t),object:e=>{try{return JSON.parse((e=>e.replace(/{\s*'/g,'{"').replace(/'\s*}/g,'"}').replace(/'\s*:/g,'":').replace(/:\s*'/g,':"').replace(/,\s*'/g,',"').replace(/'\s*,/g,'",'))(e))}catch(e){return null}}},W=(e,t,r)=>{if(e===t)return e;let o=$(e);if(o!==r){const t=((e,t)=>z[t](e))(e,r);if(o=$(t),null===t)throw`Trying to assign value with incorrect type to "${option}", allowed type: "${r}"`;e=t}return e},j=r=>{const o={};return e(r,e=>{const t=r[e];o[e]=((e,t)=>{let r=e;return{enumerable:!0,get:()=>r,set:o=>{r=W(o,e,t)}}})(t[0],t[1])}),t(o)},Q=(e,t="-")=>e.split(/(?=[A-Z])/).map(e=>e.toLowerCase()).join(t),Z=(t,r)=>{const o={};return e(r,e=>{o[e]={get:()=>t.getState().options[e],set:r=>{t.dispatch(`SET_${Q(e,"_").toUpperCase()}`,{value:r})}}}),o},K=t=>(r,o,n)=>{const s={};return e(t,e=>{const t=Q(e,"_").toUpperCase();s[`SET_${t}`]=(o=>{try{n.options[e]=o.value}catch(e){}r(`DID_SET_${t}`,{value:n.options[e]})})}),s},J=t=>r=>{const o={};return e(t,e=>{o[`GET_${Q(e,"_").toUpperCase()}`]=(t=>r.options[e])}),o},ee=1,te=2,re=3,oe=4,ne=5,se=()=>Math.random().toString(36).substr(2,9),ie=(e,t)=>e.splice(t,1),ae=()=>{const e=[],t=(t,r)=>{ie(e,e.findIndex(e=>e.event===t&&(e.cb===r||!r)))};return{fire:(t,...r)=>{e.filter(e=>e.event===t).map(e=>e.cb).forEach(e=>{setTimeout(()=>{e(...r)},0)})},on:(t,r)=>{e.push({event:t,cb:r})},onOnce:(r,o)=>{e.push({event:r,cb:(...e)=>{t(r,o),o(...e)}})},off:t}},le=(e,t,r)=>{Object.getOwnPropertyNames(e).filter(e=>!r.includes(e)).forEach(r=>Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r)))},ce=["fire","process","revert","load","on","off","onOnce","retryLoad","extend","archive","archived","release","released","requestProcessing","freeze"],de=e=>{const t={};return le(e,t,ce),t},pe={INIT:1,IDLE:2,PROCESSING_QUEUED:9,PROCESSING:3,PROCESSING_COMPLETE:5,PROCESSING_ERROR:6,PROCESSING_REVERT_ERROR:10,LOADING:7,LOAD_ERROR:8},Ee={INPUT:1,LIMBO:2,LOCAL:3},ue=e=>/[^0-9]+/.exec(e),_e=()=>ue(1.1.toLocaleString())[0],Te={BOOLEAN:"boolean",INT:"int",NUMBER:"number",STRING:"string",ARRAY:"array",OBJECT:"object",FUNCTION:"function",ACTION:"action",SERVER_API:"serverapi",REGEX:"regex"},fe=[],Ie=(e,t,r)=>new Promise((o,n)=>{const s=fe.filter(t=>t.key===e).map(e=>e.cb);if(0===s.length)return void o(t);const i=s.shift();s.reduce((e,t)=>e.then(e=>t(e,r)),i(t,r)).then(e=>o(e)).catch(e=>n(e))}),me=(e,t,r)=>fe.filter(t=>t.key===e).map(e=>e.cb(t,r)),Re=(e,t)=>fe.push({key:e,cb:t}),he=()=>({...ge}),ge={id:[null,Te.STRING],name:["filepond",Te.STRING],disabled:[!1,Te.BOOLEAN],className:[null,Te.STRING],required:[!1,Te.BOOLEAN],captureMethod:[null,Te.STRING],allowDrop:[!0,Te.BOOLEAN],allowBrowse:[!0,Te.BOOLEAN],allowPaste:[!0,Te.BOOLEAN],allowMultiple:[!1,Te.BOOLEAN],allowReplace:[!0,Te.BOOLEAN],allowRevert:[!0,Te.BOOLEAN],allowReorder:[!1,Te.BOOLEAN],allowDirectoriesOnly:[!1,Te.BOOLEAN],forceRevert:[!1,Te.BOOLEAN],maxFiles:[null,Te.INT],checkValidity:[!1,Te.BOOLEAN],itemInsertLocationFreedom:[!0,Te.BOOLEAN],itemInsertLocation:["before",Te.STRING],itemInsertInterval:[75,Te.INT],dropOnPage:[!1,Te.BOOLEAN],dropOnElement:[!0,Te.BOOLEAN],dropValidation:[!1,Te.BOOLEAN],ignoredFiles:[[".ds_store","thumbs.db","desktop.ini"],Te.ARRAY],instantUpload:[!0,Te.BOOLEAN],maxParallelUploads:[2,Te.INT],chunkUploads:[!1,Te.BOOLEAN],chunkForce:[!1,Te.BOOLEAN],chunkSize:[5e6,Te.INT],chunkRetryDelays:[[500,1e3,3e3],Te.Array],server:[null,Te.SERVER_API],labelDecimalSeparator:[_e(),Te.STRING],labelThousandsSeparator:[(()=>{const e=_e(),t=1e3.toLocaleString();return t!==1e3.toString()?ue(t)[0]:"."===e?",":"."})(),Te.STRING],labelIdle:['Drag & Drop your files or Browse',Te.STRING],labelInvalidField:["Field contains invalid files",Te.STRING],labelFileWaitingForSize:["Waiting for size",Te.STRING],labelFileSizeNotAvailable:["Size not available",Te.STRING],labelFileCountSingular:["file in list",Te.STRING],labelFileCountPlural:["files in list",Te.STRING],labelFileLoading:["Loading",Te.STRING],labelFileAdded:["Added",Te.STRING],labelFileLoadError:["Error during load",Te.STRING],labelFileRemoved:["Removed",Te.STRING],labelFileRemoveError:["Error during remove",Te.STRING],labelFileProcessing:["Uploading",Te.STRING],labelFileProcessingComplete:["Upload complete",Te.STRING],labelFileProcessingAborted:["Upload cancelled",Te.STRING],labelFileProcessingError:["Error during upload",Te.STRING],labelFileProcessingRevertError:["Error during revert",Te.STRING],labelTapToCancel:["tap to cancel",Te.STRING],labelTapToRetry:["tap to retry",Te.STRING],labelTapToUndo:["tap to undo",Te.STRING],labelButtonRemoveItem:["Remove",Te.STRING],labelButtonAbortItemLoad:["Abort",Te.STRING],labelButtonRetryItemLoad:["Retry",Te.STRING],labelButtonAbortItemProcessing:["Cancel",Te.STRING],labelButtonUndoItemProcessing:["Undo",Te.STRING],labelButtonRetryItemProcessing:["Retry",Te.STRING],labelButtonProcessItem:["Upload",Te.STRING],iconRemove:['',Te.STRING],iconProcess:['',Te.STRING],iconRetry:['',Te.STRING],iconUndo:['',Te.STRING],iconDone:['',Te.STRING],oninit:[null,Te.FUNCTION],onwarning:[null,Te.FUNCTION],onerror:[null,Te.FUNCTION],onactivatefile:[null,Te.FUNCTION],onaddfilestart:[null,Te.FUNCTION],onaddfileprogress:[null,Te.FUNCTION],onaddfile:[null,Te.FUNCTION],onprocessfilestart:[null,Te.FUNCTION],onprocessfileprogress:[null,Te.FUNCTION],onprocessfileabort:[null,Te.FUNCTION],onprocessfilerevert:[null,Te.FUNCTION],onprocessfile:[null,Te.FUNCTION],onprocessfiles:[null,Te.FUNCTION],onremovefile:[null,Te.FUNCTION],onpreparefile:[null,Te.FUNCTION],onupdatefiles:[null,Te.FUNCTION],onreorderfiles:[null,Te.FUNCTION],beforeDropFile:[null,Te.FUNCTION],beforeAddFile:[null,Te.FUNCTION],beforeRemoveFile:[null,Te.FUNCTION],stylePanelLayout:[null,Te.STRING],stylePanelAspectRatio:[null,Te.STRING],styleItemPanelAspectRatio:[null,Te.STRING],styleButtonRemoveItemPosition:["left",Te.STRING],styleButtonProcessItemPosition:["right",Te.STRING],styleLoadIndicatorPosition:["right",Te.STRING],styleProgressIndicatorPosition:["right",Te.STRING],styleButtonRemoveItemAlign:[!1,Te.BOOLEAN],files:[[],Te.ARRAY]},Oe=(e,t)=>b(t)?e[0]||null:F(t)?e[t]||null:("object"==typeof t&&(t=t.id),e.find(e=>e.id===t)||null),De=e=>{if(b(e))return e;if(/:/.test(e)){const t=e.split(":");return t[1]/t[0]}return parseFloat(e)},Se=e=>e.filter(e=>!e.archived),ye={EMPTY:0,IDLE:1,ERROR:2,BUSY:3,READY:4},Ae=[pe.LOAD_ERROR,pe.PROCESSING_ERROR,pe.PROCESSING_REVERT_ERROR],Le=[pe.LOADING,pe.PROCESSING,pe.PROCESSING_QUEUED,pe.INIT],Pe=[pe.PROCESSING_COMPLETE],ve=e=>Ae.includes(e.status),Me=e=>Le.includes(e.status),be=e=>Pe.includes(e.status),Ce=e=>({GET_STATUS:()=>{const t=Se(e.items),{EMPTY:r,ERROR:o,BUSY:n,IDLE:s,READY:i}=ye;return 0===t.length?r:t.some(ve)?o:t.some(Me)?n:t.some(be)?i:s},GET_ITEM:t=>Oe(e.items,t),GET_ACTIVE_ITEM:t=>Oe(Se(e.items),t),GET_ACTIVE_ITEMS:()=>Se(e.items),GET_ITEMS:()=>e.items,GET_ITEM_NAME:t=>{const r=Oe(e.items,t);return r?r.filename:null},GET_ITEM_SIZE:t=>{const r=Oe(e.items,t);return r?r.fileSize:null},GET_STYLES:()=>Object.keys(e.options).filter(e=>/^style/.test(e)).map(t=>({name:t,value:e.options[t]})),GET_PANEL_ASPECT_RATIO:()=>{return/circle/.test(e.options.stylePanelLayout)?1:De(e.options.stylePanelAspectRatio)},GET_ITEM_PANEL_ASPECT_RATIO:()=>e.options.styleItemPanelAspectRatio,GET_ITEMS_BY_STATUS:t=>Se(e.items).filter(e=>e.status===t),GET_TOTAL_ITEMS:()=>Se(e.items).length,IS_ASYNC:()=>k(e.options.server)&&(k(e.options.server.process)||Y(e.options.server.process))}),Ne=(e,t,r)=>Math.max(Math.min(r,e),t),we=e=>/^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i.test(e),Ge=e=>e.split("/").pop().split("?").shift(),Ue=e=>e.split(".").pop(),Be=(e,t="")=>(t+e).slice(-t.length),qe=(e=new Date)=>`${e.getFullYear()}-${Be(e.getMonth()+1,"00")}-${Be(e.getDate(),"00")}_${Be(e.getHours(),"00")}-${Be(e.getMinutes(),"00")}-${Be(e.getSeconds(),"00")}`,Ve=(e,t,r=null,o=null)=>{const n="string"==typeof r?e.slice(0,e.size,r):e.slice(0,e.size,e.type);return n.lastModifiedDate=new Date,e._relativePath&&(n._relativePath=e._relativePath),U(t)||(t=qe()),t&&null===o&&Ue(t)?n.name=t:(o=o||(e=>{if("string"!=typeof e)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)?"jpeg"===t?"jpg":t:""})(n.type),n.name=t+(o?"."+o:"")),n},Fe=(e,t)=>{const r=(()=>window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder)();if(r){const o=new r;return o.append(e),o.getBlob(t)}return new Blob([e],{type:t})},xe=e=>(/^data:(.+);/.exec(e)||[])[1]||null,Ye=e=>{const t=xe(e);return((e,t)=>{const r=new ArrayBuffer(e.length),o=new Uint8Array(r);for(let t=0;tatob((e=>e.split(",")[1].replace(/\s/g,""))(e)))(e),t)},He=e=>{if(!/^content-disposition:/i.test(e))return null;const t=e.split(/filename=|filename\*=.+''/).splice(1).map(e=>e.trim().replace(/^["']|[;"']{0,2}$/g,"")).filter(e=>e.length);return t.length?decodeURI(t[t.length-1]):null},Xe=e=>{if(/content-length:/i.test(e)){const t=e.match(/[0-9]+/)[0];return t?parseInt(t,10):null}return null},ke=e=>{if(/x-content-transfer-id:/i.test(e)){return(e.split(":")[1]||"").trim()||null}return null},$e=e=>{const t={source:null,name:null,size:null},r=e.split("\n");for(let e of r){const r=He(e);if(r){t.name=r;continue}const o=Xe(e);if(o){t.size=o;continue}const n=ke(e);n&&(t.source=n)}return t},ze=e=>{const t={source:null,complete:!1,progress:0,size:null,timestamp:null,duration:0,request:null},r=r=>{e?(t.timestamp=Date.now(),t.request=e(r,e=>{t.duration=Date.now()-t.timestamp,t.complete=!0,e instanceof Blob&&(e=Ve(e,e.name||Ge(r))),o.fire("load",e instanceof Blob?e:e?e.body:null)},e=>{o.fire("error","string"==typeof e?{type:"error",code:0,body:e}:e)},(e,r,n)=>{n&&(t.size=n),t.duration=Date.now()-t.timestamp,e?(t.progress=r/n,o.fire("progress",t.progress)):t.progress=null},()=>{o.fire("abort")},e=>{const r=$e("string"==typeof e?e:e.headers);o.fire("meta",{size:t.size||r.size,filename:r.name,source:r.source})})):o.fire("error",{type:"error",body:"Can't load URL",code:400})},o={...ae(),setSource:e=>t.source=e,getProgress:()=>t.progress,abort:()=>{t.request&&t.request.abort&&t.request.abort()},load:()=>{const e=t.source;o.fire("init",e),e instanceof File?o.fire("load",e):e instanceof Blob?o.fire("load",Ve(e,e.name)):we(e)?o.fire("load",((e,t,r)=>Ve(Ye(e),t,null,r))(e)):r(e)}};return o},We=e=>/GET|HEAD/.test(e),je=(e,t,r)=>{const o={onheaders:()=>{},onprogress:()=>{},onload:()=>{},ontimeout:()=>{},onerror:()=>{},onabort:()=>{},abort:()=>{n=!0,i.abort()}};let n=!1,s=!1;r={method:"POST",headers:{},withCredentials:!1,...r},t=encodeURI(t),We(r.method)&&e&&(t=`${t}${encodeURIComponent("string"==typeof e?e:JSON.stringify(e))}`);const i=new XMLHttpRequest;return(We(r.method)?i:i.upload).onprogress=(e=>{n||o.onprogress(e.lengthComputable,e.loaded,e.total)}),i.onreadystatechange=(()=>{i.readyState<2||4===i.readyState&&0===i.status||s||(s=!0,o.onheaders(i))}),i.onload=(()=>{i.status>=200&&i.status<300?o.onload(i):o.onerror(i)}),i.onerror=(()=>o.onerror(i)),i.onabort=(()=>{n=!0,o.onabort()}),i.ontimeout=(()=>o.ontimeout(i)),i.open(r.method,t,!0),F(r.timeout)&&(i.timeout=r.timeout),Object.keys(r.headers).forEach(e=>{const t=unescape(encodeURIComponent(r.headers[e]));i.setRequestHeader(e,t)}),r.responseType&&(i.responseType=r.responseType),r.withCredentials&&(i.withCredentials=!0),i.send(e),o},Qe=(e,t,r,o)=>({type:e,code:t,body:r,headers:o}),Ze=e=>t=>{e(Qe("error",0,"Timeout",t.getAllResponseHeaders()))},Ke=e=>/\?/.test(e),Je=(...e)=>{let t="";return e.forEach(e=>{t+=Ke(t)&&Ke(e)?e.replace(/\?/,"&"):e}),t},et=(e="",t)=>{if("function"==typeof t)return t;if(!t||!U(t.url))return null;const r=t.onload||(e=>e),o=t.onerror||(e=>null);return(n,s,i,a,l,c)=>{const d=je(n,Je(e,t.url),{...t,responseType:"blob"});return d.onload=(e=>{const o=e.getAllResponseHeaders(),i=$e(o).name||Ge(n);s(Qe("load",e.status,"HEAD"===t.method?null:Ve(r(e.response),i),o))}),d.onerror=(e=>{i(Qe("error",e.status,o(e.response)||e.statusText,e.getAllResponseHeaders()))}),d.onheaders=(e=>{c(Qe("headers",e.status,null,e.getAllResponseHeaders()))}),d.ontimeout=Ze(i),d.onprogress=a,d.onabort=l,d}},tt=0,rt=1,ot=2,nt=3,st=4,it=(e,t,r,o,n,s,i,a,l,c,d)=>{const p=[],{chunkTransferId:E,chunkServer:u,chunkSize:_,chunkRetryDelays:T}=d,f={serverId:E,aborted:!1},I=t.ondata||(e=>e),m=t.onload||((e,t)=>"HEAD"===t?e.getResponseHeader("Upload-Offset"):e.response),R=t.onerror||(e=>null),h=Math.floor(o.size/_);for(let e=0;e<=h;e++){const t=e*_,r=o.slice(t,t+_,"application/offset+octet-stream");p[e]={index:e,size:r.size,offset:t,data:r,file:o,progress:0,retries:[...T],status:tt,error:null,request:null,timeout:null}}const g=e=>e.status===tt||e.status===nt,O=t=>{if(f.aborted)return;if(!(t=t||p.find(g)))return void(p.every(e=>e.status===rt)&&(()=>s(f.serverId))());t.status=ot,t.progress=null;const r=u.ondata||(e=>e),n=u.onerror||(e=>null),a=Je(e,u.url,f.serverId),c="function"==typeof u.headers?u.headers(t):{...u.headers,"Content-Type":"application/offset+octet-stream","Upload-Offset":t.offset,"Upload-Length":o.size,"Upload-Name":o.name},d=t.request=je(r(t.data),a,{...u,headers:c});d.onload=(()=>{t.status=rt,t.request=null,y()}),d.onprogress=((e,r,o)=>{t.progress=e?r:null,S()}),d.onerror=(e=>{t.status=nt,t.request=null,t.error=n(e.response)||e.statusText,D(t)||i(Qe("error",e.status,n(e.response)||e.statusText,e.getAllResponseHeaders()))}),d.ontimeout=(e=>{t.status=nt,t.request=null,D(t)||Ze(i)(e)}),d.onabort=(()=>{t.status=tt,t.request=null,l()})},D=e=>0!==e.retries.length&&(e.status=st,clearTimeout(e.timeout),e.timeout=setTimeout(()=>{O(e)},e.retries.shift()),!0),S=()=>{const e=p.reduce((e,t)=>null===e||null===t.progress?null:e+t.progress,0);if(null===e)return a(!1,0,0);const t=p.reduce((e,t)=>e+t.size,0);a(!0,e,t)},y=()=>{p.filter(e=>e.status===ot).length>=1||O()};return f.serverId?(r=>{const o=Je(e,u.url,f.serverId),n={headers:"function"==typeof t.headers?t.headers(f.serverId):{...t.headers},method:"HEAD"},s=je(null,o,n);s.onload=(e=>r(m(e,n.method))),s.onerror=(e=>i(Qe("error",e.status,R(e.response)||e.statusText,e.getAllResponseHeaders()))),s.ontimeout=Ze(i)})(e=>{f.aborted||(p.filter(t=>t.offset{e.status=rt,e.progress=e.size}),y())}):(s=>{const a=new FormData;k(n)&&a.append(r,JSON.stringify(n));const l="function"==typeof t.headers?t.headers(o,n):{...t.headers,"Upload-Length":o.size},c={...t,headers:l},d=je(I(a),Je(e,t.url),c);d.onload=(e=>s(m(e,c.method))),d.onerror=(e=>i(Qe("error",e.status,R(e.response)||e.statusText,e.getAllResponseHeaders()))),d.ontimeout=Ze(i)})(e=>{f.aborted||(c(e),f.serverId=e,y())}),{abort:()=>{f.aborted=!0,p.forEach(e=>{clearTimeout(e.timeout),e.request&&e.request.abort()})}}},at=(e="",t,r,o)=>"function"==typeof t?(...e)=>t(r,...e,o):t&&U(t.url)?((e,t,r,o)=>(n,s,i,a,l,c,d)=>{if(!n)return;const p=o.chunkUploads,E=p&&n.size>o.chunkSize,u=p&&(E||o.chunkForce);if(n instanceof Blob&&u)return it(e,t,r,n,s,i,a,l,c,d,o);const _=t.ondata||(e=>e),T=t.onload||(e=>e),f=t.onerror||(e=>null);var I=new FormData;k(s)&&I.append(r,JSON.stringify(s)),(n instanceof Blob?[{name:null,file:n}]:n).forEach(e=>{I.append(r,e.file,null===e.name?e.file.name:`${e.name}${e.file.name}`)});const m=je(_(I),Je(e,t.url),t);return m.onload=(e=>{i(Qe("load",e.status,T(e.response),e.getAllResponseHeaders()))}),m.onerror=(e=>{a(Qe("error",e.status,f(e.response)||e.statusText,e.getAllResponseHeaders()))}),m.ontimeout=Ze(a),m.onprogress=l,m.onabort=c,m})(e,t,r,o):null,lt=(e="",t)=>{if("function"==typeof t)return t;if(!t||!U(t.url))return(e,t)=>t();const r=t.onload||(e=>e),o=t.onerror||(e=>null);return(n,s,i)=>{const a=je(n,e+t.url,t);return a.onload=(e=>{s(Qe("load",e.status,r(e.response),e.getAllResponseHeaders()))}),a.onerror=(e=>{i(Qe("error",e.status,o(e.response)||e.statusText,e.getAllResponseHeaders()))}),a.ontimeout=Ze(i),a}},ct=(e=0,t=1)=>e+Math.random()*(t-e),dt=e=>{const t={complete:!1,perceivedProgress:0,perceivedPerformanceUpdater:null,progress:null,timestamp:null,perceivedDuration:0,duration:0,request:null,response:null},r=()=>{t.request&&(t.perceivedPerformanceUpdater.clear(),t.request.abort(),t.complete=!0)},o={...ae(),process:(r,n)=>{const s=()=>{0!==t.duration&&null!==t.progress&&o.fire("progress",o.getProgress())},i=()=>{t.complete=!0,o.fire("load-perceived",t.response.body)};o.fire("start"),t.timestamp=Date.now(),t.perceivedPerformanceUpdater=((e,t=1e3,r=0,o=25,n=250)=>{let s=null;const i=Date.now(),a=()=>{let r=Date.now()-i,l=ct(o,n);r+l>t&&(l=r+l-t);let c=r/t;c>=1?e(1):(e(c),s=setTimeout(a,l))};return a(),{clear:()=>{clearTimeout(s)}}})(e=>{t.perceivedProgress=e,t.perceivedDuration=Date.now()-t.timestamp,s(),t.response&&1===t.perceivedProgress&&!t.complete&&i()},ct(750,1500)),t.request=e(r,n,e=>{t.response=k(e)?e:{type:"load",code:200,body:`${e}`,headers:{}},t.duration=Date.now()-t.timestamp,t.progress=1,o.fire("load",t.response.body),1===t.perceivedProgress&&i()},e=>{t.perceivedPerformanceUpdater.clear(),o.fire("error",k(e)?e:{type:"error",code:0,body:`${e}`})},(e,r,o)=>{t.duration=Date.now()-t.timestamp,t.progress=e?r/o:null,s()},()=>{t.perceivedPerformanceUpdater.clear(),o.fire("abort",t.response?t.response.body:null)},e=>{o.fire("transfer",e)})},abort:r,getProgress:()=>t.progress?Math.min(t.progress,t.perceivedProgress):null,getDuration:()=>Math.min(t.duration,t.perceivedDuration),reset:()=>{r(),t.complete=!1,t.perceivedProgress=0,t.progress=0,t.timestamp=null,t.perceivedDuration=0,t.duration=0,t.request=null,t.response=null}};return o},pt=e=>e.substr(0,e.lastIndexOf("."))||e,Et=e=>!!(e instanceof File||e instanceof Blob&&e.name),ut=e=>{if(!k(e))return e;const t=M(e)?[]:{};for(const r in e){if(!e.hasOwnProperty(r))continue;const o=e[r];t[r]=o&&k(o)?ut(o):o}return t},_t=(e=null,r=null,o=null)=>{const n=se(),s={archived:!1,frozen:!1,released:!1,source:null,file:o,serverFileReference:r,transferId:null,processingAborted:!1,status:r?pe.PROCESSING_COMPLETE:pe.INIT,activeLoader:null,activeProcessor:null};let i=null;const a={},l=e=>s.status=e,c=(e,...t)=>{s.released||s.frozen||E.fire(e,...t)},d=(e,t)=>{if(s.processingAborted)return void(s.processingAborted=!1);if(l(pe.PROCESSING),i=null,!(s.file instanceof Blob))return void E.on("load",()=>{d(e,t)});e.on("load",e=>{s.transferId=null,s.serverFileReference=e}),e.on("transfer",e=>{s.transferId=e}),e.on("load-perceived",e=>{s.activeProcessor=null,s.transferId=null,s.serverFileReference=e,l(pe.PROCESSING_COMPLETE),c("process-complete",e)}),e.on("start",()=>{c("process-start")}),e.on("error",e=>{s.activeProcessor=null,l(pe.PROCESSING_ERROR),c("process-error",e)}),e.on("abort",e=>{s.activeProcessor=null,s.transferId=null,s.serverFileReference=e,l(pe.IDLE),c("process-abort"),i&&i()}),e.on("progress",e=>{c("process-progress",e)});const r=console.error;t(s.file,t=>{s.archived||e.process(t,{...a})},r),s.activeProcessor=e},p=(e,t,r)=>{const o=e.split("."),n=o[0],s=o.pop();let i=a;o.forEach(e=>i=i[e]),JSON.stringify(i[s])!==JSON.stringify(t)&&(i[s]=t,r||c("metadata-update",{key:n,value:a[n]}))},E={id:{get:()=>n},origin:{get:()=>e},serverId:{get:()=>s.serverFileReference},transferId:{get:()=>s.transferId},status:{get:()=>s.status},filename:{get:()=>s.file.name},filenameWithoutExtension:{get:()=>pt(s.file.name)},fileExtension:{get:()=>Ue(s.file.name)},fileType:{get:()=>s.file.type},fileSize:{get:()=>s.file.size},file:{get:()=>s.file},relativePath:{get:()=>s.file._relativePath},source:{get:()=>s.source},getMetadata:e=>ut(e?a[e]:a),setMetadata:(e,t,r)=>{if(k(e)){const r=e;return Object.keys(r).forEach(e=>{p(e,r[e],t)}),e}return p(e,t,r),t},extend:(e,t)=>u[e]=t,abortLoad:()=>{s.activeLoader?s.activeLoader.abort():(l(pe.INIT),c("load-abort"))},retryLoad:()=>{s.activeLoader&&s.activeLoader.load()},requestProcessing:()=>{s.processingAborted=!1,l(pe.PROCESSING_QUEUED)},abortProcessing:()=>new Promise(e=>{if(!s.activeProcessor)return s.processingAborted=!0,l(pe.IDLE),c("process-abort"),void e();i=(()=>{e()}),s.activeProcessor.abort()}),load:(t,r,o)=>{s.source=t,s.file?c("load-skip"):(s.file=(e=>{let t=[e.name,e.size,e.type];return e instanceof Blob||we(e)?t[0]=e.name||qe():we(e)?(t[1]=e.length,t[2]=xe(e)):U(e)&&(t[0]=Ge(e),t[1]=0,t[2]="application/octet-stream"),{name:t[0],size:t[1],type:t[2]}})(t),r.on("init",()=>{c("load-init")}),r.on("meta",t=>{s.file.size=t.size,s.file.filename=t.filename,t.source&&(e=Ee.LIMBO,s.serverFileReference=t.source,s.status=pe.PROCESSING_COMPLETE),c("load-meta")}),r.on("progress",e=>{l(pe.LOADING),c("load-progress",e)}),r.on("error",e=>{l(pe.LOAD_ERROR),c("load-request-error",e)}),r.on("abort",()=>{l(pe.INIT),c("load-abort")}),r.on("load",t=>{s.activeLoader=null;const r=t=>{s.file=Et(t)?t:s.file,e===Ee.LIMBO&&s.serverFileReference?l(pe.PROCESSING_COMPLETE):l(pe.IDLE),c("load")};s.serverFileReference?r(t):o(t,r,e=>{s.file=t,c("load-meta"),l(pe.LOAD_ERROR),c("load-file-error",e)})}),r.setSource(t),s.activeLoader=r,r.load())},process:d,revert:(e,t)=>new Promise((r,o)=>{null!==s.serverFileReference?(e(s.serverFileReference,()=>{s.serverFileReference=null,r()},e=>{t?(l(pe.PROCESSING_REVERT_ERROR),c("process-revert-error"),o(e)):r()}),l(pe.IDLE),c("process-revert")):r()}),...ae(),freeze:()=>s.frozen=!0,release:()=>s.released=!0,released:{get:()=>s.released},archive:()=>s.archived=!0,archived:{get:()=>s.archived}},u=t(E);return u},Tt=(e,t)=>{const r=((e,t)=>b(t)?0:U(t)?e.findIndex(e=>e.id===t):-1)(e,t);if(!(r<0))return e[r]||null},ft=(e,t,r,o,n,s)=>{const i=je(null,e,{method:"GET",responseType:"blob"});return i.onload=(r=>{const o=r.getAllResponseHeaders(),n=$e(o).name||Ge(e);t(Qe("load",r.status,Ve(r.response,n),o))}),i.onerror=(e=>{r(Qe("error",e.status,e.statusText,e.getAllResponseHeaders()))}),i.onheaders=(e=>{s(Qe("headers",e.status,null,e.getAllResponseHeaders()))}),i.ontimeout=Ze(r),i.onprogress=o,i.onabort=n,i},It=e=>(0===e.indexOf("//")&&(e=location.protocol+e),e.toLowerCase().replace("blob:","").replace(/([a-z])?:\/\//,"$1").split("/")[0]),mt=e=>(...t)=>Y(e)?e(...t):e,Rt=(e,t)=>{clearTimeout(t.listUpdateTimeout),t.listUpdateTimeout=setTimeout(()=>{e("DID_UPDATE_ITEMS",{items:Se(t.items)})},0)},ht=(e,...t)=>new Promise(r=>{if(!e)return r(!0);const o=e(...t);return null==o?r(!0):"boolean"==typeof o?r(o):void("function"==typeof o.then&&o.then(r))}),gt=(e,t)=>{e.items.sort((e,r)=>t(de(e),de(r)))},Ot=(e,t)=>({query:r,success:o=(()=>{}),failure:n=(()=>{})}={})=>{const s=Oe(e.items,r);s?t(s,o,n):n({error:Qe("error",0,"Item not found"),file:null})},Dt=(t,r,o)=>({ABORT_ALL:()=>{Se(o.items).forEach(e=>{e.freeze(),e.abortLoad(),e.abortProcessing()})},DID_SET_FILES:({value:e=[]})=>{const r=e.map(e=>({source:e.source?e.source:e,options:e.options}));let n=Se(o.items);n.forEach(e=>{r.find(t=>t.source===e.source||t.source===e.file)||t("REMOVE_ITEM",{query:e})}),n=Se(o.items),r.forEach((e,r)=>{n.find(t=>t.source===e.source||t.file===e.source)||t("ADD_ITEM",{...e,interactionMethod:ne,index:r})})},DID_UPDATE_ITEM_METADATA:({id:e})=>{clearTimeout(o.itemUpdateTimeout),o.itemUpdateTimeout=setTimeout(()=>{const n=Tt(o.items,e);if(!r("IS_ASYNC"))return void Ie("SHOULD_PREPARE_OUTPUT",!1,{item:n,query:r}).then(r=>{r&&t("REQUEST_PREPARE_OUTPUT",{query:e,item:n,success:r=>{t("DID_PREPARE_OUTPUT",{id:e,file:r})}},!0)});const s=()=>{setTimeout(()=>{t("REQUEST_ITEM_PROCESSING",{query:e})},32)};return n.status===pe.PROCESSING_COMPLETE?(e=>{n.revert(lt(o.options.server.url,o.options.server.revert),r("GET_FORCE_REVERT")).then(e?s:()=>{}).catch(()=>{})})(o.options.instantUpload):n.status===pe.PROCESSING?(e=>{n.abortProcessing().then(e?s:()=>{})})(o.options.instantUpload):void(o.options.instantUpload&&s())},0)},MOVE_ITEM:({query:e,index:t})=>{const r=Oe(o.items,e);if(!r)return;const n=o.items.indexOf(r);n!==(t=Ne(t,0,o.items.length-1))&&o.items.splice(t,0,o.items.splice(n,1)[0])},SORT:({compare:e})=>{gt(o,e),t("DID_SORT_ITEMS",{items:r("GET_ACTIVE_ITEMS")})},ADD_ITEMS:({items:e,index:o,interactionMethod:n,success:s=(()=>{}),failure:i=(()=>{})})=>{let a=o;if(-1===o||void 0===o){const e=r("GET_ITEM_INSERT_LOCATION"),t=r("GET_TOTAL_ITEMS");a="before"===e?0:t}const l=r("GET_IGNORED_FILES"),c=e.filter(e=>Et(e)?!l.includes(e.name.toLowerCase()):!b(e)).map(e=>new Promise((r,o)=>{t("ADD_ITEM",{interactionMethod:n,source:e.source||e,success:r,failure:o,index:a++,options:e.options||{}})}));Promise.all(c).then(s).catch(i)},ADD_ITEM:({source:e,index:n=-1,interactionMethod:s,success:i=(()=>{}),failure:a=(()=>{}),options:l={}})=>{if(b(e))return void a({error:Qe("error",0,"No source"),file:null});if(Et(e)&&o.options.ignoredFiles.includes(e.name.toLowerCase()))return;if(!(e=>{const t=Se(e.items).length;if(!e.options.allowMultiple)return 0===t;const r=e.options.maxFiles;return null===r||t{d&&t("ADD_ITEM",{source:e,index:n,interactionMethod:s,success:i,failure:a,options:l})}).catch(()=>{}),d)return}t("REMOVE_ITEM",{query:c.id})}const c="local"===l.type?Ee.LOCAL:"limbo"===l.type?Ee.LIMBO:Ee.INPUT,d=_t(c,c===Ee.INPUT?null:e,l.file);Object.keys(l.metadata||{}).forEach(e=>{d.setMetadata(e,l.metadata[e])}),me("DID_CREATE_ITEM",d,{query:r,dispatch:t});const p=r("GET_ITEM_INSERT_LOCATION");o.options.itemInsertLocationFreedom||(n="before"===p?-1:o.items.length),((e,t,r)=>b(t)?null:void 0===r?(e.push(t),t):(((e,t,r)=>e.splice(t,0,r))(e,r=Ne(r,0,e.length),t),t))(o.items,d,n),Y(p)&&e&>(o,p);const E=d.id;d.on("load-init",()=>{t("DID_START_ITEM_LOAD",{id:E})}),d.on("load-meta",()=>{t("DID_UPDATE_ITEM_META",{id:E})}),d.on("load-progress",e=>{t("DID_UPDATE_ITEM_LOAD_PROGRESS",{id:E,progress:e})}),d.on("load-request-error",e=>{const r=mt(o.options.labelFileLoadError)(e);if(e.code>=400&&e.code<500)return t("DID_THROW_ITEM_INVALID",{id:E,error:e,status:{main:r,sub:`${e.code} (${e.body})`}}),void a({error:e,file:de(d)});t("DID_THROW_ITEM_LOAD_ERROR",{id:E,error:e,status:{main:r,sub:o.options.labelTapToRetry}})}),d.on("load-file-error",e=>{t("DID_THROW_ITEM_INVALID",{id:E,error:e.status,status:e.status}),a({error:e.status,file:de(d)})}),d.on("load-abort",()=>{t("REMOVE_ITEM",{query:E})}),d.on("load-skip",()=>{t("COMPLETE_LOAD_ITEM",{query:E,item:d,data:{source:e,success:i}})}),d.on("load",()=>{const n=n=>{n?(d.on("metadata-update",e=>{t("DID_UPDATE_ITEM_METADATA",{id:E,change:e})}),Ie("SHOULD_PREPARE_OUTPUT",!1,{item:d,query:r}).then(r=>{const n=()=>{t("COMPLETE_LOAD_ITEM",{query:E,item:d,data:{source:e,success:i}}),Rt(t,o)};r?t("REQUEST_PREPARE_OUTPUT",{query:E,item:d,success:e=>{t("DID_PREPARE_OUTPUT",{id:E,file:e}),n()}},!0):n()})):t("REMOVE_ITEM",{query:E})};Ie("DID_LOAD_ITEM",d,{query:r,dispatch:t}).then(()=>{ht(r("GET_BEFORE_ADD_FILE"),de(d)).then(n)}).catch(()=>{n(!1)})}),d.on("process-start",()=>{t("DID_START_ITEM_PROCESSING",{id:E})}),d.on("process-progress",e=>{t("DID_UPDATE_ITEM_PROCESS_PROGRESS",{id:E,progress:e})}),d.on("process-error",e=>{t("DID_THROW_ITEM_PROCESSING_ERROR",{id:E,error:e,status:{main:mt(o.options.labelFileProcessingError)(e),sub:o.options.labelTapToRetry}})}),d.on("process-revert-error",e=>{t("DID_THROW_ITEM_PROCESSING_REVERT_ERROR",{id:E,error:e,status:{main:mt(o.options.labelFileProcessingRevertError)(e),sub:o.options.labelTapToRetry}})}),d.on("process-complete",e=>{t("DID_COMPLETE_ITEM_PROCESSING",{id:E,error:null,serverFileReference:e}),t("DID_DEFINE_VALUE",{id:E,value:e})}),d.on("process-abort",()=>{t("DID_ABORT_ITEM_PROCESSING",{id:E})}),d.on("process-revert",()=>{t("DID_REVERT_ITEM_PROCESSING",{id:E}),t("DID_DEFINE_VALUE",{id:E,value:null})}),t("DID_ADD_ITEM",{id:E,index:n,interactionMethod:s}),Rt(t,o);const{url:u,load:_,restore:T,fetch:f}=o.options.server||{};d.load(e,ze(c===Ee.INPUT?U(e)&&(e=>(e.indexOf(":")>-1||e.indexOf("//")>-1)&&It(location.href)!==It(e))(e)?et(u,f):ft:et(u,c===Ee.LIMBO?T:_)),(e,t,o)=>{Ie("LOAD_FILE",e,{query:r}).then(t).catch(o)})},REQUEST_PREPARE_OUTPUT:({item:e,success:t,failure:o=(()=>{})})=>{const n={error:Qe("error",0,"Item not found"),file:null};if(e.archived)return o(n);Ie("PREPARE_OUTPUT",e.file,{query:r,item:e}).then(s=>{Ie("COMPLETE_PREPARE_OUTPUT",s,{query:r,item:e}).then(r=>{if(e.archived)return o(n);t(r)})})},COMPLETE_LOAD_ITEM:({item:e,data:n})=>{const{success:s,source:i}=n,a=r("GET_ITEM_INSERT_LOCATION");if(Y(a)&&i&>(o,a),t("DID_LOAD_ITEM",{id:e.id,error:null,serverFileReference:e.origin===Ee.INPUT?null:i}),s(de(e)),e.origin!==Ee.LOCAL)return e.origin===Ee.LIMBO?(t("DID_COMPLETE_ITEM_PROCESSING",{id:e.id,error:null,serverFileReference:i}),void t("DID_DEFINE_VALUE",{id:e.id,value:i})):void(r("IS_ASYNC")&&o.options.instantUpload&&t("REQUEST_ITEM_PROCESSING",{query:e.id}));t("DID_LOAD_LOCAL_ITEM",{id:e.id})},RETRY_ITEM_LOAD:Ot(o,e=>{e.retryLoad()}),REQUEST_ITEM_PREPARE:Ot(o,(e,r,o)=>{t("REQUEST_PREPARE_OUTPUT",{query:e.id,item:e,success:o=>{t("DID_PREPARE_OUTPUT",{id:e.id,file:o}),r({file:e,output:o})},failure:o},!0)}),REQUEST_ITEM_PROCESSING:Ot(o,(e,n,s)=>{if(e.status===pe.IDLE||e.status===pe.PROCESSING_ERROR)e.status!==pe.PROCESSING_QUEUED&&(e.requestProcessing(),t("DID_REQUEST_ITEM_PROCESSING",{id:e.id}),t("PROCESS_ITEM",{query:e,success:n,failure:s},!0));else{const i=()=>{setTimeout(()=>{t("REQUEST_ITEM_PROCESSING",{query:e,success:n,failure:s})},32)};e.status===pe.PROCESSING_COMPLETE||e.status===pe.PROCESSING_REVERT_ERROR?e.revert(lt(o.options.server.url,o.options.server.revert),r("GET_FORCE_REVERT")).then(i).catch(()=>{}):e.status===pe.PROCESSING&&e.abortProcessing().then(i)}}),PROCESS_ITEM:Ot(o,(e,n,s)=>{const i=r("GET_MAX_PARALLEL_UPLOADS");if(r("GET_ITEMS_BY_STATUS",pe.PROCESSING).length===i)return void o.processingQueue.push({id:e.id,success:n,failure:s});if(e.status===pe.PROCESSING)return;const a=()=>{const e=o.processingQueue.shift();if(!e)return;const{id:r,success:n,failure:s}=e,i=Oe(o.items,r);i&&!i.archived?t("PROCESS_ITEM",{query:r,success:n,failure:s},!0):a()};e.onOnce("process-complete",()=>{n(de(e)),a(),r("GET_ITEMS_BY_STATUS",pe.PROCESSING_COMPLETE).length===o.items.length&&t("DID_COMPLETE_ITEM_PROCESSING_ALL")}),e.onOnce("process-error",t=>{s({error:t,file:de(e)}),a()});const l=o.options;e.process(dt(at(l.server.url,l.server.process,l.name,{chunkTransferId:e.transferId,chunkServer:l.server.patch,chunkUploads:l.chunkUploads,chunkForce:l.chunkForce,chunkSize:l.chunkSize,chunkRetryDelays:l.chunkRetryDelays})),(o,n,s)=>{Ie("PREPARE_OUTPUT",o,{query:r,item:e}).then(r=>{t("DID_PREPARE_OUTPUT",{id:e.id,file:r}),n(r)}).catch(s)})}),RETRY_ITEM_PROCESSING:Ot(o,e=>{t("REQUEST_ITEM_PROCESSING",{query:e})}),REQUEST_REMOVE_ITEM:Ot(o,e=>{ht(r("GET_BEFORE_REMOVE_FILE"),de(e)).then(r=>{r&&t("REMOVE_ITEM",{query:e})})}),RELEASE_ITEM:Ot(o,e=>{e.release()}),REMOVE_ITEM:Ot(o,(e,r)=>{const n=()=>{const n=e.id;Tt(o.items,n).archive(),t("DID_REMOVE_ITEM",{error:null,id:n,item:e}),Rt(t,o),r(de(e))},s=o.options.server;e.origin===Ee.LOCAL&&s&&Y(s.remove)?(t("DID_START_ITEM_REMOVE",{id:e.id}),s.remove(e.source,()=>n(),r=>{t("DID_THROW_ITEM_REMOVE_ERROR",{id:e.id,error:Qe("error",0,r,null),status:{main:mt(o.options.labelFileRemoveError)(r),sub:o.options.labelTapToRetry}})})):n()}),ABORT_ITEM_LOAD:Ot(o,e=>{e.abortLoad()}),ABORT_ITEM_PROCESSING:Ot(o,e=>{e.serverId?t("REVERT_ITEM_PROCESSING",{id:e.id}):e.abortProcessing().then(()=>{o.options.instantUpload&&t("REMOVE_ITEM",{query:e.id})})}),REQUEST_REVERT_ITEM_PROCESSING:Ot(o,e=>{if(!o.options.instantUpload)return void t("REVERT_ITEM_PROCESSING",{query:e});const n=r=>{r&&t("REVERT_ITEM_PROCESSING",{query:e})},s=r("GET_BEFORE_REMOVE_FILE");if(!s)return n(!0);const i=s(de(e));return null==i?n(!0):"boolean"==typeof i?n(i):void("function"==typeof i.then&&i.then(n))}),REVERT_ITEM_PROCESSING:Ot(o,e=>{e.revert(lt(o.options.server.url,o.options.server.revert),r("GET_FORCE_REVERT")).then(()=>{(o.options.instantUpload||(e=>!Et(e.file))(e))&&t("REMOVE_ITEM",{query:e.id})}).catch(()=>{})}),SET_OPTIONS:({options:r})=>{e(r,(e,r)=>{t(`SET_${Q(e,"_").toUpperCase()}`,{value:r})})}}),St=e=>e,yt=e=>document.createElement(e),At=(e,t)=>{let r=e.childNodes[0];r?t!==r.nodeValue&&(r.nodeValue=t):(r=document.createTextNode(t),e.appendChild(r))},Lt=(e,t,r,o)=>{const n=(o%360-90)*Math.PI/180;return{x:e+r*Math.cos(n),y:t+r*Math.sin(n)}},Pt=(e,t,r,o,n)=>{let s=1;return n>o&&n-o<=.5&&(s=0),o>n&&o-n>=.5&&(s=0),((e,t,r,o,n,s)=>{const i=Lt(e,t,r,n),a=Lt(e,t,r,o);return["M",i.x,i.y,"A",r,r,0,s,0,a.x,a.y].join(" ")})(e,t,r,360*Math.min(.9999,o),360*Math.min(.9999,n),s)},vt=A({tag:"div",name:"progress-indicator",ignoreRectUpdate:!0,ignoreRect:!0,create:({root:e,props:t})=>{t.spin=!1,t.progress=0,t.opacity=0;const r=s("svg");e.ref.path=s("path",{"stroke-width":2,"stroke-linecap":"round"}),r.appendChild(e.ref.path),e.ref.svg=r,e.appendChild(r)},write:({root:e,props:t})=>{if(0===t.opacity)return;t.align&&(e.element.dataset.align=t.align);const o=parseInt(r(e.ref.path,"stroke-width"),10),n=.5*e.rect.element.width;let s=0,i=0;t.spin?(s=0,i=.5):(s=0,i=t.progress);const a=Pt(n,n,n-o,s,i);r(e.ref.path,"d",a),r(e.ref.path,"stroke-opacity",t.spin||t.progress>0?1:0)},mixins:{apis:["progress","spin","align"],styles:["opacity"],animations:{opacity:{type:"tween",duration:500},progress:{type:"spring",stiffness:.95,damping:.65,mass:10}}}}),Mt=A({tag:"button",attributes:{type:"button"},ignoreRect:!0,ignoreRectUpdate:!0,name:"file-action-button",mixins:{apis:["label"],styles:["translateX","translateY","scaleX","scaleY","opacity"],animations:{scaleX:"spring",scaleY:"spring",translateX:"spring",translateY:"spring",opacity:{type:"tween",duration:250}},listeners:!0},create:({root:e,props:t})=>{e.element.innerHTML=(t.icon||"")+`${t.label}`,t.isDisabled=!1},write:({root:e,props:t})=>{const{isDisabled:o}=t,n=e.query("GET_DISABLED")||0===t.opacity;n&&!o?(t.isDisabled=!0,r(e.element,"disabled","disabled")):!n&&o&&(t.isDisabled=!1,e.element.removeAttribute("disabled"))}}),bt=(e,t=".")=>(e=Math.round(Math.abs(e)))<1e3?`${e} bytes`:ee.toFixed(t).split(".").filter(e=>"0"!==e).join(r),Ut=({root:e,props:t})=>{At(e.ref.fileSize,bt(e.query("GET_ITEM_SIZE",t.id))),At(e.ref.fileName,St(e.query("GET_ITEM_NAME",t.id)))},Bt=({root:e,props:t})=>{F(e.query("GET_ITEM_SIZE",t.id))||At(e.ref.fileSize,e.query("GET_LABEL_FILE_SIZE_NOT_AVAILABLE"))},qt=A({name:"file-info",ignoreRect:!0,ignoreRectUpdate:!0,write:L({DID_LOAD_ITEM:Ut,DID_UPDATE_ITEM_META:Ut,DID_THROW_ITEM_LOAD_ERROR:Bt,DID_THROW_ITEM_INVALID:Bt}),didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},create:({root:e,props:t})=>{const o=yt("span");o.className="filepond--file-info-main",r(o,"aria-hidden","true"),e.appendChild(o),e.ref.fileName=o;const n=yt("span");n.className="filepond--file-info-sub",e.appendChild(n),e.ref.fileSize=n,At(n,e.query("GET_LABEL_FILE_WAITING_FOR_SIZE")),At(o,St(e.query("GET_ITEM_NAME",t.id)))},mixins:{styles:["translateX","translateY"],animations:{translateX:"spring",translateY:"spring"}}}),Vt=e=>Math.round(100*e),Ft=({root:e,action:t})=>{const r=null===t.progress?e.query("GET_LABEL_FILE_LOADING"):`${e.query("GET_LABEL_FILE_LOADING")} ${Vt(t.progress)}%`;At(e.ref.main,r),At(e.ref.sub,e.query("GET_LABEL_TAP_TO_CANCEL"))},xt=({root:e})=>{At(e.ref.main,""),At(e.ref.sub,"")},Yt=({root:e,action:t})=>{At(e.ref.main,t.status.main),At(e.ref.sub,t.status.sub)},Ht=A({name:"file-status",ignoreRect:!0,ignoreRectUpdate:!0,write:L({DID_LOAD_ITEM:xt,DID_REVERT_ITEM_PROCESSING:xt,DID_REQUEST_ITEM_PROCESSING:({root:e})=>{At(e.ref.main,e.query("GET_LABEL_FILE_PROCESSING")),At(e.ref.sub,e.query("GET_LABEL_TAP_TO_CANCEL"))},DID_ABORT_ITEM_PROCESSING:({root:e})=>{At(e.ref.main,e.query("GET_LABEL_FILE_PROCESSING_ABORTED")),At(e.ref.sub,e.query("GET_LABEL_TAP_TO_RETRY"))},DID_COMPLETE_ITEM_PROCESSING:({root:e})=>{At(e.ref.main,e.query("GET_LABEL_FILE_PROCESSING_COMPLETE")),At(e.ref.sub,e.query("GET_LABEL_TAP_TO_UNDO"))},DID_UPDATE_ITEM_PROCESS_PROGRESS:({root:e,action:t})=>{const r=null===t.progress?e.query("GET_LABEL_FILE_PROCESSING"):`${e.query("GET_LABEL_FILE_PROCESSING")} ${Vt(t.progress)}%`;At(e.ref.main,r),At(e.ref.sub,e.query("GET_LABEL_TAP_TO_CANCEL"))},DID_UPDATE_ITEM_LOAD_PROGRESS:Ft,DID_THROW_ITEM_LOAD_ERROR:Yt,DID_THROW_ITEM_INVALID:Yt,DID_THROW_ITEM_PROCESSING_ERROR:Yt,DID_THROW_ITEM_PROCESSING_REVERT_ERROR:Yt,DID_THROW_ITEM_REMOVE_ERROR:Yt}),didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},create:({root:e})=>{const t=yt("span");t.className="filepond--file-status-main",e.appendChild(t),e.ref.main=t;const r=yt("span");r.className="filepond--file-status-sub",e.appendChild(r),e.ref.sub=r,Ft({root:e,action:{progress:null}})},mixins:{styles:["translateX","translateY","opacity"],animations:{opacity:{type:"tween",duration:250},translateX:"spring",translateY:"spring"}}}),Xt={AbortItemLoad:{label:"GET_LABEL_BUTTON_ABORT_ITEM_LOAD",action:"ABORT_ITEM_LOAD",className:"filepond--action-abort-item-load",align:"LOAD_INDICATOR_POSITION"},RetryItemLoad:{label:"GET_LABEL_BUTTON_RETRY_ITEM_LOAD",action:"RETRY_ITEM_LOAD",icon:"GET_ICON_RETRY",className:"filepond--action-retry-item-load",align:"BUTTON_PROCESS_ITEM_POSITION"},RemoveItem:{label:"GET_LABEL_BUTTON_REMOVE_ITEM",action:"REQUEST_REMOVE_ITEM",icon:"GET_ICON_REMOVE",className:"filepond--action-remove-item",align:"BUTTON_REMOVE_ITEM_POSITION"},ProcessItem:{label:"GET_LABEL_BUTTON_PROCESS_ITEM",action:"REQUEST_ITEM_PROCESSING",icon:"GET_ICON_PROCESS",className:"filepond--action-process-item",align:"BUTTON_PROCESS_ITEM_POSITION"},AbortItemProcessing:{label:"GET_LABEL_BUTTON_ABORT_ITEM_PROCESSING",action:"ABORT_ITEM_PROCESSING",className:"filepond--action-abort-item-processing",align:"BUTTON_PROCESS_ITEM_POSITION"},RetryItemProcessing:{label:"GET_LABEL_BUTTON_RETRY_ITEM_PROCESSING",action:"RETRY_ITEM_PROCESSING",icon:"GET_ICON_RETRY",className:"filepond--action-retry-item-processing",align:"BUTTON_PROCESS_ITEM_POSITION"},RevertItemProcessing:{label:"GET_LABEL_BUTTON_UNDO_ITEM_PROCESSING",action:"REQUEST_REVERT_ITEM_PROCESSING",icon:"GET_ICON_UNDO",className:"filepond--action-revert-item-processing",align:"BUTTON_PROCESS_ITEM_POSITION"}},kt=[];e(Xt,e=>{kt.push(e)});const $t=e=>{const t=e.ref.buttonRemoveItem.rect.element;return t.hidden?null:t.width+t.left},zt=e=>Math.floor(e.ref.buttonRemoveItem.rect.element.height/4),Wt=e=>Math.floor(e.ref.buttonRemoveItem.rect.element.left/2),jt=e=>e.query("GET_STYLE_BUTTON_REMOVE_ITEM_POSITION"),Qt={buttonAbortItemLoad:{opacity:0},buttonRetryItemLoad:{opacity:0},buttonRemoveItem:{opacity:0},buttonProcessItem:{opacity:0},buttonAbortItemProcessing:{opacity:0},buttonRetryItemProcessing:{opacity:0},buttonRevertItemProcessing:{opacity:0},loadProgressIndicator:{opacity:0,align:e=>e.query("GET_STYLE_LOAD_INDICATOR_POSITION")},processProgressIndicator:{opacity:0,align:e=>e.query("GET_STYLE_PROGRESS_INDICATOR_POSITION")},processingCompleteIndicator:{opacity:0,scaleX:.75,scaleY:.75},info:{translateX:0,translateY:0,opacity:0},status:{translateX:0,translateY:0,opacity:0}},Zt={buttonRemoveItem:{opacity:1},buttonProcessItem:{opacity:1},info:{translateX:$t},status:{translateX:$t}},Kt={buttonAbortItemProcessing:{opacity:1},processProgressIndicator:{opacity:1},status:{opacity:1}},Jt={DID_THROW_ITEM_INVALID:{buttonRemoveItem:{opacity:1},info:{translateX:$t},status:{translateX:$t,opacity:1}},DID_START_ITEM_LOAD:{buttonAbortItemLoad:{opacity:1},loadProgressIndicator:{opacity:1},status:{opacity:1}},DID_THROW_ITEM_LOAD_ERROR:{buttonRetryItemLoad:{opacity:1},buttonRemoveItem:{opacity:1},info:{translateX:$t},status:{opacity:1}},DID_START_ITEM_REMOVE:{processProgressIndicator:{opacity:1,align:jt},info:{translateX:$t},status:{opacity:0}},DID_THROW_ITEM_REMOVE_ERROR:{processProgressIndicator:{opacity:0,align:jt},buttonRemoveItem:{opacity:1},info:{translateX:$t},status:{opacity:1,translateX:$t}},DID_LOAD_ITEM:Zt,DID_LOAD_LOCAL_ITEM:{buttonRemoveItem:{opacity:1},info:{translateX:$t},status:{translateX:$t}},DID_START_ITEM_PROCESSING:Kt,DID_REQUEST_ITEM_PROCESSING:Kt,DID_UPDATE_ITEM_PROCESS_PROGRESS:Kt,DID_COMPLETE_ITEM_PROCESSING:{buttonRevertItemProcessing:{opacity:1},info:{opacity:1},status:{opacity:1}},DID_THROW_ITEM_PROCESSING_ERROR:{buttonRemoveItem:{opacity:1},buttonRetryItemProcessing:{opacity:1},status:{opacity:1},info:{translateX:$t}},DID_THROW_ITEM_PROCESSING_REVERT_ERROR:{buttonRevertItemProcessing:{opacity:1},status:{opacity:1},info:{opacity:1}},DID_ABORT_ITEM_PROCESSING:{buttonRemoveItem:{opacity:1},buttonProcessItem:{opacity:1},info:{translateX:$t},status:{opacity:1}},DID_REVERT_ITEM_PROCESSING:Zt},er=A({create:({root:e})=>{e.element.innerHTML=e.query("GET_ICON_DONE")},name:"processing-complete-indicator",ignoreRect:!0,mixins:{styles:["scaleX","scaleY","opacity"],animations:{scaleX:"spring",scaleY:"spring",opacity:{type:"tween",duration:250}}}}),tr=L({DID_SET_LABEL_BUTTON_ABORT_ITEM_PROCESSING:({root:e,action:t})=>{e.ref.buttonAbortItemProcessing.label=t.value},DID_SET_LABEL_BUTTON_ABORT_ITEM_LOAD:({root:e,action:t})=>{e.ref.buttonAbortItemLoad.label=t.value},DID_SET_LABEL_BUTTON_ABORT_ITEM_REMOVAL:({root:e,action:t})=>{e.ref.buttonAbortItemRemoval.label=t.value},DID_REQUEST_ITEM_PROCESSING:({root:e})=>{e.ref.processProgressIndicator.spin=!0,e.ref.processProgressIndicator.progress=0},DID_START_ITEM_LOAD:({root:e})=>{e.ref.loadProgressIndicator.spin=!0,e.ref.loadProgressIndicator.progress=0},DID_START_ITEM_REMOVE:({root:e})=>{e.ref.processProgressIndicator.spin=!0,e.ref.processProgressIndicator.progress=0},DID_UPDATE_ITEM_LOAD_PROGRESS:({root:e,action:t})=>{e.ref.loadProgressIndicator.spin=!1,e.ref.loadProgressIndicator.progress=t.progress},DID_UPDATE_ITEM_PROCESS_PROGRESS:({root:e,action:t})=>{e.ref.processProgressIndicator.spin=!1,e.ref.processProgressIndicator.progress=t.progress}}),rr=A({create:({root:t,props:r})=>{const{id:o}=r,n=t.query("GET_ALLOW_REVERT"),s=t.query("GET_INSTANT_UPLOAD"),i=t.query("IS_ASYNC"),a=t.query("GET_STYLE_BUTTON_REMOVE_ITEM_ALIGN"),l=i?kt.concat():kt.filter(e=>!/Process/.test(e));if(s&&n&&(Xt.RevertItemProcessing.label="GET_LABEL_BUTTON_REMOVE_ITEM",Xt.RevertItemProcessing.icon="GET_ICON_REMOVE"),i&&!n){l.splice(-1,1);const e=Jt.DID_COMPLETE_ITEM_PROCESSING;e.info.translateX=Wt,e.info.translateY=zt,e.status.translateY=zt,e.processingCompleteIndicator={opacity:1,scaleX:1,scaleY:1}}if(a&&n){Xt.RevertItemProcessing.align="BUTTON_REMOVE_ITEM_POSITION";const e=Jt.DID_COMPLETE_ITEM_PROCESSING;e.info.translateX=$t,e.status.translateY=zt,e.processingCompleteIndicator={opacity:1,scaleX:1,scaleY:1}}e(Xt,(e,r)=>{const n=t.createChildView(Mt,{label:t.query(r.label),icon:t.query(r.icon),opacity:0});l.includes(e)&&t.appendChildView(n),n.element.dataset.align=t.query(`GET_STYLE_${r.align}`),n.element.classList.add(r.className),n.on("click",e=>{e.stopPropagation(),t.dispatch(r.action,{query:o})}),t.ref[`button${e}`]=n}),t.ref.processingCompleteIndicator=t.appendChildView(t.createChildView(er)),t.ref.processingCompleteIndicator.element.dataset.align=t.query("GET_STYLE_BUTTON_PROCESS_ITEM_POSITION"),t.ref.info=t.appendChildView(t.createChildView(qt,{id:o})),t.ref.status=t.appendChildView(t.createChildView(Ht,{id:o}));const c=t.appendChildView(t.createChildView(vt,{opacity:0,align:t.query("GET_STYLE_LOAD_INDICATOR_POSITION")}));c.element.classList.add("filepond--load-indicator"),t.ref.loadProgressIndicator=c;const d=t.appendChildView(t.createChildView(vt,{opacity:0,align:t.query("GET_STYLE_PROGRESS_INDICATOR_POSITION")}));d.element.classList.add("filepond--process-indicator"),t.ref.processProgressIndicator=d,t.ref.activeStyles=[]},write:({root:t,actions:r,props:o})=>{tr({root:t,actions:r,props:o});let n=r.concat().filter(e=>/^DID_/.test(e.type)).reverse().find(e=>Jt[e.type]);if(n){t.ref.activeStyles=[];const r=Jt[n.type];e(Qt,(o,n)=>{const s=t.ref[o];e(n,(e,n)=>{const i=r[o]&&void 0!==r[o][e]?r[o][e]:n;t.ref.activeStyles.push({control:s,key:e,value:i})})})}t.ref.activeStyles.forEach(({control:e,key:r,value:o})=>{e[r]="function"==typeof o?o(t):o})},didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},name:"file"}),or=A({create:({root:e,props:t})=>{e.ref.fileName=yt("legend"),e.appendChild(e.ref.fileName),e.ref.file=e.appendChildView(e.createChildView(rr,{id:t.id})),e.ref.data=!1},ignoreRect:!0,write:L({DID_LOAD_ITEM:({root:e,props:t})=>{At(e.ref.fileName,St(e.query("GET_ITEM_NAME",t.id)))}}),didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},tag:"fieldset",name:"file-wrapper"}),nr={type:"spring",damping:.6,mass:7},sr=(e,t,r)=>{const o=A({name:`panel-${t.name} filepond--${r}`,mixins:t.mixins,ignoreRectUpdate:!0}),n=e.createChildView(o,t.props);e.ref[t.name]=e.appendChildView(n)},ir=A({name:"panel",write:({root:e,props:t})=>{if(null!==e.ref.scalable&&t.scalable===e.ref.scalable||(e.ref.scalable=!w(t.scalable)||t.scalable,e.element.dataset.scalable=e.ref.scalable),!t.height)return;const r=e.ref.top.rect.element,o=e.ref.bottom.rect.element,n=Math.max(r.height+o.height,t.height);e.ref.center.translateY=r.height,e.ref.center.scaleY=(n-r.height-o.height)/100,e.ref.bottom.translateY=n-o.height},create:({root:e,props:t})=>{[{name:"top"},{name:"center",props:{translateY:null,scaleY:null},mixins:{animations:{scaleY:nr},styles:["translateY","scaleY"]}},{name:"bottom",props:{translateY:null},mixins:{animations:{translateY:nr},styles:["translateY"]}}].forEach(r=>{sr(e,r,t.name)}),e.element.classList.add(`filepond--${t.name}`),e.ref.scalable=null},ignoreRect:!0,mixins:{apis:["height","scalable"]}}),ar={type:"spring",stiffness:.75,damping:.45,mass:10},lr={DID_START_ITEM_LOAD:"busy",DID_UPDATE_ITEM_LOAD_PROGRESS:"loading",DID_THROW_ITEM_INVALID:"load-invalid",DID_THROW_ITEM_LOAD_ERROR:"load-error",DID_LOAD_ITEM:"idle",DID_THROW_ITEM_REMOVE_ERROR:"remove-error",DID_START_ITEM_REMOVE:"busy",DID_START_ITEM_PROCESSING:"busy",DID_REQUEST_ITEM_PROCESSING:"busy",DID_UPDATE_ITEM_PROCESS_PROGRESS:"processing",DID_COMPLETE_ITEM_PROCESSING:"processing-complete",DID_THROW_ITEM_PROCESSING_ERROR:"processing-error",DID_THROW_ITEM_PROCESSING_REVERT_ERROR:"processing-revert-error",DID_ABORT_ITEM_PROCESSING:"cancelled",DID_REVERT_ITEM_PROCESSING:"idle"},cr=L({DID_UPDATE_PANEL_HEIGHT:({root:e,action:t})=>{e.height=t.height}}),dr=L({DID_GRAB_ITEM:({root:e,props:t})=>{t.dragOrigin={x:e.translateX,y:e.translateY}},DID_DRAG_ITEM:({root:e})=>{e.element.dataset.dragState="drag"},DID_DROP_ITEM:({root:e,props:t})=>{t.dragOffset=null,t.dragOrigin=null,e.element.dataset.dragState="drop"}},({root:e,actions:t,props:r,shouldOptimize:o})=>{"drop"===e.element.dataset.dragState&&e.scaleX<=1&&(e.element.dataset.dragState="idle");let n=t.concat().filter(e=>/^DID_/.test(e.type)).reverse().find(e=>lr[e.type]);n&&n.type!==r.currentState&&(r.currentState=n.type,e.element.dataset.filepondItemState=lr[r.currentState]||"");const s=e.query("GET_ITEM_PANEL_ASPECT_RATIO")||e.query("GET_PANEL_ASPECT_RATIO");s?o||(e.height=e.rect.element.width*s):(cr({root:e,actions:t,props:r}),!e.height&&e.ref.container.rect.element.height>0&&(e.height=e.ref.container.rect.element.height)),o&&(e.ref.panel.height=null),e.ref.panel.height=e.height}),pr=A({create:({root:e,props:t})=>{if(e.ref.handleClick=(r=>e.dispatch("DID_ACTIVATE_ITEM",{id:t.id})),e.element.id=`filepond--item-${t.id}`,e.element.addEventListener("click",e.ref.handleClick),e.ref.container=e.appendChildView(e.createChildView(or,{id:t.id})),e.ref.panel=e.appendChildView(e.createChildView(ir,{name:"item-panel"})),e.ref.panel.height=null,t.markedForRemoval=!1,!e.query("GET_ALLOW_REORDER"))return;e.element.dataset.dragState="idle";e.element.addEventListener("pointerdown",r=>{if(!r.isPrimary)return;let o=!1;const n=r.pageX,s=r.pageY;t.dragOrigin={x:e.translateX,y:e.translateY},t.dragCenter={x:r.offsetX,y:r.offsetY},e.dispatch("DID_GRAB_ITEM",{id:t.id});const i=r=>{r.isPrimary&&(r.stopPropagation(),r.preventDefault(),t.dragOffset={x:r.pageX-n,y:r.pageY-s},t.dragOffset.x*t.dragOffset.x+t.dragOffset.y*t.dragOffset.y>16&&!o&&(o=!0,e.element.removeEventListener("click",e.ref.handleClick)),e.dispatch("DID_DRAG_ITEM",{id:t.id}))},a=r=>{r.isPrimary&&(document.removeEventListener("pointermove",i),document.removeEventListener("pointerup",a),t.dragOffset={x:r.pageX-n,y:r.pageY-s},e.dispatch("DID_DROP_ITEM",{id:t.id}),o&&setTimeout(()=>e.element.addEventListener("click",e.ref.handleClick),0))};document.addEventListener("pointermove",i),document.addEventListener("pointerup",a)})},write:dr,destroy:({root:e,props:t})=>{e.element.removeEventListener("click",e.ref.handleClick),e.dispatch("RELEASE_ITEM",{query:t.id})},tag:"li",name:"item",mixins:{apis:["id","interactionMethod","markedForRemoval","spawnDate","dragCenter","dragOrigin","dragOffset"],styles:["translateX","translateY","scaleX","scaleY","opacity","height"],animations:{scaleX:"spring",scaleY:"spring",translateX:ar,translateY:ar,opacity:{type:"tween",duration:150}}}}),Er=(e,t,r)=>{if(!r)return;const o=e.rect.element.width,n=t.length;let s=null;if(0===n||r.topa){if(r.left{e.dragOffset?(e.translateX=null,e.translateY=null,e.translateX=e.dragOrigin.x+e.dragOffset.x,e.translateY=e.dragOrigin.y+e.dragOffset.y,e.scaleX=1.025,e.scaleY=1.025):(e.translateX=t,e.translateY=r,Date.now()>e.spawnDate&&(0===e.opacity&&_r(e,t,r,o,n),e.scaleX=1,e.scaleY=1,e.opacity=1))},_r=(e,t,r,o,n)=>{e.interactionMethod===ne?(e.translateX=null,e.translateX=t,e.translateY=null,e.translateY=r):e.interactionMethod===te?(e.translateX=null,e.translateX=t-20*o,e.translateY=null,e.translateY=r-10*n,e.scaleX=.8,e.scaleY=.8):e.interactionMethod===re?(e.translateY=null,e.translateY=r-30):e.interactionMethod===ee&&(e.translateX=null,e.translateX=t-30,e.translateY=null)},Tr=e=>e.rect.element.height+.5*e.rect.element.marginBottom+.5*e.rect.element.marginTop,fr=L({DID_ADD_ITEM:({root:e,action:t})=>{const{id:r,index:o,interactionMethod:n}=t;e.ref.addIndex=o;const s=Date.now();let i=s,a=1;if(n!==ne){a=0;const t=e.query("GET_ITEM_INSERT_INTERVAL"),r=s-e.ref.lastItemSpanwDate;i=r{const{id:r}=t,o=e.childViews.find(e=>e.id===r);o&&(o.scaleX=.9,o.scaleY=.9,o.opacity=0,o.markedForRemoval=!0)},DID_DRAG_ITEM:({root:e,action:t,props:r})=>{const{id:o}=t,n=e.childViews.find(e=>e.id===o);if(!n)return;const s=n.dragOrigin.y+n.dragOffset.y+n.dragCenter.y,i=e.query("GET_ACTIVE_ITEMS"),a=e.childViews.filter(e=>e.rect.element.height),l=i.map(e=>a.find(t=>t.id===e.id)),c=l.length;let d=c-1,p=0,E=0,u=0,_=l.findIndex(e=>e===n),T=Tr(n);for(let e=0;ee){if(s{r(e.element,"role","list"),e.ref.lastItemSpanwDate=Date.now()},write:({root:e,props:t,actions:r,shouldOptimize:o})=>{fr({root:e,props:t,actions:r});const{dragCoordinates:n}=t,s=e.rect.element.width,i=e.childViews.filter(e=>e.rect.element.height),a=e.query("GET_ACTIVE_ITEMS").map(e=>i.find(t=>t.id===e.id)).filter(e=>e),l=n?Er(e,a,n):null,c=e.ref.addIndex||null;e.ref.addIndex=null;let d=0,p=0,E=0;if(0===a.length)return;const u=a[0].rect.element,_=u.marginTop+u.marginBottom,T=u.marginLeft+u.marginRight,f=u.width+T,I=u.height+_,m=Math.round(s/f);if(1===m){let e=0,t=0;a.forEach((r,n)=>{if(l){let e=n-l;t=-2===e?.25*-_:-1===e?.75*-_:0===e?.75*_:1===e?.25*_:0}o&&(r.translateX=null,r.translateY=null),r.markedForRemoval||ur(r,0,e+t);let s=(r.rect.element.height+_)*(r.markedForRemoval?r.opacity:1);e+=s})}else{let e=0,t=0;a.forEach((r,n)=>{n===l&&(d=1),n===c&&(E+=1),r.markedForRemoval&&r.opacity<.5&&(p-=1);const s=n+E+d+p,i=s%m,a=Math.floor(s/m),u=i*f,_=a*I,T=Math.sign(u-e),R=Math.sign(_-t);e=u,t=_,r.markedForRemoval||(o&&(r.translateX=null,r.translateY=null),ur(r,u,_,T,R))})}},tag:"ul",name:"list",didWriteView:({root:e})=>{e.childViews.filter(e=>e.markedForRemoval&&0===e.opacity&&e.resting).forEach(t=>{t._destroy(),e.removeChildView(t)})},filterFrameActionsForChild:(e,t)=>t.filter(t=>!t.data||!t.data.id||e.id===t.data.id),mixins:{apis:["dragCoordinates"]}}),mr=L({DID_DRAG:({root:e,props:t,action:r})=>{e.query("GET_ITEM_INSERT_LOCATION_FREEDOM")&&(t.dragCoordinates={left:r.position.scopeLeft-e.ref.list.rect.element.left,top:r.position.scopeTop-(e.rect.outer.top+e.rect.element.marginTop+e.rect.element.scrollTop)})},DID_END_DRAG:({props:e})=>{e.dragCoordinates=null}}),Rr=A({create:({root:e,props:t})=>{e.ref.list=e.appendChildView(e.createChildView(Ir)),t.dragCoordinates=null,t.overflowing=!1},write:({root:e,props:t,actions:r})=>{if(mr({root:e,props:t,actions:r}),e.ref.list.dragCoordinates=t.dragCoordinates,t.overflowing&&!t.overflow&&(t.overflowing=!1,e.element.dataset.state="",e.height=null),t.overflow){const r=Math.round(t.overflow);r!==e.height&&(t.overflowing=!0,e.element.dataset.state="overflow",e.height=r)}},name:"list-scroller",mixins:{apis:["overflow","dragCoordinates"],styles:["height","translateY"],animations:{translateY:"spring"}}}),hr=(e,t,o,n="")=>{o?r(e,t,n):e.removeAttribute(t)},gr=({root:e,action:t})=>{hr(e.element,"accept",!!t.value,t.value?t.value.join(","):"")},Or=({root:e,action:t})=>{hr(e.element,"multiple",t.value)},Dr=({root:e,action:t})=>{hr(e.element,"webkitdirectory",t.value)},Sr=({root:e})=>{const t=e.query("GET_DISABLED"),r=e.query("GET_ALLOW_BROWSE"),o=t||!r;hr(e.element,"disabled",o)},yr=({root:e,action:t})=>{t.value?0===e.query("GET_TOTAL_ITEMS")&&hr(e.element,"required",!0):hr(e.element,"required",!1)},Ar=({root:e,action:t})=>{hr(e.element,"capture",!!t.value,!0===t.value?"":t.value)},Lr=({root:e})=>{const{element:t}=e;if(e.query("GET_TOTAL_ITEMS")>0)hr(t,"required",!1),hr(t,"name",!1);else{hr(t,"name",!0,e.query("GET_NAME")),e.query("GET_CHECK_VALIDITY")&&t.setCustomValidity(""),e.query("GET_REQUIRED")&&hr(t,"required",!0)}},Pr=A({tag:"input",name:"browser",ignoreRect:!0,ignoreRectUpdate:!0,attributes:{type:"file"},create:({root:e,props:t})=>{e.element.id=`filepond--browser-${t.id}`,r(e.element,"name",e.query("GET_NAME")),r(e.element,"aria-controls",`filepond--assistant-${t.id}`),r(e.element,"aria-labelledby",`filepond--drop-label-${t.id}`),gr({root:e,action:{value:e.query("GET_ACCEPTED_FILE_TYPES")}}),Or({root:e,action:{value:e.query("GET_ALLOW_MULTIPLE")}}),Dr({root:e,action:{value:e.query("GET_ALLOW_DIRECTORIES_ONLY")}}),Sr({root:e}),yr({root:e,action:{value:e.query("GET_REQUIRED")}}),Ar({root:e,action:{value:e.query("GET_CAPTURE_METHOD")}}),e.ref.handleChange=(r=>{if(!e.element.value)return;const o=Array.from(e.element.files).map(e=>(e._relativePath=e.webkitRelativePath,e));setTimeout(()=>{t.onload(o),(e=>{if(e&&""!==e.value){try{e.value=""}catch(e){}if(e.value){const t=yt("form"),r=e.parentNode,o=e.nextSibling;t.appendChild(e),t.reset(),o?r.insertBefore(e,o):r.appendChild(e)}}})(e.element)},250)}),e.element.addEventListener("change",e.ref.handleChange)},destroy:({root:e})=>{e.element.removeEventListener("change",e.ref.handleChange)},write:L({DID_LOAD_ITEM:Lr,DID_REMOVE_ITEM:Lr,DID_THROW_ITEM_INVALID:({root:e})=>{e.query("GET_CHECK_VALIDITY")&&e.element.setCustomValidity(e.query("GET_LABEL_INVALID_FIELD"))},DID_SET_DISABLED:Sr,DID_SET_ALLOW_BROWSE:Sr,DID_SET_ALLOW_DIRECTORIES_ONLY:Dr,DID_SET_ALLOW_MULTIPLE:Or,DID_SET_ACCEPTED_FILE_TYPES:gr,DID_SET_CAPTURE_METHOD:Ar,DID_SET_REQUIRED:yr})}),vr=13,Mr=32,br=(e,t)=>{e.innerHTML=t;const o=e.querySelector(".filepond--label-action");return o&&r(o,"tabindex","0"),t},Cr=A({name:"drop-label",ignoreRect:!0,create:({root:e,props:t})=>{const o=yt("label");r(o,"for",`filepond--browser-${t.id}`),r(o,"id",`filepond--drop-label-${t.id}`),r(o,"aria-hidden","true"),e.ref.handleKeyDown=(t=>{(t.keyCode===vr||t.keyCode===Mr)&&(t.preventDefault(),e.ref.label.click())}),e.ref.handleClick=(t=>{t.target===o||o.contains(t.target)||e.ref.label.click()}),o.addEventListener("keydown",e.ref.handleKeyDown),e.element.addEventListener("click",e.ref.handleClick),br(o,t.caption),e.appendChild(o),e.ref.label=o},destroy:({root:e})=>{e.ref.label.addEventListener("keydown",e.ref.handleKeyDown),e.element.removeEventListener("click",e.ref.handleClick)},write:L({DID_SET_LABEL_IDLE:({root:e,action:t})=>{br(e.ref.label,t.value)}}),mixins:{styles:["opacity","translateX","translateY"],animations:{opacity:{type:"tween",duration:150},translateX:"spring",translateY:"spring"}}}),Nr=A({name:"drip-blob",ignoreRect:!0,mixins:{styles:["translateX","translateY","scaleX","scaleY","opacity"],animations:{scaleX:"spring",scaleY:"spring",translateX:"spring",translateY:"spring",opacity:{type:"tween",duration:250}}}}),wr=L({DID_DRAG:({root:e,action:t})=>{e.ref.blob?(e.ref.blob.translateX=t.position.scopeLeft,e.ref.blob.translateY=t.position.scopeTop,e.ref.blob.scaleX=1,e.ref.blob.scaleY=1,e.ref.blob.opacity=1):(({root:e})=>{const t=.5*e.rect.element.width,r=.5*e.rect.element.height;e.ref.blob=e.appendChildView(e.createChildView(Nr,{opacity:0,scaleX:2.5,scaleY:2.5,translateX:t,translateY:r}))})({root:e})},DID_DROP:({root:e})=>{e.ref.blob&&(e.ref.blob.scaleX=2.5,e.ref.blob.scaleY=2.5,e.ref.blob.opacity=0)},DID_END_DRAG:({root:e})=>{e.ref.blob&&(e.ref.blob.opacity=0)}}),Gr=A({ignoreRect:!0,ignoreRectUpdate:!0,name:"drip",write:({root:e,props:t,actions:r})=>{wr({root:e,props:t,actions:r});const{blob:o}=e.ref;0===r.length&&o&&0===o.opacity&&(e.removeChildView(o),e.ref.blob=null)}}),Ur=(e,t)=>e.ref.fields[t],Br=({root:e})=>(e=>{e.query("GET_ACTIVE_ITEMS").forEach(t=>{e.element.appendChild(e.ref.fields[t.id])})})(e),qr=L({DID_SET_DISABLED:({root:e})=>{e.element.disabled=e.query("GET_DISABLED")},DID_ADD_ITEM:({root:e,action:t})=>{const r=yt("input");r.type="hidden",r.name=e.query("GET_NAME"),r.disabled=e.query("GET_DISABLED"),e.appendChild(r,0),e.ref.fields[t.id]=r},DID_LOAD_ITEM:({root:e,action:t})=>{const r=Ur(e,t.id);r&&null!==t.serverFileReference&&(r.value=t.serverFileReference)},DID_REMOVE_ITEM:({root:e,action:t})=>{const r=Ur(e,t.id);r&&(r.parentNode.removeChild(r),delete e.ref.fields[t.id])},DID_DEFINE_VALUE:({root:e,action:t})=>{const r=Ur(e,t.id);r&&(null===t.value?r.removeAttribute("value"):r.value=t.value)},DID_REORDER_ITEMS:Br,DID_SORT_ITEMS:Br}),Vr=A({tag:"fieldset",name:"data",create:({root:e})=>e.ref.fields={},write:qr,ignoreRect:!0}),Fr=["jpg","jpeg","png","gif","bmp","webp","svg","tiff"],xr=["css","csv","html","txt"],Yr={zip:"zip|compressed",epub:"application/epub+zip"},Hr=(e="")=>(e=e.toLowerCase(),Fr.includes(e)?"image/"+("jpg"===e?"jpeg":"svg"===e?"svg+xml":e):xr.includes(e)?"text/"+e:Yr[e]||""),Xr=e=>new Promise((t,r)=>{const o=eo(e);if(o.length&&!kr(e))return t(o);$r(e).then(t)}),kr=e=>!!e.files&&e.files.length>0,$r=e=>new Promise((t,r)=>{const o=(e.items?Array.from(e.items):[]).filter(e=>zr(e)).map(e=>Wr(e));o.length?Promise.all(o).then(e=>{const r=[];e.forEach(e=>{r.push.apply(r,e)}),t(r.filter(e=>e).map(e=>(e._relativePath||(e._relativePath=e.webkitRelativePath),e)))}).catch(console.error):t(e.files?Array.from(e.files):[])}),zr=e=>{if(Kr(e)){const t=Jr(e);if(t)return t.isFile||t.isDirectory}return"file"===e.kind},Wr=e=>new Promise((t,r)=>{Zr(e)?jr(Jr(e)).then(t).catch(r):t([e.getAsFile()])}),jr=e=>new Promise((t,r)=>{const o=[];let n=0,s=0;const i=()=>{0===s&&0===n&&t(o)},a=e=>{n++;const t=e.createReader(),l=()=>{t.readEntries(e=>{if(0===e.length)return n--,void i();e.forEach(e=>{e.isDirectory?a(e):(s++,e.file(t=>{const r=Qr(t);e.fullPath&&(r._relativePath=e.fullPath),o.push(r),s--,i()}))}),l()},r)};l()};a(e)}),Qr=e=>{if(e.type.length)return e;const t=e.lastModifiedDate,r=e.name;return(e=e.slice(0,e.size,Hr(Ue(e.name)))).name=r,e.lastModifiedDate=t,e},Zr=e=>Kr(e)&&(Jr(e)||{}).isDirectory,Kr=e=>"webkitGetAsEntry"in e,Jr=e=>e.webkitGetAsEntry(),eo=e=>{let t=[];try{if((t=ro(e)).length)return t;t=to(e)}catch(e){}return t},to=e=>{let t=e.getData("url");return"string"==typeof t&&t.length?[t]:[]},ro=e=>{let t=e.getData("text/html");if("string"==typeof t&&t.length){const e=t.match(/src\s*=\s*"(.+?)"/);if(e)return[e[1]]}return[]},oo=[],no=e=>({pageLeft:e.pageX,pageTop:e.pageY,scopeLeft:e.offsetX||e.layerX,scopeTop:e.offsetY||e.layerY}),so=e=>{const t=oo.find(t=>t.element===e);if(t)return t;const r=io(e);return oo.push(r),r},io=t=>{const r=[],o={dragenter:po,dragover:Eo,dragleave:_o,drop:uo},n={};e(o,(e,o)=>{n[e]=o(t,r),t.addEventListener(e,n[e],!1)});const s={element:t,addListener:i=>(r.push(i),()=>{r.splice(r.indexOf(i),1),0===r.length&&(oo.splice(oo.indexOf(s),1),e(o,e=>{t.removeEventListener(e,n[e],!1)}))})};return s},ao=(e,t)=>{const r=((e,t)=>("elementFromPoint"in e||(e=document),e.elementFromPoint(t.x,t.y)))((e=>"getRootNode"in e?e.getRootNode():document)(t),{x:e.pageX-window.pageXOffset,y:e.pageY-window.pageYOffset});return r===t||t.contains(r)};let lo=null;const co=(e,t)=>{try{e.dropEffect=t}catch(e){}},po=(e,t)=>e=>{e.preventDefault(),lo=e.target,t.forEach(t=>{const{element:r,onenter:o}=t;ao(e,r)&&(t.state="enter",o(no(e)))})},Eo=(e,t)=>e=>{e.preventDefault();const r=e.dataTransfer;Xr(r).then(o=>{let n=!1;t.some(t=>{const{filterElement:s,element:i,onenter:a,onexit:l,ondrag:c,allowdrop:d}=t;co(r,"copy");const p=d(o);if(p)if(ao(e,i)){if(n=!0,null===t.state)return t.state="enter",void a(no(e));if(t.state="over",s&&!p)return void co(r,"none");c(no(e))}else s&&!n&&co(r,"none"),t.state&&(t.state=null,l(no(e)));else co(r,"none")})})},uo=(e,t)=>e=>{e.preventDefault();const r=e.dataTransfer;Xr(r).then(r=>{t.forEach(t=>{const{filterElement:o,element:n,ondrop:s,onexit:i,allowdrop:a}=t;if(t.state=null,!o||ao(e,n))return a(r)?void s(no(e),r):i(no(e))})})},_o=(e,t)=>e=>{lo===e.target&&t.forEach(t=>{const{onexit:r}=t;t.state=null,r(no(e))})},To=(e,t,r)=>{e.classList.add("filepond--hopper");const{catchesDropsOnPage:o,requiresDropOnElement:n,filterItems:s=(e=>e)}=r,i=((e,t,r)=>{const o=so(t),n={element:e,filterElement:r,state:null,ondrop:()=>{},onenter:()=>{},ondrag:()=>{},onexit:()=>{},onload:()=>{},allowdrop:()=>{}};return n.destroy=o.addListener(n),n})(e,o?document.documentElement:e,n);let a="",l="";i.allowdrop=(e=>t(s(e))),i.ondrop=((e,r)=>{const o=s(r);t(o)?(l="drag-drop",c.onload(o,e)):c.ondragend(e)}),i.ondrag=(e=>{c.ondrag(e)}),i.onenter=(e=>{l="drag-over",c.ondragstart(e)}),i.onexit=(e=>{l="drag-exit",c.ondragend(e)});const c={updateHopperState:()=>{a!==l&&(e.dataset.hopperState=l,a=l)},onload:()=>{},ondragstart:()=>{},ondrag:()=>{},ondragend:()=>{},destroy:()=>{i.destroy()}};return c};let fo=!1;const Io=[],mo=e=>{Xr(e.clipboardData).then(e=>{e.length&&Io.forEach(t=>t(e))})},Ro=()=>{const e=e=>{t.onload(e)},t={destroy:()=>{(e=>{ie(Io,Io.indexOf(e)),0===Io.length&&(document.removeEventListener("paste",mo),fo=!1)})(e)},onload:()=>{}};return(e=>{Io.includes(e)||(Io.push(e),fo||(fo=!0,document.addEventListener("paste",mo)))})(e),t};let ho=null,go=null;const Oo=[],Do=(e,t)=>{e.element.textContent=t},So=(e,t,r)=>{const o=e.query("GET_TOTAL_ITEMS");Do(e,`${r} ${t}, ${o} ${1===o?e.query("GET_LABEL_FILE_COUNT_SINGULAR"):e.query("GET_LABEL_FILE_COUNT_PLURAL")}`),clearTimeout(go),go=setTimeout(()=>{(e=>{e.element.textContent=""})(e)},1500)},yo=e=>e.element.parentNode.contains(document.activeElement),Ao=({root:e,action:t})=>{const r=e.query("GET_ITEM",t.id).filename,o=e.query("GET_LABEL_FILE_PROCESSING_ABORTED");Do(e,`${r} ${o}`)},Lo=({root:e,action:t})=>{const r=e.query("GET_ITEM",t.id).filename;Do(e,`${t.status.main} ${r} ${t.status.sub}`)},Po=A({create:({root:e,props:t})=>{e.element.id=`filepond--assistant-${t.id}`,r(e.element,"role","status"),r(e.element,"aria-live","polite"),r(e.element,"aria-relevant","additions")},ignoreRect:!0,ignoreRectUpdate:!0,write:L({DID_LOAD_ITEM:({root:e,action:t})=>{if(!yo(e))return;e.element.textContent="";const r=e.query("GET_ITEM",t.id);Oo.push(r.filename),clearTimeout(ho),ho=setTimeout(()=>{So(e,Oo.join(", "),e.query("GET_LABEL_FILE_ADDED")),Oo.length=0},750)},DID_REMOVE_ITEM:({root:e,action:t})=>{if(!yo(e))return;const r=t.item;So(e,r.filename,e.query("GET_LABEL_FILE_REMOVED"))},DID_COMPLETE_ITEM_PROCESSING:({root:e,action:t})=>{const r=e.query("GET_ITEM",t.id).filename,o=e.query("GET_LABEL_FILE_PROCESSING_COMPLETE");Do(e,`${r} ${o}`)},DID_ABORT_ITEM_PROCESSING:Ao,DID_REVERT_ITEM_PROCESSING:Ao,DID_THROW_ITEM_REMOVE_ERROR:Lo,DID_THROW_ITEM_LOAD_ERROR:Lo,DID_THROW_ITEM_INVALID:Lo,DID_THROW_ITEM_PROCESSING_ERROR:Lo}),tag:"span",name:"assistant"}),vo=(e,t="-")=>e.replace(new RegExp(`${t}.`,"g"),e=>e.charAt(1).toUpperCase()),Mo=(e,t=16,r=!0)=>{let o=Date.now(),n=null;return(...s)=>{clearTimeout(n);const i=Date.now()-o,a=()=>{o=Date.now(),e(...s)};ie.preventDefault(),Co=e=>{const t=e.ref.list.childViews[0].childViews[0];return t?{top:t.rect.element.marginTop,bottom:t.rect.element.marginBottom}:{top:0,bottom:0}},No=e=>{let t=0,r=0;const o=e.ref.list,n=o.childViews[0],s=n.childViews.filter(e=>e.rect.element.height),i=e.query("GET_ACTIVE_ITEMS").map(e=>s.find(t=>t.id===e.id)).filter(e=>e);if(0===i.length)return{visual:t,bounds:r};const a=n.rect.element.width,l=Er(n,i,o.dragCoordinates),c=i[0].rect.element,d=c.marginTop+c.marginBottom,p=c.marginLeft+c.marginRight,E=c.width+p,u=c.height+d,_=void 0!==l&&l>=0?1:0,T=i.find(e=>e.markedForRemoval&&e.opacity<.45)?-1:0,f=i.length+_+T,I=Math.round(a/E);return 1===I?i.forEach(e=>{const o=e.rect.element.height+d;r+=o,t+=o*e.opacity}):(r=Math.ceil(f/I)*u,t=r),{visual:t,bounds:r}},wo=e=>{const t=e.ref.measureHeight||null;return{cappedHeight:parseInt(e.style.maxHeight,10)||null,fixedHeight:0===t?null:t}},Go=(e,t)=>{const r=e.query("GET_ALLOW_REPLACE"),o=e.query("GET_ALLOW_MULTIPLE"),n=e.query("GET_TOTAL_ITEMS");let s=e.query("GET_MAX_FILES");const i=t.length;return!o&&i>1||!!(F(s=o?s:r?s:1)&&n+i>s)&&(e.dispatch("DID_THROW_MAX_FILES",{source:t,error:Qe("warning",0,"Max files")}),!0)},Uo=(e,t,r)=>{const o=e.childViews[0];return Er(o,t,{left:r.scopeLeft-o.rect.element.left,top:r.scopeTop-(e.rect.outer.top+e.rect.element.marginTop+e.rect.element.scrollTop)})},Bo=e=>{const t=e.query("GET_ALLOW_DROP"),r=e.query("GET_DISABLED"),o=t&&!r;if(o&&!e.ref.hopper){const t=To(e.element,t=>{if(Go(e,t))return!1;const r=e.query("GET_BEFORE_DROP_FILE")||(()=>!0);return!e.query("GET_DROP_VALIDATION")||t.every(t=>me("ALLOW_HOPPER_ITEM",t,{query:e.query}).every(e=>!0===e)&&r(t))},{filterItems:t=>{const r=e.query("GET_IGNORED_FILES");return t.filter(e=>!Et(e)||!r.includes(e.name.toLowerCase()))},catchesDropsOnPage:e.query("GET_DROP_ON_PAGE"),requiresDropOnElement:e.query("GET_DROP_ON_ELEMENT")});t.onload=((t,r)=>{const o=e.ref.list.childViews[0].childViews.filter(e=>e.rect.element.height),n=e.query("GET_ACTIVE_ITEMS").map(e=>o.find(t=>t.id===e.id)).filter(e=>e);e.dispatch("ADD_ITEMS",{items:t,index:Uo(e.ref.list,n,r),interactionMethod:te}),e.dispatch("DID_DROP",{position:r}),e.dispatch("DID_END_DRAG",{position:r})}),t.ondragstart=(t=>{e.dispatch("DID_START_DRAG",{position:t})}),t.ondrag=Mo(t=>{e.dispatch("DID_DRAG",{position:t})}),t.ondragend=(t=>{e.dispatch("DID_END_DRAG",{position:t})}),e.ref.hopper=t,e.ref.drip=e.appendChildView(e.createChildView(Gr))}else!o&&e.ref.hopper&&(e.ref.hopper.destroy(),e.ref.hopper=null,e.removeChildView(e.ref.drip))},qo=(e,t)=>{const r=e.query("GET_ALLOW_BROWSE"),o=e.query("GET_DISABLED"),n=r&&!o;n&&!e.ref.browser?e.ref.browser=e.appendChildView(e.createChildView(Pr,{...t,onload:t=>{if(Go(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:re})}}),0):!n&&e.ref.browser&&(e.removeChildView(e.ref.browser),e.ref.browser=null)},Vo=e=>{const t=e.query("GET_ALLOW_PASTE"),r=e.query("GET_DISABLED"),o=t&&!r;o&&!e.ref.paster?(e.ref.paster=Ro(),e.ref.paster.onload=(t=>{e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:oe})})):!o&&e.ref.paster&&(e.ref.paster.destroy(),e.ref.paster=null)},Fo=L({DID_SET_ALLOW_BROWSE:({root:e,props:t})=>{qo(e,t)},DID_SET_ALLOW_DROP:({root:e})=>{Bo(e)},DID_SET_ALLOW_PASTE:({root:e})=>{Vo(e)},DID_SET_DISABLED:({root:e,props:t})=>{Bo(e),Vo(e),qo(e,t),e.query("GET_DISABLED")?e.element.dataset.disabled="disabled":e.element.removeAttribute("data-disabled")}}),xo=A({name:"root",read:({root:e})=>{e.ref.measure&&(e.ref.measureHeight=e.ref.measure.offsetHeight)},create:({root:e,props:t})=>{const r=e.query("GET_ID");r&&(e.element.id=r);const o=e.query("GET_CLASS_NAME");o&&o.split(" ").filter(e=>e.length).forEach(t=>{e.element.classList.add(t)}),e.ref.label=e.appendChildView(e.createChildView(Cr,{...t,translateY:null,caption:e.query("GET_LABEL_IDLE")})),e.ref.list=e.appendChildView(e.createChildView(Rr,{translateY:null})),e.ref.panel=e.appendChildView(e.createChildView(ir,{name:"panel-root"})),e.ref.assistant=e.appendChildView(e.createChildView(Po,{...t})),e.ref.data=e.appendChildView(e.createChildView(Vr,{...t})),e.ref.measure=yt("div"),e.ref.measure.style.height="100%",e.element.appendChild(e.ref.measure),e.ref.bounds=null,e.query("GET_STYLES").filter(e=>!b(e.value)).map(({name:t,value:r})=>{e.element.dataset[t]=r}),e.ref.widthPrevious=null,e.ref.widthUpdated=Mo(()=>{e.ref.updateHistory=[],e.dispatch("DID_RESIZE_ROOT")},250),e.ref.previousAspectRatio=null,e.ref.updateHistory=[];const n=window.matchMedia("(pointer: fine) and (hover: hover)").matches,s="PointerEvent"in window;e.query("GET_ALLOW_REORDER")&&s&&!n&&(e.element.addEventListener("touchmove",bo,{passive:!1}),e.element.addEventListener("gesturestart",bo))},write:({root:e,props:t,actions:r})=>{if(Fo({root:e,props:t,actions:r}),r.filter(e=>/^DID_SET_STYLE_/.test(e.type)).filter(e=>!b(e.data.value)).map(({type:t,data:r})=>{const o=vo(t.substr(8).toLowerCase(),"_");e.element.dataset[o]=r.value,e.invalidateLayout()}),e.rect.element.hidden)return;e.rect.element.width!==e.ref.widthPrevious&&(e.ref.widthPrevious=e.rect.element.width,e.ref.widthUpdated());let o=e.ref.bounds;o||(o=e.ref.bounds=wo(e),e.element.removeChild(e.ref.measure),e.ref.measure=null);const{hopper:n,label:s,list:i,panel:a}=e.ref;n&&n.updateHopperState();const l=e.query("GET_PANEL_ASPECT_RATIO"),c=e.query("GET_ALLOW_MULTIPLE"),d=e.query("GET_TOTAL_ITEMS"),p=d===(c?e.query("GET_MAX_FILES")||1e6:1),E=r.find(e=>"DID_ADD_ITEM"===e.type);if(p&&E){const e=E.data.interactionMethod;s.opacity=0,c?s.translateY=-40:e===ee?s.translateX=40:s.translateY=e===re?40:30}else p||(s.opacity=1,s.translateX=0,s.translateY=0);const u=Co(e),_=No(e),T=s.rect.element.height,f=!c||p?0:T,I=p?i.rect.element.marginTop:0,m=0===d?0:i.rect.element.marginBottom,R=f+I+_.visual+m,h=f+I+_.bounds+m;if(i.translateY=Math.max(0,f-i.rect.element.marginTop)-u.top,l){const t=e.rect.element.width,r=t*l;l!==e.ref.previousAspectRatio&&(e.ref.previousAspectRatio=l,e.ref.updateHistory=[]);const o=e.ref.updateHistory;o.push(t);const n=2;if(o.length>2*n){const e=o.length,t=e-10;let r=0;for(let s=e;s>=t;s--)if(o[s]===o[s-2]&&r++,r>=n)return}a.scalable=!1,a.height=r;const s=r-f-(m-u.bottom)-(p?I:0);_.visual>s?i.overflow=s:i.overflow=null,e.height=r}else if(o.fixedHeight){a.scalable=!1;const e=o.fixedHeight-f-(m-u.bottom)-(p?I:0);_.visual>e?i.overflow=e:i.overflow=null}else if(o.cappedHeight){const t=R>=o.cappedHeight,r=Math.min(o.cappedHeight,R);a.scalable=!0,a.height=t?r:r-u.top-u.bottom;const n=r-f-(m-u.bottom)-(p?I:0);R>o.cappedHeight&&_.visual>n?i.overflow=n:i.overflow=null,e.height=Math.min(o.cappedHeight,h-u.top-u.bottom)}else{const t=d>0?u.top+u.bottom:0;a.scalable=!0,a.height=Math.max(T,R-t),e.height=Math.max(T,h-t)}},destroy:({root:e})=>{e.ref.paster&&e.ref.paster.destroy(),e.ref.hopper&&e.ref.hopper.destroy(),e.element.removeEventListener("touchmove",bo),e.element.removeEventListener("gesturestart",bo)},mixins:{styles:["height"]}}),Yo=(e={})=>{let r=null;const o=he(),n=((e,t=[],r=[])=>{const o={...e},n=[],s=[],i=(e,t,r)=>{r?s.push({type:e,data:t}):(d[e]&&d[e](t),n.push({type:e,data:t}))},a=(e,...t)=>c[e]?c[e](...t):null,l={getState:()=>({...o}),processActionQueue:()=>{const e=[...n];return n.length=0,e},processDispatchQueue:()=>{const e=[...s];s.length=0,e.forEach(({type:e,data:t})=>{i(e,t)})},dispatch:i,query:a};let c={};t.forEach(e=>{c={...e(o),...c}});let d={};return r.forEach(e=>{d={...e(i,a,o),...d}}),l})((e=>({items:[],listUpdateTimeout:null,itemUpdateTimeout:null,processingQueue:[],options:j(e)}))(o),[Ce,J(o)],[Dt,K(o)]);n.dispatch("SET_OPTIONS",{options:e});const s=()=>{document.hidden||n.dispatch("KICK")};document.addEventListener("visibilitychange",s);let i=null,a=!1,l=!1,c=null,d=null;const p=()=>{a||(a=!0),clearTimeout(i),i=setTimeout(()=>{a=!1,c=null,d=null,l&&(l=!1,n.dispatch("DID_STOP_RESIZE"))},500)};window.addEventListener("resize",p);const E=xo(n,{id:se()});let u=!1,_=!1;const f={_read:()=>{a&&(d=window.innerWidth,c||(c=d),l||d===c||(n.dispatch("DID_START_RESIZE"),l=!0)),_&&u&&(u=null===E.element.offsetParent),u||(E._read(),_=E.rect.element.hidden)},_write:e=>{const t=n.processActionQueue().filter(e=>!/^SET_/.test(e.type));u&&!t.length||(R(t),u=E._write(e,t,l),(e=>{e.forEach((t,r)=>{t.released&&ie(e,r)})})(n.query("GET_ITEMS")),u&&n.processDispatchQueue())}},I=e=>t=>{const r={type:e};if(!t)return r;if(t.hasOwnProperty("error")&&(r.error=t.error?{...t.error}:null),t.status&&(r.status={...t.status}),t.file&&(r.output=t.file),t.source)r.file=t.source;else if(t.item||t.id){const e=t.item?t.item:n.query("GET_ITEM",t.id);r.file=e?de(e):null}return t.items&&(r.items=t.items.map(de)),/progress/.test(e)&&(r.progress=t.progress),r},m={DID_DESTROY:I("destroy"),DID_INIT:I("init"),DID_THROW_MAX_FILES:I("warning"),DID_START_ITEM_LOAD:I("addfilestart"),DID_UPDATE_ITEM_LOAD_PROGRESS:I("addfileprogress"),DID_LOAD_ITEM:I("addfile"),DID_THROW_ITEM_INVALID:[I("error"),I("addfile")],DID_THROW_ITEM_LOAD_ERROR:[I("error"),I("addfile")],DID_THROW_ITEM_REMOVE_ERROR:[I("error"),I("removefile")],DID_PREPARE_OUTPUT:I("preparefile"),DID_START_ITEM_PROCESSING:I("processfilestart"),DID_UPDATE_ITEM_PROCESS_PROGRESS:I("processfileprogress"),DID_ABORT_ITEM_PROCESSING:I("processfileabort"),DID_COMPLETE_ITEM_PROCESSING:I("processfile"),DID_COMPLETE_ITEM_PROCESSING_ALL:I("processfiles"),DID_REVERT_ITEM_PROCESSING:I("processfilerevert"),DID_THROW_ITEM_PROCESSING_ERROR:[I("error"),I("processfile")],DID_REMOVE_ITEM:I("removefile"),DID_UPDATE_ITEMS:I("updatefiles"),DID_ACTIVATE_ITEM:I("activatefile"),DID_REORDER_ITEMS:I("reorderfiles")},R=e=>{e.length&&e.forEach(e=>{if(!m[e.type])return;const t=m[e.type];(Array.isArray(t)?t:[t]).forEach(t=>{setTimeout(()=>{(e=>{const t={pond:y,...e};delete t.type,E.element.dispatchEvent(new CustomEvent(`FilePond:${e.type}`,{detail:t,bubbles:!0,cancelable:!0,composed:!0}));const r=[];e.hasOwnProperty("error")&&r.push(e.error),e.hasOwnProperty("file")&&r.push(e.file);const o=["type","error","file"];Object.keys(e).filter(e=>!o.includes(e)).forEach(t=>r.push(e[t])),y.fire(e.type,...r);const s=n.query(`GET_ON${e.type.toUpperCase()}`);s&&s(...r)})(t(e.data))},0)})})},h=e=>new Promise((t,r)=>{n.dispatch("REQUEST_ITEM_PREPARE",{query:e,success:e=>{t(e)},failure:e=>{r(e)}})}),g=e=>(n.dispatch("REMOVE_ITEM",{query:e}),null===n.query("GET_ACTIVE_ITEM",e)),O=(...e)=>new Promise((t,r)=>{const o=[],s={};if(M(e[0]))o.push.apply(o,e[0]),Object.assign(s,e[1]||{});else{const t=e[e.length-1];"object"!=typeof t||t instanceof Blob||Object.assign(s,e.pop()),o.push(...e)}n.dispatch("ADD_ITEMS",{items:o,index:s.index,interactionMethod:ee,success:t,failure:r})}),D=()=>n.query("GET_ACTIVE_ITEMS"),S=e=>new Promise((t,r)=>{n.dispatch("REQUEST_ITEM_PROCESSING",{query:e,success:e=>{t(e)},failure:e=>{r(e)}})}),y={...ae(),...f,...Z(n,o),setOptions:e=>n.dispatch("SET_OPTIONS",{options:e}),addFile:(e,t={})=>new Promise((r,o)=>{O([{source:e,options:t}],{index:t.index}).then(e=>r(e&&e[0])).catch(o)}),addFiles:O,getFile:e=>n.query("GET_ACTIVE_ITEM",e),processFile:S,prepareFile:h,removeFile:g,moveFile:(e,t)=>n.dispatch("MOVE_ITEM",{query:e,index:t}),getFiles:D,processFiles:(...e)=>{const t=Array.isArray(e[0])?e[0]:e;if(!t.length){const e=D().filter(e=>!(e.status===pe.IDLE&&e.origin===Ee.LOCAL)&&e.status!==pe.PROCESSING&&e.status!==pe.PROCESSING_COMPLETE&&e.status!==pe.PROCESSING_REVERT_ERROR);return Promise.all(e.map(S))}return Promise.all(t.map(S))},removeFiles:(...e)=>{const t=Array.isArray(e[0])?e[0]:e,r=D();return t.length?t.map(e=>T(e)?r[e]?r[e].id:null:e).filter(e=>e).map(g):Promise.all(r.map(g))},prepareFiles:(...e)=>{const t=Array.isArray(e[0])?e[0]:e,r=t.length?t:D();return Promise.all(r.map(h))},sort:e=>n.dispatch("SORT",{compare:e}),browse:()=>{var e=E.element.querySelector("input[type=file]");e&&e.click()},destroy:()=>{y.fire("destroy",E.element),n.dispatch("ABORT_ALL"),E._destroy(),window.removeEventListener("resize",p),document.removeEventListener("visibilitychange",s),n.dispatch("DID_DESTROY")},insertBefore:e=>P(E.element,e),insertAfter:e=>v(E.element,e),appendTo:e=>e.appendChild(E.element),replaceElement:e=>{P(E.element,e),e.parentNode.removeChild(e),r=e},restoreElement:()=>{r&&(v(r,E.element),E.element.parentNode.removeChild(E.element),r=null)},isAttachedTo:e=>E.element===e||r===e,element:{get:()=>E.element},status:{get:()=>n.query("GET_STATUS")}};return n.dispatch("DID_INIT"),t(y)},Ho=(t={})=>{const r={};return e(he(),(e,t)=>{r[e]=t[0]}),Yo({...r,...t})},Xo=(t,r)=>{e(r,(r,o)=>{e(t,(e,n)=>{const s=new RegExp(r);if(!s.test(e))return;if(delete t[e],!1===o)return;if(U(o))return void(t[o]=n);const i=o.group;k(o)&&!t[i]&&(t[i]={}),t[i][(e=>e.charAt(0).toLowerCase()+e.slice(1))(e.replace(s,""))]=n}),o.mapping&&Xo(t[o.group],o.mapping)})},ko=(t,o={})=>{const n=[];e(t.attributes,e=>{n.push(t.attributes[e])});const s=n.filter(e=>e.name).reduce((e,o)=>{const n=r(t,o.name);return e[(e=>vo(e.replace(/^data-/,"")))(o.name)]=n===o.name||n,e},{});return Xo(s,o),s},$o=(...e)=>(e=>e instanceof HTMLElement)(e[0])?((e,t={})=>{const r={"^class$":"className","^multiple$":"allowMultiple","^capture$":"captureMethod","^webkitdirectory$":"allowDirectoriesOnly","^server":{group:"server",mapping:{"^process":{group:"process"},"^revert":{group:"revert"},"^fetch":{group:"fetch"},"^restore":{group:"restore"},"^load":{group:"load"}}},"^type$":!1,"^files$":!1};me("SET_ATTRIBUTE_TO_OPTION_MAP",r);const o={...t},n=ko("FIELDSET"===e.nodeName?e.querySelector("input[type=file]"):e,r);Object.keys(n).forEach(e=>{k(n[e])?(k(o[e])||(o[e]={}),Object.assign(o[e],n[e])):o[e]=n[e]}),o.files=(t.files||[]).concat(Array.from(e.querySelectorAll("input:not([type=file])")).map(e=>({source:e.value,options:{type:e.dataset.type}})));const s=Ho(o);return e.files&&Array.from(e.files).forEach(e=>{s.addFile(e)}),s.replaceElement(e),s})(...e):Ho(...e),zo=["fire","_read","_write"],Wo=e=>{const t={};return le(e,t,zo),t},jo=(e,t)=>e.replace(/(?:{([a-zA-Z]+)})/g,(e,r)=>t[r]),Qo=e=>{const t=new Blob(["(",e.toString(),")()"],{type:"application/javascript"}),r=URL.createObjectURL(t),o=new Worker(r);return{transfer:(e,t)=>{},post:(e,t,r)=>{const n=se();o.onmessage=(e=>{e.data.id===n&&t(e.data.message)}),o.postMessage({id:n,message:e},r)},terminate:()=>{o.terminate(),URL.revokeObjectURL(r)}}},Zo=e=>new Promise((t,r)=>{const o=new Image;o.onload=(()=>{t(o)}),o.onerror=(e=>{r(e)}),o.src=e}),Ko=(e,t)=>{const r=e.slice(0,e.size,e.type);return r.lastModifiedDate=e.lastModifiedDate,r.name=t,r},Jo=e=>Ko(e,e.name),en=[],tn=t=>{if(en.includes(t))return;en.push(t),(e=>Object.assign(ge,e))(t({addFilter:Re,utils:{Type:Te,forin:e,isString:U,isFile:Et,toNaturalFileSize:bt,replaceInString:jo,getExtensionFromFilename:Ue,getFilenameWithoutExtension:pt,guesstimateMimeType:Hr,getFileFromBlob:Ve,getFilenameFromURL:Ge,createRoute:L,createWorker:Qo,createView:A,createItemAPI:de,loadImage:Zo,copyFile:Jo,renameFile:Ko,createBlob:Fe,applyFilterChain:Ie,text:At,getNumericAspectRatioFromString:De},views:{fileActionButton:Mt}}).options)},rn=(()=>{const e=d()&&!(()=>"[object OperaMini]"===Object.prototype.toString.call(window.operamini))()&&(()=>"visibilityState"in document)()&&(()=>"Promise"in window)()&&(()=>"slice"in Blob.prototype)()&&(()=>"URL"in window&&"createObjectURL"in window.URL)()&&(()=>"performance"in window)();return()=>e})(),on={apps:[]},nn=()=>{};let sn={},an={},ln={},cn={},dn=nn,pn=nn,En=nn,un=nn,_n=nn,Tn=nn,fn=nn;if(rn()){((e,t,r=60)=>{const o="__framePainter";if(window[o])return window[o].readers.push(e),void window[o].writers.push(t);window[o]={readers:[e],writers:[t]};const n=window[o],s=1e3/r;let i=null,a=null,l=null,c=null;const d=()=>{document.hidden?(l=(()=>window.setTimeout(()=>p(performance.now()),s)),c=(()=>window.clearTimeout(a))):(l=(()=>window.requestAnimationFrame(p)),c=(()=>window.cancelAnimationFrame(a)))};document.addEventListener("visibilitychange",()=>{c&&c(),d(),p(performance.now())});const p=e=>{a=l(p),i||(i=e);const t=e-i;t<=s||(i=e-t%s,n.readers.forEach(e=>e()),n.writers.forEach(t=>t(e)))};d(),p(performance.now())})(()=>{on.apps.forEach(e=>e._read())},e=>{on.apps.forEach(t=>t._write(e))});const t=()=>{document.dispatchEvent(new CustomEvent("FilePond:loaded",{detail:{supported:rn,create:dn,destroy:pn,parse:En,find:un,registerPlugin:_n,setOptions:fn}})),document.removeEventListener("DOMContentLoaded",t)};"loading"!==document.readyState?setTimeout(()=>t(),0):document.addEventListener("DOMContentLoaded",t);const r=()=>e(he(),(e,t)=>{cn[e]=t[1]});sn={...ye},ln={...Ee},an={...pe},cn={},r(),dn=((...e)=>{const t=$o(...e);return t.on("destroy",pn),on.apps.push(t),Wo(t)}),pn=(e=>{const t=on.apps.findIndex(t=>t.isAttachedTo(e));if(t>=0){return on.apps.splice(t,1)[0].restoreElement(),!0}return!1}),En=(e=>{return Array.from(e.querySelectorAll(".filepond")).filter(e=>!on.apps.find(t=>t.isAttachedTo(e))).map(e=>dn(e))}),un=(e=>{const t=on.apps.find(t=>t.isAttachedTo(e));return t?Wo(t):null}),_n=((...e)=>{e.forEach(tn),r()}),Tn=(()=>{const t={};return e(he(),(e,r)=>{t[e]=r[0]}),t}),fn=(t=>(k(t)&&(on.apps.forEach(e=>{e.setOptions(t)}),(t=>{e(t,(e,t)=>{ge[e]&&(ge[e][0]=W(t,ge[e][0],ge[e][1]))})})(t)),Tn()))}export{ln as FileOrigin,an as FileStatus,cn as OptionTypes,sn as Status,dn as create,pn as destroy,un as find,Tn as getOptions,En as parse,_n as registerPlugin,fn as setOptions,rn as supported}; +const e=(e,t)=>{for(const r in e)e.hasOwnProperty(r)&&t(r,e[r])},t=t=>{const r={};return e(t,e=>{((e,t,r)=>{"function"!=typeof r?Object.defineProperty(e,t,{...r}):e[t]=r})(r,e,t[e])}),r},r=(e,t,r=null)=>{if(null===r)return e.getAttribute(t)||e.hasAttribute(t);e.setAttribute(t,r)},o=["svg","path"],n=e=>o.includes(e),s=(t,o,s={})=>{"object"==typeof o&&(s=o,o=null);const i=n(t)?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t);return o&&(n(t)?r(i,"class",o):i.className=o),e(s,(e,t)=>{r(i,e,t)}),i},i=e=>(t,r)=>{void 0!==r&&e.children[r]?e.insertBefore(t,e.children[r]):e.appendChild(t)},a=(e,t)=>(e,r)=>(void 0!==r?t.splice(r,0,e):t.push(e),e),l=(e,t)=>r=>(t.splice(t.indexOf(r),1),r.element.parentNode&&e.removeChild(r.element),r),c=(()=>"undefined"!=typeof window&&void 0!==window.document)(),d=()=>c,p="children"in(d()?s("svg"):{})?e=>e.children.length:e=>e.childNodes.length,E=(e,t,r,o)=>{const n=r[0]||e.left,s=r[1]||e.top,i=n+e.width,a=s+e.height*(o[1]||1),l={element:{...e},inner:{left:e.left,top:e.top,right:e.right,bottom:e.bottom},outer:{left:n,top:s,right:i,bottom:a}};return t.filter(e=>!e.isRectIgnored()).map(e=>e.rect).forEach(e=>{u(l.inner,{...e.inner}),u(l.outer,{...e.outer})}),_(l.inner),l.outer.bottom+=l.element.marginBottom,l.outer.right+=l.element.marginRight,_(l.outer),l},u=(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)},_=e=>{e.width=e.right-e.left,e.height=e.bottom-e.top},T=e=>"number"==typeof e,f=e=>e<.5?2*e*e:(4-2*e)*e-1,I={spring:({stiffness:e=.5,damping:r=.75,mass:o=10}={})=>{let n=null,s=null,i=0,a=!1;const l=t({interpolate:(t,c)=>{if(!a)return T(n)&&T(s)?void(((e,t,r,o=.001)=>Math.abs(e-t){if(T(e)&&!T(s)&&(s=e),null===n&&(n=e,s=e),s===(n=e)||void 0===n)return a=!0,i=0,l.onupdate(s),void l.oncomplete(s);a=!1},get:()=>n},resting:{get:()=>a},onupdate:e=>{},oncomplete:e=>{}});return l},tween:({duration:e=500,easing:r=f,delay:o=0}={})=>{let n,s,i=null,a=!0,l=!1,c=null;const d=t({interpolate:(t,p)=>{a||null===c||(null===i&&(i=t),t-i=e||p?(n=1,s=l?0:1,d.onupdate(s*c),d.oncomplete(s*c),a=!0):(s=n/e,d.onupdate((n>=0?r(l?1-s:s):0)*c))))},target:{get:()=>l?0:c,set:e=>{if(null===c)return c=e,d.onupdate(e),void d.oncomplete(e);ea},onupdate:e=>{},oncomplete:e=>{}});return d}},m=(e,t,r)=>{const o=e[t]&&"object"==typeof e[t][r]?e[t][r]:e[t]||e,n="string"==typeof o?o:o.type,s="object"==typeof o?{...o}:{};return I[n]?I[n](s):null},R=(e,t,r,o=!1)=>{(t=Array.isArray(t)?t:[t]).forEach(t=>{e.forEach(e=>{let n=e,s=()=>r[e],i=t=>r[e]=t;"object"==typeof e&&(n=e.key,s=e.getter||s,i=e.setter||i),t[n]&&!o||(t[n]={get:s,set:i})})})},h=e=>null!=e,g={opacity:1,scaleX:1,scaleY:1,translateX:0,translateY:0,rotateX:0,rotateY:0,rotateZ:0,originX:0,originY:0},O=(e,t)=>{if(Object.keys(e).length!==Object.keys(t).length)return!0;for(const r in t)if(t[r]!==e[r])return!0;return!1},D=(e,{opacity:t,perspective:r,translateX:o,translateY:n,scaleX:s,scaleY:i,rotateX:a,rotateY:l,rotateZ:c,originX:d,originY:p,width:E,height:u})=>{let _="",T="";(h(d)||h(p))&&(T+=`transform-origin: ${d||0}px ${p||0}px;`),h(r)&&(_+=`perspective(${r}px) `),(h(o)||h(n))&&(_+=`translate3d(${o||0}px, ${n||0}px, 0) `),(h(s)||h(i))&&(_+=`scale3d(${h(s)?s:1}, ${h(i)?i:1}, 1) `),h(c)&&(_+=`rotateZ(${c}rad) `),h(a)&&(_+=`rotateX(${a}rad) `),h(l)&&(_+=`rotateY(${l}rad) `),_.length&&(T+=`transform:${_};`),h(t)&&(T+=`opacity:${t};`,0===t&&(T+="visibility:hidden;"),t<1&&(T+="pointer-events:none;")),h(u)&&(T+=`height:${u}px;`),h(E)&&(T+=`width:${E}px;`);const f=e.elementCurrentStyle||"";T.length===f.length&&T===f||(e.style.cssText=T,e.elementCurrentStyle=T)},S={styles:({mixinConfig:e,viewProps:t,viewInternalAPI:r,viewExternalAPI:o,view:n})=>{const s={...t},i={};R(e,[r,o],t);const a=()=>n.rect?E(n.rect,n.childViews,(()=>[t.translateX||0,t.translateY||0])(),(()=>[t.scaleX||0,t.scaleY||0])()):null;return r.rect={get:a},o.rect={get:a},e.forEach(e=>{t[e]=void 0===s[e]?g[e]:s[e]}),{write:()=>{if(O(i,t))return D(n.element,t),Object.assign(i,{...t}),!0},destroy:()=>{}}},listeners:({mixinConfig:e,viewProps:t,viewInternalAPI:r,viewExternalAPI:o,viewState:n,view:s})=>{const i=[],a=(e=>(t,r)=>{e.addEventListener(t,r)})(s.element),l=(e=>(t,r)=>{e.removeEventListener(t,r)})(s.element);return o.on=((e,t)=>{i.push({type:e,fn:t}),a(e,t)}),o.off=((e,t)=>{i.splice(i.findIndex(r=>r.type===e&&r.fn===t),1),l(e,t)}),{write:()=>!0,destroy:()=>{i.forEach(e=>{l(e.type,e.fn)})}}},animations:({mixinConfig:t,viewProps:r,viewInternalAPI:o,viewExternalAPI:n})=>{const s={...r},i=[];return e(t,(e,t)=>{const a=m(t);a&&(a.onupdate=(t=>{r[e]=t}),a.target=s[e],R([{key:e,setter:e=>{a.target!==e&&(a.target=e)},getter:()=>r[e]}],[o,n],r,!0),i.push(a))}),{write:e=>{let t=document.hidden,r=!0;return i.forEach(o=>{o.resting||(r=!1),o.interpolate(e,t)}),r},destroy:()=>{}}},apis:({mixinConfig:e,viewProps:t,viewExternalAPI:r})=>{R(e,r,t)}},y=(e={},t={},r={})=>(t.layoutCalculated||(e.paddingTop=parseInt(r.paddingTop,10)||0,e.marginTop=parseInt(r.marginTop,10)||0,e.marginRight=parseInt(r.marginRight,10)||0,e.marginBottom=parseInt(r.marginBottom,10)||0,e.marginLeft=parseInt(r.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=null===t.offsetParent,e),A=({tag:e="div",name:r=null,attributes:o={},read:n=(()=>{}),write:c=(()=>{}),create:d=(()=>{}),destroy:u=(()=>{}),filterFrameActionsForChild:_=((e,t)=>t),didCreateView:T=(()=>{}),didWriteView:f=(()=>{}),ignoreRect:I=!1,ignoreRectUpdate:m=!1,mixins:R=[]}={})=>(h,g={})=>{const O=s(e,`filepond--${r}`,o),D=window.getComputedStyle(O,null),A=y();let L=null,P=!1;const v=[],M=[],b={},C={},N=[c],w=[n],G=[u],U=()=>O,B=()=>v.concat(),q=()=>L||(L=E(A,v,[0,0],[1,1])),V={element:{get:U},style:{get:()=>D},childViews:{get:B}},F={...V,rect:{get:q},ref:{get:()=>b},is:e=>r===e,appendChild:i(O),createChildView:(e=>(t,r)=>t(e,r))(h),linkView:e=>(v.push(e),e),unlinkView:e=>{v.splice(v.indexOf(e),1)},appendChildView:a(0,v),removeChildView:l(O,v),registerWriter:e=>N.push(e),registerReader:e=>w.push(e),registerDestroyer:e=>G.push(e),invalidateLayout:()=>O.layoutCalculated=!1,dispatch:h.dispatch,query:h.query},x={element:{get:U},childViews:{get:B},rect:{get:q},resting:{get:()=>P},isRectIgnored:()=>I,_read:()=>{L=null,v.forEach(e=>e._read()),!(m&&A.width&&A.height)&&y(A,O,D);const e={root:H,props:g,rect:A};w.forEach(t=>t(e))},_write:(e,t,r)=>{let o=0===t.length;return N.forEach(n=>{!1===n({props:g,root:H,actions:t,timestamp:e,shouldOptimize:r})&&(o=!1)}),M.forEach(t=>{!1===t.write(e)&&(o=!1)}),v.filter(e=>!!e.element.parentNode).forEach(n=>{n._write(e,_(n,t),r)||(o=!1)}),v.forEach((n,s)=>{n.element.parentNode||(H.appendChild(n.element,s),n._read(),n._write(e,_(n,t),r),o=!1)}),P=o,f({props:g,root:H,actions:t,timestamp:e}),o},_destroy:()=>{M.forEach(e=>e.destroy()),G.forEach(e=>{e({root:H,props:g})}),v.forEach(e=>e._destroy())}},Y={...V,rect:{get:()=>A}};Object.keys(R).sort((e,t)=>"styles"===e?1:"styles"===t?-1:0).forEach(e=>{const r=S[e]({mixinConfig:R[e],viewProps:g,viewState:C,viewInternalAPI:F,viewExternalAPI:x,view:t(Y)});r&&M.push(r)});const H=t(F);d({root:H,props:g});const X=p(O);return v.forEach((e,t)=>{H.appendChild(e.element,X+t)}),T(H),t(x)},L=(e,t)=>({root:r,props:o,actions:n=[],timestamp:s,shouldOptimize:i})=>{n.filter(t=>e[t.type]).forEach(t=>e[t.type]({root:r,props:o,action:t.data,timestamp:s,shouldOptimize:i})),t&&t({root:r,props:o,actions:n,timestamp:s,shouldOptimize:i})},P=(e,t)=>t.parentNode.insertBefore(e,t),v=(e,t)=>t.parentNode.insertBefore(e,t.nextSibling),M=e=>Array.isArray(e),b=e=>null==e,C=e=>e.trim(),N=e=>""+e,w=e=>"boolean"==typeof e,G=e=>w(e)?e:"true"===e,U=e=>"string"==typeof e,B=e=>T(e)?e:U(e)?N(e).replace(/[a-z]+/gi,""):0,q=e=>parseInt(B(e),10),V=e=>parseFloat(B(e)),F=e=>T(e)&&isFinite(e)&&Math.floor(e)===e,x=e=>{if(F(e))return e;let t=N(e).trim();return/MB$/i.test(t)?(t=t.replace(/MB$i/,"").trim(),1e3*q(t)*1e3):/KB/i.test(t)?(t=t.replace(/KB$i/,"").trim(),1e3*q(t)):q(t)},Y=e=>"function"==typeof e,H={process:"POST",patch:"PATCH",revert:"DELETE",fetch:"GET",restore:"GET",load:"GET"},X=(e,t,r,o,n)=>{if(null===t)return null;if("function"==typeof t)return t;const s={url:"GET"===r||"PATCH"===r?`?${e}=`:"",method:r,headers:n,withCredentials:!1,timeout:o,onload:null,ondata:null,onerror:null};if(U(t))return s.url=t,s;if(Object.assign(s,t),U(s.headers)){const e=s.headers.split(/:(.+)/);s.headers={header:e[0],value:e[1]}}return s.withCredentials=G(s.withCredentials),s},k=e=>"object"==typeof e&&null!==e,$=e=>M(e)?"array":(e=>null===e)(e)?"null":F(e)?"int":/^[0-9]+ ?(?:GB|MB|KB)$/gi.test(e)?"bytes":(e=>k(e)&&U(e.url)&&k(e.process)&&k(e.revert)&&k(e.restore)&&k(e.fetch))(e)?"api":typeof e,z={array:(e,t=",")=>b(e)?[]:M(e)?e:N(e).split(t).map(C).filter(e=>e.length),boolean:G,int:e=>"bytes"===$(e)?x(e):q(e),number:V,float:V,bytes:x,string:e=>Y(e)?e:N(e),function:e=>(e=>{let t=self,r=e.split("."),o=null;for(;o=r.shift();)if(!(t=t[o]))return null;return t})(e),serverapi:t=>(t=>{const r={};return r.url=U(t)?t:t.url||"",r.timeout=t.timeout?parseInt(t.timeout,10):0,r.headers=t.headers?t.headers:{},e(H,e=>{r[e]=X(e,t[e],H[e],r.timeout,r.headers)}),r.remove=t.remove||null,delete r.headers,r})(t),object:e=>{try{return JSON.parse((e=>e.replace(/{\s*'/g,'{"').replace(/'\s*}/g,'"}').replace(/'\s*:/g,'":').replace(/:\s*'/g,':"').replace(/,\s*'/g,',"').replace(/'\s*,/g,'",'))(e))}catch(e){return null}}},W=(e,t,r)=>{if(e===t)return e;let o=$(e);if(o!==r){const t=((e,t)=>z[t](e))(e,r);if(o=$(t),null===t)throw`Trying to assign value with incorrect type to "${option}", allowed type: "${r}"`;e=t}return e},j=r=>{const o={};return e(r,e=>{const t=r[e];o[e]=((e,t)=>{let r=e;return{enumerable:!0,get:()=>r,set:o=>{r=W(o,e,t)}}})(t[0],t[1])}),t(o)},Q=(e,t="-")=>e.split(/(?=[A-Z])/).map(e=>e.toLowerCase()).join(t),Z=(t,r)=>{const o={};return e(r,e=>{o[e]={get:()=>t.getState().options[e],set:r=>{t.dispatch(`SET_${Q(e,"_").toUpperCase()}`,{value:r})}}}),o},K=t=>(r,o,n)=>{const s={};return e(t,e=>{const t=Q(e,"_").toUpperCase();s[`SET_${t}`]=(o=>{try{n.options[e]=o.value}catch(e){}r(`DID_SET_${t}`,{value:n.options[e]})})}),s},J=t=>r=>{const o={};return e(t,e=>{o[`GET_${Q(e,"_").toUpperCase()}`]=(t=>r.options[e])}),o},ee=1,te=2,re=3,oe=4,ne=5,se=()=>Math.random().toString(36).substr(2,9),ie=(e,t)=>e.splice(t,1),ae=()=>{const e=[],t=(t,r)=>{ie(e,e.findIndex(e=>e.event===t&&(e.cb===r||!r)))};return{fire:(t,...r)=>{e.filter(e=>e.event===t).map(e=>e.cb).forEach(e=>{setTimeout(()=>{e(...r)},0)})},on:(t,r)=>{e.push({event:t,cb:r})},onOnce:(r,o)=>{e.push({event:r,cb:(...e)=>{t(r,o),o(...e)}})},off:t}},le=(e,t,r)=>{Object.getOwnPropertyNames(e).filter(e=>!r.includes(e)).forEach(r=>Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(e,r)))},ce=["fire","process","revert","load","on","off","onOnce","retryLoad","extend","archive","archived","release","released","requestProcessing","freeze"],de=e=>{const t={};return le(e,t,ce),t},pe={INIT:1,IDLE:2,PROCESSING_QUEUED:9,PROCESSING:3,PROCESSING_COMPLETE:5,PROCESSING_ERROR:6,PROCESSING_REVERT_ERROR:10,LOADING:7,LOAD_ERROR:8},Ee={INPUT:1,LIMBO:2,LOCAL:3},ue=e=>/[^0-9]+/.exec(e),_e=()=>ue(1.1.toLocaleString())[0],Te={BOOLEAN:"boolean",INT:"int",NUMBER:"number",STRING:"string",ARRAY:"array",OBJECT:"object",FUNCTION:"function",ACTION:"action",SERVER_API:"serverapi",REGEX:"regex"},fe=[],Ie=(e,t,r)=>new Promise((o,n)=>{const s=fe.filter(t=>t.key===e).map(e=>e.cb);if(0===s.length)return void o(t);const i=s.shift();s.reduce((e,t)=>e.then(e=>t(e,r)),i(t,r)).then(e=>o(e)).catch(e=>n(e))}),me=(e,t,r)=>fe.filter(t=>t.key===e).map(e=>e.cb(t,r)),Re=(e,t)=>fe.push({key:e,cb:t}),he=()=>({...ge}),ge={id:[null,Te.STRING],name:["filepond",Te.STRING],disabled:[!1,Te.BOOLEAN],className:[null,Te.STRING],required:[!1,Te.BOOLEAN],captureMethod:[null,Te.STRING],allowDrop:[!0,Te.BOOLEAN],allowBrowse:[!0,Te.BOOLEAN],allowPaste:[!0,Te.BOOLEAN],allowMultiple:[!1,Te.BOOLEAN],allowReplace:[!0,Te.BOOLEAN],allowRevert:[!0,Te.BOOLEAN],allowReorder:[!1,Te.BOOLEAN],allowDirectoriesOnly:[!1,Te.BOOLEAN],forceRevert:[!1,Te.BOOLEAN],maxFiles:[null,Te.INT],checkValidity:[!1,Te.BOOLEAN],itemInsertLocationFreedom:[!0,Te.BOOLEAN],itemInsertLocation:["before",Te.STRING],itemInsertInterval:[75,Te.INT],dropOnPage:[!1,Te.BOOLEAN],dropOnElement:[!0,Te.BOOLEAN],dropValidation:[!1,Te.BOOLEAN],ignoredFiles:[[".ds_store","thumbs.db","desktop.ini"],Te.ARRAY],instantUpload:[!0,Te.BOOLEAN],maxParallelUploads:[2,Te.INT],chunkUploads:[!1,Te.BOOLEAN],chunkForce:[!1,Te.BOOLEAN],chunkSize:[5e6,Te.INT],chunkRetryDelays:[[500,1e3,3e3],Te.Array],server:[null,Te.SERVER_API],labelDecimalSeparator:[_e(),Te.STRING],labelThousandsSeparator:[(()=>{const e=_e(),t=1e3.toLocaleString();return t!==1e3.toString()?ue(t)[0]:"."===e?",":"."})(),Te.STRING],labelIdle:['Drag & Drop your files or Browse',Te.STRING],labelInvalidField:["Field contains invalid files",Te.STRING],labelFileWaitingForSize:["Waiting for size",Te.STRING],labelFileSizeNotAvailable:["Size not available",Te.STRING],labelFileCountSingular:["file in list",Te.STRING],labelFileCountPlural:["files in list",Te.STRING],labelFileLoading:["Loading",Te.STRING],labelFileAdded:["Added",Te.STRING],labelFileLoadError:["Error during load",Te.STRING],labelFileRemoved:["Removed",Te.STRING],labelFileRemoveError:["Error during remove",Te.STRING],labelFileProcessing:["Uploading",Te.STRING],labelFileProcessingComplete:["Upload complete",Te.STRING],labelFileProcessingAborted:["Upload cancelled",Te.STRING],labelFileProcessingError:["Error during upload",Te.STRING],labelFileProcessingRevertError:["Error during revert",Te.STRING],labelTapToCancel:["tap to cancel",Te.STRING],labelTapToRetry:["tap to retry",Te.STRING],labelTapToUndo:["tap to undo",Te.STRING],labelButtonRemoveItem:["Remove",Te.STRING],labelButtonAbortItemLoad:["Abort",Te.STRING],labelButtonRetryItemLoad:["Retry",Te.STRING],labelButtonAbortItemProcessing:["Cancel",Te.STRING],labelButtonUndoItemProcessing:["Undo",Te.STRING],labelButtonRetryItemProcessing:["Retry",Te.STRING],labelButtonProcessItem:["Upload",Te.STRING],iconRemove:['',Te.STRING],iconProcess:['',Te.STRING],iconRetry:['',Te.STRING],iconUndo:['',Te.STRING],iconDone:['',Te.STRING],oninit:[null,Te.FUNCTION],onwarning:[null,Te.FUNCTION],onerror:[null,Te.FUNCTION],onactivatefile:[null,Te.FUNCTION],onaddfilestart:[null,Te.FUNCTION],onaddfileprogress:[null,Te.FUNCTION],onaddfile:[null,Te.FUNCTION],onprocessfilestart:[null,Te.FUNCTION],onprocessfileprogress:[null,Te.FUNCTION],onprocessfileabort:[null,Te.FUNCTION],onprocessfilerevert:[null,Te.FUNCTION],onprocessfile:[null,Te.FUNCTION],onprocessfiles:[null,Te.FUNCTION],onremovefile:[null,Te.FUNCTION],onpreparefile:[null,Te.FUNCTION],onupdatefiles:[null,Te.FUNCTION],onreorderfiles:[null,Te.FUNCTION],beforeDropFile:[null,Te.FUNCTION],beforeAddFile:[null,Te.FUNCTION],beforeRemoveFile:[null,Te.FUNCTION],stylePanelLayout:[null,Te.STRING],stylePanelAspectRatio:[null,Te.STRING],styleItemPanelAspectRatio:[null,Te.STRING],styleButtonRemoveItemPosition:["left",Te.STRING],styleButtonProcessItemPosition:["right",Te.STRING],styleLoadIndicatorPosition:["right",Te.STRING],styleProgressIndicatorPosition:["right",Te.STRING],styleButtonRemoveItemAlign:[!1,Te.BOOLEAN],files:[[],Te.ARRAY]},Oe=(e,t)=>b(t)?e[0]||null:F(t)?e[t]||null:("object"==typeof t&&(t=t.id),e.find(e=>e.id===t)||null),De=e=>{if(b(e))return e;if(/:/.test(e)){const t=e.split(":");return t[1]/t[0]}return parseFloat(e)},Se=e=>e.filter(e=>!e.archived),ye={EMPTY:0,IDLE:1,ERROR:2,BUSY:3,READY:4},Ae=[pe.LOAD_ERROR,pe.PROCESSING_ERROR,pe.PROCESSING_REVERT_ERROR],Le=[pe.LOADING,pe.PROCESSING,pe.PROCESSING_QUEUED,pe.INIT],Pe=[pe.PROCESSING_COMPLETE],ve=e=>Ae.includes(e.status),Me=e=>Le.includes(e.status),be=e=>Pe.includes(e.status),Ce=e=>({GET_STATUS:()=>{const t=Se(e.items),{EMPTY:r,ERROR:o,BUSY:n,IDLE:s,READY:i}=ye;return 0===t.length?r:t.some(ve)?o:t.some(Me)?n:t.some(be)?i:s},GET_ITEM:t=>Oe(e.items,t),GET_ACTIVE_ITEM:t=>Oe(Se(e.items),t),GET_ACTIVE_ITEMS:()=>Se(e.items),GET_ITEMS:()=>e.items,GET_ITEM_NAME:t=>{const r=Oe(e.items,t);return r?r.filename:null},GET_ITEM_SIZE:t=>{const r=Oe(e.items,t);return r?r.fileSize:null},GET_STYLES:()=>Object.keys(e.options).filter(e=>/^style/.test(e)).map(t=>({name:t,value:e.options[t]})),GET_PANEL_ASPECT_RATIO:()=>{return/circle/.test(e.options.stylePanelLayout)?1:De(e.options.stylePanelAspectRatio)},GET_ITEM_PANEL_ASPECT_RATIO:()=>e.options.styleItemPanelAspectRatio,GET_ITEMS_BY_STATUS:t=>Se(e.items).filter(e=>e.status===t),GET_TOTAL_ITEMS:()=>Se(e.items).length,IS_ASYNC:()=>k(e.options.server)&&(k(e.options.server.process)||Y(e.options.server.process))}),Ne=(e,t,r)=>Math.max(Math.min(r,e),t),we=e=>/^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i.test(e),Ge=e=>e.split("/").pop().split("?").shift(),Ue=e=>e.split(".").pop(),Be=(e,t="")=>(t+e).slice(-t.length),qe=(e=new Date)=>`${e.getFullYear()}-${Be(e.getMonth()+1,"00")}-${Be(e.getDate(),"00")}_${Be(e.getHours(),"00")}-${Be(e.getMinutes(),"00")}-${Be(e.getSeconds(),"00")}`,Ve=(e,t,r=null,o=null)=>{const n="string"==typeof r?e.slice(0,e.size,r):e.slice(0,e.size,e.type);return n.lastModifiedDate=new Date,e._relativePath&&(n._relativePath=e._relativePath),U(t)||(t=qe()),t&&null===o&&Ue(t)?n.name=t:(o=o||(e=>{if("string"!=typeof e)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)?"jpeg"===t?"jpg":t:""})(n.type),n.name=t+(o?"."+o:"")),n},Fe=(e,t)=>{const r=(()=>window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder)();if(r){const o=new r;return o.append(e),o.getBlob(t)}return new Blob([e],{type:t})},xe=e=>(/^data:(.+);/.exec(e)||[])[1]||null,Ye=e=>{const t=xe(e);return((e,t)=>{const r=new ArrayBuffer(e.length),o=new Uint8Array(r);for(let t=0;tatob((e=>e.split(",")[1].replace(/\s/g,""))(e)))(e),t)},He=e=>{if(!/^content-disposition:/i.test(e))return null;const t=e.split(/filename=|filename\*=.+''/).splice(1).map(e=>e.trim().replace(/^["']|[;"']{0,2}$/g,"")).filter(e=>e.length);return t.length?decodeURI(t[t.length-1]):null},Xe=e=>{if(/content-length:/i.test(e)){const t=e.match(/[0-9]+/)[0];return t?parseInt(t,10):null}return null},ke=e=>{if(/x-content-transfer-id:/i.test(e)){return(e.split(":")[1]||"").trim()||null}return null},$e=e=>{const t={source:null,name:null,size:null},r=e.split("\n");for(let e of r){const r=He(e);if(r){t.name=r;continue}const o=Xe(e);if(o){t.size=o;continue}const n=ke(e);n&&(t.source=n)}return t},ze=e=>{const t={source:null,complete:!1,progress:0,size:null,timestamp:null,duration:0,request:null},r=r=>{e?(t.timestamp=Date.now(),t.request=e(r,e=>{t.duration=Date.now()-t.timestamp,t.complete=!0,e instanceof Blob&&(e=Ve(e,e.name||Ge(r))),o.fire("load",e instanceof Blob?e:e?e.body:null)},e=>{o.fire("error","string"==typeof e?{type:"error",code:0,body:e}:e)},(e,r,n)=>{n&&(t.size=n),t.duration=Date.now()-t.timestamp,e?(t.progress=r/n,o.fire("progress",t.progress)):t.progress=null},()=>{o.fire("abort")},e=>{const r=$e("string"==typeof e?e:e.headers);o.fire("meta",{size:t.size||r.size,filename:r.name,source:r.source})})):o.fire("error",{type:"error",body:"Can't load URL",code:400})},o={...ae(),setSource:e=>t.source=e,getProgress:()=>t.progress,abort:()=>{t.request&&t.request.abort&&t.request.abort()},load:()=>{const e=t.source;o.fire("init",e),e instanceof File?o.fire("load",e):e instanceof Blob?o.fire("load",Ve(e,e.name)):we(e)?o.fire("load",((e,t,r)=>Ve(Ye(e),t,null,r))(e)):r(e)}};return o},We=e=>/GET|HEAD/.test(e),je=(e,t,r)=>{const o={onheaders:()=>{},onprogress:()=>{},onload:()=>{},ontimeout:()=>{},onerror:()=>{},onabort:()=>{},abort:()=>{n=!0,i.abort()}};let n=!1,s=!1;r={method:"POST",headers:{},withCredentials:!1,...r},t=encodeURI(t),We(r.method)&&e&&(t=`${t}${encodeURIComponent("string"==typeof e?e:JSON.stringify(e))}`);const i=new XMLHttpRequest;return(We(r.method)?i:i.upload).onprogress=(e=>{n||o.onprogress(e.lengthComputable,e.loaded,e.total)}),i.onreadystatechange=(()=>{i.readyState<2||4===i.readyState&&0===i.status||s||(s=!0,o.onheaders(i))}),i.onload=(()=>{i.status>=200&&i.status<300?o.onload(i):o.onerror(i)}),i.onerror=(()=>o.onerror(i)),i.onabort=(()=>{n=!0,o.onabort()}),i.ontimeout=(()=>o.ontimeout(i)),i.open(r.method,t,!0),F(r.timeout)&&(i.timeout=r.timeout),Object.keys(r.headers).forEach(e=>{const t=unescape(encodeURIComponent(r.headers[e]));i.setRequestHeader(e,t)}),r.responseType&&(i.responseType=r.responseType),r.withCredentials&&(i.withCredentials=!0),i.send(e),o},Qe=(e,t,r,o)=>({type:e,code:t,body:r,headers:o}),Ze=e=>t=>{e(Qe("error",0,"Timeout",t.getAllResponseHeaders()))},Ke=e=>/\?/.test(e),Je=(...e)=>{let t="";return e.forEach(e=>{t+=Ke(t)&&Ke(e)?e.replace(/\?/,"&"):e}),t},et=(e="",t)=>{if("function"==typeof t)return t;if(!t||!U(t.url))return null;const r=t.onload||(e=>e),o=t.onerror||(e=>null);return(n,s,i,a,l,c)=>{const d=je(n,Je(e,t.url),{...t,responseType:"blob"});return d.onload=(e=>{const o=e.getAllResponseHeaders(),i=$e(o).name||Ge(n);s(Qe("load",e.status,"HEAD"===t.method?null:Ve(r(e.response),i),o))}),d.onerror=(e=>{i(Qe("error",e.status,o(e.response)||e.statusText,e.getAllResponseHeaders()))}),d.onheaders=(e=>{c(Qe("headers",e.status,null,e.getAllResponseHeaders()))}),d.ontimeout=Ze(i),d.onprogress=a,d.onabort=l,d}},tt=0,rt=1,ot=2,nt=3,st=4,it=(e,t,r,o,n,s,i,a,l,c,d)=>{const p=[],{chunkTransferId:E,chunkServer:u,chunkSize:_,chunkRetryDelays:T}=d,f={serverId:E,aborted:!1},I=t.ondata||(e=>e),m=t.onload||((e,t)=>"HEAD"===t?e.getResponseHeader("Upload-Offset"):e.response),R=t.onerror||(e=>null),h=Math.floor(o.size/_);for(let e=0;e<=h;e++){const t=e*_,r=o.slice(t,t+_,"application/offset+octet-stream");p[e]={index:e,size:r.size,offset:t,data:r,file:o,progress:0,retries:[...T],status:tt,error:null,request:null,timeout:null}}const g=e=>e.status===tt||e.status===nt,O=t=>{if(f.aborted)return;if(!(t=t||p.find(g)))return void(p.every(e=>e.status===rt)&&(()=>s(f.serverId))());t.status=ot,t.progress=null;const r=u.ondata||(e=>e),n=u.onerror||(e=>null),a=Je(e,u.url,f.serverId),c="function"==typeof u.headers?u.headers(t):{...u.headers,"Content-Type":"application/offset+octet-stream","Upload-Offset":t.offset,"Upload-Length":o.size,"Upload-Name":o.name},d=t.request=je(r(t.data),a,{...u,headers:c});d.onload=(()=>{t.status=rt,t.request=null,y()}),d.onprogress=((e,r,o)=>{t.progress=e?r:null,S()}),d.onerror=(e=>{t.status=nt,t.request=null,t.error=n(e.response)||e.statusText,D(t)||i(Qe("error",e.status,n(e.response)||e.statusText,e.getAllResponseHeaders()))}),d.ontimeout=(e=>{t.status=nt,t.request=null,D(t)||Ze(i)(e)}),d.onabort=(()=>{t.status=tt,t.request=null,l()})},D=e=>0!==e.retries.length&&(e.status=st,clearTimeout(e.timeout),e.timeout=setTimeout(()=>{O(e)},e.retries.shift()),!0),S=()=>{const e=p.reduce((e,t)=>null===e||null===t.progress?null:e+t.progress,0);if(null===e)return a(!1,0,0);const t=p.reduce((e,t)=>e+t.size,0);a(!0,e,t)},y=()=>{p.filter(e=>e.status===ot).length>=1||O()};return f.serverId?(r=>{const o=Je(e,u.url,f.serverId),n={headers:"function"==typeof t.headers?t.headers(f.serverId):{...t.headers},method:"HEAD"},s=je(null,o,n);s.onload=(e=>r(m(e,n.method))),s.onerror=(e=>i(Qe("error",e.status,R(e.response)||e.statusText,e.getAllResponseHeaders()))),s.ontimeout=Ze(i)})(e=>{f.aborted||(p.filter(t=>t.offset{e.status=rt,e.progress=e.size}),y())}):(s=>{const a=new FormData;k(n)&&a.append(r,JSON.stringify(n));const l="function"==typeof t.headers?t.headers(o,n):{...t.headers,"Upload-Length":o.size},c={...t,headers:l},d=je(I(a),Je(e,t.url),c);d.onload=(e=>s(m(e,c.method))),d.onerror=(e=>i(Qe("error",e.status,R(e.response)||e.statusText,e.getAllResponseHeaders()))),d.ontimeout=Ze(i)})(e=>{f.aborted||(c(e),f.serverId=e,y())}),{abort:()=>{f.aborted=!0,p.forEach(e=>{clearTimeout(e.timeout),e.request&&e.request.abort()})}}},at=(e="",t,r,o)=>"function"==typeof t?(...e)=>t(r,...e,o):t&&U(t.url)?((e,t,r,o)=>(n,s,i,a,l,c,d)=>{if(!n)return;const p=o.chunkUploads,E=p&&n.size>o.chunkSize,u=p&&(E||o.chunkForce);if(n instanceof Blob&&u)return it(e,t,r,n,s,i,a,l,c,d,o);const _=t.ondata||(e=>e),T=t.onload||(e=>e),f=t.onerror||(e=>null);var I=new FormData;k(s)&&I.append(r,JSON.stringify(s)),(n instanceof Blob?[{name:null,file:n}]:n).forEach(e=>{I.append(r,e.file,null===e.name?e.file.name:`${e.name}${e.file.name}`)});const m=je(_(I),Je(e,t.url),t);return m.onload=(e=>{i(Qe("load",e.status,T(e.response),e.getAllResponseHeaders()))}),m.onerror=(e=>{a(Qe("error",e.status,f(e.response)||e.statusText,e.getAllResponseHeaders()))}),m.ontimeout=Ze(a),m.onprogress=l,m.onabort=c,m})(e,t,r,o):null,lt=(e="",t)=>{if("function"==typeof t)return t;if(!t||!U(t.url))return(e,t)=>t();const r=t.onload||(e=>e),o=t.onerror||(e=>null);return(n,s,i)=>{const a=je(n,e+t.url,t);return a.onload=(e=>{s(Qe("load",e.status,r(e.response),e.getAllResponseHeaders()))}),a.onerror=(e=>{i(Qe("error",e.status,o(e.response)||e.statusText,e.getAllResponseHeaders()))}),a.ontimeout=Ze(i),a}},ct=(e=0,t=1)=>e+Math.random()*(t-e),dt=e=>{const t={complete:!1,perceivedProgress:0,perceivedPerformanceUpdater:null,progress:null,timestamp:null,perceivedDuration:0,duration:0,request:null,response:null},r=()=>{t.request&&(t.perceivedPerformanceUpdater.clear(),t.request.abort(),t.complete=!0)},o={...ae(),process:(r,n)=>{const s=()=>{0!==t.duration&&null!==t.progress&&o.fire("progress",o.getProgress())},i=()=>{t.complete=!0,o.fire("load-perceived",t.response.body)};o.fire("start"),t.timestamp=Date.now(),t.perceivedPerformanceUpdater=((e,t=1e3,r=0,o=25,n=250)=>{let s=null;const i=Date.now(),a=()=>{let r=Date.now()-i,l=ct(o,n);r+l>t&&(l=r+l-t);let c=r/t;c>=1?e(1):(e(c),s=setTimeout(a,l))};return a(),{clear:()=>{clearTimeout(s)}}})(e=>{t.perceivedProgress=e,t.perceivedDuration=Date.now()-t.timestamp,s(),t.response&&1===t.perceivedProgress&&!t.complete&&i()},ct(750,1500)),t.request=e(r,n,e=>{t.response=k(e)?e:{type:"load",code:200,body:`${e}`,headers:{}},t.duration=Date.now()-t.timestamp,t.progress=1,o.fire("load",t.response.body),1===t.perceivedProgress&&i()},e=>{t.perceivedPerformanceUpdater.clear(),o.fire("error",k(e)?e:{type:"error",code:0,body:`${e}`})},(e,r,o)=>{t.duration=Date.now()-t.timestamp,t.progress=e?r/o:null,s()},()=>{t.perceivedPerformanceUpdater.clear(),o.fire("abort",t.response?t.response.body:null)},e=>{o.fire("transfer",e)})},abort:r,getProgress:()=>t.progress?Math.min(t.progress,t.perceivedProgress):null,getDuration:()=>Math.min(t.duration,t.perceivedDuration),reset:()=>{r(),t.complete=!1,t.perceivedProgress=0,t.progress=0,t.timestamp=null,t.perceivedDuration=0,t.duration=0,t.request=null,t.response=null}};return o},pt=e=>e.substr(0,e.lastIndexOf("."))||e,Et=e=>!!(e instanceof File||e instanceof Blob&&e.name),ut=e=>{if(!k(e))return e;const t=M(e)?[]:{};for(const r in e){if(!e.hasOwnProperty(r))continue;const o=e[r];t[r]=o&&k(o)?ut(o):o}return t},_t=(e=null,r=null,o=null)=>{const n=se(),s={archived:!1,frozen:!1,released:!1,source:null,file:o,serverFileReference:r,transferId:null,processingAborted:!1,status:r?pe.PROCESSING_COMPLETE:pe.INIT,activeLoader:null,activeProcessor:null};let i=null;const a={},l=e=>s.status=e,c=(e,...t)=>{s.released||s.frozen||E.fire(e,...t)},d=(e,t)=>{if(s.processingAborted)return void(s.processingAborted=!1);if(l(pe.PROCESSING),i=null,!(s.file instanceof Blob))return void E.on("load",()=>{d(e,t)});e.on("load",e=>{s.transferId=null,s.serverFileReference=e}),e.on("transfer",e=>{s.transferId=e}),e.on("load-perceived",e=>{s.activeProcessor=null,s.transferId=null,s.serverFileReference=e,l(pe.PROCESSING_COMPLETE),c("process-complete",e)}),e.on("start",()=>{c("process-start")}),e.on("error",e=>{s.activeProcessor=null,l(pe.PROCESSING_ERROR),c("process-error",e)}),e.on("abort",e=>{s.activeProcessor=null,s.transferId=null,s.serverFileReference=e,l(pe.IDLE),c("process-abort"),i&&i()}),e.on("progress",e=>{c("process-progress",e)});const r=console.error;t(s.file,t=>{s.archived||e.process(t,{...a})},r),s.activeProcessor=e},p=(e,t,r)=>{const o=e.split("."),n=o[0],s=o.pop();let i=a;o.forEach(e=>i=i[e]),JSON.stringify(i[s])!==JSON.stringify(t)&&(i[s]=t,r||c("metadata-update",{key:n,value:a[n]}))},E={id:{get:()=>n},origin:{get:()=>e},serverId:{get:()=>s.serverFileReference},transferId:{get:()=>s.transferId},status:{get:()=>s.status},filename:{get:()=>s.file.name},filenameWithoutExtension:{get:()=>pt(s.file.name)},fileExtension:{get:()=>Ue(s.file.name)},fileType:{get:()=>s.file.type},fileSize:{get:()=>s.file.size},file:{get:()=>s.file},relativePath:{get:()=>s.file._relativePath},source:{get:()=>s.source},getMetadata:e=>ut(e?a[e]:a),setMetadata:(e,t,r)=>{if(k(e)){const r=e;return Object.keys(r).forEach(e=>{p(e,r[e],t)}),e}return p(e,t,r),t},extend:(e,t)=>u[e]=t,abortLoad:()=>{s.activeLoader?s.activeLoader.abort():(l(pe.INIT),c("load-abort"))},retryLoad:()=>{s.activeLoader&&s.activeLoader.load()},requestProcessing:()=>{s.processingAborted=!1,l(pe.PROCESSING_QUEUED)},abortProcessing:()=>new Promise(e=>{if(!s.activeProcessor)return s.processingAborted=!0,l(pe.IDLE),c("process-abort"),void e();i=(()=>{e()}),s.activeProcessor.abort()}),load:(t,r,o)=>{s.source=t,s.file?c("load-skip"):(s.file=(e=>{let t=[e.name,e.size,e.type];return e instanceof Blob||we(e)?t[0]=e.name||qe():we(e)?(t[1]=e.length,t[2]=xe(e)):U(e)&&(t[0]=Ge(e),t[1]=0,t[2]="application/octet-stream"),{name:t[0],size:t[1],type:t[2]}})(t),r.on("init",()=>{c("load-init")}),r.on("meta",t=>{s.file.size=t.size,s.file.filename=t.filename,t.source&&(e=Ee.LIMBO,s.serverFileReference=t.source,s.status=pe.PROCESSING_COMPLETE),c("load-meta")}),r.on("progress",e=>{l(pe.LOADING),c("load-progress",e)}),r.on("error",e=>{l(pe.LOAD_ERROR),c("load-request-error",e)}),r.on("abort",()=>{l(pe.INIT),c("load-abort")}),r.on("load",t=>{s.activeLoader=null;const r=t=>{s.file=Et(t)?t:s.file,e===Ee.LIMBO&&s.serverFileReference?l(pe.PROCESSING_COMPLETE):l(pe.IDLE),c("load")};s.serverFileReference?r(t):o(t,r,e=>{s.file=t,c("load-meta"),l(pe.LOAD_ERROR),c("load-file-error",e)})}),r.setSource(t),s.activeLoader=r,r.load())},process:d,revert:(e,t)=>new Promise((r,o)=>{null!==s.serverFileReference?(e(s.serverFileReference,()=>{s.serverFileReference=null,r()},e=>{t?(l(pe.PROCESSING_REVERT_ERROR),c("process-revert-error"),o(e)):r()}),l(pe.IDLE),c("process-revert")):r()}),...ae(),freeze:()=>s.frozen=!0,release:()=>s.released=!0,released:{get:()=>s.released},archive:()=>s.archived=!0,archived:{get:()=>s.archived}},u=t(E);return u},Tt=(e,t)=>{const r=((e,t)=>b(t)?0:U(t)?e.findIndex(e=>e.id===t):-1)(e,t);if(!(r<0))return e[r]||null},ft=(e,t,r,o,n,s)=>{const i=je(null,e,{method:"GET",responseType:"blob"});return i.onload=(r=>{const o=r.getAllResponseHeaders(),n=$e(o).name||Ge(e);t(Qe("load",r.status,Ve(r.response,n),o))}),i.onerror=(e=>{r(Qe("error",e.status,e.statusText,e.getAllResponseHeaders()))}),i.onheaders=(e=>{s(Qe("headers",e.status,null,e.getAllResponseHeaders()))}),i.ontimeout=Ze(r),i.onprogress=o,i.onabort=n,i},It=e=>(0===e.indexOf("//")&&(e=location.protocol+e),e.toLowerCase().replace("blob:","").replace(/([a-z])?:\/\//,"$1").split("/")[0]),mt=e=>(...t)=>Y(e)?e(...t):e,Rt=(e,t)=>{clearTimeout(t.listUpdateTimeout),t.listUpdateTimeout=setTimeout(()=>{e("DID_UPDATE_ITEMS",{items:Se(t.items)})},0)},ht=(e,...t)=>new Promise(r=>{if(!e)return r(!0);const o=e(...t);return null==o?r(!0):"boolean"==typeof o?r(o):void("function"==typeof o.then&&o.then(r))}),gt=(e,t)=>{e.items.sort((e,r)=>t(de(e),de(r)))},Ot=(e,t)=>({query:r,success:o=(()=>{}),failure:n=(()=>{})}={})=>{const s=Oe(e.items,r);s?t(s,o,n):n({error:Qe("error",0,"Item not found"),file:null})},Dt=(t,r,o)=>({ABORT_ALL:()=>{Se(o.items).forEach(e=>{e.freeze(),e.abortLoad(),e.abortProcessing()})},DID_SET_FILES:({value:e=[]})=>{const r=e.map(e=>({source:e.source?e.source:e,options:e.options}));let n=Se(o.items);n.forEach(e=>{r.find(t=>t.source===e.source||t.source===e.file)||t("REMOVE_ITEM",{query:e})}),n=Se(o.items),r.forEach((e,r)=>{n.find(t=>t.source===e.source||t.file===e.source)||t("ADD_ITEM",{...e,interactionMethod:ne,index:r})})},DID_UPDATE_ITEM_METADATA:({id:e})=>{clearTimeout(o.itemUpdateTimeout),o.itemUpdateTimeout=setTimeout(()=>{const n=Tt(o.items,e);if(!r("IS_ASYNC"))return void Ie("SHOULD_PREPARE_OUTPUT",!1,{item:n,query:r}).then(r=>{r&&t("REQUEST_PREPARE_OUTPUT",{query:e,item:n,success:r=>{t("DID_PREPARE_OUTPUT",{id:e,file:r})}},!0)});const s=()=>{setTimeout(()=>{t("REQUEST_ITEM_PROCESSING",{query:e})},32)};return n.status===pe.PROCESSING_COMPLETE?(e=>{n.revert(lt(o.options.server.url,o.options.server.revert),r("GET_FORCE_REVERT")).then(e?s:()=>{}).catch(()=>{})})(o.options.instantUpload):n.status===pe.PROCESSING?(e=>{n.abortProcessing().then(e?s:()=>{})})(o.options.instantUpload):void(o.options.instantUpload&&s())},0)},MOVE_ITEM:({query:e,index:t})=>{const r=Oe(o.items,e);if(!r)return;const n=o.items.indexOf(r);n!==(t=Ne(t,0,o.items.length-1))&&o.items.splice(t,0,o.items.splice(n,1)[0])},SORT:({compare:e})=>{gt(o,e),t("DID_SORT_ITEMS",{items:r("GET_ACTIVE_ITEMS")})},ADD_ITEMS:({items:e,index:o,interactionMethod:n,success:s=(()=>{}),failure:i=(()=>{})})=>{let a=o;if(-1===o||void 0===o){const e=r("GET_ITEM_INSERT_LOCATION"),t=r("GET_TOTAL_ITEMS");a="before"===e?0:t}const l=r("GET_IGNORED_FILES"),c=e.filter(e=>Et(e)?!l.includes(e.name.toLowerCase()):!b(e)).map(e=>new Promise((r,o)=>{t("ADD_ITEM",{interactionMethod:n,source:e.source||e,success:r,failure:o,index:a++,options:e.options||{}})}));Promise.all(c).then(s).catch(i)},ADD_ITEM:({source:e,index:n=-1,interactionMethod:s,success:i=(()=>{}),failure:a=(()=>{}),options:l={}})=>{if(b(e))return void a({error:Qe("error",0,"No source"),file:null});if(Et(e)&&o.options.ignoredFiles.includes(e.name.toLowerCase()))return;if(!(e=>{const t=Se(e.items).length;if(!e.options.allowMultiple)return 0===t;const r=e.options.maxFiles;return null===r||t{d&&t("ADD_ITEM",{source:e,index:n,interactionMethod:s,success:i,failure:a,options:l})}).catch(()=>{}),d)return}t("REMOVE_ITEM",{query:c.id})}const c="local"===l.type?Ee.LOCAL:"limbo"===l.type?Ee.LIMBO:Ee.INPUT,d=_t(c,c===Ee.INPUT?null:e,l.file);Object.keys(l.metadata||{}).forEach(e=>{d.setMetadata(e,l.metadata[e])}),me("DID_CREATE_ITEM",d,{query:r,dispatch:t});const p=r("GET_ITEM_INSERT_LOCATION");o.options.itemInsertLocationFreedom||(n="before"===p?-1:o.items.length),((e,t,r)=>b(t)?null:void 0===r?(e.push(t),t):(((e,t,r)=>e.splice(t,0,r))(e,r=Ne(r,0,e.length),t),t))(o.items,d,n),Y(p)&&e&>(o,p);const E=d.id;d.on("load-init",()=>{t("DID_START_ITEM_LOAD",{id:E})}),d.on("load-meta",()=>{t("DID_UPDATE_ITEM_META",{id:E})}),d.on("load-progress",e=>{t("DID_UPDATE_ITEM_LOAD_PROGRESS",{id:E,progress:e})}),d.on("load-request-error",e=>{const r=mt(o.options.labelFileLoadError)(e);if(e.code>=400&&e.code<500)return t("DID_THROW_ITEM_INVALID",{id:E,error:e,status:{main:r,sub:`${e.code} (${e.body})`}}),void a({error:e,file:de(d)});t("DID_THROW_ITEM_LOAD_ERROR",{id:E,error:e,status:{main:r,sub:o.options.labelTapToRetry}})}),d.on("load-file-error",e=>{t("DID_THROW_ITEM_INVALID",{id:E,error:e.status,status:e.status}),a({error:e.status,file:de(d)})}),d.on("load-abort",()=>{t("REMOVE_ITEM",{query:E})}),d.on("load-skip",()=>{t("COMPLETE_LOAD_ITEM",{query:E,item:d,data:{source:e,success:i}})}),d.on("load",()=>{const n=n=>{n?(d.on("metadata-update",e=>{t("DID_UPDATE_ITEM_METADATA",{id:E,change:e})}),Ie("SHOULD_PREPARE_OUTPUT",!1,{item:d,query:r}).then(r=>{const n=()=>{t("COMPLETE_LOAD_ITEM",{query:E,item:d,data:{source:e,success:i}}),Rt(t,o)};r?t("REQUEST_PREPARE_OUTPUT",{query:E,item:d,success:e=>{t("DID_PREPARE_OUTPUT",{id:E,file:e}),n()}},!0):n()})):t("REMOVE_ITEM",{query:E})};Ie("DID_LOAD_ITEM",d,{query:r,dispatch:t}).then(()=>{ht(r("GET_BEFORE_ADD_FILE"),de(d)).then(n)}).catch(()=>{n(!1)})}),d.on("process-start",()=>{t("DID_START_ITEM_PROCESSING",{id:E})}),d.on("process-progress",e=>{t("DID_UPDATE_ITEM_PROCESS_PROGRESS",{id:E,progress:e})}),d.on("process-error",e=>{t("DID_THROW_ITEM_PROCESSING_ERROR",{id:E,error:e,status:{main:mt(o.options.labelFileProcessingError)(e),sub:o.options.labelTapToRetry}})}),d.on("process-revert-error",e=>{t("DID_THROW_ITEM_PROCESSING_REVERT_ERROR",{id:E,error:e,status:{main:mt(o.options.labelFileProcessingRevertError)(e),sub:o.options.labelTapToRetry}})}),d.on("process-complete",e=>{t("DID_COMPLETE_ITEM_PROCESSING",{id:E,error:null,serverFileReference:e}),t("DID_DEFINE_VALUE",{id:E,value:e})}),d.on("process-abort",()=>{t("DID_ABORT_ITEM_PROCESSING",{id:E})}),d.on("process-revert",()=>{t("DID_REVERT_ITEM_PROCESSING",{id:E}),t("DID_DEFINE_VALUE",{id:E,value:null})}),t("DID_ADD_ITEM",{id:E,index:n,interactionMethod:s}),Rt(t,o);const{url:u,load:_,restore:T,fetch:f}=o.options.server||{};d.load(e,ze(c===Ee.INPUT?U(e)&&(e=>(e.indexOf(":")>-1||e.indexOf("//")>-1)&&It(location.href)!==It(e))(e)?et(u,f):ft:et(u,c===Ee.LIMBO?T:_)),(e,t,o)=>{Ie("LOAD_FILE",e,{query:r}).then(t).catch(o)})},REQUEST_PREPARE_OUTPUT:({item:e,success:t,failure:o=(()=>{})})=>{const n={error:Qe("error",0,"Item not found"),file:null};if(e.archived)return o(n);Ie("PREPARE_OUTPUT",e.file,{query:r,item:e}).then(s=>{Ie("COMPLETE_PREPARE_OUTPUT",s,{query:r,item:e}).then(r=>{if(e.archived)return o(n);t(r)})})},COMPLETE_LOAD_ITEM:({item:e,data:n})=>{const{success:s,source:i}=n,a=r("GET_ITEM_INSERT_LOCATION");if(Y(a)&&i&>(o,a),t("DID_LOAD_ITEM",{id:e.id,error:null,serverFileReference:e.origin===Ee.INPUT?null:i}),s(de(e)),e.origin!==Ee.LOCAL)return e.origin===Ee.LIMBO?(t("DID_COMPLETE_ITEM_PROCESSING",{id:e.id,error:null,serverFileReference:i}),void t("DID_DEFINE_VALUE",{id:e.id,value:i})):void(r("IS_ASYNC")&&o.options.instantUpload&&t("REQUEST_ITEM_PROCESSING",{query:e.id}));t("DID_LOAD_LOCAL_ITEM",{id:e.id})},RETRY_ITEM_LOAD:Ot(o,e=>{e.retryLoad()}),REQUEST_ITEM_PREPARE:Ot(o,(e,r,o)=>{t("REQUEST_PREPARE_OUTPUT",{query:e.id,item:e,success:o=>{t("DID_PREPARE_OUTPUT",{id:e.id,file:o}),r({file:e,output:o})},failure:o},!0)}),REQUEST_ITEM_PROCESSING:Ot(o,(e,n,s)=>{if(e.status===pe.IDLE||e.status===pe.PROCESSING_ERROR)e.status!==pe.PROCESSING_QUEUED&&(e.requestProcessing(),t("DID_REQUEST_ITEM_PROCESSING",{id:e.id}),t("PROCESS_ITEM",{query:e,success:n,failure:s},!0));else{const i=()=>{setTimeout(()=>{t("REQUEST_ITEM_PROCESSING",{query:e,success:n,failure:s})},32)};e.status===pe.PROCESSING_COMPLETE||e.status===pe.PROCESSING_REVERT_ERROR?e.revert(lt(o.options.server.url,o.options.server.revert),r("GET_FORCE_REVERT")).then(i).catch(()=>{}):e.status===pe.PROCESSING&&e.abortProcessing().then(i)}}),PROCESS_ITEM:Ot(o,(e,n,s)=>{const i=r("GET_MAX_PARALLEL_UPLOADS");if(r("GET_ITEMS_BY_STATUS",pe.PROCESSING).length===i)return void o.processingQueue.push({id:e.id,success:n,failure:s});if(e.status===pe.PROCESSING)return;const a=()=>{const e=o.processingQueue.shift();if(!e)return;const{id:r,success:n,failure:s}=e,i=Oe(o.items,r);i&&!i.archived?t("PROCESS_ITEM",{query:r,success:n,failure:s},!0):a()};e.onOnce("process-complete",()=>{n(de(e)),a(),r("GET_ITEMS_BY_STATUS",pe.PROCESSING_COMPLETE).length===o.items.length&&t("DID_COMPLETE_ITEM_PROCESSING_ALL")}),e.onOnce("process-error",t=>{s({error:t,file:de(e)}),a()});const l=o.options;e.process(dt(at(l.server.url,l.server.process,l.name,{chunkTransferId:e.transferId,chunkServer:l.server.patch,chunkUploads:l.chunkUploads,chunkForce:l.chunkForce,chunkSize:l.chunkSize,chunkRetryDelays:l.chunkRetryDelays})),(o,n,s)=>{Ie("PREPARE_OUTPUT",o,{query:r,item:e}).then(r=>{t("DID_PREPARE_OUTPUT",{id:e.id,file:r}),n(r)}).catch(s)})}),RETRY_ITEM_PROCESSING:Ot(o,e=>{t("REQUEST_ITEM_PROCESSING",{query:e})}),REQUEST_REMOVE_ITEM:Ot(o,e=>{ht(r("GET_BEFORE_REMOVE_FILE"),de(e)).then(r=>{r&&t("REMOVE_ITEM",{query:e})})}),RELEASE_ITEM:Ot(o,e=>{e.release()}),REMOVE_ITEM:Ot(o,(e,r)=>{const n=()=>{const n=e.id;Tt(o.items,n).archive(),t("DID_REMOVE_ITEM",{error:null,id:n,item:e}),Rt(t,o),r(de(e))},s=o.options.server;e.origin===Ee.LOCAL&&s&&Y(s.remove)?(t("DID_START_ITEM_REMOVE",{id:e.id}),s.remove(e.source,()=>n(),r=>{t("DID_THROW_ITEM_REMOVE_ERROR",{id:e.id,error:Qe("error",0,r,null),status:{main:mt(o.options.labelFileRemoveError)(r),sub:o.options.labelTapToRetry}})})):n()}),ABORT_ITEM_LOAD:Ot(o,e=>{e.abortLoad()}),ABORT_ITEM_PROCESSING:Ot(o,e=>{e.serverId?t("REVERT_ITEM_PROCESSING",{id:e.id}):e.abortProcessing().then(()=>{o.options.instantUpload&&t("REMOVE_ITEM",{query:e.id})})}),REQUEST_REVERT_ITEM_PROCESSING:Ot(o,e=>{if(!o.options.instantUpload)return void t("REVERT_ITEM_PROCESSING",{query:e});const n=r=>{r&&t("REVERT_ITEM_PROCESSING",{query:e})},s=r("GET_BEFORE_REMOVE_FILE");if(!s)return n(!0);const i=s(de(e));return null==i?n(!0):"boolean"==typeof i?n(i):void("function"==typeof i.then&&i.then(n))}),REVERT_ITEM_PROCESSING:Ot(o,e=>{e.revert(lt(o.options.server.url,o.options.server.revert),r("GET_FORCE_REVERT")).then(()=>{(o.options.instantUpload||(e=>!Et(e.file))(e))&&t("REMOVE_ITEM",{query:e.id})}).catch(()=>{})}),SET_OPTIONS:({options:r})=>{e(r,(e,r)=>{t(`SET_${Q(e,"_").toUpperCase()}`,{value:r})})}}),St=e=>e,yt=e=>document.createElement(e),At=(e,t)=>{let r=e.childNodes[0];r?t!==r.nodeValue&&(r.nodeValue=t):(r=document.createTextNode(t),e.appendChild(r))},Lt=(e,t,r,o)=>{const n=(o%360-90)*Math.PI/180;return{x:e+r*Math.cos(n),y:t+r*Math.sin(n)}},Pt=(e,t,r,o,n)=>{let s=1;return n>o&&n-o<=.5&&(s=0),o>n&&o-n>=.5&&(s=0),((e,t,r,o,n,s)=>{const i=Lt(e,t,r,n),a=Lt(e,t,r,o);return["M",i.x,i.y,"A",r,r,0,s,0,a.x,a.y].join(" ")})(e,t,r,360*Math.min(.9999,o),360*Math.min(.9999,n),s)},vt=A({tag:"div",name:"progress-indicator",ignoreRectUpdate:!0,ignoreRect:!0,create:({root:e,props:t})=>{t.spin=!1,t.progress=0,t.opacity=0;const r=s("svg");e.ref.path=s("path",{"stroke-width":2,"stroke-linecap":"round"}),r.appendChild(e.ref.path),e.ref.svg=r,e.appendChild(r)},write:({root:e,props:t})=>{if(0===t.opacity)return;t.align&&(e.element.dataset.align=t.align);const o=parseInt(r(e.ref.path,"stroke-width"),10),n=.5*e.rect.element.width;let s=0,i=0;t.spin?(s=0,i=.5):(s=0,i=t.progress);const a=Pt(n,n,n-o,s,i);r(e.ref.path,"d",a),r(e.ref.path,"stroke-opacity",t.spin||t.progress>0?1:0)},mixins:{apis:["progress","spin","align"],styles:["opacity"],animations:{opacity:{type:"tween",duration:500},progress:{type:"spring",stiffness:.95,damping:.65,mass:10}}}}),Mt=A({tag:"button",attributes:{type:"button"},ignoreRect:!0,ignoreRectUpdate:!0,name:"file-action-button",mixins:{apis:["label"],styles:["translateX","translateY","scaleX","scaleY","opacity"],animations:{scaleX:"spring",scaleY:"spring",translateX:"spring",translateY:"spring",opacity:{type:"tween",duration:250}},listeners:!0},create:({root:e,props:t})=>{e.element.innerHTML=(t.icon||"")+`${t.label}`,t.isDisabled=!1},write:({root:e,props:t})=>{const{isDisabled:o}=t,n=e.query("GET_DISABLED")||0===t.opacity;n&&!o?(t.isDisabled=!0,r(e.element,"disabled","disabled")):!n&&o&&(t.isDisabled=!1,e.element.removeAttribute("disabled"))}}),bt=(e,t=".")=>(e=Math.round(Math.abs(e)))<1e3?`${e} bytes`:ee.toFixed(t).split(".").filter(e=>"0"!==e).join(r),Ut=({root:e,props:t})=>{At(e.ref.fileSize,bt(e.query("GET_ITEM_SIZE",t.id))),At(e.ref.fileName,St(e.query("GET_ITEM_NAME",t.id)))},Bt=({root:e,props:t})=>{F(e.query("GET_ITEM_SIZE",t.id))||At(e.ref.fileSize,e.query("GET_LABEL_FILE_SIZE_NOT_AVAILABLE"))},qt=A({name:"file-info",ignoreRect:!0,ignoreRectUpdate:!0,write:L({DID_LOAD_ITEM:Ut,DID_UPDATE_ITEM_META:Ut,DID_THROW_ITEM_LOAD_ERROR:Bt,DID_THROW_ITEM_INVALID:Bt}),didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},create:({root:e,props:t})=>{const o=yt("span");o.className="filepond--file-info-main",r(o,"aria-hidden","true"),e.appendChild(o),e.ref.fileName=o;const n=yt("span");n.className="filepond--file-info-sub",e.appendChild(n),e.ref.fileSize=n,At(n,e.query("GET_LABEL_FILE_WAITING_FOR_SIZE")),At(o,St(e.query("GET_ITEM_NAME",t.id)))},mixins:{styles:["translateX","translateY"],animations:{translateX:"spring",translateY:"spring"}}}),Vt=e=>Math.round(100*e),Ft=({root:e,action:t})=>{const r=null===t.progress?e.query("GET_LABEL_FILE_LOADING"):`${e.query("GET_LABEL_FILE_LOADING")} ${Vt(t.progress)}%`;At(e.ref.main,r),At(e.ref.sub,e.query("GET_LABEL_TAP_TO_CANCEL"))},xt=({root:e})=>{At(e.ref.main,""),At(e.ref.sub,"")},Yt=({root:e,action:t})=>{At(e.ref.main,t.status.main),At(e.ref.sub,t.status.sub)},Ht=A({name:"file-status",ignoreRect:!0,ignoreRectUpdate:!0,write:L({DID_LOAD_ITEM:xt,DID_REVERT_ITEM_PROCESSING:xt,DID_REQUEST_ITEM_PROCESSING:({root:e})=>{At(e.ref.main,e.query("GET_LABEL_FILE_PROCESSING")),At(e.ref.sub,e.query("GET_LABEL_TAP_TO_CANCEL"))},DID_ABORT_ITEM_PROCESSING:({root:e})=>{At(e.ref.main,e.query("GET_LABEL_FILE_PROCESSING_ABORTED")),At(e.ref.sub,e.query("GET_LABEL_TAP_TO_RETRY"))},DID_COMPLETE_ITEM_PROCESSING:({root:e})=>{At(e.ref.main,e.query("GET_LABEL_FILE_PROCESSING_COMPLETE")),At(e.ref.sub,e.query("GET_LABEL_TAP_TO_UNDO"))},DID_UPDATE_ITEM_PROCESS_PROGRESS:({root:e,action:t})=>{const r=null===t.progress?e.query("GET_LABEL_FILE_PROCESSING"):`${e.query("GET_LABEL_FILE_PROCESSING")} ${Vt(t.progress)}%`;At(e.ref.main,r),At(e.ref.sub,e.query("GET_LABEL_TAP_TO_CANCEL"))},DID_UPDATE_ITEM_LOAD_PROGRESS:Ft,DID_THROW_ITEM_LOAD_ERROR:Yt,DID_THROW_ITEM_INVALID:Yt,DID_THROW_ITEM_PROCESSING_ERROR:Yt,DID_THROW_ITEM_PROCESSING_REVERT_ERROR:Yt,DID_THROW_ITEM_REMOVE_ERROR:Yt}),didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},create:({root:e})=>{const t=yt("span");t.className="filepond--file-status-main",e.appendChild(t),e.ref.main=t;const r=yt("span");r.className="filepond--file-status-sub",e.appendChild(r),e.ref.sub=r,Ft({root:e,action:{progress:null}})},mixins:{styles:["translateX","translateY","opacity"],animations:{opacity:{type:"tween",duration:250},translateX:"spring",translateY:"spring"}}}),Xt={AbortItemLoad:{label:"GET_LABEL_BUTTON_ABORT_ITEM_LOAD",action:"ABORT_ITEM_LOAD",className:"filepond--action-abort-item-load",align:"LOAD_INDICATOR_POSITION"},RetryItemLoad:{label:"GET_LABEL_BUTTON_RETRY_ITEM_LOAD",action:"RETRY_ITEM_LOAD",icon:"GET_ICON_RETRY",className:"filepond--action-retry-item-load",align:"BUTTON_PROCESS_ITEM_POSITION"},RemoveItem:{label:"GET_LABEL_BUTTON_REMOVE_ITEM",action:"REQUEST_REMOVE_ITEM",icon:"GET_ICON_REMOVE",className:"filepond--action-remove-item",align:"BUTTON_REMOVE_ITEM_POSITION"},ProcessItem:{label:"GET_LABEL_BUTTON_PROCESS_ITEM",action:"REQUEST_ITEM_PROCESSING",icon:"GET_ICON_PROCESS",className:"filepond--action-process-item",align:"BUTTON_PROCESS_ITEM_POSITION"},AbortItemProcessing:{label:"GET_LABEL_BUTTON_ABORT_ITEM_PROCESSING",action:"ABORT_ITEM_PROCESSING",className:"filepond--action-abort-item-processing",align:"BUTTON_PROCESS_ITEM_POSITION"},RetryItemProcessing:{label:"GET_LABEL_BUTTON_RETRY_ITEM_PROCESSING",action:"RETRY_ITEM_PROCESSING",icon:"GET_ICON_RETRY",className:"filepond--action-retry-item-processing",align:"BUTTON_PROCESS_ITEM_POSITION"},RevertItemProcessing:{label:"GET_LABEL_BUTTON_UNDO_ITEM_PROCESSING",action:"REQUEST_REVERT_ITEM_PROCESSING",icon:"GET_ICON_UNDO",className:"filepond--action-revert-item-processing",align:"BUTTON_PROCESS_ITEM_POSITION"}},kt=[];e(Xt,e=>{kt.push(e)});const $t=e=>{const t=e.ref.buttonRemoveItem.rect.element;return t.hidden?null:t.width+t.left},zt=e=>Math.floor(e.ref.buttonRemoveItem.rect.element.height/4),Wt=e=>Math.floor(e.ref.buttonRemoveItem.rect.element.left/2),jt=e=>e.query("GET_STYLE_BUTTON_REMOVE_ITEM_POSITION"),Qt={buttonAbortItemLoad:{opacity:0},buttonRetryItemLoad:{opacity:0},buttonRemoveItem:{opacity:0},buttonProcessItem:{opacity:0},buttonAbortItemProcessing:{opacity:0},buttonRetryItemProcessing:{opacity:0},buttonRevertItemProcessing:{opacity:0},loadProgressIndicator:{opacity:0,align:e=>e.query("GET_STYLE_LOAD_INDICATOR_POSITION")},processProgressIndicator:{opacity:0,align:e=>e.query("GET_STYLE_PROGRESS_INDICATOR_POSITION")},processingCompleteIndicator:{opacity:0,scaleX:.75,scaleY:.75},info:{translateX:0,translateY:0,opacity:0},status:{translateX:0,translateY:0,opacity:0}},Zt={buttonRemoveItem:{opacity:1},buttonProcessItem:{opacity:1},info:{translateX:$t},status:{translateX:$t}},Kt={buttonAbortItemProcessing:{opacity:1},processProgressIndicator:{opacity:1},status:{opacity:1}},Jt={DID_THROW_ITEM_INVALID:{buttonRemoveItem:{opacity:1},info:{translateX:$t},status:{translateX:$t,opacity:1}},DID_START_ITEM_LOAD:{buttonAbortItemLoad:{opacity:1},loadProgressIndicator:{opacity:1},status:{opacity:1}},DID_THROW_ITEM_LOAD_ERROR:{buttonRetryItemLoad:{opacity:1},buttonRemoveItem:{opacity:1},info:{translateX:$t},status:{opacity:1}},DID_START_ITEM_REMOVE:{processProgressIndicator:{opacity:1,align:jt},info:{translateX:$t},status:{opacity:0}},DID_THROW_ITEM_REMOVE_ERROR:{processProgressIndicator:{opacity:0,align:jt},buttonRemoveItem:{opacity:1},info:{translateX:$t},status:{opacity:1,translateX:$t}},DID_LOAD_ITEM:Zt,DID_LOAD_LOCAL_ITEM:{buttonRemoveItem:{opacity:1},info:{translateX:$t},status:{translateX:$t}},DID_START_ITEM_PROCESSING:Kt,DID_REQUEST_ITEM_PROCESSING:Kt,DID_UPDATE_ITEM_PROCESS_PROGRESS:Kt,DID_COMPLETE_ITEM_PROCESSING:{buttonRevertItemProcessing:{opacity:1},info:{opacity:1},status:{opacity:1}},DID_THROW_ITEM_PROCESSING_ERROR:{buttonRemoveItem:{opacity:1},buttonRetryItemProcessing:{opacity:1},status:{opacity:1},info:{translateX:$t}},DID_THROW_ITEM_PROCESSING_REVERT_ERROR:{buttonRevertItemProcessing:{opacity:1},status:{opacity:1},info:{opacity:1}},DID_ABORT_ITEM_PROCESSING:{buttonRemoveItem:{opacity:1},buttonProcessItem:{opacity:1},info:{translateX:$t},status:{opacity:1}},DID_REVERT_ITEM_PROCESSING:Zt},er=A({create:({root:e})=>{e.element.innerHTML=e.query("GET_ICON_DONE")},name:"processing-complete-indicator",ignoreRect:!0,mixins:{styles:["scaleX","scaleY","opacity"],animations:{scaleX:"spring",scaleY:"spring",opacity:{type:"tween",duration:250}}}}),tr=L({DID_SET_LABEL_BUTTON_ABORT_ITEM_PROCESSING:({root:e,action:t})=>{e.ref.buttonAbortItemProcessing.label=t.value},DID_SET_LABEL_BUTTON_ABORT_ITEM_LOAD:({root:e,action:t})=>{e.ref.buttonAbortItemLoad.label=t.value},DID_SET_LABEL_BUTTON_ABORT_ITEM_REMOVAL:({root:e,action:t})=>{e.ref.buttonAbortItemRemoval.label=t.value},DID_REQUEST_ITEM_PROCESSING:({root:e})=>{e.ref.processProgressIndicator.spin=!0,e.ref.processProgressIndicator.progress=0},DID_START_ITEM_LOAD:({root:e})=>{e.ref.loadProgressIndicator.spin=!0,e.ref.loadProgressIndicator.progress=0},DID_START_ITEM_REMOVE:({root:e})=>{e.ref.processProgressIndicator.spin=!0,e.ref.processProgressIndicator.progress=0},DID_UPDATE_ITEM_LOAD_PROGRESS:({root:e,action:t})=>{e.ref.loadProgressIndicator.spin=!1,e.ref.loadProgressIndicator.progress=t.progress},DID_UPDATE_ITEM_PROCESS_PROGRESS:({root:e,action:t})=>{e.ref.processProgressIndicator.spin=!1,e.ref.processProgressIndicator.progress=t.progress}}),rr=A({create:({root:t,props:r})=>{const{id:o}=r,n=t.query("GET_ALLOW_REVERT"),s=t.query("GET_INSTANT_UPLOAD"),i=t.query("IS_ASYNC"),a=t.query("GET_STYLE_BUTTON_REMOVE_ITEM_ALIGN"),l=i?kt.concat():kt.filter(e=>!/Process/.test(e));if(s&&n&&(Xt.RevertItemProcessing.label="GET_LABEL_BUTTON_REMOVE_ITEM",Xt.RevertItemProcessing.icon="GET_ICON_REMOVE"),i&&!n){l.splice(-1,1);const e=Jt.DID_COMPLETE_ITEM_PROCESSING;e.info.translateX=Wt,e.info.translateY=zt,e.status.translateY=zt,e.processingCompleteIndicator={opacity:1,scaleX:1,scaleY:1}}if(a&&n){Xt.RevertItemProcessing.align="BUTTON_REMOVE_ITEM_POSITION";const e=Jt.DID_COMPLETE_ITEM_PROCESSING;e.info.translateX=$t,e.status.translateY=zt,e.processingCompleteIndicator={opacity:1,scaleX:1,scaleY:1}}e(Xt,(e,r)=>{const n=t.createChildView(Mt,{label:t.query(r.label),icon:t.query(r.icon),opacity:0});l.includes(e)&&t.appendChildView(n),n.element.dataset.align=t.query(`GET_STYLE_${r.align}`),n.element.classList.add(r.className),n.on("click",e=>{e.stopPropagation(),t.dispatch(r.action,{query:o})}),t.ref[`button${e}`]=n}),t.ref.processingCompleteIndicator=t.appendChildView(t.createChildView(er)),t.ref.processingCompleteIndicator.element.dataset.align=t.query("GET_STYLE_BUTTON_PROCESS_ITEM_POSITION"),t.ref.info=t.appendChildView(t.createChildView(qt,{id:o})),t.ref.status=t.appendChildView(t.createChildView(Ht,{id:o}));const c=t.appendChildView(t.createChildView(vt,{opacity:0,align:t.query("GET_STYLE_LOAD_INDICATOR_POSITION")}));c.element.classList.add("filepond--load-indicator"),t.ref.loadProgressIndicator=c;const d=t.appendChildView(t.createChildView(vt,{opacity:0,align:t.query("GET_STYLE_PROGRESS_INDICATOR_POSITION")}));d.element.classList.add("filepond--process-indicator"),t.ref.processProgressIndicator=d,t.ref.activeStyles=[]},write:({root:t,actions:r,props:o})=>{tr({root:t,actions:r,props:o});let n=r.concat().filter(e=>/^DID_/.test(e.type)).reverse().find(e=>Jt[e.type]);if(n){t.ref.activeStyles=[];const r=Jt[n.type];e(Qt,(o,n)=>{const s=t.ref[o];e(n,(e,n)=>{const i=r[o]&&void 0!==r[o][e]?r[o][e]:n;t.ref.activeStyles.push({control:s,key:e,value:i})})})}t.ref.activeStyles.forEach(({control:e,key:r,value:o})=>{e[r]="function"==typeof o?o(t):o})},didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},name:"file"}),or=A({create:({root:e,props:t})=>{e.ref.fileName=yt("legend"),e.appendChild(e.ref.fileName),e.ref.file=e.appendChildView(e.createChildView(rr,{id:t.id})),e.ref.data=!1},ignoreRect:!0,write:L({DID_LOAD_ITEM:({root:e,props:t})=>{At(e.ref.fileName,St(e.query("GET_ITEM_NAME",t.id)))}}),didCreateView:e=>{me("CREATE_VIEW",{...e,view:e})},tag:"fieldset",name:"file-wrapper"}),nr={type:"spring",damping:.6,mass:7},sr=(e,t,r)=>{const o=A({name:`panel-${t.name} filepond--${r}`,mixins:t.mixins,ignoreRectUpdate:!0}),n=e.createChildView(o,t.props);e.ref[t.name]=e.appendChildView(n)},ir=A({name:"panel",write:({root:e,props:t})=>{if(null!==e.ref.scalable&&t.scalable===e.ref.scalable||(e.ref.scalable=!w(t.scalable)||t.scalable,e.element.dataset.scalable=e.ref.scalable),!t.height)return;const r=e.ref.top.rect.element,o=e.ref.bottom.rect.element,n=Math.max(r.height+o.height,t.height);e.ref.center.translateY=r.height,e.ref.center.scaleY=(n-r.height-o.height)/100,e.ref.bottom.translateY=n-o.height},create:({root:e,props:t})=>{[{name:"top"},{name:"center",props:{translateY:null,scaleY:null},mixins:{animations:{scaleY:nr},styles:["translateY","scaleY"]}},{name:"bottom",props:{translateY:null},mixins:{animations:{translateY:nr},styles:["translateY"]}}].forEach(r=>{sr(e,r,t.name)}),e.element.classList.add(`filepond--${t.name}`),e.ref.scalable=null},ignoreRect:!0,mixins:{apis:["height","scalable"]}}),ar={type:"spring",stiffness:.75,damping:.45,mass:10},lr={DID_START_ITEM_LOAD:"busy",DID_UPDATE_ITEM_LOAD_PROGRESS:"loading",DID_THROW_ITEM_INVALID:"load-invalid",DID_THROW_ITEM_LOAD_ERROR:"load-error",DID_LOAD_ITEM:"idle",DID_THROW_ITEM_REMOVE_ERROR:"remove-error",DID_START_ITEM_REMOVE:"busy",DID_START_ITEM_PROCESSING:"busy",DID_REQUEST_ITEM_PROCESSING:"busy",DID_UPDATE_ITEM_PROCESS_PROGRESS:"processing",DID_COMPLETE_ITEM_PROCESSING:"processing-complete",DID_THROW_ITEM_PROCESSING_ERROR:"processing-error",DID_THROW_ITEM_PROCESSING_REVERT_ERROR:"processing-revert-error",DID_ABORT_ITEM_PROCESSING:"cancelled",DID_REVERT_ITEM_PROCESSING:"idle"},cr=L({DID_UPDATE_PANEL_HEIGHT:({root:e,action:t})=>{e.height=t.height}}),dr=L({DID_GRAB_ITEM:({root:e,props:t})=>{t.dragOrigin={x:e.translateX,y:e.translateY}},DID_DRAG_ITEM:({root:e})=>{e.element.dataset.dragState="drag"},DID_DROP_ITEM:({root:e,props:t})=>{t.dragOffset=null,t.dragOrigin=null,e.element.dataset.dragState="drop"}},({root:e,actions:t,props:r,shouldOptimize:o})=>{"drop"===e.element.dataset.dragState&&e.scaleX<=1&&(e.element.dataset.dragState="idle");let n=t.concat().filter(e=>/^DID_/.test(e.type)).reverse().find(e=>lr[e.type]);n&&n.type!==r.currentState&&(r.currentState=n.type,e.element.dataset.filepondItemState=lr[r.currentState]||"");const s=e.query("GET_ITEM_PANEL_ASPECT_RATIO")||e.query("GET_PANEL_ASPECT_RATIO");s?o||(e.height=e.rect.element.width*s):(cr({root:e,actions:t,props:r}),!e.height&&e.ref.container.rect.element.height>0&&(e.height=e.ref.container.rect.element.height)),o&&(e.ref.panel.height=null),e.ref.panel.height=e.height}),pr=A({create:({root:e,props:t})=>{if(e.ref.handleClick=(r=>e.dispatch("DID_ACTIVATE_ITEM",{id:t.id})),e.element.id=`filepond--item-${t.id}`,e.element.addEventListener("click",e.ref.handleClick),e.ref.container=e.appendChildView(e.createChildView(or,{id:t.id})),e.ref.panel=e.appendChildView(e.createChildView(ir,{name:"item-panel"})),e.ref.panel.height=null,t.markedForRemoval=!1,!e.query("GET_ALLOW_REORDER"))return;e.element.dataset.dragState="idle";e.element.addEventListener("pointerdown",r=>{if(!r.isPrimary)return;let o=!1;const n=r.pageX,s=r.pageY;t.dragOrigin={x:e.translateX,y:e.translateY},t.dragCenter={x:r.offsetX,y:r.offsetY},e.dispatch("DID_GRAB_ITEM",{id:t.id});const i=r=>{r.isPrimary&&(r.stopPropagation(),r.preventDefault(),t.dragOffset={x:r.pageX-n,y:r.pageY-s},t.dragOffset.x*t.dragOffset.x+t.dragOffset.y*t.dragOffset.y>16&&!o&&(o=!0,e.element.removeEventListener("click",e.ref.handleClick)),e.dispatch("DID_DRAG_ITEM",{id:t.id}))},a=r=>{r.isPrimary&&(document.removeEventListener("pointermove",i),document.removeEventListener("pointerup",a),t.dragOffset={x:r.pageX-n,y:r.pageY-s},e.dispatch("DID_DROP_ITEM",{id:t.id}),o&&setTimeout(()=>e.element.addEventListener("click",e.ref.handleClick),0))};document.addEventListener("pointermove",i),document.addEventListener("pointerup",a)})},write:dr,destroy:({root:e,props:t})=>{e.element.removeEventListener("click",e.ref.handleClick),e.dispatch("RELEASE_ITEM",{query:t.id})},tag:"li",name:"item",mixins:{apis:["id","interactionMethod","markedForRemoval","spawnDate","dragCenter","dragOrigin","dragOffset"],styles:["translateX","translateY","scaleX","scaleY","opacity","height"],animations:{scaleX:"spring",scaleY:"spring",translateX:ar,translateY:ar,opacity:{type:"tween",duration:150}}}}),Er=(e,t,r)=>{if(!r)return;const o=e.rect.element.width,n=t.length;let s=null;if(0===n||r.topa){if(r.left{e.dragOffset?(e.translateX=null,e.translateY=null,e.translateX=e.dragOrigin.x+e.dragOffset.x,e.translateY=e.dragOrigin.y+e.dragOffset.y,e.scaleX=1.025,e.scaleY=1.025):(e.translateX=t,e.translateY=r,Date.now()>e.spawnDate&&(0===e.opacity&&_r(e,t,r,o,n),e.scaleX=1,e.scaleY=1,e.opacity=1))},_r=(e,t,r,o,n)=>{e.interactionMethod===ne?(e.translateX=null,e.translateX=t,e.translateY=null,e.translateY=r):e.interactionMethod===te?(e.translateX=null,e.translateX=t-20*o,e.translateY=null,e.translateY=r-10*n,e.scaleX=.8,e.scaleY=.8):e.interactionMethod===re?(e.translateY=null,e.translateY=r-30):e.interactionMethod===ee&&(e.translateX=null,e.translateX=t-30,e.translateY=null)},Tr=e=>e.rect.element.height+.5*e.rect.element.marginBottom+.5*e.rect.element.marginTop,fr=L({DID_ADD_ITEM:({root:e,action:t})=>{const{id:r,index:o,interactionMethod:n}=t;e.ref.addIndex=o;const s=Date.now();let i=s,a=1;if(n!==ne){a=0;const t=e.query("GET_ITEM_INSERT_INTERVAL"),r=s-e.ref.lastItemSpanwDate;i=r{const{id:r}=t,o=e.childViews.find(e=>e.id===r);o&&(o.scaleX=.9,o.scaleY=.9,o.opacity=0,o.markedForRemoval=!0)},DID_DRAG_ITEM:({root:e,action:t,props:r})=>{const{id:o}=t,n=e.childViews.find(e=>e.id===o);if(!n)return;const s=n.dragOrigin.y+n.dragOffset.y+n.dragCenter.y,i=e.query("GET_ACTIVE_ITEMS"),a=e.childViews.filter(e=>e.rect.element.height),l=i.map(e=>a.find(t=>t.id===e.id)),c=l.length;let d=c-1,p=0,E=0,u=0,_=l.findIndex(e=>e===n),T=Tr(n);for(let e=0;ee){if(s{r(e.element,"role","list"),e.ref.lastItemSpanwDate=Date.now()},write:({root:e,props:t,actions:r,shouldOptimize:o})=>{fr({root:e,props:t,actions:r});const{dragCoordinates:n}=t,s=e.rect.element.width,i=e.childViews.filter(e=>e.rect.element.height),a=e.query("GET_ACTIVE_ITEMS").map(e=>i.find(t=>t.id===e.id)).filter(e=>e),l=n?Er(e,a,n):null,c=e.ref.addIndex||null;e.ref.addIndex=null;let d=0,p=0,E=0;if(0===a.length)return;const u=a[0].rect.element,_=u.marginTop+u.marginBottom,T=u.marginLeft+u.marginRight,f=u.width+T,I=u.height+_,m=Math.round(s/f);if(1===m){let e=0,t=0;a.forEach((r,n)=>{if(l){let e=n-l;t=-2===e?.25*-_:-1===e?.75*-_:0===e?.75*_:1===e?.25*_:0}o&&(r.translateX=null,r.translateY=null),r.markedForRemoval||ur(r,0,e+t);let s=(r.rect.element.height+_)*(r.markedForRemoval?r.opacity:1);e+=s})}else{let e=0,t=0;a.forEach((r,n)=>{n===l&&(d=1),n===c&&(E+=1),r.markedForRemoval&&r.opacity<.5&&(p-=1);const s=n+E+d+p,i=s%m,a=Math.floor(s/m),u=i*f,_=a*I,T=Math.sign(u-e),R=Math.sign(_-t);e=u,t=_,r.markedForRemoval||(o&&(r.translateX=null,r.translateY=null),ur(r,u,_,T,R))})}},tag:"ul",name:"list",didWriteView:({root:e})=>{e.childViews.filter(e=>e.markedForRemoval&&0===e.opacity&&e.resting).forEach(t=>{t._destroy(),e.removeChildView(t)})},filterFrameActionsForChild:(e,t)=>t.filter(t=>!t.data||!t.data.id||e.id===t.data.id),mixins:{apis:["dragCoordinates"]}}),mr=L({DID_DRAG:({root:e,props:t,action:r})=>{e.query("GET_ITEM_INSERT_LOCATION_FREEDOM")&&(t.dragCoordinates={left:r.position.scopeLeft-e.ref.list.rect.element.left,top:r.position.scopeTop-(e.rect.outer.top+e.rect.element.marginTop+e.rect.element.scrollTop)})},DID_END_DRAG:({props:e})=>{e.dragCoordinates=null}}),Rr=A({create:({root:e,props:t})=>{e.ref.list=e.appendChildView(e.createChildView(Ir)),t.dragCoordinates=null,t.overflowing=!1},write:({root:e,props:t,actions:r})=>{if(mr({root:e,props:t,actions:r}),e.ref.list.dragCoordinates=t.dragCoordinates,t.overflowing&&!t.overflow&&(t.overflowing=!1,e.element.dataset.state="",e.height=null),t.overflow){const r=Math.round(t.overflow);r!==e.height&&(t.overflowing=!0,e.element.dataset.state="overflow",e.height=r)}},name:"list-scroller",mixins:{apis:["overflow","dragCoordinates"],styles:["height","translateY"],animations:{translateY:"spring"}}}),hr=(e,t,o,n="")=>{o?r(e,t,n):e.removeAttribute(t)},gr=({root:e,action:t})=>{hr(e.element,"accept",!!t.value,t.value?t.value.join(","):"")},Or=({root:e,action:t})=>{hr(e.element,"multiple",t.value)},Dr=({root:e,action:t})=>{hr(e.element,"webkitdirectory",t.value)},Sr=({root:e})=>{const t=e.query("GET_DISABLED"),r=e.query("GET_ALLOW_BROWSE"),o=t||!r;hr(e.element,"disabled",o)},yr=({root:e,action:t})=>{t.value?0===e.query("GET_TOTAL_ITEMS")&&hr(e.element,"required",!0):hr(e.element,"required",!1)},Ar=({root:e,action:t})=>{hr(e.element,"capture",!!t.value,!0===t.value?"":t.value)},Lr=({root:e})=>{const{element:t}=e;if(e.query("GET_TOTAL_ITEMS")>0)hr(t,"required",!1),hr(t,"name",!1);else{hr(t,"name",!0,e.query("GET_NAME")),e.query("GET_CHECK_VALIDITY")&&t.setCustomValidity(""),e.query("GET_REQUIRED")&&hr(t,"required",!0)}},Pr=A({tag:"input",name:"browser",ignoreRect:!0,ignoreRectUpdate:!0,attributes:{type:"file"},create:({root:e,props:t})=>{e.element.id=`filepond--browser-${t.id}`,r(e.element,"name",e.query("GET_NAME")),r(e.element,"aria-controls",`filepond--assistant-${t.id}`),r(e.element,"aria-labelledby",`filepond--drop-label-${t.id}`),gr({root:e,action:{value:e.query("GET_ACCEPTED_FILE_TYPES")}}),Or({root:e,action:{value:e.query("GET_ALLOW_MULTIPLE")}}),Dr({root:e,action:{value:e.query("GET_ALLOW_DIRECTORIES_ONLY")}}),Sr({root:e}),yr({root:e,action:{value:e.query("GET_REQUIRED")}}),Ar({root:e,action:{value:e.query("GET_CAPTURE_METHOD")}}),e.ref.handleChange=(r=>{if(!e.element.value)return;const o=Array.from(e.element.files).map(e=>(e._relativePath=e.webkitRelativePath,e));setTimeout(()=>{t.onload(o),(e=>{if(e&&""!==e.value){try{e.value=""}catch(e){}if(e.value){const t=yt("form"),r=e.parentNode,o=e.nextSibling;t.appendChild(e),t.reset(),o?r.insertBefore(e,o):r.appendChild(e)}}})(e.element)},250)}),e.element.addEventListener("change",e.ref.handleChange)},destroy:({root:e})=>{e.element.removeEventListener("change",e.ref.handleChange)},write:L({DID_LOAD_ITEM:Lr,DID_REMOVE_ITEM:Lr,DID_THROW_ITEM_INVALID:({root:e})=>{e.query("GET_CHECK_VALIDITY")&&e.element.setCustomValidity(e.query("GET_LABEL_INVALID_FIELD"))},DID_SET_DISABLED:Sr,DID_SET_ALLOW_BROWSE:Sr,DID_SET_ALLOW_DIRECTORIES_ONLY:Dr,DID_SET_ALLOW_MULTIPLE:Or,DID_SET_ACCEPTED_FILE_TYPES:gr,DID_SET_CAPTURE_METHOD:Ar,DID_SET_REQUIRED:yr})}),vr=13,Mr=32,br=(e,t)=>{e.innerHTML=t;const o=e.querySelector(".filepond--label-action");return o&&r(o,"tabindex","0"),t},Cr=A({name:"drop-label",ignoreRect:!0,create:({root:e,props:t})=>{const o=yt("label");r(o,"for",`filepond--browser-${t.id}`),r(o,"id",`filepond--drop-label-${t.id}`),r(o,"aria-hidden","true"),e.ref.handleKeyDown=(t=>{(t.keyCode===vr||t.keyCode===Mr)&&(t.preventDefault(),e.ref.label.click())}),e.ref.handleClick=(t=>{t.target===o||o.contains(t.target)||e.ref.label.click()}),o.addEventListener("keydown",e.ref.handleKeyDown),e.element.addEventListener("click",e.ref.handleClick),br(o,t.caption),e.appendChild(o),e.ref.label=o},destroy:({root:e})=>{e.ref.label.addEventListener("keydown",e.ref.handleKeyDown),e.element.removeEventListener("click",e.ref.handleClick)},write:L({DID_SET_LABEL_IDLE:({root:e,action:t})=>{br(e.ref.label,t.value)}}),mixins:{styles:["opacity","translateX","translateY"],animations:{opacity:{type:"tween",duration:150},translateX:"spring",translateY:"spring"}}}),Nr=A({name:"drip-blob",ignoreRect:!0,mixins:{styles:["translateX","translateY","scaleX","scaleY","opacity"],animations:{scaleX:"spring",scaleY:"spring",translateX:"spring",translateY:"spring",opacity:{type:"tween",duration:250}}}}),wr=L({DID_DRAG:({root:e,action:t})=>{e.ref.blob?(e.ref.blob.translateX=t.position.scopeLeft,e.ref.blob.translateY=t.position.scopeTop,e.ref.blob.scaleX=1,e.ref.blob.scaleY=1,e.ref.blob.opacity=1):(({root:e})=>{const t=.5*e.rect.element.width,r=.5*e.rect.element.height;e.ref.blob=e.appendChildView(e.createChildView(Nr,{opacity:0,scaleX:2.5,scaleY:2.5,translateX:t,translateY:r}))})({root:e})},DID_DROP:({root:e})=>{e.ref.blob&&(e.ref.blob.scaleX=2.5,e.ref.blob.scaleY=2.5,e.ref.blob.opacity=0)},DID_END_DRAG:({root:e})=>{e.ref.blob&&(e.ref.blob.opacity=0)}}),Gr=A({ignoreRect:!0,ignoreRectUpdate:!0,name:"drip",write:({root:e,props:t,actions:r})=>{wr({root:e,props:t,actions:r});const{blob:o}=e.ref;0===r.length&&o&&0===o.opacity&&(e.removeChildView(o),e.ref.blob=null)}}),Ur=(e,t)=>e.ref.fields[t],Br=({root:e})=>(e=>{e.query("GET_ACTIVE_ITEMS").forEach(t=>{e.element.appendChild(e.ref.fields[t.id])})})(e),qr=L({DID_SET_DISABLED:({root:e})=>{e.element.disabled=e.query("GET_DISABLED")},DID_ADD_ITEM:({root:e,action:t})=>{const r=yt("input");r.type="hidden",r.name=e.query("GET_NAME"),r.disabled=e.query("GET_DISABLED"),e.appendChild(r,0),e.ref.fields[t.id]=r},DID_LOAD_ITEM:({root:e,action:t})=>{const r=Ur(e,t.id);r&&null!==t.serverFileReference&&(r.value=t.serverFileReference)},DID_REMOVE_ITEM:({root:e,action:t})=>{const r=Ur(e,t.id);r&&(r.parentNode.removeChild(r),delete e.ref.fields[t.id])},DID_DEFINE_VALUE:({root:e,action:t})=>{const r=Ur(e,t.id);r&&(null===t.value?r.removeAttribute("value"):r.value=t.value)},DID_REORDER_ITEMS:Br,DID_SORT_ITEMS:Br}),Vr=A({tag:"fieldset",name:"data",create:({root:e})=>e.ref.fields={},write:qr,ignoreRect:!0}),Fr=["jpg","jpeg","png","gif","bmp","webp","svg","tiff"],xr=["css","csv","html","txt"],Yr={zip:"zip|compressed",epub:"application/epub+zip"},Hr=(e="")=>(e=e.toLowerCase(),Fr.includes(e)?"image/"+("jpg"===e?"jpeg":"svg"===e?"svg+xml":e):xr.includes(e)?"text/"+e:Yr[e]||""),Xr=e=>new Promise((t,r)=>{const o=eo(e);if(o.length&&!kr(e))return t(o);$r(e).then(t)}),kr=e=>!!e.files&&e.files.length>0,$r=e=>new Promise((t,r)=>{const o=(e.items?Array.from(e.items):[]).filter(e=>zr(e)).map(e=>Wr(e));o.length?Promise.all(o).then(e=>{const r=[];e.forEach(e=>{r.push.apply(r,e)}),t(r.filter(e=>e).map(e=>(e._relativePath||(e._relativePath=e.webkitRelativePath),e)))}).catch(console.error):t(e.files?Array.from(e.files):[])}),zr=e=>{if(Kr(e)){const t=Jr(e);if(t)return t.isFile||t.isDirectory}return"file"===e.kind},Wr=e=>new Promise((t,r)=>{Zr(e)?jr(Jr(e)).then(t).catch(r):t([e.getAsFile()])}),jr=e=>new Promise((t,r)=>{const o=[];let n=0,s=0;const i=()=>{0===s&&0===n&&t(o)},a=e=>{n++;const t=e.createReader(),l=()=>{t.readEntries(e=>{if(0===e.length)return n--,void i();e.forEach(e=>{e.isDirectory?a(e):(s++,e.file(t=>{const r=Qr(t);e.fullPath&&(r._relativePath=e.fullPath),o.push(r),s--,i()}))}),l()},r)};l()};a(e)}),Qr=e=>{if(e.type.length)return e;const t=e.lastModifiedDate,r=e.name;return(e=e.slice(0,e.size,Hr(Ue(e.name)))).name=r,e.lastModifiedDate=t,e},Zr=e=>Kr(e)&&(Jr(e)||{}).isDirectory,Kr=e=>"webkitGetAsEntry"in e,Jr=e=>e.webkitGetAsEntry(),eo=e=>{let t=[];try{if((t=ro(e)).length)return t;t=to(e)}catch(e){}return t},to=e=>{let t=e.getData("url");return"string"==typeof t&&t.length?[t]:[]},ro=e=>{let t=e.getData("text/html");if("string"==typeof t&&t.length){const e=t.match(/src\s*=\s*"(.+?)"/);if(e)return[e[1]]}return[]},oo=[],no=e=>({pageLeft:e.pageX,pageTop:e.pageY,scopeLeft:e.offsetX||e.layerX,scopeTop:e.offsetY||e.layerY}),so=e=>{const t=oo.find(t=>t.element===e);if(t)return t;const r=io(e);return oo.push(r),r},io=t=>{const r=[],o={dragenter:po,dragover:Eo,dragleave:_o,drop:uo},n={};e(o,(e,o)=>{n[e]=o(t,r),t.addEventListener(e,n[e],!1)});const s={element:t,addListener:i=>(r.push(i),()=>{r.splice(r.indexOf(i),1),0===r.length&&(oo.splice(oo.indexOf(s),1),e(o,e=>{t.removeEventListener(e,n[e],!1)}))})};return s},ao=(e,t)=>{const r=((e,t)=>("elementFromPoint"in e||(e=document),e.elementFromPoint(t.x,t.y)))((e=>"getRootNode"in e?e.getRootNode():document)(t),{x:e.pageX-window.pageXOffset,y:e.pageY-window.pageYOffset});return r===t||t.contains(r)};let lo=null;const co=(e,t)=>{try{e.dropEffect=t}catch(e){}},po=(e,t)=>e=>{e.preventDefault(),lo=e.target,t.forEach(t=>{const{element:r,onenter:o}=t;ao(e,r)&&(t.state="enter",o(no(e)))})},Eo=(e,t)=>e=>{e.preventDefault();const r=e.dataTransfer;Xr(r).then(o=>{let n=!1;t.some(t=>{const{filterElement:s,element:i,onenter:a,onexit:l,ondrag:c,allowdrop:d}=t;co(r,"copy");const p=d(o);if(p)if(ao(e,i)){if(n=!0,null===t.state)return t.state="enter",void a(no(e));if(t.state="over",s&&!p)return void co(r,"none");c(no(e))}else s&&!n&&co(r,"none"),t.state&&(t.state=null,l(no(e)));else co(r,"none")})})},uo=(e,t)=>e=>{e.preventDefault();const r=e.dataTransfer;Xr(r).then(r=>{t.forEach(t=>{const{filterElement:o,element:n,ondrop:s,onexit:i,allowdrop:a}=t;if(t.state=null,!o||ao(e,n))return a(r)?void s(no(e),r):i(no(e))})})},_o=(e,t)=>e=>{lo===e.target&&t.forEach(t=>{const{onexit:r}=t;t.state=null,r(no(e))})},To=(e,t,r)=>{e.classList.add("filepond--hopper");const{catchesDropsOnPage:o,requiresDropOnElement:n,filterItems:s=(e=>e)}=r,i=((e,t,r)=>{const o=so(t),n={element:e,filterElement:r,state:null,ondrop:()=>{},onenter:()=>{},ondrag:()=>{},onexit:()=>{},onload:()=>{},allowdrop:()=>{}};return n.destroy=o.addListener(n),n})(e,o?document.documentElement:e,n);let a="",l="";i.allowdrop=(e=>t(s(e))),i.ondrop=((e,r)=>{const o=s(r);t(o)?(l="drag-drop",c.onload(o,e)):c.ondragend(e)}),i.ondrag=(e=>{c.ondrag(e)}),i.onenter=(e=>{l="drag-over",c.ondragstart(e)}),i.onexit=(e=>{l="drag-exit",c.ondragend(e)});const c={updateHopperState:()=>{a!==l&&(e.dataset.hopperState=l,a=l)},onload:()=>{},ondragstart:()=>{},ondrag:()=>{},ondragend:()=>{},destroy:()=>{i.destroy()}};return c};let fo=!1;const Io=[],mo=e=>{Xr(e.clipboardData).then(e=>{e.length&&Io.forEach(t=>t(e))})},Ro=()=>{const e=e=>{t.onload(e)},t={destroy:()=>{(e=>{ie(Io,Io.indexOf(e)),0===Io.length&&(document.removeEventListener("paste",mo),fo=!1)})(e)},onload:()=>{}};return(e=>{Io.includes(e)||(Io.push(e),fo||(fo=!0,document.addEventListener("paste",mo)))})(e),t};let ho=null,go=null;const Oo=[],Do=(e,t)=>{e.element.textContent=t},So=(e,t,r)=>{const o=e.query("GET_TOTAL_ITEMS");Do(e,`${r} ${t}, ${o} ${1===o?e.query("GET_LABEL_FILE_COUNT_SINGULAR"):e.query("GET_LABEL_FILE_COUNT_PLURAL")}`),clearTimeout(go),go=setTimeout(()=>{(e=>{e.element.textContent=""})(e)},1500)},yo=e=>e.element.parentNode.contains(document.activeElement),Ao=({root:e,action:t})=>{const r=e.query("GET_ITEM",t.id).filename,o=e.query("GET_LABEL_FILE_PROCESSING_ABORTED");Do(e,`${r} ${o}`)},Lo=({root:e,action:t})=>{const r=e.query("GET_ITEM",t.id).filename;Do(e,`${t.status.main} ${r} ${t.status.sub}`)},Po=A({create:({root:e,props:t})=>{e.element.id=`filepond--assistant-${t.id}`,r(e.element,"role","status"),r(e.element,"aria-live","polite"),r(e.element,"aria-relevant","additions")},ignoreRect:!0,ignoreRectUpdate:!0,write:L({DID_LOAD_ITEM:({root:e,action:t})=>{if(!yo(e))return;e.element.textContent="";const r=e.query("GET_ITEM",t.id);Oo.push(r.filename),clearTimeout(ho),ho=setTimeout(()=>{So(e,Oo.join(", "),e.query("GET_LABEL_FILE_ADDED")),Oo.length=0},750)},DID_REMOVE_ITEM:({root:e,action:t})=>{if(!yo(e))return;const r=t.item;So(e,r.filename,e.query("GET_LABEL_FILE_REMOVED"))},DID_COMPLETE_ITEM_PROCESSING:({root:e,action:t})=>{const r=e.query("GET_ITEM",t.id).filename,o=e.query("GET_LABEL_FILE_PROCESSING_COMPLETE");Do(e,`${r} ${o}`)},DID_ABORT_ITEM_PROCESSING:Ao,DID_REVERT_ITEM_PROCESSING:Ao,DID_THROW_ITEM_REMOVE_ERROR:Lo,DID_THROW_ITEM_LOAD_ERROR:Lo,DID_THROW_ITEM_INVALID:Lo,DID_THROW_ITEM_PROCESSING_ERROR:Lo}),tag:"span",name:"assistant"}),vo=(e,t="-")=>e.replace(new RegExp(`${t}.`,"g"),e=>e.charAt(1).toUpperCase()),Mo=(e,t=16,r=!0)=>{let o=Date.now(),n=null;return(...s)=>{clearTimeout(n);const i=Date.now()-o,a=()=>{o=Date.now(),e(...s)};ie.preventDefault(),Co=e=>{const t=e.ref.list.childViews[0].childViews[0];return t?{top:t.rect.element.marginTop,bottom:t.rect.element.marginBottom}:{top:0,bottom:0}},No=e=>{let t=0,r=0;const o=e.ref.list,n=o.childViews[0],s=n.childViews.filter(e=>e.rect.element.height),i=e.query("GET_ACTIVE_ITEMS").map(e=>s.find(t=>t.id===e.id)).filter(e=>e);if(0===i.length)return{visual:t,bounds:r};const a=n.rect.element.width,l=Er(n,i,o.dragCoordinates),c=i[0].rect.element,d=c.marginTop+c.marginBottom,p=c.marginLeft+c.marginRight,E=c.width+p,u=c.height+d,_=void 0!==l&&l>=0?1:0,T=i.find(e=>e.markedForRemoval&&e.opacity<.45)?-1:0,f=i.length+_+T,I=Math.round(a/E);return 1===I?i.forEach(e=>{const o=e.rect.element.height+d;r+=o,t+=o*e.opacity}):(r=Math.ceil(f/I)*u,t=r),{visual:t,bounds:r}},wo=e=>{const t=e.ref.measureHeight||null;return{cappedHeight:parseInt(e.style.maxHeight,10)||null,fixedHeight:0===t?null:t}},Go=(e,t)=>{const r=e.query("GET_ALLOW_REPLACE"),o=e.query("GET_ALLOW_MULTIPLE"),n=e.query("GET_TOTAL_ITEMS");let s=e.query("GET_MAX_FILES");const i=t.length;return!o&&i>1||!!(F(s=o?s:r?s:1)&&n+i>s)&&(e.dispatch("DID_THROW_MAX_FILES",{source:t,error:Qe("warning",0,"Max files")}),!0)},Uo=(e,t,r)=>{const o=e.childViews[0];return Er(o,t,{left:r.scopeLeft-o.rect.element.left,top:r.scopeTop-(e.rect.outer.top+e.rect.element.marginTop+e.rect.element.scrollTop)})},Bo=e=>{const t=e.query("GET_ALLOW_DROP"),r=e.query("GET_DISABLED"),o=t&&!r;if(o&&!e.ref.hopper){const t=To(e.element,t=>{if(Go(e,t))return!1;const r=e.query("GET_BEFORE_DROP_FILE")||(()=>!0);return!e.query("GET_DROP_VALIDATION")||t.every(t=>me("ALLOW_HOPPER_ITEM",t,{query:e.query}).every(e=>!0===e)&&r(t))},{filterItems:t=>{const r=e.query("GET_IGNORED_FILES");return t.filter(e=>!Et(e)||!r.includes(e.name.toLowerCase()))},catchesDropsOnPage:e.query("GET_DROP_ON_PAGE"),requiresDropOnElement:e.query("GET_DROP_ON_ELEMENT")});t.onload=((t,r)=>{const o=e.ref.list.childViews[0].childViews.filter(e=>e.rect.element.height),n=e.query("GET_ACTIVE_ITEMS").map(e=>o.find(t=>t.id===e.id)).filter(e=>e);e.dispatch("ADD_ITEMS",{items:t,index:Uo(e.ref.list,n,r),interactionMethod:te}),e.dispatch("DID_DROP",{position:r}),e.dispatch("DID_END_DRAG",{position:r})}),t.ondragstart=(t=>{e.dispatch("DID_START_DRAG",{position:t})}),t.ondrag=Mo(t=>{e.dispatch("DID_DRAG",{position:t})}),t.ondragend=(t=>{e.dispatch("DID_END_DRAG",{position:t})}),e.ref.hopper=t,e.ref.drip=e.appendChildView(e.createChildView(Gr))}else!o&&e.ref.hopper&&(e.ref.hopper.destroy(),e.ref.hopper=null,e.removeChildView(e.ref.drip))},qo=(e,t)=>{const r=e.query("GET_ALLOW_BROWSE"),o=e.query("GET_DISABLED"),n=r&&!o;n&&!e.ref.browser?e.ref.browser=e.appendChildView(e.createChildView(Pr,{...t,onload:t=>{if(Go(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:re})}}),0):!n&&e.ref.browser&&(e.removeChildView(e.ref.browser),e.ref.browser=null)},Vo=e=>{const t=e.query("GET_ALLOW_PASTE"),r=e.query("GET_DISABLED"),o=t&&!r;o&&!e.ref.paster?(e.ref.paster=Ro(),e.ref.paster.onload=(t=>{e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:oe})})):!o&&e.ref.paster&&(e.ref.paster.destroy(),e.ref.paster=null)},Fo=L({DID_SET_ALLOW_BROWSE:({root:e,props:t})=>{qo(e,t)},DID_SET_ALLOW_DROP:({root:e})=>{Bo(e)},DID_SET_ALLOW_PASTE:({root:e})=>{Vo(e)},DID_SET_DISABLED:({root:e,props:t})=>{Bo(e),Vo(e),qo(e,t),e.query("GET_DISABLED")?e.element.dataset.disabled="disabled":e.element.removeAttribute("data-disabled")}}),xo=A({name:"root",read:({root:e})=>{e.ref.measure&&(e.ref.measureHeight=e.ref.measure.offsetHeight)},create:({root:e,props:t})=>{const r=e.query("GET_ID");r&&(e.element.id=r);const o=e.query("GET_CLASS_NAME");o&&o.split(" ").filter(e=>e.length).forEach(t=>{e.element.classList.add(t)}),e.ref.label=e.appendChildView(e.createChildView(Cr,{...t,translateY:null,caption:e.query("GET_LABEL_IDLE")})),e.ref.list=e.appendChildView(e.createChildView(Rr,{translateY:null})),e.ref.panel=e.appendChildView(e.createChildView(ir,{name:"panel-root"})),e.ref.assistant=e.appendChildView(e.createChildView(Po,{...t})),e.ref.data=e.appendChildView(e.createChildView(Vr,{...t})),e.ref.measure=yt("div"),e.ref.measure.style.height="100%",e.element.appendChild(e.ref.measure),e.ref.bounds=null,e.query("GET_STYLES").filter(e=>!b(e.value)).map(({name:t,value:r})=>{e.element.dataset[t]=r}),e.ref.widthPrevious=null,e.ref.widthUpdated=Mo(()=>{e.ref.updateHistory=[],e.dispatch("DID_RESIZE_ROOT")},250),e.ref.previousAspectRatio=null,e.ref.updateHistory=[];const n=window.matchMedia("(pointer: fine) and (hover: hover)").matches,s="PointerEvent"in window;e.query("GET_ALLOW_REORDER")&&s&&!n&&(e.element.addEventListener("touchmove",bo,{passive:!1}),e.element.addEventListener("gesturestart",bo))},write:({root:e,props:t,actions:r})=>{if(Fo({root:e,props:t,actions:r}),r.filter(e=>/^DID_SET_STYLE_/.test(e.type)).filter(e=>!b(e.data.value)).map(({type:t,data:r})=>{const o=vo(t.substr(8).toLowerCase(),"_");e.element.dataset[o]=r.value,e.invalidateLayout()}),e.rect.element.hidden)return;e.rect.element.width!==e.ref.widthPrevious&&(e.ref.widthPrevious=e.rect.element.width,e.ref.widthUpdated());let o=e.ref.bounds;o||(o=e.ref.bounds=wo(e),e.element.removeChild(e.ref.measure),e.ref.measure=null);const{hopper:n,label:s,list:i,panel:a}=e.ref;n&&n.updateHopperState();const l=e.query("GET_PANEL_ASPECT_RATIO"),c=e.query("GET_ALLOW_MULTIPLE"),d=e.query("GET_TOTAL_ITEMS"),p=d===(c?e.query("GET_MAX_FILES")||1e6:1),E=r.find(e=>"DID_ADD_ITEM"===e.type);if(p&&E){const e=E.data.interactionMethod;s.opacity=0,c?s.translateY=-40:e===ee?s.translateX=40:s.translateY=e===re?40:30}else p||(s.opacity=1,s.translateX=0,s.translateY=0);const u=Co(e),_=No(e),T=s.rect.element.height,f=!c||p?0:T,I=p?i.rect.element.marginTop:0,m=0===d?0:i.rect.element.marginBottom,R=f+I+_.visual+m,h=f+I+_.bounds+m;if(i.translateY=Math.max(0,f-i.rect.element.marginTop)-u.top,l){const t=e.rect.element.width,r=t*l;l!==e.ref.previousAspectRatio&&(e.ref.previousAspectRatio=l,e.ref.updateHistory=[]);const o=e.ref.updateHistory;o.push(t);const n=2;if(o.length>2*n){const e=o.length,t=e-10;let r=0;for(let s=e;s>=t;s--)if(o[s]===o[s-2]&&r++,r>=n)return}a.scalable=!1,a.height=r;const s=r-f-(m-u.bottom)-(p?I:0);_.visual>s?i.overflow=s:i.overflow=null,e.height=r}else if(o.fixedHeight){a.scalable=!1;const e=o.fixedHeight-f-(m-u.bottom)-(p?I:0);_.visual>e?i.overflow=e:i.overflow=null}else if(o.cappedHeight){const t=R>=o.cappedHeight,r=Math.min(o.cappedHeight,R);a.scalable=!0,a.height=t?r:r-u.top-u.bottom;const n=r-f-(m-u.bottom)-(p?I:0);R>o.cappedHeight&&_.visual>n?i.overflow=n:i.overflow=null,e.height=Math.min(o.cappedHeight,h-u.top-u.bottom)}else{const t=d>0?u.top+u.bottom:0;a.scalable=!0,a.height=Math.max(T,R-t),e.height=Math.max(T,h-t)}},destroy:({root:e})=>{e.ref.paster&&e.ref.paster.destroy(),e.ref.hopper&&e.ref.hopper.destroy(),e.element.removeEventListener("touchmove",bo),e.element.removeEventListener("gesturestart",bo)},mixins:{styles:["height"]}}),Yo=(e={})=>{let r=null;const o=he(),n=((e,t=[],r=[])=>{const o={...e},n=[],s=[],i=(e,t,r)=>{r?s.push({type:e,data:t}):(d[e]&&d[e](t),n.push({type:e,data:t}))},a=(e,...t)=>c[e]?c[e](...t):null,l={getState:()=>({...o}),processActionQueue:()=>{const e=[...n];return n.length=0,e},processDispatchQueue:()=>{const e=[...s];s.length=0,e.forEach(({type:e,data:t})=>{i(e,t)})},dispatch:i,query:a};let c={};t.forEach(e=>{c={...e(o),...c}});let d={};return r.forEach(e=>{d={...e(i,a,o),...d}}),l})((e=>({items:[],listUpdateTimeout:null,itemUpdateTimeout:null,processingQueue:[],options:j(e)}))(o),[Ce,J(o)],[Dt,K(o)]);n.dispatch("SET_OPTIONS",{options:e});const s=()=>{document.hidden||n.dispatch("KICK")};document.addEventListener("visibilitychange",s);let i=null,a=!1,l=!1,c=null,d=null;const p=()=>{a||(a=!0),clearTimeout(i),i=setTimeout(()=>{a=!1,c=null,d=null,l&&(l=!1,n.dispatch("DID_STOP_RESIZE"))},500)};window.addEventListener("resize",p);const E=xo(n,{id:se()});let u=!1,_=!1;const f={_read:()=>{a&&(d=window.innerWidth,c||(c=d),l||d===c||(n.dispatch("DID_START_RESIZE"),l=!0)),_&&u&&(u=null===E.element.offsetParent),u||(E._read(),_=E.rect.element.hidden)},_write:e=>{const t=n.processActionQueue().filter(e=>!/^SET_/.test(e.type));u&&!t.length||(R(t),u=E._write(e,t,l),(e=>{e.forEach((t,r)=>{t.released&&ie(e,r)})})(n.query("GET_ITEMS")),u&&n.processDispatchQueue())}},I=e=>t=>{const r={type:e};if(!t)return r;if(t.hasOwnProperty("error")&&(r.error=t.error?{...t.error}:null),t.status&&(r.status={...t.status}),t.file&&(r.output=t.file),t.source)r.file=t.source;else if(t.item||t.id){const e=t.item?t.item:n.query("GET_ITEM",t.id);r.file=e?de(e):null}return t.items&&(r.items=t.items.map(de)),/progress/.test(e)&&(r.progress=t.progress),r},m={DID_DESTROY:I("destroy"),DID_INIT:I("init"),DID_THROW_MAX_FILES:I("warning"),DID_START_ITEM_LOAD:I("addfilestart"),DID_UPDATE_ITEM_LOAD_PROGRESS:I("addfileprogress"),DID_LOAD_ITEM:I("addfile"),DID_THROW_ITEM_INVALID:[I("error"),I("addfile")],DID_THROW_ITEM_LOAD_ERROR:[I("error"),I("addfile")],DID_THROW_ITEM_REMOVE_ERROR:[I("error"),I("removefile")],DID_PREPARE_OUTPUT:I("preparefile"),DID_START_ITEM_PROCESSING:I("processfilestart"),DID_UPDATE_ITEM_PROCESS_PROGRESS:I("processfileprogress"),DID_ABORT_ITEM_PROCESSING:I("processfileabort"),DID_COMPLETE_ITEM_PROCESSING:I("processfile"),DID_COMPLETE_ITEM_PROCESSING_ALL:I("processfiles"),DID_REVERT_ITEM_PROCESSING:I("processfilerevert"),DID_THROW_ITEM_PROCESSING_ERROR:[I("error"),I("processfile")],DID_REMOVE_ITEM:I("removefile"),DID_UPDATE_ITEMS:I("updatefiles"),DID_ACTIVATE_ITEM:I("activatefile"),DID_REORDER_ITEMS:I("reorderfiles")},R=e=>{e.length&&e.forEach(e=>{if(!m[e.type])return;const t=m[e.type];(Array.isArray(t)?t:[t]).forEach(t=>{setTimeout(()=>{(e=>{const t={pond:y,...e};delete t.type,E.element.dispatchEvent(new CustomEvent(`FilePond:${e.type}`,{detail:t,bubbles:!0,cancelable:!0,composed:!0}));const r=[];e.hasOwnProperty("error")&&r.push(e.error),e.hasOwnProperty("file")&&r.push(e.file);const o=["type","error","file"];Object.keys(e).filter(e=>!o.includes(e)).forEach(t=>r.push(e[t])),y.fire(e.type,...r);const s=n.query(`GET_ON${e.type.toUpperCase()}`);s&&s(...r)})(t(e.data))},0)})})},h=e=>new Promise((t,r)=>{n.dispatch("REQUEST_ITEM_PREPARE",{query:e,success:e=>{t(e)},failure:e=>{r(e)}})}),g=e=>(n.dispatch("REMOVE_ITEM",{query:e}),null===n.query("GET_ACTIVE_ITEM",e)),O=(...e)=>new Promise((t,r)=>{const o=[],s={};if(M(e[0]))o.push.apply(o,e[0]),Object.assign(s,e[1]||{});else{const t=e[e.length-1];"object"!=typeof t||t instanceof Blob||Object.assign(s,e.pop()),o.push(...e)}n.dispatch("ADD_ITEMS",{items:o,index:s.index,interactionMethod:ee,success:t,failure:r})}),D=()=>n.query("GET_ACTIVE_ITEMS"),S=e=>new Promise((t,r)=>{n.dispatch("REQUEST_ITEM_PROCESSING",{query:e,success:e=>{t(e)},failure:e=>{r(e)}})}),y={...ae(),...f,...Z(n,o),setOptions:e=>n.dispatch("SET_OPTIONS",{options:e}),addFile:(e,t={})=>new Promise((r,o)=>{O([{source:e,options:t}],{index:t.index}).then(e=>r(e&&e[0])).catch(o)}),addFiles:O,getFile:e=>n.query("GET_ACTIVE_ITEM",e),processFile:S,prepareFile:h,removeFile:g,moveFile:(e,t)=>n.dispatch("MOVE_ITEM",{query:e,index:t}),getFiles:D,processFiles:(...e)=>{const t=Array.isArray(e[0])?e[0]:e;if(!t.length){const e=D().filter(e=>!(e.status===pe.IDLE&&e.origin===Ee.LOCAL)&&e.status!==pe.PROCESSING&&e.status!==pe.PROCESSING_COMPLETE&&e.status!==pe.PROCESSING_REVERT_ERROR);return Promise.all(e.map(S))}return Promise.all(t.map(S))},removeFiles:(...e)=>{const t=Array.isArray(e[0])?e[0]:e,r=D();return t.length?t.map(e=>T(e)?r[e]?r[e].id:null:e).filter(e=>e).map(g):Promise.all(r.map(g))},prepareFiles:(...e)=>{const t=Array.isArray(e[0])?e[0]:e,r=t.length?t:D();return Promise.all(r.map(h))},sort:e=>n.dispatch("SORT",{compare:e}),browse:()=>{var e=E.element.querySelector("input[type=file]");e&&e.click()},destroy:()=>{y.fire("destroy",E.element),n.dispatch("ABORT_ALL"),E._destroy(),window.removeEventListener("resize",p),document.removeEventListener("visibilitychange",s),n.dispatch("DID_DESTROY")},insertBefore:e=>P(E.element,e),insertAfter:e=>v(E.element,e),appendTo:e=>e.appendChild(E.element),replaceElement:e=>{P(E.element,e),e.parentNode.removeChild(e),r=e},restoreElement:()=>{r&&(v(r,E.element),E.element.parentNode.removeChild(E.element),r=null)},isAttachedTo:e=>E.element===e||r===e,element:{get:()=>E.element},status:{get:()=>n.query("GET_STATUS")}};return n.dispatch("DID_INIT"),t(y)},Ho=(t={})=>{const r={};return e(he(),(e,t)=>{r[e]=t[0]}),Yo({...r,...t})},Xo=(t,r)=>{e(r,(r,o)=>{e(t,(e,n)=>{const s=new RegExp(r);if(!s.test(e))return;if(delete t[e],!1===o)return;if(U(o))return void(t[o]=n);const i=o.group;k(o)&&!t[i]&&(t[i]={}),t[i][(e=>e.charAt(0).toLowerCase()+e.slice(1))(e.replace(s,""))]=n}),o.mapping&&Xo(t[o.group],o.mapping)})},ko=(t,o={})=>{const n=[];e(t.attributes,e=>{n.push(t.attributes[e])});const s=n.filter(e=>e.name).reduce((e,o)=>{const n=r(t,o.name);return e[(e=>vo(e.replace(/^data-/,"")))(o.name)]=n===o.name||n,e},{});return Xo(s,o),s},$o=(...e)=>(e=>e instanceof HTMLElement)(e[0])?((e,t={})=>{const r={"^class$":"className","^multiple$":"allowMultiple","^capture$":"captureMethod","^webkitdirectory$":"allowDirectoriesOnly","^server":{group:"server",mapping:{"^process":{group:"process"},"^revert":{group:"revert"},"^fetch":{group:"fetch"},"^restore":{group:"restore"},"^load":{group:"load"}}},"^type$":!1,"^files$":!1};me("SET_ATTRIBUTE_TO_OPTION_MAP",r);const o={...t},n=ko("FIELDSET"===e.nodeName?e.querySelector("input[type=file]"):e,r);Object.keys(n).forEach(e=>{k(n[e])?(k(o[e])||(o[e]={}),Object.assign(o[e],n[e])):o[e]=n[e]}),o.files=(t.files||[]).concat(Array.from(e.querySelectorAll("input:not([type=file])")).map(e=>({source:e.value,options:{type:e.dataset.type}})));const s=Ho(o);return e.files&&Array.from(e.files).forEach(e=>{s.addFile(e)}),s.replaceElement(e),s})(...e):Ho(...e),zo=["fire","_read","_write"],Wo=e=>{const t={};return le(e,t,zo),t},jo=(e,t)=>e.replace(/(?:{([a-zA-Z]+)})/g,(e,r)=>t[r]),Qo=e=>{const t=new Blob(["(",e.toString(),")()"],{type:"application/javascript"}),r=URL.createObjectURL(t),o=new Worker(r);return{transfer:(e,t)=>{},post:(e,t,r)=>{const n=se();o.onmessage=(e=>{e.data.id===n&&t(e.data.message)}),o.postMessage({id:n,message:e},r)},terminate:()=>{o.terminate(),URL.revokeObjectURL(r)}}},Zo=e=>new Promise((t,r)=>{const o=new Image;o.onload=(()=>{t(o)}),o.onerror=(e=>{r(e)}),o.src=e}),Ko=(e,t)=>{const r=e.slice(0,e.size,e.type);return r.lastModifiedDate=e.lastModifiedDate,r.name=t,r},Jo=e=>Ko(e,e.name),en=[],tn=t=>{if(en.includes(t))return;en.push(t),(e=>Object.assign(ge,e))(t({addFilter:Re,utils:{Type:Te,forin:e,isString:U,isFile:Et,toNaturalFileSize:bt,replaceInString:jo,getExtensionFromFilename:Ue,getFilenameWithoutExtension:pt,guesstimateMimeType:Hr,getFileFromBlob:Ve,getFilenameFromURL:Ge,createRoute:L,createWorker:Qo,createView:A,createItemAPI:de,loadImage:Zo,copyFile:Jo,renameFile:Ko,createBlob:Fe,applyFilterChain:Ie,text:At,getNumericAspectRatioFromString:De},views:{fileActionButton:Mt}}).options)},rn=(()=>{const e=d()&&!(()=>"[object OperaMini]"===Object.prototype.toString.call(window.operamini))()&&(()=>"visibilityState"in document)()&&(()=>"Promise"in window)()&&(()=>"slice"in Blob.prototype)()&&(()=>"URL"in window&&"createObjectURL"in window.URL)()&&(()=>"performance"in window)();return()=>e})(),on={apps:[]},nn=()=>{};let sn={},an={},ln={},cn={},dn=nn,pn=nn,En=nn,un=nn,_n=nn,Tn=nn,fn=nn;if(rn()){((e,t,r=60)=>{const o="__framePainter";if(window[o])return window[o].readers.push(e),void window[o].writers.push(t);window[o]={readers:[e],writers:[t]};const n=window[o],s=1e3/r;let i=null,a=null,l=null,c=null;const d=()=>{document.hidden?(l=(()=>window.setTimeout(()=>p(performance.now()),s)),c=(()=>window.clearTimeout(a))):(l=(()=>window.requestAnimationFrame(p)),c=(()=>window.cancelAnimationFrame(a)))};document.addEventListener("visibilitychange",()=>{c&&c(),d(),p(performance.now())});const p=e=>{a=l(p),i||(i=e);const t=e-i;t<=s||(i=e-t%s,n.readers.forEach(e=>e()),n.writers.forEach(t=>t(e)))};d(),p(performance.now())})(()=>{on.apps.forEach(e=>e._read())},e=>{on.apps.forEach(t=>t._write(e))});const t=()=>{document.dispatchEvent(new CustomEvent("FilePond:loaded",{detail:{supported:rn,create:dn,destroy:pn,parse:En,find:un,registerPlugin:_n,setOptions:fn}})),document.removeEventListener("DOMContentLoaded",t)};"loading"!==document.readyState?setTimeout(()=>t(),0):document.addEventListener("DOMContentLoaded",t);const r=()=>e(he(),(e,t)=>{cn[e]=t[1]});sn={...ye},ln={...Ee},an={...pe},cn={},r(),dn=((...e)=>{const t=$o(...e);return t.on("destroy",pn),on.apps.push(t),Wo(t)}),pn=(e=>{const t=on.apps.findIndex(t=>t.isAttachedTo(e));if(t>=0){return on.apps.splice(t,1)[0].restoreElement(),!0}return!1}),En=(e=>{return Array.from(e.querySelectorAll(".filepond")).filter(e=>!on.apps.find(t=>t.isAttachedTo(e))).map(e=>dn(e))}),un=(e=>{const t=on.apps.find(t=>t.isAttachedTo(e));return t?Wo(t):null}),_n=((...e)=>{e.forEach(tn),r()}),Tn=(()=>{const t={};return e(he(),(e,r)=>{t[e]=r[0]}),t}),fn=(t=>(k(t)&&(on.apps.forEach(e=>{e.setOptions(t)}),(t=>{e(t,(e,t)=>{ge[e]&&(ge[e][0]=W(t,ge[e][0],ge[e][1]))})})(t)),Tn()))}export{ln as FileOrigin,an as FileStatus,cn as OptionTypes,sn as Status,dn as create,pn as destroy,un as find,Tn as getOptions,En as parse,_n as registerPlugin,fn as setOptions,rn as supported}; diff --git a/dist/filepond.js b/dist/filepond.js index 4aef33ae..f9e62abf 100755 --- a/dist/filepond.js +++ b/dist/filepond.js @@ -1,5 +1,5 @@ /*! - * FilePond 4.13.1 + * FilePond 4.13.2 * Licensed under MIT, https://opensource.org/licenses/MIT/ * Please visit https://pqina.nl/filepond/ for details. */ @@ -373,11 +373,9 @@ var resting = false; // updates spring state - var interpolate = function interpolate() { + var interpolate = function interpolate(ts, skipToEndState) { // in rest, don't animate - if (resting) { - return; - } + if (resting) return; // need at least a target or position to do springy things if (!(isNumber(target) && isNumber(position))) { @@ -399,7 +397,7 @@ velocity *= damping; // we've arrived if we're near target and our velocity is near zero - if (thereYet(position, target, velocity)) { + if (thereYet(position, target, velocity) || skipToEndState) { position = target; velocity = 0; resting = true; @@ -499,30 +497,26 @@ var reverse = false; var target = null; - var interpolate = function interpolate(ts) { - if (resting || target === null) { - return; - } + var interpolate = function interpolate(ts, skipToEndState) { + if (resting || target === null) return; if (start === null) { start = ts; } - if (ts - start < delay) { - return; - } + if (ts - start < delay) return; t = ts - start - delay; - if (t < duration) { - p = t / duration; - api.onupdate((t >= 0 ? easing(reverse ? 1 - p : p) : 0) * target); - } else { + if (t >= duration || skipToEndState) { t = 1; p = reverse ? 0 : 1; api.onupdate(p * target); api.oncomplete(p * target); resting = true; + } else { + p = t / duration; + api.onupdate((t >= 0 ? easing(reverse ? 1 - p : p) : 0) * target); } }; @@ -627,10 +621,6 @@ }); }; - var isDefined = function isDefined(value) { - return value != null; - }; - // add to state, // add getters and setters to internal and external api (if not set) // setup animators @@ -639,8 +629,7 @@ var mixinConfig = _ref.mixinConfig, viewProps = _ref.viewProps, viewInternalAPI = _ref.viewInternalAPI, - viewExternalAPI = _ref.viewExternalAPI, - viewState = _ref.viewState; + viewExternalAPI = _ref.viewExternalAPI; // initial properties var initialProps = Object.assign({}, viewProps); @@ -688,12 +677,11 @@ // expose internal write api return { write: function write(ts) { + var skipToEndState = document.hidden; var resting = true; animations.forEach(function(animation) { - if (!animation.resting) { - resting = false; - } - animation.interpolate(ts); + if (!animation.resting) resting = false; + animation.interpolate(ts, skipToEndState); }); return resting; }, @@ -768,6 +756,10 @@ addGetSet(mixinConfig, viewExternalAPI, viewProps); }; + var isDefined = function isDefined(value) { + return value != null; + }; + // add to state, // add getters and setters to internal and external api (if not set) // set initial state based on props in viewProps diff --git a/dist/filepond.min.css b/dist/filepond.min.css index 98625521..913a7947 100755 --- a/dist/filepond.min.css +++ b/dist/filepond.min.css @@ -1,5 +1,5 @@ /*! - * FilePond 4.13.1 + * FilePond 4.13.2 * Licensed under MIT, https://opensource.org/licenses/MIT/ * Please visit https://pqina.nl/filepond/ for details. */ diff --git a/dist/filepond.min.js b/dist/filepond.min.js index 1091f9dd..3ce2a3ba 100755 --- a/dist/filepond.min.js +++ b/dist/filepond.min.js @@ -1,9 +1,9 @@ /*! - * FilePond 4.13.1 + * FilePond 4.13.2 * Licensed under MIT, https://opensource.org/licenses/MIT/ * Please visit https://pqina.nl/filepond/ for details. */ /* eslint-disable */ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self).FilePond={})}(this,function(e){"use strict";var t,n,r=function(e,t){for(var n in e)e.hasOwnProperty(n)&&t(n,e[n])},o=function(e){var t={};return r(e,function(n){!function(e,t,n){"function"!=typeof n?Object.defineProperty(e,t,Object.assign({},n)):e[t]=n}(t,n,e[n])}),t},i=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(null===n)return e.getAttribute(t)||e.hasAttribute(t);e.setAttribute(t,n)},a=["svg","path"],u=function(e){return a.includes(e)},s=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"object"==typeof t&&(n=t,t=null);var o=u(e)?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return t&&(u(e)?i(o,"class",t):o.className=t),r(n,function(e,t){i(o,e,t)}),o},l=function(e,t){return function(e,n){return void 0!==n?t.splice(n,0,e):t.push(e),e}},c=function(e,t){return function(n){return t.splice(t.indexOf(n),1),n.element.parentNode&&e.removeChild(n.element),n}},f="undefined"!=typeof window&&void 0!==window.document,d=function(){return f},p="children"in(d()?s("svg"):{})?function(e){return e.children.length}:function(e){return e.childNodes.length},E=function(e,t,n,r){var o=n[0]||e.left,i=n[1]||e.top,a=o+e.width,u=i+e.height*(r[1]||1),s={element:Object.assign({},e),inner:{left:e.left,top:e.top,right:e.right,bottom:e.bottom},outer:{left:o,top:i,right:a,bottom:u}};return t.filter(function(e){return!e.isRectIgnored()}).map(function(e){return e.rect}).forEach(function(e){_(s.inner,Object.assign({},e.inner)),_(s.outer,Object.assign({},e.outer))}),T(s.inner),s.outer.bottom+=s.element.marginBottom,s.outer.right+=s.element.marginRight,T(s.outer),s},_=function(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)},T=function(e){e.width=e.right-e.left,e.height=e.bottom-e.top},v=function(e){return"number"==typeof e},I=function(e){return e<.5?2*e*e:(4-2*e)*e-1},m={spring:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.stiffness,n=void 0===t?.5:t,r=e.damping,i=void 0===r?.75:r,a=e.mass,u=void 0===a?10:a,s=null,l=null,c=0,f=!1,d=o({interpolate:function(){if(!f){if(!v(s)||!v(l))return f=!0,void(c=0);!function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.001;return Math.abs(e-t)0&&void 0!==arguments[0]?arguments[0]:{},r=n.duration,i=void 0===r?500:r,a=n.easing,u=void 0===a?I:a,s=n.delay,l=void 0===s?0:s,c=null,f=!0,d=!1,p=null,E=o({interpolate:function(n){f||null===p||(null===c&&(c=n),n-c=0?u(d?1-t:t):0)*p)):(e=1,t=d?0:1,E.onupdate(t*p),E.oncomplete(t*p),f=!0)))},target:{get:function(){return d?0:p},set:function(e){if(null===p)return p=e,E.onupdate(e),void E.oncomplete(e);e3&&void 0!==arguments[3]&&arguments[3];(t=Array.isArray(t)?t:[t]).forEach(function(t){e.forEach(function(e){var o=e,i=function(){return n[e]},a=function(t){return n[e]=t};"object"==typeof e&&(o=e.key,i=e.getter||i,a=e.setter||a),t[o]&&!r||(t[o]={get:i,set:a})})})},R=function(e){return null!=e},O={opacity:1,scaleX:1,scaleY:1,translateX:0,translateY:0,rotateX:0,rotateY:0,rotateZ:0,originX:0,originY:0},D=function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!0;for(var n in t)if(t[n]!==e[n])return!0;return!1},y=function(e,t){var n=t.opacity,r=t.perspective,o=t.translateX,i=t.translateY,a=t.scaleX,u=t.scaleY,s=t.rotateX,l=t.rotateY,c=t.rotateZ,f=t.originX,d=t.originY,p=t.width,E=t.height,_="",T="";(R(f)||R(d))&&(T+="transform-origin: "+(f||0)+"px "+(d||0)+"px;"),R(r)&&(_+="perspective("+r+"px) "),(R(o)||R(i))&&(_+="translate3d("+(o||0)+"px, "+(i||0)+"px, 0) "),(R(a)||R(u))&&(_+="scale3d("+(R(a)?a:1)+", "+(R(u)?u:1)+", 1) "),R(c)&&(_+="rotateZ("+c+"rad) "),R(s)&&(_+="rotateX("+s+"rad) "),R(l)&&(_+="rotateY("+l+"rad) "),_.length&&(T+="transform:"+_+";"),R(n)&&(T+="opacity:"+n+";",0===n&&(T+="visibility:hidden;"),n<1&&(T+="pointer-events:none;")),R(E)&&(T+="height:"+E+"px;"),R(p)&&(T+="width:"+p+"px;");var v=e.elementCurrentStyle||"";T.length===v.length&&T===v||(e.style.cssText=T,e.elementCurrentStyle=T)},S={styles:function(e){var t=e.mixinConfig,n=e.viewProps,r=e.viewInternalAPI,o=e.viewExternalAPI,i=e.view,a=Object.assign({},n),u={};h(t,[r,o],n);var s=function(){return i.rect?E(i.rect,i.childViews,[n.translateX||0,n.translateY||0],[n.scaleX||0,n.scaleY||0]):null};return r.rect={get:s},o.rect={get:s},t.forEach(function(e){n[e]=void 0===a[e]?O[e]:a[e]}),{write:function(){if(D(u,n))return y(i.element,n),Object.assign(u,Object.assign({},n)),!0},destroy:function(){}}},listeners:function(e){e.mixinConfig,e.viewProps,e.viewInternalAPI;var t,n=e.viewExternalAPI,r=(e.viewState,e.view),o=[],i=(t=r.element,function(e,n){t.addEventListener(e,n)}),a=function(e){return function(t,n){e.removeEventListener(t,n)}}(r.element);return n.on=function(e,t){o.push({type:e,fn:t}),i(e,t)},n.off=function(e,t){o.splice(o.findIndex(function(n){return n.type===e&&n.fn===t}),1),a(e,t)},{write:function(){return!0},destroy:function(){o.forEach(function(e){a(e.type,e.fn)})}}},animations:function(e){var t=e.mixinConfig,n=e.viewProps,o=e.viewInternalAPI,i=e.viewExternalAPI,a=(e.viewState,Object.assign({},n)),u=[];return r(t,function(e,t){var r=g(t);r&&(r.onupdate=function(t){n[e]=t},r.target=a[e],h([{key:e,setter:function(e){r.target!==e&&(r.target=e)},getter:function(){return n[e]}}],[o,i],n,!0),u.push(r))}),{write:function(e){var t=!0;return u.forEach(function(n){n.resting||(t=!1),n.interpolate(e)}),t},destroy:function(){}}},apis:function(e){var t=e.mixinConfig,n=e.viewProps,r=e.viewExternalAPI;h(t,r,n)}},A=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return 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=null===t.offsetParent,e},L=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.tag,n=void 0===t?"div":t,r=e.name,i=void 0===r?null:r,a=e.attributes,u=void 0===a?{}:a,f=e.read,d=void 0===f?function(){}:f,_=e.write,T=void 0===_?function(){}:_,v=e.create,I=void 0===v?function(){}:v,m=e.destroy,g=void 0===m?function(){}:m,h=e.filterFrameActionsForChild,R=void 0===h?function(e,t){return t}:h,O=e.didCreateView,D=void 0===O?function(){}:O,y=e.didWriteView,L=void 0===y?function(){}:y,b=e.ignoreRect,P=void 0!==b&&b,M=e.ignoreRectUpdate,w=void 0!==M&&M,C=e.mixins,N=void 0===C?[]:C;return function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=s(n,"filepond--"+i,u),f=window.getComputedStyle(a,null),_=A(),v=null,m=!1,h=[],O=[],y={},b={},M=[T],C=[d],G=[g],U=function(){return a},B=function(){return h.concat()},q=function(){return v||(v=E(_,h,[0,0],[1,1]))},V={element:{get:U},style:{get:function(){return f}},childViews:{get:B}},F=Object.assign({},V,{rect:{get:q},ref:{get:function(){return y}},is:function(e){return i===e},appendChild:(t=a,function(e,n){void 0!==n&&t.children[n]?t.insertBefore(e,t.children[n]):t.appendChild(e)}),createChildView:function(e){return function(t,n){return t(e,n)}}(e),linkView:function(e){return h.push(e),e},unlinkView:function(e){h.splice(h.indexOf(e),1)},appendChildView:l(0,h),removeChildView:c(a,h),registerWriter:function(e){return M.push(e)},registerReader:function(e){return C.push(e)},registerDestroyer:function(e){return G.push(e)},invalidateLayout:function(){return a.layoutCalculated=!1},dispatch:e.dispatch,query:e.query}),x={element:{get:U},childViews:{get:B},rect:{get:q},resting:{get:function(){return m}},isRectIgnored:function(){return P},_read:function(){v=null,h.forEach(function(e){return e._read()}),!(w&&_.width&&_.height)&&A(_,a,f);var e={root:k,props:r,rect:_};C.forEach(function(t){return t(e)})},_write:function(e,t,n){var o=0===t.length;return M.forEach(function(i){!1===i({props:r,root:k,actions:t,timestamp:e,shouldOptimize:n})&&(o=!1)}),O.forEach(function(t){!1===t.write(e)&&(o=!1)}),h.filter(function(e){return!!e.element.parentNode}).forEach(function(r){r._write(e,R(r,t),n)||(o=!1)}),h.forEach(function(r,i){r.element.parentNode||(k.appendChild(r.element,i),r._read(),r._write(e,R(r,t),n),o=!1)}),m=o,L({props:r,root:k,actions:t,timestamp:e}),o},_destroy:function(){O.forEach(function(e){return e.destroy()}),G.forEach(function(e){e({root:k,props:r})}),h.forEach(function(e){return e._destroy()})}},Y=Object.assign({},V,{rect:{get:function(){return _}}});Object.keys(N).sort(function(e,t){return"styles"===e?1:"styles"===t?-1:0}).forEach(function(e){var t=S[e]({mixinConfig:N[e],viewProps:r,viewState:b,viewInternalAPI:F,viewExternalAPI:x,view:o(Y)});t&&O.push(t)});var k=o(F);I({root:k,props:r});var j=p(a);return h.forEach(function(e,t){k.appendChild(e.element,j+t)}),D(k),o(x)}},b=function(e,t){return function(n){var r=n.root,o=n.props,i=n.actions,a=void 0===i?[]:i,u=n.timestamp,s=n.shouldOptimize;a.filter(function(t){return e[t.type]}).forEach(function(t){return e[t.type]({root:r,props:o,action:t.data,timestamp:u,shouldOptimize:s})}),t&&t({root:r,props:o,actions:a,timestamp:u,shouldOptimize:s})}},P=function(e,t){return t.parentNode.insertBefore(e,t)},M=function(e,t){return t.parentNode.insertBefore(e,t.nextSibling)},w=function(e){return Array.isArray(e)},C=function(e){return null==e},N=function(e){return e.trim()},G=function(e){return""+e},U=function(e){return"boolean"==typeof e},B=function(e){return U(e)?e:"true"===e},q=function(e){return"string"==typeof e},V=function(e){return v(e)?e:q(e)?G(e).replace(/[a-z]+/gi,""):0},F=function(e){return parseInt(V(e),10)},x=function(e){return parseFloat(V(e))},Y=function(e){return v(e)&&isFinite(e)&&Math.floor(e)===e},k=function(e){if(Y(e))return e;var t=G(e).trim();return/MB$/i.test(t)?(t=t.replace(/MB$i/,"").trim(),1e3*F(t)*1e3):/KB/i.test(t)?(t=t.replace(/KB$i/,"").trim(),1e3*F(t)):F(t)},j=function(e){return"function"==typeof e},H={process:"POST",patch:"PATCH",revert:"DELETE",fetch:"GET",restore:"GET",load:"GET"},X=function(e,t,n,r,o){if(null===t)return null;if("function"==typeof t)return t;var i={url:"GET"===n||"PATCH"===n?"?"+e+"=":"",method:n,headers:o,withCredentials:!1,timeout:r,onload:null,ondata:null,onerror:null};if(q(t))return i.url=t,i;if(Object.assign(i,t),q(i.headers)){var a=i.headers.split(/:(.+)/);i.headers={header:a[0],value:a[1]}}return i.withCredentials=B(i.withCredentials),i},z=function(e){return"object"==typeof e&&null!==e},W=function(e){return w(e)?"array":function(e){return null===e}(e)?"null":Y(e)?"int":/^[0-9]+ ?(?:GB|MB|KB)$/gi.test(e)?"bytes":function(e){return z(e)&&q(e.url)&&z(e.process)&&z(e.revert)&&z(e.restore)&&z(e.fetch)}(e)?"api":typeof e},Q={array:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return C(e)?[]:w(e)?e:G(e).split(t).map(N).filter(function(e){return e.length})},boolean:B,int:function(e){return"bytes"===W(e)?k(e):F(e)},number:x,float:x,bytes:k,string:function(e){return j(e)?e:G(e)},function:function(e){return function(e){for(var t=self,n=e.split("."),r=null;r=n.shift();)if(!(t=t[r]))return null;return t}(e)},serverapi:function(e){return(n={}).url=q(t=e)?t:t.url||"",n.timeout=t.timeout?parseInt(t.timeout,10):0,n.headers=t.headers?t.headers:{},r(H,function(e){n[e]=X(e,t[e],H[e],n.timeout,n.headers)}),n.remove=t.remove||null,delete n.headers,n;var t,n},object:function(e){try{return JSON.parse(e.replace(/{\s*'/g,'{"').replace(/'\s*}/g,'"}').replace(/'\s*:/g,'":').replace(/:\s*'/g,':"').replace(/,\s*'/g,',"').replace(/'\s*,/g,'",'))}catch(e){return null}}},$=function(e,t,n){if(e===t)return e;var r,o=W(e);if(o!==n){var i=(r=e,Q[n](r));if(o=W(i),null===i)throw'Trying to assign value with incorrect type to "'+option+'", allowed type: "'+n+'"';e=i}return e},Z=function(e){var t={};return r(e,function(n){var r,o,i,a=e[n];t[n]=(r=a[0],o=a[1],i=r,{enumerable:!0,get:function(){return i},set:function(e){i=$(e,r,o)}})}),o(t)},K=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";return e.split(/(?=[A-Z])/).map(function(e){return e.toLowerCase()}).join(t)},J=function(e){return function(t,n,o){var i={};return r(e,function(e){var n=K(e,"_").toUpperCase();i["SET_"+n]=function(r){try{o.options[e]=r.value}catch(e){}t("DID_SET_"+n,{value:o.options[e]})}}),i}},ee=function(e){return function(t){var n={};return r(e,function(e){n["GET_"+K(e,"_").toUpperCase()]=function(n){return t.options[e]}}),n}},te=1,ne=2,re=3,oe=4,ie=5,ae=function(){return Math.random().toString(36).substr(2,9)},ue=function(e,t){return e.splice(t,1)},se=function(){var e=[],t=function(t,n){ue(e,e.findIndex(function(e){return e.event===t&&(e.cb===n||!n)}))};return{fire:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;oBrowse',Te.STRING],labelInvalidField:["Field contains invalid files",Te.STRING],labelFileWaitingForSize:["Waiting for size",Te.STRING],labelFileSizeNotAvailable:["Size not available",Te.STRING],labelFileCountSingular:["file in list",Te.STRING],labelFileCountPlural:["files in list",Te.STRING],labelFileLoading:["Loading",Te.STRING],labelFileAdded:["Added",Te.STRING],labelFileLoadError:["Error during load",Te.STRING],labelFileRemoved:["Removed",Te.STRING],labelFileRemoveError:["Error during remove",Te.STRING],labelFileProcessing:["Uploading",Te.STRING],labelFileProcessingComplete:["Upload complete",Te.STRING],labelFileProcessingAborted:["Upload cancelled",Te.STRING],labelFileProcessingError:["Error during upload",Te.STRING],labelFileProcessingRevertError:["Error during revert",Te.STRING],labelTapToCancel:["tap to cancel",Te.STRING],labelTapToRetry:["tap to retry",Te.STRING],labelTapToUndo:["tap to undo",Te.STRING],labelButtonRemoveItem:["Remove",Te.STRING],labelButtonAbortItemLoad:["Abort",Te.STRING],labelButtonRetryItemLoad:["Retry",Te.STRING],labelButtonAbortItemProcessing:["Cancel",Te.STRING],labelButtonUndoItemProcessing:["Undo",Te.STRING],labelButtonRetryItemProcessing:["Retry",Te.STRING],labelButtonProcessItem:["Upload",Te.STRING],iconRemove:['',Te.STRING],iconProcess:['',Te.STRING],iconRetry:['',Te.STRING],iconUndo:['',Te.STRING],iconDone:['',Te.STRING],oninit:[null,Te.FUNCTION],onwarning:[null,Te.FUNCTION],onerror:[null,Te.FUNCTION],onactivatefile:[null,Te.FUNCTION],onaddfilestart:[null,Te.FUNCTION],onaddfileprogress:[null,Te.FUNCTION],onaddfile:[null,Te.FUNCTION],onprocessfilestart:[null,Te.FUNCTION],onprocessfileprogress:[null,Te.FUNCTION],onprocessfileabort:[null,Te.FUNCTION],onprocessfilerevert:[null,Te.FUNCTION],onprocessfile:[null,Te.FUNCTION],onprocessfiles:[null,Te.FUNCTION],onremovefile:[null,Te.FUNCTION],onpreparefile:[null,Te.FUNCTION],onupdatefiles:[null,Te.FUNCTION],onreorderfiles:[null,Te.FUNCTION],beforeDropFile:[null,Te.FUNCTION],beforeAddFile:[null,Te.FUNCTION],beforeRemoveFile:[null,Te.FUNCTION],stylePanelLayout:[null,Te.STRING],stylePanelAspectRatio:[null,Te.STRING],styleItemPanelAspectRatio:[null,Te.STRING],styleButtonRemoveItemPosition:["left",Te.STRING],styleButtonProcessItemPosition:["right",Te.STRING],styleLoadIndicatorPosition:["right",Te.STRING],styleProgressIndicatorPosition:["right",Te.STRING],styleButtonRemoveItemAlign:[!1,Te.BOOLEAN],files:[[],Te.ARRAY]},Oe=function(e,t){return C(t)?e[0]||null:Y(t)?e[t]||null:("object"==typeof t&&(t=t.id),e.find(function(e){return e.id===t})||null)},De=function(e){if(C(e))return e;if(/:/.test(e)){var t=e.split(":");return t[1]/t[0]}return parseFloat(e)},ye=function(e){return e.filter(function(e){return!e.archived})},Se={EMPTY:0,IDLE:1,ERROR:2,BUSY:3,READY:4},Ae=[de.LOAD_ERROR,de.PROCESSING_ERROR,de.PROCESSING_REVERT_ERROR],Le=[de.LOADING,de.PROCESSING,de.PROCESSING_QUEUED,de.INIT],be=[de.PROCESSING_COMPLETE],Pe=function(e){return Ae.includes(e.status)},Me=function(e){return Le.includes(e.status)},we=function(e){return be.includes(e.status)},Ce=function(e){return{GET_STATUS:function(){var t=ye(e.items),n=Se.EMPTY,r=Se.ERROR,o=Se.BUSY,i=Se.IDLE,a=Se.READY;return 0===t.length?n:t.some(Pe)?r:t.some(Me)?o:t.some(we)?a:i},GET_ITEM:function(t){return Oe(e.items,t)},GET_ACTIVE_ITEM:function(t){return Oe(ye(e.items),t)},GET_ACTIVE_ITEMS:function(){return ye(e.items)},GET_ITEMS:function(){return e.items},GET_ITEM_NAME:function(t){var n=Oe(e.items,t);return n?n.filename:null},GET_ITEM_SIZE:function(t){var n=Oe(e.items,t);return n?n.fileSize:null},GET_STYLES:function(){return Object.keys(e.options).filter(function(e){return/^style/.test(e)}).map(function(t){return{name:t,value:e.options[t]}})},GET_PANEL_ASPECT_RATIO:function(){return/circle/.test(e.options.stylePanelLayout)?1:De(e.options.stylePanelAspectRatio)},GET_ITEM_PANEL_ASPECT_RATIO:function(){return e.options.styleItemPanelAspectRatio},GET_ITEMS_BY_STATUS:function(t){return ye(e.items).filter(function(e){return e.status===t})},GET_TOTAL_ITEMS:function(){return ye(e.items).length},IS_ASYNC:function(){return z(e.options.server)&&(z(e.options.server.process)||j(e.options.server.process))}}},Ne=function(e,t,n){return Math.max(Math.min(n,e),t)},Ge=function(e){return/^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i.test(e)},Ue=function(e){return e.split("/").pop().split("?").shift()},Be=function(e){return e.split(".").pop()},qe=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return(t+e).slice(-t.length)},Ve=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date;return e.getFullYear()+"-"+qe(e.getMonth()+1,"00")+"-"+qe(e.getDate(),"00")+"_"+qe(e.getHours(),"00")+"-"+qe(e.getMinutes(),"00")+"-"+qe(e.getSeconds(),"00")},Fe=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o="string"==typeof n?e.slice(0,e.size,n):e.slice(0,e.size,e.type);return o.lastModifiedDate=new Date,e._relativePath&&(o._relativePath=e._relativePath),q(t)||(t=Ve()),t&&null===r&&Be(t)?o.name=t:(r=r||function(e){if("string"!=typeof e)return"";var 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)?"jpeg"===t?"jpg":t:""}(o.type),o.name=t+(r?"."+r:"")),o},xe=function(e,t){var n=window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;if(n){var r=new n;return r.append(e),r.getBlob(t)}return new Blob([e],{type:t})},Ye=function(e){return(/^data:(.+);/.exec(e)||[])[1]||null},ke=function(e){var t=Ye(e);return function(e,t){for(var n=new ArrayBuffer(e.length),r=new Uint8Array(n),o=0;o=200&&a.status<300?r.onload(a):r.onerror(a)},a.onerror=function(){return r.onerror(a)},a.onabort=function(){o=!0,r.onabort()},a.ontimeout=function(){return r.ontimeout(a)},a.open(n.method,t,!0),Y(n.timeout)&&(a.timeout=n.timeout),Object.keys(n.headers).forEach(function(e){var t=unescape(encodeURIComponent(n.headers[e]));a.setRequestHeader(e,t)}),n.responseType&&(a.responseType=n.responseType),n.withCredentials&&(a.withCredentials=!0),a.send(e),r},Ze=function(e,t,n,r){return{type:e,code:t,body:n,headers:r}},Ke=function(e){return function(t){e(Ze("error",0,"Timeout",t.getAllResponseHeaders()))}},Je=function(e){return/\?/.test(e)},et=function(){for(var e="",t=arguments.length,n=new Array(t),r=0;r0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if("function"==typeof t)return t;if(!t||!q(t.url))return null;var n=t.onload||function(e){return e},r=t.onerror||function(e){return null};return function(o,i,a,u,s,l){var c=$e(o,et(e,t.url),Object.assign({},t,{responseType:"blob"}));return c.onload=function(e){var r=e.getAllResponseHeaders(),a=ze(r).name||Ue(o);i(Ze("load",e.status,"HEAD"===t.method?null:Fe(n(e.response),a),r))},c.onerror=function(e){a(Ze("error",e.status,r(e.response)||e.statusText,e.getAllResponseHeaders()))},c.onheaders=function(e){l(Ze("headers",e.status,null,e.getAllResponseHeaders()))},c.ontimeout=Ke(a),c.onprogress=u,c.onabort=s,c}};function nt(e){this.wrapped=e}function rt(e){var t,n;function r(t,n){try{var i=e[t](n),a=i.value,u=a instanceof nt;Promise.resolve(u?a.wrapped:a).then(function(e){u?r("next",e):o(i.done?"return":"normal",e)},function(e){r("throw",e)})}catch(e){o("throw",e)}}function o(e,o){switch(e){case"return":t.resolve({value:o,done:!0});break;case"throw":t.reject(o);break;default:t.resolve({value:o,done:!1})}(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,o){return new Promise(function(i,a){var u={key:e,arg:o,resolve:i,reject:a,next:null};n?n=n.next=u:(t=n=u,r(e,o))})},"function"!=typeof e.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(rt.prototype[Symbol.asyncIterator]=function(){return this}),rt.prototype.next=function(e){return this._invoke("next",e)},rt.prototype.throw=function(e){return this._invoke("throw",e)},rt.prototype.return=function(e){return this._invoke("return",e)};function ot(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t=1||b()};return T.serverId?(D=function(e){T.aborted||(f.filter(function(t){return t.offset0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;return"function"==typeof t?function(){for(var e=arguments.length,o=new Array(e),i=0;ir.chunkSize,p=f&&(d||r.chunkForce);if(o instanceof Blob&&p)return ft(e,t,n,o,i,a,u,s,l,c,r);var E=t.ondata||function(e){return e},_=t.onload||function(e){return e},T=t.onerror||function(e){return null},v=new FormData;z(i)&&v.append(n,JSON.stringify(i)),(o instanceof Blob?[{name:null,file:o}]:o).forEach(function(e){v.append(n,e.file,null===e.name?e.file.name:""+e.name+e.file.name)});var I=$e(E(v),et(e,t.url),t);return I.onload=function(e){a(Ze("load",e.status,_(e.response),e.getAllResponseHeaders()))},I.onerror=function(e){u(Ze("error",e.status,T(e.response)||e.statusText,e.getAllResponseHeaders()))},I.ontimeout=Ke(u),I.onprogress=s,I.onabort=l,I}}}(e,t,n,r):null},pt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if("function"==typeof t)return t;if(!t||!q(t.url))return function(e,t){return t()};var n=t.onload||function(e){return e},r=t.onerror||function(e){return null};return function(o,i,a){var u=$e(o,e+t.url,t);return u.onload=function(e){i(Ze("load",e.status,n(e.response),e.getAllResponseHeaders()))},u.onerror=function(e){a(Ze("error",e.status,r(e.response)||e.statusText,e.getAllResponseHeaders()))},u.ontimeout=Ke(a),u}},Et=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e+Math.random()*(t-e)},_t=function(e){var t={complete:!1,perceivedProgress:0,perceivedPerformanceUpdater:null,progress:null,timestamp:null,perceivedDuration:0,duration:0,request:null,response:null},n=function(){t.request&&(t.perceivedPerformanceUpdater.clear(),t.request.abort(),t.complete=!0)},r=Object.assign({},se(),{process:function(n,o){var i=function(){0!==t.duration&&null!==t.progress&&r.fire("progress",r.getProgress())},a=function(){t.complete=!0,r.fire("load-perceived",t.response.body)};r.fire("start"),t.timestamp=Date.now(),t.perceivedPerformanceUpdater=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=(arguments.length>2&&void 0!==arguments[2]&&arguments[2],arguments.length>3&&void 0!==arguments[3]?arguments[3]:25),r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:250,o=null,i=Date.now();return function a(){var u=Date.now()-i,s=Et(n,r);u+s>t&&(s=u+s-t);var l=u/t;l>=1?e(1):(e(l),o=setTimeout(a,s))}(),{clear:function(){clearTimeout(o)}}}(function(e){t.perceivedProgress=e,t.perceivedDuration=Date.now()-t.timestamp,i(),t.response&&1===t.perceivedProgress&&!t.complete&&a()},Et(750,1500)),t.request=e(n,o,function(e){t.response=z(e)?e:{type:"load",code:200,body:""+e,headers:{}},t.duration=Date.now()-t.timestamp,t.progress=1,r.fire("load",t.response.body),1===t.perceivedProgress&&a()},function(e){t.perceivedPerformanceUpdater.clear(),r.fire("error",z(e)?e:{type:"error",code:0,body:""+e})},function(e,n,r){t.duration=Date.now()-t.timestamp,t.progress=e?n/r:null,i()},function(){t.perceivedPerformanceUpdater.clear(),r.fire("abort",t.response?t.response.body:null)},function(e){r.fire("transfer",e)})},abort:n,getProgress:function(){return t.progress?Math.min(t.progress,t.perceivedProgress):null},getDuration:function(){return Math.min(t.duration,t.perceivedDuration)},reset:function(){n(),t.complete=!1,t.perceivedProgress=0,t.progress=0,t.timestamp=null,t.perceivedDuration=0,t.duration=0,t.request=null,t.response=null}});return r},Tt=function(e){return e.substr(0,e.lastIndexOf("."))||e},vt=function(e){return!!(e instanceof File||e instanceof Blob&&e.name)},It=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=ae(),i={archived:!1,frozen:!1,released:!1,source:null,file:n,serverFileReference:t,transferId:null,processingAborted:!1,status:t?de.PROCESSING_COMPLETE:de.INIT,activeLoader:null,activeProcessor:null},a=null,u={},s=function(e){return i.status=e},l=function(e){if(!i.released&&!i.frozen){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:{},r=n.query,o=n.success,i=void 0===o?function(){}:o,a=n.failure,u=void 0===a?function(){}:a,s=Oe(e.items,r);s?t(s,i,u):u({error:Ze("error",0,"Item not found"),file:null})}},At=function(e,t,n){return{ABORT_ALL:function(){ye(n.items).forEach(function(e){e.freeze(),e.abortLoad(),e.abortProcessing()})},DID_SET_FILES:function(t){var r=t.value,o=(void 0===r?[]:r).map(function(e){return{source:e.source?e.source:e,options:e.options}}),i=ye(n.items);i.forEach(function(t){o.find(function(e){return e.source===t.source||e.source===t.file})||e("REMOVE_ITEM",{query:t})}),i=ye(n.items),o.forEach(function(t,n){i.find(function(e){return e.source===t.source||e.file===t.source})||e("ADD_ITEM",Object.assign({},t,{interactionMethod:ie,index:n}))})},DID_UPDATE_ITEM_METADATA:function(r){var o=r.id;clearTimeout(n.itemUpdateTimeout),n.itemUpdateTimeout=setTimeout(function(){var r=mt(n.items,o);if(t("IS_ASYNC")){var i,a=function(){setTimeout(function(){e("REQUEST_ITEM_PROCESSING",{query:o})},32)};return r.status===de.PROCESSING_COMPLETE?(i=n.options.instantUpload,void r.revert(pt(n.options.server.url,n.options.server.revert),t("GET_FORCE_REVERT")).then(i?a:function(){}).catch(function(){})):r.status===de.PROCESSING?function(e){r.abortProcessing().then(e?a:function(){})}(n.options.instantUpload):void(n.options.instantUpload&&a())}Ie("SHOULD_PREPARE_OUTPUT",!1,{item:r,query:t}).then(function(t){t&&e("REQUEST_PREPARE_OUTPUT",{query:o,item:r,success:function(t){e("DID_PREPARE_OUTPUT",{id:o,file:t})}},!0)})},0)},MOVE_ITEM:function(e){var t=e.query,r=e.index,o=Oe(n.items,t);if(o){var i=n.items.indexOf(o);i!==(r=Ne(r,0,n.items.length-1))&&n.items.splice(r,0,n.items.splice(i,1)[0])}},SORT:function(r){var o=r.compare;yt(n,o),e("DID_SORT_ITEMS",{items:t("GET_ACTIVE_ITEMS")})},ADD_ITEMS:function(n){var r=n.items,o=n.index,i=n.interactionMethod,a=n.success,u=void 0===a?function(){}:a,s=n.failure,l=void 0===s?function(){}:s,c=o;if(-1===o||void 0===o){var f=t("GET_ITEM_INSERT_LOCATION"),d=t("GET_TOTAL_ITEMS");c="before"===f?0:d}var p=t("GET_IGNORED_FILES"),E=r.filter(function(e){return vt(e)?!p.includes(e.name.toLowerCase()):!C(e)}).map(function(t){return new Promise(function(n,r){e("ADD_ITEM",{interactionMethod:i,source:t.source||t,success:n,failure:r,index:c++,options:t.options||{}})})});Promise.all(E).then(u).catch(l)},ADD_ITEM:function(r){var o=r.source,i=r.index,a=void 0===i?-1:i,u=r.interactionMethod,s=r.success,l=void 0===s?function(){}:s,c=r.failure,f=void 0===c?function(){}:c,d=r.options,p=void 0===d?{}:d;if(C(o))f({error:Ze("error",0,"No source"),file:null});else if(!vt(o)||!n.options.ignoredFiles.includes(o.name.toLowerCase())){if(!function(e){var t=ye(e.items).length;if(!e.options.allowMultiple)return 0===t;var n=e.options.maxFiles;return null===n||t=400&&t.code<500)return e("DID_THROW_ITEM_INVALID",{id:g,error:t,status:{main:r,sub:t.code+" ("+t.body+")"}}),void f({error:t,file:fe(I)});e("DID_THROW_ITEM_LOAD_ERROR",{id:g,error:t,status:{main:r,sub:n.options.labelTapToRetry}})}),I.on("load-file-error",function(t){e("DID_THROW_ITEM_INVALID",{id:g,error:t.status,status:t.status}),f({error:t.status,file:fe(I)})}),I.on("load-abort",function(){e("REMOVE_ITEM",{query:g})}),I.on("load-skip",function(){e("COMPLETE_LOAD_ITEM",{query:g,item:I,data:{source:o,success:l}})}),I.on("load",function(){var r=function(r){r?(I.on("metadata-update",function(t){e("DID_UPDATE_ITEM_METADATA",{id:g,change:t})}),Ie("SHOULD_PREPARE_OUTPUT",!1,{item:I,query:t}).then(function(t){var r=function(){e("COMPLETE_LOAD_ITEM",{query:g,item:I,data:{source:o,success:l}}),Ot(e,n)};t?e("REQUEST_PREPARE_OUTPUT",{query:g,item:I,success:function(t){e("DID_PREPARE_OUTPUT",{id:g,file:t}),r()}},!0):r()})):e("REMOVE_ITEM",{query:g})};Ie("DID_LOAD_ITEM",I,{query:t,dispatch:e}).then(function(){Dt(t("GET_BEFORE_ADD_FILE"),fe(I)).then(r)}).catch(function(){r(!1)})}),I.on("process-start",function(){e("DID_START_ITEM_PROCESSING",{id:g})}),I.on("process-progress",function(t){e("DID_UPDATE_ITEM_PROCESS_PROGRESS",{id:g,progress:t})}),I.on("process-error",function(t){e("DID_THROW_ITEM_PROCESSING_ERROR",{id:g,error:t,status:{main:Rt(n.options.labelFileProcessingError)(t),sub:n.options.labelTapToRetry}})}),I.on("process-revert-error",function(t){e("DID_THROW_ITEM_PROCESSING_REVERT_ERROR",{id:g,error:t,status:{main:Rt(n.options.labelFileProcessingRevertError)(t),sub:n.options.labelTapToRetry}})}),I.on("process-complete",function(t){e("DID_COMPLETE_ITEM_PROCESSING",{id:g,error:null,serverFileReference:t}),e("DID_DEFINE_VALUE",{id:g,value:t})}),I.on("process-abort",function(){e("DID_ABORT_ITEM_PROCESSING",{id:g})}),I.on("process-revert",function(){e("DID_REVERT_ITEM_PROCESSING",{id:g}),e("DID_DEFINE_VALUE",{id:g,value:null})}),e("DID_ADD_ITEM",{id:g,index:a,interactionMethod:u}),Ot(e,n);var h=n.options.server||{},R=h.url,O=h.load,D=h.restore,y=h.fetch;I.load(o,We(v===pe.INPUT?q(o)&&function(e){return(e.indexOf(":")>-1||e.indexOf("//")>-1)&&ht(location.href)!==ht(e)}(o)?tt(R,y):gt:tt(R,v===pe.LIMBO?D:O)),function(e,n,r){Ie("LOAD_FILE",e,{query:t}).then(n).catch(r)})}},REQUEST_PREPARE_OUTPUT:function(e){var n=e.item,r=e.success,o=e.failure,i=void 0===o?function(){}:o,a={error:Ze("error",0,"Item not found"),file:null};if(n.archived)return i(a);Ie("PREPARE_OUTPUT",n.file,{query:t,item:n}).then(function(e){Ie("COMPLETE_PREPARE_OUTPUT",e,{query:t,item:n}).then(function(e){if(n.archived)return i(a);r(e)})})},COMPLETE_LOAD_ITEM:function(r){var o=r.item,i=r.data,a=i.success,u=i.source,s=t("GET_ITEM_INSERT_LOCATION");if(j(s)&&u&&yt(n,s),e("DID_LOAD_ITEM",{id:o.id,error:null,serverFileReference:o.origin===pe.INPUT?null:u}),a(fe(o)),o.origin!==pe.LOCAL)return o.origin===pe.LIMBO?(e("DID_COMPLETE_ITEM_PROCESSING",{id:o.id,error:null,serverFileReference:u}),void e("DID_DEFINE_VALUE",{id:o.id,value:u})):void(t("IS_ASYNC")&&n.options.instantUpload&&e("REQUEST_ITEM_PROCESSING",{query:o.id}));e("DID_LOAD_LOCAL_ITEM",{id:o.id})},RETRY_ITEM_LOAD:St(n,function(e){e.retryLoad()}),REQUEST_ITEM_PREPARE:St(n,function(t,n,r){e("REQUEST_PREPARE_OUTPUT",{query:t.id,item:t,success:function(r){e("DID_PREPARE_OUTPUT",{id:t.id,file:r}),n({file:t,output:r})},failure:r},!0)}),REQUEST_ITEM_PROCESSING:St(n,function(r,o,i){if(r.status===de.IDLE||r.status===de.PROCESSING_ERROR)r.status!==de.PROCESSING_QUEUED&&(r.requestProcessing(),e("DID_REQUEST_ITEM_PROCESSING",{id:r.id}),e("PROCESS_ITEM",{query:r,success:o,failure:i},!0));else{var a=function(){setTimeout(function(){e("REQUEST_ITEM_PROCESSING",{query:r,success:o,failure:i})},32)};r.status===de.PROCESSING_COMPLETE||r.status===de.PROCESSING_REVERT_ERROR?r.revert(pt(n.options.server.url,n.options.server.revert),t("GET_FORCE_REVERT")).then(a).catch(function(){}):r.status===de.PROCESSING&&r.abortProcessing().then(a)}}),PROCESS_ITEM:St(n,function(r,o,i){var a=t("GET_MAX_PARALLEL_UPLOADS");if(t("GET_ITEMS_BY_STATUS",de.PROCESSING).length!==a){if(r.status!==de.PROCESSING){var u=function t(){var r=n.processingQueue.shift();if(r){var o=r.id,i=r.success,a=r.failure,u=Oe(n.items,o);u&&!u.archived?e("PROCESS_ITEM",{query:o,success:i,failure:a},!0):t()}};r.onOnce("process-complete",function(){o(fe(r)),u(),t("GET_ITEMS_BY_STATUS",de.PROCESSING_COMPLETE).length===n.items.length&&e("DID_COMPLETE_ITEM_PROCESSING_ALL")}),r.onOnce("process-error",function(e){i({error:e,file:fe(r)}),u()});var s=n.options;r.process(_t(dt(s.server.url,s.server.process,s.name,{chunkTransferId:r.transferId,chunkServer:s.server.patch,chunkUploads:s.chunkUploads,chunkForce:s.chunkForce,chunkSize:s.chunkSize,chunkRetryDelays:s.chunkRetryDelays})),function(n,o,i){Ie("PREPARE_OUTPUT",n,{query:t,item:r}).then(function(t){e("DID_PREPARE_OUTPUT",{id:r.id,file:t}),o(t)}).catch(i)})}}else n.processingQueue.push({id:r.id,success:o,failure:i})}),RETRY_ITEM_PROCESSING:St(n,function(t){e("REQUEST_ITEM_PROCESSING",{query:t})}),REQUEST_REMOVE_ITEM:St(n,function(n){Dt(t("GET_BEFORE_REMOVE_FILE"),fe(n)).then(function(t){t&&e("REMOVE_ITEM",{query:n})})}),RELEASE_ITEM:St(n,function(e){e.release()}),REMOVE_ITEM:St(n,function(t,r){var o=function(){var o=t.id;mt(n.items,o).archive(),e("DID_REMOVE_ITEM",{error:null,id:o,item:t}),Ot(e,n),r(fe(t))},i=n.options.server;t.origin===pe.LOCAL&&i&&j(i.remove)?(e("DID_START_ITEM_REMOVE",{id:t.id}),i.remove(t.source,function(){return o()},function(r){e("DID_THROW_ITEM_REMOVE_ERROR",{id:t.id,error:Ze("error",0,r,null),status:{main:Rt(n.options.labelFileRemoveError)(r),sub:n.options.labelTapToRetry}})})):o()}),ABORT_ITEM_LOAD:St(n,function(e){e.abortLoad()}),ABORT_ITEM_PROCESSING:St(n,function(t){t.serverId?e("REVERT_ITEM_PROCESSING",{id:t.id}):t.abortProcessing().then(function(){n.options.instantUpload&&e("REMOVE_ITEM",{query:t.id})})}),REQUEST_REVERT_ITEM_PROCESSING:St(n,function(r){if(n.options.instantUpload){var o=function(t){t&&e("REVERT_ITEM_PROCESSING",{query:r})},i=t("GET_BEFORE_REMOVE_FILE");if(!i)return o(!0);var a=i(fe(r));return null==a?o(!0):"boolean"==typeof a?o(a):void("function"==typeof a.then&&a.then(o))}e("REVERT_ITEM_PROCESSING",{query:r})}),REVERT_ITEM_PROCESSING:St(n,function(r){r.revert(pt(n.options.server.url,n.options.server.revert),t("GET_FORCE_REVERT")).then(function(){(n.options.instantUpload||function(e){return!vt(e.file)}(r))&&e("REMOVE_ITEM",{query:r.id})}).catch(function(){})}),SET_OPTIONS:function(t){var n=t.options;r(n,function(t,n){e("SET_"+K(t,"_").toUpperCase(),{value:n})})}}},Lt=function(e){return e},bt=function(e){return document.createElement(e)},Pt=function(e,t){var n=e.childNodes[0];n?t!==n.nodeValue&&(n.nodeValue=t):(n=document.createTextNode(t),e.appendChild(n))},Mt=function(e,t,n,r){var o=(r%360-90)*Math.PI/180;return{x:e+n*Math.cos(o),y:t+n*Math.sin(o)}},wt=function(e,t,n,r,o){var i=1;return o>r&&o-r<=.5&&(i=0),r>o&&r-o>=.5&&(i=0),function(e,t,n,r,o,i){var a=Mt(e,t,n,o),u=Mt(e,t,n,r);return["M",a.x,a.y,"A",n,n,0,i,0,u.x,u.y].join(" ")}(e,t,n,360*Math.min(.9999,r),360*Math.min(.9999,o),i)},Ct=L({tag:"div",name:"progress-indicator",ignoreRectUpdate:!0,ignoreRect:!0,create:function(e){var t=e.root,n=e.props;n.spin=!1,n.progress=0,n.opacity=0;var r=s("svg");t.ref.path=s("path",{"stroke-width":2,"stroke-linecap":"round"}),r.appendChild(t.ref.path),t.ref.svg=r,t.appendChild(r)},write:function(e){var t=e.root,n=e.props;if(0!==n.opacity){n.align&&(t.element.dataset.align=n.align);var r=parseInt(i(t.ref.path,"stroke-width"),10),o=.5*t.rect.element.width,a=0,u=0;n.spin?(a=0,u=.5):(a=0,u=n.progress);var s=wt(o,o,o-r,a,u);i(t.ref.path,"d",s),i(t.ref.path,"stroke-opacity",n.spin||n.progress>0?1:0)}},mixins:{apis:["progress","spin","align"],styles:["opacity"],animations:{opacity:{type:"tween",duration:500},progress:{type:"spring",stiffness:.95,damping:.65,mass:10}}}}),Nt=L({tag:"button",attributes:{type:"button"},ignoreRect:!0,ignoreRectUpdate:!0,name:"file-action-button",mixins:{apis:["label"],styles:["translateX","translateY","scaleX","scaleY","opacity"],animations:{scaleX:"spring",scaleY:"spring",translateX:"spring",translateY:"spring",opacity:{type:"tween",duration:250}},listeners:!0},create:function(e){var t=e.root,n=e.props;t.element.innerHTML=(n.icon||"")+""+n.label+"",n.isDisabled=!1},write:function(e){var t=e.root,n=e.props,r=n.isDisabled,o=t.query("GET_DISABLED")||0===n.opacity;o&&!r?(n.isDisabled=!0,i(t.element,"disabled","disabled")):!o&&r&&(n.isDisabled=!1,t.element.removeAttribute("disabled"))}}),Gt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".";return(e=Math.round(Math.abs(e)))<1e3?e+" bytes":e0&&(t.height=t.ref.container.rect.element.height)),o&&(t.ref.panel.height=null),t.ref.panel.height=t.height}),vn=L({create:function(e){var t=e.root,n=e.props;t.ref.handleClick=function(e){return t.dispatch("DID_ACTIVATE_ITEM",{id:n.id})},t.element.id="filepond--item-"+n.id,t.element.addEventListener("click",t.ref.handleClick),t.ref.container=t.appendChildView(t.createChildView(ln,{id:n.id})),t.ref.panel=t.appendChildView(t.createChildView(dn,{name:"item-panel"})),t.ref.panel.height=null,n.markedForRemoval=!1,t.query("GET_ALLOW_REORDER")&&(t.element.dataset.dragState="idle",t.element.addEventListener("pointerdown",function(e){if(e.isPrimary){var r=!1,o=e.pageX,i=e.pageY;n.dragOrigin={x:t.translateX,y:t.translateY},n.dragCenter={x:e.offsetX,y:e.offsetY},t.dispatch("DID_GRAB_ITEM",{id:n.id});var a=function(e){e.isPrimary&&(e.stopPropagation(),e.preventDefault(),n.dragOffset={x:e.pageX-o,y:e.pageY-i},n.dragOffset.x*n.dragOffset.x+n.dragOffset.y*n.dragOffset.y>16&&!r&&(r=!0,t.element.removeEventListener("click",t.ref.handleClick)),t.dispatch("DID_DRAG_ITEM",{id:n.id}))};document.addEventListener("pointermove",a),document.addEventListener("pointerup",function e(u){u.isPrimary&&(document.removeEventListener("pointermove",a),document.removeEventListener("pointerup",e),n.dragOffset={x:u.pageX-o,y:u.pageY-i},t.dispatch("DID_DROP_ITEM",{id:n.id}),r&&setTimeout(function(){return t.element.addEventListener("click",t.ref.handleClick)},0))})}}))},write:Tn,destroy:function(e){var t=e.root,n=e.props;t.element.removeEventListener("click",t.ref.handleClick),t.dispatch("RELEASE_ITEM",{query:n.id})},tag:"li",name:"item",mixins:{apis:["id","interactionMethod","markedForRemoval","spawnDate","dragCenter","dragOrigin","dragOffset"],styles:["translateX","translateY","scaleX","scaleY","opacity","height"],animations:{scaleX:"spring",scaleY:"spring",translateX:pn,translateY:pn,opacity:{type:"tween",duration:150}}}}),In=function(e,t,n){if(n){var r=e.rect.element.width,o=t.length,i=null;if(0===o||n.topI){if(n.left3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;e.dragOffset?(e.translateX=null,e.translateY=null,e.translateX=e.dragOrigin.x+e.dragOffset.x,e.translateY=e.dragOrigin.y+e.dragOffset.y,e.scaleX=1.025,e.scaleY=1.025):(e.translateX=t,e.translateY=n,Date.now()>e.spawnDate&&(0===e.opacity&&gn(e,t,n,r,o),e.scaleX=1,e.scaleY=1,e.opacity=1))},gn=function(e,t,n,r,o){e.interactionMethod===ie?(e.translateX=null,e.translateX=t,e.translateY=null,e.translateY=n):e.interactionMethod===ne?(e.translateX=null,e.translateX=t-20*r,e.translateY=null,e.translateY=n-10*o,e.scaleX=.8,e.scaleY=.8):e.interactionMethod===re?(e.translateY=null,e.translateY=n-30):e.interactionMethod===te&&(e.translateX=null,e.translateX=t-30,e.translateY=null)},hn=function(e){return e.rect.element.height+.5*e.rect.element.marginBottom+.5*e.rect.element.marginTop},Rn=b({DID_ADD_ITEM:function(e){var t=e.root,n=e.action,r=n.id,o=n.index,i=n.interactionMethod;t.ref.addIndex=o;var a=Date.now(),u=a,s=1;if(i!==ie){s=0;var l=t.query("GET_ITEM_INSERT_INTERVAL"),c=a-t.ref.lastItemSpanwDate;u=c_){if(i3&&void 0!==arguments[3]?arguments[3]:"";n?i(e,t,r):e.removeAttribute(t)},An=function(e){var t=e.root,n=e.action;Sn(t.element,"accept",!!n.value,n.value?n.value.join(","):"")},Ln=function(e){var t=e.root,n=e.action;Sn(t.element,"multiple",n.value)},bn=function(e){var t=e.root,n=e.action;Sn(t.element,"webkitdirectory",n.value)},Pn=function(e){var t=e.root,n=t.query("GET_DISABLED"),r=t.query("GET_ALLOW_BROWSE"),o=n||!r;Sn(t.element,"disabled",o)},Mn=function(e){var t=e.root;e.action.value?0===t.query("GET_TOTAL_ITEMS")&&Sn(t.element,"required",!0):Sn(t.element,"required",!1)},wn=function(e){var t=e.root,n=e.action;Sn(t.element,"capture",!!n.value,!0===n.value?"":n.value)},Cn=function(e){var t=e.root,n=t.element;t.query("GET_TOTAL_ITEMS")>0?(Sn(n,"required",!1),Sn(n,"name",!1)):(Sn(n,"name",!0,t.query("GET_NAME")),t.query("GET_CHECK_VALIDITY")&&n.setCustomValidity(""),t.query("GET_REQUIRED")&&Sn(n,"required",!0))},Nn=L({tag:"input",name:"browser",ignoreRect:!0,ignoreRectUpdate:!0,attributes:{type:"file"},create:function(e){var t=e.root,n=e.props;t.element.id="filepond--browser-"+n.id,i(t.element,"name",t.query("GET_NAME")),i(t.element,"aria-controls","filepond--assistant-"+n.id),i(t.element,"aria-labelledby","filepond--drop-label-"+n.id),An({root:t,action:{value:t.query("GET_ACCEPTED_FILE_TYPES")}}),Ln({root:t,action:{value:t.query("GET_ALLOW_MULTIPLE")}}),bn({root:t,action:{value:t.query("GET_ALLOW_DIRECTORIES_ONLY")}}),Pn({root:t}),Mn({root:t,action:{value:t.query("GET_REQUIRED")}}),wn({root:t,action:{value:t.query("GET_CAPTURE_METHOD")}}),t.ref.handleChange=function(e){if(t.element.value){var r=Array.from(t.element.files).map(function(e){return e._relativePath=e.webkitRelativePath,e});setTimeout(function(){n.onload(r),function(e){if(e&&""!==e.value){try{e.value=""}catch(e){}if(e.value){var t=bt("form"),n=e.parentNode,r=e.nextSibling;t.appendChild(e),t.reset(),r?n.insertBefore(e,r):n.appendChild(e)}}}(t.element)},250)}},t.element.addEventListener("change",t.ref.handleChange)},destroy:function(e){var t=e.root;t.element.removeEventListener("change",t.ref.handleChange)},write:b({DID_LOAD_ITEM:Cn,DID_REMOVE_ITEM:Cn,DID_THROW_ITEM_INVALID:function(e){var t=e.root;t.query("GET_CHECK_VALIDITY")&&t.element.setCustomValidity(t.query("GET_LABEL_INVALID_FIELD"))},DID_SET_DISABLED:Pn,DID_SET_ALLOW_BROWSE:Pn,DID_SET_ALLOW_DIRECTORIES_ONLY:bn,DID_SET_ALLOW_MULTIPLE:Ln,DID_SET_ACCEPTED_FILE_TYPES:An,DID_SET_CAPTURE_METHOD:wn,DID_SET_REQUIRED:Mn})}),Gn=13,Un=32,Bn=function(e,t){e.innerHTML=t;var n=e.querySelector(".filepond--label-action");return n&&i(n,"tabindex","0"),t},qn=L({name:"drop-label",ignoreRect:!0,create:function(e){var t=e.root,n=e.props,r=bt("label");i(r,"for","filepond--browser-"+n.id),i(r,"id","filepond--drop-label-"+n.id),i(r,"aria-hidden","true"),t.ref.handleKeyDown=function(e){(e.keyCode===Gn||e.keyCode===Un)&&(e.preventDefault(),t.ref.label.click())},t.ref.handleClick=function(e){e.target===r||r.contains(e.target)||t.ref.label.click()},r.addEventListener("keydown",t.ref.handleKeyDown),t.element.addEventListener("click",t.ref.handleClick),Bn(r,n.caption),t.appendChild(r),t.ref.label=r},destroy:function(e){var t=e.root;t.ref.label.addEventListener("keydown",t.ref.handleKeyDown),t.element.removeEventListener("click",t.ref.handleClick)},write:b({DID_SET_LABEL_IDLE:function(e){var t=e.root,n=e.action;Bn(t.ref.label,n.value)}}),mixins:{styles:["opacity","translateX","translateY"],animations:{opacity:{type:"tween",duration:150},translateX:"spring",translateY:"spring"}}}),Vn=L({name:"drip-blob",ignoreRect:!0,mixins:{styles:["translateX","translateY","scaleX","scaleY","opacity"],animations:{scaleX:"spring",scaleY:"spring",translateX:"spring",translateY:"spring",opacity:{type:"tween",duration:250}}}}),Fn=b({DID_DRAG:function(e){var t=e.root,n=e.action;t.ref.blob?(t.ref.blob.translateX=n.position.scopeLeft,t.ref.blob.translateY=n.position.scopeTop,t.ref.blob.scaleX=1,t.ref.blob.scaleY=1,t.ref.blob.opacity=1):function(e){var t=e.root,n=.5*t.rect.element.width,r=.5*t.rect.element.height;t.ref.blob=t.appendChildView(t.createChildView(Vn,{opacity:0,scaleX:2.5,scaleY:2.5,translateX:n,translateY:r}))}({root:t})},DID_DROP:function(e){var t=e.root;t.ref.blob&&(t.ref.blob.scaleX=2.5,t.ref.blob.scaleY=2.5,t.ref.blob.opacity=0)},DID_END_DRAG:function(e){var t=e.root;t.ref.blob&&(t.ref.blob.opacity=0)}}),xn=L({ignoreRect:!0,ignoreRectUpdate:!0,name:"drip",write:function(e){var t=e.root,n=e.props,r=e.actions;Fn({root:t,props:n,actions:r});var o=t.ref.blob;0===r.length&&o&&0===o.opacity&&(t.removeChildView(o),t.ref.blob=null)}}),Yn=function(e,t){return e.ref.fields[t]},kn=function(e){return function(e){e.query("GET_ACTIVE_ITEMS").forEach(function(t){e.element.appendChild(e.ref.fields[t.id])})}(e.root)},jn=b({DID_SET_DISABLED:function(e){var t=e.root;t.element.disabled=t.query("GET_DISABLED")},DID_ADD_ITEM:function(e){var t=e.root,n=e.action,r=bt("input");r.type="hidden",r.name=t.query("GET_NAME"),r.disabled=t.query("GET_DISABLED"),t.appendChild(r,0),t.ref.fields[n.id]=r},DID_LOAD_ITEM:function(e){var t=e.root,n=e.action,r=Yn(t,n.id);r&&null!==n.serverFileReference&&(r.value=n.serverFileReference)},DID_REMOVE_ITEM:function(e){var t=e.root,n=e.action,r=Yn(t,n.id);r&&(r.parentNode.removeChild(r),delete t.ref.fields[n.id])},DID_DEFINE_VALUE:function(e){var t=e.root,n=e.action,r=Yn(t,n.id);r&&(null===n.value?r.removeAttribute("value"):r.value=n.value)},DID_REORDER_ITEMS:kn,DID_SORT_ITEMS:kn}),Hn=L({tag:"fieldset",name:"data",create:function(e){return e.root.ref.fields={}},write:jn,ignoreRect:!0}),Xn=["jpg","jpeg","png","gif","bmp","webp","svg","tiff"],zn=["css","csv","html","txt"],Wn={zip:"zip|compressed",epub:"application/epub+zip"},Qn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e=e.toLowerCase(),Xn.includes(e)?"image/"+("jpg"===e?"jpeg":"svg"===e?"svg+xml":e):zn.includes(e)?"text/"+e:Wn[e]||""},$n=function(e){return new Promise(function(t,n){var r=ar(e);if(r.length&&!Zn(e))return t(r);Kn(e).then(t)})},Zn=function(e){return!!e.files&&e.files.length>0},Kn=function(e){return new Promise(function(t,n){var r=(e.items?Array.from(e.items):[]).filter(function(e){return Jn(e)}).map(function(e){return er(e)});r.length?Promise.all(r).then(function(e){var n=[];e.forEach(function(e){n.push.apply(n,e)}),t(n.filter(function(e){return e}).map(function(e){return e._relativePath||(e._relativePath=e.webkitRelativePath),e}))}).catch(console.error):t(e.files?Array.from(e.files):[])})},Jn=function(e){if(or(e)){var t=ir(e);if(t)return t.isFile||t.isDirectory}return"file"===e.kind},er=function(e){return new Promise(function(t,n){rr(e)?tr(ir(e)).then(t).catch(n):t([e.getAsFile()])})},tr=function(e){return new Promise(function(t,n){var r=[],o=0,i=0,a=function(){0===i&&0===o&&t(r)};!function e(t){o++;var u=t.createReader();!function t(){u.readEntries(function(n){if(0===n.length)return o--,void a();n.forEach(function(t){t.isDirectory?e(t):(i++,t.file(function(e){var n=nr(e);t.fullPath&&(n._relativePath=t.fullPath),r.push(n),i--,a()}))}),t()},n)}()}(e)})},nr=function(e){if(e.type.length)return e;var t=e.lastModifiedDate,n=e.name;return(e=e.slice(0,e.size,Qn(Be(e.name)))).name=n,e.lastModifiedDate=t,e},rr=function(e){return or(e)&&(ir(e)||{}).isDirectory},or=function(e){return"webkitGetAsEntry"in e},ir=function(e){return e.webkitGetAsEntry()},ar=function(e){var t=[];try{if((t=sr(e)).length)return t;t=ur(e)}catch(e){}return t},ur=function(e){var t=e.getData("url");return"string"==typeof t&&t.length?[t]:[]},sr=function(e){var t=e.getData("text/html");if("string"==typeof t&&t.length){var n=t.match(/src\s*=\s*"(.+?)"/);if(n)return[n[1]]}return[]},lr=[],cr=function(e){return{pageLeft:e.pageX,pageTop:e.pageY,scopeLeft:e.offsetX||e.layerX,scopeTop:e.offsetY||e.layerY}},fr=function(e){var t=lr.find(function(t){return t.element===e});if(t)return t;var n=dr(e);return lr.push(n),n},dr=function(e){var t=[],n={dragenter:Tr,dragover:vr,dragleave:mr,drop:Ir},o={};r(n,function(n,r){o[n]=r(e,t),e.addEventListener(n,o[n],!1)});var i={element:e,addListener:function(a){return t.push(a),function(){t.splice(t.indexOf(a),1),0===t.length&&(lr.splice(lr.indexOf(i),1),r(n,function(t){e.removeEventListener(t,o[t],!1)}))}}};return i},pr=function(e,t){var n,r=function(e,t){return"elementFromPoint"in e||(e=document),e.elementFromPoint(t.x,t.y)}("getRootNode"in(n=t)?n.getRootNode():document,{x:e.pageX-window.pageXOffset,y:e.pageY-window.pageYOffset});return r===t||t.contains(r)},Er=null,_r=function(e,t){try{e.dropEffect=t}catch(e){}},Tr=function(e,t){return function(e){e.preventDefault(),Er=e.target,t.forEach(function(t){var n=t.element,r=t.onenter;pr(e,n)&&(t.state="enter",r(cr(e)))})}},vr=function(e,t){return function(e){e.preventDefault();var n=e.dataTransfer;$n(n).then(function(r){var o=!1;t.some(function(t){var i=t.filterElement,a=t.element,u=t.onenter,s=t.onexit,l=t.ondrag,c=t.allowdrop;_r(n,"copy");var f=c(r);if(f)if(pr(e,a)){if(o=!0,null===t.state)return t.state="enter",void u(cr(e));if(t.state="over",i&&!f)return void _r(n,"none");l(cr(e))}else i&&!o&&_r(n,"none"),t.state&&(t.state=null,s(cr(e)));else _r(n,"none")})})}},Ir=function(e,t){return function(e){e.preventDefault();var n=e.dataTransfer;$n(n).then(function(n){t.forEach(function(t){var r=t.filterElement,o=t.element,i=t.ondrop,a=t.onexit,u=t.allowdrop;if(t.state=null,!r||pr(e,o))return u(n)?void i(cr(e),n):a(cr(e))})})}},mr=function(e,t){return function(e){Er===e.target&&t.forEach(function(t){var n=t.onexit;t.state=null,n(cr(e))})}},gr=function(e,t,n){e.classList.add("filepond--hopper");var r=n.catchesDropsOnPage,o=n.requiresDropOnElement,i=n.filterItems,a=void 0===i?function(e){return e}:i,u=function(e,t,n){var r=fr(t),o={element:e,filterElement:n,state:null,ondrop:function(){},onenter:function(){},ondrag:function(){},onexit:function(){},onload:function(){},allowdrop:function(){}};return o.destroy=r.addListener(o),o}(e,r?document.documentElement:e,o),s="",l="";u.allowdrop=function(e){return t(a(e))},u.ondrop=function(e,n){var r=a(n);t(r)?(l="drag-drop",c.onload(r,e)):c.ondragend(e)},u.ondrag=function(e){c.ondrag(e)},u.onenter=function(e){l="drag-over",c.ondragstart(e)},u.onexit=function(e){l="drag-exit",c.ondragend(e)};var c={updateHopperState:function(){s!==l&&(e.dataset.hopperState=l,s=l)},onload:function(){},ondragstart:function(){},ondrag:function(){},ondragend:function(){},destroy:function(){u.destroy()}};return c},hr=!1,Rr=[],Or=function(e){$n(e.clipboardData).then(function(e){e.length&&Rr.forEach(function(t){return t(e)})})},Dr=function(){var e=function(e){t.onload(e)},t={destroy:function(){var t;t=e,ue(Rr,Rr.indexOf(t)),0===Rr.length&&(document.removeEventListener("paste",Or),hr=!1)},onload:function(){}};return function(e){Rr.includes(e)||(Rr.push(e),hr||(hr=!0,document.addEventListener("paste",Or)))}(e),t},yr=null,Sr=null,Ar=[],Lr=function(e,t){e.element.textContent=t},br=function(e,t,n){var r=e.query("GET_TOTAL_ITEMS");Lr(e,n+" "+t+", "+r+" "+(1===r?e.query("GET_LABEL_FILE_COUNT_SINGULAR"):e.query("GET_LABEL_FILE_COUNT_PLURAL"))),clearTimeout(Sr),Sr=setTimeout(function(){!function(e){e.element.textContent=""}(e)},1500)},Pr=function(e){return e.element.parentNode.contains(document.activeElement)},Mr=function(e){var t=e.root,n=e.action,r=t.query("GET_ITEM",n.id).filename,o=t.query("GET_LABEL_FILE_PROCESSING_ABORTED");Lr(t,r+" "+o)},wr=function(e){var t=e.root,n=e.action,r=t.query("GET_ITEM",n.id).filename;Lr(t,n.status.main+" "+r+" "+n.status.sub)},Cr=L({create:function(e){var t=e.root,n=e.props;t.element.id="filepond--assistant-"+n.id,i(t.element,"role","status"),i(t.element,"aria-live","polite"),i(t.element,"aria-relevant","additions")},ignoreRect:!0,ignoreRectUpdate:!0,write:b({DID_LOAD_ITEM:function(e){var t=e.root,n=e.action;if(Pr(t)){t.element.textContent="";var r=t.query("GET_ITEM",n.id);Ar.push(r.filename),clearTimeout(yr),yr=setTimeout(function(){br(t,Ar.join(", "),t.query("GET_LABEL_FILE_ADDED")),Ar.length=0},750)}},DID_REMOVE_ITEM:function(e){var t=e.root,n=e.action;if(Pr(t)){var r=n.item;br(t,r.filename,t.query("GET_LABEL_FILE_REMOVED"))}},DID_COMPLETE_ITEM_PROCESSING:function(e){var t=e.root,n=e.action,r=t.query("GET_ITEM",n.id).filename,o=t.query("GET_LABEL_FILE_PROCESSING_COMPLETE");Lr(t,r+" "+o)},DID_ABORT_ITEM_PROCESSING:Mr,DID_REVERT_ITEM_PROCESSING:Mr,DID_THROW_ITEM_REMOVE_ERROR:wr,DID_THROW_ITEM_LOAD_ERROR:wr,DID_THROW_ITEM_INVALID:wr,DID_THROW_ITEM_PROCESSING_ERROR:wr}),tag:"span",name:"assistant"}),Nr=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";return e.replace(new RegExp(t+".","g"),function(e){return e.charAt(1).toUpperCase()})},Gr=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=Date.now(),o=null;return function(){for(var i=arguments.length,a=new Array(i),u=0;u=0?1:0,_=a.find(function(e){return e.markedForRemoval&&e.opacity<.45})?-1:0,T=a.length+E+_,v=Math.round(u/d);return 1===v?a.forEach(function(e){var r=e.rect.element.height+c;n+=r,t+=r*e.opacity}):(n=Math.ceil(T/v)*p,t=n),{visual:t,bounds:n}},Vr=function(e){var t=e.ref.measureHeight||null;return{cappedHeight:parseInt(e.style.maxHeight,10)||null,fixedHeight:0===t?null:t}},Fr=function(e,t){var n=e.query("GET_ALLOW_REPLACE"),r=e.query("GET_ALLOW_MULTIPLE"),o=e.query("GET_TOTAL_ITEMS"),i=e.query("GET_MAX_FILES"),a=t.length;return!r&&a>1||!!(Y(i=r?i:n?i:1)&&o+a>i)&&(e.dispatch("DID_THROW_MAX_FILES",{source:t,error:Ze("warning",0,"Max files")}),!0)},xr=function(e,t,n){var r=e.childViews[0];return In(r,t,{left:n.scopeLeft-r.rect.element.left,top:n.scopeTop-(e.rect.outer.top+e.rect.element.marginTop+e.rect.element.scrollTop)})},Yr=function(e){var t=e.query("GET_ALLOW_DROP"),n=e.query("GET_DISABLED"),r=t&&!n;if(r&&!e.ref.hopper){var o=gr(e.element,function(t){if(Fr(e,t))return!1;var n=e.query("GET_BEFORE_DROP_FILE")||function(){return!0};return!e.query("GET_DROP_VALIDATION")||t.every(function(t){return me("ALLOW_HOPPER_ITEM",t,{query:e.query}).every(function(e){return!0===e})&&n(t)})},{filterItems:function(t){var n=e.query("GET_IGNORED_FILES");return t.filter(function(e){return!vt(e)||!n.includes(e.name.toLowerCase())})},catchesDropsOnPage:e.query("GET_DROP_ON_PAGE"),requiresDropOnElement:e.query("GET_DROP_ON_ELEMENT")});o.onload=function(t,n){var r=e.ref.list.childViews[0].childViews.filter(function(e){return e.rect.element.height}),o=e.query("GET_ACTIVE_ITEMS").map(function(e){return r.find(function(t){return t.id===e.id})}).filter(function(e){return e});e.dispatch("ADD_ITEMS",{items:t,index:xr(e.ref.list,o,n),interactionMethod:ne}),e.dispatch("DID_DROP",{position:n}),e.dispatch("DID_END_DRAG",{position:n})},o.ondragstart=function(t){e.dispatch("DID_START_DRAG",{position:t})},o.ondrag=Gr(function(t){e.dispatch("DID_DRAG",{position:t})}),o.ondragend=function(t){e.dispatch("DID_END_DRAG",{position:t})},e.ref.hopper=o,e.ref.drip=e.appendChildView(e.createChildView(xn))}else!r&&e.ref.hopper&&(e.ref.hopper.destroy(),e.ref.hopper=null,e.removeChildView(e.ref.drip))},kr=function(e,t){var n=e.query("GET_ALLOW_BROWSE"),r=e.query("GET_DISABLED"),o=n&&!r;o&&!e.ref.browser?e.ref.browser=e.appendChildView(e.createChildView(Nn,Object.assign({},t,{onload:function(t){if(Fr(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:re})}})),0):!o&&e.ref.browser&&(e.removeChildView(e.ref.browser),e.ref.browser=null)},jr=function(e){var t=e.query("GET_ALLOW_PASTE"),n=e.query("GET_DISABLED"),r=t&&!n;r&&!e.ref.paster?(e.ref.paster=Dr(),e.ref.paster.onload=function(t){e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:oe})}):!r&&e.ref.paster&&(e.ref.paster.destroy(),e.ref.paster=null)},Hr=b({DID_SET_ALLOW_BROWSE:function(e){var t=e.root,n=e.props;kr(t,n)},DID_SET_ALLOW_DROP:function(e){var t=e.root;Yr(t)},DID_SET_ALLOW_PASTE:function(e){var t=e.root;jr(t)},DID_SET_DISABLED:function(e){var t=e.root,n=e.props;Yr(t),jr(t),kr(t,n),t.query("GET_DISABLED")?t.element.dataset.disabled="disabled":t.element.removeAttribute("data-disabled")}}),Xr=L({name:"root",read:function(e){var t=e.root;t.ref.measure&&(t.ref.measureHeight=t.ref.measure.offsetHeight)},create:function(e){var t=e.root,n=e.props,r=t.query("GET_ID");r&&(t.element.id=r);var o=t.query("GET_CLASS_NAME");o&&o.split(" ").filter(function(e){return e.length}).forEach(function(e){t.element.classList.add(e)}),t.ref.label=t.appendChildView(t.createChildView(qn,Object.assign({},n,{translateY:null,caption:t.query("GET_LABEL_IDLE")}))),t.ref.list=t.appendChildView(t.createChildView(yn,{translateY:null})),t.ref.panel=t.appendChildView(t.createChildView(dn,{name:"panel-root"})),t.ref.assistant=t.appendChildView(t.createChildView(Cr,Object.assign({},n))),t.ref.data=t.appendChildView(t.createChildView(Hn,Object.assign({},n))),t.ref.measure=bt("div"),t.ref.measure.style.height="100%",t.element.appendChild(t.ref.measure),t.ref.bounds=null,t.query("GET_STYLES").filter(function(e){return!C(e.value)}).map(function(e){var n=e.name,r=e.value;t.element.dataset[n]=r}),t.ref.widthPrevious=null,t.ref.widthUpdated=Gr(function(){t.ref.updateHistory=[],t.dispatch("DID_RESIZE_ROOT")},250),t.ref.previousAspectRatio=null,t.ref.updateHistory=[];var i=window.matchMedia("(pointer: fine) and (hover: hover)").matches,a="PointerEvent"in window;t.query("GET_ALLOW_REORDER")&&a&&!i&&(t.element.addEventListener("touchmove",Ur,{passive:!1}),t.element.addEventListener("gesturestart",Ur))},write:function(e){var t=e.root,n=e.props,r=e.actions;if(Hr({root:t,props:n,actions:r}),r.filter(function(e){return/^DID_SET_STYLE_/.test(e.type)}).filter(function(e){return!C(e.data.value)}).map(function(e){var n=e.type,r=e.data,o=Nr(n.substr(8).toLowerCase(),"_");t.element.dataset[o]=r.value,t.invalidateLayout()}),!t.rect.element.hidden){t.rect.element.width!==t.ref.widthPrevious&&(t.ref.widthPrevious=t.rect.element.width,t.ref.widthUpdated());var o=t.ref.bounds;o||(o=t.ref.bounds=Vr(t),t.element.removeChild(t.ref.measure),t.ref.measure=null);var i=t.ref,a=i.hopper,u=i.label,s=i.list,l=i.panel;a&&a.updateHopperState();var c=t.query("GET_PANEL_ASPECT_RATIO"),f=t.query("GET_ALLOW_MULTIPLE"),d=t.query("GET_TOTAL_ITEMS"),p=d===(f?t.query("GET_MAX_FILES")||1e6:1),E=r.find(function(e){return"DID_ADD_ITEM"===e.type});if(p&&E){var _=E.data.interactionMethod;u.opacity=0,f?u.translateY=-40:_===te?u.translateX=40:u.translateY=_===re?40:30}else p||(u.opacity=1,u.translateX=0,u.translateY=0);var T=Br(t),v=qr(t),I=u.rect.element.height,m=!f||p?0:I,g=p?s.rect.element.marginTop:0,h=0===d?0:s.rect.element.marginBottom,R=m+g+v.visual+h,O=m+g+v.bounds+h;if(s.translateY=Math.max(0,m-s.rect.element.marginTop)-T.top,c){var D=t.rect.element.width,y=D*c;c!==t.ref.previousAspectRatio&&(t.ref.previousAspectRatio=c,t.ref.updateHistory=[]);var S=t.ref.updateHistory;if(S.push(D),S.length>4)for(var A=S.length,L=A-10,b=0,P=A;P>=L;P--)if(S[P]===S[P-2]&&b++,b>=2)return;l.scalable=!1,l.height=y;var M=y-m-(h-T.bottom)-(p?g:0);v.visual>M?s.overflow=M:s.overflow=null,t.height=y}else if(o.fixedHeight){l.scalable=!1;var w=o.fixedHeight-m-(h-T.bottom)-(p?g:0);v.visual>w?s.overflow=w:s.overflow=null}else if(o.cappedHeight){var N=R>=o.cappedHeight,G=Math.min(o.cappedHeight,R);l.scalable=!0,l.height=N?G:G-T.top-T.bottom;var U=G-m-(h-T.bottom)-(p?g:0);R>o.cappedHeight&&v.visual>U?s.overflow=U:s.overflow=null,t.height=Math.min(o.cappedHeight,O-T.top-T.bottom)}else{var B=d>0?T.top+T.bottom:0;l.scalable=!0,l.height=Math.max(I,R-B),t.height=Math.max(I,O-B)}}},destroy:function(e){var t=e.root;t.ref.paster&&t.ref.paster.destroy(),t.ref.hopper&&t.ref.hopper.destroy(),t.element.removeEventListener("touchmove",Ur),t.element.removeEventListener("gesturestart",Ur)},mixins:{styles:["height"]}}),zr=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=null,n=he(),i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=Object.assign({},e),o=[],i=[],a=function(e,t,n){n?i.push({type:e,data:t}):(c[e]&&c[e](t),o.push({type:e,data:t}))},u=function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(n,r){O([{source:e,options:t}],{index:t.index}).then(function(e){return n(e&&e[0])}).catch(r)})},addFiles:O,getFile:function(e){return i.query("GET_ACTIVE_ITEM",e)},processFile:y,prepareFile:h,removeFile:R,moveFile:function(e,t){return i.dispatch("MOVE_ITEM",{query:e,index:t})},getFiles:D,processFiles:function(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t={};return r(he(),function(e,n){t[e]=n[0]}),zr(Object.assign({},t,{},e))},Qr=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[];r(e.attributes,function(t){n.push(e.attributes[t])});var o=n.filter(function(e){return e.name}).reduce(function(t,n){var r,o=i(e,n.name);return t[(r=n.name,Nr(r.replace(/^data-/,"")))]=o===n.name||o,t},{});return function e(t,n){r(n,function(n,o){r(t,function(e,r){var i=new RegExp(n);if(i.test(e)&&(delete t[e],!1!==o))if(q(o))t[o]=r;else{var a,u=o.group;z(o)&&!t[u]&&(t[u]={}),t[u][(a=e.replace(i,""),a.charAt(0).toLowerCase()+a.slice(1))]=r}}),o.mapping&&e(t[o.group],o.mapping)})}(o,t),o},$r=function(){return(arguments.length<=0?void 0:arguments[0])instanceof HTMLElement?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={"^class$":"className","^multiple$":"allowMultiple","^capture$":"captureMethod","^webkitdirectory$":"allowDirectoriesOnly","^server":{group:"server",mapping:{"^process":{group:"process"},"^revert":{group:"revert"},"^fetch":{group:"fetch"},"^restore":{group:"restore"},"^load":{group:"load"}}},"^type$":!1,"^files$":!1};me("SET_ATTRIBUTE_TO_OPTION_MAP",n);var r=Object.assign({},t),o=Qr("FIELDSET"===e.nodeName?e.querySelector("input[type=file]"):e,n);Object.keys(o).forEach(function(e){z(o[e])?(z(r[e])||(r[e]={}),Object.assign(r[e],o[e])):r[e]=o[e]}),r.files=(t.files||[]).concat(Array.from(e.querySelectorAll("input:not([type=file])")).map(function(e){return{source:e.value,options:{type:e.dataset.type}}}));var i=Wr(r);return e.files&&Array.from(e.files).forEach(function(e){i.addFile(e)}),i.replaceElement(e),i}.apply(void 0,arguments):Wr.apply(void 0,arguments)},Zr=["fire","_read","_write"],Kr=function(e){var t={};return le(e,t,Zr),t},Jr=function(e,t){return e.replace(/(?:{([a-zA-Z]+)})/g,function(e,n){return t[n]})},eo=function(e){var t=new Blob(["(",e.toString(),")()"],{type:"application/javascript"}),n=URL.createObjectURL(t),r=new Worker(n);return{transfer:function(e,t){},post:function(e,t,n){var o=ae();r.onmessage=function(e){e.data.id===o&&t(e.data.message)},r.postMessage({id:o,message:e},n)},terminate:function(){r.terminate(),URL.revokeObjectURL(n)}}},to=function(e){return new Promise(function(t,n){var r=new Image;r.onload=function(){t(r)},r.onerror=function(e){n(e)},r.src=e})},no=function(e,t){var n=e.slice(0,e.size,e.type);return n.lastModifiedDate=e.lastModifiedDate,n.name=t,n},ro=function(e){return no(e,e.name)},oo=[],io=function(e){if(!oo.includes(e)){oo.push(e);var t,n=e({addFilter:ge,utils:{Type:Te,forin:r,isString:q,isFile:vt,toNaturalFileSize:Gt,replaceInString:Jr,getExtensionFromFilename:Be,getFilenameWithoutExtension:Tt,guesstimateMimeType:Qn,getFileFromBlob:Fe,getFilenameFromURL:Ue,createRoute:b,createWorker:eo,createView:L,createItemAPI:fe,loadImage:to,copyFile:ro,renameFile:no,createBlob:xe,applyFilterChain:Ie,text:Pt,getNumericAspectRatioFromString:De},views:{fileActionButton:Nt}});t=n.options,Object.assign(Re,t)}},ao=($t=d()&&!("[object OperaMini]"===Object.prototype.toString.call(window.operamini))&&"visibilityState"in document&&"Promise"in window&&"slice"in Blob.prototype&&"URL"in window&&"createObjectURL"in window.URL&&"performance"in window,function(){return $t}),uo={apps:[]},so=function(){};if(e.Status={},e.FileStatus={},e.FileOrigin={},e.OptionTypes={},e.create=so,e.destroy=so,e.parse=so,e.find=so,e.registerPlugin=so,e.getOptions=so,e.setOptions=so,ao()){!function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:60,r="__framePainter";if(window[r])return window[r].readers.push(e),void window[r].writers.push(t);window[r]={readers:[e],writers:[t]};var o=window[r],i=1e3/n,a=null,u=null,s=null,l=null,c=function(){document.hidden?(s=function(){return window.setTimeout(function(){return f(performance.now())},i)},l=function(){return window.clearTimeout(u)}):(s=function(){return window.requestAnimationFrame(f)},l=function(){return window.cancelAnimationFrame(u)})};document.addEventListener("visibilitychange",function(){l&&l(),c(),f(performance.now())});var f=function e(t){u=s(e),a||(a=t);var n=t-a;n<=i||(a=t-n%i,o.readers.forEach(function(e){return e()}),o.writers.forEach(function(e){return e(t)}))};c(),f(performance.now())}(function(){uo.apps.forEach(function(e){return e._read()})},function(e){uo.apps.forEach(function(t){return t._write(e)})});var lo=function t(){document.dispatchEvent(new CustomEvent("FilePond:loaded",{detail:{supported:ao,create:e.create,destroy:e.destroy,parse:e.parse,find:e.find,registerPlugin:e.registerPlugin,setOptions:e.setOptions}})),document.removeEventListener("DOMContentLoaded",t)};"loading"!==document.readyState?setTimeout(function(){return lo()},0):document.addEventListener("DOMContentLoaded",lo);var co=function(){return r(he(),function(t,n){e.OptionTypes[t]=n[1]})};e.Status=Object.assign({},Se),e.FileOrigin=Object.assign({},pe),e.FileStatus=Object.assign({},de),e.OptionTypes={},co(),e.create=function(){var t=$r.apply(void 0,arguments);return t.on("destroy",e.destroy),uo.apps.push(t),Kr(t)},e.destroy=function(e){var t=uo.apps.findIndex(function(t){return t.isAttachedTo(e)});return t>=0&&(uo.apps.splice(t,1)[0].restoreElement(),!0)},e.parse=function(t){return Array.from(t.querySelectorAll(".filepond")).filter(function(e){return!uo.apps.find(function(t){return t.isAttachedTo(e)})}).map(function(t){return e.create(t)})},e.find=function(e){var t=uo.apps.find(function(t){return t.isAttachedTo(e)});return t?Kr(t):null},e.registerPlugin=function(){for(var e=arguments.length,t=new Array(e),n=0;n2&&void 0!==arguments[2]?arguments[2]:null;if(null===n)return e.getAttribute(t)||e.hasAttribute(t);e.setAttribute(t,n)},a=["svg","path"],u=function(e){return a.includes(e)},s=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"object"==typeof t&&(n=t,t=null);var o=u(e)?document.createElementNS("http://www.w3.org/2000/svg",e):document.createElement(e);return t&&(u(e)?i(o,"class",t):o.className=t),r(n,function(e,t){i(o,e,t)}),o},l=function(e,t){return function(e,n){return void 0!==n?t.splice(n,0,e):t.push(e),e}},c=function(e,t){return function(n){return t.splice(t.indexOf(n),1),n.element.parentNode&&e.removeChild(n.element),n}},f="undefined"!=typeof window&&void 0!==window.document,d=function(){return f},p="children"in(d()?s("svg"):{})?function(e){return e.children.length}:function(e){return e.childNodes.length},E=function(e,t,n,r){var o=n[0]||e.left,i=n[1]||e.top,a=o+e.width,u=i+e.height*(r[1]||1),s={element:Object.assign({},e),inner:{left:e.left,top:e.top,right:e.right,bottom:e.bottom},outer:{left:o,top:i,right:a,bottom:u}};return t.filter(function(e){return!e.isRectIgnored()}).map(function(e){return e.rect}).forEach(function(e){_(s.inner,Object.assign({},e.inner)),_(s.outer,Object.assign({},e.outer))}),T(s.inner),s.outer.bottom+=s.element.marginBottom,s.outer.right+=s.element.marginRight,T(s.outer),s},_=function(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)},T=function(e){e.width=e.right-e.left,e.height=e.bottom-e.top},I=function(e){return"number"==typeof e},v=function(e){return e<.5?2*e*e:(4-2*e)*e-1},m={spring:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.stiffness,n=void 0===t?.5:t,r=e.damping,i=void 0===r?.75:r,a=e.mass,u=void 0===a?10:a,s=null,l=null,c=0,f=!1,d=o({interpolate:function(e,t){if(!f){if(!I(s)||!I(l))return f=!0,void(c=0);(function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.001;return Math.abs(e-t)0&&void 0!==arguments[0]?arguments[0]:{},r=n.duration,i=void 0===r?500:r,a=n.easing,u=void 0===a?v:a,s=n.delay,l=void 0===s?0:s,c=null,f=!0,d=!1,p=null,E=o({interpolate:function(n,r){f||null===p||(null===c&&(c=n),n-c=i||r?(e=1,t=d?0:1,E.onupdate(t*p),E.oncomplete(t*p),f=!0):(t=e/i,E.onupdate((e>=0?u(d?1-t:t):0)*p))))},target:{get:function(){return d?0:p},set:function(e){if(null===p)return p=e,E.onupdate(e),void E.oncomplete(e);e3&&void 0!==arguments[3]&&arguments[3];(t=Array.isArray(t)?t:[t]).forEach(function(t){e.forEach(function(e){var o=e,i=function(){return n[e]},a=function(t){return n[e]=t};"object"==typeof e&&(o=e.key,i=e.getter||i,a=e.setter||a),t[o]&&!r||(t[o]={get:i,set:a})})})},R=function(e){return null!=e},O={opacity:1,scaleX:1,scaleY:1,translateX:0,translateY:0,rotateX:0,rotateY:0,rotateZ:0,originX:0,originY:0},D=function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!0;for(var n in t)if(t[n]!==e[n])return!0;return!1},y=function(e,t){var n=t.opacity,r=t.perspective,o=t.translateX,i=t.translateY,a=t.scaleX,u=t.scaleY,s=t.rotateX,l=t.rotateY,c=t.rotateZ,f=t.originX,d=t.originY,p=t.width,E=t.height,_="",T="";(R(f)||R(d))&&(T+="transform-origin: "+(f||0)+"px "+(d||0)+"px;"),R(r)&&(_+="perspective("+r+"px) "),(R(o)||R(i))&&(_+="translate3d("+(o||0)+"px, "+(i||0)+"px, 0) "),(R(a)||R(u))&&(_+="scale3d("+(R(a)?a:1)+", "+(R(u)?u:1)+", 1) "),R(c)&&(_+="rotateZ("+c+"rad) "),R(s)&&(_+="rotateX("+s+"rad) "),R(l)&&(_+="rotateY("+l+"rad) "),_.length&&(T+="transform:"+_+";"),R(n)&&(T+="opacity:"+n+";",0===n&&(T+="visibility:hidden;"),n<1&&(T+="pointer-events:none;")),R(E)&&(T+="height:"+E+"px;"),R(p)&&(T+="width:"+p+"px;");var I=e.elementCurrentStyle||"";T.length===I.length&&T===I||(e.style.cssText=T,e.elementCurrentStyle=T)},S={styles:function(e){var t=e.mixinConfig,n=e.viewProps,r=e.viewInternalAPI,o=e.viewExternalAPI,i=e.view,a=Object.assign({},n),u={};h(t,[r,o],n);var s=function(){return i.rect?E(i.rect,i.childViews,[n.translateX||0,n.translateY||0],[n.scaleX||0,n.scaleY||0]):null};return r.rect={get:s},o.rect={get:s},t.forEach(function(e){n[e]=void 0===a[e]?O[e]:a[e]}),{write:function(){if(D(u,n))return y(i.element,n),Object.assign(u,Object.assign({},n)),!0},destroy:function(){}}},listeners:function(e){e.mixinConfig,e.viewProps,e.viewInternalAPI;var t,n=e.viewExternalAPI,r=(e.viewState,e.view),o=[],i=(t=r.element,function(e,n){t.addEventListener(e,n)}),a=function(e){return function(t,n){e.removeEventListener(t,n)}}(r.element);return n.on=function(e,t){o.push({type:e,fn:t}),i(e,t)},n.off=function(e,t){o.splice(o.findIndex(function(n){return n.type===e&&n.fn===t}),1),a(e,t)},{write:function(){return!0},destroy:function(){o.forEach(function(e){a(e.type,e.fn)})}}},animations:function(e){var t=e.mixinConfig,n=e.viewProps,o=e.viewInternalAPI,i=e.viewExternalAPI,a=Object.assign({},n),u=[];return r(t,function(e,t){var r=g(t);r&&(r.onupdate=function(t){n[e]=t},r.target=a[e],h([{key:e,setter:function(e){r.target!==e&&(r.target=e)},getter:function(){return n[e]}}],[o,i],n,!0),u.push(r))}),{write:function(e){var t=document.hidden,n=!0;return u.forEach(function(r){r.resting||(n=!1),r.interpolate(e,t)}),n},destroy:function(){}}},apis:function(e){var t=e.mixinConfig,n=e.viewProps,r=e.viewExternalAPI;h(t,r,n)}},A=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return 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=null===t.offsetParent,e},L=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.tag,n=void 0===t?"div":t,r=e.name,i=void 0===r?null:r,a=e.attributes,u=void 0===a?{}:a,f=e.read,d=void 0===f?function(){}:f,_=e.write,T=void 0===_?function(){}:_,I=e.create,v=void 0===I?function(){}:I,m=e.destroy,g=void 0===m?function(){}:m,h=e.filterFrameActionsForChild,R=void 0===h?function(e,t){return t}:h,O=e.didCreateView,D=void 0===O?function(){}:O,y=e.didWriteView,L=void 0===y?function(){}:y,b=e.ignoreRect,P=void 0!==b&&b,M=e.ignoreRectUpdate,w=void 0!==M&&M,C=e.mixins,N=void 0===C?[]:C;return function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=s(n,"filepond--"+i,u),f=window.getComputedStyle(a,null),_=A(),I=null,m=!1,h=[],O=[],y={},b={},M=[T],C=[d],G=[g],U=function(){return a},B=function(){return h.concat()},q=function(){return I||(I=E(_,h,[0,0],[1,1]))},V={element:{get:U},style:{get:function(){return f}},childViews:{get:B}},F=Object.assign({},V,{rect:{get:q},ref:{get:function(){return y}},is:function(e){return i===e},appendChild:(t=a,function(e,n){void 0!==n&&t.children[n]?t.insertBefore(e,t.children[n]):t.appendChild(e)}),createChildView:function(e){return function(t,n){return t(e,n)}}(e),linkView:function(e){return h.push(e),e},unlinkView:function(e){h.splice(h.indexOf(e),1)},appendChildView:l(0,h),removeChildView:c(a,h),registerWriter:function(e){return M.push(e)},registerReader:function(e){return C.push(e)},registerDestroyer:function(e){return G.push(e)},invalidateLayout:function(){return a.layoutCalculated=!1},dispatch:e.dispatch,query:e.query}),x={element:{get:U},childViews:{get:B},rect:{get:q},resting:{get:function(){return m}},isRectIgnored:function(){return P},_read:function(){I=null,h.forEach(function(e){return e._read()}),!(w&&_.width&&_.height)&&A(_,a,f);var e={root:k,props:r,rect:_};C.forEach(function(t){return t(e)})},_write:function(e,t,n){var o=0===t.length;return M.forEach(function(i){!1===i({props:r,root:k,actions:t,timestamp:e,shouldOptimize:n})&&(o=!1)}),O.forEach(function(t){!1===t.write(e)&&(o=!1)}),h.filter(function(e){return!!e.element.parentNode}).forEach(function(r){r._write(e,R(r,t),n)||(o=!1)}),h.forEach(function(r,i){r.element.parentNode||(k.appendChild(r.element,i),r._read(),r._write(e,R(r,t),n),o=!1)}),m=o,L({props:r,root:k,actions:t,timestamp:e}),o},_destroy:function(){O.forEach(function(e){return e.destroy()}),G.forEach(function(e){e({root:k,props:r})}),h.forEach(function(e){return e._destroy()})}},Y=Object.assign({},V,{rect:{get:function(){return _}}});Object.keys(N).sort(function(e,t){return"styles"===e?1:"styles"===t?-1:0}).forEach(function(e){var t=S[e]({mixinConfig:N[e],viewProps:r,viewState:b,viewInternalAPI:F,viewExternalAPI:x,view:o(Y)});t&&O.push(t)});var k=o(F);v({root:k,props:r});var j=p(a);return h.forEach(function(e,t){k.appendChild(e.element,j+t)}),D(k),o(x)}},b=function(e,t){return function(n){var r=n.root,o=n.props,i=n.actions,a=void 0===i?[]:i,u=n.timestamp,s=n.shouldOptimize;a.filter(function(t){return e[t.type]}).forEach(function(t){return e[t.type]({root:r,props:o,action:t.data,timestamp:u,shouldOptimize:s})}),t&&t({root:r,props:o,actions:a,timestamp:u,shouldOptimize:s})}},P=function(e,t){return t.parentNode.insertBefore(e,t)},M=function(e,t){return t.parentNode.insertBefore(e,t.nextSibling)},w=function(e){return Array.isArray(e)},C=function(e){return null==e},N=function(e){return e.trim()},G=function(e){return""+e},U=function(e){return"boolean"==typeof e},B=function(e){return U(e)?e:"true"===e},q=function(e){return"string"==typeof e},V=function(e){return I(e)?e:q(e)?G(e).replace(/[a-z]+/gi,""):0},F=function(e){return parseInt(V(e),10)},x=function(e){return parseFloat(V(e))},Y=function(e){return I(e)&&isFinite(e)&&Math.floor(e)===e},k=function(e){if(Y(e))return e;var t=G(e).trim();return/MB$/i.test(t)?(t=t.replace(/MB$i/,"").trim(),1e3*F(t)*1e3):/KB/i.test(t)?(t=t.replace(/KB$i/,"").trim(),1e3*F(t)):F(t)},j=function(e){return"function"==typeof e},H={process:"POST",patch:"PATCH",revert:"DELETE",fetch:"GET",restore:"GET",load:"GET"},X=function(e,t,n,r,o){if(null===t)return null;if("function"==typeof t)return t;var i={url:"GET"===n||"PATCH"===n?"?"+e+"=":"",method:n,headers:o,withCredentials:!1,timeout:r,onload:null,ondata:null,onerror:null};if(q(t))return i.url=t,i;if(Object.assign(i,t),q(i.headers)){var a=i.headers.split(/:(.+)/);i.headers={header:a[0],value:a[1]}}return i.withCredentials=B(i.withCredentials),i},z=function(e){return"object"==typeof e&&null!==e},W=function(e){return w(e)?"array":function(e){return null===e}(e)?"null":Y(e)?"int":/^[0-9]+ ?(?:GB|MB|KB)$/gi.test(e)?"bytes":function(e){return z(e)&&q(e.url)&&z(e.process)&&z(e.revert)&&z(e.restore)&&z(e.fetch)}(e)?"api":typeof e},Q={array:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return C(e)?[]:w(e)?e:G(e).split(t).map(N).filter(function(e){return e.length})},boolean:B,int:function(e){return"bytes"===W(e)?k(e):F(e)},number:x,float:x,bytes:k,string:function(e){return j(e)?e:G(e)},function:function(e){return function(e){for(var t=self,n=e.split("."),r=null;r=n.shift();)if(!(t=t[r]))return null;return t}(e)},serverapi:function(e){return(n={}).url=q(t=e)?t:t.url||"",n.timeout=t.timeout?parseInt(t.timeout,10):0,n.headers=t.headers?t.headers:{},r(H,function(e){n[e]=X(e,t[e],H[e],n.timeout,n.headers)}),n.remove=t.remove||null,delete n.headers,n;var t,n},object:function(e){try{return JSON.parse(e.replace(/{\s*'/g,'{"').replace(/'\s*}/g,'"}').replace(/'\s*:/g,'":').replace(/:\s*'/g,':"').replace(/,\s*'/g,',"').replace(/'\s*,/g,'",'))}catch(e){return null}}},$=function(e,t,n){if(e===t)return e;var r,o=W(e);if(o!==n){var i=(r=e,Q[n](r));if(o=W(i),null===i)throw'Trying to assign value with incorrect type to "'+option+'", allowed type: "'+n+'"';e=i}return e},Z=function(e){var t={};return r(e,function(n){var r,o,i,a=e[n];t[n]=(r=a[0],o=a[1],i=r,{enumerable:!0,get:function(){return i},set:function(e){i=$(e,r,o)}})}),o(t)},K=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";return e.split(/(?=[A-Z])/).map(function(e){return e.toLowerCase()}).join(t)},J=function(e){return function(t,n,o){var i={};return r(e,function(e){var n=K(e,"_").toUpperCase();i["SET_"+n]=function(r){try{o.options[e]=r.value}catch(e){}t("DID_SET_"+n,{value:o.options[e]})}}),i}},ee=function(e){return function(t){var n={};return r(e,function(e){n["GET_"+K(e,"_").toUpperCase()]=function(n){return t.options[e]}}),n}},te=1,ne=2,re=3,oe=4,ie=5,ae=function(){return Math.random().toString(36).substr(2,9)},ue=function(e,t){return e.splice(t,1)},se=function(){var e=[],t=function(t,n){ue(e,e.findIndex(function(e){return e.event===t&&(e.cb===n||!n)}))};return{fire:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;oBrowse',Te.STRING],labelInvalidField:["Field contains invalid files",Te.STRING],labelFileWaitingForSize:["Waiting for size",Te.STRING],labelFileSizeNotAvailable:["Size not available",Te.STRING],labelFileCountSingular:["file in list",Te.STRING],labelFileCountPlural:["files in list",Te.STRING],labelFileLoading:["Loading",Te.STRING],labelFileAdded:["Added",Te.STRING],labelFileLoadError:["Error during load",Te.STRING],labelFileRemoved:["Removed",Te.STRING],labelFileRemoveError:["Error during remove",Te.STRING],labelFileProcessing:["Uploading",Te.STRING],labelFileProcessingComplete:["Upload complete",Te.STRING],labelFileProcessingAborted:["Upload cancelled",Te.STRING],labelFileProcessingError:["Error during upload",Te.STRING],labelFileProcessingRevertError:["Error during revert",Te.STRING],labelTapToCancel:["tap to cancel",Te.STRING],labelTapToRetry:["tap to retry",Te.STRING],labelTapToUndo:["tap to undo",Te.STRING],labelButtonRemoveItem:["Remove",Te.STRING],labelButtonAbortItemLoad:["Abort",Te.STRING],labelButtonRetryItemLoad:["Retry",Te.STRING],labelButtonAbortItemProcessing:["Cancel",Te.STRING],labelButtonUndoItemProcessing:["Undo",Te.STRING],labelButtonRetryItemProcessing:["Retry",Te.STRING],labelButtonProcessItem:["Upload",Te.STRING],iconRemove:['',Te.STRING],iconProcess:['',Te.STRING],iconRetry:['',Te.STRING],iconUndo:['',Te.STRING],iconDone:['',Te.STRING],oninit:[null,Te.FUNCTION],onwarning:[null,Te.FUNCTION],onerror:[null,Te.FUNCTION],onactivatefile:[null,Te.FUNCTION],onaddfilestart:[null,Te.FUNCTION],onaddfileprogress:[null,Te.FUNCTION],onaddfile:[null,Te.FUNCTION],onprocessfilestart:[null,Te.FUNCTION],onprocessfileprogress:[null,Te.FUNCTION],onprocessfileabort:[null,Te.FUNCTION],onprocessfilerevert:[null,Te.FUNCTION],onprocessfile:[null,Te.FUNCTION],onprocessfiles:[null,Te.FUNCTION],onremovefile:[null,Te.FUNCTION],onpreparefile:[null,Te.FUNCTION],onupdatefiles:[null,Te.FUNCTION],onreorderfiles:[null,Te.FUNCTION],beforeDropFile:[null,Te.FUNCTION],beforeAddFile:[null,Te.FUNCTION],beforeRemoveFile:[null,Te.FUNCTION],stylePanelLayout:[null,Te.STRING],stylePanelAspectRatio:[null,Te.STRING],styleItemPanelAspectRatio:[null,Te.STRING],styleButtonRemoveItemPosition:["left",Te.STRING],styleButtonProcessItemPosition:["right",Te.STRING],styleLoadIndicatorPosition:["right",Te.STRING],styleProgressIndicatorPosition:["right",Te.STRING],styleButtonRemoveItemAlign:[!1,Te.BOOLEAN],files:[[],Te.ARRAY]},Oe=function(e,t){return C(t)?e[0]||null:Y(t)?e[t]||null:("object"==typeof t&&(t=t.id),e.find(function(e){return e.id===t})||null)},De=function(e){if(C(e))return e;if(/:/.test(e)){var t=e.split(":");return t[1]/t[0]}return parseFloat(e)},ye=function(e){return e.filter(function(e){return!e.archived})},Se={EMPTY:0,IDLE:1,ERROR:2,BUSY:3,READY:4},Ae=[de.LOAD_ERROR,de.PROCESSING_ERROR,de.PROCESSING_REVERT_ERROR],Le=[de.LOADING,de.PROCESSING,de.PROCESSING_QUEUED,de.INIT],be=[de.PROCESSING_COMPLETE],Pe=function(e){return Ae.includes(e.status)},Me=function(e){return Le.includes(e.status)},we=function(e){return be.includes(e.status)},Ce=function(e){return{GET_STATUS:function(){var t=ye(e.items),n=Se.EMPTY,r=Se.ERROR,o=Se.BUSY,i=Se.IDLE,a=Se.READY;return 0===t.length?n:t.some(Pe)?r:t.some(Me)?o:t.some(we)?a:i},GET_ITEM:function(t){return Oe(e.items,t)},GET_ACTIVE_ITEM:function(t){return Oe(ye(e.items),t)},GET_ACTIVE_ITEMS:function(){return ye(e.items)},GET_ITEMS:function(){return e.items},GET_ITEM_NAME:function(t){var n=Oe(e.items,t);return n?n.filename:null},GET_ITEM_SIZE:function(t){var n=Oe(e.items,t);return n?n.fileSize:null},GET_STYLES:function(){return Object.keys(e.options).filter(function(e){return/^style/.test(e)}).map(function(t){return{name:t,value:e.options[t]}})},GET_PANEL_ASPECT_RATIO:function(){return/circle/.test(e.options.stylePanelLayout)?1:De(e.options.stylePanelAspectRatio)},GET_ITEM_PANEL_ASPECT_RATIO:function(){return e.options.styleItemPanelAspectRatio},GET_ITEMS_BY_STATUS:function(t){return ye(e.items).filter(function(e){return e.status===t})},GET_TOTAL_ITEMS:function(){return ye(e.items).length},IS_ASYNC:function(){return z(e.options.server)&&(z(e.options.server.process)||j(e.options.server.process))}}},Ne=function(e,t,n){return Math.max(Math.min(n,e),t)},Ge=function(e){return/^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i.test(e)},Ue=function(e){return e.split("/").pop().split("?").shift()},Be=function(e){return e.split(".").pop()},qe=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return(t+e).slice(-t.length)},Ve=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date;return e.getFullYear()+"-"+qe(e.getMonth()+1,"00")+"-"+qe(e.getDate(),"00")+"_"+qe(e.getHours(),"00")+"-"+qe(e.getMinutes(),"00")+"-"+qe(e.getSeconds(),"00")},Fe=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o="string"==typeof n?e.slice(0,e.size,n):e.slice(0,e.size,e.type);return o.lastModifiedDate=new Date,e._relativePath&&(o._relativePath=e._relativePath),q(t)||(t=Ve()),t&&null===r&&Be(t)?o.name=t:(r=r||function(e){if("string"!=typeof e)return"";var 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)?"jpeg"===t?"jpg":t:""}(o.type),o.name=t+(r?"."+r:"")),o},xe=function(e,t){var n=window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;if(n){var r=new n;return r.append(e),r.getBlob(t)}return new Blob([e],{type:t})},Ye=function(e){return(/^data:(.+);/.exec(e)||[])[1]||null},ke=function(e){var t=Ye(e);return function(e,t){for(var n=new ArrayBuffer(e.length),r=new Uint8Array(n),o=0;o=200&&a.status<300?r.onload(a):r.onerror(a)},a.onerror=function(){return r.onerror(a)},a.onabort=function(){o=!0,r.onabort()},a.ontimeout=function(){return r.ontimeout(a)},a.open(n.method,t,!0),Y(n.timeout)&&(a.timeout=n.timeout),Object.keys(n.headers).forEach(function(e){var t=unescape(encodeURIComponent(n.headers[e]));a.setRequestHeader(e,t)}),n.responseType&&(a.responseType=n.responseType),n.withCredentials&&(a.withCredentials=!0),a.send(e),r},Ze=function(e,t,n,r){return{type:e,code:t,body:n,headers:r}},Ke=function(e){return function(t){e(Ze("error",0,"Timeout",t.getAllResponseHeaders()))}},Je=function(e){return/\?/.test(e)},et=function(){for(var e="",t=arguments.length,n=new Array(t),r=0;r0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if("function"==typeof t)return t;if(!t||!q(t.url))return null;var n=t.onload||function(e){return e},r=t.onerror||function(e){return null};return function(o,i,a,u,s,l){var c=$e(o,et(e,t.url),Object.assign({},t,{responseType:"blob"}));return c.onload=function(e){var r=e.getAllResponseHeaders(),a=ze(r).name||Ue(o);i(Ze("load",e.status,"HEAD"===t.method?null:Fe(n(e.response),a),r))},c.onerror=function(e){a(Ze("error",e.status,r(e.response)||e.statusText,e.getAllResponseHeaders()))},c.onheaders=function(e){l(Ze("headers",e.status,null,e.getAllResponseHeaders()))},c.ontimeout=Ke(a),c.onprogress=u,c.onabort=s,c}};function nt(e){this.wrapped=e}function rt(e){var t,n;function r(t,n){try{var i=e[t](n),a=i.value,u=a instanceof nt;Promise.resolve(u?a.wrapped:a).then(function(e){u?r("next",e):o(i.done?"return":"normal",e)},function(e){r("throw",e)})}catch(e){o("throw",e)}}function o(e,o){switch(e){case"return":t.resolve({value:o,done:!0});break;case"throw":t.reject(o);break;default:t.resolve({value:o,done:!1})}(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,o){return new Promise(function(i,a){var u={key:e,arg:o,resolve:i,reject:a,next:null};n?n=n.next=u:(t=n=u,r(e,o))})},"function"!=typeof e.return&&(this.return=void 0)}"function"==typeof Symbol&&Symbol.asyncIterator&&(rt.prototype[Symbol.asyncIterator]=function(){return this}),rt.prototype.next=function(e){return this._invoke("next",e)},rt.prototype.throw=function(e){return this._invoke("throw",e)},rt.prototype.return=function(e){return this._invoke("return",e)};function ot(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t=1||b()};return T.serverId?(D=function(e){T.aborted||(f.filter(function(t){return t.offset0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;return"function"==typeof t?function(){for(var e=arguments.length,o=new Array(e),i=0;ir.chunkSize,p=f&&(d||r.chunkForce);if(o instanceof Blob&&p)return ft(e,t,n,o,i,a,u,s,l,c,r);var E=t.ondata||function(e){return e},_=t.onload||function(e){return e},T=t.onerror||function(e){return null},I=new FormData;z(i)&&I.append(n,JSON.stringify(i)),(o instanceof Blob?[{name:null,file:o}]:o).forEach(function(e){I.append(n,e.file,null===e.name?e.file.name:""+e.name+e.file.name)});var v=$e(E(I),et(e,t.url),t);return v.onload=function(e){a(Ze("load",e.status,_(e.response),e.getAllResponseHeaders()))},v.onerror=function(e){u(Ze("error",e.status,T(e.response)||e.statusText,e.getAllResponseHeaders()))},v.ontimeout=Ke(u),v.onprogress=s,v.onabort=l,v}}}(e,t,n,r):null},pt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if("function"==typeof t)return t;if(!t||!q(t.url))return function(e,t){return t()};var n=t.onload||function(e){return e},r=t.onerror||function(e){return null};return function(o,i,a){var u=$e(o,e+t.url,t);return u.onload=function(e){i(Ze("load",e.status,n(e.response),e.getAllResponseHeaders()))},u.onerror=function(e){a(Ze("error",e.status,r(e.response)||e.statusText,e.getAllResponseHeaders()))},u.ontimeout=Ke(a),u}},Et=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return e+Math.random()*(t-e)},_t=function(e){var t={complete:!1,perceivedProgress:0,perceivedPerformanceUpdater:null,progress:null,timestamp:null,perceivedDuration:0,duration:0,request:null,response:null},n=function(){t.request&&(t.perceivedPerformanceUpdater.clear(),t.request.abort(),t.complete=!0)},r=Object.assign({},se(),{process:function(n,o){var i=function(){0!==t.duration&&null!==t.progress&&r.fire("progress",r.getProgress())},a=function(){t.complete=!0,r.fire("load-perceived",t.response.body)};r.fire("start"),t.timestamp=Date.now(),t.perceivedPerformanceUpdater=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,n=(arguments.length>2&&void 0!==arguments[2]&&arguments[2],arguments.length>3&&void 0!==arguments[3]?arguments[3]:25),r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:250,o=null,i=Date.now();return function a(){var u=Date.now()-i,s=Et(n,r);u+s>t&&(s=u+s-t);var l=u/t;l>=1?e(1):(e(l),o=setTimeout(a,s))}(),{clear:function(){clearTimeout(o)}}}(function(e){t.perceivedProgress=e,t.perceivedDuration=Date.now()-t.timestamp,i(),t.response&&1===t.perceivedProgress&&!t.complete&&a()},Et(750,1500)),t.request=e(n,o,function(e){t.response=z(e)?e:{type:"load",code:200,body:""+e,headers:{}},t.duration=Date.now()-t.timestamp,t.progress=1,r.fire("load",t.response.body),1===t.perceivedProgress&&a()},function(e){t.perceivedPerformanceUpdater.clear(),r.fire("error",z(e)?e:{type:"error",code:0,body:""+e})},function(e,n,r){t.duration=Date.now()-t.timestamp,t.progress=e?n/r:null,i()},function(){t.perceivedPerformanceUpdater.clear(),r.fire("abort",t.response?t.response.body:null)},function(e){r.fire("transfer",e)})},abort:n,getProgress:function(){return t.progress?Math.min(t.progress,t.perceivedProgress):null},getDuration:function(){return Math.min(t.duration,t.perceivedDuration)},reset:function(){n(),t.complete=!1,t.perceivedProgress=0,t.progress=0,t.timestamp=null,t.perceivedDuration=0,t.duration=0,t.request=null,t.response=null}});return r},Tt=function(e){return e.substr(0,e.lastIndexOf("."))||e},It=function(e){return!!(e instanceof File||e instanceof Blob&&e.name)},vt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=ae(),i={archived:!1,frozen:!1,released:!1,source:null,file:n,serverFileReference:t,transferId:null,processingAborted:!1,status:t?de.PROCESSING_COMPLETE:de.INIT,activeLoader:null,activeProcessor:null},a=null,u={},s=function(e){return i.status=e},l=function(e){if(!i.released&&!i.frozen){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r1?t-1:0),r=1;r0&&void 0!==arguments[0]?arguments[0]:{},r=n.query,o=n.success,i=void 0===o?function(){}:o,a=n.failure,u=void 0===a?function(){}:a,s=Oe(e.items,r);s?t(s,i,u):u({error:Ze("error",0,"Item not found"),file:null})}},At=function(e,t,n){return{ABORT_ALL:function(){ye(n.items).forEach(function(e){e.freeze(),e.abortLoad(),e.abortProcessing()})},DID_SET_FILES:function(t){var r=t.value,o=(void 0===r?[]:r).map(function(e){return{source:e.source?e.source:e,options:e.options}}),i=ye(n.items);i.forEach(function(t){o.find(function(e){return e.source===t.source||e.source===t.file})||e("REMOVE_ITEM",{query:t})}),i=ye(n.items),o.forEach(function(t,n){i.find(function(e){return e.source===t.source||e.file===t.source})||e("ADD_ITEM",Object.assign({},t,{interactionMethod:ie,index:n}))})},DID_UPDATE_ITEM_METADATA:function(r){var o=r.id;clearTimeout(n.itemUpdateTimeout),n.itemUpdateTimeout=setTimeout(function(){var r=mt(n.items,o);if(t("IS_ASYNC")){var i,a=function(){setTimeout(function(){e("REQUEST_ITEM_PROCESSING",{query:o})},32)};return r.status===de.PROCESSING_COMPLETE?(i=n.options.instantUpload,void r.revert(pt(n.options.server.url,n.options.server.revert),t("GET_FORCE_REVERT")).then(i?a:function(){}).catch(function(){})):r.status===de.PROCESSING?function(e){r.abortProcessing().then(e?a:function(){})}(n.options.instantUpload):void(n.options.instantUpload&&a())}ve("SHOULD_PREPARE_OUTPUT",!1,{item:r,query:t}).then(function(t){t&&e("REQUEST_PREPARE_OUTPUT",{query:o,item:r,success:function(t){e("DID_PREPARE_OUTPUT",{id:o,file:t})}},!0)})},0)},MOVE_ITEM:function(e){var t=e.query,r=e.index,o=Oe(n.items,t);if(o){var i=n.items.indexOf(o);i!==(r=Ne(r,0,n.items.length-1))&&n.items.splice(r,0,n.items.splice(i,1)[0])}},SORT:function(r){var o=r.compare;yt(n,o),e("DID_SORT_ITEMS",{items:t("GET_ACTIVE_ITEMS")})},ADD_ITEMS:function(n){var r=n.items,o=n.index,i=n.interactionMethod,a=n.success,u=void 0===a?function(){}:a,s=n.failure,l=void 0===s?function(){}:s,c=o;if(-1===o||void 0===o){var f=t("GET_ITEM_INSERT_LOCATION"),d=t("GET_TOTAL_ITEMS");c="before"===f?0:d}var p=t("GET_IGNORED_FILES"),E=r.filter(function(e){return It(e)?!p.includes(e.name.toLowerCase()):!C(e)}).map(function(t){return new Promise(function(n,r){e("ADD_ITEM",{interactionMethod:i,source:t.source||t,success:n,failure:r,index:c++,options:t.options||{}})})});Promise.all(E).then(u).catch(l)},ADD_ITEM:function(r){var o=r.source,i=r.index,a=void 0===i?-1:i,u=r.interactionMethod,s=r.success,l=void 0===s?function(){}:s,c=r.failure,f=void 0===c?function(){}:c,d=r.options,p=void 0===d?{}:d;if(C(o))f({error:Ze("error",0,"No source"),file:null});else if(!It(o)||!n.options.ignoredFiles.includes(o.name.toLowerCase())){if(!function(e){var t=ye(e.items).length;if(!e.options.allowMultiple)return 0===t;var n=e.options.maxFiles;return null===n||t=400&&t.code<500)return e("DID_THROW_ITEM_INVALID",{id:g,error:t,status:{main:r,sub:t.code+" ("+t.body+")"}}),void f({error:t,file:fe(v)});e("DID_THROW_ITEM_LOAD_ERROR",{id:g,error:t,status:{main:r,sub:n.options.labelTapToRetry}})}),v.on("load-file-error",function(t){e("DID_THROW_ITEM_INVALID",{id:g,error:t.status,status:t.status}),f({error:t.status,file:fe(v)})}),v.on("load-abort",function(){e("REMOVE_ITEM",{query:g})}),v.on("load-skip",function(){e("COMPLETE_LOAD_ITEM",{query:g,item:v,data:{source:o,success:l}})}),v.on("load",function(){var r=function(r){r?(v.on("metadata-update",function(t){e("DID_UPDATE_ITEM_METADATA",{id:g,change:t})}),ve("SHOULD_PREPARE_OUTPUT",!1,{item:v,query:t}).then(function(t){var r=function(){e("COMPLETE_LOAD_ITEM",{query:g,item:v,data:{source:o,success:l}}),Ot(e,n)};t?e("REQUEST_PREPARE_OUTPUT",{query:g,item:v,success:function(t){e("DID_PREPARE_OUTPUT",{id:g,file:t}),r()}},!0):r()})):e("REMOVE_ITEM",{query:g})};ve("DID_LOAD_ITEM",v,{query:t,dispatch:e}).then(function(){Dt(t("GET_BEFORE_ADD_FILE"),fe(v)).then(r)}).catch(function(){r(!1)})}),v.on("process-start",function(){e("DID_START_ITEM_PROCESSING",{id:g})}),v.on("process-progress",function(t){e("DID_UPDATE_ITEM_PROCESS_PROGRESS",{id:g,progress:t})}),v.on("process-error",function(t){e("DID_THROW_ITEM_PROCESSING_ERROR",{id:g,error:t,status:{main:Rt(n.options.labelFileProcessingError)(t),sub:n.options.labelTapToRetry}})}),v.on("process-revert-error",function(t){e("DID_THROW_ITEM_PROCESSING_REVERT_ERROR",{id:g,error:t,status:{main:Rt(n.options.labelFileProcessingRevertError)(t),sub:n.options.labelTapToRetry}})}),v.on("process-complete",function(t){e("DID_COMPLETE_ITEM_PROCESSING",{id:g,error:null,serverFileReference:t}),e("DID_DEFINE_VALUE",{id:g,value:t})}),v.on("process-abort",function(){e("DID_ABORT_ITEM_PROCESSING",{id:g})}),v.on("process-revert",function(){e("DID_REVERT_ITEM_PROCESSING",{id:g}),e("DID_DEFINE_VALUE",{id:g,value:null})}),e("DID_ADD_ITEM",{id:g,index:a,interactionMethod:u}),Ot(e,n);var h=n.options.server||{},R=h.url,O=h.load,D=h.restore,y=h.fetch;v.load(o,We(I===pe.INPUT?q(o)&&function(e){return(e.indexOf(":")>-1||e.indexOf("//")>-1)&&ht(location.href)!==ht(e)}(o)?tt(R,y):gt:tt(R,I===pe.LIMBO?D:O)),function(e,n,r){ve("LOAD_FILE",e,{query:t}).then(n).catch(r)})}},REQUEST_PREPARE_OUTPUT:function(e){var n=e.item,r=e.success,o=e.failure,i=void 0===o?function(){}:o,a={error:Ze("error",0,"Item not found"),file:null};if(n.archived)return i(a);ve("PREPARE_OUTPUT",n.file,{query:t,item:n}).then(function(e){ve("COMPLETE_PREPARE_OUTPUT",e,{query:t,item:n}).then(function(e){if(n.archived)return i(a);r(e)})})},COMPLETE_LOAD_ITEM:function(r){var o=r.item,i=r.data,a=i.success,u=i.source,s=t("GET_ITEM_INSERT_LOCATION");if(j(s)&&u&&yt(n,s),e("DID_LOAD_ITEM",{id:o.id,error:null,serverFileReference:o.origin===pe.INPUT?null:u}),a(fe(o)),o.origin!==pe.LOCAL)return o.origin===pe.LIMBO?(e("DID_COMPLETE_ITEM_PROCESSING",{id:o.id,error:null,serverFileReference:u}),void e("DID_DEFINE_VALUE",{id:o.id,value:u})):void(t("IS_ASYNC")&&n.options.instantUpload&&e("REQUEST_ITEM_PROCESSING",{query:o.id}));e("DID_LOAD_LOCAL_ITEM",{id:o.id})},RETRY_ITEM_LOAD:St(n,function(e){e.retryLoad()}),REQUEST_ITEM_PREPARE:St(n,function(t,n,r){e("REQUEST_PREPARE_OUTPUT",{query:t.id,item:t,success:function(r){e("DID_PREPARE_OUTPUT",{id:t.id,file:r}),n({file:t,output:r})},failure:r},!0)}),REQUEST_ITEM_PROCESSING:St(n,function(r,o,i){if(r.status===de.IDLE||r.status===de.PROCESSING_ERROR)r.status!==de.PROCESSING_QUEUED&&(r.requestProcessing(),e("DID_REQUEST_ITEM_PROCESSING",{id:r.id}),e("PROCESS_ITEM",{query:r,success:o,failure:i},!0));else{var a=function(){setTimeout(function(){e("REQUEST_ITEM_PROCESSING",{query:r,success:o,failure:i})},32)};r.status===de.PROCESSING_COMPLETE||r.status===de.PROCESSING_REVERT_ERROR?r.revert(pt(n.options.server.url,n.options.server.revert),t("GET_FORCE_REVERT")).then(a).catch(function(){}):r.status===de.PROCESSING&&r.abortProcessing().then(a)}}),PROCESS_ITEM:St(n,function(r,o,i){var a=t("GET_MAX_PARALLEL_UPLOADS");if(t("GET_ITEMS_BY_STATUS",de.PROCESSING).length!==a){if(r.status!==de.PROCESSING){var u=function t(){var r=n.processingQueue.shift();if(r){var o=r.id,i=r.success,a=r.failure,u=Oe(n.items,o);u&&!u.archived?e("PROCESS_ITEM",{query:o,success:i,failure:a},!0):t()}};r.onOnce("process-complete",function(){o(fe(r)),u(),t("GET_ITEMS_BY_STATUS",de.PROCESSING_COMPLETE).length===n.items.length&&e("DID_COMPLETE_ITEM_PROCESSING_ALL")}),r.onOnce("process-error",function(e){i({error:e,file:fe(r)}),u()});var s=n.options;r.process(_t(dt(s.server.url,s.server.process,s.name,{chunkTransferId:r.transferId,chunkServer:s.server.patch,chunkUploads:s.chunkUploads,chunkForce:s.chunkForce,chunkSize:s.chunkSize,chunkRetryDelays:s.chunkRetryDelays})),function(n,o,i){ve("PREPARE_OUTPUT",n,{query:t,item:r}).then(function(t){e("DID_PREPARE_OUTPUT",{id:r.id,file:t}),o(t)}).catch(i)})}}else n.processingQueue.push({id:r.id,success:o,failure:i})}),RETRY_ITEM_PROCESSING:St(n,function(t){e("REQUEST_ITEM_PROCESSING",{query:t})}),REQUEST_REMOVE_ITEM:St(n,function(n){Dt(t("GET_BEFORE_REMOVE_FILE"),fe(n)).then(function(t){t&&e("REMOVE_ITEM",{query:n})})}),RELEASE_ITEM:St(n,function(e){e.release()}),REMOVE_ITEM:St(n,function(t,r){var o=function(){var o=t.id;mt(n.items,o).archive(),e("DID_REMOVE_ITEM",{error:null,id:o,item:t}),Ot(e,n),r(fe(t))},i=n.options.server;t.origin===pe.LOCAL&&i&&j(i.remove)?(e("DID_START_ITEM_REMOVE",{id:t.id}),i.remove(t.source,function(){return o()},function(r){e("DID_THROW_ITEM_REMOVE_ERROR",{id:t.id,error:Ze("error",0,r,null),status:{main:Rt(n.options.labelFileRemoveError)(r),sub:n.options.labelTapToRetry}})})):o()}),ABORT_ITEM_LOAD:St(n,function(e){e.abortLoad()}),ABORT_ITEM_PROCESSING:St(n,function(t){t.serverId?e("REVERT_ITEM_PROCESSING",{id:t.id}):t.abortProcessing().then(function(){n.options.instantUpload&&e("REMOVE_ITEM",{query:t.id})})}),REQUEST_REVERT_ITEM_PROCESSING:St(n,function(r){if(n.options.instantUpload){var o=function(t){t&&e("REVERT_ITEM_PROCESSING",{query:r})},i=t("GET_BEFORE_REMOVE_FILE");if(!i)return o(!0);var a=i(fe(r));return null==a?o(!0):"boolean"==typeof a?o(a):void("function"==typeof a.then&&a.then(o))}e("REVERT_ITEM_PROCESSING",{query:r})}),REVERT_ITEM_PROCESSING:St(n,function(r){r.revert(pt(n.options.server.url,n.options.server.revert),t("GET_FORCE_REVERT")).then(function(){(n.options.instantUpload||function(e){return!It(e.file)}(r))&&e("REMOVE_ITEM",{query:r.id})}).catch(function(){})}),SET_OPTIONS:function(t){var n=t.options;r(n,function(t,n){e("SET_"+K(t,"_").toUpperCase(),{value:n})})}}},Lt=function(e){return e},bt=function(e){return document.createElement(e)},Pt=function(e,t){var n=e.childNodes[0];n?t!==n.nodeValue&&(n.nodeValue=t):(n=document.createTextNode(t),e.appendChild(n))},Mt=function(e,t,n,r){var o=(r%360-90)*Math.PI/180;return{x:e+n*Math.cos(o),y:t+n*Math.sin(o)}},wt=function(e,t,n,r,o){var i=1;return o>r&&o-r<=.5&&(i=0),r>o&&r-o>=.5&&(i=0),function(e,t,n,r,o,i){var a=Mt(e,t,n,o),u=Mt(e,t,n,r);return["M",a.x,a.y,"A",n,n,0,i,0,u.x,u.y].join(" ")}(e,t,n,360*Math.min(.9999,r),360*Math.min(.9999,o),i)},Ct=L({tag:"div",name:"progress-indicator",ignoreRectUpdate:!0,ignoreRect:!0,create:function(e){var t=e.root,n=e.props;n.spin=!1,n.progress=0,n.opacity=0;var r=s("svg");t.ref.path=s("path",{"stroke-width":2,"stroke-linecap":"round"}),r.appendChild(t.ref.path),t.ref.svg=r,t.appendChild(r)},write:function(e){var t=e.root,n=e.props;if(0!==n.opacity){n.align&&(t.element.dataset.align=n.align);var r=parseInt(i(t.ref.path,"stroke-width"),10),o=.5*t.rect.element.width,a=0,u=0;n.spin?(a=0,u=.5):(a=0,u=n.progress);var s=wt(o,o,o-r,a,u);i(t.ref.path,"d",s),i(t.ref.path,"stroke-opacity",n.spin||n.progress>0?1:0)}},mixins:{apis:["progress","spin","align"],styles:["opacity"],animations:{opacity:{type:"tween",duration:500},progress:{type:"spring",stiffness:.95,damping:.65,mass:10}}}}),Nt=L({tag:"button",attributes:{type:"button"},ignoreRect:!0,ignoreRectUpdate:!0,name:"file-action-button",mixins:{apis:["label"],styles:["translateX","translateY","scaleX","scaleY","opacity"],animations:{scaleX:"spring",scaleY:"spring",translateX:"spring",translateY:"spring",opacity:{type:"tween",duration:250}},listeners:!0},create:function(e){var t=e.root,n=e.props;t.element.innerHTML=(n.icon||"")+""+n.label+"",n.isDisabled=!1},write:function(e){var t=e.root,n=e.props,r=n.isDisabled,o=t.query("GET_DISABLED")||0===n.opacity;o&&!r?(n.isDisabled=!0,i(t.element,"disabled","disabled")):!o&&r&&(n.isDisabled=!1,t.element.removeAttribute("disabled"))}}),Gt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".";return(e=Math.round(Math.abs(e)))<1e3?e+" bytes":e0&&(t.height=t.ref.container.rect.element.height)),o&&(t.ref.panel.height=null),t.ref.panel.height=t.height}),In=L({create:function(e){var t=e.root,n=e.props;t.ref.handleClick=function(e){return t.dispatch("DID_ACTIVATE_ITEM",{id:n.id})},t.element.id="filepond--item-"+n.id,t.element.addEventListener("click",t.ref.handleClick),t.ref.container=t.appendChildView(t.createChildView(ln,{id:n.id})),t.ref.panel=t.appendChildView(t.createChildView(dn,{name:"item-panel"})),t.ref.panel.height=null,n.markedForRemoval=!1,t.query("GET_ALLOW_REORDER")&&(t.element.dataset.dragState="idle",t.element.addEventListener("pointerdown",function(e){if(e.isPrimary){var r=!1,o=e.pageX,i=e.pageY;n.dragOrigin={x:t.translateX,y:t.translateY},n.dragCenter={x:e.offsetX,y:e.offsetY},t.dispatch("DID_GRAB_ITEM",{id:n.id});var a=function(e){e.isPrimary&&(e.stopPropagation(),e.preventDefault(),n.dragOffset={x:e.pageX-o,y:e.pageY-i},n.dragOffset.x*n.dragOffset.x+n.dragOffset.y*n.dragOffset.y>16&&!r&&(r=!0,t.element.removeEventListener("click",t.ref.handleClick)),t.dispatch("DID_DRAG_ITEM",{id:n.id}))};document.addEventListener("pointermove",a),document.addEventListener("pointerup",function e(u){u.isPrimary&&(document.removeEventListener("pointermove",a),document.removeEventListener("pointerup",e),n.dragOffset={x:u.pageX-o,y:u.pageY-i},t.dispatch("DID_DROP_ITEM",{id:n.id}),r&&setTimeout(function(){return t.element.addEventListener("click",t.ref.handleClick)},0))})}}))},write:Tn,destroy:function(e){var t=e.root,n=e.props;t.element.removeEventListener("click",t.ref.handleClick),t.dispatch("RELEASE_ITEM",{query:n.id})},tag:"li",name:"item",mixins:{apis:["id","interactionMethod","markedForRemoval","spawnDate","dragCenter","dragOrigin","dragOffset"],styles:["translateX","translateY","scaleX","scaleY","opacity","height"],animations:{scaleX:"spring",scaleY:"spring",translateX:pn,translateY:pn,opacity:{type:"tween",duration:150}}}}),vn=function(e,t,n){if(n){var r=e.rect.element.width,o=t.length,i=null;if(0===o||n.topv){if(n.left3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;e.dragOffset?(e.translateX=null,e.translateY=null,e.translateX=e.dragOrigin.x+e.dragOffset.x,e.translateY=e.dragOrigin.y+e.dragOffset.y,e.scaleX=1.025,e.scaleY=1.025):(e.translateX=t,e.translateY=n,Date.now()>e.spawnDate&&(0===e.opacity&&gn(e,t,n,r,o),e.scaleX=1,e.scaleY=1,e.opacity=1))},gn=function(e,t,n,r,o){e.interactionMethod===ie?(e.translateX=null,e.translateX=t,e.translateY=null,e.translateY=n):e.interactionMethod===ne?(e.translateX=null,e.translateX=t-20*r,e.translateY=null,e.translateY=n-10*o,e.scaleX=.8,e.scaleY=.8):e.interactionMethod===re?(e.translateY=null,e.translateY=n-30):e.interactionMethod===te&&(e.translateX=null,e.translateX=t-30,e.translateY=null)},hn=function(e){return e.rect.element.height+.5*e.rect.element.marginBottom+.5*e.rect.element.marginTop},Rn=b({DID_ADD_ITEM:function(e){var t=e.root,n=e.action,r=n.id,o=n.index,i=n.interactionMethod;t.ref.addIndex=o;var a=Date.now(),u=a,s=1;if(i!==ie){s=0;var l=t.query("GET_ITEM_INSERT_INTERVAL"),c=a-t.ref.lastItemSpanwDate;u=c_){if(i3&&void 0!==arguments[3]?arguments[3]:"";n?i(e,t,r):e.removeAttribute(t)},An=function(e){var t=e.root,n=e.action;Sn(t.element,"accept",!!n.value,n.value?n.value.join(","):"")},Ln=function(e){var t=e.root,n=e.action;Sn(t.element,"multiple",n.value)},bn=function(e){var t=e.root,n=e.action;Sn(t.element,"webkitdirectory",n.value)},Pn=function(e){var t=e.root,n=t.query("GET_DISABLED"),r=t.query("GET_ALLOW_BROWSE"),o=n||!r;Sn(t.element,"disabled",o)},Mn=function(e){var t=e.root;e.action.value?0===t.query("GET_TOTAL_ITEMS")&&Sn(t.element,"required",!0):Sn(t.element,"required",!1)},wn=function(e){var t=e.root,n=e.action;Sn(t.element,"capture",!!n.value,!0===n.value?"":n.value)},Cn=function(e){var t=e.root,n=t.element;t.query("GET_TOTAL_ITEMS")>0?(Sn(n,"required",!1),Sn(n,"name",!1)):(Sn(n,"name",!0,t.query("GET_NAME")),t.query("GET_CHECK_VALIDITY")&&n.setCustomValidity(""),t.query("GET_REQUIRED")&&Sn(n,"required",!0))},Nn=L({tag:"input",name:"browser",ignoreRect:!0,ignoreRectUpdate:!0,attributes:{type:"file"},create:function(e){var t=e.root,n=e.props;t.element.id="filepond--browser-"+n.id,i(t.element,"name",t.query("GET_NAME")),i(t.element,"aria-controls","filepond--assistant-"+n.id),i(t.element,"aria-labelledby","filepond--drop-label-"+n.id),An({root:t,action:{value:t.query("GET_ACCEPTED_FILE_TYPES")}}),Ln({root:t,action:{value:t.query("GET_ALLOW_MULTIPLE")}}),bn({root:t,action:{value:t.query("GET_ALLOW_DIRECTORIES_ONLY")}}),Pn({root:t}),Mn({root:t,action:{value:t.query("GET_REQUIRED")}}),wn({root:t,action:{value:t.query("GET_CAPTURE_METHOD")}}),t.ref.handleChange=function(e){if(t.element.value){var r=Array.from(t.element.files).map(function(e){return e._relativePath=e.webkitRelativePath,e});setTimeout(function(){n.onload(r),function(e){if(e&&""!==e.value){try{e.value=""}catch(e){}if(e.value){var t=bt("form"),n=e.parentNode,r=e.nextSibling;t.appendChild(e),t.reset(),r?n.insertBefore(e,r):n.appendChild(e)}}}(t.element)},250)}},t.element.addEventListener("change",t.ref.handleChange)},destroy:function(e){var t=e.root;t.element.removeEventListener("change",t.ref.handleChange)},write:b({DID_LOAD_ITEM:Cn,DID_REMOVE_ITEM:Cn,DID_THROW_ITEM_INVALID:function(e){var t=e.root;t.query("GET_CHECK_VALIDITY")&&t.element.setCustomValidity(t.query("GET_LABEL_INVALID_FIELD"))},DID_SET_DISABLED:Pn,DID_SET_ALLOW_BROWSE:Pn,DID_SET_ALLOW_DIRECTORIES_ONLY:bn,DID_SET_ALLOW_MULTIPLE:Ln,DID_SET_ACCEPTED_FILE_TYPES:An,DID_SET_CAPTURE_METHOD:wn,DID_SET_REQUIRED:Mn})}),Gn=13,Un=32,Bn=function(e,t){e.innerHTML=t;var n=e.querySelector(".filepond--label-action");return n&&i(n,"tabindex","0"),t},qn=L({name:"drop-label",ignoreRect:!0,create:function(e){var t=e.root,n=e.props,r=bt("label");i(r,"for","filepond--browser-"+n.id),i(r,"id","filepond--drop-label-"+n.id),i(r,"aria-hidden","true"),t.ref.handleKeyDown=function(e){(e.keyCode===Gn||e.keyCode===Un)&&(e.preventDefault(),t.ref.label.click())},t.ref.handleClick=function(e){e.target===r||r.contains(e.target)||t.ref.label.click()},r.addEventListener("keydown",t.ref.handleKeyDown),t.element.addEventListener("click",t.ref.handleClick),Bn(r,n.caption),t.appendChild(r),t.ref.label=r},destroy:function(e){var t=e.root;t.ref.label.addEventListener("keydown",t.ref.handleKeyDown),t.element.removeEventListener("click",t.ref.handleClick)},write:b({DID_SET_LABEL_IDLE:function(e){var t=e.root,n=e.action;Bn(t.ref.label,n.value)}}),mixins:{styles:["opacity","translateX","translateY"],animations:{opacity:{type:"tween",duration:150},translateX:"spring",translateY:"spring"}}}),Vn=L({name:"drip-blob",ignoreRect:!0,mixins:{styles:["translateX","translateY","scaleX","scaleY","opacity"],animations:{scaleX:"spring",scaleY:"spring",translateX:"spring",translateY:"spring",opacity:{type:"tween",duration:250}}}}),Fn=b({DID_DRAG:function(e){var t=e.root,n=e.action;t.ref.blob?(t.ref.blob.translateX=n.position.scopeLeft,t.ref.blob.translateY=n.position.scopeTop,t.ref.blob.scaleX=1,t.ref.blob.scaleY=1,t.ref.blob.opacity=1):function(e){var t=e.root,n=.5*t.rect.element.width,r=.5*t.rect.element.height;t.ref.blob=t.appendChildView(t.createChildView(Vn,{opacity:0,scaleX:2.5,scaleY:2.5,translateX:n,translateY:r}))}({root:t})},DID_DROP:function(e){var t=e.root;t.ref.blob&&(t.ref.blob.scaleX=2.5,t.ref.blob.scaleY=2.5,t.ref.blob.opacity=0)},DID_END_DRAG:function(e){var t=e.root;t.ref.blob&&(t.ref.blob.opacity=0)}}),xn=L({ignoreRect:!0,ignoreRectUpdate:!0,name:"drip",write:function(e){var t=e.root,n=e.props,r=e.actions;Fn({root:t,props:n,actions:r});var o=t.ref.blob;0===r.length&&o&&0===o.opacity&&(t.removeChildView(o),t.ref.blob=null)}}),Yn=function(e,t){return e.ref.fields[t]},kn=function(e){return function(e){e.query("GET_ACTIVE_ITEMS").forEach(function(t){e.element.appendChild(e.ref.fields[t.id])})}(e.root)},jn=b({DID_SET_DISABLED:function(e){var t=e.root;t.element.disabled=t.query("GET_DISABLED")},DID_ADD_ITEM:function(e){var t=e.root,n=e.action,r=bt("input");r.type="hidden",r.name=t.query("GET_NAME"),r.disabled=t.query("GET_DISABLED"),t.appendChild(r,0),t.ref.fields[n.id]=r},DID_LOAD_ITEM:function(e){var t=e.root,n=e.action,r=Yn(t,n.id);r&&null!==n.serverFileReference&&(r.value=n.serverFileReference)},DID_REMOVE_ITEM:function(e){var t=e.root,n=e.action,r=Yn(t,n.id);r&&(r.parentNode.removeChild(r),delete t.ref.fields[n.id])},DID_DEFINE_VALUE:function(e){var t=e.root,n=e.action,r=Yn(t,n.id);r&&(null===n.value?r.removeAttribute("value"):r.value=n.value)},DID_REORDER_ITEMS:kn,DID_SORT_ITEMS:kn}),Hn=L({tag:"fieldset",name:"data",create:function(e){return e.root.ref.fields={}},write:jn,ignoreRect:!0}),Xn=["jpg","jpeg","png","gif","bmp","webp","svg","tiff"],zn=["css","csv","html","txt"],Wn={zip:"zip|compressed",epub:"application/epub+zip"},Qn=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e=e.toLowerCase(),Xn.includes(e)?"image/"+("jpg"===e?"jpeg":"svg"===e?"svg+xml":e):zn.includes(e)?"text/"+e:Wn[e]||""},$n=function(e){return new Promise(function(t,n){var r=ar(e);if(r.length&&!Zn(e))return t(r);Kn(e).then(t)})},Zn=function(e){return!!e.files&&e.files.length>0},Kn=function(e){return new Promise(function(t,n){var r=(e.items?Array.from(e.items):[]).filter(function(e){return Jn(e)}).map(function(e){return er(e)});r.length?Promise.all(r).then(function(e){var n=[];e.forEach(function(e){n.push.apply(n,e)}),t(n.filter(function(e){return e}).map(function(e){return e._relativePath||(e._relativePath=e.webkitRelativePath),e}))}).catch(console.error):t(e.files?Array.from(e.files):[])})},Jn=function(e){if(or(e)){var t=ir(e);if(t)return t.isFile||t.isDirectory}return"file"===e.kind},er=function(e){return new Promise(function(t,n){rr(e)?tr(ir(e)).then(t).catch(n):t([e.getAsFile()])})},tr=function(e){return new Promise(function(t,n){var r=[],o=0,i=0,a=function(){0===i&&0===o&&t(r)};!function e(t){o++;var u=t.createReader();!function t(){u.readEntries(function(n){if(0===n.length)return o--,void a();n.forEach(function(t){t.isDirectory?e(t):(i++,t.file(function(e){var n=nr(e);t.fullPath&&(n._relativePath=t.fullPath),r.push(n),i--,a()}))}),t()},n)}()}(e)})},nr=function(e){if(e.type.length)return e;var t=e.lastModifiedDate,n=e.name;return(e=e.slice(0,e.size,Qn(Be(e.name)))).name=n,e.lastModifiedDate=t,e},rr=function(e){return or(e)&&(ir(e)||{}).isDirectory},or=function(e){return"webkitGetAsEntry"in e},ir=function(e){return e.webkitGetAsEntry()},ar=function(e){var t=[];try{if((t=sr(e)).length)return t;t=ur(e)}catch(e){}return t},ur=function(e){var t=e.getData("url");return"string"==typeof t&&t.length?[t]:[]},sr=function(e){var t=e.getData("text/html");if("string"==typeof t&&t.length){var n=t.match(/src\s*=\s*"(.+?)"/);if(n)return[n[1]]}return[]},lr=[],cr=function(e){return{pageLeft:e.pageX,pageTop:e.pageY,scopeLeft:e.offsetX||e.layerX,scopeTop:e.offsetY||e.layerY}},fr=function(e){var t=lr.find(function(t){return t.element===e});if(t)return t;var n=dr(e);return lr.push(n),n},dr=function(e){var t=[],n={dragenter:Tr,dragover:Ir,dragleave:mr,drop:vr},o={};r(n,function(n,r){o[n]=r(e,t),e.addEventListener(n,o[n],!1)});var i={element:e,addListener:function(a){return t.push(a),function(){t.splice(t.indexOf(a),1),0===t.length&&(lr.splice(lr.indexOf(i),1),r(n,function(t){e.removeEventListener(t,o[t],!1)}))}}};return i},pr=function(e,t){var n,r=function(e,t){return"elementFromPoint"in e||(e=document),e.elementFromPoint(t.x,t.y)}("getRootNode"in(n=t)?n.getRootNode():document,{x:e.pageX-window.pageXOffset,y:e.pageY-window.pageYOffset});return r===t||t.contains(r)},Er=null,_r=function(e,t){try{e.dropEffect=t}catch(e){}},Tr=function(e,t){return function(e){e.preventDefault(),Er=e.target,t.forEach(function(t){var n=t.element,r=t.onenter;pr(e,n)&&(t.state="enter",r(cr(e)))})}},Ir=function(e,t){return function(e){e.preventDefault();var n=e.dataTransfer;$n(n).then(function(r){var o=!1;t.some(function(t){var i=t.filterElement,a=t.element,u=t.onenter,s=t.onexit,l=t.ondrag,c=t.allowdrop;_r(n,"copy");var f=c(r);if(f)if(pr(e,a)){if(o=!0,null===t.state)return t.state="enter",void u(cr(e));if(t.state="over",i&&!f)return void _r(n,"none");l(cr(e))}else i&&!o&&_r(n,"none"),t.state&&(t.state=null,s(cr(e)));else _r(n,"none")})})}},vr=function(e,t){return function(e){e.preventDefault();var n=e.dataTransfer;$n(n).then(function(n){t.forEach(function(t){var r=t.filterElement,o=t.element,i=t.ondrop,a=t.onexit,u=t.allowdrop;if(t.state=null,!r||pr(e,o))return u(n)?void i(cr(e),n):a(cr(e))})})}},mr=function(e,t){return function(e){Er===e.target&&t.forEach(function(t){var n=t.onexit;t.state=null,n(cr(e))})}},gr=function(e,t,n){e.classList.add("filepond--hopper");var r=n.catchesDropsOnPage,o=n.requiresDropOnElement,i=n.filterItems,a=void 0===i?function(e){return e}:i,u=function(e,t,n){var r=fr(t),o={element:e,filterElement:n,state:null,ondrop:function(){},onenter:function(){},ondrag:function(){},onexit:function(){},onload:function(){},allowdrop:function(){}};return o.destroy=r.addListener(o),o}(e,r?document.documentElement:e,o),s="",l="";u.allowdrop=function(e){return t(a(e))},u.ondrop=function(e,n){var r=a(n);t(r)?(l="drag-drop",c.onload(r,e)):c.ondragend(e)},u.ondrag=function(e){c.ondrag(e)},u.onenter=function(e){l="drag-over",c.ondragstart(e)},u.onexit=function(e){l="drag-exit",c.ondragend(e)};var c={updateHopperState:function(){s!==l&&(e.dataset.hopperState=l,s=l)},onload:function(){},ondragstart:function(){},ondrag:function(){},ondragend:function(){},destroy:function(){u.destroy()}};return c},hr=!1,Rr=[],Or=function(e){$n(e.clipboardData).then(function(e){e.length&&Rr.forEach(function(t){return t(e)})})},Dr=function(){var e=function(e){t.onload(e)},t={destroy:function(){var t;t=e,ue(Rr,Rr.indexOf(t)),0===Rr.length&&(document.removeEventListener("paste",Or),hr=!1)},onload:function(){}};return function(e){Rr.includes(e)||(Rr.push(e),hr||(hr=!0,document.addEventListener("paste",Or)))}(e),t},yr=null,Sr=null,Ar=[],Lr=function(e,t){e.element.textContent=t},br=function(e,t,n){var r=e.query("GET_TOTAL_ITEMS");Lr(e,n+" "+t+", "+r+" "+(1===r?e.query("GET_LABEL_FILE_COUNT_SINGULAR"):e.query("GET_LABEL_FILE_COUNT_PLURAL"))),clearTimeout(Sr),Sr=setTimeout(function(){!function(e){e.element.textContent=""}(e)},1500)},Pr=function(e){return e.element.parentNode.contains(document.activeElement)},Mr=function(e){var t=e.root,n=e.action,r=t.query("GET_ITEM",n.id).filename,o=t.query("GET_LABEL_FILE_PROCESSING_ABORTED");Lr(t,r+" "+o)},wr=function(e){var t=e.root,n=e.action,r=t.query("GET_ITEM",n.id).filename;Lr(t,n.status.main+" "+r+" "+n.status.sub)},Cr=L({create:function(e){var t=e.root,n=e.props;t.element.id="filepond--assistant-"+n.id,i(t.element,"role","status"),i(t.element,"aria-live","polite"),i(t.element,"aria-relevant","additions")},ignoreRect:!0,ignoreRectUpdate:!0,write:b({DID_LOAD_ITEM:function(e){var t=e.root,n=e.action;if(Pr(t)){t.element.textContent="";var r=t.query("GET_ITEM",n.id);Ar.push(r.filename),clearTimeout(yr),yr=setTimeout(function(){br(t,Ar.join(", "),t.query("GET_LABEL_FILE_ADDED")),Ar.length=0},750)}},DID_REMOVE_ITEM:function(e){var t=e.root,n=e.action;if(Pr(t)){var r=n.item;br(t,r.filename,t.query("GET_LABEL_FILE_REMOVED"))}},DID_COMPLETE_ITEM_PROCESSING:function(e){var t=e.root,n=e.action,r=t.query("GET_ITEM",n.id).filename,o=t.query("GET_LABEL_FILE_PROCESSING_COMPLETE");Lr(t,r+" "+o)},DID_ABORT_ITEM_PROCESSING:Mr,DID_REVERT_ITEM_PROCESSING:Mr,DID_THROW_ITEM_REMOVE_ERROR:wr,DID_THROW_ITEM_LOAD_ERROR:wr,DID_THROW_ITEM_INVALID:wr,DID_THROW_ITEM_PROCESSING_ERROR:wr}),tag:"span",name:"assistant"}),Nr=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";return e.replace(new RegExp(t+".","g"),function(e){return e.charAt(1).toUpperCase()})},Gr=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=Date.now(),o=null;return function(){for(var i=arguments.length,a=new Array(i),u=0;u=0?1:0,_=a.find(function(e){return e.markedForRemoval&&e.opacity<.45})?-1:0,T=a.length+E+_,I=Math.round(u/d);return 1===I?a.forEach(function(e){var r=e.rect.element.height+c;n+=r,t+=r*e.opacity}):(n=Math.ceil(T/I)*p,t=n),{visual:t,bounds:n}},Vr=function(e){var t=e.ref.measureHeight||null;return{cappedHeight:parseInt(e.style.maxHeight,10)||null,fixedHeight:0===t?null:t}},Fr=function(e,t){var n=e.query("GET_ALLOW_REPLACE"),r=e.query("GET_ALLOW_MULTIPLE"),o=e.query("GET_TOTAL_ITEMS"),i=e.query("GET_MAX_FILES"),a=t.length;return!r&&a>1||!!(Y(i=r?i:n?i:1)&&o+a>i)&&(e.dispatch("DID_THROW_MAX_FILES",{source:t,error:Ze("warning",0,"Max files")}),!0)},xr=function(e,t,n){var r=e.childViews[0];return vn(r,t,{left:n.scopeLeft-r.rect.element.left,top:n.scopeTop-(e.rect.outer.top+e.rect.element.marginTop+e.rect.element.scrollTop)})},Yr=function(e){var t=e.query("GET_ALLOW_DROP"),n=e.query("GET_DISABLED"),r=t&&!n;if(r&&!e.ref.hopper){var o=gr(e.element,function(t){if(Fr(e,t))return!1;var n=e.query("GET_BEFORE_DROP_FILE")||function(){return!0};return!e.query("GET_DROP_VALIDATION")||t.every(function(t){return me("ALLOW_HOPPER_ITEM",t,{query:e.query}).every(function(e){return!0===e})&&n(t)})},{filterItems:function(t){var n=e.query("GET_IGNORED_FILES");return t.filter(function(e){return!It(e)||!n.includes(e.name.toLowerCase())})},catchesDropsOnPage:e.query("GET_DROP_ON_PAGE"),requiresDropOnElement:e.query("GET_DROP_ON_ELEMENT")});o.onload=function(t,n){var r=e.ref.list.childViews[0].childViews.filter(function(e){return e.rect.element.height}),o=e.query("GET_ACTIVE_ITEMS").map(function(e){return r.find(function(t){return t.id===e.id})}).filter(function(e){return e});e.dispatch("ADD_ITEMS",{items:t,index:xr(e.ref.list,o,n),interactionMethod:ne}),e.dispatch("DID_DROP",{position:n}),e.dispatch("DID_END_DRAG",{position:n})},o.ondragstart=function(t){e.dispatch("DID_START_DRAG",{position:t})},o.ondrag=Gr(function(t){e.dispatch("DID_DRAG",{position:t})}),o.ondragend=function(t){e.dispatch("DID_END_DRAG",{position:t})},e.ref.hopper=o,e.ref.drip=e.appendChildView(e.createChildView(xn))}else!r&&e.ref.hopper&&(e.ref.hopper.destroy(),e.ref.hopper=null,e.removeChildView(e.ref.drip))},kr=function(e,t){var n=e.query("GET_ALLOW_BROWSE"),r=e.query("GET_DISABLED"),o=n&&!r;o&&!e.ref.browser?e.ref.browser=e.appendChildView(e.createChildView(Nn,Object.assign({},t,{onload:function(t){if(Fr(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:re})}})),0):!o&&e.ref.browser&&(e.removeChildView(e.ref.browser),e.ref.browser=null)},jr=function(e){var t=e.query("GET_ALLOW_PASTE"),n=e.query("GET_DISABLED"),r=t&&!n;r&&!e.ref.paster?(e.ref.paster=Dr(),e.ref.paster.onload=function(t){e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:oe})}):!r&&e.ref.paster&&(e.ref.paster.destroy(),e.ref.paster=null)},Hr=b({DID_SET_ALLOW_BROWSE:function(e){var t=e.root,n=e.props;kr(t,n)},DID_SET_ALLOW_DROP:function(e){var t=e.root;Yr(t)},DID_SET_ALLOW_PASTE:function(e){var t=e.root;jr(t)},DID_SET_DISABLED:function(e){var t=e.root,n=e.props;Yr(t),jr(t),kr(t,n),t.query("GET_DISABLED")?t.element.dataset.disabled="disabled":t.element.removeAttribute("data-disabled")}}),Xr=L({name:"root",read:function(e){var t=e.root;t.ref.measure&&(t.ref.measureHeight=t.ref.measure.offsetHeight)},create:function(e){var t=e.root,n=e.props,r=t.query("GET_ID");r&&(t.element.id=r);var o=t.query("GET_CLASS_NAME");o&&o.split(" ").filter(function(e){return e.length}).forEach(function(e){t.element.classList.add(e)}),t.ref.label=t.appendChildView(t.createChildView(qn,Object.assign({},n,{translateY:null,caption:t.query("GET_LABEL_IDLE")}))),t.ref.list=t.appendChildView(t.createChildView(yn,{translateY:null})),t.ref.panel=t.appendChildView(t.createChildView(dn,{name:"panel-root"})),t.ref.assistant=t.appendChildView(t.createChildView(Cr,Object.assign({},n))),t.ref.data=t.appendChildView(t.createChildView(Hn,Object.assign({},n))),t.ref.measure=bt("div"),t.ref.measure.style.height="100%",t.element.appendChild(t.ref.measure),t.ref.bounds=null,t.query("GET_STYLES").filter(function(e){return!C(e.value)}).map(function(e){var n=e.name,r=e.value;t.element.dataset[n]=r}),t.ref.widthPrevious=null,t.ref.widthUpdated=Gr(function(){t.ref.updateHistory=[],t.dispatch("DID_RESIZE_ROOT")},250),t.ref.previousAspectRatio=null,t.ref.updateHistory=[];var i=window.matchMedia("(pointer: fine) and (hover: hover)").matches,a="PointerEvent"in window;t.query("GET_ALLOW_REORDER")&&a&&!i&&(t.element.addEventListener("touchmove",Ur,{passive:!1}),t.element.addEventListener("gesturestart",Ur))},write:function(e){var t=e.root,n=e.props,r=e.actions;if(Hr({root:t,props:n,actions:r}),r.filter(function(e){return/^DID_SET_STYLE_/.test(e.type)}).filter(function(e){return!C(e.data.value)}).map(function(e){var n=e.type,r=e.data,o=Nr(n.substr(8).toLowerCase(),"_");t.element.dataset[o]=r.value,t.invalidateLayout()}),!t.rect.element.hidden){t.rect.element.width!==t.ref.widthPrevious&&(t.ref.widthPrevious=t.rect.element.width,t.ref.widthUpdated());var o=t.ref.bounds;o||(o=t.ref.bounds=Vr(t),t.element.removeChild(t.ref.measure),t.ref.measure=null);var i=t.ref,a=i.hopper,u=i.label,s=i.list,l=i.panel;a&&a.updateHopperState();var c=t.query("GET_PANEL_ASPECT_RATIO"),f=t.query("GET_ALLOW_MULTIPLE"),d=t.query("GET_TOTAL_ITEMS"),p=d===(f?t.query("GET_MAX_FILES")||1e6:1),E=r.find(function(e){return"DID_ADD_ITEM"===e.type});if(p&&E){var _=E.data.interactionMethod;u.opacity=0,f?u.translateY=-40:_===te?u.translateX=40:u.translateY=_===re?40:30}else p||(u.opacity=1,u.translateX=0,u.translateY=0);var T=Br(t),I=qr(t),v=u.rect.element.height,m=!f||p?0:v,g=p?s.rect.element.marginTop:0,h=0===d?0:s.rect.element.marginBottom,R=m+g+I.visual+h,O=m+g+I.bounds+h;if(s.translateY=Math.max(0,m-s.rect.element.marginTop)-T.top,c){var D=t.rect.element.width,y=D*c;c!==t.ref.previousAspectRatio&&(t.ref.previousAspectRatio=c,t.ref.updateHistory=[]);var S=t.ref.updateHistory;if(S.push(D),S.length>4)for(var A=S.length,L=A-10,b=0,P=A;P>=L;P--)if(S[P]===S[P-2]&&b++,b>=2)return;l.scalable=!1,l.height=y;var M=y-m-(h-T.bottom)-(p?g:0);I.visual>M?s.overflow=M:s.overflow=null,t.height=y}else if(o.fixedHeight){l.scalable=!1;var w=o.fixedHeight-m-(h-T.bottom)-(p?g:0);I.visual>w?s.overflow=w:s.overflow=null}else if(o.cappedHeight){var N=R>=o.cappedHeight,G=Math.min(o.cappedHeight,R);l.scalable=!0,l.height=N?G:G-T.top-T.bottom;var U=G-m-(h-T.bottom)-(p?g:0);R>o.cappedHeight&&I.visual>U?s.overflow=U:s.overflow=null,t.height=Math.min(o.cappedHeight,O-T.top-T.bottom)}else{var B=d>0?T.top+T.bottom:0;l.scalable=!0,l.height=Math.max(v,R-B),t.height=Math.max(v,O-B)}}},destroy:function(e){var t=e.root;t.ref.paster&&t.ref.paster.destroy(),t.ref.hopper&&t.ref.hopper.destroy(),t.element.removeEventListener("touchmove",Ur),t.element.removeEventListener("gesturestart",Ur)},mixins:{styles:["height"]}}),zr=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=null,n=he(),i=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],r=Object.assign({},e),o=[],i=[],a=function(e,t,n){n?i.push({type:e,data:t}):(c[e]&&c[e](t),o.push({type:e,data:t}))},u=function(e){for(var t,n=arguments.length,r=new Array(n>1?n-1:0),o=1;o1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(function(n,r){O([{source:e,options:t}],{index:t.index}).then(function(e){return n(e&&e[0])}).catch(r)})},addFiles:O,getFile:function(e){return i.query("GET_ACTIVE_ITEM",e)},processFile:y,prepareFile:h,removeFile:R,moveFile:function(e,t){return i.dispatch("MOVE_ITEM",{query:e,index:t})},getFiles:D,processFiles:function(){for(var e=arguments.length,t=new Array(e),n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t={};return r(he(),function(e,n){t[e]=n[0]}),zr(Object.assign({},t,{},e))},Qr=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=[];r(e.attributes,function(t){n.push(e.attributes[t])});var o=n.filter(function(e){return e.name}).reduce(function(t,n){var r,o=i(e,n.name);return t[(r=n.name,Nr(r.replace(/^data-/,"")))]=o===n.name||o,t},{});return function e(t,n){r(n,function(n,o){r(t,function(e,r){var i=new RegExp(n);if(i.test(e)&&(delete t[e],!1!==o))if(q(o))t[o]=r;else{var a,u=o.group;z(o)&&!t[u]&&(t[u]={}),t[u][(a=e.replace(i,""),a.charAt(0).toLowerCase()+a.slice(1))]=r}}),o.mapping&&e(t[o.group],o.mapping)})}(o,t),o},$r=function(){return(arguments.length<=0?void 0:arguments[0])instanceof HTMLElement?function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={"^class$":"className","^multiple$":"allowMultiple","^capture$":"captureMethod","^webkitdirectory$":"allowDirectoriesOnly","^server":{group:"server",mapping:{"^process":{group:"process"},"^revert":{group:"revert"},"^fetch":{group:"fetch"},"^restore":{group:"restore"},"^load":{group:"load"}}},"^type$":!1,"^files$":!1};me("SET_ATTRIBUTE_TO_OPTION_MAP",n);var r=Object.assign({},t),o=Qr("FIELDSET"===e.nodeName?e.querySelector("input[type=file]"):e,n);Object.keys(o).forEach(function(e){z(o[e])?(z(r[e])||(r[e]={}),Object.assign(r[e],o[e])):r[e]=o[e]}),r.files=(t.files||[]).concat(Array.from(e.querySelectorAll("input:not([type=file])")).map(function(e){return{source:e.value,options:{type:e.dataset.type}}}));var i=Wr(r);return e.files&&Array.from(e.files).forEach(function(e){i.addFile(e)}),i.replaceElement(e),i}.apply(void 0,arguments):Wr.apply(void 0,arguments)},Zr=["fire","_read","_write"],Kr=function(e){var t={};return le(e,t,Zr),t},Jr=function(e,t){return e.replace(/(?:{([a-zA-Z]+)})/g,function(e,n){return t[n]})},eo=function(e){var t=new Blob(["(",e.toString(),")()"],{type:"application/javascript"}),n=URL.createObjectURL(t),r=new Worker(n);return{transfer:function(e,t){},post:function(e,t,n){var o=ae();r.onmessage=function(e){e.data.id===o&&t(e.data.message)},r.postMessage({id:o,message:e},n)},terminate:function(){r.terminate(),URL.revokeObjectURL(n)}}},to=function(e){return new Promise(function(t,n){var r=new Image;r.onload=function(){t(r)},r.onerror=function(e){n(e)},r.src=e})},no=function(e,t){var n=e.slice(0,e.size,e.type);return n.lastModifiedDate=e.lastModifiedDate,n.name=t,n},ro=function(e){return no(e,e.name)},oo=[],io=function(e){if(!oo.includes(e)){oo.push(e);var t,n=e({addFilter:ge,utils:{Type:Te,forin:r,isString:q,isFile:It,toNaturalFileSize:Gt,replaceInString:Jr,getExtensionFromFilename:Be,getFilenameWithoutExtension:Tt,guesstimateMimeType:Qn,getFileFromBlob:Fe,getFilenameFromURL:Ue,createRoute:b,createWorker:eo,createView:L,createItemAPI:fe,loadImage:to,copyFile:ro,renameFile:no,createBlob:xe,applyFilterChain:ve,text:Pt,getNumericAspectRatioFromString:De},views:{fileActionButton:Nt}});t=n.options,Object.assign(Re,t)}},ao=($t=d()&&!("[object OperaMini]"===Object.prototype.toString.call(window.operamini))&&"visibilityState"in document&&"Promise"in window&&"slice"in Blob.prototype&&"URL"in window&&"createObjectURL"in window.URL&&"performance"in window,function(){return $t}),uo={apps:[]},so=function(){};if(e.Status={},e.FileStatus={},e.FileOrigin={},e.OptionTypes={},e.create=so,e.destroy=so,e.parse=so,e.find=so,e.registerPlugin=so,e.getOptions=so,e.setOptions=so,ao()){!function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:60,r="__framePainter";if(window[r])return window[r].readers.push(e),void window[r].writers.push(t);window[r]={readers:[e],writers:[t]};var o=window[r],i=1e3/n,a=null,u=null,s=null,l=null,c=function(){document.hidden?(s=function(){return window.setTimeout(function(){return f(performance.now())},i)},l=function(){return window.clearTimeout(u)}):(s=function(){return window.requestAnimationFrame(f)},l=function(){return window.cancelAnimationFrame(u)})};document.addEventListener("visibilitychange",function(){l&&l(),c(),f(performance.now())});var f=function e(t){u=s(e),a||(a=t);var n=t-a;n<=i||(a=t-n%i,o.readers.forEach(function(e){return e()}),o.writers.forEach(function(e){return e(t)}))};c(),f(performance.now())}(function(){uo.apps.forEach(function(e){return e._read()})},function(e){uo.apps.forEach(function(t){return t._write(e)})});var lo=function t(){document.dispatchEvent(new CustomEvent("FilePond:loaded",{detail:{supported:ao,create:e.create,destroy:e.destroy,parse:e.parse,find:e.find,registerPlugin:e.registerPlugin,setOptions:e.setOptions}})),document.removeEventListener("DOMContentLoaded",t)};"loading"!==document.readyState?setTimeout(function(){return lo()},0):document.addEventListener("DOMContentLoaded",lo);var co=function(){return r(he(),function(t,n){e.OptionTypes[t]=n[1]})};e.Status=Object.assign({},Se),e.FileOrigin=Object.assign({},pe),e.FileStatus=Object.assign({},de),e.OptionTypes={},co(),e.create=function(){var t=$r.apply(void 0,arguments);return t.on("destroy",e.destroy),uo.apps.push(t),Kr(t)},e.destroy=function(e){var t=uo.apps.findIndex(function(t){return t.isAttachedTo(e)});return t>=0&&(uo.apps.splice(t,1)[0].restoreElement(),!0)},e.parse=function(t){return Array.from(t.querySelectorAll(".filepond")).filter(function(e){return!uo.apps.find(function(t){return t.isAttachedTo(e)})}).map(function(t){return e.create(t)})},e.find=function(e){var t=uo.apps.find(function(t){return t.isAttachedTo(e)});return t?Kr(t):null},e.registerPlugin=function(){for(var e=arguments.length,t=new Array(e),n=0;n ({ }), PROCESS_ITEM: getItemByQueryFromState(state, (item, success, failure) => { - + const maxParallelUploads = query('GET_MAX_PARALLEL_UPLOADS'); const totalCurrentUploads = query('GET_ITEMS_BY_STATUS', ItemStatus.PROCESSING).length; diff --git a/src/js/app/frame/mixins/animations.js b/src/js/app/frame/mixins/animations.js index 6ac0831a..9ff874f2 100644 --- a/src/js/app/frame/mixins/animations.js +++ b/src/js/app/frame/mixins/animations.js @@ -1,7 +1,6 @@ import { createAnimator } from '../utils/createAnimator'; import { forin } from '../../../utils/forin'; import { addGetSet } from './utils/addGetSet'; -import { isDefined } from '../../../utils/isDefined'; // add to state, // add getters and setters to internal and external api (if not set) @@ -11,8 +10,7 @@ export const animations = ({ mixinConfig, viewProps, viewInternalAPI, - viewExternalAPI, - viewState + viewExternalAPI }) => { // initial properties const initialProps = { ...viewProps }; @@ -60,12 +58,11 @@ export const animations = ({ // expose internal write api return { write: ts => { + let skipToEndState = document.hidden; let resting = true; animations.forEach(animation => { - if (!animation.resting) { - resting = false; - } - animation.interpolate(ts); + if (!animation.resting) resting = false; + animation.interpolate(ts, skipToEndState); }); return resting; }, diff --git a/src/js/app/frame/utils/animators/spring.js b/src/js/app/frame/utils/animators/spring.js index e7d8dfc2..063f8923 100644 --- a/src/js/app/frame/utils/animators/spring.js +++ b/src/js/app/frame/utils/animators/spring.js @@ -30,12 +30,10 @@ export const spring = let resting = false; // updates spring state - const interpolate = () => { + const interpolate = (ts, skipToEndState) => { // in rest, don't animate - if (resting) { - return; - } + if (resting) return; // need at least a target or position to do springy things if (!(isNumber(target) && isNumber(position))) { @@ -57,7 +55,7 @@ export const spring = velocity *= damping; // we've arrived if we're near target and our velocity is near zero - if (thereYet(position, target, velocity)) { + if (thereYet(position, target, velocity) || skipToEndState) { position = target; velocity = 0; resting = true; diff --git a/src/js/app/frame/utils/animators/tween.js b/src/js/app/frame/utils/animators/tween.js index 3f622696..84ef3c06 100644 --- a/src/js/app/frame/utils/animators/tween.js +++ b/src/js/app/frame/utils/animators/tween.js @@ -13,33 +13,30 @@ export const tween = let reverse = false; let target = null; - const interpolate = ts => { - if (resting || target === null) { - return; - } + const interpolate = (ts, skipToEndState) => { + if (resting || target === null) return; if (start === null) { start = ts; } - if (ts - start < delay) { - return; - } + if (ts - start < delay) return; t = ts - start - delay; - if (t < duration) { - p = t / duration; - api.onupdate( - (t >= 0 ? easing(reverse ? 1 - p : p) : 0) * target - ); - } else { + if (t >= duration || skipToEndState) { t = 1; p = reverse ? 0 : 1; api.onupdate(p * target); api.oncomplete(p * target); resting = true; } + else { + p = t / duration; + api.onupdate( + (t >= 0 ? easing(reverse ? 1 - p : p) : 0) * target + ); + } }; // need 'api' to call onupdate callback diff --git a/src/js/app/utils/createFileProcessor.js b/src/js/app/utils/createFileProcessor.js index 68a32cdf..cb079c29 100644 --- a/src/js/app/utils/createFileProcessor.js +++ b/src/js/app/utils/createFileProcessor.js @@ -122,6 +122,7 @@ export const createFileProcessor = processFn => { // actual processing progress (computable, current, total) => { + // update actual duration state.duration = Date.now() - state.timestamp;