UNPKG

@salla.sa/twilight-components

Version:
4 lines 118 kB
/*! * Crafted with ❤ by Salla */ import{d as n}from"./p-BQQ2x3w_.js";function t(n,t){return t.forEach((function(t){t&&"string"!=typeof t&&!Array.isArray(t)&&Object.keys(t).forEach((function(e){if("default"!==e&&!(e in n)){var r=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(n,e,r.get?r:{enumerable:!0,get:function(){return t[e]}})}}))})),Object.freeze(n)}var e,r={exports:{}},o=(e||(e=1,function(n){var t=function(n,t){for(var e in n)n.hasOwnProperty(e)&&t(e,n[e])},e=function(n){var e={};return t(n,(function(t){!function(n,t,e){"function"!=typeof e?Object.defineProperty(n,t,Object.assign({},e)):n[t]=e}(e,t,n[t])})),e},r=function(n,t){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null;if(null===e)return n.getAttribute(t)||n.hasAttribute(t);n.setAttribute(t,e)},o=["svg","path"],i=function(n){return o.includes(n)},u=function(n,e){var o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"object"==typeof e&&(o=e,e=null);var u=i(n)?document.createElementNS("http://www.w3.org/2000/svg",n):document.createElement(n);return e&&(i(n)?r(u,"class",e):u.className=e),t(o,(function(n,t){r(u,n,t)})),u},c=function(n,t){return function(n,e){return void 0!==e?t.splice(e,0,n):t.push(n),n}},a=function(n,t){return function(e){return t.splice(t.indexOf(e),1),e.element.parentNode&&n.removeChild(e.element),e}},f="undefined"!=typeof window&&void 0!==window.document,l=function(){return f},E="children"in(l()?u("svg"):{})?function(n){return n.children.length}:function(n){return n.childNodes.length},s=function(n,t,e,r){var o=e[0]||n.left,i=e[1]||n.top,u=o+n.width,c=i+n.height*(r[1]||1),a={element:Object.assign({},n),inner:{left:n.left,top:n.top,right:n.right,bottom:n.bottom},outer:{left:o,top:i,right:u,bottom:c}};return t.filter((function(n){return!n.isRectIgnored()})).map((function(n){return n.rect})).forEach((function(n){_(a.inner,Object.assign({},n.inner)),_(a.outer,Object.assign({},n.outer))})),T(a.inner),a.outer.bottom+=a.element.marginBottom,a.outer.right+=a.element.marginRight,T(a.outer),a},_=function(n,t){t.top+=n.top,t.right+=n.left,t.bottom+=n.top,t.left+=n.left,t.bottom>n.bottom&&(n.bottom=t.bottom),t.right>n.right&&(n.right=t.right)},T=function(n){n.width=n.right-n.left,n.height=n.bottom-n.top},I=function(n){return"number"==typeof n},d=function(n){return n<.5?2*n*n:(4-2*n)*n-1},v={spring:function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=n.stiffness,r=void 0===t?.5:t,o=n.damping,i=void 0===o?.75:o,u=n.mass,c=void 0===u?10:u,a=null,f=null,l=0,E=!1,s=e({interpolate:function(n,t){if(!E){if(!I(a)||!I(f))return E=!0,void(l=0);(function(n,t,e){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.001;return Math.abs(n-t)<r&&Math.abs(e)<r})(f+=l+=-(f-a)*r/c,a,l*=i)||t?(l=0,E=!0,s.onupdate(f=a),s.oncomplete(f)):s.onupdate(f)}},target:{set:function(n){if(I(n)&&!I(f)&&(f=n),null===a&&(a=n,f=n),f===(a=n)||void 0===a)return E=!0,l=0,s.onupdate(f),void s.oncomplete(f);E=!1},get:function(){return a}},resting:{get:function(){return E}},onupdate:function(){},oncomplete:function(){}});return s},tween:function(){var n,t,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=r.duration,i=void 0===o?500:o,u=r.easing,c=void 0===u?d:u,a=r.delay,f=void 0===a?0:a,l=null,E=!0,s=!1,_=null,T=e({interpolate:function(e,r){E||null===_||(null===l&&(l=e),e-l<f||((n=e-l-f)>=i||r?(n=1,T.onupdate((t=s?0:1)*_),T.oncomplete(t*_),E=!0):(t=n/i,T.onupdate((n>=0?c(s?1-t:t):0)*_))))},target:{get:function(){return s?0:_},set:function(n){if(null===_)return _=n,T.onupdate(n),void T.oncomplete(n);n<_?(_=1,s=!0):(s=!1,_=n),E=!1,l=null}},resting:{get:function(){return E}},onupdate:function(){},oncomplete:function(){}});return T}},D=function(n,t,e){var r=n[t]&&"object"==typeof n[t][e]?n[t][e]:n[t]||n,o="string"==typeof r?r:r.type,i="object"==typeof r?Object.assign({},r):{};return v[o]?v[o](i):null},R=function(n,t,e){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];(t=Array.isArray(t)?t:[t]).forEach((function(t){n.forEach((function(n){var o=n,i=function(){return e[n]},u=function(t){return e[n]=t};"object"==typeof n&&(o=n.key,i=n.getter||i,u=n.setter||u),t[o]&&!r||(t[o]={get:i,set:u})}))}))},p=function(n){return null!=n},O={opacity:1,scaleX:1,scaleY:1,translateX:0,translateY:0,rotateX:0,rotateY:0,rotateZ:0,originX:0,originY:0},S=function(n,t){if(Object.keys(n).length!==Object.keys(t).length)return!0;for(var e in t)if(t[e]!==n[e])return!0;return!1},A=function(n,t){var e=t.opacity,r=t.perspective,o=t.translateX,i=t.translateY,u=t.scaleX,c=t.scaleY,a=t.rotateX,f=t.rotateY,l=t.rotateZ,E=t.originX,s=t.originY,_=t.width,T=t.height,I="",d="";(p(E)||p(s))&&(d+="transform-origin: "+(E||0)+"px "+(s||0)+"px;"),p(r)&&(I+="perspective("+r+"px) "),(p(o)||p(i))&&(I+="translate3d("+(o||0)+"px, "+(i||0)+"px, 0) "),(p(u)||p(c))&&(I+="scale3d("+(p(u)?u:1)+", "+(p(c)?c:1)+", 1) "),p(l)&&(I+="rotateZ("+l+"rad) "),p(a)&&(I+="rotateX("+a+"rad) "),p(f)&&(I+="rotateY("+f+"rad) "),I.length&&(d+="transform:"+I+";"),p(e)&&(d+="opacity:"+e+";",0===e&&(d+="visibility:hidden;"),e<1&&(d+="pointer-events:none;")),p(T)&&(d+="height:"+T+"px;"),p(_)&&(d+="width:"+_+"px;");var v=n.elementCurrentStyle||"";d.length===v.length&&d===v||(n.style.cssText=d,n.elementCurrentStyle=d)},M={styles:function(n){var t=n.mixinConfig,e=n.viewProps,r=n.viewInternalAPI,o=n.viewExternalAPI,i=n.view,u=Object.assign({},e),c={};R(t,[r,o],e);var a=function(){return i.rect?s(i.rect,i.childViews,[e.translateX||0,e.translateY||0],[e.scaleX||0,e.scaleY||0]):null};return r.rect={get:a},o.rect={get:a},t.forEach((function(n){e[n]=void 0===u[n]?O[n]:u[n]})),{write:function(){if(S(c,e))return A(i.element,e),Object.assign(c,Object.assign({},e)),!0},destroy:function(){}}},listeners:function(n){var t,e=n.viewExternalAPI,r=n.view,o=[],i=(t=r.element,function(n,e){t.addEventListener(n,e)}),u=function(n){return function(t,e){n.removeEventListener(t,e)}}(r.element);return e.on=function(n,t){o.push({type:n,fn:t}),i(n,t)},e.off=function(n,t){o.splice(o.findIndex((function(e){return e.type===n&&e.fn===t})),1),u(n,t)},{write:function(){return!0},destroy:function(){o.forEach((function(n){u(n.type,n.fn)}))}}},animations:function(n){var e=n.mixinConfig,r=n.viewProps,o=n.viewInternalAPI,i=n.viewExternalAPI,u=Object.assign({},r),c=[];return t(e,(function(n,t){var e=D(t);e&&(e.onupdate=function(t){r[n]=t},e.target=u[n],R([{key:n,setter:function(n){e.target!==n&&(e.target=n)},getter:function(){return r[n]}}],[o,i],r,!0),c.push(e))})),{write:function(n){var t=document.hidden,e=!0;return c.forEach((function(r){r.resting||(e=!1),r.interpolate(n,t)})),e},destroy:function(){}}},apis:function(n){R(n.mixinConfig,n.viewExternalAPI,n.viewProps)}},m=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.layoutCalculated||(n.paddingTop=parseInt(e.paddingTop,10)||0,n.marginTop=parseInt(e.marginTop,10)||0,n.marginRight=parseInt(e.marginRight,10)||0,n.marginBottom=parseInt(e.marginBottom,10)||0,n.marginLeft=parseInt(e.marginLeft,10)||0,t.layoutCalculated=!0),n.left=t.offsetLeft||0,n.top=t.offsetTop||0,n.width=t.offsetWidth||0,n.height=t.offsetHeight||0,n.right=n.left+n.width,n.bottom=n.top+n.height,n.scrollTop=t.scrollTop,n.hidden=null===t.offsetParent,n},L=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=n.tag,r=void 0===t?"div":t,o=n.name,i=void 0===o?null:o,f=n.attributes,l=void 0===f?{}:f,_=n.read,T=void 0===_?function(){}:_,I=n.write,d=void 0===I?function(){}:I,v=n.create,D=void 0===v?function(){}:v,R=n.destroy,p=void 0===R?function(){}:R,O=n.filterFrameActionsForChild,S=void 0===O?function(n,t){return t}:O,A=n.didCreateView,L=void 0===A?function(){}:A,g=n.didWriteView,P=void 0===g?function(){}:g,y=n.ignoreRect,b=void 0!==y&&y,G=n.ignoreRectUpdate,w=void 0!==G&&G,N=n.mixins,C=void 0===N?[]:N;return function(n){var t,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},f=u(r,"filepond--"+i,l),_=window.getComputedStyle(f,null),I=m(),v=null,R=!1,O=[],A=[],g={},y={},G=[d],N=[T],h=[p],U=function(){return f},B=function(){return O.concat()},F=function(){return v||(v=s(I,O,[0,0],[1,1]))},V={element:{get:U},style:{get:function(){return _}},childViews:{get:B}},j=Object.assign({},V,{rect:{get:F},ref:{get:function(){return g}},is:function(n){return i===n},appendChild:(t=f,function(n,e){void 0!==e&&t.children[e]?t.insertBefore(n,t.children[e]):t.appendChild(n)}),createChildView:function(n){return function(t,e){return t(n,e)}}(n),linkView:function(n){return O.push(n),n},unlinkView:function(n){O.splice(O.indexOf(n),1)},appendChildView:c(0,O),removeChildView:a(f,O),registerWriter:function(n){return G.push(n)},registerReader:function(n){return N.push(n)},registerDestroyer:function(n){return h.push(n)},invalidateLayout:function(){return f.layoutCalculated=!1},dispatch:n.dispatch,query:n.query}),x={element:{get:U},childViews:{get:B},rect:{get:F},resting:{get:function(){return R}},isRectIgnored:function(){return b},_read:function(){v=null,O.forEach((function(n){return n._read()})),!(w&&I.width&&I.height)&&m(I,f,_);var n={root:W,props:o,rect:I};N.forEach((function(t){return t(n)}))},_write:function(n,t,e){var r=0===t.length;return G.forEach((function(i){!1===i({props:o,root:W,actions:t,timestamp:n,shouldOptimize:e})&&(r=!1)})),A.forEach((function(t){!1===t.write(n)&&(r=!1)})),O.filter((function(n){return!!n.element.parentNode})).forEach((function(o){o._write(n,S(o,t),e)||(r=!1)})),O.forEach((function(o,i){o.element.parentNode||(W.appendChild(o.element,i),o._read(),o._write(n,S(o,t),e),r=!1)})),R=r,P({props:o,root:W,actions:t,timestamp:n}),r},_destroy:function(){A.forEach((function(n){return n.destroy()})),h.forEach((function(n){n({root:W,props:o})})),O.forEach((function(n){return n._destroy()}))}},Y=Object.assign({},V,{rect:{get:function(){return I}}});Object.keys(C).sort((function(n,t){return"styles"===n?1:"styles"===t?-1:0})).forEach((function(n){var t=M[n]({mixinConfig:C[n],viewProps:o,viewState:y,viewInternalAPI:j,viewExternalAPI:x,view:e(Y)});t&&A.push(t)}));var W=e(j);D({root:W,props:o});var H=E(f);return O.forEach((function(n,t){W.appendChild(n.element,H+t)})),L(W),e(x)}},g=function(n,t){return function(e){var r=e.root,o=e.props,i=e.actions,u=void 0===i?[]:i,c=e.timestamp,a=e.shouldOptimize;u.filter((function(t){return n[t.type]})).forEach((function(t){return n[t.type]({root:r,props:o,action:t.data,timestamp:c,shouldOptimize:a})})),t&&t({root:r,props:o,actions:u,timestamp:c,shouldOptimize:a})}},P=function(n,t){return t.parentNode.insertBefore(n,t)},y=function(n,t){return t.parentNode.insertBefore(n,t.nextSibling)},b=function(n){return Array.isArray(n)},G=function(n){return null==n},w=function(n){return n.trim()},N=function(n){return""+n},C=function(n){return"boolean"==typeof n},h=function(n){return C(n)?n:"true"===n},U=function(n){return"string"==typeof n},B=function(n){return I(n)?n:U(n)?N(n).replace(/[a-z]+/gi,""):0},F=function(n){return parseInt(B(n),10)},V=function(n){return parseFloat(B(n))},j=function(n){return I(n)&&isFinite(n)&&Math.floor(n)===n},x=function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;if(j(n))return n;var e=N(n).trim();return/MB$/i.test(e)?(e=e.replace(/MB$i/,"").trim(),F(e)*t*t):/KB/i.test(e)?(e=e.replace(/KB$i/,"").trim(),F(e)*t):F(e)},Y=function(n){return"function"==typeof n},W={process:"POST",patch:"PATCH",revert:"DELETE",fetch:"GET",restore:"GET",load:"GET"},H=function(n,t,e,r,o){if(null===t)return null;if("function"==typeof t)return t;var i={url:"GET"===e||"PATCH"===e?"?"+n+"=":"",method:e,headers:o,withCredentials:!1,timeout:r,onload:null,ondata:null,onerror:null};if(U(t))return i.url=t,i;if(Object.assign(i,t),U(i.headers)){var u=i.headers.split(/:(.+)/);i.headers={header:u[0],value:u[1]}}return i.withCredentials=h(i.withCredentials),i},q=function(n){return"object"==typeof n&&null!==n},X=function(n){return b(n)?"array":function(n){return null===n}(n)?"null":j(n)?"int":/^[0-9]+ ?(?:GB|MB|KB)$/gi.test(n)?"bytes":function(n){return q(n)&&U(n.url)&&q(n.process)&&q(n.revert)&&q(n.restore)&&q(n.fetch)}(n)?"api":typeof n},z={array:function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return G(n)?[]:b(n)?n:N(n).split(t).map(w).filter((function(n){return n.length}))},boolean:h,int:function(n){return"bytes"===X(n)?x(n):F(n)},number:V,float:V,bytes:x,string:function(n){return Y(n)?n:N(n)},function:function(n){return function(n){for(var t=self,e=n.split("."),r=null;r=e.shift();)if(!(t=t[r]))return null;return t}(n)},serverapi:function(n){return(r={}).url=U(e=n)?e:e.url||"",r.timeout=e.timeout?parseInt(e.timeout,10):0,r.headers=e.headers?e.headers:{},t(W,(function(n){r[n]=H(n,e[n],W[n],r.timeout,r.headers)})),r.process=e.process||U(e)||e.url?r.process:null,r.remove=e.remove||null,delete r.headers,r;var e,r},object:function(n){try{return JSON.parse(n.replace(/{\s*'/g,'{"').replace(/'\s*}/g,'"}').replace(/'\s*:/g,'":').replace(/:\s*'/g,':"').replace(/,\s*'/g,',"').replace(/'\s*,/g,'",'))}catch(n){return null}}},k=function(n,t,e){if(n===t)return n;var r=X(n);if(r!==e){var o=z[e](n);if(r=X(o),null===o)throw'Trying to assign value with incorrect type to "'+option+'", allowed type: "'+e+'"';n=o}return n},Q=function(n){var r={};return t(n,(function(t){var e,o,i,u=n[t];r[t]=(o=u[1],i=e=u[0],{enumerable:!0,get:function(){return i},set:function(n){i=k(n,e,o)}})})),e(r)},Z=function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-";return n.split(/(?=[A-Z])/).map((function(n){return n.toLowerCase()})).join(t)},$=function(n){return function(e,r,o){var i={};return t(n,(function(n){var t=Z(n,"_").toUpperCase();i["SET_"+t]=function(r){try{o.options[n]=r.value}catch(n){}e("DID_SET_"+t,{value:o.options[n]})}})),i}},K=function(n){return function(e){var r={};return t(n,(function(n){r["GET_"+Z(n,"_").toUpperCase()]=function(){return e.options[n]}})),r}},J=1,nn=2,tn=3,en=4,rn=5,on=function(){return Math.random().toString(36).substring(2,11)};function un(n,t){if(null==n)return{};var e,r,o=function(n,t){if(null==n)return{};var e,r,o={},i=Object.keys(n);for(r=0;r<i.length;r++)t.indexOf(e=i[r])>=0||(o[e]=n[e]);return o}(n,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(n);for(r=0;r<i.length;r++)t.indexOf(e=i[r])>=0||Object.prototype.propertyIsEnumerable.call(n,e)&&(o[e]=n[e])}return o}function cn(n){return function(n){if(Array.isArray(n)){for(var t=0,e=new Array(n.length);t<n.length;t++)e[t]=n[t];return e}}(n)||function(n){if(Symbol.iterator in Object(n)||"[object Arguments]"===Object.prototype.toString.call(n))return Array.from(n)}(n)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var an,fn,ln=function(n,t){return n.splice(t,1)},En=function(){var n=[],t=function(t,e){ln(n,n.findIndex((function(n){return n.event===t&&(n.cb===e||!e)})))},e=function(t,e,r){n.filter((function(n){return n.event===t})).map((function(n){return n.cb})).forEach((function(n){return function(n,t){t?n():document.hidden?Promise.resolve(1).then(n):setTimeout(n,0)}((function(){return n.apply(void 0,cn(e))}),r)}))};return{fireSync:function(n){for(var t=arguments.length,r=new Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];e(n,r,!0)},fire:function(n){for(var t=arguments.length,r=new Array(t>1?t-1:0),o=1;o<t;o++)r[o-1]=arguments[o];e(n,r,!1)},on:function(t,e){n.push({event:t,cb:e})},onOnce:function(e,r){n.push({event:e,cb:function(){t(e,r),r.apply(void 0,arguments)}})},off:t}},sn=function(n,t,e){Object.getOwnPropertyNames(n).filter((function(n){return!e.includes(n)})).forEach((function(e){return Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))},_n=["fire","process","revert","load","on","off","onOnce","retryLoad","extend","archive","archived","release","released","requestProcessing","freeze"],Tn=function(n){var t={};return sn(n,t,_n),t},In={INIT:1,IDLE:2,PROCESSING_QUEUED:9,PROCESSING:3,PROCESSING_COMPLETE:5,PROCESSING_ERROR:6,PROCESSING_REVERT_ERROR:10,LOADING:7,LOAD_ERROR:8},dn={INPUT:1,LIMBO:2,LOCAL:3},vn=function(n){return/[^0-9]+/.exec(n)},Dn=function(){return vn(1.1.toLocaleString())[0]},Rn={BOOLEAN:"boolean",INT:"int",NUMBER:"number",STRING:"string",ARRAY:"array",OBJECT:"object",FUNCTION:"function",ACTION:"action",SERVER_API:"serverapi",REGEX:"regex"},pn=[],On=function(n,t,e){return new Promise((function(r,o){var i=pn.filter((function(t){return t.key===n})).map((function(n){return n.cb}));if(0!==i.length){var u=i.shift();i.reduce((function(n,t){return n.then((function(n){return t(n,e)}))}),u(t,e)).then((function(n){return r(n)})).catch((function(n){return o(n)}))}else r(t)}))},Sn=function(n,t,e){return pn.filter((function(t){return t.key===n})).map((function(n){return n.cb(t,e)}))},An=function(n,t){return pn.push({key:n,cb:t})},Mn=function(){return Object.assign({},mn)},mn={id:[null,Rn.STRING],name:["filepond",Rn.STRING],disabled:[!1,Rn.BOOLEAN],className:[null,Rn.STRING],required:[!1,Rn.BOOLEAN],captureMethod:[null,Rn.STRING],allowSyncAcceptAttribute:[!0,Rn.BOOLEAN],allowDrop:[!0,Rn.BOOLEAN],allowBrowse:[!0,Rn.BOOLEAN],allowPaste:[!0,Rn.BOOLEAN],allowMultiple:[!1,Rn.BOOLEAN],allowReplace:[!0,Rn.BOOLEAN],allowRevert:[!0,Rn.BOOLEAN],allowRemove:[!0,Rn.BOOLEAN],allowProcess:[!0,Rn.BOOLEAN],allowReorder:[!1,Rn.BOOLEAN],allowDirectoriesOnly:[!1,Rn.BOOLEAN],storeAsFile:[!1,Rn.BOOLEAN],forceRevert:[!1,Rn.BOOLEAN],maxFiles:[null,Rn.INT],checkValidity:[!1,Rn.BOOLEAN],itemInsertLocationFreedom:[!0,Rn.BOOLEAN],itemInsertLocation:["before",Rn.STRING],itemInsertInterval:[75,Rn.INT],dropOnPage:[!1,Rn.BOOLEAN],dropOnElement:[!0,Rn.BOOLEAN],dropValidation:[!1,Rn.BOOLEAN],ignoredFiles:[[".ds_store","thumbs.db","desktop.ini"],Rn.ARRAY],instantUpload:[!0,Rn.BOOLEAN],maxParallelUploads:[2,Rn.INT],allowMinimumUploadDuration:[!0,Rn.BOOLEAN],chunkUploads:[!1,Rn.BOOLEAN],chunkForce:[!1,Rn.BOOLEAN],chunkSize:[5e6,Rn.INT],chunkRetryDelays:[[500,1e3,3e3],Rn.ARRAY],server:[null,Rn.SERVER_API],fileSizeBase:[1e3,Rn.INT],labelFileSizeBytes:["bytes",Rn.STRING],labelFileSizeKilobytes:["KB",Rn.STRING],labelFileSizeMegabytes:["MB",Rn.STRING],labelFileSizeGigabytes:["GB",Rn.STRING],labelDecimalSeparator:[Dn(),Rn.STRING],labelThousandsSeparator:[(an=Dn(),fn=1e3.toLocaleString(),fn!==1e3.toString()?vn(fn)[0]:"."===an?",":"."),Rn.STRING],labelIdle:['Drag & Drop your files or <span class="filepond--label-action">Browse</span>',Rn.STRING],labelInvalidField:["Field contains invalid files",Rn.STRING],labelFileWaitingForSize:["Waiting for size",Rn.STRING],labelFileSizeNotAvailable:["Size not available",Rn.STRING],labelFileCountSingular:["file in list",Rn.STRING],labelFileCountPlural:["files in list",Rn.STRING],labelFileLoading:["Loading",Rn.STRING],labelFileAdded:["Added",Rn.STRING],labelFileLoadError:["Error during load",Rn.STRING],labelFileRemoved:["Removed",Rn.STRING],labelFileRemoveError:["Error during remove",Rn.STRING],labelFileProcessing:["Uploading",Rn.STRING],labelFileProcessingComplete:["Upload complete",Rn.STRING],labelFileProcessingAborted:["Upload cancelled",Rn.STRING],labelFileProcessingError:["Error during upload",Rn.STRING],labelFileProcessingRevertError:["Error during revert",Rn.STRING],labelTapToCancel:["tap to cancel",Rn.STRING],labelTapToRetry:["tap to retry",Rn.STRING],labelTapToUndo:["tap to undo",Rn.STRING],labelButtonRemoveItem:["Remove",Rn.STRING],labelButtonAbortItemLoad:["Abort",Rn.STRING],labelButtonRetryItemLoad:["Retry",Rn.STRING],labelButtonAbortItemProcessing:["Cancel",Rn.STRING],labelButtonUndoItemProcessing:["Undo",Rn.STRING],labelButtonRetryItemProcessing:["Retry",Rn.STRING],labelButtonProcessItem:["Upload",Rn.STRING],iconRemove:['<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M11.586 13l-2.293 2.293a1 1 0 0 0 1.414 1.414L13 14.414l2.293 2.293a1 1 0 0 0 1.414-1.414L14.414 13l2.293-2.293a1 1 0 0 0-1.414-1.414L13 11.586l-2.293-2.293a1 1 0 0 0-1.414 1.414L11.586 13z" fill="currentColor" fill-rule="nonzero"/></svg>',Rn.STRING],iconProcess:['<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M14 10.414v3.585a1 1 0 0 1-2 0v-3.585l-1.293 1.293a1 1 0 0 1-1.414-1.415l3-3a1 1 0 0 1 1.414 0l3 3a1 1 0 0 1-1.414 1.415L14 10.414zM9 18a1 1 0 0 1 0-2h8a1 1 0 0 1 0 2H9z" fill="currentColor" fill-rule="evenodd"/></svg>',Rn.STRING],iconRetry:['<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M10.81 9.185l-.038.02A4.997 4.997 0 0 0 8 13.683a5 5 0 0 0 5 5 5 5 0 0 0 5-5 1 1 0 0 1 2 0A7 7 0 1 1 9.722 7.496l-.842-.21a.999.999 0 1 1 .484-1.94l3.23.806c.535.133.86.675.73 1.21l-.804 3.233a.997.997 0 0 1-1.21.73.997.997 0 0 1-.73-1.21l.23-.928v-.002z" fill="currentColor" fill-rule="nonzero"/></svg>',Rn.STRING],iconUndo:['<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M9.185 10.81l.02-.038A4.997 4.997 0 0 1 13.683 8a5 5 0 0 1 5 5 5 5 0 0 1-5 5 1 1 0 0 0 0 2A7 7 0 1 0 7.496 9.722l-.21-.842a.999.999 0 1 0-1.94.484l.806 3.23c.133.535.675.86 1.21.73l3.233-.803a.997.997 0 0 0 .73-1.21.997.997 0 0 0-1.21-.73l-.928.23-.002-.001z" fill="currentColor" fill-rule="nonzero"/></svg>',Rn.STRING],iconDone:['<svg width="26" height="26" viewBox="0 0 26 26" xmlns="http://www.w3.org/2000/svg"><path d="M18.293 9.293a1 1 0 0 1 1.414 1.414l-7.002 7a1 1 0 0 1-1.414 0l-3.998-4a1 1 0 1 1 1.414-1.414L12 15.586l6.294-6.293z" fill="currentColor" fill-rule="nonzero"/></svg>',Rn.STRING],oninit:[null,Rn.FUNCTION],onwarning:[null,Rn.FUNCTION],onerror:[null,Rn.FUNCTION],onactivatefile:[null,Rn.FUNCTION],oninitfile:[null,Rn.FUNCTION],onaddfilestart:[null,Rn.FUNCTION],onaddfileprogress:[null,Rn.FUNCTION],onaddfile:[null,Rn.FUNCTION],onprocessfilestart:[null,Rn.FUNCTION],onprocessfileprogress:[null,Rn.FUNCTION],onprocessfileabort:[null,Rn.FUNCTION],onprocessfilerevert:[null,Rn.FUNCTION],onprocessfile:[null,Rn.FUNCTION],onprocessfiles:[null,Rn.FUNCTION],onremovefile:[null,Rn.FUNCTION],onpreparefile:[null,Rn.FUNCTION],onupdatefiles:[null,Rn.FUNCTION],onreorderfiles:[null,Rn.FUNCTION],beforeDropFile:[null,Rn.FUNCTION],beforeAddFile:[null,Rn.FUNCTION],beforeRemoveFile:[null,Rn.FUNCTION],beforePrepareFile:[null,Rn.FUNCTION],stylePanelLayout:[null,Rn.STRING],stylePanelAspectRatio:[null,Rn.STRING],styleItemPanelAspectRatio:[null,Rn.STRING],styleButtonRemoveItemPosition:["left",Rn.STRING],styleButtonProcessItemPosition:["right",Rn.STRING],styleLoadIndicatorPosition:["right",Rn.STRING],styleProgressIndicatorPosition:["right",Rn.STRING],styleButtonRemoveItemAlign:[!1,Rn.BOOLEAN],files:[[],Rn.ARRAY],credits:[["https://pqina.nl/","Powered by PQINA"],Rn.ARRAY]},Ln=function(n,t){return G(t)?n[0]||null:j(t)?n[t]||null:("object"==typeof t&&(t=t.id),n.find((function(n){return n.id===t}))||null)},gn=function(n){if(G(n))return n;if(/:/.test(n)){var t=n.split(":");return t[1]/t[0]}return parseFloat(n)},Pn=function(n){return n.filter((function(n){return!n.archived}))},yn={EMPTY:0,IDLE:1,ERROR:2,BUSY:3,READY:4},bn=null,Gn=[In.LOAD_ERROR,In.PROCESSING_ERROR,In.PROCESSING_REVERT_ERROR],wn=[In.LOADING,In.PROCESSING,In.PROCESSING_QUEUED,In.INIT],Nn=[In.PROCESSING_COMPLETE],Cn=function(n){return Gn.includes(n.status)},hn=function(n){return wn.includes(n.status)},Un=function(n){return Nn.includes(n.status)},Bn=function(n){return q(n.options.server)&&(q(n.options.server.process)||Y(n.options.server.process))},Fn=function(n){return{GET_STATUS:function(){var t=Pn(n.items),e=yn.ERROR,r=yn.BUSY,o=yn.IDLE,i=yn.READY;return 0===t.length?yn.EMPTY:t.some(Cn)?e:t.some(hn)?r:t.some(Un)?i:o},GET_ITEM:function(t){return Ln(n.items,t)},GET_ACTIVE_ITEM:function(t){return Ln(Pn(n.items),t)},GET_ACTIVE_ITEMS:function(){return Pn(n.items)},GET_ITEMS:function(){return n.items},GET_ITEM_NAME:function(t){var e=Ln(n.items,t);return e?e.filename:null},GET_ITEM_SIZE:function(t){var e=Ln(n.items,t);return e?e.fileSize:null},GET_STYLES:function(){return Object.keys(n.options).filter((function(n){return/^style/.test(n)})).map((function(t){return{name:t,value:n.options[t]}}))},GET_PANEL_ASPECT_RATIO:function(){return/circle/.test(n.options.stylePanelLayout)?1:gn(n.options.stylePanelAspectRatio)},GET_ITEM_PANEL_ASPECT_RATIO:function(){return n.options.styleItemPanelAspectRatio},GET_ITEMS_BY_STATUS:function(t){return Pn(n.items).filter((function(n){return n.status===t}))},GET_TOTAL_ITEMS:function(){return Pn(n.items).length},SHOULD_UPDATE_FILE_INPUT:function(){return n.options.storeAsFile&&function(){if(null===bn)try{var n=new DataTransfer;n.items.add(new File(["hello world"],"This_Works.txt"));var t=document.createElement("input");t.setAttribute("type","file"),t.files=n.files,bn=1===t.files.length}catch(n){bn=!1}return bn}()&&!Bn(n)},IS_ASYNC:function(){return Bn(n)},GET_FILE_SIZE_LABELS:function(n){return{labelBytes:n("GET_LABEL_FILE_SIZE_BYTES")||void 0,labelKilobytes:n("GET_LABEL_FILE_SIZE_KILOBYTES")||void 0,labelMegabytes:n("GET_LABEL_FILE_SIZE_MEGABYTES")||void 0,labelGigabytes:n("GET_LABEL_FILE_SIZE_GIGABYTES")||void 0}}}},Vn=function(n,t,e){return Math.max(Math.min(e,n),t)},jn=function(n){return/^\s*data:([a-z]+\/[a-z0-9-+.]+(;[a-z-]+=[a-z0-9-]+)?)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s]*)\s*$/i.test(n)},xn=function(n){return(""+n).split("/").pop().split("?").shift()},Yn=function(n){return n.split(".").pop()},Wn=function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return(t+n).slice(-t.length)},Hn=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date;return n.getFullYear()+"-"+Wn(n.getMonth()+1,"00")+"-"+Wn(n.getDate(),"00")+"_"+Wn(n.getHours(),"00")+"-"+Wn(n.getMinutes(),"00")+"-"+Wn(n.getSeconds(),"00")},qn=function(n,t){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,o=n.slice(0,n.size,"string"==typeof e?e:n.type);return o.lastModifiedDate=new Date,n._relativePath&&(o._relativePath=n._relativePath),U(t)||(t=Hn()),t&&null===r&&Yn(t)?o.name=t:(r=r||function(n){if("string"!=typeof n)return"";var t=n.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},Xn=function(n,t){var e=window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder;if(e){var r=new e;return r.append(n),r.getBlob(t)}return new Blob([n],{type:t})},zn=function(n){return(/^data:(.+);/.exec(n)||[])[1]||null},kn=function(n){var t=zn(n),e=function(n){return atob(function(n){return n.split(",")[1].replace(/\s/g,"")}(n))}(n);return function(n,t){for(var e=new ArrayBuffer(n.length),r=new Uint8Array(e),o=0;o<n.length;o++)r[o]=n.charCodeAt(o);return Xn(e,t)}(e,t)},Qn=function(n){if(!/^content-disposition:/i.test(n))return null;var t=n.split(/filename=|filename\*=.+''/).splice(1).map((function(n){return n.trim().replace(/^["']|[;"']{0,2}$/g,"")})).filter((function(n){return n.length}));return t.length?decodeURI(t[t.length-1]):null},Zn=function(n){if(/content-length:/i.test(n)){var t=n.match(/[0-9]+/)[0];return t?parseInt(t,10):null}return null},$n=function(n){return/x-content-transfer-id:/i.test(n)&&(n.split(":")[1]||"").trim()||null},Kn=function(n){var t={source:null,name:null,size:null},e=n.split("\n"),r=!0,o=!1,i=void 0;try{for(var u,c=e[Symbol.iterator]();!(r=(u=c.next()).done);r=!0){var a=u.value,f=Qn(a);if(f)t.name=f;else{var l=Zn(a);if(l)t.size=l;else{var E=$n(a);E&&(t.source=E)}}}}catch(n){o=!0,i=n}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}return t},Jn=function(n){var t={source:null,complete:!1,progress:0,size:null,timestamp:null,duration:0,request:null},e=function(e){n?(t.timestamp=Date.now(),t.request=n(e,(function(n){t.duration=Date.now()-t.timestamp,t.complete=!0,n instanceof Blob&&(n=qn(n,n.name||xn(e))),r.fire("load",n instanceof Blob?n:n?n.body:null)}),(function(n){r.fire("error","string"==typeof n?{type:"error",code:0,body:n}:n)}),(function(n,e,o){o&&(t.size=o),t.duration=Date.now()-t.timestamp,n?(t.progress=e/o,r.fire("progress",t.progress)):t.progress=null}),(function(){r.fire("abort")}),(function(n){var e=Kn("string"==typeof n?n:n.headers);r.fire("meta",{size:t.size||e.size,filename:e.name,source:e.source})}))):r.fire("error",{type:"error",body:"Can't load URL",code:400})},r=Object.assign({},En(),{setSource:function(n){return t.source=n},getProgress:function(){return t.progress},abort:function(){t.request&&t.request.abort&&t.request.abort()},load:function(){var n,o,i=t.source;r.fire("init",i),i instanceof File?r.fire("load",i):i instanceof Blob?r.fire("load",qn(i,i.name)):jn(i)?r.fire("load",qn(kn(i),n,null,o)):e(i)}});return r},nt=function(n){return/GET|HEAD/.test(n)},tt=function(n,t,e){var r={onheaders:function(){},onprogress:function(){},onload:function(){},ontimeout:function(){},onerror:function(){},onabort:function(){},abort:function(){o=!0,u.abort()}},o=!1,i=!1;e=Object.assign({method:"POST",headers:{},withCredentials:!1},e),t=encodeURI(t),nt(e.method)&&n&&(t=""+t+encodeURIComponent("string"==typeof n?n:JSON.stringify(n)));var u=new XMLHttpRequest;return(nt(e.method)?u:u.upload).onprogress=function(n){o||r.onprogress(n.lengthComputable,n.loaded,n.total)},u.onreadystatechange=function(){u.readyState<2||4===u.readyState&&0===u.status||i||(i=!0,r.onheaders(u))},u.onload=function(){u.status>=200&&u.status<300?r.onload(u):r.onerror(u)},u.onerror=function(){return r.onerror(u)},u.onabort=function(){o=!0,r.onabort()},u.ontimeout=function(){return r.ontimeout(u)},u.open(e.method,t,!0),j(e.timeout)&&(u.timeout=e.timeout),Object.keys(e.headers).forEach((function(n){var t=unescape(encodeURIComponent(e.headers[n]));u.setRequestHeader(n,t)})),e.responseType&&(u.responseType=e.responseType),e.withCredentials&&(u.withCredentials=!0),u.send(n),r},et=function(n,t,e,r){return{type:n,code:t,body:e,headers:r}},rt=function(n){return function(t){n(et("error",0,"Timeout",t.getAllResponseHeaders()))}},ot=function(n){return/\?/.test(n)},it=function(){for(var n="",t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return e.forEach((function(t){n+=ot(n)&&ot(t)?t.replace(/\?/,"&"):t})),n},ut=function(){var n=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||!U(t.url))return null;var e=t.onload||function(n){return n},r=t.onerror||function(){return null};return function(o,i,u,c,a,f){var l=tt(o,it(n,t.url),Object.assign({},t,{responseType:"blob"}));return l.onload=function(n){var r=n.getAllResponseHeaders(),u=Kn(r).name||xn(o);i(et("load",n.status,"HEAD"===t.method?null:qn(e(n.response),u),r))},l.onerror=function(n){u(et("error",n.status,r(n.response)||n.statusText,n.getAllResponseHeaders()))},l.onheaders=function(n){f(et("headers",n.status,null,n.getAllResponseHeaders()))},l.ontimeout=rt(u),l.onprogress=c,l.onabort=a,l}},ct=0,at=1,ft=2,lt=3,Et=4,st=function(n,t,e,r,o,i,u,c,a,f,l){for(var E=[],s=l.chunkServer,_=l.chunkSize,T=l.chunkRetryDelays,I={serverId:l.chunkTransferId,aborted:!1},d=t.ondata||function(n){return n},v=t.onload||function(n,t){return"HEAD"===t?n.getResponseHeader("Upload-Offset"):n.response},D=t.onerror||function(){return null},R=Math.floor(r.size/_),p=0;p<=R;p++){var O=p*_,S=r.slice(O,O+_,"application/offset+octet-stream");E[p]={index:p,size:S.size,offset:O,data:S,file:r,progress:0,retries:cn(T),status:ct,error:null,request:null,timeout:null}}var A,M,m,L,g=function(n){return n.status===ct||n.status===lt},P=function(t){if(!I.aborted)if(t=t||E.find(g)){t.status=ft,t.progress=null;var e=s.ondata||function(n){return n},o=s.onerror||function(){return null},c=s.onload||function(){},f=it(n,s.url,I.serverId),l="function"==typeof s.headers?s.headers(t):Object.assign({},s.headers,{"Content-Type":"application/offset+octet-stream","Upload-Offset":t.offset,"Upload-Length":r.size,"Upload-Name":r.name}),_=t.request=tt(e(t.data),f,Object.assign({},s,{headers:l}));_.onload=function(n){c(n,t.index,E.length),t.status=at,t.request=null,G()},_.onprogress=function(n,e){t.progress=n?e:null,b()},_.onerror=function(n){t.status=lt,t.request=null,t.error=o(n.response)||n.statusText,y(t)||u(et("error",n.status,o(n.response)||n.statusText,n.getAllResponseHeaders()))},_.ontimeout=function(n){t.status=lt,t.request=null,y(t)||rt(u)(n)},_.onabort=function(){t.status=ct,t.request=null,a()}}else E.every((function(n){return n.status===at}))&&i(I.serverId)},y=function(n){return 0!==n.retries.length&&(n.status=Et,clearTimeout(n.timeout),n.timeout=setTimeout((function(){P(n)}),n.retries.shift()),!0)},b=function(){var n=E.reduce((function(n,t){return null===n||null===t.progress?null:n+t.progress}),0);if(null===n)return c(!1,0,0);var t=E.reduce((function(n,t){return n+t.size}),0);c(!0,n,t)},G=function(){E.filter((function(n){return n.status===ft})).length>=1||P()};return I.serverId?(A=function(n){I.aborted||(E.filter((function(t){return t.offset<n})).forEach((function(n){n.status=at,n.progress=n.size})),G())},M=it(n,s.url,I.serverId),m={headers:"function"==typeof t.headers?t.headers(I.serverId):Object.assign({},t.headers),method:"HEAD"},(L=tt(null,M,m)).onload=function(n){return A(v(n,m.method))},L.onerror=function(n){return u(et("error",n.status,D(n.response)||n.statusText,n.getAllResponseHeaders()))},L.ontimeout=rt(u)):function(i){var c=new FormData;q(o)&&c.append(e,JSON.stringify(o));var a="function"==typeof t.headers?t.headers(r,o):Object.assign({},t.headers,{"Upload-Length":r.size}),f=Object.assign({},t,{headers:a}),l=tt(d(c),it(n,t.url),f);l.onload=function(n){return i(v(n,f.method))},l.onerror=function(n){return u(et("error",n.status,D(n.response)||n.statusText,n.getAllResponseHeaders()))},l.ontimeout=rt(u)}((function(n){I.aborted||(f(n),I.serverId=n,G())})),{abort:function(){I.aborted=!0,E.forEach((function(n){clearTimeout(n.timeout),n.request&&n.request.abort()}))}}},_t=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,e=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;return"function"==typeof t?function(){for(var n=arguments.length,o=new Array(n),i=0;i<n;i++)o[i]=arguments[i];return t.apply(void 0,[e].concat(o,[r]))}:t&&U(t.url)?function(n,t,e,r){return function(o,i,u,c,a,f,l){if(o){var E=r.chunkUploads;if(o instanceof Blob&&E&&(E&&o.size>r.chunkSize||r.chunkForce))return st(n,t,e,o,i,u,c,a,f,l,r);var s=t.ondata||function(n){return n},_=t.onload||function(n){return n},T=t.onerror||function(){return null},I="function"==typeof t.headers?t.headers(o,i)||{}:Object.assign({},t.headers),d=Object.assign({},t,{headers:I}),v=new FormData;q(i)&&v.append(e,JSON.stringify(i)),(o instanceof Blob?[{name:null,file:o}]:o).forEach((function(n){v.append(e,n.file,null===n.name?n.file.name:""+n.name+n.file.name)}));var D=tt(s(v),it(n,t.url),d);return D.onload=function(n){u(et("load",n.status,_(n.response),n.getAllResponseHeaders()))},D.onerror=function(n){c(et("error",n.status,T(n.response)||n.statusText,n.getAllResponseHeaders()))},D.ontimeout=rt(c),D.onprogress=a,D.onabort=f,D}}}(n,t,e,r):null},Tt=function(){var n=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||!U(t.url))return function(n,t){return t()};var e=t.onload||function(n){return n},r=t.onerror||function(){return null};return function(o,i,u){var c=tt(o,n+t.url,t);return c.onload=function(n){i(et("load",n.status,e(n.response),n.getAllResponseHeaders()))},c.onerror=function(n){u(et("error",n.status,r(n.response)||n.statusText,n.getAllResponseHeaders()))},c.ontimeout=rt(u),c}},It=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return n+Math.random()*(t-n)},dt=function(n,t){var e={complete:!1,perceivedProgress:0,perceivedPerformanceUpdater:null,progress:null,timestamp:null,perceivedDuration:0,duration:0,request:null,response:null},r=t.allowMinimumUploadDuration,o=function(){e.request&&(e.perceivedPerformanceUpdater.clear(),e.request.abort&&e.request.abort(),e.complete=!0)},i=r?function(){return e.progress?Math.min(e.progress,e.perceivedProgress):null}:function(){return e.progress||null},u=r?function(){return Math.min(e.duration,e.perceivedDuration)}:function(){return e.duration},c=Object.assign({},En(),{process:function(t,o){var i=function(){0!==e.duration&&null!==e.progress&&c.fire("progress",c.getProgress())},u=function(){e.complete=!0,c.fire("load-perceived",e.response.body)};c.fire("start"),e.timestamp=Date.now(),e.perceivedPerformanceUpdater=function(n){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,e=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 t>0&&function u(){var c=Date.now()-i,a=It(e,r);c+a>t&&(a=c+a-t);var f=c/t;f>=1||document.hidden?n(1):(n(f),o=setTimeout(u,a))}(),{clear:function(){clearTimeout(o)}}}((function(n){e.perceivedProgress=n,e.perceivedDuration=Date.now()-e.timestamp,i(),e.response&&1===e.perceivedProgress&&!e.complete&&u()}),r?It(750,1500):0),e.request=n(t,o,(function(n){e.response=q(n)?n:{type:"load",code:200,body:""+n,headers:{}},e.duration=Date.now()-e.timestamp,e.progress=1,c.fire("load",e.response.body),(!r||r&&1===e.perceivedProgress)&&u()}),(function(n){e.perceivedPerformanceUpdater.clear(),c.fire("error",q(n)?n:{type:"error",code:0,body:""+n})}),(function(n,t,r){e.duration=Date.now()-e.timestamp,e.progress=n?t/r:null,i()}),(function(){e.perceivedPerformanceUpdater.clear(),c.fire("abort",e.response?e.response.body:null)}),(function(n){c.fire("transfer",n)}))},abort:o,getProgress:i,getDuration:u,reset:function(){o(),e.complete=!1,e.perceivedProgress=0,e.progress=0,e.timestamp=null,e.perceivedDuration=0,e.duration=0,e.request=null,e.response=null}});return c},vt=function(n){return n.substring(0,n.lastIndexOf("."))||n},Dt=function(n){return!!(n instanceof File||n instanceof Blob&&n.name)},Rt=function n(t){if(!q(t))return t;var e=b(t)?[]:{};for(var r in t)if(t.hasOwnProperty(r)){var o=t[r];e[r]=o&&q(o)?n(o):o}return e},pt=function(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,o=on(),i={archived:!1,frozen:!1,released:!1,source:null,file:r,serverFileReference:t,transferId:null,processingAborted:!1,status:t?In.PROCESSING_COMPLETE:In.INIT,activeLoader:null,activeProcessor:null},u=null,c={},a=function(n){return i.status=n},f=function(n){if(!i.released&&!i.frozen){for(var t=arguments.length,e=new Array(t>1?t-1:0),r=1;r<t;r++)e[r-1]=arguments[r];E.fire.apply(E,[n].concat(e))}},l=function(n,t,e){var r=n.split("."),o=r[0],i=r.pop(),u=c;r.forEach((function(n){return u=u[n]})),JSON.stringify(u[i])!==JSON.stringify(t)&&(u[i]=t,f("metadata-update",{key:o,value:c[o],silent:e}))},E=Object.assign({id:{get:function(){return o}},origin:{get:function(){return n},set:function(t){return n=t}},serverId:{get:function(){return i.serverFileReference}},transferId:{get:function(){return i.transferId}},status:{get:function(){return i.status}},filename:{get:function(){return i.file.name}},filenameWithoutExtension:{get:function(){return vt(i.file.name)}},fileExtension:{get:function(){return Yn(i.file.name)}},fileType:{get:function(){return i.file.type}},fileSize:{get:function(){return i.file.size}},file:{get:function(){return i.file}},relativePath:{get:function(){return i.file._relativePath}},source:{get:function(){return i.source}},getMetadata:function(n){return Rt(n?c[n]:c)},setMetadata:function(n,t,e){if(q(n)){var r=n;return Object.keys(r).forEach((function(n){l(n,r[n],t)})),n}return l(n,t,e),t},extend:function(n,t){return s[n]=t},abortLoad:function(){i.activeLoader?i.activeLoader.abort():(a(In.INIT),f("load-abort"))},retryLoad:function(){i.activeLoader&&i.activeLoader.load()},requestProcessing:function(){i.processingAborted=!1,a(In.PROCESSING_QUEUED)},abortProcessing:function(){return new Promise((function(n){if(!i.activeProcessor)return i.processingAborted=!0,a(In.IDLE),f("process-abort"),void n();u=function(){n()},i.activeProcessor.abort()}))},load:function(t,e,r){i.source=t,E.fireSync("init"),i.file?E.fireSync("load-skip"):(i.file=function(n){var t=[n.name,n.size,n.type];return n instanceof Blob||jn(n)?t[0]=n.name||Hn():jn(n)?(t[1]=n.length,t[2]=zn(n)):U(n)&&(t[0]=xn(n),t[1]=0,t[2]="application/octet-stream"),{name:t[0],size:t[1],type:t[2]}}(t),e.on("init",(function(){f("load-init")})),e.on("meta",(function(t){i.file.size=t.size,i.file.filename=t.filename,t.source&&(n=dn.LIMBO,i.serverFileReference=t.source,i.status=In.PROCESSING_COMPLETE),f("load-meta")})),e.on("progress",(function(n){a(In.LOADING),f("load-progress",n)})),e.on("error",(function(n){a(In.LOAD_ERROR),f("load-request-error",n)})),e.on("abort",(function(){a(In.INIT),f("load-abort")})),e.on("load",(function(t){i.activeLoader=null;var e=function(t){i.file=Dt(t)?t:i.file,a(n===dn.LIMBO&&i.serverFileReference?In.PROCESSING_COMPLETE:In.IDLE),f("load")};i.serverFileReference?e(t):r(t,e,(function(n){i.file=t,f("load-meta"),a(In.LOAD_ERROR),f("load-file-error",n)}))})),e.setSource(t),i.activeLoader=e,e.load())},process:function n(t,e){if(i.processingAborted)i.processingAborted=!1;else if(a(In.PROCESSING),u=null,i.file instanceof Blob){t.on("load",(function(n){i.transferId=null,i.serverFileReference=n})),t.on("transfer",(function(n){i.transferId=n})),t.on("load-perceived",(function(n){i.activeProcessor=null,i.transferId=null,i.serverFileReference=n,a(In.PROCESSING_COMPLETE),f("process-complete",n)})),t.on("start",(function(){f("process-start")})),t.on("error",(function(n){i.activeProcessor=null,a(In.PROCESSING_ERROR),f("process-error",n)})),t.on("abort",(function(n){i.activeProcessor=null,i.serverFileReference=n,a(In.IDLE),f("process-abort"),u&&u()})),t.on("progress",(function(n){f("process-progress",n)}));var r=console.error;e(i.file,(function(n){i.archived||t.process(n,Object.assign({},c))}),r),i.activeProcessor=t}else E.on("load",(function(){n(t,e)}))},revert:function(n,t){return new Promise((function(e,r){var o=null!==i.serverFileReference?i.serverFileReference:i.transferId;null!==o?(n(o,(function(){i.serverFileReference=null,i.transferId=null,e()}),(function(n){t?(a(In.PROCESSING_REVERT_ERROR),f("process-revert-error"),r(n)):e()})),a(In.IDLE),f("process-revert")):e()}))}},En(),{freeze:function(){return i.frozen=!0},release:function(){return i.released=!0},released:{get:function(){return i.released}},archive:function(){return i.archived=!0},archived:{get:function(){return i.archived}},setFile:function(n){return i.file=n}}),s=e(E);return s},Ot=function(n,t){var e=function(n,t){return G(t)?0:U(t)?n.findIndex((function(n){return n.id===t})):-1}(n,t);if(!(e<0))return n[e]||null},St=function(n,t,e,r,o,i){var u=tt(null,n,{method:"GET",responseType:"blob"});return u.onload=function(e){var r=e.getAllResponseHeaders(),o=Kn(r).name||xn(n);t(et("load",e.status,qn(e.response,o),r))},u.onerror=function(n){e(et("error",n.status,n.statusText,n.getAllResponseHeaders()))},u.onheaders=function(n){i(et("headers",n.status,null,n.getAllResponseHeaders()))},u.ontimeout=rt(e),u.onprogress=r,u.onabort=o,u},At=function(n){return 0===n.indexOf("//")&&(n=location.protocol+n),n.toLowerCase().replace("blob:","").replace(/([a-z])?:\/\//,"$1").split("/")[0]},Mt=function(n){return function(){return Y(n)?n.apply(void 0,arguments):n}},mt=function(n,t){clearTimeout(t.listUpdateTimeout),t.listUpdateTimeout=setTimeout((function(){n("DID_UPDATE_ITEMS",{items:Pn(t.items)})}),0)},Lt=function(n){for(var t=arguments.length,e=new Array(t>1?t-1:0),r=1;r<t;r++)e[r-1]=arguments[r];return new Promise((function(t){if(!n)return t(!0);var r=n.apply(void 0,e);return null==r?t(!0):"boolean"==typeof r?t(r):void("function"==typeof r.then&&r.then(t))}))},gt=function(n,t){n.items.sort((function(n,e){return t(Tn(n),Tn(e))}))},Pt=function(n,t){return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=e.query,o=e.success,i=void 0===o?function(){}:o,u=e.failure,c=void 0===u?function(){}:u,a=un(e,["query","success","failure"]),f=Ln(n.items,r);f?t(f,i,c,a||{}):c({error:et("error",0,"Item not found"),file:null})}},yt=function(n,t,e){return{ABORT_ALL:function(){Pn(e.items).forEach((function(n){n.freeze(),n.abortLoad(),n.abortProcessing()}))},DID_SET_FILES:function(t){var r=t.value,o=(void 0===r?[]:r).map((function(n){return{source:n.source?n.source:n,options:n.options}})),i=Pn(e.items);i.forEach((function(t){o.find((function(n){return n.source===t.source||n.source===t.file}))||n("REMOVE_ITEM",{query:t,remove:!1})})),i=Pn(e.items),o.forEach((function(t,e){i.find((function(n){return n.source===t.source||n.file===t.source}))||n("ADD_ITEM",Object.assign({},t,{interactionMethod:rn,index:e}))}))},DID_UPDATE_ITEM_METADATA:function(r){var o=r.id,i=r.action,u=r.change;u.silent||(clearTimeout(e.itemUpdateTimeout),e.itemUpdateTimeout=setTimeout((function(){var r,c=Ot(e.items,o);if(t("IS_ASYNC")){c.origin===dn.LOCAL&&n("DID_LOAD_ITEM",{id:c.id,error:null,serverFileReference:c.source});var a=function(){setTimeout((function(){n("REQUEST_ITEM_PROCESSING",{query:o})}),32)};return c.status===In.PROCESSING_COMPLETE?(r=e.options.instantUpload,void c.revert(Tt(e.options.server.url,e.options.server.revert),t("GET_FORCE_REVERT")).then(r?a:function(){}).catch((function(){}))):c.status===In.PROCESSING?function(n){c.abortProcessing().then(n?a:function(){})}(e.options.instantUpload):void(e.options.instantUpload&&a())}On("SHOULD_PREPARE_OUTPUT",!1,{item:c,query:t,action:i,change:u}).then((function(e){var r=t("GET_BEFORE_PREPARE_FILE");r&&(e=r(c,e)),e&&n("REQUEST_PREPARE_OUTPUT",{query:o,item:c,success:function(t){n("DID_PREPARE_OUTPUT",{id:o,file:t})}},!0)}))}),0))},MOVE_ITEM:function(n){var t=n.index,r=Ln(e.items,n.query);if(r){var o=e.items.indexOf(r);o!==(t=Vn(t,0,e.items.length-1))&&e.items.splice(t,0,e.items.splice(o,1)[0])}},SORT:function(r){gt(e,r.compare),n("DID_SORT_ITEMS",{items:t("GET_ACTIVE_ITEMS")})},ADD_ITEMS:function(e){var r=e.items,o=e.index,i=e.interactionMethod,u=e.success,c=void 0===u?function(){}:u,a=e.failure,f=void 0===a?function(){}:a,l=o;if(-1===o||void 0===o){var E=t("GET_ITEM_INSERT_LOCATION"),s=t("GET_TOTAL_ITEMS");l="before"===E?0:s}var _=t("GET_IGNORED_FILES"),T=r.filter((function(n){return Dt(n)?!_.includes(n.name.toLowerCase()):!G(n)})).map((function(t){return new Promise((function(e,r){n("ADD_ITEM",{interactionMethod:i,source:t.source||t,success:e,failure:r,index:l++,options:t.options||{}})}))}));Promise.all(T).then(c).catch(f)},ADD_ITEM:function(r){var o=r.source,i=r.index,u=void 0===i?-1:i,c=r.interactionMethod,a=r.success,f=void 0===a?function(){}:a,l=r.failure,E=void 0===l?function(){}:l,s=r.options,_=void 0===s?{}:s;if(G(o))E({error:et("error",0,"No source"),file:null});else if(!Dt(o)||!e.options.ignoredFiles.includes(o.name.toLowerCase())){if(!function(n){var t=Pn(n.items).length;if(!n.options.allowMultiple)return 0===t;var e=n.options.maxFiles;return null===e||t<e}(e)){if(e.options.allowMultiple||!e.options.allowMultiple&&!e.options.allowReplace){var T=et("warning",0,"Max files");return n("DID_THROW_MAX_FILES",{source:o,error:T}),void E({error:T,file:null})}var I=Pn(e.items)[0];if(I.status===In.PROCESSING_COMPLETE||I.status===In.PROCESSING_REVERT_ERROR){var d=t("GET_FORCE_REVERT");if(I.revert(Tt(e.options.server.url,e.options.server.revert),d).then((function(){d&&n("ADD_ITEM",{source:o,index:u,interactionMethod:c,success:f,failure:E,options:_})})).catch((function(){})),d)return}n("REMOVE_ITEM",{query:I.id})}var v="local"===_.type?dn.LOCAL:"limbo"===_.type?dn.LIMBO:dn.INPUT,D=pt(v,v===dn.INPUT?null:o,_.file);Object.keys(_.metadata||{}).forEach((function(n){D.setMetadata(n,_.metadata[n])})),Sn("DID_CREATE_ITEM",D,{query:t,dispatch:n});var R=t("GET_ITEM_INSERT_LOCATION");e.options.itemInsertLocationFreedom||(u="before"===R?-1:e.items.length),function(n,t,e){G(t)||(void 0===e?n.push(t):function(n,t,e){n.splice(t,0,e)}(n,e=Vn(e,0,n.length),t))}(e.items,D,u),Y(R)&&o&&gt(e,R);var p=D.id;D.on("init",(function(){n("DID_INIT_ITEM",{id:p})})),D.on("load-init",(function(){n("DID_START_ITEM_LOAD",{id:p})})),D.on("load-meta",(function(){n("DID_UPDATE_ITEM_META",{id:p})})),D.on("load-progress",(function(t){n("DID_UPDATE_ITEM_LOAD_PROGRESS",{id:p,progress:t})})),D.on("load-request-error",(function(t){var r=Mt(e.options.labelFileLoadError)(t);if(t.code>=400&&t.code<500)return n("DID_THROW_ITEM_INVALID",{id:p,error:t,status:{main:r,sub:t.code+" ("+t.body+")"}}),void E({error:t,file:Tn(D)});n("DID_THROW_ITEM_LOAD_ERROR",{id:p,error:t,status:{main:r,sub:e.options.labelTapToRetry}})})),D.on("load-file-error",(function(t){n("DID_THROW_ITEM_INVALID",{id:p,error:t.status,status:t.status}),E({error:t.status,file:Tn(D)})})),D.on("load-abort",(function(){n("REMOVE_ITEM",{query:p})})),D.on("load-skip",(function(){D.on("metadata-update",(function(t){Dt(D.file)&&n("DID_UPDATE_ITEM_METADATA",{id:p,change:t})})),n("COMPLETE_LOAD_ITEM",{query:p,item:D,data:{source:o,success:f}})})),D.on("load",(function(){var r=function(r){r?(D.on("metadata-update",(function(t){n("DID_UPDATE_ITEM_METADATA",{id:p,change:t})})),On("SHOULD_PREPARE_OUTPUT",!1,{item:D,query:t}).then((function(r){var i=t("GET_BEFORE_PREPARE_FILE");i&&(r=i(D,r));var u=function(){n("COMPLETE_LOAD_ITEM",{query:p,item:D,data:{source:o,success:f}}),mt(n,e)};r?n("REQUEST_PREPARE_OUTPUT",{query:p,item:D,success:function(t){n("DID_PREPARE_OUTPUT",{id:p,file:t}),u()}},!0):u()}))):n("REMOVE_ITEM",{query:p})};On("DID_LOAD_ITEM",D,{query:t,dispatch:n}).then((function(){Lt(t("GET_BEFORE_ADD_FILE"),Tn(D)).then(r)})).catch((function(t){if(!t||!t.error||!t.status)return r(!1);n("DID_THROW_ITEM_INVALID",{id:p,error:t.error,status:t.status})}))})),D.on("process-start",(function(){n("DID_START