!function(){function e(e){return e&&e.__esModule?e.default:e} /*! * FilePondPluginImageValidateSize 1.0.4 * Licensed under MIT, https://opensource.org/licenses/MIT/ * Please visit https://pqina.nl/filepond/ for details. */var t;t=function(){"use strict";var e,t,i,n;Array.prototype.find||Object.defineProperty(Array.prototype,"find",{value:function(e){if(null==this)throw new TypeError('"this" is null or not defined');var t=Object(this),i=t.length>>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var n=arguments[1],r=0;r>>0;if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var n=arguments[1],r=0;r0?1:-1)*Math.floor(Math.abs(t)):t}(e);return Math.min(Math.max(t,0),i)},function(e){var i=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var r,o=arguments.length>1?arguments[1]:void 0;if(void 0!==o){if(!t(o))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(r=arguments[2])}for(var a,s=n(i.length),l=t(this)?Object(new this(s)):new Array(s),u=0;u>>0;if(0===n)return!1;for(var r,o,a=0|t,s=Math.max(a>=0?a:n-Math.abs(a),0);s>>0,n=arguments.length>=2?arguments[1]:void 0,r=0;r>>0;if("function"!=typeof e)throw new TypeError;for(arguments.length>1&&(i=t),n=0;n0);return!n&&Array.isArray(e)&&e.length>0?i.isElement(e[0]):n}static isInPage(e){return e!==document.body&&document.body.contains(e)}static matches(e,t){return Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),i=t.length;--i>=0&&t.item(i)!==this;);return i>-1}),e.matches(t)}static findParent(e,t){if("function"==typeof e.closest)return e.closest(t)||null;for(Element.prototype.matches||(Element.prototype.matches=Element.prototype.matchesSelector||Element.prototype.mozMatchesSelector||Element.prototype.msMatchesSelector||Element.prototype.oMatchesSelector||Element.prototype.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),i=t.length;--i>=0&&t.item(i)!==this;);return i>-1});e;){if(e.matches(t))return e;e=e.parentElement}return null}static readCookie(e){e+="=";for(let t=document.cookie.split(/;\s*/),i=t.length-1;i>=0;i--)if(!t[i].indexOf(e))return t[i].replace(e,"")}static writeCookie(e,t,i,n="/"){let r=new Date;r.setDate(r.getDate()+i);let o=null==i?"":"; expires="+r.toUTCString();document.cookie=encodeURIComponent(e)+"="+encodeURIComponent(t)+o+(n?"; path="+n:"")+";"}static removeCookie(e,t="/"){document.cookie=e+"=; Path="+t+"; Expires=Thu, 01 Jan 1970 00:00:01 GMT;"}static addStyleElement(e,t){t&&"head"!=t||(t=document.head||document.getElementsByTagName("head")[0]);let i=document.createElement("style");return i.appendChild(document.createTextNode(e)),t.appendChild(i),i}static objectKeys(e){if(!Object.keys){let t,i=[];for(t in e)Object.prototype.hasOwnProperty.call(e,t)&&i.push(t);return i}return Object.keys(e)}static hasQueryParam(e,t){return-1!==e.indexOf(t)}static getQueryParam(e,t){let i=new RegExp("[?&]"+t+"=([^&#]*)","i").exec(e);return i?i[1]:null}static escapeHtml(e){return String(e).replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}static debounced(e,t){let i;return function(...n){i&&clearTimeout(i),i=setTimeout((()=>{t(...n),i=null}),e)}}}var n=i;var r=class{parse(e){let t;if("text"!==this.settings.responseType&&""!==this.settings.responseType){let t=e.response;if("json"===this.settings.responseType&&"string"==typeof t)try{t=JSON.parse(t)}catch(e){}return{data:t,xhr:e}}try{t=JSON.parse(e.responseText)}catch(i){t=e.responseText}return{data:t,xhr:e}}param(e){if("string"==typeof e||"[object FormData]"===Object.prototype.toString.call(e)||"[object File]"===Object.prototype.toString.call(e)||"[object Blob]"===Object.prototype.toString.call(e))return e;if(/application\/json/i.test(this.settings.headers["Content-type"])||"[object Array]"===Object.prototype.toString.call(e))return JSON.stringify(e);let t=[];for(let i in e)e.hasOwnProperty(i)&&t.push(encodeURIComponent(i)+"="+encodeURIComponent(e[i]));return t.join("&")}addQueryParams(e){if(this.settings.queryParams){let t=[];for(let e in this.settings.queryParams)this.settings.queryParams.hasOwnProperty(e)&&t.push(e+"="+this.settings.queryParams[e]);if(t.length>0){let i=t.join("&");return-1===e.indexOf("?")?e+"?"+i:e+"&"+i}}return e}xhr(e){const t=new XMLHttpRequest,i=new Promise(((i,n)=>{t.onreadystatechange=()=>{if(4!==t.readyState)return;let e=this.parse(t);t.status>=200&&t.status<300?i(e):n(e)},e=this.addQueryParams(e),t.open(this.settings.method,e,!0,this.settings.username,this.settings.password),t.responseType=this.settings.responseType;for(let e in this.settings.headers)this.settings.headers.hasOwnProperty(e)&&t.setRequestHeader(e,this.settings.headers[e]);this.settings.timeout&&(t.timeout=this.settings.timeout,t.ontimeout=e=>{n({status:408,statusText:"Request timeout"})}),this.settings.withCredentials&&(t.withCredentials=!0),this.settings.onProgress&&(t.upload.onprogress=this.settings.onProgress),t.send(this.param(this.settings.data))}));return i.cancel=()=>{t.abort()},i}constructor(e,t){return this.settings=n.extend({method:"GET",username:null,password:null,data:{},queryParams:{},headers:{"Content-type":"application/x-www-form-urlencoded"},responseType:"text",timeout:null,withCredentials:!1,onProgress:null},t||{}),this.xhr(e)}};class o{findToken(){let e=n.readCookie("token");e&&(this.settings.queryParams.token=e)}fromNative(e){return{name:e.name?e.name:"",size:e.size,mimeType:e.type,meta:{},_file:e}}saveFile(e){return this.settings.queryParams.token||this.findToken(),new r(this.settings.api+this.settings.path,{method:"POST",responseType:"json",headers:{"Content-type":"application/json"},data:e,queryParams:this.settings.queryParams}).then((e=>{if(!this.settings.queryParams.token&&e.data.token){let t=e.data.token;n.writeCookie("token",t,10,"/"),this.settings.queryParams.token=t}return this.settings.storage&&this._storeFile(e.data),e.data})).catch((e=>{throw e}))}removeFile(e){if(this.settings.storage&&this._files&&(this._files=this._files.filter((t=>!(t.uuid===e.uuid||t.parent===e.uuid))),this._storeFiles()),this.settings.serverDelete){return new r(this.settings.api+this.settings.path+"/"+e.uuid,{method:"DELETE",responseType:"json",queryParams:this.settings.queryParams}).then((e=>e.data)).catch((e=>{throw e}))}return Promise.resolve()}fetchFiles(){if(this.settings.storage)return new Promise(((e,t)=>{this._files||this._parseFiles(),e(this._files)}));return new r(this.settings.api+this.settings.path,{method:"GET",responseType:"json",queryParams:this.settings.queryParams}).then((e=>e.data)).catch((e=>{throw e}))}restoreFiles(e,t=!1){return new r(this.settings.api+this.settings.path+"/restore"+(t?"?archive=1":""),{method:"POST",responseType:"json",headers:{"Content-type":"application/json"},data:e,queryParams:this.settings.queryParams}).then((e=>e.data)).catch((e=>{throw e}))}sendTemplate(e,t){return new r(this.settings.api+this.settings.path+"/"+e+"/send",{method:"POST",responseType:"json",headers:{"Content-type":"application/json"},data:t,queryParams:this.settings.queryParams}).then((e=>e.data)).catch((e=>{throw e}))}tagOrder(e,t){return new r(this.settings.api+this.settings.path+"/"+e+"/tag",{method:"POST",responseType:"json",headers:{"Content-type":"application/json"},data:t,queryParams:this.settings.queryParams}).then((e=>e.data)).catch((e=>{throw e}))}inAppFailed(e,t){return new r(this.settings.api+this.settings.path+"/inapp"+(e?"?reload=1":t?"?empty=1":""),{method:"POST",responseType:"text",headers:{"Content-type":"application/json"},queryParams:this.settings.queryParams}).then((e=>e.data)).catch((e=>{throw e}))}_storeFile(e){this._files||this._parseFiles();let t=JSON.parse(JSON.stringify(e));this._files.push(t),this._storeFiles()}_storeFiles(){window.localStorage&&localStorage.setItem(this.settings.storageKey,JSON.stringify(this._files))}_parseFiles(){if(window.localStorage){let e=localStorage.getItem(this.settings.storageKey);if(e){if(this._files=JSON.parse(e),this.settings.queryParams.token){let e=this._files.length;this._files=this._files.filter((e=>e.token===this.settings.queryParams.token)),e!==this._files.length&&this._storeFiles()}}else this._files=[]}return this._files}constructor(e){let t={api:"",path:"/api/upload",queryParams:{},storage:!1,storageKey:o.storageKey,serverDelete:!1};this.settings=n.extend(t,e||{}),this.findToken()}}o.storageKey="cl_files";var a=o,s={};!function(e,t){"use strict";"function"==typeof define&&define.amd?define(t):s?s=t():e.log=t()}(s,(function(){"use strict";var e=function(){},t="undefined",i=typeof window!==t&&typeof window.navigator!==t&&/Trident\/|MSIE /.test(window.navigator.userAgent),n=["trace","debug","info","warn","error"];function r(e,t){var i=e[t];if("function"==typeof i.bind)return i.bind(e);try{return Function.prototype.bind.call(i,e)}catch(t){return function(){return Function.prototype.apply.apply(i,[e,arguments])}}}function o(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function a(t,i){for(var r=0;r=0&&i<=s.levels.SILENT))throw"log.setLevel() called with invalid level: "+i;if(o=i,!1!==r&&function(e){var i=(n[e]||"silent").toUpperCase();if(typeof window!==t&&u){try{return void(window.localStorage[u]=i)}catch(e){}try{window.document.cookie=encodeURIComponent(u)+"="+i+";"}catch(e){}}}(i),a.call(s,i,e),typeof console===t&&i(s.debug("[translate] "+t+" response",e.data),l.update(e.data),l.translations))).catch((e=>(s.error("[translate] "+t+" error",e),l.translations))),l.ready}static update(e){l.translations=n.extend(l.translations,e),l.updated()}static updated(){const e=new CustomEvent(l.event,{detail:{},cancelable:!0,bubbles:!0});window.dispatchEvent(e)}static onUpdated(e){window.addEventListener(l.event,e)}}l.locale=window.Shopify&&window.Shopify.locale?window.Shopify.locale:document.documentElement.lang,l.translations={},l.ready=Promise.resolve(!0),l.event="cloudlift.translate",l.api="";var u,c,d=l,p={},f={},h=f={};function g(){throw new Error("setTimeout has not been defined")}function m(){throw new Error("clearTimeout has not been defined")}function E(e){if(u===setTimeout)return setTimeout(e,0);if((u===g||!u)&&setTimeout)return u=setTimeout,setTimeout(e,0);try{return u(e,0)}catch(t){try{return u.call(null,e,0)}catch(t){return u.call(this,e,0)}}}!function(){try{u="function"==typeof setTimeout?setTimeout:g}catch(e){u=g}try{c="function"==typeof clearTimeout?clearTimeout:m}catch(e){c=m}}();var _,I=[],v=!1,T=-1;function y(){v&&_&&(v=!1,_.length?I=_.concat(I):T=-1,I.length&&w())}function w(){if(!v){var e=E(y);v=!0;for(var t=I.length;t;){for(_=I,I=[];++T1)for(var i=1;i1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[],n=Object.assign({},e),r=[],o=[],a=function(){var e=[].concat(o);o.length=0,e.forEach((function(e){var t=e.type,i=e.data;s(t,i)}))},s=function(e,t,i){!i||document.hidden?(d[e]&&d[e](t),r.push({type:e,data:t})):o.push({type:e,data:t})},l=function(e){for(var t,i=arguments.length,n=new Array(i>1?i-1:0),r=1;r2&&void 0!==arguments[2]?arguments[2]:null;if(null===i)return e.getAttribute(t)||e.hasAttribute(t);e.setAttribute(t,i)},s="http://www.w3.org/2000/svg",l=["svg","path"],u=function(e){return l.includes(e)},c=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};"object"==typeof t&&(i=t,t=null);var n=u(e)?document.createElementNS(s,e):document.createElement(e);return t&&(u(e)?a(n,"class",t):n.className=t),r(i,(function(e,t){a(n,e,t)})),n},d=function(e){return function(t,i){void 0!==i&&e.children[i]?e.insertBefore(t,e.children[i]):e.appendChild(t)}},p=function(e,t){return function(e,i){return void 0!==i?t.splice(i,0,e):t.push(e),e}},h=function(e,t){return function(i){return t.splice(t.indexOf(i),1),i.element.parentNode&&e.removeChild(i.element),i}},g="undefined"!=typeof window&&void 0!==window.document,m=function(){return g},E="children"in(m()?c("svg"):{})?function(e){return e.children.length}:function(e){return e.childNodes.length},_=function(e,t,i,n){var r=i[0]||e.left,o=i[1]||e.top,a=r+e.width,s=o+e.height*(n[1]||1),l={element:Object.assign({},e),inner:{left:e.left,top:e.top,right:e.right,bottom:e.bottom},outer:{left:r,top:o,right:a,bottom:s}};return t.filter((function(e){return!e.isRectIgnored()})).map((function(e){return e.rect})).forEach((function(e){I(l.inner,Object.assign({},e.inner)),I(l.outer,Object.assign({},e.outer))})),v(l.inner),l.outer.bottom+=l.element.marginBottom,l.outer.right+=l.element.marginRight,v(l.outer),l},I=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)},v=function(e){e.width=e.right-e.left,e.height=e.bottom-e.top},T=function(e){return"number"==typeof e},y=function(e,t,i){var n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:.001;return Math.abs(e-t)0&&void 0!==arguments[0]?arguments[0]:{},t=e.stiffness,i=void 0===t?.5:t,n=e.damping,r=void 0===n?.75:n,a=e.mass,s=void 0===a?10:a,l=null,u=null,c=0,d=!1,p=o({interpolate:function(e,t){if(!d){if(!T(l)||!T(u))return d=!0,void(c=0);y(u+=c+=-(u-l)*i/s,l,c*=r)||t?(u=l,c=0,d=!0,p.onupdate(u),p.oncomplete(u)):p.onupdate(u)}},target:{set:function(e){if(T(e)&&!T(u)&&(u=e),null===l&&(l=e,u=e),u===(l=e)||void 0===l)return d=!0,c=0,p.onupdate(u),void p.oncomplete(u);d=!1},get:function(){return l}},resting:{get:function(){return d}},onupdate:function(e){},oncomplete:function(e){}});return p},O=function(e){return e<.5?2*e*e:(4-2*e)*e-1},A=function(){var e,t,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=i.duration,r=void 0===n?500:n,a=i.easing,s=void 0===a?O:a,l=i.delay,u=void 0===l?0:l,c=null,d=!0,p=!1,f=null,h=o({interpolate:function(i,n){d||null===f||(null===c&&(c=i),i-c=r||n?(e=1,t=p?0:1,h.onupdate(t*f),h.oncomplete(t*f),d=!0):(t=e/r,h.onupdate((e>=0?s(p?1-t:t):0)*f))))},target:{get:function(){return p?0:f},set:function(e){if(null===f)return f=e,h.onupdate(e),void h.oncomplete(e);e3&&void 0!==arguments[3]&&arguments[3];(t=Array.isArray(t)?t:[t]).forEach((function(t){e.forEach((function(e){var r=e,o=function(){return i[e]},a=function(t){return i[e]=t};"object"==typeof e&&(r=e.key,o=e.getter||o,a=e.setter||a),t[r]&&!n||(t[r]={get:o,set:a})}))}))},M=function(e){return function(t,i){e.addEventListener(t,i)}},C=function(e){return function(t,i){e.removeEventListener(t,i)}},P=function(e){return null!=e},L={opacity:1,scaleX:1,scaleY:1,translateX:0,translateY:0,rotateX:0,rotateY:0,rotateZ:0,originX:0,originY:0},D=function(e){var t=e.mixinConfig,i=e.viewProps,n=e.viewInternalAPI,r=e.viewExternalAPI,o=e.view,a=Object.assign({},i),s={};b(t,[n,r],i);var l=function(){return[i.translateX||0,i.translateY||0]},u=function(){return[i.scaleX||0,i.scaleY||0]},c=function(){return o.rect?_(o.rect,o.childViews,l(),u()):null};return n.rect={get:c},r.rect={get:c},t.forEach((function(e){i[e]=void 0===a[e]?L[e]:a[e]})),{write:function(){if(x(s,i))return G(o.element,i),Object.assign(s,Object.assign({},i)),!0},destroy:function(){}}},x=function(e,t){if(Object.keys(e).length!==Object.keys(t).length)return!0;for(var i in t)if(t[i]!==e[i])return!0;return!1},G=function(e,t){var i=t.opacity,n=t.perspective,r=t.translateX,o=t.translateY,a=t.scaleX,s=t.scaleY,l=t.rotateX,u=t.rotateY,c=t.rotateZ,d=t.originX,p=t.originY,f=t.width,h=t.height,g="",m="";(P(d)||P(p))&&(m+="transform-origin: "+(d||0)+"px "+(p||0)+"px;"),P(n)&&(g+="perspective("+n+"px) "),(P(r)||P(o))&&(g+="translate3d("+(r||0)+"px, "+(o||0)+"px, 0) "),(P(a)||P(s))&&(g+="scale3d("+(P(a)?a:1)+", "+(P(s)?s:1)+", 1) "),P(c)&&(g+="rotateZ("+c+"rad) "),P(l)&&(g+="rotateX("+l+"rad) "),P(u)&&(g+="rotateY("+u+"rad) "),g.length&&(m+="transform:"+g+";"),P(i)&&(m+="opacity:"+i+";",0===i&&(m+="visibility:hidden;"),i<1&&(m+="pointer-events:none;")),P(h)&&(m+="height:"+h+"px;"),P(f)&&(m+="width:"+f+"px;");var E=e.elementCurrentStyle||"";m.length===E.length&&m===E||(e.style.cssText=m,e.elementCurrentStyle=m)},N={styles:D,listeners:function(e){e.mixinConfig,e.viewProps,e.viewInternalAPI;var t=e.viewExternalAPI,i=(e.viewState,e.view),n=[],r=M(i.element),o=C(i.element);return t.on=function(e,t){n.push({type:e,fn:t}),r(e,t)},t.off=function(e,t){n.splice(n.findIndex((function(i){return i.type===e&&i.fn===t})),1),o(e,t)},{write:function(){return!0},destroy:function(){n.forEach((function(e){o(e.type,e.fn)}))}}},animations:function(e){var t=e.mixinConfig,i=e.viewProps,n=e.viewInternalAPI,o=e.viewExternalAPI,a=Object.assign({},i),s=[];return r(t,(function(e,t){var r=S(t);r&&(r.onupdate=function(t){i[e]=t},r.target=a[e],b([{key:e,setter:function(e){r.target!==e&&(r.target=e)},getter:function(){return i[e]}}],[n,o],i,!0),s.push(r))})),{write:function(e){var t=document.hidden,i=!0;return s.forEach((function(n){n.resting||(i=!1),n.interpolate(e,t)})),i},destroy:function(){}}},apis:function(e){var t=e.mixinConfig,i=e.viewProps,n=e.viewExternalAPI;b(t,n,i)}},F=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return t.layoutCalculated||(e.paddingTop=parseInt(i.paddingTop,10)||0,e.marginTop=parseInt(i.marginTop,10)||0,e.marginRight=parseInt(i.marginRight,10)||0,e.marginBottom=parseInt(i.marginBottom,10)||0,e.marginLeft=parseInt(i.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},k=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.tag,i=void 0===t?"div":t,n=e.name,r=void 0===n?null:n,a=e.attributes,s=void 0===a?{}:a,l=e.read,u=void 0===l?function(){}:l,f=e.write,g=void 0===f?function(){}:f,m=e.create,I=void 0===m?function(){}:m,v=e.destroy,T=void 0===v?function(){}:v,y=e.filterFrameActionsForChild,w=void 0===y?function(e,t){return t}:y,O=e.didCreateView,A=void 0===O?function(){}:O,R=e.didWriteView,S=void 0===R?function(){}:R,b=e.ignoreRect,M=void 0!==b&&b,C=e.ignoreRectUpdate,P=void 0!==C&&C,L=e.mixins,D=void 0===L?[]:L;return function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=c(i,"filepond--"+r,s),a=window.getComputedStyle(n,null),l=F(),f=null,m=!1,v=[],y=[],O={},R={},b=[g],C=[u],L=[T],x=function(){return n},G=function(){return v.concat()},k=function(){return O},U=function(e){return function(t,i){return t(e,i)}},V=function(){return f||(f=_(l,v,[0,0],[1,1]))},B=function(){f=null,v.forEach((function(e){return e._read()})),!(P&&l.width&&l.height)&&F(l,n,a);var e={root:X,props:t,rect:l};C.forEach((function(t){return t(e)}))},q=function(e,i,n){var r=0===i.length;return b.forEach((function(o){!1===o({props:t,root:X,actions:i,timestamp:e,shouldOptimize:n})&&(r=!1)})),y.forEach((function(t){!1===t.write(e)&&(r=!1)})),v.filter((function(e){return!!e.element.parentNode})).forEach((function(t){t._write(e,w(t,i),n)||(r=!1)})),v.forEach((function(t,o){t.element.parentNode||(X.appendChild(t.element,o),t._read(),t._write(e,w(t,i),n),r=!1)})),m=r,S({props:t,root:X,actions:i,timestamp:e}),r},z=function(){y.forEach((function(e){return e.destroy()})),L.forEach((function(e){e({root:X,props:t})})),v.forEach((function(e){return e._destroy()}))},W={element:{get:x},style:{get:function(){return a}},childViews:{get:G}},H=Object.assign({},W,{rect:{get:V},ref:{get:k},is:function(e){return r===e},appendChild:d(n),createChildView:U(e),linkView:function(e){return v.push(e),e},unlinkView:function(e){v.splice(v.indexOf(e),1)},appendChildView:p(n,v),removeChildView:h(n,v),registerWriter:function(e){return b.push(e)},registerReader:function(e){return C.push(e)},registerDestroyer:function(e){return L.push(e)},invalidateLayout:function(){return n.layoutCalculated=!1},dispatch:e.dispatch,query:e.query}),j={element:{get:x},childViews:{get:G},rect:{get:V},resting:{get:function(){return m}},isRectIgnored:function(){return M},_read:B,_write:q,_destroy:z},Y=Object.assign({},W,{rect:{get:function(){return l}}});Object.keys(D).sort((function(e,t){return"styles"===e?1:"styles"===t?-1:0})).forEach((function(e){var i=N[e]({mixinConfig:D[e],viewProps:t,viewState:R,viewInternalAPI:H,viewExternalAPI:j,view:o(Y)});i&&y.push(i)}));var X=o(H);I({root:X,props:t});var Z=E(n);return v.forEach((function(e,t){X.appendChild(e.element,Z+t)})),A(X),o(j)}},U=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:60,n="__framePainter";if(window[n])return window[n].readers.push(e),void window[n].writers.push(t);window[n]={readers:[e],writers:[t]};var r=window[n],o=1e3/i,a=null,s=null,l=null,u=null,c=function(){document.hidden?(l=function(){return window.setTimeout((function(){return d(performance.now())}),o)},u=function(){return window.clearTimeout(s)}):(l=function(){return window.requestAnimationFrame(d)},u=function(){return window.cancelAnimationFrame(s)})};document.addEventListener("visibilitychange",(function(){u&&u(),c(),d(performance.now())}));var d=function e(t){s=l(e),a||(a=t);var i=t-a;i<=o||(a=t-i%o,r.readers.forEach((function(e){return e()})),r.writers.forEach((function(e){return e(t)})))};return c(),d(performance.now()),{pause:function(){u(s)}}},V=function(e,t){return function(i){var n=i.root,r=i.props,o=i.actions,a=void 0===o?[]:o,s=i.timestamp,l=i.shouldOptimize;a.filter((function(t){return e[t.type]})).forEach((function(t){return e[t.type]({root:n,props:r,action:t.data,timestamp:s,shouldOptimize:l})})),t&&t({root:n,props:r,actions:a,timestamp:s,shouldOptimize:l})}},B=function(e,t){return t.parentNode.insertBefore(e,t)},q=function(e,t){return t.parentNode.insertBefore(e,t.nextSibling)},z=function(e){return Array.isArray(e)},W=function(e){return null==e},H=function(e){return e.trim()},j=function(e){return""+e},Y=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:",";return W(e)?[]:z(e)?e:j(e).split(t).map(H).filter((function(e){return e.length}))},X=function(e){return"boolean"==typeof e},Z=function(e){return X(e)?e:"true"===e},Q=function(e){return"string"==typeof e},$=function(e){return T(e)?e:Q(e)?j(e).replace(/[a-z]+/gi,""):0},J=function(e){return parseInt($(e),10)},K=function(e){return parseFloat($(e))},ee=function(e){return T(e)&&isFinite(e)&&Math.floor(e)===e},te=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3;if(ee(e))return e;var i=j(e).trim();return/MB$/i.test(i)?(i=i.replace(/MB$i/,"").trim(),J(i)*t*t):/KB/i.test(i)?(i=i.replace(/KB$i/,"").trim(),J(i)*t):J(i)},ie=function(e){return"function"==typeof e},ne=function(e){for(var t=self,i=e.split("."),n=null;n=i.shift();)if(!(t=t[n]))return null;return t},re={process:"POST",patch:"PATCH",revert:"DELETE",fetch:"GET",restore:"GET",load:"GET"},oe=function(e){var t={};return t.url=Q(e)?e:e.url||"",t.timeout=e.timeout?parseInt(e.timeout,10):0,t.headers=e.headers?e.headers:{},r(re,(function(i){t[i]=ae(i,e[i],re[i],t.timeout,t.headers)})),t.process=e.process||Q(e)||e.url?t.process:null,t.remove=e.remove||null,delete t.headers,t},ae=function(e,t,i,n,r){if(null===t)return null;if("function"==typeof t)return t;var o={url:"GET"===i||"PATCH"===i?"?"+e+"=":"",method:i,headers:r,withCredentials:!1,timeout:n,onload:null,ondata:null,onerror:null};if(Q(t))return o.url=t,o;if(Object.assign(o,t),Q(o.headers)){var a=o.headers.split(/:(.+)/);o.headers={header:a[0],value:a[1]}}return o.withCredentials=Z(o.withCredentials),o},se=function(e){return null===e},le=function(e){return"object"==typeof e&&null!==e},ue=function(e){return le(e)&&Q(e.url)&&le(e.process)&&le(e.revert)&&le(e.restore)&&le(e.fetch)},ce=function(e){return z(e)?"array":se(e)?"null":ee(e)?"int":/^[0-9]+ ?(?:GB|MB|KB)$/gi.test(e)?"bytes":ue(e)?"api":typeof e},de=function(e){return e.replace(/{\s*'/g,'{"').replace(/'\s*}/g,'"}').replace(/'\s*:/g,'":').replace(/:\s*'/g,':"').replace(/,\s*'/g,',"').replace(/'\s*,/g,'",')},pe={array:Y,boolean:Z,int:function(e){return"bytes"===ce(e)?te(e):J(e)},number:K,float:K,bytes:te,string:function(e){return ie(e)?e:j(e)},function:function(e){return ne(e)},serverapi:function(e){return oe(e)},object:function(e){try{return JSON.parse(de(e))}catch(e){return null}}},fe=function(e,t){return pe[t](e)},he=function(e,t,i){if(e===t)return e;var n=ce(e);if(n!==i){var r=fe(e,i);if(n=ce(r),null===r)throw'Trying to assign value with incorrect type to "'+option+'", allowed type: "'+i+'"';e=r}return e},ge=function(e,t){var i=e;return{enumerable:!0,get:function(){return i},set:function(n){i=he(n,e,t)}}},me=function(e){var t={};return r(e,(function(i){var n=e[i];t[i]=ge(n[0],n[1])})),o(t)},Ee=function(e){return{items:[],listUpdateTimeout:null,itemUpdateTimeout:null,processingQueue:[],options:me(e)}},_e=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)},Ie=function(e,t){var i={};return r(t,(function(t){i[t]={get:function(){return e.getState().options[t]},set:function(i){e.dispatch("SET_"+_e(t,"_").toUpperCase(),{value:i})}}})),i},ve=function(e){return function(t,i,n){var o={};return r(e,(function(e){var i=_e(e,"_").toUpperCase();o["SET_"+i]=function(r){try{n.options[e]=r.value}catch(e){}t("DID_SET_"+i,{value:n.options[e]})}})),o}},Te=function(e){return function(t){var i={};return r(e,(function(e){i["GET_"+_e(e,"_").toUpperCase()]=function(i){return t.options[e]}})),i}},ye={API:1,DROP:2,BROWSE:3,PASTE:4,NONE:5},we=function(){return Math.random().toString(36).substr(2,9)};function Oe(e){this.wrapped=e}function Ae(e){var t,i;function n(e,n){return new Promise((function(o,a){var s={key:e,arg:n,resolve:o,reject:a,next:null};i?i=i.next=s:(t=i=s,r(e,n))}))}function r(t,i){try{var n=e[t](i),a=n.value,s=a instanceof Oe;Promise.resolve(s?a.wrapped:a).then((function(e){s?r("next",e):o(n.done?"return":"normal",e)}),(function(e){r("throw",e)}))}catch(e){o("throw",e)}}function o(e,n){switch(e){case"return":t.resolve({value:n,done:!0});break;case"throw":t.reject(n);break;default:t.resolve({value:n,done:!1})}(t=t.next)?r(t.key,t.arg):i=null}this._invoke=n,"function"!=typeof e.return&&(this.return=void 0)}function Re(e,t){if(null==e)return{};var i,n,r={},o=Object.keys(e);for(n=0;n=0||(r[i]=e[i]);return r}function Se(e,t){if(null==e)return{};var i,n,r=Re(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,i)&&(r[i]=e[i])}return r}function be(e){return Me(e)||Ce(e)||Pe()}function Me(e){if(Array.isArray(e)){for(var t=0,i=new Array(e.length);t1?t-1:0),r=1;r1?t-1:0),r=1;rBrowse',We.STRING],labelInvalidField:["Field contains invalid files",We.STRING],labelFileWaitingForSize:["Waiting for size",We.STRING],labelFileSizeNotAvailable:["Size not available",We.STRING],labelFileCountSingular:["file in list",We.STRING],labelFileCountPlural:["files in list",We.STRING],labelFileLoading:["Loading",We.STRING],labelFileAdded:["Added",We.STRING],labelFileLoadError:["Error during load",We.STRING],labelFileRemoved:["Removed",We.STRING],labelFileRemoveError:["Error during remove",We.STRING],labelFileProcessing:["Uploading",We.STRING],labelFileProcessingComplete:["Upload complete",We.STRING],labelFileProcessingAborted:["Upload cancelled",We.STRING],labelFileProcessingError:["Error during upload",We.STRING],labelFileProcessingRevertError:["Error during revert",We.STRING],labelTapToCancel:["tap to cancel",We.STRING],labelTapToRetry:["tap to retry",We.STRING],labelTapToUndo:["tap to undo",We.STRING],labelButtonRemoveItem:["Remove",We.STRING],labelButtonAbortItemLoad:["Abort",We.STRING],labelButtonRetryItemLoad:["Retry",We.STRING],labelButtonAbortItemProcessing:["Cancel",We.STRING],labelButtonUndoItemProcessing:["Undo",We.STRING],labelButtonRetryItemProcessing:["Retry",We.STRING],labelButtonProcessItem:["Upload",We.STRING],iconRemove:['',We.STRING],iconProcess:['',We.STRING],iconRetry:['',We.STRING],iconUndo:['',We.STRING],iconDone:['',We.STRING],oninit:[null,We.FUNCTION],onwarning:[null,We.FUNCTION],onerror:[null,We.FUNCTION],onactivatefile:[null,We.FUNCTION],oninitfile:[null,We.FUNCTION],onaddfilestart:[null,We.FUNCTION],onaddfileprogress:[null,We.FUNCTION],onaddfile:[null,We.FUNCTION],onprocessfilestart:[null,We.FUNCTION],onprocessfileprogress:[null,We.FUNCTION],onprocessfileabort:[null,We.FUNCTION],onprocessfilerevert:[null,We.FUNCTION],onprocessfile:[null,We.FUNCTION],onprocessfiles:[null,We.FUNCTION],onremovefile:[null,We.FUNCTION],onpreparefile:[null,We.FUNCTION],onupdatefiles:[null,We.FUNCTION],onreorderfiles:[null,We.FUNCTION],beforeDropFile:[null,We.FUNCTION],beforeAddFile:[null,We.FUNCTION],beforeRemoveFile:[null,We.FUNCTION],beforePrepareFile:[null,We.FUNCTION],stylePanelLayout:[null,We.STRING],stylePanelAspectRatio:[null,We.STRING],styleItemPanelAspectRatio:[null,We.STRING],styleButtonRemoveItemPosition:["left",We.STRING],styleButtonProcessItemPosition:["right",We.STRING],styleLoadIndicatorPosition:["right",We.STRING],styleProgressIndicatorPosition:["right",We.STRING],styleButtonRemoveItemAlign:[!1,We.BOOLEAN],files:[[],We.ARRAY],credits:[["https://pqina.nl/","Powered by PQINA"],We.ARRAY]},Ke=function(e,t){return W(t)?e[0]||null:ee(t)?e[t]||null:("object"==typeof t&&(t=t.id),e.find((function(e){return e.id===t}))||null)},et=function(e){if(W(e))return e;if(/:/.test(e)){var t=e.split(":");return t[1]/t[0]}return parseFloat(e)},tt=function(e){return e.filter((function(e){return!e.archived}))},it={EMPTY:0,IDLE:1,ERROR:2,BUSY:3,READY:4},nt=null,rt=function(){if(null===nt)try{var e=new DataTransfer;e.items.add(new File(["hello world"],"This_Works.txt"));var t=document.createElement("input");t.setAttribute("type","file"),t.files=e.files,nt=1===t.files.length}catch(e){nt=!1}return nt},ot=[Ue.LOAD_ERROR,Ue.PROCESSING_ERROR,Ue.PROCESSING_REVERT_ERROR],at=[Ue.LOADING,Ue.PROCESSING,Ue.PROCESSING_QUEUED,Ue.INIT],st=[Ue.PROCESSING_COMPLETE],lt=function(e){return ot.includes(e.status)},ut=function(e){return at.includes(e.status)},ct=function(e){return st.includes(e.status)},dt=function(e){return le(e.options.server)&&(le(e.options.server.process)||ie(e.options.server.process))},pt=function(e){return{GET_STATUS:function(){var t=tt(e.items),i=it.EMPTY,n=it.ERROR,r=it.BUSY,o=it.IDLE,a=it.READY;return 0===t.length?i:t.some(lt)?n:t.some(ut)?r:t.some(ct)?a:o},GET_ITEM:function(t){return Ke(e.items,t)},GET_ACTIVE_ITEM:function(t){return Ke(tt(e.items),t)},GET_ACTIVE_ITEMS:function(){return tt(e.items)},GET_ITEMS:function(){return e.items},GET_ITEM_NAME:function(t){var i=Ke(e.items,t);return i?i.filename:null},GET_ITEM_SIZE:function(t){var i=Ke(e.items,t);return i?i.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:et(e.options.stylePanelAspectRatio)},GET_ITEM_PANEL_ASPECT_RATIO:function(){return e.options.styleItemPanelAspectRatio},GET_ITEMS_BY_STATUS:function(t){return tt(e.items).filter((function(e){return e.status===t}))},GET_TOTAL_ITEMS:function(){return tt(e.items).length},SHOULD_UPDATE_FILE_INPUT:function(){return e.options.storeAsFile&&rt()&&!dt(e)},IS_ASYNC:function(){return dt(e)},GET_FILE_SIZE_LABELS:function(e){return{labelBytes:e("GET_LABEL_FILE_SIZE_BYTES")||void 0,labelKilobytes:e("GET_LABEL_FILE_SIZE_KILOBYTES")||void 0,labelMegabytes:e("GET_LABEL_FILE_SIZE_MEGABYTES")||void 0,labelGigabytes:e("GET_LABEL_FILE_SIZE_GIGABYTES")||void 0}}}},ft=function(e){var t=tt(e.items).length;if(!e.options.allowMultiple)return 0===t;var i=e.options.maxFiles;return null===i||t1&&void 0!==arguments[1]?arguments[1]:"";return(t+e).slice(-t.length)},yt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new Date;return e.getFullYear()+"-"+Tt(e.getMonth()+1,"00")+"-"+Tt(e.getDate(),"00")+"_"+Tt(e.getHours(),"00")+"-"+Tt(e.getMinutes(),"00")+"-"+Tt(e.getSeconds(),"00")},wt=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,r="string"==typeof i?e.slice(0,e.size,i):e.slice(0,e.size,e.type);return r.lastModifiedDate=new Date,e._relativePath&&(r._relativePath=e._relativePath),Q(t)||(t=yt()),t&&null===n&&It(t)?r.name=t:(n=n||vt(r.type),r.name=t+(n?"."+n:"")),r},Ot=function(){return window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder},At=function(e,t){var i=Ot();if(i){var n=new i;return n.append(e),n.getBlob(t)}return new Blob([e],{type:t})},Rt=function(e,t){for(var i=new ArrayBuffer(e.length),n=new Uint8Array(i),r=0;r=200&&a.status<300?n.onload(a):n.onerror(a)},a.onerror=function(){return n.onerror(a)},a.onabort=function(){r=!0,n.onabort()},a.ontimeout=function(){return n.ontimeout(a)},a.open(i.method,t,!0),ee(i.timeout)&&(a.timeout=i.timeout),Object.keys(i.headers).forEach((function(e){var t=unescape(encodeURIComponent(i.headers[e]));a.setRequestHeader(e,t)})),i.responseType&&(a.responseType=i.responseType),i.withCredentials&&(a.withCredentials=!0),a.send(e),n},Ut=function(e,t,i,n){return{type:e,code:t,body:i,headers:n}},Vt=function(e){return function(t){e(Ut("error",0,"Timeout",t.getAllResponseHeaders()))}},Bt=function(e){return/\?/.test(e)},qt=function(){for(var e="",t=arguments.length,i=new Array(t),n=0;n0&&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 i=t.onload||function(e){return e},n=t.onerror||function(e){return null};return function(r,o,a,s,l,u){var c=kt(r,qt(e,t.url),Object.assign({},t,{responseType:"blob"}));return c.onload=function(e){var n=e.getAllResponseHeaders(),a=Gt(n).name||_t(r);o(Ut("load",e.status,"HEAD"===t.method?null:wt(i(e.response),a),n))},c.onerror=function(e){a(Ut("error",e.status,n(e.response)||e.statusText,e.getAllResponseHeaders()))},c.onheaders=function(e){u(Ut("headers",e.status,null,e.getAllResponseHeaders()))},c.ontimeout=Vt(a),c.onprogress=s,c.onabort=l,c}},Wt={QUEUED:0,COMPLETE:1,PROCESSING:2,ERROR:3,WAITING:4},Ht=function(e,t,i,n,r,o,a,s,l,u,c){for(var d=[],p=c.chunkTransferId,f=c.chunkServer,h=c.chunkSize,g=c.chunkRetryDelays,m={serverId:p,aborted:!1},E=t.ondata||function(e){return e},_=t.onload||function(e,t){return"HEAD"===t?e.getResponseHeader("Upload-Offset"):e.response},I=t.onerror||function(e){return null},v=function(o){var s=new FormData;le(r)&&s.append(i,JSON.stringify(r));var l="function"==typeof t.headers?t.headers(n,r):Object.assign({},t.headers,{"Upload-Length":n.size}),u=Object.assign({},t,{headers:l}),c=kt(E(s),qt(e,t.url),u);c.onload=function(e){return o(_(e,u.method))},c.onerror=function(e){return a(Ut("error",e.status,I(e.response)||e.statusText,e.getAllResponseHeaders()))},c.ontimeout=Vt(a)},T=function(i){var n=qt(e,f.url,m.serverId),r={headers:"function"==typeof t.headers?t.headers(m.serverId):Object.assign({},t.headers),method:"HEAD"},o=kt(null,n,r);o.onload=function(e){return i(_(e,r.method))},o.onerror=function(e){return a(Ut("error",e.status,I(e.response)||e.statusText,e.getAllResponseHeaders()))},o.ontimeout=Vt(a)},y=Math.floor(n.size/h),w=0;w<=y;w++){var O=w*h,A=n.slice(O,O+h,"application/offset+octet-stream");d[w]={index:w,size:A.size,offset:O,data:A,file:n,progress:0,retries:be(g),status:Wt.QUEUED,error:null,request:null,timeout:null}}var R=function(){return o(m.serverId)},S=function(e){return e.status===Wt.QUEUED||e.status===Wt.ERROR},b=function(t){if(!m.aborted)if(t=t||d.find(S)){t.status=Wt.PROCESSING,t.progress=null;var i=f.ondata||function(e){return e},r=f.onerror||function(e){return null},o=qt(e,f.url,m.serverId),s="function"==typeof f.headers?f.headers(t):Object.assign({},f.headers,{"Content-Type":"application/offset+octet-stream","Upload-Offset":t.offset,"Upload-Length":n.size,"Upload-Name":n.name}),u=t.request=kt(i(t.data),o,Object.assign({},f,{headers:s}));u.onload=function(){t.status=Wt.COMPLETE,t.request=null,P()},u.onprogress=function(e,i,n){t.progress=e?i:null,C()},u.onerror=function(e){t.status=Wt.ERROR,t.request=null,t.error=r(e.response)||e.statusText,M(t)||a(Ut("error",e.status,r(e.response)||e.statusText,e.getAllResponseHeaders()))},u.ontimeout=function(e){t.status=Wt.ERROR,t.request=null,M(t)||Vt(a)(e)},u.onabort=function(){t.status=Wt.QUEUED,t.request=null,l()}}else d.every((function(e){return e.status===Wt.COMPLETE}))&&R()},M=function(e){return 0!==e.retries.length&&(e.status=Wt.WAITING,clearTimeout(e.timeout),e.timeout=setTimeout((function(){b(e)}),e.retries.shift()),!0)},C=function(){var e=d.reduce((function(e,t){return null===e||null===t.progress?null:e+t.progress}),0);if(null===e)return s(!1,0,0);var t=d.reduce((function(e,t){return e+t.size}),0);s(!0,e,t)},P=function(){d.filter((function(e){return e.status===Wt.PROCESSING})).length>=1||b()},L=function(){d.forEach((function(e){clearTimeout(e.timeout),e.request&&e.request.abort()}))};return m.serverId?T((function(e){m.aborted||(d.filter((function(t){return t.offsetn.chunkSize,f=d&&(p||n.chunkForce);if(r instanceof Blob&&f)return Ht(e,t,i,r,o,a,s,l,u,c,n);var h=t.ondata||function(e){return e},g=t.onload||function(e){return e},m=t.onerror||function(e){return null},E="function"==typeof t.headers?t.headers(r,o)||{}:Object.assign({},t.headers),_=Object.assign({},t,{headers:E}),I=new FormData;le(o)&&I.append(i,JSON.stringify(o)),(r instanceof Blob?[{name:null,file:r}]:r).forEach((function(e){I.append(i,e.file,null===e.name?e.file.name:""+e.name+e.file.name)}));var v=kt(h(I),qt(e,t.url),_);return v.onload=function(e){a(Ut("load",e.status,g(e.response),e.getAllResponseHeaders()))},v.onerror=function(e){s(Ut("error",e.status,m(e.response)||e.statusText,e.getAllResponseHeaders()))},v.ontimeout=Vt(s),v.onprogress=l,v.onabort=u,v}}},Yt=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;return"function"==typeof t?function(){for(var e=arguments.length,r=new Array(e),o=0;o0&&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 i=t.onload||function(e){return e},n=t.onerror||function(e){return null};return function(r,o,a){var s=kt(r,e+t.url,t);return s.onload=function(e){o(Ut("load",e.status,i(e.response),e.getAllResponseHeaders()))},s.onerror=function(e){a(Ut("error",e.status,n(e.response)||e.statusText,e.getAllResponseHeaders()))},s.ontimeout=Vt(a),s}},Zt=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)},Qt=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:25,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:250,r=null,o=Date.now();return t>0&&function a(){var s=Date.now()-o,l=Zt(i,n);s+l>t&&(l=s+l-t);var u=s/t;u>=1||document.hidden?e(1):(e(u),r=setTimeout(a,l))}(),{clear:function(){clearTimeout(r)}}},$t=function(e,t){var i={complete:!1,perceivedProgress:0,perceivedPerformanceUpdater:null,progress:null,timestamp:null,perceivedDuration:0,duration:0,request:null,response:null},n=t.allowMinimumUploadDuration,r=function(t,r){var o=function(){0!==i.duration&&null!==i.progress&&u.fire("progress",u.getProgress())},a=function(){i.complete=!0,u.fire("load-perceived",i.response.body)};u.fire("start"),i.timestamp=Date.now(),i.perceivedPerformanceUpdater=Qt((function(e){i.perceivedProgress=e,i.perceivedDuration=Date.now()-i.timestamp,o(),i.response&&1===i.perceivedProgress&&!i.complete&&a()}),n?Zt(750,1500):0),i.request=e(t,r,(function(e){i.response=le(e)?e:{type:"load",code:200,body:""+e,headers:{}},i.duration=Date.now()-i.timestamp,i.progress=1,u.fire("load",i.response.body),(!n||n&&1===i.perceivedProgress)&&a()}),(function(e){i.perceivedPerformanceUpdater.clear(),u.fire("error",le(e)?e:{type:"error",code:0,body:""+e})}),(function(e,t,n){i.duration=Date.now()-i.timestamp,i.progress=e?t/n:null,o()}),(function(){i.perceivedPerformanceUpdater.clear(),u.fire("abort",i.response?i.response.body:null)}),(function(e){u.fire("transfer",e)}))},o=function(){i.request&&(i.perceivedPerformanceUpdater.clear(),i.request.abort&&i.request.abort(),i.complete=!0)},a=function(){o(),i.complete=!1,i.perceivedProgress=0,i.progress=0,i.timestamp=null,i.perceivedDuration=0,i.duration=0,i.request=null,i.response=null},s=n?function(){return i.progress?Math.min(i.progress,i.perceivedProgress):null}:function(){return i.progress||null},l=n?function(){return Math.min(i.duration,i.perceivedDuration)}:function(){return i.duration},u=Object.assign({},xe(),{process:r,abort:o,getProgress:s,getDuration:l,reset:a});return u},Jt=function(e){return e.substr(0,e.lastIndexOf("."))||e},Kt=function(e){var t=[e.name,e.size,e.type];return e instanceof Blob||Et(e)?t[0]=e.name||yt():Et(e)?(t[1]=e.length,t[2]=St(e)):Q(e)&&(t[0]=_t(e),t[1]=0,t[2]="application/octet-stream"),{name:t[0],size:t[1],type:t[2]}},ei=function(e){return!!(e instanceof File||e instanceof Blob&&e.name)},ti=function e(t){if(!le(t))return t;var i=z(t)?[]:{};for(var n in t)if(t.hasOwnProperty(n)){var r=t[n];i[n]=r&&le(r)?e(r):r}return i},ii=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=we(),r={archived:!1,frozen:!1,released:!1,source:null,file:i,serverFileReference:t,transferId:null,processingAborted:!1,status:t?Ue.PROCESSING_COMPLETE:Ue.INIT,activeLoader:null,activeProcessor:null},a=null,s={},l=function(e){return r.status=e},u=function(e){if(!r.released&&!r.frozen){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n-1||e.indexOf("//")>-1)&&ai(location.href)!==ai(e)},li=function(e){return function(){return ie(e)?e.apply(void 0,arguments):e}},ui=function(e){return!ei(e.file)},ci=function(e,t){clearTimeout(t.listUpdateTimeout),t.listUpdateTimeout=setTimeout((function(){e("DID_UPDATE_ITEMS",{items:tt(t.items)})}),0)},di=function(e){for(var t=arguments.length,i=new Array(t>1?t-1:0),n=1;n0&&void 0!==arguments[0]?arguments[0]:{},n=i.query,r=i.success,o=void 0===r?function(){}:r,a=i.failure,s=void 0===a?function(){}:a,l=Se(i,["query","success","failure"]),u=Ke(e.items,n);u?t(u,o,s,l||{}):s({error:Ut("error",0,"Item not found"),file:null})}},hi=function(e,t,i){return{ABORT_ALL:function(){tt(i.items).forEach((function(e){e.freeze(),e.abortLoad(),e.abortProcessing()}))},DID_SET_FILES:function(t){var n=t.value,r=(void 0===n?[]:n).map((function(e){return{source:e.source?e.source:e,options:e.options}})),o=tt(i.items);o.forEach((function(t){r.find((function(e){return e.source===t.source||e.source===t.file}))||e("REMOVE_ITEM",{query:t,remove:!1})})),o=tt(i.items),r.forEach((function(t,i){o.find((function(e){return e.source===t.source||e.file===t.source}))||e("ADD_ITEM",Object.assign({},t,{interactionMethod:ye.NONE,index:i}))}))},DID_UPDATE_ITEM_METADATA:function(n){var r=n.id,o=n.action,a=n.change;a.silent||(clearTimeout(i.itemUpdateTimeout),i.itemUpdateTimeout=setTimeout((function(){var n=ri(i.items,r);if(t("IS_ASYNC")){n.origin===Ve.LOCAL&&e("DID_LOAD_ITEM",{id:n.id,error:null,serverFileReference:n.source});var s=function(){setTimeout((function(){e("REQUEST_ITEM_PROCESSING",{query:r})}),32)},l=function(e){n.revert(Xt(i.options.server.url,i.options.server.revert),t("GET_FORCE_REVERT")).then(e?s:function(){}).catch((function(){}))},u=function(e){n.abortProcessing().then(e?s:function(){})};return n.status===Ue.PROCESSING_COMPLETE?l(i.options.instantUpload):n.status===Ue.PROCESSING?u(i.options.instantUpload):void(i.options.instantUpload&&s())}je("SHOULD_PREPARE_OUTPUT",!1,{item:n,query:t,action:o,change:a}).then((function(i){var o=t("GET_BEFORE_PREPARE_FILE");o&&(i=o(n,i)),i&&e("REQUEST_PREPARE_OUTPUT",{query:r,item:n,success:function(t){e("DID_PREPARE_OUTPUT",{id:r,file:t})}},!0)}))}),0))},MOVE_ITEM:function(e){var t=e.query,n=e.index,r=Ke(i.items,t);if(r){var o=i.items.indexOf(r);o!==(n=ht(n,0,i.items.length-1))&&i.items.splice(n,0,i.items.splice(o,1)[0])}},SORT:function(n){var r=n.compare;pi(i,r),e("DID_SORT_ITEMS",{items:t("GET_ACTIVE_ITEMS")})},ADD_ITEMS:function(i){var n=i.items,r=i.index,o=i.interactionMethod,a=i.success,s=void 0===a?function(){}:a,l=i.failure,u=void 0===l?function(){}:l,c=r;if(-1===r||void 0===r){var d=t("GET_ITEM_INSERT_LOCATION"),p=t("GET_TOTAL_ITEMS");c="before"===d?0:p}var f=t("GET_IGNORED_FILES"),h=function(e){return ei(e)?!f.includes(e.name.toLowerCase()):!W(e)},g=n.filter(h).map((function(t){return new Promise((function(i,n){e("ADD_ITEM",{interactionMethod:o,source:t.source||t,success:i,failure:n,index:c++,options:t.options||{}})}))}));Promise.all(g).then(s).catch(u)},ADD_ITEM:function(n){var r=n.source,o=n.index,a=void 0===o?-1:o,s=n.interactionMethod,l=n.success,u=void 0===l?function(){}:l,c=n.failure,d=void 0===c?function(){}:c,p=n.options,f=void 0===p?{}:p;if(W(r))d({error:Ut("error",0,"No source"),file:null});else if(!ei(r)||!i.options.ignoredFiles.includes(r.name.toLowerCase())){if(!ft(i)){if(i.options.allowMultiple||!i.options.allowMultiple&&!i.options.allowReplace){var h=Ut("warning",0,"Max files");return e("DID_THROW_MAX_FILES",{source:r,error:h}),void d({error:h,file:null})}var g=tt(i.items)[0];if(g.status===Ue.PROCESSING_COMPLETE||g.status===Ue.PROCESSING_REVERT_ERROR){var m=t("GET_FORCE_REVERT");if(g.revert(Xt(i.options.server.url,i.options.server.revert),m).then((function(){m&&e("ADD_ITEM",{source:r,index:a,interactionMethod:s,success:u,failure:d,options:f})})).catch((function(){})),m)return}e("REMOVE_ITEM",{query:g.id})}var E="local"===f.type?Ve.LOCAL:"limbo"===f.type?Ve.LIMBO:Ve.INPUT,_=ii(E,E===Ve.INPUT?null:r,f.file);Object.keys(f.metadata||{}).forEach((function(e){_.setMetadata(e,f.metadata[e])})),Ye("DID_CREATE_ITEM",_,{query:t,dispatch:e});var I=t("GET_ITEM_INSERT_LOCATION");i.options.itemInsertLocationFreedom||(a="before"===I?-1:i.items.length),mt(i.items,_,a),ie(I)&&r&&pi(i,I);var v=_.id;_.on("init",(function(){e("DID_INIT_ITEM",{id:v})})),_.on("load-init",(function(){e("DID_START_ITEM_LOAD",{id:v})})),_.on("load-meta",(function(){e("DID_UPDATE_ITEM_META",{id:v})})),_.on("load-progress",(function(t){e("DID_UPDATE_ITEM_LOAD_PROGRESS",{id:v,progress:t})})),_.on("load-request-error",(function(t){var n=li(i.options.labelFileLoadError)(t);if(t.code>=400&&t.code<500)return e("DID_THROW_ITEM_INVALID",{id:v,error:t,status:{main:n,sub:t.code+" ("+t.body+")"}}),void d({error:t,file:Fe(_)});e("DID_THROW_ITEM_LOAD_ERROR",{id:v,error:t,status:{main:n,sub:i.options.labelTapToRetry}})})),_.on("load-file-error",(function(t){e("DID_THROW_ITEM_INVALID",{id:v,error:t.status,status:t.status}),d({error:t.status,file:Fe(_)})})),_.on("load-abort",(function(){e("REMOVE_ITEM",{query:v})})),_.on("load-skip",(function(){e("COMPLETE_LOAD_ITEM",{query:v,item:_,data:{source:r,success:u}})})),_.on("load",(function(){var n=function(n){n?(_.on("metadata-update",(function(t){e("DID_UPDATE_ITEM_METADATA",{id:v,change:t})})),je("SHOULD_PREPARE_OUTPUT",!1,{item:_,query:t}).then((function(n){var o=t("GET_BEFORE_PREPARE_FILE");o&&(n=o(_,n));var a=function(){e("COMPLETE_LOAD_ITEM",{query:v,item:_,data:{source:r,success:u}}),ci(e,i)};n?e("REQUEST_PREPARE_OUTPUT",{query:v,item:_,success:function(t){e("DID_PREPARE_OUTPUT",{id:v,file:t}),a()}},!0):a()}))):e("REMOVE_ITEM",{query:v})};je("DID_LOAD_ITEM",_,{query:t,dispatch:e}).then((function(){di(t("GET_BEFORE_ADD_FILE"),Fe(_)).then(n)})).catch((function(t){if(!t||!t.error||!t.status)return n(!1);e("DID_THROW_ITEM_INVALID",{id:v,error:t.error,status:t.status})}))})),_.on("process-start",(function(){e("DID_START_ITEM_PROCESSING",{id:v})})),_.on("process-progress",(function(t){e("DID_UPDATE_ITEM_PROCESS_PROGRESS",{id:v,progress:t})})),_.on("process-error",(function(t){e("DID_THROW_ITEM_PROCESSING_ERROR",{id:v,error:t,status:{main:li(i.options.labelFileProcessingError)(t),sub:i.options.labelTapToRetry}})})),_.on("process-revert-error",(function(t){e("DID_THROW_ITEM_PROCESSING_REVERT_ERROR",{id:v,error:t,status:{main:li(i.options.labelFileProcessingRevertError)(t),sub:i.options.labelTapToRetry}})})),_.on("process-complete",(function(t){e("DID_COMPLETE_ITEM_PROCESSING",{id:v,error:null,serverFileReference:t}),e("DID_DEFINE_VALUE",{id:v,value:t})})),_.on("process-abort",(function(){e("DID_ABORT_ITEM_PROCESSING",{id:v})})),_.on("process-revert",(function(){e("DID_REVERT_ITEM_PROCESSING",{id:v}),e("DID_DEFINE_VALUE",{id:v,value:null})})),e("DID_ADD_ITEM",{id:v,index:a,interactionMethod:s}),ci(e,i);var T=i.options.server||{},y=T.url,w=T.load,O=T.restore,A=T.fetch;_.load(r,Nt(E===Ve.INPUT?Q(r)&&si(r)&&A?zt(y,A):oi:E===Ve.LIMBO?zt(y,O):zt(y,w)),(function(e,i,n){je("LOAD_FILE",e,{query:t}).then(i).catch(n)}))}},REQUEST_PREPARE_OUTPUT:function(e){var i=e.item,n=e.success,r=e.failure,o=void 0===r?function(){}:r,a={error:Ut("error",0,"Item not found"),file:null};if(i.archived)return o(a);je("PREPARE_OUTPUT",i.file,{query:t,item:i}).then((function(e){je("COMPLETE_PREPARE_OUTPUT",e,{query:t,item:i}).then((function(e){if(i.archived)return o(a);n(e)}))}))},COMPLETE_LOAD_ITEM:function(n){var r=n.item,o=n.data,a=o.success,s=o.source,l=t("GET_ITEM_INSERT_LOCATION");if(ie(l)&&s&&pi(i,l),e("DID_LOAD_ITEM",{id:r.id,error:null,serverFileReference:r.origin===Ve.INPUT?null:s}),a(Fe(r)),r.origin!==Ve.LOCAL)return r.origin===Ve.LIMBO?(e("DID_COMPLETE_ITEM_PROCESSING",{id:r.id,error:null,serverFileReference:s}),void e("DID_DEFINE_VALUE",{id:r.id,value:r.serverId||s})):void(t("IS_ASYNC")&&i.options.instantUpload&&e("REQUEST_ITEM_PROCESSING",{query:r.id}));e("DID_LOAD_LOCAL_ITEM",{id:r.id})},RETRY_ITEM_LOAD:fi(i,(function(e){e.retryLoad()})),REQUEST_ITEM_PREPARE:fi(i,(function(t,i,n){e("REQUEST_PREPARE_OUTPUT",{query:t.id,item:t,success:function(n){e("DID_PREPARE_OUTPUT",{id:t.id,file:n}),i({file:t,output:n})},failure:n},!0)})),REQUEST_ITEM_PROCESSING:fi(i,(function(n,r,o){if(n.status===Ue.IDLE||n.status===Ue.PROCESSING_ERROR)n.status!==Ue.PROCESSING_QUEUED&&(n.requestProcessing(),e("DID_REQUEST_ITEM_PROCESSING",{id:n.id}),e("PROCESS_ITEM",{query:n,success:r,failure:o},!0));else{var a=function(){return e("REQUEST_ITEM_PROCESSING",{query:n,success:r,failure:o})},s=function(){return document.hidden?a():setTimeout(a,32)};n.status===Ue.PROCESSING_COMPLETE||n.status===Ue.PROCESSING_REVERT_ERROR?n.revert(Xt(i.options.server.url,i.options.server.revert),t("GET_FORCE_REVERT")).then(s).catch((function(){})):n.status===Ue.PROCESSING&&n.abortProcessing().then(s)}})),PROCESS_ITEM:fi(i,(function(n,r,o){var a=t("GET_MAX_PARALLEL_UPLOADS");if(t("GET_ITEMS_BY_STATUS",Ue.PROCESSING).length!==a){if(n.status!==Ue.PROCESSING){var s=function t(){var n=i.processingQueue.shift();if(n){var r=n.id,o=n.success,a=n.failure,s=Ke(i.items,r);s&&!s.archived?e("PROCESS_ITEM",{query:r,success:o,failure:a},!0):t()}};n.onOnce("process-complete",(function(){r(Fe(n)),s();var o=i.options.server;if(i.options.instantUpload&&n.origin===Ve.LOCAL&&ie(o.remove)){var a=function(){};n.origin=Ve.LIMBO,i.options.server.remove(n.source,a,a)}t("GET_ITEMS_BY_STATUS",Ue.PROCESSING_COMPLETE).length===i.items.length&&e("DID_COMPLETE_ITEM_PROCESSING_ALL")})),n.onOnce("process-error",(function(e){o({error:e,file:Fe(n)}),s()}));var l=i.options;n.process($t(Yt(l.server.url,l.server.process,l.name,{chunkTransferId:n.transferId,chunkServer:l.server.patch,chunkUploads:l.chunkUploads,chunkForce:l.chunkForce,chunkSize:l.chunkSize,chunkRetryDelays:l.chunkRetryDelays}),{allowMinimumUploadDuration:t("GET_ALLOW_MINIMUM_UPLOAD_DURATION")}),(function(i,r,o){je("PREPARE_OUTPUT",i,{query:t,item:n}).then((function(t){e("DID_PREPARE_OUTPUT",{id:n.id,file:t}),r(t)})).catch(o)}))}}else i.processingQueue.push({id:n.id,success:r,failure:o})})),RETRY_ITEM_PROCESSING:fi(i,(function(t){e("REQUEST_ITEM_PROCESSING",{query:t})})),REQUEST_REMOVE_ITEM:fi(i,(function(i){di(t("GET_BEFORE_REMOVE_FILE"),Fe(i)).then((function(t){t&&e("REMOVE_ITEM",{query:i})}))})),RELEASE_ITEM:fi(i,(function(e){e.release()})),REMOVE_ITEM:fi(i,(function(n,r,o,a){var s=function(){var t=n.id;ri(i.items,t).archive(),e("DID_REMOVE_ITEM",{error:null,id:t,item:n}),ci(e,i),r(Fe(n))},l=i.options.server;n.origin===Ve.LOCAL&&l&&ie(l.remove)&&!1!==a.remove?(e("DID_START_ITEM_REMOVE",{id:n.id}),l.remove(n.source,(function(){return s()}),(function(t){e("DID_THROW_ITEM_REMOVE_ERROR",{id:n.id,error:Ut("error",0,t,null),status:{main:li(i.options.labelFileRemoveError)(t),sub:i.options.labelTapToRetry}})}))):((a.revert&&n.origin!==Ve.LOCAL&&null!==n.serverId||i.options.chunkUploads&&n.file.size>i.options.chunkSize||i.options.chunkUploads&&i.options.chunkForce)&&n.revert(Xt(i.options.server.url,i.options.server.revert),t("GET_FORCE_REVERT")),s())})),ABORT_ITEM_LOAD:fi(i,(function(e){e.abortLoad()})),ABORT_ITEM_PROCESSING:fi(i,(function(t){t.serverId?e("REVERT_ITEM_PROCESSING",{id:t.id}):t.abortProcessing().then((function(){i.options.instantUpload&&e("REMOVE_ITEM",{query:t.id})}))})),REQUEST_REVERT_ITEM_PROCESSING:fi(i,(function(n){if(i.options.instantUpload){var r=function(t){t&&e("REVERT_ITEM_PROCESSING",{query:n})},o=t("GET_BEFORE_REMOVE_FILE");if(!o)return r(!0);var a=o(Fe(n));return null==a?r(!0):"boolean"==typeof a?r(a):void("function"==typeof a.then&&a.then(r))}e("REVERT_ITEM_PROCESSING",{query:n})})),REVERT_ITEM_PROCESSING:fi(i,(function(n){n.revert(Xt(i.options.server.url,i.options.server.revert),t("GET_FORCE_REVERT")).then((function(){(i.options.instantUpload||ui(n))&&e("REMOVE_ITEM",{query:n.id})})).catch((function(){}))})),SET_OPTIONS:function(t){var i=t.options,n=Object.keys(i),r=gi.filter((function(e){return n.includes(e)}));[].concat(be(r),be(Object.keys(i).filter((function(e){return!r.includes(e)})))).forEach((function(t){e("SET_"+_e(t,"_").toUpperCase(),{value:i[t]})}))}}},gi=["server"],mi=function(e){return e},Ei=function(e){return document.createElement(e)},_i=function(e,t){var i=e.childNodes[0];i?t!==i.nodeValue&&(i.nodeValue=t):(i=document.createTextNode(t),e.appendChild(i))},Ii=function(e,t,i,n){var r=(n%360-90)*Math.PI/180;return{x:e+i*Math.cos(r),y:t+i*Math.sin(r)}},vi=function(e,t,i,n,r,o){var a=Ii(e,t,i,r),s=Ii(e,t,i,n);return["M",a.x,a.y,"A",i,i,0,o,0,s.x,s.y].join(" ")},Ti=function(e,t,i,n,r){var o=1;return r>n&&r-n<=.5&&(o=0),n>r&&n-r>=.5&&(o=0),vi(e,t,i,360*Math.min(.9999,n),360*Math.min(.9999,r),o)},yi=k({tag:"div",name:"progress-indicator",ignoreRectUpdate:!0,ignoreRect:!0,create:function(e){var t=e.root,i=e.props;i.spin=!1,i.progress=0,i.opacity=0;var n=c("svg");t.ref.path=c("path",{"stroke-width":2,"stroke-linecap":"round"}),n.appendChild(t.ref.path),t.ref.svg=n,t.appendChild(n)},write:function(e){var t=e.root,i=e.props;if(0!==i.opacity){i.align&&(t.element.dataset.align=i.align);var n=parseInt(a(t.ref.path,"stroke-width"),10),r=.5*t.rect.element.width,o=0,s=0;i.spin?(o=0,s=.5):(o=0,s=i.progress);var l=Ti(r,r,r-n,o,s);a(t.ref.path,"d",l),a(t.ref.path,"stroke-opacity",i.spin||i.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}}}}),wi=k({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,i=e.props;t.element.innerHTML=(i.icon||"")+""+i.label+"",i.isDisabled=!1},write:function(e){var t=e.root,i=e.props,n=i.isDisabled,r=t.query("GET_DISABLED")||0===i.opacity;r&&!n?(i.isDisabled=!0,a(t.element,"disabled","disabled")):!r&&n&&(i.isDisabled=!1,t.element.removeAttribute("disabled"))}}),Oi=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:".",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e3,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=n.labelBytes,o=void 0===r?"bytes":r,a=n.labelKilobytes,s=void 0===a?"KB":a,l=n.labelMegabytes,u=void 0===l?"MB":l,c=n.labelGigabytes,d=void 0===c?"GB":c,p=i,f=i*i,h=i*i*i;return(e=Math.round(Math.abs(e)))16&&!n&&(n=!0,t.element.removeEventListener("click",t.ref.handleClick)),t.dispatch("DID_DRAG_ITEM",{id:i.id,dragState:o}))},s=function e(s){s.isPrimary&&(document.removeEventListener("pointermove",a),document.removeEventListener("pointerup",e),i.dragOffset={x:s.pageX-r.x,y:s.pageY-r.y},t.dispatch("DID_DROP_ITEM",{id:i.id,dragState:o}),n&&setTimeout((function(){return t.element.addEventListener("click",t.ref.handleClick)}),0))};document.addEventListener("pointermove",a),document.addEventListener("pointerup",s)}};t.element.addEventListener("pointerdown",n)}},cn=V({DID_UPDATE_PANEL_HEIGHT:function(e){var t=e.root,i=e.action;t.height=i.height}}),dn=V({DID_GRAB_ITEM:function(e){var t=e.root;e.props.dragOrigin={x:t.translateX,y:t.translateY}},DID_DRAG_ITEM:function(e){e.root.element.dataset.dragState="drag"},DID_DROP_ITEM:function(e){var t=e.root,i=e.props;i.dragOffset=null,i.dragOrigin=null,t.element.dataset.dragState="drop"}},(function(e){var t=e.root,i=e.actions,n=e.props,r=e.shouldOptimize;"drop"===t.element.dataset.dragState&&t.scaleX<=1&&(t.element.dataset.dragState="idle");var o=i.concat().filter((function(e){return/^DID_/.test(e.type)})).reverse().find((function(e){return ln[e.type]}));o&&o.type!==n.currentState&&(n.currentState=o.type,t.element.dataset.filepondItemState=ln[n.currentState]||"");var a=t.query("GET_ITEM_PANEL_ASPECT_RATIO")||t.query("GET_PANEL_ASPECT_RATIO");a?r||(t.height=t.rect.element.width*a):(cn({root:t,actions:i,props:n}),!t.height&&t.ref.container.rect.element.height>0&&(t.height=t.ref.container.rect.element.height)),r&&(t.ref.panel.height=null),t.ref.panel.height=t.height})),pn=k({create:un,write:dn,destroy:function(e){var t=e.root,i=e.props;t.element.removeEventListener("click",t.ref.handleClick),t.dispatch("RELEASE_ITEM",{query:i.id})},tag:"li",name:"item",mixins:{apis:["id","interactionMethod","markedForRemoval","spawnDate","dragCenter","dragOrigin","dragOffset"],styles:["translateX","translateY","scaleX","scaleY","opacity","height"],animations:{scaleX:sn,scaleY:sn,translateX:an,translateY:an,opacity:{type:"tween",duration:150}}}}),fn=function(e,t){return Math.max(1,Math.floor((e+1)/t))},hn=function(e,t,i){if(i){var n=e.rect.element.width,r=t.length,o=null;if(0===r||i.top_){if(i.left3&&void 0!==arguments[3]?arguments[3]:0,r=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=i,Date.now()>e.spawnDate&&(0===e.opacity&&_n(e,t,i,n,r),e.scaleX=1,e.scaleY=1,e.opacity=1))},_n=function(e,t,i,n,r){e.interactionMethod===ye.NONE?(e.translateX=null,e.translateX=t,e.translateY=null,e.translateY=i):e.interactionMethod===ye.DROP?(e.translateX=null,e.translateX=t-20*n,e.translateY=null,e.translateY=i-10*r,e.scaleX=.8,e.scaleY=.8):e.interactionMethod===ye.BROWSE?(e.translateY=null,e.translateY=i-30):e.interactionMethod===ye.API&&(e.translateX=null,e.translateX=t-30,e.translateY=null)},In=function(e){return e.rect.element.height+.5*e.rect.element.marginBottom+.5*e.rect.element.marginTop},vn=function(e){return e.rect.element.width+.5*e.rect.element.marginLeft+.5*e.rect.element.marginRight},Tn=V({DID_ADD_ITEM:function(e){var t=e.root,i=e.action,n=i.id,r=i.index,o=i.interactionMethod;t.ref.addIndex=r;var a=Date.now(),s=a,l=1;if(o!==ye.NONE){l=0;var u=t.query("GET_ITEM_INSERT_INTERVAL"),c=a-t.ref.lastItemSpanwDate;s=cs&&(p=s);var f=Math.floor(s/p+1);gn.setHeight=c*f,gn.setWidth=d*p;var h={y:Math.floor(u.y/c),x:Math.floor(u.x/d),getGridIndex:function(){return u.y>gn.getHeight||u.y<0||u.x>gn.getWidth||u.x<0?l:this.y*p+this.x},getColIndex:function(){for(var e=t.query("GET_ACTIVE_ITEMS"),i=t.childViews.filter((function(e){return e.rect.element.height})),n=e.map((function(e){return i.find((function(t){return t.id===e.id}))})),r=n.findIndex((function(e){return e===a})),o=In(a),s=n.length,l=s,c=0,d=0,p=0;pp){if(u.y1?h.getGridIndex():h.getColIndex();t.dispatch("MOVE_ITEM",{query:a,index:g});var m=r.getIndex();if(void 0===m||m!==g){if(r.setIndex(g),void 0===m)return;t.dispatch("DID_REORDER_ITEMS",{items:t.query("GET_ACTIVE_ITEMS"),origin:l,target:g})}}}}),yn=k({create:mn,write:function(e){var t=e.root,i=e.props,n=e.actions,r=e.shouldOptimize;Tn({root:t,props:i,actions:n});var o=i.dragCoordinates,a=t.rect.element.width,s=t.childViews.filter((function(e){return e.rect.element.height})),l=t.query("GET_ACTIVE_ITEMS").map((function(e){return s.find((function(t){return t.id===e.id}))})).filter((function(e){return e})),u=o?hn(t,l,o):null,c=t.ref.addIndex||null;t.ref.addIndex=null;var d=0,p=0,f=0;if(0!==l.length){var h=l[0].rect.element,g=h.marginTop+h.marginBottom,m=h.marginLeft+h.marginRight,E=h.width+m,_=h.height+g,I=fn(a,E);if(1===I){var v=0,T=0;l.forEach((function(e,t){if(u){var i=t-u;T=-2===i?.25*-g:-1===i?.75*-g:0===i?.75*g:1===i?.25*g:0}r&&(e.translateX=null,e.translateY=null),e.markedForRemoval||En(e,0,v+T);var n=(e.rect.element.height+g)*(e.markedForRemoval?e.opacity:1);v+=n}))}else{var y=0,w=0;l.forEach((function(e,t){t===u&&(d=1),t===c&&(f+=1),e.markedForRemoval&&e.opacity<.5&&(p-=1);var i=t+f+d+p,n=i%I,o=Math.floor(i/I),a=n*E,s=o*_,l=Math.sign(a-y),h=Math.sign(s-w);y=a,w=s,e.markedForRemoval||(r&&(e.translateX=null,e.translateY=null),En(e,a,s,l,h))}))}}},tag:"ul",name:"list",didWriteView:function(e){var t=e.root;t.childViews.filter((function(e){return e.markedForRemoval&&0===e.opacity&&e.resting})).forEach((function(e){e._destroy(),t.removeChildView(e)}))},filterFrameActionsForChild:function(e,t){return t.filter((function(t){return!t.data||!t.data.id||e.id===t.data.id}))},mixins:{apis:["dragCoordinates"]}}),wn=function(e){var t=e.root,i=e.props;t.ref.list=t.appendChildView(t.createChildView(yn)),i.dragCoordinates=null,i.overflowing=!1},On=V({DID_DRAG:function(e){var t=e.root,i=e.props,n=e.action;t.query("GET_ITEM_INSERT_LOCATION_FREEDOM")&&(i.dragCoordinates={left:n.position.scopeLeft-t.ref.list.rect.element.left,top:n.position.scopeTop-(t.rect.outer.top+t.rect.element.marginTop+t.rect.element.scrollTop)})},DID_END_DRAG:function(e){e.props.dragCoordinates=null}}),An=k({create:wn,write:function(e){var t=e.root,i=e.props,n=e.actions;if(On({root:t,props:i,actions:n}),t.ref.list.dragCoordinates=i.dragCoordinates,i.overflowing&&!i.overflow&&(i.overflowing=!1,t.element.dataset.state="",t.height=null),i.overflow){var r=Math.round(i.overflow);r!==t.height&&(i.overflowing=!0,t.element.dataset.state="overflow",t.height=r)}},name:"list-scroller",mixins:{apis:["overflow","dragCoordinates"],styles:["height","translateY"],animations:{translateY:"spring"}}}),Rn=function(e,t,i){i?a(e,t,arguments.length>3&&void 0!==arguments[3]?arguments[3]:""):e.removeAttribute(t)},Sn=function(e){if(e&&""!==e.value){try{e.value=""}catch(e){}if(e.value){var t=Ei("form"),i=e.parentNode,n=e.nextSibling;t.appendChild(e),t.reset(),n?i.insertBefore(e,n):i.appendChild(e)}}},bn=function(e){var t=e.root,i=e.props;t.element.id="filepond--browser-"+i.id,a(t.element,"name",t.query("GET_NAME")),a(t.element,"aria-controls","filepond--assistant-"+i.id),a(t.element,"aria-labelledby","filepond--drop-label-"+i.id),Mn({root:t,action:{value:t.query("GET_ACCEPTED_FILE_TYPES")}}),Cn({root:t,action:{value:t.query("GET_ALLOW_MULTIPLE")}}),Pn({root:t,action:{value:t.query("GET_ALLOW_DIRECTORIES_ONLY")}}),Ln({root:t}),Dn({root:t,action:{value:t.query("GET_REQUIRED")}}),xn({root:t,action:{value:t.query("GET_CAPTURE_METHOD")}}),t.ref.handleChange=function(e){if(t.element.value){var n=Array.from(t.element.files).map((function(e){return e._relativePath=e.webkitRelativePath,e}));setTimeout((function(){i.onload(n),Sn(t.element)}),250)}},t.element.addEventListener("change",t.ref.handleChange)},Mn=function(e){var t=e.root,i=e.action;t.query("GET_ALLOW_SYNC_ACCEPT_ATTRIBUTE")&&Rn(t.element,"accept",!!i.value,i.value?i.value.join(","):"")},Cn=function(e){var t=e.root,i=e.action;Rn(t.element,"multiple",i.value)},Pn=function(e){var t=e.root,i=e.action;Rn(t.element,"webkitdirectory",i.value)},Ln=function(e){var t=e.root,i=t.query("GET_DISABLED"),n=t.query("GET_ALLOW_BROWSE"),r=i||!n;Rn(t.element,"disabled",r)},Dn=function(e){var t=e.root;e.action.value?0===t.query("GET_TOTAL_ITEMS")&&Rn(t.element,"required",!0):Rn(t.element,"required",!1)},xn=function(e){var t=e.root,i=e.action;Rn(t.element,"capture",!!i.value,!0===i.value?"":i.value)},Gn=function(e){var t=e.root,i=t.element;t.query("GET_TOTAL_ITEMS")>0?(Rn(i,"required",!1),Rn(i,"name",!1)):(Rn(i,"name",!0,t.query("GET_NAME")),t.query("GET_CHECK_VALIDITY")&&i.setCustomValidity(""),t.query("GET_REQUIRED")&&Rn(i,"required",!0))},Nn=k({tag:"input",name:"browser",ignoreRect:!0,ignoreRectUpdate:!0,attributes:{type:"file"},create:bn,destroy:function(e){var t=e.root;t.element.removeEventListener("change",t.ref.handleChange)},write:V({DID_LOAD_ITEM:Gn,DID_REMOVE_ITEM:Gn,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:Ln,DID_SET_ALLOW_BROWSE:Ln,DID_SET_ALLOW_DIRECTORIES_ONLY:Pn,DID_SET_ALLOW_MULTIPLE:Cn,DID_SET_ACCEPTED_FILE_TYPES:Mn,DID_SET_CAPTURE_METHOD:xn,DID_SET_REQUIRED:Dn})}),Fn={ENTER:13,SPACE:32},kn=function(e){var t=e.root,i=e.props,n=Ei("label");a(n,"for","filepond--browser-"+i.id),a(n,"id","filepond--drop-label-"+i.id),a(n,"aria-hidden","true"),t.ref.handleKeyDown=function(e){(e.keyCode===Fn.ENTER||e.keyCode===Fn.SPACE)&&(e.preventDefault(),t.ref.label.click())},t.ref.handleClick=function(e){e.target===n||n.contains(e.target)||t.ref.label.click()},n.addEventListener("keydown",t.ref.handleKeyDown),t.element.addEventListener("click",t.ref.handleClick),Un(n,i.caption),t.appendChild(n),t.ref.label=n},Un=function(e,t){e.innerHTML=t;var i=e.querySelector(".filepond--label-action");return i&&a(i,"tabindex","0"),t},Vn=k({name:"drop-label",ignoreRect:!0,create:kn,destroy:function(e){var t=e.root;t.ref.label.addEventListener("keydown",t.ref.handleKeyDown),t.element.removeEventListener("click",t.ref.handleClick)},write:V({DID_SET_LABEL_IDLE:function(e){var t=e.root,i=e.action;Un(t.ref.label,i.value)}}),mixins:{styles:["opacity","translateX","translateY"],animations:{opacity:{type:"tween",duration:150},translateX:"spring",translateY:"spring"}}}),Bn=k({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}}}}),qn=function(e){var t=e.root,i=.5*t.rect.element.width,n=.5*t.rect.element.height;t.ref.blob=t.appendChildView(t.createChildView(Bn,{opacity:0,scaleX:2.5,scaleY:2.5,translateX:i,translateY:n}))},zn=function(e){var t=e.root,i=e.props,n=e.actions;Wn({root:t,props:i,actions:n});var r=t.ref.blob;0===n.length&&r&&0===r.opacity&&(t.removeChildView(r),t.ref.blob=null)},Wn=V({DID_DRAG:function(e){var t=e.root,i=e.action;t.ref.blob?(t.ref.blob.translateX=i.position.scopeLeft,t.ref.blob.translateY=i.position.scopeTop,t.ref.blob.scaleX=1,t.ref.blob.scaleY=1,t.ref.blob.opacity=1):qn({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)}}),Hn=k({ignoreRect:!0,ignoreRectUpdate:!0,name:"drip",write:zn}),jn=function(e,t){try{var i=new DataTransfer;t.forEach((function(e){e instanceof File?i.items.add(e):i.items.add(new File([e],e.name,{type:e.type}))})),e.files=i.files}catch(e){return!1}return!0},Yn=function(e){return e.root.ref.fields={}},Xn=function(e,t){return e.ref.fields[t]},Zn=function(e){e.query("GET_ACTIVE_ITEMS").forEach((function(t){e.ref.fields[t.id]&&e.element.appendChild(e.ref.fields[t.id])}))},Qn=function(e){var t=e.root;return Zn(t)},$n=V({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,i=e.action,n=!(t.query("GET_ITEM",i.id).origin===Ve.LOCAL)&&t.query("SHOULD_UPDATE_FILE_INPUT"),r=Ei("input");r.type=n?"file":"hidden",r.name=t.query("GET_NAME"),r.disabled=t.query("GET_DISABLED"),t.ref.fields[i.id]=r,Zn(t)},DID_LOAD_ITEM:function(e){var t=e.root,i=e.action,n=Xn(t,i.id);if(n&&(null!==i.serverFileReference&&(n.value=i.serverFileReference),t.query("SHOULD_UPDATE_FILE_INPUT"))){var r=t.query("GET_ITEM",i.id);jn(n,[r.file])}},DID_REMOVE_ITEM:function(e){var t=e.root,i=e.action,n=Xn(t,i.id);n&&(n.parentNode&&n.parentNode.removeChild(n),delete t.ref.fields[i.id])},DID_DEFINE_VALUE:function(e){var t=e.root,i=e.action,n=Xn(t,i.id);n&&(null===i.value?n.removeAttribute("value"):n.value=i.value,Zn(t))},DID_PREPARE_OUTPUT:function(e){var t=e.root,i=e.action;t.query("SHOULD_UPDATE_FILE_INPUT")&&setTimeout((function(){var e=Xn(t,i.id);e&&jn(e,[i.file])}),0)},DID_REORDER_ITEMS:Qn,DID_SORT_ITEMS:Qn}),Jn=k({tag:"fieldset",name:"data",create:Yn,write:$n,ignoreRect:!0}),Kn=function(e){return"getRootNode"in e?e.getRootNode():document},er=["jpg","jpeg","png","gif","bmp","webp","svg","tiff"],tr=["css","csv","html","txt"],ir={zip:"zip|compressed",epub:"application/epub+zip"},nr=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return e=e.toLowerCase(),er.includes(e)?"image/"+("jpg"===e?"jpeg":"svg"===e?"svg+xml":e):tr.includes(e)?"text/"+e:ir[e]||""},rr=function(e){return new Promise((function(t,i){var n=hr(e);if(n.length&&!or(e))return t(n);ar(e).then(t)}))},or=function(e){return!!e.files&&e.files.length>0},ar=function(e){return new Promise((function(t,i){var n=(e.items?Array.from(e.items):[]).filter((function(e){return sr(e)})).map((function(e){return lr(e)}));n.length?Promise.all(n).then((function(e){var i=[];e.forEach((function(e){i.push.apply(i,e)})),t(i.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):[])}))},sr=function(e){if(pr(e)){var t=fr(e);if(t)return t.isFile||t.isDirectory}return"file"===e.kind},lr=function(e){return new Promise((function(t,i){dr(e)?ur(fr(e)).then(t).catch(i):t([e.getAsFile()])}))},ur=function(e){return new Promise((function(t,i){var n=[],r=0,o=0,a=function(){0===o&&0===r&&t(n)},s=function e(t){r++;var s=t.createReader(),l=function t(){s.readEntries((function(i){if(0===i.length)return r--,void a();i.forEach((function(t){t.isDirectory?e(t):(o++,t.file((function(e){var i=cr(e);t.fullPath&&(i._relativePath=t.fullPath),n.push(i),o--,a()})))})),t()}),i)};l()};s(e)}))},cr=function(e){if(e.type.length)return e;var t=e.lastModifiedDate,i=e.name,n=nr(It(e.name));return n.length?((e=e.slice(0,e.size,n)).name=i,e.lastModifiedDate=t,e):e},dr=function(e){return pr(e)&&(fr(e)||{}).isDirectory},pr=function(e){return"webkitGetAsEntry"in e},fr=function(e){return e.webkitGetAsEntry()},hr=function(e){var t=[];try{if((t=mr(e)).length)return t;t=gr(e)}catch(e){}return t},gr=function(e){var t=e.getData("url");return"string"==typeof t&&t.length?[t]:[]},mr=function(e){var t=e.getData("text/html");if("string"==typeof t&&t.length){var i=t.match(/src\s*=\s*"(.+?)"/);if(i)return[i[1]]}return[]},Er=[],_r=function(e){return{pageLeft:e.pageX,pageTop:e.pageY,scopeLeft:e.offsetX||e.layerX,scopeTop:e.offsetY||e.layerY}},Ir=function(e,t,i){var n=vr(t),r={element:e,filterElement:i,state:null,ondrop:function(){},onenter:function(){},ondrag:function(){},onexit:function(){},onload:function(){},allowdrop:function(){}};return r.destroy=n.addListener(r),r},vr=function(e){var t=Er.find((function(t){return t.element===e}));if(t)return t;var i=Tr(e);return Er.push(i),i},Tr=function(e){var t=[],i={dragenter:Rr,dragover:Sr,dragleave:Mr,drop:br},n={};r(i,(function(i,r){n[i]=r(e,t),e.addEventListener(i,n[i],!1)}));var o={element:e,addListener:function(a){return t.push(a),function(){t.splice(t.indexOf(a),1),0===t.length&&(Er.splice(Er.indexOf(o),1),r(i,(function(t){e.removeEventListener(t,n[t],!1)})))}}};return o},yr=function(e,t){return"elementFromPoint"in e||(e=document),e.elementFromPoint(t.x,t.y)},wr=function(e,t){var i=Kn(t),n=yr(i,{x:e.pageX-window.pageXOffset,y:e.pageY-window.pageYOffset});return n===t||t.contains(n)},Or=null,Ar=function(e,t){try{e.dropEffect=t}catch(e){}},Rr=function(e,t){return function(e){e.preventDefault(),Or=e.target,t.forEach((function(t){var i=t.element,n=t.onenter;wr(e,i)&&(t.state="enter",n(_r(e)))}))}},Sr=function(e,t){return function(e){e.preventDefault();var i=e.dataTransfer;rr(i).then((function(n){var r=!1;t.some((function(t){var o=t.filterElement,a=t.element,s=t.onenter,l=t.onexit,u=t.ondrag,c=t.allowdrop;Ar(i,"copy");var d=c(n);if(d)if(wr(e,a)){if(r=!0,null===t.state)return t.state="enter",void s(_r(e));if(t.state="over",o&&!d)return void Ar(i,"none");u(_r(e))}else o&&!r&&Ar(i,"none"),t.state&&(t.state=null,l(_r(e)));else Ar(i,"none")}))}))}},br=function(e,t){return function(e){e.preventDefault();var i=e.dataTransfer;rr(i).then((function(i){t.forEach((function(t){var n=t.filterElement,r=t.element,o=t.ondrop,a=t.onexit,s=t.allowdrop;if(t.state=null,!n||wr(e,r))return s(i)?void o(_r(e),i):a(_r(e))}))}))}},Mr=function(e,t){return function(e){Or===e.target&&t.forEach((function(t){var i=t.onexit;t.state=null,i(_r(e))}))}},Cr=function(e,t,i){e.classList.add("filepond--hopper");var n=i.catchesDropsOnPage,r=i.requiresDropOnElement,o=i.filterItems,a=void 0===o?function(e){return e}:o,s=Ir(e,n?document.documentElement:e,r),l="",u="";s.allowdrop=function(e){return t(a(e))},s.ondrop=function(e,i){var n=a(i);t(n)?(u="drag-drop",c.onload(n,e)):c.ondragend(e)},s.ondrag=function(e){c.ondrag(e)},s.onenter=function(e){u="drag-over",c.ondragstart(e)},s.onexit=function(e){u="drag-exit",c.ondragend(e)};var c={updateHopperState:function(){l!==u&&(e.dataset.hopperState=u,l=u)},onload:function(){},ondragstart:function(){},ondrag:function(){},ondragend:function(){},destroy:function(){s.destroy()}};return c},Pr=!1,Lr=[],Dr=function(e){var t=document.activeElement;if(t&&/textarea|input/i.test(t.nodeName)){for(var i=!1,n=t;n!==document.body;){if(n.classList.contains("filepond--root")){i=!0;break}n=n.parentNode}if(!i)return}rr(e.clipboardData).then((function(e){e.length&&Lr.forEach((function(t){return t(e)}))}))},xr=function(e){Lr.includes(e)||(Lr.push(e),Pr||(Pr=!0,document.addEventListener("paste",Dr)))},Gr=function(e){Le(Lr,Lr.indexOf(e)),0===Lr.length&&(document.removeEventListener("paste",Dr),Pr=!1)},Nr=function(){var e=function(e){t.onload(e)},t={destroy:function(){Gr(e)},onload:function(){}};return xr(e),t},Fr=null,kr=null,Ur=[],Vr=function(e,t){e.element.textContent=t},Br=function(e){e.element.textContent=""},qr=function(e,t,i){var n=e.query("GET_TOTAL_ITEMS");Vr(e,i+" "+t+", "+n+" "+(1===n?e.query("GET_LABEL_FILE_COUNT_SINGULAR"):e.query("GET_LABEL_FILE_COUNT_PLURAL"))),clearTimeout(kr),kr=setTimeout((function(){Br(e)}),1500)},zr=function(e){return e.element.parentNode.contains(document.activeElement)},Wr=function(e){var t=e.root,i=e.action,n=t.query("GET_ITEM",i.id).filename,r=t.query("GET_LABEL_FILE_PROCESSING_ABORTED");Vr(t,n+" "+r)},Hr=function(e){var t=e.root,i=e.action,n=t.query("GET_ITEM",i.id).filename;Vr(t,i.status.main+" "+n+" "+i.status.sub)},jr=k({create:function(e){var t=e.root,i=e.props;t.element.id="filepond--assistant-"+i.id,a(t.element,"role","status"),a(t.element,"aria-live","polite"),a(t.element,"aria-relevant","additions")},ignoreRect:!0,ignoreRectUpdate:!0,write:V({DID_LOAD_ITEM:function(e){var t=e.root,i=e.action;if(zr(t)){t.element.textContent="";var n=t.query("GET_ITEM",i.id);Ur.push(n.filename),clearTimeout(Fr),Fr=setTimeout((function(){qr(t,Ur.join(", "),t.query("GET_LABEL_FILE_ADDED")),Ur.length=0}),750)}},DID_REMOVE_ITEM:function(e){var t=e.root,i=e.action;if(zr(t)){var n=i.item;qr(t,n.filename,t.query("GET_LABEL_FILE_REMOVED"))}},DID_COMPLETE_ITEM_PROCESSING:function(e){var t=e.root,i=e.action,n=t.query("GET_ITEM",i.id).filename,r=t.query("GET_LABEL_FILE_PROCESSING_COMPLETE");Vr(t,n+" "+r)},DID_ABORT_ITEM_PROCESSING:Wr,DID_REVERT_ITEM_PROCESSING:Wr,DID_THROW_ITEM_REMOVE_ERROR:Hr,DID_THROW_ITEM_LOAD_ERROR:Hr,DID_THROW_ITEM_INVALID:Hr,DID_THROW_ITEM_PROCESSING_ERROR:Hr}),tag:"span",name:"assistant"}),Yr=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()}))},Xr=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:16,i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],n=Date.now(),r=null;return function(){for(var o=arguments.length,a=new Array(o),s=0;s2*S)for(var b=R.length,M=b-10,C=0,P=b;P>=M;P--)if(R[P]===R[P-2]&&C++,C>=S)return;u.scalable=!1,u.height=A;var L=A-I-(T-m.bottom)-(f?v:0);E.visual>L?l.overflow=L:l.overflow=null,t.height=A}else if(r.fixedHeight){u.scalable=!1;var D=r.fixedHeight-I-(T-m.bottom)-(f?v:0);E.visual>D?l.overflow=D:l.overflow=null}else if(r.cappedHeight){var x=y>=r.cappedHeight,G=Math.min(r.cappedHeight,y);u.scalable=!0,u.height=x?G:G-m.top-m.bottom;var N=G-I-(T-m.bottom)-(f?v:0);y>r.cappedHeight&&E.visual>N?l.overflow=N:l.overflow=null,t.height=Math.min(r.cappedHeight,w-m.top-m.bottom)}else{var F=p>0?m.top+m.bottom:0;u.scalable=!0,u.height=Math.max(_,y-F),t.height=Math.max(_,w-F)}t.ref.credits&&u.heightCurrent&&(t.ref.credits.style.transform="translateY("+u.heightCurrent+"px)")}},Kr=function(e){var t=e.ref.list.childViews[0].childViews[0];return t?{top:t.rect.element.marginTop,bottom:t.rect.element.marginBottom}:{top:0,bottom:0}},eo=function(e){var t=0,i=0,n=e.ref.list,r=n.childViews[0],o=r.childViews.filter((function(e){return e.rect.element.height})),a=e.query("GET_ACTIVE_ITEMS").map((function(e){return o.find((function(t){return t.id===e.id}))})).filter((function(e){return e}));if(0===a.length)return{visual:t,bounds:i};var s=r.rect.element.width,l=hn(r,a,n.dragCoordinates),u=a[0].rect.element,c=u.marginTop+u.marginBottom,d=u.marginLeft+u.marginRight,p=u.width+d,f=u.height+c,h=void 0!==l&&l>=0?1:0,g=a.find((function(e){return e.markedForRemoval&&e.opacity<.45}))?-1:0,m=a.length+h+g,E=fn(s,p);return 1===E?a.forEach((function(e){var n=e.rect.element.height+c;i+=n,t+=n*e.opacity})):(i=Math.ceil(m/E)*f,t=i),{visual:t,bounds:i}},to=function(e){var t=e.ref.measureHeight||null;return{cappedHeight:parseInt(e.style.maxHeight,10)||null,fixedHeight:0===t?null:t}},io=function(e,t){var i=e.query("GET_ALLOW_REPLACE"),n=e.query("GET_ALLOW_MULTIPLE"),r=e.query("GET_TOTAL_ITEMS"),o=e.query("GET_MAX_FILES"),a=t.length;return!n&&a>1||!!(ee(o=n||i?o:1)&&r+a>o)&&(e.dispatch("DID_THROW_MAX_FILES",{source:t,error:Ut("warning",0,"Max files")}),!0)},no=function(e,t,i){var n=e.childViews[0];return hn(n,t,{left:i.scopeLeft-n.rect.element.left,top:i.scopeTop-(e.rect.outer.top+e.rect.element.marginTop+e.rect.element.scrollTop)})},ro=function(e){var t=e.query("GET_ALLOW_DROP"),i=e.query("GET_DISABLED"),n=t&&!i;if(n&&!e.ref.hopper){var r=Cr(e.element,(function(t){var i=e.query("GET_BEFORE_DROP_FILE")||function(){return!0};return!e.query("GET_DROP_VALIDATION")||t.every((function(t){return Ye("ALLOW_HOPPER_ITEM",t,{query:e.query}).every((function(e){return!0===e}))&&i(t)}))}),{filterItems:function(t){var i=e.query("GET_IGNORED_FILES");return t.filter((function(e){return!ei(e)||!i.includes(e.name.toLowerCase())}))},catchesDropsOnPage:e.query("GET_DROP_ON_PAGE"),requiresDropOnElement:e.query("GET_DROP_ON_ELEMENT")});r.onload=function(t,i){var n=e.ref.list.childViews[0].childViews.filter((function(e){return e.rect.element.height})),r=e.query("GET_ACTIVE_ITEMS").map((function(e){return n.find((function(t){return t.id===e.id}))})).filter((function(e){return e}));je("ADD_ITEMS",t,{dispatch:e.dispatch}).then((function(t){if(io(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:no(e.ref.list,r,i),interactionMethod:ye.DROP})})),e.dispatch("DID_DROP",{position:i}),e.dispatch("DID_END_DRAG",{position:i})},r.ondragstart=function(t){e.dispatch("DID_START_DRAG",{position:t})},r.ondrag=Xr((function(t){e.dispatch("DID_DRAG",{position:t})})),r.ondragend=function(t){e.dispatch("DID_END_DRAG",{position:t})},e.ref.hopper=r,e.ref.drip=e.appendChildView(e.createChildView(Hn))}else!n&&e.ref.hopper&&(e.ref.hopper.destroy(),e.ref.hopper=null,e.removeChildView(e.ref.drip))},oo=function(e,t){var i=e.query("GET_ALLOW_BROWSE"),n=e.query("GET_DISABLED"),r=i&&!n;r&&!e.ref.browser?e.ref.browser=e.appendChildView(e.createChildView(Nn,Object.assign({},t,{onload:function(t){je("ADD_ITEMS",t,{dispatch:e.dispatch}).then((function(t){if(io(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:ye.BROWSE})}))}})),0):!r&&e.ref.browser&&(e.removeChildView(e.ref.browser),e.ref.browser=null)},ao=function(e){var t=e.query("GET_ALLOW_PASTE"),i=e.query("GET_DISABLED"),n=t&&!i;n&&!e.ref.paster?(e.ref.paster=Nr(),e.ref.paster.onload=function(t){je("ADD_ITEMS",t,{dispatch:e.dispatch}).then((function(t){if(io(e,t))return!1;e.dispatch("ADD_ITEMS",{items:t,index:-1,interactionMethod:ye.PASTE})}))}):!n&&e.ref.paster&&(e.ref.paster.destroy(),e.ref.paster=null)},so=V({DID_SET_ALLOW_BROWSE:function(e){var t=e.root,i=e.props;oo(t,i)},DID_SET_ALLOW_DROP:function(e){var t=e.root;ro(t)},DID_SET_ALLOW_PASTE:function(e){var t=e.root;ao(t)},DID_SET_DISABLED:function(e){var t=e.root,i=e.props;ro(t),ao(t),oo(t,i),t.query("GET_DISABLED")?t.element.dataset.disabled="disabled":t.element.removeAttribute("data-disabled")}}),lo=k({name:"root",read:function(e){var t=e.root;t.ref.measure&&(t.ref.measureHeight=t.ref.measure.offsetHeight)},create:$r,write:Jr,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",Qr),t.element.removeEventListener("gesturestart",Qr)},mixins:{styles:["height"]}}),uo=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=null,n=Qe(),r=i(Ee(n),[pt,Te(n)],[hi,ve(n)]);r.dispatch("SET_OPTIONS",{options:e});var a=function(){document.hidden||r.dispatch("KICK")};document.addEventListener("visibilitychange",a);var s=null,l=!1,u=!1,c=null,d=null,p=function(){l||(l=!0),clearTimeout(s),s=setTimeout((function(){l=!1,c=null,d=null,u&&(u=!1,r.dispatch("DID_STOP_RESIZE"))}),500)};window.addEventListener("resize",p);var f=lo(r,{id:we()}),h=!1,g=!1,m={_read:function(){l&&(d=window.innerWidth,c||(c=d),u||d===c||(r.dispatch("DID_START_RESIZE"),u=!0)),g&&h&&(h=null===f.element.offsetParent),h||(f._read(),g=f.rect.element.hidden)},_write:function(e){var t=r.processActionQueue().filter((function(e){return!/^SET_/.test(e.type)}));h&&!t.length||(v(t),h=f._write(e,t,u),ke(r.query("GET_ITEMS")),h&&r.processDispatchQueue())}},E=function(e){return function(t){var i={type:e};if(!t)return i;if(t.hasOwnProperty("error")&&(i.error=t.error?Object.assign({},t.error):null),t.status&&(i.status=Object.assign({},t.status)),t.file&&(i.output=t.file),t.source)i.file=t.source;else if(t.item||t.id){var n=t.item?t.item:r.query("GET_ITEM",t.id);i.file=n?Fe(n):null}return t.items&&(i.items=t.items.map(Fe)),/progress/.test(e)&&(i.progress=t.progress),t.hasOwnProperty("origin")&&t.hasOwnProperty("target")&&(i.origin=t.origin,i.target=t.target),i}},_={DID_DESTROY:E("destroy"),DID_INIT:E("init"),DID_THROW_MAX_FILES:E("warning"),DID_INIT_ITEM:E("initfile"),DID_START_ITEM_LOAD:E("addfilestart"),DID_UPDATE_ITEM_LOAD_PROGRESS:E("addfileprogress"),DID_LOAD_ITEM:E("addfile"),DID_THROW_ITEM_INVALID:[E("error"),E("addfile")],DID_THROW_ITEM_LOAD_ERROR:[E("error"),E("addfile")],DID_THROW_ITEM_REMOVE_ERROR:[E("error"),E("removefile")],DID_PREPARE_OUTPUT:E("preparefile"),DID_START_ITEM_PROCESSING:E("processfilestart"),DID_UPDATE_ITEM_PROCESS_PROGRESS:E("processfileprogress"),DID_ABORT_ITEM_PROCESSING:E("processfileabort"),DID_COMPLETE_ITEM_PROCESSING:E("processfile"),DID_COMPLETE_ITEM_PROCESSING_ALL:E("processfiles"),DID_REVERT_ITEM_PROCESSING:E("processfilerevert"),DID_THROW_ITEM_PROCESSING_ERROR:[E("error"),E("processfile")],DID_REMOVE_ITEM:E("removefile"),DID_UPDATE_ITEMS:E("updatefiles"),DID_ACTIVATE_ITEM:E("activatefile"),DID_REORDER_ITEMS:E("reorderfiles")},I=function(e){var t=Object.assign({pond:x},e);delete t.type,f.element.dispatchEvent(new CustomEvent("FilePond:"+e.type,{detail:t,bubbles:!0,cancelable:!0,composed:!0}));var i=[];e.hasOwnProperty("error")&&i.push(e.error),e.hasOwnProperty("file")&&i.push(e.file);var n=["type","error","file"];Object.keys(e).filter((function(e){return!n.includes(e)})).forEach((function(t){return i.push(e[t])})),x.fire.apply(x,[e.type].concat(i));var o=r.query("GET_ON"+e.type.toUpperCase());o&&o.apply(void 0,i)},v=function(e){e.length&&e.filter((function(e){return _[e.type]})).forEach((function(e){var t=_[e.type];(Array.isArray(t)?t:[t]).forEach((function(t){"DID_INIT_ITEM"===e.type?I(t(e.data)):setTimeout((function(){I(t(e.data))}),0)}))}))},y=function(e){return r.dispatch("SET_OPTIONS",{options:e})},w=function(e){return r.query("GET_ACTIVE_ITEM",e)},O=function(e){return new Promise((function(t,i){r.dispatch("REQUEST_ITEM_PREPARE",{query:e,success:function(e){t(e)},failure:function(e){i(e)}})}))},A=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(i,n){b([{source:e,options:t}],{index:t.index}).then((function(e){return i(e&&e[0])})).catch(n)}))},R=function(e){return e.file&&e.id},S=function(e,t){return"object"!=typeof e||R(e)||t||(t=e,e=void 0),r.dispatch("REMOVE_ITEM",Object.assign({},t,{query:e})),null===r.query("GET_ACTIVE_ITEM",e)},b=function(){for(var e=arguments.length,t=new Array(e),i=0;i0&&void 0!==arguments[0]?arguments[0]:{},t={};return r(Qe(),(function(e,i){t[e]=i[0]})),uo(Object.assign({},t,{},e))},po=function(e){return e.charAt(0).toLowerCase()+e.slice(1)},fo=function(e){return Yr(e.replace(/^data-/,""))},ho=function e(t,i){r(i,(function(i,n){r(t,(function(e,r){var o=new RegExp(i);if(o.test(e)&&(delete t[e],!1!==n))if(Q(n))t[n]=r;else{var a=n.group;le(n)&&!t[a]&&(t[a]={}),t[a][po(e.replace(o,""))]=r}})),n.mapping&&e(t[n.group],n.mapping)}))},go=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=[];r(e.attributes,(function(t){i.push(e.attributes[t])}));var n=i.filter((function(e){return e.name})).reduce((function(t,i){var n=a(e,i.name);return t[fo(i.name)]=n===i.name||n,t}),{});return ho(n,t),n},mo=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i={"^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};Ye("SET_ATTRIBUTE_TO_OPTION_MAP",i);var n=Object.assign({},t),r=go("FIELDSET"===e.nodeName?e.querySelector("input[type=file]"):e,i);Object.keys(r).forEach((function(e){le(r[e])?(le(n[e])||(n[e]={}),Object.assign(n[e],r[e])):n[e]=r[e]})),n.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 o=co(n);return e.files&&Array.from(e.files).forEach((function(e){o.addFile(e)})),o.replaceElement(e),o},Eo=function(){return t(arguments.length<=0?void 0:arguments[0])?mo.apply(void 0,arguments):co.apply(void 0,arguments)},_o=["fire","_read","_write"],Io=function(e){var t={};return Ge(e,t,_o),t},vo=function(e,t){return e.replace(/(?:{([a-zA-Z]+)})/g,(function(e,i){return t[i]}))},To=function(e){var t=new Blob(["(",e.toString(),")()"],{type:"application/javascript"}),i=URL.createObjectURL(t),n=new Worker(i);return{transfer:function(e,t){},post:function(e,t,i){var r=we();n.onmessage=function(e){e.data.id===r&&t(e.data.message)},n.postMessage({id:r,message:e},i)},terminate:function(){n.terminate(),URL.revokeObjectURL(i)}}},yo=function(e){return new Promise((function(t,i){var n=new Image;n.onload=function(){t(n)},n.onerror=function(e){i(e)},n.src=e}))},wo=function(e,t){var i=e.slice(0,e.size,e.type);return i.lastModifiedDate=e.lastModifiedDate,i.name=t,i},Oo=function(e){return wo(e,e.name)},Ao=[],Ro=function(e){if(!Ao.includes(e)){Ao.push(e);var t=e({addFilter:Xe,utils:{Type:We,forin:r,isString:Q,isFile:ei,toNaturalFileSize:Oi,replaceInString:vo,getExtensionFromFilename:It,getFilenameWithoutExtension:Jt,guesstimateMimeType:nr,getFileFromBlob:wt,getFilenameFromURL:_t,createRoute:V,createWorker:To,createView:k,createItemAPI:Fe,loadImage:yo,copyFile:Oo,renameFile:wo,createBlob:At,applyFilterChain:je,text:_i,getNumericAspectRatioFromString:et},views:{fileActionButton:wi}});Ze(t.options)}},So=function(){return"[object OperaMini]"===Object.prototype.toString.call(window.operamini)},bo=function(){return"Promise"in window},Mo=function(){return"slice"in Blob.prototype},Co=function(){return"URL"in window&&"createObjectURL"in window.URL},Po=function(){return"visibilityState"in document},Lo=function(){return"performance"in window},Do=function(){return"supports"in(window.CSS||{})},xo=function(){return/MSIE|Trident/.test(window.navigator.userAgent)},Go=(ki=m()&&!So()&&Po()&&bo()&&Mo()&&Co()&&Lo()&&(Do()||xo()),function(){return ki}),No={apps:[]},Fo="filepond",ko=function(){};if(e.Status={},e.FileStatus={},e.FileOrigin={},e.OptionTypes={},e.create=ko,e.destroy=ko,e.parse=ko,e.find=ko,e.registerPlugin=ko,e.getOptions=ko,e.setOptions=ko,Go()){U((function(){No.apps.forEach((function(e){return e._read()}))}),(function(e){No.apps.forEach((function(t){return t._write(e)}))}));var Uo=function t(){document.dispatchEvent(new CustomEvent("FilePond:loaded",{detail:{supported:Go,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 Uo()}),0):document.addEventListener("DOMContentLoaded",Uo);var Vo=function(){return r(Qe(),(function(t,i){e.OptionTypes[t]=i[1]}))};e.Status=Object.assign({},it),e.FileOrigin=Object.assign({},Ve),e.FileStatus=Object.assign({},Ue),e.OptionTypes={},Vo(),e.create=function(){var t=Eo.apply(void 0,arguments);return t.on("destroy",e.destroy),No.apps.push(t),Io(t)},e.destroy=function(e){var t=No.apps.findIndex((function(t){return t.isAttachedTo(e)}));return t>=0&&(No.apps.splice(t,1)[0].restoreElement(),!0)},e.parse=function(t){return Array.from(t.querySelectorAll("."+Fo)).filter((function(e){return!No.apps.find((function(t){return t.isAttachedTo(e)}))})).map((function(t){return e.create(t)}))},e.find=function(e){var t=No.apps.find((function(t){return t.isAttachedTo(e)}));return t?Io(t):null},e.registerPlugin=function(){for(var e=arguments.length,t=new Array(e),i=0;ie instanceof File,S=e=>/^image/.test(e.type),b=(e,t,i=[])=>{const n=document.createElement(e),r=Object.getOwnPropertyDescriptors(n.__proto__);for(const e in t)"style"===e?n.style.cssText=t[e]:r[e]&&r[e].set||/textContent|innerHTML/.test(e)||"function"==typeof t[e]?n[e]=t[e]:n.setAttribute(e,t[e]);return i.forEach((e=>n.appendChild(e))),n};let M=null;var C=()=>(null===M&&(M="undefined"!=typeof window&&void 0!==window.document),M);const P=C()&&!!Node.prototype.replaceChildren?(e,t)=>e.replaceChildren(t):(e,t)=>{for(;e.lastChild;)e.removeChild(e.lastChild);void 0!==t&&e.append(t)},L=C()&&b("div",{class:"PinturaMeasure",style:"pointer-events:none;left:0;top:0;width:0;height:0;contain:strict;overflow:hidden;position:absolute;"});let D;let x=null;var G=e=>new Promise(((t,i)=>{let n=!1;!e.parentNode&&(null===x&&(x=C()&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)),x)&&(n=!0,e.style.cssText="position:absolute;visibility:hidden;pointer-events:none;left:0;top:0;width:0;height:0;",P(L,e),L.parentNode||document.body.append(L),clearTimeout(D),D=setTimeout((()=>{L.remove()}),500));const r=()=>{const i=e.naturalWidth,r=e.naturalHeight;i&&r&&(n&&e.remove(),clearInterval(o),t({width:i,height:r}))};e.onerror=e=>{clearInterval(o),i(e)};const o=setInterval(r,1);r()})),N=(...e)=>{},F=e=>{e.width=1,e.height=1;const t=e.getContext("2d");t&&t.clearRect(0,0,1,1)};let k=null;var U=(e,t)=>(()=>{if(null===k)if("WebGL2RenderingContext"in window){let e;try{e=b("canvas"),k=!!e.getContext("webgl2")}catch(e){k=!1}e&&F(e),e=void 0}else k=!1;return k})()?e.getContext("webgl2",t):e.getContext("webgl",t)||e.getContext("experimental-webgl",t);let V=null;var B=()=>{if(null===V){let e=b("canvas");V=!!U(e),F(e),e=void 0}return V};let q=null;var z=()=>(null===q&&(q=C()&&!("[object OperaMini]"===Object.prototype.toString.call(window.operamini))&&"visibilityState"in document&&"Promise"in window&&"File"in window&&"URL"in window&&"createObjectURL"in window.URL&&"performance"in window),q);const W=e=>{const{addFilter:t,utils:i,views:n}=e,{Type:r,createRoute:o}=i,{fileActionButton:a}=n,s=(({parallel:e=1,autoShift:t=!0})=>{const i=[];let n=0;const r=()=>{if(!i.length)return a.oncomplete();n++;i.shift()((()=>{n--,n{for(let t=0;t{i.push(e),t&&o()},runJobs:o,oncomplete:()=>{}};return a})({parallel:1}),l=e=>null===e?{}:e;t("SHOULD_REMOVE_ON_REVERT",((e,{item:t,query:i})=>new Promise((e=>{const{file:n}=t;e(!(i("GET_ALLOW_IMAGE_EDITOR")&&i("GET_IMAGE_EDITOR_ALLOW_EDIT")&&i("GET_IMAGE_EDITOR_SUPPORT_EDIT")&&i("GET_IMAGE_EDITOR_SUPPORT_IMAGE")(n)))})))),t("DID_LOAD_ITEM",((e,{query:t,dispatch:i})=>new Promise(((n,r)=>{if(e.origin>1)return void n(e);const{file:o}=e;if(!t("GET_ALLOW_IMAGE_EDITOR")||!t("GET_IMAGE_EDITOR_INSTANT_EDIT"))return n(e);if(!t("GET_IMAGE_EDITOR_SUPPORT_IMAGE")(o))return n(e);const a=()=>{if(!u.length)return;const{item:e,resolve:t,reject:n}=u[0];i("EDIT_ITEM",{id:e.id,handleEditorResponse:s(e,t,n)})},s=(e,t,n)=>r=>{u.shift(),r?t(e):n(e),i("KICK"),a()};c({item:e,resolve:n,reject:r}),1===u.length&&a()})))),t("DID_CREATE_ITEM",((e,{query:t,dispatch:i})=>{e.extend("edit",(()=>{i("EDIT_ITEM",{id:e.id})}))}));const u=[],c=e=>(u.push(e),e),d=(e,t,i=(()=>{}))=>{if(!t)return;const{imageProcessor:n,imageReader:r,imageWriter:o,editorOptions:a,imageState:u}=l(e("GET_IMAGE_EDITOR"));if(!n)return;const[c,d]=r,[p=N,f]=o,h=t.file,g=t.getMetadata("imageState");if(g){const r=((e,t)=>{const i=e("GET_FILE_POSTER_HEIGHT"),n=e("GET_FILE_POSTER_MAX_HEIGHT");return i?(t.width=2*i,t.height=2*i):n&&(t.width=2*n,t.height=2*n),t})(e,{width:512,height:512}),o={...a,imageReader:c(d),imageWriter:p({...f||{},canvasMemoryLimit:r.width*r.height*2}),imageState:{...u,...g}};s.queue((e=>{n(h,o).then((({dest:n})=>{t.setMetadata("poster",URL.createObjectURL(n),!0),e(),i()}))}))}else i()};t("CREATE_VIEW",(e=>{const{is:t,view:i,query:n}=e;if(!n("GET_ALLOW_IMAGE_EDITOR"))return;if(!n("GET_IMAGE_EDITOR_SUPPORT_WRITE_IMAGE"))return;const r=n("GET_ALLOW_FILE_POSTER")||n("GET_ALLOW_FILE_GRID")||n("GET_ALLOW_FILE_GRID");if(!(t("file-info")&&!r||t("file")&&r))return;const{createEditor:s,imageReader:u,imageWriter:c,editorOptions:p,legacyDataToImageState:f,imageState:h}=l(n("GET_IMAGE_EDITOR"));if(!(u&&c&&p&&p.locale))return;delete p.imageReader,delete p.imageWriter;const[g,m]=u,E=e=>{const{id:t}=e;return n("GET_ITEM",t)},_=(e,t)=>{if(e.ref.handleEdit||(e.ref.handleEdit=i=>{i.stopPropagation(),e.dispatch("EDIT_ITEM",{id:t.id})}),(e=>{if(!(n("GET_ALLOW_FILE_POSTER")||n("GET_ALLOW_FILE_GRID")||n("GET_ALLOW_FILE_GRID")))return!1;const t=E(e);if(!t)return;return!!n("GET_FILE_POSTER_FILTER_ITEM")(t)&&!!t.getMetadata("poster")})(t)){e.ref.editButton&&e.ref.editButton.parentNode&&e.ref.editButton.parentNode.removeChild(e.ref.editButton);const t=i.createChildView(a,{label:"edit",icon:n("GET_IMAGE_EDITOR_ICON_EDIT"),opacity:0});t.element.classList.add("filepond--action-edit-item"),t.element.dataset.align=n("GET_STYLE_IMAGE_EDITOR_BUTTON_EDIT_ITEM_POSITION"),t.on("click",e.ref.handleEdit),e.ref.buttonEditItem=i.appendChildView(t)}else{e.ref.buttonEditItem&&e.removeChildView(e.ref.buttonEditItem);const t=i.element.querySelector(".filepond--file-info-main"),r=document.createElement("button");r.className="filepond--action-edit-item-alt",r.innerHTML=n("GET_IMAGE_EDITOR_ICON_EDIT")+"edit",r.addEventListener("click",e.ref.handleEdit),t.appendChild(r),e.ref.editButton=r}};i.registerDestroyer((({root:e})=>{e.ref.buttonEditItem&&e.ref.buttonEditItem.off("click",e.ref.handleEdit),e.ref.editButton&&e.ref.editButton.removeEventListener("click",e.ref.handleEdit)}));const I={EDIT_ITEM:({root:e,props:t,action:i})=>{const{handleEditorResponse:n}=i,r=E(t),o=r.file,a=s({...p,imageReader:g(m),src:o});a.on("load",(({size:e})=>{let t=r.getMetadata("imageState");t=f?f(a,e,t):t,a.imageState={...h,...t}})),a.on("process",(({imageState:e})=>{r.setMetadata("imageState",e),n&&n(!0)})),a.on("close",(()=>{n&&n(!1)}))},DID_LOAD_ITEM:({root:e,props:t})=>{const{id:i}=t,r=n("GET_ITEM",i);if(!r)return;const o=r.file;n("GET_IMAGE_EDITOR_SUPPORT_IMAGE")(o)&&((n("GET_ALLOW_FILE_POSTER")||n("GET_ALLOW_FILE_GRID")||n("GET_ALLOW_FILE_GRID"))&&!r.getMetadata("poster")&&e.dispatch("REQUEST_CREATE_IMAGE_POSTER",{id:i}),n("GET_IMAGE_EDITOR_ALLOW_EDIT")&&n("GET_IMAGE_EDITOR_SUPPORT_EDIT")&&_(e,t))},DID_UPDATE_ITEM_METADATA:({root:e,props:t,action:i})=>{if(/imageState/.test(i.change.key)&&(n("GET_ALLOW_FILE_POSTER")||n("GET_ALLOW_FILE_GRID")||n("GET_ALLOW_FILE_GRID")))return e.dispatch("REQUEST_CREATE_IMAGE_POSTER",{id:t.id});/poster/.test(i.change.key)&&n("GET_IMAGE_EDITOR_ALLOW_EDIT")&&n("GET_IMAGE_EDITOR_SUPPORT_EDIT")&&_(e,t)},DID_REMOVE_ITEM:({props:e})=>{const{id:t}=e,i=n("GET_ITEM",t);if(!i)return;const r=i.getMetadata("poster");r&&URL.revokeObjectURL(r)},REQUEST_CREATE_IMAGE_POSTER:({root:e,props:t})=>d(e.query,E(t)),DID_FILE_POSTER_LOAD:void 0};if(r){const e=({root:e})=>{e.ref.buttonEditItem&&(e.ref.buttonEditItem.opacity=1)};I.DID_FILE_POSTER_LOAD=e}i.registerWriter(o(I))})),t("SHOULD_PREPARE_OUTPUT",((e,{query:t,change:i,item:n})=>new Promise((e=>{let r=t("GET_IMAGE_EDITOR_SUPPORT_IMAGE");return r&&!r(n.file)||i&&!/imageState/.test(i.key)?e(!1):void e(!t("IS_ASYNC"))}))));const p=(e,t,i)=>new Promise((n=>{if(!(e=>{const{imageProcessor:t,imageReader:i,imageWriter:n}=l(e("GET_IMAGE_EDITOR"));return e("GET_IMAGE_EDITOR_WRITE_IMAGE")&&e("GET_IMAGE_EDITOR_SUPPORT_WRITE_IMAGE")&&t&&i&&n})(e)||i.archived||!R(t)&&(!((r=t)instanceof Blob)||r instanceof File)||!e("GET_IMAGE_EDITOR_SUPPORT_IMAGE")(t))return n(!1);var r;(async e=>{let t,i=e;i.src||(i=new Image,i.src="string"==typeof e?e:URL.createObjectURL(e));try{t=await G(i)}finally{R(e)&&URL.revokeObjectURL(i.src)}return t})(t).then((r=>{let o=e("GET_IMAGE_EDITOR_DIMENSION_MAX");if(o){if(r.width*r.height>o)return i.setMetadata("imageError","max",!0),n(!1)}const a=e("GET_IMAGE_TRANSFORM_IMAGE_FILTER");if(a){const e=a(t);if("boolean"==typeof e)return n(e);if("function"==typeof e.then)return e.then(n)}n(!0)})).catch((e=>{i.setMetadata("imageError","invalid",!0),n(!1)}))}));return t("PREPARE_OUTPUT",((e,{query:t,item:i})=>new Promise((n=>{p(t,e,i).then((r=>{if(!r)return n(e);(e=>new Promise(((n,r)=>{const o=()=>{s.queue((o=>{const a=i.getMetadata("imageState"),{imageProcessor:s,imageReader:u,imageWriter:c,editorOptions:d,imageState:p}=l(t("GET_IMAGE_EDITOR"));if(!(s&&u&&c&&d))return;const[f,h]=u,[g=N,m]=c;s(e,{...d,imageReader:f(h),imageWriter:g(m),imageState:{...p,...a}}).then(n).catch(r).finally(o)}))};!t("GET_ALLOW_FILE_POSTER")&&!t("GET_ALLOW_FILE_GRID")||i.getMetadata("poster")?o():d(t,i,o)})))(e).then((e=>{const i=t("GET_IMAGE_EDITOR_AFTER_WRITE_IMAGE");if(i)return Promise.resolve(i(e)).then(n);n(e.dest)}))}))})))),{options:{allowImageEditor:[!0,r.BOOLEAN],imageEditorDimensionMax:[void 0,r.NUMBER],imageEditorInstantEdit:[!1,r.BOOLEAN],imageEditorAllowEdit:[!0,r.BOOLEAN],imageEditorSupportEdit:[C()&&z()&&B(),r.BOOLEAN],imageEditorSupportImage:[S,r.FUNCTION],imageEditorSupportWriteImage:[z(),r.BOOLEAN],imageEditorWriteImage:[!0,r.BOOLEAN],imageEditorAfterWriteImage:[void 0,r.FUNCTION],imageEditor:[null,r.OBJECT],imageEditorIconEdit:['',r.STRING],styleImageEditorButtonEditItemPosition:["bottom center",r.STRING]}}};C()&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:W}));var H=W,j={};j=function(){"use strict";var e={type:"spring",stiffness:.5,damping:.45,mass:10},t=function(t){return t.utils.createView({name:"file-poster",tag:"div",ignoreRect:!0,create:function(e){var t=e.root;t.ref.image=document.createElement("img"),t.element.appendChild(t.ref.image)},write:t.utils.createRoute({DID_FILE_POSTER_LOAD:function(e){var t=e.root,i=e.props,n=i.id,r=t.query("GET_ITEM",{id:i.id});if(r){var o=r.getMetadata("poster");t.ref.image.src=o,t.dispatch("DID_FILE_POSTER_DRAW",{id:n})}}}),mixins:{styles:["scaleX","scaleY","opacity"],animations:{scaleX:e,scaleY:e,opacity:{type:"tween",duration:750}}}})},i=function(e,t){t.width=e.width,t.height=e.height,t.getContext("2d").drawImage(e,0,0)},n=function(e){return e.utils.createView({name:"file-poster-overlay",tag:"canvas",ignoreRect:!0,create:function(e){var t=e.root,n=e.props;i(n.template,t.element)},mixins:{styles:["opacity"],animations:{opacity:{type:"spring",mass:25}}}})},r=function(e,t){var i=new Image;i.onload=function(){var e=i.naturalWidth,n=i.naturalHeight;i=null,t(e,n)},i.src=e},o=function(e){return-.5*(Math.cos(Math.PI*e)-1)},a=function(e,t){for(var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:o,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:10,a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,s=1-a,l=t.join(","),u=0;u<=r;u++){var c=u/r,d=a+s*c;e.addColorStop(d,"rgba(".concat(l,", ").concat(n(c)*i,")"))}},s=10,l=10,u=function(e){var t=Math.min(s/e.width,l/e.height),i=document.createElement("canvas"),n=i.getContext("2d"),r=i.width=Math.ceil(e.width*t),o=i.height=Math.ceil(e.height*t);n.drawImage(e,0,0,r,o);var a=null;try{a=n.getImageData(0,0,r,o).data}catch(e){return null}for(var u=a.length,d=0,p=0,f=0,h=0;hr?r:o};i.registerWriter(r({DID_LOAD_ITEM:a,DID_FILE_POSTER_CALCULATE_SIZE:u,DID_UPDATE_ITEM_METADATA:s},(function(e){var t=e.root,i=e.props;t.ref.filePoster&&(t.rect.element.hidden||t.ref.shouldUpdatePanelHeight&&(t.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:i.id,height:c({root:t})}),t.ref.shouldUpdatePanelHeight=!1))})))}})),{options:{allowFilePoster:[!0,n.BOOLEAN],filePosterHeight:[null,n.INT],filePosterMinHeight:[null,n.INT],filePosterMaxHeight:[null,n.INT],filePosterFilterItem:[function(){return!0},n.FUNCTION],filePosterCalculateAverageImageColor:[!1,n.BOOLEAN],filePosterCrossOriginAttributeValue:["Anonymous",n.STRING],filePosterItemOverlayShadowColor:[null,n.ARRAY],filePosterItemOverlayErrorColor:[null,n.ARRAY],filePosterItemOverlaySuccessColor:[null,n.ARRAY]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:w})),w}();var Y={}; /*! * FilePondPluginFileValidateType 1.2.8 * Licensed under MIT, https://opensource.org/licenses/MIT/ * Please visit https://pqina.nl/filepond/ for details. */Y=function(){"use strict";var e=function(e){var t=e.addFilter,i=e.utils,n=i.Type,r=i.isString,o=i.replaceInString,a=i.guesstimateMimeType,s=i.getExtensionFromFilename,l=i.getFilenameFromURL,u=function(e,t){return(/^[^/]+/.exec(e)||[]).pop()===t.slice(0,-2)},c=function(e,t){return e.some((function(e){return/\*$/.test(e)?u(t,e):e===t}))},d=function(e){var t="";if(r(e)){var i=l(e),n=s(i);n&&(t=a(n))}else t=e.type;return t},p=function(e,t,i){if(0===t.length)return!0;var n=d(e);return i?new Promise((function(r,o){i(e,n).then((function(e){c(t,e)?r():o()})).catch(o)})):c(t,n)},f=function(e){return function(t){return null!==e[t]&&(e[t]||t)}};return t("SET_ATTRIBUTE_TO_OPTION_MAP",(function(e){return Object.assign(e,{accept:"acceptedFileTypes"})})),t("ALLOW_HOPPER_ITEM",(function(e,t){var i=t.query;return!i("GET_ALLOW_FILE_TYPE_VALIDATION")||p(e,i("GET_ACCEPTED_FILE_TYPES"))})),t("LOAD_FILE",(function(e,t){var i=t.query;return new Promise((function(t,n){if(i("GET_ALLOW_FILE_TYPE_VALIDATION")){var r=i("GET_ACCEPTED_FILE_TYPES"),a=i("GET_FILE_VALIDATE_TYPE_DETECT_TYPE"),s=p(e,r,a),l=function(){var e=r.map(f(i("GET_FILE_VALIDATE_TYPE_LABEL_EXPECTED_TYPES_MAP"))).filter((function(e){return!1!==e})),t=e.filter((function(t,i){return e.indexOf(t)===i}));n({status:{main:i("GET_LABEL_FILE_TYPE_NOT_ALLOWED"),sub:o(i("GET_FILE_VALIDATE_TYPE_LABEL_EXPECTED_TYPES"),{allTypes:t.join(", "),allButLastType:t.slice(0,-1).join(", "),lastType:t[e.length-1]})}})};if("boolean"==typeof s)return s?t(e):l();s.then((function(){t(e)})).catch(l)}else t(e)}))})),{options:{allowFileTypeValidation:[!0,n.BOOLEAN],acceptedFileTypes:[[],n.ARRAY],labelFileTypeNotAllowed:["File is of invalid type",n.STRING],fileValidateTypeLabelExpectedTypes:["Expects {allButLastType} or {lastType}",n.STRING],fileValidateTypeLabelExpectedTypesMap:[{},n.OBJECT],fileValidateTypeDetectType:[null,n.FUNCTION]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:e})),e}();var X={}; /*! * FilePondPluginFileValidateSize 2.2.8 * Licensed under MIT, https://opensource.org/licenses/MIT/ * Please visit https://pqina.nl/filepond/ for details. */X=function(){"use strict";var e=function(e){var t=e.addFilter,i=e.utils,n=i.Type,r=i.replaceInString,o=i.toNaturalFileSize;return t("ALLOW_HOPPER_ITEM",(function(e,t){var i=t.query;if(!i("GET_ALLOW_FILE_SIZE_VALIDATION"))return!0;var n=i("GET_MAX_FILE_SIZE");if(null!==n&&e.size>n)return!1;var r=i("GET_MIN_FILE_SIZE");return!(null!==r&&e.sizes)n({status:{main:i("GET_LABEL_MAX_FILE_SIZE_EXCEEDED"),sub:r(i("GET_LABEL_MAX_FILE_SIZE"),{filesize:o(s,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});else{var l=i("GET_MIN_FILE_SIZE");if(null!==l&&e.sizeu)return void n({status:{main:i("GET_LABEL_MAX_TOTAL_FILE_SIZE_EXCEEDED"),sub:r(i("GET_LABEL_MAX_TOTAL_FILE_SIZE"),{filesize:o(u,".",i("GET_FILE_SIZE_BASE"),i("GET_FILE_SIZE_LABELS",i))})}});t(e)}}}))})),{options:{allowFileSizeValidation:[!0,n.BOOLEAN],maxFileSize:[null,n.INT],minFileSize:[null,n.INT],maxTotalFileSize:[null,n.INT],fileValidateSizeFilter:[null,n.FUNCTION],labelMinFileSizeExceeded:["File is too small",n.STRING],labelMinFileSize:["Minimum file size is {filesize}",n.STRING],labelMaxFileSizeExceeded:["File is too large",n.STRING],labelMaxFileSize:["Maximum file size is {filesize}",n.STRING],labelMaxTotalFileSizeExceeded:["Maximum total size exceeded",n.STRING],labelMaxTotalFileSize:["Maximum total file size is {filesize}",n.STRING]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:e})),e}();var Z={}; /*! * FilePondPluginImageExifOrientation 1.0.9 * Licensed under MIT, https://opensource.org/licenses/MIT/ * Please visit https://pqina.nl/filepond/ for details. */Z=function(){"use strict";var e=function(e){return/^image\/jpeg/.test(e.type)},t={JPEG:65496,APP1:65505,EXIF:1165519206,TIFF:18761,Orientation:274,Unknown:65280},i=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e.getUint16(t,i)},n=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return e.getUint32(t,i)},r=function(e){return new Promise((function(r,o){var a=new FileReader;a.onload=function(e){var o=new DataView(e.target.result);if(i(o,0)===t.JPEG){for(var a=o.byteLength,s=2;sl.naturalHeight},l.src=a;var u=function(){return s},c=function(t){var i=t.addFilter,n=t.utils,o=n.Type,a=n.isFile;return i("DID_LOAD_ITEM",(function(t,i){var n=i.query;return new Promise((function(i,o){var s=t.file;if(!(a(s)&&e(s)&&n("GET_ALLOW_IMAGE_EXIF_ORIENTATION")&&u()))return i(t);r(s).then((function(e){t.setMetadata("exif",{orientation:e}),i(t)}))}))})),{options:{allowImageExifOrientation:[!0,o.BOOLEAN]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:c})),c}();var Q={}; /*! * FilePondPluginImagePreview 4.6.4 * Licensed under MIT, https://opensource.org/licenses/MIT/ * Please visit https://pqina.nl/filepond/ for details. */Q=function(){"use strict";var e=function(e){return/^image/.test(e.type)};function t(e){this.wrapped=e}function i(e){var i,n;function r(e,t){return new Promise((function(r,a){var s={key:e,arg:t,resolve:r,reject:a,next:null};n?n=n.next=s:(i=n=s,o(e,t))}))}function o(i,n){try{var r=e[i](n),s=r.value,l=s instanceof t;Promise.resolve(l?s.wrapped:s).then((function(e){l?o("next",e):a(r.done?"return":"normal",e)}),(function(e){o("throw",e)}))}catch(e){a("throw",e)}}function a(e,t){switch(e){case"return":i.resolve({value:t,done:!0});break;case"throw":i.reject(t);break;default:i.resolve({value:t,done:!1})}(i=i.next)?o(i.key,i.arg):n=null}this._invoke=r,"function"!=typeof e.return&&(this.return=void 0)}function n(e,t){return r(e)||o(e,t)||a()}function r(e){if(Array.isArray(e))return e}function o(e,t){var i=[],n=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(i.push(a.value),!t||i.length!==t);n=!0);}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return i}function a(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}"function"==typeof Symbol&&Symbol.asyncIterator&&(i.prototype[Symbol.asyncIterator]=function(){return this}),i.prototype.next=function(e){return this._invoke("next",e)},i.prototype.throw=function(e){return this._invoke("throw",e)},i.prototype.return=function(e){return this._invoke("return",e)};var s=function(e,t){return d(e.x*t,e.y*t)},l=function(e,t){return d(e.x+t.x,e.y+t.y)},u=function(e){var t=Math.sqrt(e.x*e.x+e.y*e.y);return 0===t?{x:0,y:0}:d(e.x/t,e.y/t)},c=function(e,t,i){var n=Math.cos(t),r=Math.sin(t),o=d(e.x-i.x,e.y-i.y);return d(i.x+n*o.x-r*o.y,i.y+r*o.x+n*o.y)},d=function(){return{x:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,y:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0}},p=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3?arguments[3]:void 0;return"string"==typeof e?parseFloat(e)*i:"number"==typeof e?e*(n?t[n]:Math.min(t.width,t.height)):void 0},f=function(e,t,i){var n=e.borderStyle||e.lineStyle||"solid",r=e.backgroundColor||e.fontColor||"transparent",o=e.borderColor||e.lineColor||"transparent",a=p(e.borderWidth||e.lineWidth,t,i);return{"stroke-linecap":e.lineCap||"round","stroke-linejoin":e.lineJoin||"round","stroke-width":a||0,"stroke-dasharray":"string"==typeof n?"":n.map((function(e){return p(e,t,i)})).join(","),stroke:o,fill:r,opacity:e.opacity||1}},h=function(e){return null!=e},g=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=p(e.x,t,i,"width")||p(e.left,t,i,"width"),r=p(e.y,t,i,"height")||p(e.top,t,i,"height"),o=p(e.width,t,i,"width"),a=p(e.height,t,i,"height"),s=p(e.right,t,i,"width"),l=p(e.bottom,t,i,"height");return h(r)||(r=h(a)&&h(l)?t.height-a-l:l),h(n)||(n=h(o)&&h(s)?t.width-o-s:s),h(o)||(o=h(n)&&h(s)?t.width-n-s:0),h(a)||(a=h(r)&&h(l)?t.height-r-l:0),{x:n||0,y:r||0,width:o||0,height:a||0}},m=function(e){return e.map((function(e,t){return"".concat(0===t?"M":"L"," ").concat(e.x," ").concat(e.y)})).join(" ")},E=function(e,t){return Object.keys(t).forEach((function(i){return e.setAttribute(i,t[i])}))},_="http://www.w3.org/2000/svg",I=function(e,t){var i=document.createElementNS(_,e);return t&&E(i,t),i},v=function(e){return E(e,Object.assign({},e.rect,e.styles))},T=function(e){var t=e.rect.x+.5*e.rect.width,i=e.rect.y+.5*e.rect.height,n=.5*e.rect.width,r=.5*e.rect.height;return E(e,Object.assign({cx:t,cy:i,rx:n,ry:r},e.styles))},y={contain:"xMidYMid meet",cover:"xMidYMid slice"},w=function(e,t){E(e,Object.assign({},e.rect,e.styles,{preserveAspectRatio:y[t.fit]||"none"}))},O={left:"start",center:"middle",right:"end"},A=function(e,t,i,n){var r=p(t.fontSize,i,n),o=t.fontFamily||"sans-serif",a=t.fontWeight||"normal",s=O[t.textAlign]||"start";E(e,Object.assign({},e.rect,e.styles,{"stroke-width":0,"font-weight":a,"font-size":r,"font-family":o,"text-anchor":s})),e.text!==t.text&&(e.text=t.text,e.textContent=t.text.length?t.text:" ")},R=function(e,t,i,n){E(e,Object.assign({},e.rect,e.styles,{fill:"none"}));var r=e.childNodes[0],o=e.childNodes[1],a=e.childNodes[2],d=e.rect,f={x:e.rect.x+e.rect.width,y:e.rect.y+e.rect.height};if(E(r,{x1:d.x,y1:d.y,x2:f.x,y2:f.y}),t.lineDecoration){o.style.display="none",a.style.display="none";var h=u({x:f.x-d.x,y:f.y-d.y}),g=p(.05,i,n);if(-1!==t.lineDecoration.indexOf("arrow-begin")){var m=s(h,g),_=l(d,m),I=c(d,2,_),v=c(d,-2,_);E(o,{style:"display:block;",d:"M".concat(I.x,",").concat(I.y," L").concat(d.x,",").concat(d.y," L").concat(v.x,",").concat(v.y)})}if(-1!==t.lineDecoration.indexOf("arrow-end")){var T=s(h,-g),y=l(f,T),w=c(f,2,y),O=c(f,-2,y);E(a,{style:"display:block;",d:"M".concat(w.x,",").concat(w.y," L").concat(f.x,",").concat(f.y," L").concat(O.x,",").concat(O.y)})}}},S=function(e,t,i,n){E(e,Object.assign({},e.styles,{fill:"none",d:m(t.points.map((function(e){return{x:p(e.x,i,n,"width"),y:p(e.y,i,n,"height")}})))}))},b=function(e){return function(t){return I(e,{id:t.id})}},M=function(e){var t=I("g",{id:e.id,"stroke-linecap":"round","stroke-linejoin":"round"}),i=I("line");t.appendChild(i);var n=I("path");t.appendChild(n);var r=I("path");return t.appendChild(r),t},C={image:function(e){var t=I("image",{id:e.id,"stroke-linecap":"round","stroke-linejoin":"round",opacity:"0"});return t.onload=function(){t.setAttribute("opacity",e.opacity||1)},t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",e.src),t},rect:b("rect"),ellipse:b("ellipse"),text:b("text"),path:b("path"),line:M},P={rect:v,ellipse:T,image:w,text:A,path:S,line:R},L=function(e,t){return C[e](t)},D=function(e,t,i,n,r){"path"!==t&&(e.rect=g(i,n,r)),e.styles=f(i,n,r),P[t](e,i,n,r)},x=["x","y","left","top","right","bottom","width","height"],G=function(e){return"string"==typeof e&&/%/.test(e)?parseFloat(e)/100:e},N=function(e){var t=n(e,2),i=t[0],r=t[1],o=r.points?{}:x.reduce((function(e,t){return e[t]=G(r[t]),e}),{});return[i,Object.assign({zIndex:0},r,o)]},F=function(e,t){return e[1].zIndex>t[1].zIndex?1:e[1].zIndex2&&void 0!==arguments[2]?arguments[2]:1,n=e.height/e.width,r=1,o=t,a=1,s=n;s>o&&(a=(s=o)/n);var l=Math.max(r/a,o/s),u=e.width/(i*l*a);return{width:u,height:u*t}},Y=function(e,t,i,n){var r=n.x>.5?1-n.x:n.x,o=n.y>.5?1-n.y:n.y,a=2*r*e.width,s=2*o*e.height,l=H(t,i);return Math.max(l.width/a,l.height/s)},X=function(e,t){var i=e.width,n=i*t;return n>e.height&&(i=(n=e.height)/t),{x:.5*(e.width-i),y:.5*(e.height-n),width:i,height:n}},Z=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=t.zoom,n=t.rotation,r=t.center,o=t.aspectRatio;o||(o=e.height/e.width);var a=j(e,o,i),s={x:.5*a.width,y:.5*a.height},l={x:0,y:0,width:a.width,height:a.height,center:s},u=void 0===t.scaleToFit||t.scaleToFit,c=i*Y(e,X(l,o),n,u?r:{x:.5,y:.5});return{widthFloat:a.width/c,heightFloat:a.height/c,width:Math.round(a.width/c),height:Math.round(a.height/c)}},Q={type:"spring",stiffness:.5,damping:.45,mass:10},$=function(e){return e.utils.createView({name:"image-bitmap",ignoreRect:!0,mixins:{styles:["scaleX","scaleY"]},create:function(e){var t=e.root,i=e.props;t.appendChild(i.image)}})},J=function(e){return e.utils.createView({name:"image-canvas-wrapper",tag:"div",ignoreRect:!0,mixins:{apis:["crop","width","height"],styles:["originX","originY","translateX","translateY","scaleX","scaleY","rotateZ"],animations:{originX:Q,originY:Q,scaleX:Q,scaleY:Q,translateX:Q,translateY:Q,rotateZ:Q}},create:function(t){var i=t.root,n=t.props;n.width=n.image.width,n.height=n.image.height,i.ref.bitmap=i.appendChildView(i.createChildView($(e),{image:n.image}))},write:function(e){var t=e.root,i=e.props.crop.flip,n=t.ref.bitmap;n.scaleX=i.horizontal?-1:1,n.scaleY=i.vertical?-1:1}})},K=function(e){return e.utils.createView({name:"image-clip",tag:"div",ignoreRect:!0,mixins:{apis:["crop","markup","resize","width","height","dirty","background"],styles:["width","height","opacity"],animations:{opacity:{type:"tween",duration:250}}},didWriteView:function(e){var t=e.root,i=e.props;i.background&&(t.element.style.backgroundColor=i.background)},create:function(t){var i=t.root,n=t.props;i.ref.image=i.appendChildView(i.createChildView(J(e),Object.assign({},n))),i.ref.createMarkup=function(){i.ref.markup||(i.ref.markup=i.appendChildView(i.createChildView(k(e),Object.assign({},n))))},i.ref.destroyMarkup=function(){i.ref.markup&&(i.removeChildView(i.ref.markup),i.ref.markup=null)};var r=i.query("GET_IMAGE_PREVIEW_TRANSPARENCY_INDICATOR");null!==r&&(i.element.dataset.transparencyIndicator="grid"===r?r:"color")},write:function(e){var t=e.root,i=e.props,n=e.shouldOptimize,r=i.crop,o=i.markup,a=i.resize,s=i.dirty,l=i.width,u=i.height;t.ref.image.crop=r;var c={x:0,y:0,width:l,height:u,center:{x:.5*l,y:.5*u}},d={width:t.ref.image.width,height:t.ref.image.height},p={x:r.center.x*d.width,y:r.center.y*d.height},f={x:c.center.x-d.width*r.center.x,y:c.center.y-d.height*r.center.y},h=2*Math.PI+r.rotation%(2*Math.PI),g=r.aspectRatio||d.height/d.width,m=void 0===r.scaleToFit||r.scaleToFit,E=Y(d,X(c,g),h,m?r.center:{x:.5,y:.5}),_=r.zoom*E;o&&o.length?(t.ref.createMarkup(),t.ref.markup.width=l,t.ref.markup.height=u,t.ref.markup.resize=a,t.ref.markup.dirty=s,t.ref.markup.markup=o,t.ref.markup.crop=Z(d,r)):t.ref.markup&&t.ref.destroyMarkup();var I=t.ref.image;if(n)return I.originX=null,I.originY=null,I.translateX=null,I.translateY=null,I.rotateZ=null,I.scaleX=null,void(I.scaleY=null);I.originX=p.x,I.originY=p.y,I.translateX=f.x,I.translateY=f.y,I.rotateZ=h,I.scaleX=_,I.scaleY=_}})},ee=function(e){return e.utils.createView({name:"image-preview",tag:"div",ignoreRect:!0,mixins:{apis:["image","crop","markup","resize","dirty","background"],styles:["translateY","scaleX","scaleY","opacity"],animations:{scaleX:Q,scaleY:Q,translateY:Q,opacity:{type:"tween",duration:400}}},create:function(t){var i=t.root,n=t.props;i.ref.clip=i.appendChildView(i.createChildView(K(e),{id:n.id,image:n.image,crop:n.crop,markup:n.markup,resize:n.resize,dirty:n.dirty,background:n.background}))},write:function(e){var t=e.root,i=e.props,n=e.shouldOptimize,r=t.ref.clip,o=i.image,a=i.crop,s=i.markup,l=i.resize,u=i.dirty;if(r.crop=a,r.markup=s,r.resize=l,r.dirty=u,r.opacity=n?0:1,!n&&!t.rect.element.hidden){var c=o.height/o.width,d=a.aspectRatio||c,p=t.rect.inner.width,f=t.rect.inner.height,h=t.query("GET_IMAGE_PREVIEW_HEIGHT"),g=t.query("GET_IMAGE_PREVIEW_MIN_HEIGHT"),m=t.query("GET_IMAGE_PREVIEW_MAX_HEIGHT"),E=t.query("GET_PANEL_ASPECT_RATIO"),_=t.query("GET_ALLOW_MULTIPLE");E&&!_&&(h=p*E,d=E);var I=null!==h?h:Math.max(g,Math.min(p*d,m)),v=I/d;v>p&&(I=(v=p)*d),I>f&&(I=f,v=f/d),r.width=v,r.height=I}}})},te='\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n',ie=!1,ne=0,re=function(e){return e.utils.createView({name:"image-preview-overlay",tag:"div",ignoreRect:!0,create:function(e){var t=e.root,i=e.props;!ie&&document.querySelector("base")&&(te=te.replace(/url\(\#/g,"url("+window.location.href.replace(window.location.hash,"")+"#"),ie=!0),ne++,t.element.classList.add("filepond--image-preview-overlay-".concat(i.status)),t.element.innerHTML=te.replace(/__UID__/g,ne)},mixins:{styles:["opacity"],animations:{opacity:{type:"spring",mass:25}}}})},oe=function(){self.onmessage=function(e){createImageBitmap(e.data.message.file).then((function(t){self.postMessage({id:e.data.id,message:t},[t])}))}},ae=function(){self.onmessage=function(e){for(var t=e.data.message.imageData,i=e.data.message.colorMatrix,n=t.data,r=n.length,o=i[0],a=i[1],s=i[2],l=i[3],u=i[4],c=i[5],d=i[6],p=i[7],f=i[8],h=i[9],g=i[10],m=i[11],E=i[12],_=i[13],I=i[14],v=i[15],T=i[16],y=i[17],w=i[18],O=i[19],A=0,R=0,S=0,b=0,M=0;A=5&&n<=8){var a=[i,t];t=a[0],i=a[1]}return ue(o,t,i,n),o.drawImage(e,0,0,t,i),r},de=function(e){return/^image/.test(e.type)&&!/svg/.test(e.type)},pe=10,fe=10,he=function(e){var t=Math.min(pe/e.width,fe/e.height),i=document.createElement("canvas"),n=i.getContext("2d"),r=i.width=Math.ceil(e.width*t),o=i.height=Math.ceil(e.height*t);n.drawImage(e,0,0,r,o);var a=null;try{a=n.getImageData(0,0,r,o).data}catch(e){return null}for(var s=a.length,l=0,u=0,c=0,d=0;d1e-5){var p=a({root:t});s({root:t,props:i,image:me(p.image)})}else l({root:t,props:i})}}},c=function(e){var t=window.navigator.userAgent.match(/Firefox\/([0-9]+)\./);return!((t?parseInt(t[1]):null)<=58)&&"createImageBitmap"in window&&de(e)},d=function(e){var t=e.root,i=e.props.id,n=t.query("GET_ITEM",i);if(n){var r=URL.createObjectURL(n.file);se(r,(function(e,n){t.dispatch("DID_IMAGE_PREVIEW_CALCULATE_SIZE",{id:i,width:e,height:n})}))}},p=function(e){var t=e.root,i=e.props,o=i.id,a=t.query("GET_ITEM",o);if(a){var l=URL.createObjectURL(a.file),u=function(){_e(l).then(d)},d=function(e){URL.revokeObjectURL(l);var n=(a.getMetadata("exif")||{}).orientation||-1,o=e.width,u=e.height;if(n>=5&&n<=8){var c=[u,o];o=c[0],u=c[1]}var d=Math.max(1,.75*window.devicePixelRatio),p=t.query("GET_IMAGE_PREVIEW_ZOOM_FACTOR")*d,f=u/o,h=t.rect.element.width,g=t.rect.element.height,m=h,E=m*f;f>1?E=(m=Math.min(o,h*p))*f:m=(E=Math.min(u,g*p))/f;var _=ce(e,m,E,n),I=function(){var n=t.query("GET_IMAGE_PREVIEW_CALCULATE_AVERAGE_IMAGE_COLOR")?he(data):null;a.setMetadata("color",n,!0),"close"in e&&e.close(),t.ref.overlayShadow.opacity=1,s({root:t,props:i,image:_})},v=a.getMetadata("filter");v?r(t,v,_).then(I):I()};if(c(a.file)){var p=n(oe);p.post({file:a.file},(function(e){p.terminate(),e?d(e):u()}))}else u()}},f=function(e){var t=e.root,i=t.ref.images[t.ref.images.length-1];i.translateY=0,i.scaleX=1,i.scaleY=1,i.opacity=1},h=function(e){var t=e.root;t.ref.overlayShadow.opacity=1,t.ref.overlayError.opacity=0,t.ref.overlaySuccess.opacity=0},g=function(e){var t=e.root;t.ref.overlayShadow.opacity=.25,t.ref.overlayError.opacity=1},m=function(e){var t=e.root;t.ref.overlayShadow.opacity=.25,t.ref.overlaySuccess.opacity=1},E=function(e){var i=e.root;i.ref.images=[],i.ref.imageData=null,i.ref.imageViewBin=[],i.ref.overlayShadow=i.appendChildView(i.createChildView(t,{opacity:0,status:"idle"})),i.ref.overlaySuccess=i.appendChildView(i.createChildView(t,{opacity:0,status:"success"})),i.ref.overlayError=i.appendChildView(i.createChildView(t,{opacity:0,status:"failure"}))};return e.utils.createView({name:"image-preview-wrapper",create:E,styles:["height"],apis:["height"],destroy:function(e){e.root.ref.images.forEach((function(e){e.image.width=1,e.image.height=1}))},didWriteView:function(e){e.root.ref.images.forEach((function(e){e.dirty=!1}))},write:e.utils.createRoute({DID_IMAGE_PREVIEW_DRAW:f,DID_IMAGE_PREVIEW_CONTAINER_CREATE:d,DID_FINISH_CALCULATE_PREVIEWSIZE:p,DID_UPDATE_ITEM_METADATA:u,DID_THROW_ITEM_LOAD_ERROR:g,DID_THROW_ITEM_PROCESSING_ERROR:g,DID_THROW_ITEM_INVALID:g,DID_COMPLETE_ITEM_PROCESSING:m,DID_START_ITEM_PROCESSING:h,DID_REVERT_ITEM_PROCESSING:h},(function(e){var t=e.root,i=t.ref.imageViewBin.filter((function(e){return 0===e.opacity}));t.ref.imageViewBin=t.ref.imageViewBin.filter((function(e){return e.opacity>0})),i.forEach((function(e){return o(t,e)})),i.length=0}))})},ve=function(t){var i=t.addFilter,n=t.utils,r=n.Type,o=n.createRoute,a=n.isFile,s=Ie(t);return i("CREATE_VIEW",(function(t){var i=t.is,n=t.view,r=t.query;if(i("file")&&r("GET_ALLOW_IMAGE_PREVIEW")){var l=function(t){var i=t.root,o=t.props.id,l=r("GET_ITEM",o);if(l&&a(l.file)&&!l.archived){var u=l.file;if(e(u)&&r("GET_IMAGE_PREVIEW_FILTER_ITEM")(l)){var c="createImageBitmap"in(window||{}),d=r("GET_IMAGE_PREVIEW_MAX_FILE_SIZE");if(!(!c&&d&&u.size>d)){i.ref.imagePreview=n.appendChildView(n.createChildView(s,{id:o}));var p=i.query("GET_IMAGE_PREVIEW_HEIGHT");p&&i.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:l.id,height:p});var f=!c&&u.size>r("GET_IMAGE_PREVIEW_MAX_INSTANT_PREVIEW_FILE_SIZE");i.dispatch("DID_IMAGE_PREVIEW_CONTAINER_CREATE",{id:o},f)}}}},u=function(e,t){if(e.ref.imagePreview){var i=t.id,n=e.query("GET_ITEM",{id:i});if(n){var r=e.query("GET_PANEL_ASPECT_RATIO"),o=e.query("GET_ITEM_PANEL_ASPECT_RATIO"),a=e.query("GET_IMAGE_PREVIEW_HEIGHT");if(!(r||o||a)){var s=e.ref,l=s.imageWidth,u=s.imageHeight;if(l&&u){var c=e.query("GET_IMAGE_PREVIEW_MIN_HEIGHT"),d=e.query("GET_IMAGE_PREVIEW_MAX_HEIGHT"),p=(n.getMetadata("exif")||{}).orientation||-1;if(p>=5&&p<=8){var f=[u,l];l=f[0],u=f[1]}if(!de(n.file)||e.query("GET_IMAGE_PREVIEW_UPSCALE")){var h=2048/l;l*=h,u*=h}var g=u/l,m=(n.getMetadata("crop")||{}).aspectRatio||g,E=Math.max(c,Math.min(u,d)),_=e.rect.element.width,I=Math.min(_*m,E);e.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:n.id,height:I})}}}}},c=function(e){e.root.ref.shouldRescale=!0},d=function(e){var t=e.root;"crop"===e.action.change.key&&(t.ref.shouldRescale=!0)},p=function(e){var t=e.root,i=e.action;t.ref.imageWidth=i.width,t.ref.imageHeight=i.height,t.ref.shouldRescale=!0,t.ref.shouldDrawPreview=!0,t.dispatch("KICK")};n.registerWriter(o({DID_RESIZE_ROOT:c,DID_STOP_RESIZE:c,DID_LOAD_ITEM:l,DID_IMAGE_PREVIEW_CALCULATE_SIZE:p,DID_UPDATE_ITEM_METADATA:d},(function(e){var t=e.root,i=e.props;t.ref.imagePreview&&(t.rect.element.hidden||(t.ref.shouldRescale&&(u(t,i),t.ref.shouldRescale=!1),t.ref.shouldDrawPreview&&(requestAnimationFrame((function(){t.dispatch("DID_FINISH_CALCULATE_PREVIEWSIZE",{id:i.id})})),t.ref.shouldDrawPreview=!1)))})))}})),{options:{allowImagePreview:[!0,r.BOOLEAN],imagePreviewFilterItem:[function(){return!0},r.FUNCTION],imagePreviewHeight:[null,r.INT],imagePreviewMinHeight:[44,r.INT],imagePreviewMaxHeight:[256,r.INT],imagePreviewMaxFileSize:[null,r.INT],imagePreviewZoomFactor:[2,r.INT],imagePreviewUpscale:[!1,r.BOOLEAN],imagePreviewMaxInstantPreviewFileSize:[1e6,r.INT],imagePreviewTransparencyIndicator:[null,r.STRING],imagePreviewCalculateAverageImageColor:[!1,r.BOOLEAN],imagePreviewMarkupShow:[!0,r.BOOLEAN],imagePreviewMarkupFilter:[function(){return!0},r.FUNCTION]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:ve})),ve}(); /*! * FilePondPluginImageEdit 1.6.3 * Licensed under MIT, https://opensource.org/licenses/MIT/ * Please visit https://pqina.nl/filepond/ for details. */ const $=e=>/^image/.test(e.type),J=e=>{const{addFilter:t,utils:i,views:n}=e,{Type:r,createRoute:o,createItemAPI:a=(e=>e)}=i,{fileActionButton:s}=n;t("SHOULD_REMOVE_ON_REVERT",((e,{item:t,query:i})=>new Promise((e=>{const{file:n}=t;e(!(i("GET_ALLOW_IMAGE_EDIT")&&i("GET_IMAGE_EDIT_ALLOW_EDIT")&&i("GET_IMAGE_EDIT_SUPPORT_IMAGE")(n)))})))),t("DID_LOAD_ITEM",((e,{query:t,dispatch:i})=>new Promise(((n,r)=>{if(e.origin>1)return void n(e);const{file:o}=e;if(!t("GET_ALLOW_IMAGE_EDIT")||!t("GET_IMAGE_EDIT_INSTANT_EDIT"))return void n(e);if(!t("GET_IMAGE_EDIT_SUPPORT_IMAGE")(o))return void n(e);const a=(e,t,n)=>r=>{l.shift(),r?t(e):n(e),i("KICK"),s()},s=()=>{if(!l.length)return;const{item:e,resolve:t,reject:n}=l[0];i("EDIT_ITEM",{id:e.id,handleEditorResponse:a(e,t,n)})};u({item:e,resolve:n,reject:r}),1===l.length&&s()})))),t("DID_CREATE_ITEM",((e,{query:t,dispatch:i})=>{e.extend("edit",(()=>{i("EDIT_ITEM",{id:e.id})}))}));const l=[],u=e=>(l.push(e),e);return t("CREATE_VIEW",(e=>{const{is:t,view:i,query:n}=e;if(!n("GET_ALLOW_IMAGE_EDIT"))return;const r=n("GET_ALLOW_IMAGE_PREVIEW");if(!(t("file-info")&&!r||t("file")&&r))return;const l=n("GET_IMAGE_EDIT_EDITOR");if(!l)return;l.filepondCallbackBridge||(l.outputData=!0,l.outputFile=!1,l.filepondCallbackBridge={onconfirm:l.onconfirm||(()=>{}),oncancel:l.oncancel||(()=>{})});i.registerDestroyer((({root:e})=>{e.ref.buttonEditItem&&e.ref.buttonEditItem.off("click",e.ref.handleEdit),e.ref.editButton&&e.ref.editButton.removeEventListener("click",e.ref.handleEdit)}));const u={EDIT_ITEM:({root:e,props:t,action:i})=>{const{id:n}=t,{handleEditorResponse:r}=i;l.cropAspectRatio=e.query("GET_IMAGE_CROP_ASPECT_RATIO")||l.cropAspectRatio,l.outputCanvasBackgroundColor=e.query("GET_IMAGE_TRANSFORM_CANVAS_BACKGROUND_COLOR")||l.outputCanvasBackgroundColor;const o=e.query("GET_ITEM",n);if(!o)return;const s=o.file,u=o.getMetadata("crop"),c=o.getMetadata("resize"),d=o.getMetadata("filter")||null,p=o.getMetadata("filters")||null,f=o.getMetadata("colors")||null,h=o.getMetadata("markup")||null,g={crop:u||{center:{x:.5,y:.5},flip:{horizontal:!1,vertical:!1},zoom:1,rotation:0,aspectRatio:null},size:c?{upscale:c.upscale,mode:c.mode,width:c.size.width,height:c.size.height}:null,filter:p?p.id||p.matrix:e.query("GET_ALLOW_IMAGE_FILTER")&&e.query("GET_IMAGE_FILTER_COLOR_MATRIX")&&!f?d:null,color:f,markup:h};l.onconfirm=({data:e})=>{const{crop:t,size:i,filter:n,color:s,colorMatrix:u,markup:c}=e,d={};if(t&&(d.crop=t),i){const e=(o.getMetadata("resize")||{}).size,t={width:i.width,height:i.height};t.width&&t.height||!e||(t.width=e.width,t.height=e.height),(t.width||t.height)&&(d.resize={upscale:i.upscale,mode:i.mode,size:t})}c&&(d.markup=c),d.colors=s,d.filters=n,d.filter=u,o.setMetadata(d),l.filepondCallbackBridge.onconfirm(e,a(o)),r&&(l.onclose=()=>{r(!0),l.onclose=null})},l.oncancel=()=>{l.filepondCallbackBridge.oncancel(a(o)),r&&(l.onclose=()=>{r(!1),l.onclose=null})},l.open(s,g)},DID_LOAD_ITEM:({root:e,props:t})=>{if(!n("GET_IMAGE_EDIT_ALLOW_EDIT"))return;const{id:o}=t,a=n("GET_ITEM",o);if(!a)return;const l=a.file;if(n("GET_IMAGE_EDIT_SUPPORT_IMAGE")(l))if(e.ref.handleEdit=t=>{t.stopPropagation(),e.dispatch("EDIT_ITEM",{id:o})},r){const t=i.createChildView(s,{label:"edit",icon:n("GET_IMAGE_EDIT_ICON_EDIT"),opacity:0});t.element.classList.add("filepond--action-edit-item"),t.element.dataset.align=n("GET_STYLE_IMAGE_EDIT_BUTTON_EDIT_ITEM_POSITION"),t.on("click",e.ref.handleEdit),e.ref.buttonEditItem=i.appendChildView(t)}else{const t=i.element.querySelector(".filepond--file-info-main"),r=document.createElement("button");r.className="filepond--action-edit-item-alt",r.innerHTML=n("GET_IMAGE_EDIT_ICON_EDIT")+"edit",r.addEventListener("click",e.ref.handleEdit),t.appendChild(r),e.ref.editButton=r}}};if(r){const e=({root:e})=>{e.ref.buttonEditItem&&(e.ref.buttonEditItem.opacity=1)};u.DID_IMAGE_PREVIEW_SHOW=e}i.registerWriter(o(u))})),{options:{allowImageEdit:[!0,r.BOOLEAN],styleImageEditButtonEditItemPosition:["bottom center",r.STRING],imageEditInstantEdit:[!1,r.BOOLEAN],imageEditAllowEdit:[!0,r.BOOLEAN],imageEditIconEdit:['',r.STRING],imageEditEditor:[null,r.OBJECT],imageEditSupportImage:[$,r.FUNCTION]}}};"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:J}));var K=J,ee={};ee=function(){"use strict";var e=function(e){return/^image/.test(e.type)},t=function(t){var i=t.addFilter,n=t.utils,r=n.Type,o=n.isFile,a=n.getNumericAspectRatioFromString,s=function(t,i){return!(!e(t.file)||!i("GET_ALLOW_IMAGE_CROP"))},l=function(e){return"object"==typeof e},u=function(e){return"number"==typeof e},c=function(e,t){return e.setMetadata("crop",Object.assign({},e.getMetadata("crop"),t))};return i("DID_CREATE_ITEM",(function(e,t){var i=t.query;e.extend("setImageCrop",(function(t){if(s(e,i)&&l(center))return e.setMetadata("crop",t),t})),e.extend("setImageCropCenter",(function(t){if(s(e,i)&&l(t))return c(e,{center:t})})),e.extend("setImageCropZoom",(function(t){if(s(e,i)&&u(t))return c(e,{zoom:Math.max(1,t)})})),e.extend("setImageCropRotation",(function(t){if(s(e,i)&&u(t))return c(e,{rotation:t})})),e.extend("setImageCropFlip",(function(t){if(s(e,i)&&l(t))return c(e,{flip:t})})),e.extend("setImageCropAspectRatio",(function(t){if(s(e,i)&&void 0!==t){var n=e.getMetadata("crop"),r=a(t),o={center:{x:.5,y:.5},flip:n?Object.assign({},n.flip):{horizontal:!1,vertical:!1},rotation:0,zoom:1,aspectRatio:r};return e.setMetadata("crop",o),o}}))})),i("DID_LOAD_ITEM",(function(t,i){var n=i.query;return new Promise((function(i,r){var s=t.file;if(!o(s)||!e(s)||!n("GET_ALLOW_IMAGE_CROP"))return i(t);if(t.getMetadata("crop"))return i(t);var l=n("GET_IMAGE_CROP_ASPECT_RATIO");t.setMetadata("crop",{center:{x:.5,y:.5},flip:{horizontal:!1,vertical:!1},rotation:0,zoom:1,aspectRatio:l?a(l):null}),i(t)}))})),{options:{allowImageCrop:[!0,r.BOOLEAN],imageCropAspectRatio:[null,r.STRING]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:t})),t}();var te={}; /*! * FilePondPluginImageResize 2.0.7 * Licensed under MIT, https://opensource.org/licenses/MIT/ * Please visit https://pqina.nl/filepond/ for details. */te=function(){"use strict";var e=function(e){return/^image/.test(e.type)},t=function(e,t){var i=new Image;i.onload=function(){var e=i.naturalWidth,n=i.naturalHeight;i=null,t({width:e,height:n})},i.onerror=function(){return t(null)},i.src=e},i=function(i){var n=i.addFilter,r=i.utils.Type;return n("DID_LOAD_ITEM",(function(i,n){var r=n.query;return new Promise((function(n,o){var a=i.file;if(!e(a)||!r("GET_ALLOW_IMAGE_RESIZE"))return n(i);var s=r("GET_IMAGE_RESIZE_MODE"),l=r("GET_IMAGE_RESIZE_TARGET_WIDTH"),u=r("GET_IMAGE_RESIZE_TARGET_HEIGHT"),c=r("GET_IMAGE_RESIZE_UPSCALE");if(null===l&&null===u)return n(i);var d=null===l?u:l,p=null===u?d:u,f=URL.createObjectURL(a);t(f,(function(e){if(URL.revokeObjectURL(f),!e)return n(i);var t=e.width,r=e.height,o=(i.getMetadata("exif")||{}).orientation||-1;if(o>=5&&o<=8){var a=[r,t];t=a[0],r=a[1]}return t===d&&r===p||t<=d&&r<=p&&!c?n(i):(i.setMetadata("resize",{mode:s,upscale:c,size:{width:d,height:p}}),void n(i))}))}))})),{options:{allowImageResize:[!0,r.BOOLEAN],imageResizeMode:["cover",r.STRING],imageResizeUpscale:[!0,r.BOOLEAN],imageResizeTargetWidth:[null,r.INT],imageResizeTargetHeight:[null,r.INT]}}};return"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:i})),i}();var ie={}; /*! * FilePondPluginImageTransform 3.7.4 * Licensed under MIT, https://opensource.org/licenses/MIT/ * Please visit https://pqina.nl/filepond/ for details. */ie=function(){"use strict";var e=function(e){return/^image/.test(e.type)},t=function(e){return e.substr(0,e.lastIndexOf("."))||e},i={jpeg:"jpg","svg+xml":"svg"},n=function(e,n){var r=t(e),o=n.split("/")[1],a=i[o]||o;return"".concat(r,".").concat(a)},r=function(e){return/jpeg|png|svg\+xml/.test(e)?e:"image/jpeg"},o=function(e){return/^image/.test(e.type)},a={1:function(){return[1,0,0,1,0,0]},2:function(e){return[-1,0,0,1,e,0]},3:function(e,t){return[-1,0,0,-1,e,t]},4:function(e,t){return[1,0,0,-1,0,t]},5:function(){return[0,1,1,0,0,0]},6:function(e,t){return[0,1,-1,0,t,0]},7:function(e,t){return[0,-1,-1,0,t,e]},8:function(e){return[0,-1,1,0,0,e]}},s=function(e,t,i){return-1===i&&(i=1),a[i](e,t)},l=function(e,t){return{x:e,y:t}},u=function(e,t){return e.x*t.x+e.y*t.y},c=function(e,t){return l(e.x-t.x,e.y-t.y)},d=function(e,t){return u(c(e,t),c(e,t))},p=function(e,t){return Math.sqrt(d(e,t))},f=function(e,t){var i=e,n=1.5707963267948966,r=t,o=1.5707963267948966-t,a=Math.sin(n),s=Math.sin(r),u=Math.sin(o),c=Math.cos(o),d=i/a;return l(c*(d*s),c*(d*u))},h=function(e,t){var i=e.width,n=e.height,r=f(i,t),o=f(n,t),a=l(e.x+Math.abs(r.x),e.y-Math.abs(r.y)),s=l(e.x+e.width+Math.abs(o.y),e.y+Math.abs(o.x)),u=l(e.x-Math.abs(o.y),e.y+e.height-Math.abs(o.x));return{width:p(a,s),height:p(a,u)}},g=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{x:.5,y:.5},r=n.x>.5?1-n.x:n.x,o=n.y>.5?1-n.y:n.y,a=2*r*e.width,s=2*o*e.height,l=h(t,i);return Math.max(l.width/a,l.height/s)},m=function(e,t){var i=e.width,n=i*t;return n>e.height&&(i=(n=e.height)/t),{x:.5*(e.width-i),y:.5*(e.height-n),width:i,height:n}},E=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=e.height/e.width,r=1,o=t,a=1,s=n;s>o&&(a=(s=o)/n);var l=Math.max(r/a,o/s),u=e.width/(i*l*a);return{width:u,height:u*t}},_=function(e){e.width=1,e.height=1,e.getContext("2d").clearRect(0,0,1,1)},I=function(e){return e&&(e.horizontal||e.vertical)},v=function(e,t,i){if(t<=1&&!I(i))return e.width=e.naturalWidth,e.height=e.naturalHeight,e;var n=document.createElement("canvas"),r=e.naturalWidth,o=e.naturalHeight,a=t>=5&&t<=8;a?(n.width=o,n.height=r):(n.width=r,n.height=o);var l=n.getContext("2d");if(t&&l.transform.apply(l,s(r,o,t)),I(i)){var u=[1,0,0,1,0,0];(!a&&i.horizontal||a&i.vertical)&&(u[0]=-1,u[4]=r),(!a&&i.vertical||a&&i.horizontal)&&(u[3]=-1,u[5]=o),l.transform.apply(l,u)}return l.drawImage(e,0,0,r,o),n},T=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},r=n.canvasMemoryLimit,o=n.background,a=void 0===o?null:o,s=i.zoom||1,l=v(e,t,i.flip),u={width:l.width,height:l.height},c=i.aspectRatio||u.height/u.width,d=E(u,c,s);if(r){var p=d.width*d.height;if(p>r){var f=Math.sqrt(r)/Math.sqrt(p);u.width=Math.floor(u.width*f),u.height=Math.floor(u.height*f),d=E(u,c,s)}}var h=document.createElement("canvas"),I={x:.5*d.width,y:.5*d.height},T={x:0,y:0,width:d.width,height:d.height,center:I},y=void 0===i.scaleToFit||i.scaleToFit,w=s*g(u,m(T,c),i.rotation,y?i.center:{x:.5,y:.5});h.width=Math.round(d.width/w),h.height=Math.round(d.height/w),I.x/=w,I.y/=w;var O={x:I.x-u.width*(i.center?i.center.x:.5),y:I.y-u.height*(i.center?i.center.y:.5)},A=h.getContext("2d");a&&(A.fillStyle=a,A.fillRect(0,0,h.width,h.height)),A.translate(I.x,I.y),A.rotate(i.rotation||0),A.drawImage(l,O.x-I.x,O.y-I.y,u.width,u.height);var R=A.getImageData(0,0,h.width,h.height);return _(h),R};"undefined"!=typeof window&&void 0!==window.document&&(HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(e,t,i){var n=this.toDataURL(t,i).split(",")[1];setTimeout((function(){for(var i=atob(n),r=i.length,o=new Uint8Array(r),a=0;a2&&void 0!==arguments[2]?arguments[2]:null;return new Promise((function(n){var r=i?i(e):e;Promise.resolve(r).then((function(e){e.toBlob(n,t.type,t.quality)}))}))},w=function(e,t){return S(e.x*t,e.y*t)},O=function(e,t){return S(e.x+t.x,e.y+t.y)},A=function(e){var t=Math.sqrt(e.x*e.x+e.y*e.y);return 0===t?{x:0,y:0}:S(e.x/t,e.y/t)},R=function(e,t,i){var n=Math.cos(t),r=Math.sin(t),o=S(e.x-i.x,e.y-i.y);return S(i.x+n*o.x-r*o.y,i.y+r*o.x+n*o.y)},S=function(){return{x:arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,y:arguments.length>1&&void 0!==arguments[1]?arguments[1]:0}},b=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=arguments.length>3?arguments[3]:void 0;return"string"==typeof e?parseFloat(e)*i:"number"==typeof e?e*(n?t[n]:Math.min(t.width,t.height)):void 0},M=function(e,t,i){var n=e.borderStyle||e.lineStyle||"solid",r=e.backgroundColor||e.fontColor||"transparent",o=e.borderColor||e.lineColor||"transparent",a=b(e.borderWidth||e.lineWidth,t,i);return{"stroke-linecap":e.lineCap||"round","stroke-linejoin":e.lineJoin||"round","stroke-width":a||0,"stroke-dasharray":"string"==typeof n?"":n.map((function(e){return b(e,t,i)})).join(","),stroke:o,fill:r,opacity:e.opacity||1}},C=function(e){return null!=e},P=function(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,n=b(e.x,t,i,"width")||b(e.left,t,i,"width"),r=b(e.y,t,i,"height")||b(e.top,t,i,"height"),o=b(e.width,t,i,"width"),a=b(e.height,t,i,"height"),s=b(e.right,t,i,"width"),l=b(e.bottom,t,i,"height");return C(r)||(r=C(a)&&C(l)?t.height-a-l:l),C(n)||(n=C(o)&&C(s)?t.width-o-s:s),C(o)||(o=C(n)&&C(s)?t.width-n-s:0),C(a)||(a=C(r)&&C(l)?t.height-r-l:0),{x:n||0,y:r||0,width:o||0,height:a||0}},L=function(e){return e.map((function(e,t){return"".concat(0===t?"M":"L"," ").concat(e.x," ").concat(e.y)})).join(" ")},D=function(e,t){return Object.keys(t).forEach((function(i){return e.setAttribute(i,t[i])}))},x="http://www.w3.org/2000/svg",G=function(e,t){var i=document.createElementNS(x,e);return t&&D(i,t),i},N=function(e){return D(e,Object.assign({},e.rect,e.styles))},F=function(e){var t=e.rect.x+.5*e.rect.width,i=e.rect.y+.5*e.rect.height,n=.5*e.rect.width,r=.5*e.rect.height;return D(e,Object.assign({cx:t,cy:i,rx:n,ry:r},e.styles))},k={contain:"xMidYMid meet",cover:"xMidYMid slice"},U=function(e,t){D(e,Object.assign({},e.rect,e.styles,{preserveAspectRatio:k[t.fit]||"none"}))},V={left:"start",center:"middle",right:"end"},B=function(e,t,i,n){var r=b(t.fontSize,i,n),o=t.fontFamily||"sans-serif",a=t.fontWeight||"normal",s=V[t.textAlign]||"start";D(e,Object.assign({},e.rect,e.styles,{"stroke-width":0,"font-weight":a,"font-size":r,"font-family":o,"text-anchor":s})),e.text!==t.text&&(e.text=t.text,e.textContent=t.text.length?t.text:" ")},q=function(e,t,i,n){D(e,Object.assign({},e.rect,e.styles,{fill:"none"}));var r=e.childNodes[0],o=e.childNodes[1],a=e.childNodes[2],s=e.rect,l={x:e.rect.x+e.rect.width,y:e.rect.y+e.rect.height};if(D(r,{x1:s.x,y1:s.y,x2:l.x,y2:l.y}),t.lineDecoration){o.style.display="none",a.style.display="none";var u=A({x:l.x-s.x,y:l.y-s.y}),c=b(.05,i,n);if(-1!==t.lineDecoration.indexOf("arrow-begin")){var d=w(u,c),p=O(s,d),f=R(s,2,p),h=R(s,-2,p);D(o,{style:"display:block;",d:"M".concat(f.x,",").concat(f.y," L").concat(s.x,",").concat(s.y," L").concat(h.x,",").concat(h.y)})}if(-1!==t.lineDecoration.indexOf("arrow-end")){var g=w(u,-c),m=O(l,g),E=R(l,2,m),_=R(l,-2,m);D(a,{style:"display:block;",d:"M".concat(E.x,",").concat(E.y," L").concat(l.x,",").concat(l.y," L").concat(_.x,",").concat(_.y)})}}},z=function(e,t,i,n){D(e,Object.assign({},e.styles,{fill:"none",d:L(t.points.map((function(e){return{x:b(e.x,i,n,"width"),y:b(e.y,i,n,"height")}})))}))},W=function(e){return function(t){return G(e,{id:t.id})}},H=function(e){var t=G("g",{id:e.id,"stroke-linecap":"round","stroke-linejoin":"round"}),i=G("line");t.appendChild(i);var n=G("path");t.appendChild(n);var r=G("path");return t.appendChild(r),t},j={image:function(e){var t=G("image",{id:e.id,"stroke-linecap":"round","stroke-linejoin":"round",opacity:"0"});return t.onload=function(){t.setAttribute("opacity",e.opacity||1)},t.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",e.src),t},rect:W("rect"),ellipse:W("ellipse"),text:W("text"),path:W("path"),line:H},Y={rect:N,ellipse:F,image:U,text:B,path:z,line:q},X=function(e,t){return j[e](t)},Z=function(e,t,i,n,r){"path"!==t&&(e.rect=P(i,n,r)),e.styles=M(i,n,r),Y[t](e,i,n,r)},Q=function(e,t){return e[1].zIndex>t[1].zIndex?1:e[1].zIndex1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0,n=arguments.length>3?arguments[3]:void 0;return new Promise((function(r){var o=n.background,a=void 0===o?null:o,s=new FileReader;s.onloadend=function(){var e=s.result,n=document.createElement("div");n.style.cssText="position:absolute;pointer-events:none;width:0;height:0;visibility:hidden;",n.innerHTML=e;var o=n.querySelector("svg");document.body.appendChild(n);var l=o.getBBox();n.parentNode.removeChild(n);var u=n.querySelector("title"),c=o.getAttribute("viewBox")||"",d=o.getAttribute("width")||"",p=o.getAttribute("height")||"",f=parseFloat(d)||null,h=parseFloat(p)||null,E=(d.match(/[a-z]+/)||[])[0]||"",_=(p.match(/[a-z]+/)||[])[0]||"",I=c.split(" ").map(parseFloat),v=I.length?{x:I[0],y:I[1],width:I[2],height:I[3]}:l,T=null!=f?f:v.width,y=null!=h?h:v.height;o.style.overflow="visible",o.setAttribute("width",T),o.setAttribute("height",y);var w="";if(i&&i.length){var O={width:T,height:y};w=i.sort(Q).reduce((function(e,t){var i=X(t[0],t[1]);return Z(i,t[0],t[1],O),i.removeAttribute("id"),1===i.getAttribute("opacity")&&i.removeAttribute("opacity"),e+"\n"+i.outerHTML+"\n"}),""),w="\n\n".concat(w.replace(/ /g," "),"\n\n")}var A=t.aspectRatio||y/T,R=T,S=R*A,b=void 0===t.scaleToFit||t.scaleToFit,M=t.center?t.center.x:.5,C=t.center?t.center.y:.5,P=g({width:T,height:y},m({width:R,height:S},A),t.rotation,b?{x:M,y:C}:{x:.5,y:.5}),L=t.zoom*P,D=t.rotation*(180/Math.PI),x={x:.5*R,y:.5*S},G={x:x.x-T*M,y:x.y-y*C},N=["rotate(".concat(D," ").concat(x.x," ").concat(x.y,")"),"translate(".concat(x.x," ").concat(x.y,")"),"scale(".concat(L,")"),"translate(".concat(-x.x," ").concat(-x.y,")"),"translate(".concat(G.x," ").concat(G.y,")")],F=t.flip&&t.flip.horizontal,k=t.flip&&t.flip.vertical,U=["scale(".concat(F?-1:1," ").concat(k?-1:1,")"),"translate(".concat(F?-T:0," ").concat(k?-y:0,")")],V='\n\n\x3c!-- Generated by PQINA - https://pqina.nl/ --\x3e\n').concat(u?u.textContent:"",'\n\n\n').concat(o.outerHTML).concat(w,"\n\n\n");r(V)},s.readAsText(e)}))},J=function(e){var t;try{t=new ImageData(e.width,e.height)}catch(i){t=document.createElement("canvas").getContext("2d").createImageData(e.width,e.height)}return t.data.set(e.data),t},K=function(){var e={resize:c,filter:u},t=function(t,i){return t.forEach((function(t){i=e[t.type](i,t.data)})),i},i=function(e,i){var n=e.transforms,r=null;if(n.forEach((function(e){"filter"===e.type&&(r=e)})),r){var o=null;n.forEach((function(e){"resize"===e.type&&(o=e)})),o&&(o.data.matrix=r.data,n=n.filter((function(e){return"filter"!==e.type})))}i(t(n,e.imageData))};self.onmessage=function(e){i(e.data.message,(function(t){self.postMessage({id:e.data.id,message:t},[t.data.buffer])}))};var n=1,r=1,o=1;function a(e,t,i){var a=t[e]/255,s=t[e+1]/255,l=t[e+2]/255,u=t[e+3]/255,c=a*i[0]+s*i[1]+l*i[2]+u*i[3]+i[4],d=a*i[5]+s*i[6]+l*i[7]+u*i[8]+i[9],p=a*i[10]+s*i[11]+l*i[12]+u*i[13]+i[14],f=a*i[15]+s*i[16]+l*i[17]+u*i[18]+i[19],h=Math.max(0,c*f)+n*(1-f),g=Math.max(0,d*f)+r*(1-f),m=Math.max(0,p*f)+o*(1-f);t[e]=255*Math.max(0,Math.min(1,h)),t[e+1]=255*Math.max(0,Math.min(1,g)),t[e+2]=255*Math.max(0,Math.min(1,m))}var s=self.JSON.stringify([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]);function l(e){return self.JSON.stringify(e||[])===s}function u(e,t){if(!t||l(t))return e;for(var i=e.data,a=i.length,s=t[0],u=t[1],c=t[2],d=t[3],p=t[4],f=t[5],h=t[6],g=t[7],m=t[8],E=t[9],_=t[10],I=t[11],v=t[12],T=t[13],y=t[14],w=t[15],O=t[16],A=t[17],R=t[18],S=t[19],b=0,M=0,C=0,P=0,L=0,D=0,x=0,G=0,N=0,F=0,k=0,U=0;b1&&!1===o)return u(e,d);s=e.width*h,c=e.height*h}for(var g=e.width,m=e.height,E=Math.round(s),_=Math.round(c),I=e.data,v=new Uint8ClampedArray(E*_*4),T=g/E,y=m/_,w=Math.ceil(.5*T),O=Math.ceil(.5*y),A=0;A<_;A++)for(var R=0;R=-1&&q<=1&&(b=2*q*q*q-3*q*q+1)>0){var z=I[3+(B=4*(V+N*g))];x+=b*z,C+=b,z<255&&(b=b*z/250),P+=b*I[B],L+=b*I[B+1],D+=b*I[B+2],M+=b}}v[S]=P/M,v[S+1]=L/M,v[S+2]=D/M,v[S+3]=x/C,d&&a(S,v,d)}return{data:v,width:E,height:_}}},ee=function(e,t){if(1165519206===e.getUint32(t+4,!1)){t+=4;var i=18761===e.getUint16(t+=6,!1);t+=e.getUint32(t+4,i);var n=e.getUint16(t,i);t+=2;for(var r=0;r=65504&&i<=65519||65534===i)&&(o||(o=ee(t,r,n)),!(r+n>t.byteLength));)r+=n;return e.slice(0,r)},ie=function(e){return new Promise((function(t){var i=new FileReader;i.onload=function(){return t(te(i.result)||null)},i.readAsArrayBuffer(e.slice(0,262144))}))},ne=function(){return window.BlobBuilder=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder},re=function(e,t){var i=ne();if(i){var n=new i;return n.append(e),n.getBlob(t)}return new Blob([e],{type:t})},oe=function(){return Math.random().toString(36).substr(2,9)},ae=function(e){var t=new Blob(["(",e.toString(),")()"],{type:"application/javascript"}),i=URL.createObjectURL(t),n=new Worker(i),r=[];return{transfer:function(){},post:function(e,t,i){var o=oe();r[o]=t,n.onmessage=function(e){var t=r[e.data.id];t&&(t(e.data.message),delete r[e.data.id])},n.postMessage({id:o,message:e},i)},terminate:function(){n.terminate(),URL.revokeObjectURL(i)}}},se=function(e){return new Promise((function(t,i){var n=new Image;n.onload=function(){t(n)},n.onerror=function(e){i(e)},n.src=e}))},le=function(e){return e.reduce((function(e,t){return e.then((function(e){return t().then(Array.prototype.concat.bind(e))}))}),Promise.resolve([]))},ue=function(e,t){return new Promise((function(i){var n={width:e.width,height:e.height},r=e.getContext("2d"),o=t.sort(Q).map((function(e){return function(){return new Promise((function(t){pe[e[0]](r,n,e[1],t)&&t()}))}}));le(o).then((function(){return i(e)}))}))},ce=function(e,t){e.beginPath(),e.lineCap=t["stroke-linecap"],e.lineJoin=t["stroke-linejoin"],e.lineWidth=t["stroke-width"],t["stroke-dasharray"].length&&e.setLineDash(t["stroke-dasharray"].split(",")),e.fillStyle=t.fill,e.strokeStyle=t.stroke,e.globalAlpha=t.opacity||1},de=function(e){e.fill(),e.stroke(),e.globalAlpha=1},pe={rect:function(e,t,i){var n=P(i,t),r=M(i,t);return ce(e,r),e.rect(n.x,n.y,n.width,n.height),de(e,r),!0},ellipse:function(e,t,i){var n=P(i,t),r=M(i,t);ce(e,r);var o=n.x,a=n.y,s=n.width,l=n.height,u=.5522848,c=s/2*u,d=l/2*u,p=o+s,f=a+l,h=o+s/2,g=a+l/2;return e.moveTo(o,g),e.bezierCurveTo(o,g-d,h-c,a,h,a),e.bezierCurveTo(h+c,a,p,g-d,p,g),e.bezierCurveTo(p,g+d,h+c,f,h,f),e.bezierCurveTo(h-c,f,o,g+d,o,g),de(e,r),!0},image:function(e,t,i,n){var r=P(i,t),o=M(i,t);ce(e,o);var a=new Image;new URL(i.src,window.location.href).origin!==window.location.origin&&(a.crossOrigin=""),a.onload=function(){if("cover"===i.fit){var t=r.width/r.height,s=t>1?a.width:a.height*t,l=t>1?a.width/t:a.height,u=.5*a.width-.5*s,c=.5*a.height-.5*l;e.drawImage(a,u,c,s,l,r.x,r.y,r.width,r.height)}else if("contain"===i.fit){var d=Math.min(r.width/a.width,r.height/a.height),p=d*a.width,f=d*a.height,h=r.x+.5*r.width-.5*p,g=r.y+.5*r.height-.5*f;e.drawImage(a,0,0,a.width,a.height,h,g,p,f)}else e.drawImage(a,0,0,a.width,a.height,r.x,r.y,r.width,r.height);de(e,o),n()},a.src=i.src},text:function(e,t,i){var n=P(i,t),r=M(i,t);ce(e,r);var o=b(i.fontSize,t),a=i.fontFamily||"sans-serif",s=i.fontWeight||"normal",l=i.textAlign||"left";return e.font="".concat(s," ").concat(o,"px ").concat(a),e.textAlign=l,e.fillText(i.text,n.x,n.y),de(e,r),!0},line:function(e,t,i){var n=P(i,t),r=M(i,t);ce(e,r),e.beginPath();var o={x:n.x,y:n.y},a={x:n.x+n.width,y:n.y+n.height};e.moveTo(o.x,o.y),e.lineTo(a.x,a.y);var s=A({x:a.x-o.x,y:a.y-o.y}),l=.04*Math.min(t.width,t.height);if(-1!==i.lineDecoration.indexOf("arrow-begin")){var u=w(s,l),c=O(o,u),d=R(o,2,c),p=R(o,-2,c);e.moveTo(d.x,d.y),e.lineTo(o.x,o.y),e.lineTo(p.x,p.y)}if(-1!==i.lineDecoration.indexOf("arrow-end")){var f=w(s,-l),h=O(a,f),g=R(a,2,h),m=R(a,-2,h);e.moveTo(g.x,g.y),e.lineTo(a.x,a.y),e.lineTo(m.x,m.y)}return de(e,r),!0},path:function(e,t,i){var n=M(i,t);ce(e,n),e.beginPath();var r=i.points.map((function(e){return{x:b(e.x,t,1,"width"),y:b(e.y,t,1,"height")}}));e.moveTo(r[0].x,r[0].y);for(var o=r.length,a=1;a2&&void 0!==arguments[2]?arguments[2]:{};return new Promise((function(n,r){if(!e||!o(e))return r({status:"not an image file",file:e});var a=i.stripImageHead,s=i.beforeCreateBlob,l=i.afterCreateBlob,u=i.canvasMemoryLimit,c=t.crop,d=t.size,p=t.filter,f=t.markup,h=t.output,g=t.image&&t.image.orientation?Math.max(1,Math.min(8,t.image.orientation)):null,m=h&&h.quality,E=null===m?null:m/100,I=h&&h.type||null,v=h&&h.background||null,w=[];!d||"number"!=typeof d.width&&"number"!=typeof d.height||w.push({type:"resize",data:d}),p&&20===p.length&&w.push({type:"filter",data:p});var O=function(e){var t=l?l(e):e;Promise.resolve(t).then(n)},A=function(t,i){var n=fe(t),o=f.length?ue(n,f):n;Promise.resolve(o).then((function(t){y(t,i,s).then((function(i){if(_(t),a)return O(i);ie(e).then((function(e){null!==e&&(i=new Blob([e,i.slice(20)],{type:i.type})),O(i)}))})).catch(r)}))};if(/svg/.test(e.type)&&null===I)return $(e,c,f,{background:v}).then((function(e){n(re(e,"image/svg+xml"))}));var R=URL.createObjectURL(e);se(R).then((function(t){URL.revokeObjectURL(R);var i=T(t,g,c,{canvasMemoryLimit:u,background:v}),n={quality:E,type:I||e.type};if(!w.length)return A(i,n);var r=ae(K);r.post({transforms:w,imageData:i},(function(e){A(J(e),n),r.terminate()}),[i.data.buffer])})).catch(r)}))};function ge(e){this.wrapped=e}function me(e){var t,i;function n(e,n){return new Promise((function(o,a){var s={key:e,arg:n,resolve:o,reject:a,next:null};i?i=i.next=s:(t=i=s,r(e,n))}))}function r(t,i){try{var n=e[t](i),a=n.value,s=a instanceof ge;Promise.resolve(s?a.wrapped:a).then((function(e){s?r("next",e):o(n.done?"return":"normal",e)}),(function(e){r("throw",e)}))}catch(e){o("throw",e)}}function o(e,n){switch(e){case"return":t.resolve({value:n,done:!0});break;case"throw":t.reject(n);break;default:t.resolve({value:n,done:!1})}(t=t.next)?r(t.key,t.arg):i=null}this._invoke=n,"function"!=typeof e.return&&(this.return=void 0)}function Ee(e,t){return _e(e)||Ie(e,t)||ve()}function _e(e){if(Array.isArray(e))return e}function Ie(e,t){var i=[],n=!0,r=!1,o=void 0;try{for(var a,s=e[Symbol.iterator]();!(n=(a=s.next()).done)&&(i.push(a.value),!t||i.length!==t);n=!0);}catch(e){r=!0,o=e}finally{try{n||null==s.return||s.return()}finally{if(r)throw o}}return i}function ve(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}"function"==typeof Symbol&&Symbol.asyncIterator&&(me.prototype[Symbol.asyncIterator]=function(){return this}),me.prototype.next=function(e){return this._invoke("next",e)},me.prototype.throw=function(e){return this._invoke("throw",e)},me.prototype.return=function(e){return this._invoke("return",e)};var Te=["x","y","left","top","right","bottom","width","height"],ye=function(e){return"string"==typeof e&&/%/.test(e)?parseFloat(e)/100:e},we=function(e){var t=Ee(e,2),i=t[0],n=t[1],r=n.points?{}:Te.reduce((function(e,t){return e[t]=ye(n[t]),e}),{});return[i,Object.assign({zIndex:0},n,r)]},Oe=function(e){return new Promise((function(t,i){var n=new Image;n.src=URL.createObjectURL(e);var r=function(){var e=n.naturalWidth,i=n.naturalHeight;e&&i&&(URL.revokeObjectURL(n.src),clearInterval(o),t({width:e,height:i}))};n.onerror=function(e){URL.revokeObjectURL(n.src),clearInterval(o),i(e)};var o=setInterval(r,1);r()}))};"undefined"!=typeof window&&void 0!==window.document&&(HTMLCanvasElement.prototype.toBlob||Object.defineProperty(HTMLCanvasElement.prototype,"toBlob",{value:function(e,t,i){var n=this;setTimeout((function(){for(var r=n.toDataURL(t,i).split(",")[1],o=atob(r),a=o.length,s=new Uint8Array(a);a--;)s[a]=o.charCodeAt(a);e(new Blob([s],{type:t||"image/png"}))}))}}));var Ae="undefined"!=typeof window&&void 0!==window.document,Re=Ae&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Se=function(t){var i=t.addFilter,o=t.utils,a=o.Type,s=o.forin,l=o.getFileFromBlob,u=o.isFile,c=["crop","resize","filter","markup","output"],d=function(e){return function(t,i,n){return t(i,e?e(n):n)}},p=function(e){return null===e.aspectRatio&&0===e.rotation&&1===e.zoom&&e.center&&.5===e.center.x&&.5===e.center.y&&e.flip&&!1===e.flip.horizontal&&!1===e.flip.vertical};i("SHOULD_PREPARE_OUTPUT",(function(e,t){var i=t.query;return new Promise((function(e){e(!i("IS_ASYNC"))}))}));var f=function(t,i,n){return new Promise((function(r){if(!t("GET_ALLOW_IMAGE_TRANSFORM")||n.archived||!u(i)||!e(i))return r(!1);Oe(i).then((function(){var e=t("GET_IMAGE_TRANSFORM_IMAGE_FILTER");if(e){var n=e(i);if(null==n)return handleRevert(!0);if("boolean"==typeof n)return r(n);if("function"==typeof n.then)return n.then(r)}r(!0)})).catch((function(e){r(!1)}))}))};return i("PREPARE_OUTPUT",(function(e,t){var i=t.query,o=t.item;return new Promise((function(t){f(i,e,o).then((function(a){if(!a)return t(e);var u=[];i("GET_IMAGE_TRANSFORM_VARIANTS_INCLUDE_ORIGINAL")&&u.push((function(){return new Promise((function(t){t({name:i("GET_IMAGE_TRANSFORM_VARIANTS_ORIGINAL_NAME"),file:e})}))})),i("GET_IMAGE_TRANSFORM_VARIANTS_INCLUDE_DEFAULT")&&u.push((function(e,t,n){return new Promise((function(r){e(t,n).then((function(e){return r({name:i("GET_IMAGE_TRANSFORM_VARIANTS_DEFAULT_NAME"),file:e})}))}))}));var f=i("GET_IMAGE_TRANSFORM_VARIANTS")||{};s(f,(function(e,t){var i=d(t);u.push((function(t,n,r){return new Promise((function(o){i(t,n,r).then((function(t){return o({name:e,file:t})}))}))}))}));var h=i("GET_IMAGE_TRANSFORM_OUTPUT_QUALITY"),g=i("GET_IMAGE_TRANSFORM_OUTPUT_QUALITY_MODE"),m=null===h?null:h/100,E=i("GET_IMAGE_TRANSFORM_OUTPUT_MIME_TYPE"),_=i("GET_IMAGE_TRANSFORM_CLIENT_TRANSFORMS")||c;o.setMetadata("output",{type:E,quality:m,client:_},!0);var I=function(e,t){return new Promise((function(o,a){var s=Object.assign({},t);Object.keys(s).filter((function(e){return"exif"!==e})).forEach((function(e){-1===_.indexOf(e)&&delete s[e]}));var u=s.resize,c=s.exif,d=s.output,f=s.crop,h=s.filter,m=s.markup,E={image:{orientation:c?c.orientation:null},output:d&&(d.type||"number"==typeof d.quality||d.background)?{type:d.type,quality:"number"==typeof d.quality?100*d.quality:null,background:d.background||i("GET_IMAGE_TRANSFORM_CANVAS_BACKGROUND_COLOR")||null}:void 0,size:u&&(u.size.width||u.size.height)?Object.assign({mode:u.mode,upscale:u.upscale},u.size):void 0,crop:f&&!p(f)?Object.assign({},f):void 0,markup:m&&m.length?m.map(we):[],filter:h};if(E.output){var I=!!d.type&&d.type!==e.type,v=/\/jpe?g$/.test(e.type),T=null!==d.quality&&v&&"always"===g;if(!(E.size||E.crop||E.filter||I||T))return o(e)}var y={beforeCreateBlob:i("GET_IMAGE_TRANSFORM_BEFORE_CREATE_BLOB"),afterCreateBlob:i("GET_IMAGE_TRANSFORM_AFTER_CREATE_BLOB"),canvasMemoryLimit:i("GET_IMAGE_TRANSFORM_CANVAS_MEMORY_LIMIT"),stripImageHead:i("GET_IMAGE_TRANSFORM_OUTPUT_STRIP_IMAGE_HEAD")};he(e,E,y).then((function(t){var i=l(t,n(e.name,r(t.type)));o(i)})).catch(a)}))},v=u.map((function(t){return t(I,e,o.getMetadata())}));Promise.all(v).then((function(e){t(1===e.length&&null===e[0].name?e[0].file:e)}))}))}))})),{options:{allowImageTransform:[!0,a.BOOLEAN],imageTransformImageFilter:[null,a.FUNCTION],imageTransformOutputMimeType:[null,a.STRING],imageTransformOutputQuality:[null,a.INT],imageTransformOutputStripImageHead:[!0,a.BOOLEAN],imageTransformClientTransforms:[null,a.ARRAY],imageTransformOutputQualityMode:["always",a.STRING],imageTransformVariants:[null,a.OBJECT],imageTransformVariantsIncludeDefault:[!0,a.BOOLEAN],imageTransformVariantsDefaultName:[null,a.STRING],imageTransformVariantsIncludeOriginal:[!1,a.BOOLEAN],imageTransformVariantsOriginalName:["original_",a.STRING],imageTransformBeforeCreateBlob:[null,a.FUNCTION],imageTransformAfterCreateBlob:[null,a.FUNCTION],imageTransformCanvasMemoryLimit:[Ae&&Re?16777216:null,a.INT],imageTransformCanvasBackgroundColor:[null,a.STRING]}}};return Ae&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:Se})),Se}();const ne=e=>new Promise(((t,i)=>{const n=document.createElement("img");n.src=URL.createObjectURL(e),n.onerror=e=>{clearInterval(r),i(e)};const r=setInterval((()=>{n.naturalWidth&&n.naturalHeight&&(clearInterval(r),URL.revokeObjectURL(n.src),t({width:n.naturalWidth,height:n.naturalHeight}))}),1)})),re=e=>/^image/.test(e.type),oe=e=>{const{addFilter:t,utils:i}=e,{Type:n,replaceInString:r,isFile:o,createRoute:a}=i,s=(e,t,i)=>{const n={minWidth:t("GET_IMAGE_VALIDATE_SIZE_MIN_WIDTH"),minHeight:t("GET_IMAGE_VALIDATE_SIZE_MIN_HEIGHT"),maxWidth:t("GET_IMAGE_VALIDATE_SIZE_MAX_WIDTH"),maxHeight:t("GET_IMAGE_VALIDATE_SIZE_MAX_HEIGHT"),minResolution:t("GET_IMAGE_VALIDATE_SIZE_MIN_RESOLUTION"),maxResolution:t("GET_IMAGE_VALIDATE_SIZE_MAX_RESOLUTION")};return((e,t,i)=>new Promise(((n,r)=>{const o=({width:e,height:i})=>{const{minWidth:o,minHeight:a,maxWidth:s,maxHeight:l,minResolution:u,maxResolution:c}=t,d=e*i;es||i>l?r("TOO_BIG"):null!==u&&dc&&r("TOO_HIGH_RES"),n()};i&&i.width&&i.height?o(i):ne(e).then(o).catch((()=>{r()}))})))(e,n,i).catch((i=>{const o=i?{TOO_SMALL:{label:t("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_SIZE_TOO_SMALL"),details:t("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MIN_SIZE")},TOO_BIG:{label:t("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_SIZE_TOO_BIG"),details:t("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MAX_SIZE")},TOO_LOW_RES:{label:t("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_RESOLUTION_TOO_LOW"),details:t("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MIN_RESOLUTION")},TOO_HIGH_RES:{label:t("GET_IMAGE_VALIDATE_SIZE_LABEL_IMAGE_RESOLUTION_TOO_HIGH"),details:t("GET_IMAGE_VALIDATE_SIZE_LABEL_EXPECTED_MAX_RESOLUTION")}}[i]:{label:t("GET_IMAGE_VALIDATE_SIZE_LABEL_FORMAT_ERROR"),details:e.type};throw{status:{main:o.label,sub:i?r(o.details,n):o.details}}}))},l=e=>{if(null==e||""===e)return null;if("number"==typeof e)return e;if(-1!==e.indexOf(":")){let t=e.split(":");if(t.length>1){return parseFloat(t[0])/parseFloat(t[1])}}else{let t=parseFloat(e);if(!isNaN(t))return t}return null};let u=!1;return t("CREATE_VIEW",(e=>{const{is:t,view:i,query:n}=e,c=({root:e,props:t})=>{const{id:i}=t,a=n("GET_ITEM",i);if(!a||a.archived)return;if(a.getMetadata("imageValidate")){a.setMetadata("imageValidate",!1,!0);let t=a.file;if(!n("GET_IMAGE_VALIDATE_SUPPORT_IMAGE")(t))return;const c=a.serverId;let d=a.getMetadata("imageSize"),p=n("GET_IMAGE_VALIDATE_COMPLETE_RESULT");if(!o(t)&&!d)return void e.dispatch("REMOVE_ITEM",{id:a.id});const f=()=>{let t=e.element.querySelector(".filepond--image-preview-overlay-failure");null!=t&&(t.style.opacity="0"),p(c,!0)},h=t=>{e.dispatch("DID_THROW_ITEM_INVALID",{id:i,error:t.status,status:t.status}),p(c,!1)};s(t,n,d).then((()=>{let i=n("GET_IMAGE_VALIDATE_CROP_RATIOS");if(null!=i&&Array.isArray(i)&&i.length>0){let s=d.width/d.height;s=Math.round(1e3*s)/1e3;let c=!1,p="";for(let e=0;e{u=!1,e?f():h(s)}});throw s}}f()})).catch((e=>{h(e)}))}};i.registerWriter(a({DID_COMPLETE_ITEM_PROCESSING:c,DID_LOAD_ITEM:c},(({root:e,props:t})=>{})))})),t("DID_CREATE_ITEM",((e,{query:t,dispatch:i})=>{e.extend("validate",(()=>{let n=t("GET_ALLOW_IMAGE_VALIDATE_SIZE");e.setMetadata("imageValidate",n,!0),i("DID_COMPLETE_ITEM_PROCESSING",{id:e.id,error:null,serverFileReference:e.serverId})}))})),t("PREPARE_OUTPUT",((e,{query:t,item:i})=>new Promise(((n,r)=>{e&&Array.isArray(e)&&0!==e.length||n(e);let a=t("GET_IMAGE_VALIDATE_COMPLETE_OUTPUT_NAME"),s=null;for(let t=0;t{i.setMetadata("imageSize",{width:t.width,height:t.height},!0),n(e)})).catch((()=>{n(e)}))})))),t("LOAD_FILE",((e,{query:t})=>new Promise(((i,n)=>{let r=t("GET_IMAGE_VALIDATE_SUPPORT_IMAGE");if(!o(e)||null==r||!r(e))return void i(e);let a=t("GET_ALLOW_IMAGE_VALIDATE_SIZE"),l=t("GET_ALLOW_IMAGE_VALIDATE_IMAGE");a||l?ne(e).then((r=>{a?s(e,t,r).then((()=>{i(e)})).catch((e=>{n(e)})):i(e)})).catch((r=>{t("GET_ALLOW_IMAGE_VALIDATE_IMAGE_FAIL")?i(e):n({status:{main:t("GET_IMAGE_VALIDATE_SIZE_LABEL_FORMAT_ERROR"),sub:e.type}})})):i(e)})))),{options:{imageValidateCompleteResult:[(e,t)=>null,n.FUNCTION],imageValidateSupportImage:[re,n.FUNCTION],imageValidateCompleteOutputName:["original",n.STRING],imageValidateCropRatios:[null,n.ARRAY],allowImageValidateImage:[!1,n.BOOLEAN],allowImageValidateImageFail:[!1,n.BOOLEAN],allowImageValidateSize:[!0,n.BOOLEAN],imageValidateSizeLabelFormatError:["Image type not supported",n.STRING],imageValidateSizeMeasure:[null,n.FUNCTION],imageValidateSizeMinResolution:[null,n.INT],imageValidateSizeMaxResolution:[null,n.INT],imageValidateSizeLabelImageResolutionTooLow:["Resolution is too low",n.STRING],imageValidateSizeLabelImageResolutionTooHigh:["Resolution is too high",n.STRING],imageValidateSizeLabelExpectedMinResolution:["Minimum resolution is {minResolution}",n.STRING],imageValidateSizeLabelExpectedMaxResolution:["Maximum resolution is {maxResolution}",n.STRING],imageValidateSizeMinWidth:[1,n.INT],imageValidateSizeMinHeight:[1,n.INT],imageValidateSizeMaxWidth:[65535,n.INT],imageValidateSizeMaxHeight:[65535,n.INT],imageValidateSizeLabelImageSizeTooSmall:["Image is too small",n.STRING],imageValidateSizeLabelImageSizeTooBig:["Image is too big",n.STRING],imageValidateSizeLabelExpectedMinSize:["Minimum size is {minWidth} × {minHeight}",n.STRING],imageValidateSizeLabelExpectedMaxSize:["Maximum size is {maxWidth} × {maxHeight}",n.STRING],imageValidateSizeLabelImageRatioInvalid:["Image ratio does not match",n.STRING],imageValidateSizeLabelImageRatioExpected:["Expected image ratio {ratio}",n.STRING]}}};"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:oe}));var ae=oe;const se={type:"spring",stiffness:.5,damping:.45,mass:10},le=e=>e.utils.createView({name:"file-poster appcloud",tag:"div",ignoreRect:!0,create:({root:e})=>{e.ref.image=document.createElement("img"),e.element.appendChild(e.ref.image)},write:e.utils.createRoute({DID_FILE_POSTER_LOAD:({root:e,props:t})=>{const{id:i}=t,n=e.query("GET_ITEM",{id:t.id});if(!n)return;if(e.query("GET_ALLOW_FILE_GRID_PREVIEW")){const t=n.getMetadata("poster");t?e.ref.image.src=t:n.status!==p.FileStatus.PROCESSING_COMPLETE&&n.status!==p.FileStatus.PROCESSING_ERROR?e.ref.image.src="data:image/svg+xml;base64,PCEtLSBCeSBTYW0gSGVyYmVydCAoQHNoZXJiKSwgZm9yIGV2ZXJ5b25lLiBNb3JlIEAgaHR0cDovL2dvby5nbC83QUp6YkwgLS0+Cjxzdmcgd2lkdGg9IjQ0IiBoZWlnaHQ9IjQ0IiB2aWV3Qm94PSIwIDAgNDQgNDQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgc3Ryb2tlPSIjZmZmIj4KICAgIDxnIGZpbGw9Im5vbmUiIGZpbGwtcnVsZT0iZXZlbm9kZCIgc3Ryb2tlLXdpZHRoPSIyIj4KICAgICAgICA8Y2lyY2xlIGN4PSIyMiIgY3k9IjIyIiByPSIxIj4KICAgICAgICAgICAgPGFuaW1hdGUgYXR0cmlidXRlTmFtZT0iciIKICAgICAgICAgICAgICAgIGJlZ2luPSIwcyIgZHVyPSIxLjhzIgogICAgICAgICAgICAgICAgdmFsdWVzPSIxOyAyMCIKICAgICAgICAgICAgICAgIGNhbGNNb2RlPSJzcGxpbmUiCiAgICAgICAgICAgICAgICBrZXlUaW1lcz0iMDsgMSIKICAgICAgICAgICAgICAgIGtleVNwbGluZXM9IjAuMTY1LCAwLjg0LCAwLjQ0LCAxIgogICAgICAgICAgICAgICAgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIC8+CiAgICAgICAgICAgIDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9InN0cm9rZS1vcGFjaXR5IgogICAgICAgICAgICAgICAgYmVnaW49IjBzIiBkdXI9IjEuOHMiCiAgICAgICAgICAgICAgICB2YWx1ZXM9IjE7IDAiCiAgICAgICAgICAgICAgICBjYWxjTW9kZT0ic3BsaW5lIgogICAgICAgICAgICAgICAga2V5VGltZXM9IjA7IDEiCiAgICAgICAgICAgICAgICBrZXlTcGxpbmVzPSIwLjMsIDAuNjEsIDAuMzU1LCAxIgogICAgICAgICAgICAgICAgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiIC8+CiAgICAgICAgPC9jaXJjbGU+CiAgICAgICAgPGNpcmNsZSBjeD0iMjIiIGN5PSIyMiIgcj0iMSI+CiAgICAgICAgICAgIDxhbmltYXRlIGF0dHJpYnV0ZU5hbWU9InIiCiAgICAgICAgICAgICAgICBiZWdpbj0iLTAuOXMiIGR1cj0iMS44cyIKICAgICAgICAgICAgICAgIHZhbHVlcz0iMTsgMjAiCiAgICAgICAgICAgICAgICBjYWxjTW9kZT0ic3BsaW5lIgogICAgICAgICAgICAgICAga2V5VGltZXM9IjA7IDEiCiAgICAgICAgICAgICAgICBrZXlTcGxpbmVzPSIwLjE2NSwgMC44NCwgMC40NCwgMSIKICAgICAgICAgICAgICAgIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiAvPgogICAgICAgICAgICA8YW5pbWF0ZSBhdHRyaWJ1dGVOYW1lPSJzdHJva2Utb3BhY2l0eSIKICAgICAgICAgICAgICAgIGJlZ2luPSItMC45cyIgZHVyPSIxLjhzIgogICAgICAgICAgICAgICAgdmFsdWVzPSIxOyAwIgogICAgICAgICAgICAgICAgY2FsY01vZGU9InNwbGluZSIKICAgICAgICAgICAgICAgIGtleVRpbWVzPSIwOyAxIgogICAgICAgICAgICAgICAga2V5U3BsaW5lcz0iMC4zLCAwLjYxLCAwLjM1NSwgMSIKICAgICAgICAgICAgICAgIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIiAvPgogICAgICAgIDwvY2lyY2xlPgogICAgPC9nPgo8L3N2Zz4=":e.ref.image.src="",e.dispatch("DID_FILE_POSTER_DRAW",{id:i}),t&&e.dispatch("DID_IMAGE_PREVIEW_SHOW",{id:i})}else n.status===p.FileStatus.PROCESSING_COMPLETE&&e.dispatch("DID_IMAGE_PREVIEW_SHOW",{id:i})}}),mixins:{styles:["scaleX","scaleY","opacity"],animations:{scaleX:se,scaleY:se,opacity:{type:"tween",duration:750}}}}),ue=e=>-.5*(Math.cos(Math.PI*e)-1),ce=(e,t,i=1,n=ue,r=10,o=0)=>{const a=1-o,s=t.join(",");for(let t=0;t<=r;t++){const l=t/r,u=o+a*l;e.addColorStop(u,`rgba(${s}, ${n(l)*i})`)}},de=(e,t,i,n,r)=>{e.width=t,e.height=i;const o=e.getContext("2d"),a=.5*t,s=o.createRadialGradient(a,i+110,i-100,a,i+110,i+100);ce(s,n,r,void 0,8,.4),o.save(),o.translate(.5*-t,0),o.scale(2,1),o.fillStyle=s,o.fillRect(0,0,t,i),o.restore()},pe="undefined"!=typeof navigator,fe=500,he=200,ge=pe&&document.createElement("canvas"),me=pe&&document.createElement("canvas"),Ee=pe&&document.createElement("canvas");pe&&(de(ge,fe,he,[40,40,40],.85),de(me,fe,he,[196,78,71],1),de(Ee,fe,he,[54,151,99],0));const _e=e=>{const t=e.utils.createView({name:"file-poster-overlay",tag:"canvas",ignoreRect:!0,create:({root:e,props:t})=>{var i,n;i=t.template,(n=e.element).width=i.width,n.height=i.height,n.getContext("2d").drawImage(i,0,0)},mixins:{styles:["opacity"],animations:{opacity:{type:"spring",mass:25}}}});const i=({root:e})=>{e.ref.overlayError.opacity=0},n=({root:e})=>{e.ref.overlayError.opacity=1};return e.utils.createView({name:"file-poster-wrapper",create:({root:i,props:n})=>{const r=le(e);i.ref.image=i.appendChildView(i.createChildView(r,{id:n.id,scaleX:1.25,scaleY:1.25,opacity:0})),i.ref.overlayError=i.appendChildView(i.createChildView(t,{template:me,opacity:0}))},write:e.utils.createRoute({DID_FILE_POSTER_LOAD:({root:e})=>{},DID_FILE_POSTER_DRAW:({root:e})=>{const{image:t}=e.ref;t.scaleX=1,t.scaleY=1,t.opacity=1},DID_FILE_POSTER_CONTAINER_CREATE:({root:e,props:t})=>{const{id:i}=t,n=e.query("GET_ITEM",i);if(!n)return;const r=n.getMetadata("poster"),o=t=>{e.dispatch("DID_FILE_POSTER_LOAD",{id:i,data:t})};r?(((e,t)=>{let i=new Image;i.onload=()=>{const e=i.naturalWidth,n=i.naturalHeight;i=null,t(e,n)},i.src=e})(r,((t,i)=>{var n,a;(n=r,a=e.query("GET_FILE_POSTER_CROSS_ORIGIN_ATTRIBUTE_VALUE"),new Promise(((e,t)=>{const i=new Image;"string"==typeof crossOrigin&&(i.crossOrigin=a),i.onload=()=>{e(i)},i.onerror=e=>{t(e)},i.src=n}))).then(o)})),e.dispatch("DID_FILE_POSTER_CALCULATE_SIZE",{id:i,width:fe,height:he})):(e.dispatch("DID_FILE_POSTER_CALCULATE_SIZE",{id:i}),n.origin===p.FileOrigin.INPUT&&e.dispatch("DID_FILE_POSTER_LOAD",{id:i}))},DID_THROW_ITEM_LOAD_ERROR:n,DID_THROW_ITEM_PROCESSING_ERROR:n,DID_THROW_ITEM_INVALID:n,DID_COMPLETE_ITEM_PROCESSING:({root:e})=>{},DID_START_ITEM_PROCESSING:i,DID_REVERT_ITEM_PROCESSING:i})})},Ie=e=>{const{addFilter:t,utils:i}=e,{Type:n,createRoute:r}=i,o=_e(e);return t("CREATE_VIEW",(e=>{const{is:t,view:i,query:n}=e;if(!t("file")||!n("GET_ALLOW_FILE_GRID"))return;const a=e=>{const t=e.serverId;let i=n("GET_FILE_GRID_FILE_VARIANT")(t,"thumbnail");null!=i&&e.setMetadata("poster",i.url,!0)},s=({root:e})=>{let t=e.query("GET_FILE_POSTER_HEIGHT");if(t)return t;const i=e.query("GET_FILE_POSTER_MIN_HEIGHT"),n=e.query("GET_FILE_POSTER_MAX_HEIGHT");if(i&&e.ref.imageHeightn?n:r};i.registerWriter(r({DID_THROW_ITEM_INVALID:({root:e,props:t})=>{e.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:t.id,height:s({root:e})})},DID_THROW_ITEM_PROCESSING_ERROR:({root:e,props:t})=>{const{id:i}=t;e.dispatch("DID_FILE_POSTER_LOAD",{id:i})},DID_COMPLETE_ITEM_PROCESSING:({root:e,props:t})=>{const{id:i}=t,r=n("GET_ITEM",i);r&&!r.archived&&(a(r),e.dispatch("DID_FILE_POSTER_LOAD",{id:i}))},DID_LOAD_ITEM:({root:e,props:t})=>{const{id:r}=t,s=n("GET_ITEM",r);s&&!s.archived&&n("GET_FILE_POSTER_FILTER_ITEM")(s)&&(a(s),s.origin===p.FileOrigin.LOCAL&&e.element.classList.add("server"),e.ref.filePoster=i.appendChildView(i.createChildView(o,{id:r})),e.dispatch("DID_FILE_POSTER_CONTAINER_CREATE",{id:r}))},DID_FILE_POSTER_CALCULATE_SIZE:({root:e,action:t})=>{e.ref.filePoster&&(e.ref.imageWidth=t.width,e.ref.imageHeight=t.height,e.ref.shouldUpdatePanelHeight=!0,e.dispatch("KICK"))}},(({root:e,props:t})=>{e.ref.filePoster&&(e.rect.element.hidden||e.ref.shouldUpdatePanelHeight&&(e.dispatch("DID_UPDATE_PANEL_HEIGHT",{id:t.id,height:s({root:e})}),e.ref.shouldUpdatePanelHeight=!1))})))})),{options:{allowImagePreview:[!0,n.BOOLEAN],allowFileGrid:[!0,n.BOOLEAN],allowFileGridPreview:[!0,n.BOOLEAN],fileGridFileVariant:[()=>null,n.FUNCTION],filePosterHeight:[null,n.INT],filePosterMinHeight:[null,n.INT],filePosterMaxHeight:[null,n.INT],filePosterFilterItem:[()=>!0,n.FUNCTION],filePosterCalculateAverageImageColor:[!1,n.BOOLEAN],filePosterCrossOriginAttributeValue:["Anonymous",n.STRING]}}};"undefined"!=typeof window&&void 0!==window.document&&document.dispatchEvent(new CustomEvent("FilePond:pluginloaded",{detail:Ie}));var ve=Ie;class Te{destroy(){this._pond.destroy()}getElement(){return this._pond.element}getStatus(){return this._pond.status}isReady(){const e=this.getStatus();return 0===e||4===e}updateOptions(e){this.settings=n.extend(this.settings,e);for(let t in e)e.hasOwnProperty(t)&&"[object Object]"===Object.prototype.toString.call(e[t])&&(this.settings[t]=e[t]);const t=this._mapOptions();this._pond.setOptions(t)}upload(e){return this._pond.setOptions({instantUpload:!1}),this._pond.addFile(e).then((e=>this._pond.processFile(e).then((e=>(this.updateOptions({instantUpload:!1}),this.files[e.serverId]))))).catch((e=>{throw s.error("failed to upload file",e),this._pond.setOptions({instantUpload:!0}),e}))}validateFiles(){let e=this._pond.getFiles();for(let t=0;t{this._storeFiles(e),this._addStoreFiles(i)}))}removeFiles(){this._pond.removeFiles({revert:!0})}_init(){let t=n.extend(this.settings.queryParams,{config:this.settings.fileFetchConfig}),i={api:this.settings.api,queryParams:t};if(this.settings.fileFetch&&(i.storage=!0,i.storageKey=a.storageKey+"_"+this.settings.fileFetchConfig),this.settings.queryParams.orderId&&(i.storage=!1,i.serverDelete=!0),this._fileMeta=new a(i),this._provider=Te.providers[this.settings.provider],!this._provider)throw"upload plugin "+this.settings.provider+" not found";p.registerPlugin(e(X),e(Y)),this.settings.imageEditorPintura?this.settings.imageEditor&&p.registerPlugin(H):(p.registerPlugin(e(ie),e(Z)),this.settings.imageResize&&p.registerPlugin(e(te)),(this.settings.imageCrop||this.settings.imageEditor)&&p.registerPlugin(e(ee)),this.settings.imageEditor&&p.registerPlugin(K)),this.settings.imagePreviewAppCloud?p.registerPlugin(ve):this.settings.imagePreview&&(this.settings.imageEditorPintura?p.registerPlugin(e(j)):p.registerPlugin(e(Q))),(this.settings.imageSizeValidate||this.settings.imageEditor)&&p.registerPlugin(ae);const r=this._mapOptions();this._pond=p.create(this.element,r),this._pond?(this._pond.setOptions({server:this._getFilePondServerImpl()}),this._pond.on("addfilestart",(e=>{e.file&&this._triggerEvent("upload:select",this._fileMeta.fromNative(e.file))})),this._pond.on("addfile",((e,t)=>{null==e&&t.file&&this._triggerEvent("upload:add",this._fileMeta.fromNative(t.file))})),this._pond.on("error",((e,t)=>{if(t.file){let i=this._fileMeta.fromNative(t.file);e.main?(i.meta.error=e.main,i.meta.msg=e.sub,this._triggerEvent("upload:invalid",i)):this._triggerEvent("upload:error",i)}})),this._pond.on("warning",((e,t)=>{e.body&&"Max files"===e.body&&(this._triggerEvent("upload:select",{}),this._triggerEvent("upload:errors",[d.get(this.settings.translatePrefix+"error.fileCountMax",{max:this.settings.fileCountMax})]))})),this._pond.on("reorderfiles",((e,t,i)=>{let n=e.map((e=>e.serverId));this._triggerEvent("upload:sort",{fileIds:n,origin:t,target:i})})),this.settings.fileMimeTypesValidate&&this._pond.on("init",(()=>{let e=this._pond.element.querySelector('input[type="file"]');if(e){let t=[];(this.settings.fileMimeTypes.includes("image/heic")||this.settings.convert&&this.settings.fileMimeTypes.includes("image/*"))&&t.push(".heic"),this.settings.fileMimeTypes.includes("image/vnd.adobe.photoshop")&&t.push(".psd"),this.settings.fileMimeTypes.includes("application/postscript")&&(t.push(".ai"),t.push(".eps")),t.length&&e.setAttribute("accept",e.getAttribute("accept")+","+t.join(","))}})),this.settings.fileFetch&&(this._fileMeta.settings.queryParams.token||this._fileMeta.settings.queryParams.orderId)&&this._fileMeta.fetchFiles().then((e=>{this._storeFiles(e),this._addStoreFiles()}))):(s.error('Upload-Lift not supported - condition:\n\n !("[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'),alert("Upload-Lift not supported"))}_mapOptions(){const e=this.settings.translatePrefix;return this._mapEditorOptions(),{checkValidity:!1,instantUpload:!0,credits:!1,name:this.settings.field,required:this.settings.required,allowFileTypeValidation:this.settings.fileMimeTypesValidate,acceptedFileTypes:this.settings.fileMimeTypesValidate?this.settings.fileMimeTypes:[],fileValidateTypeDetectType:(e,t)=>new Promise(((i,n)=>{""===t&&(t=this._fileType(e)),i(t)})),allowFileSizeValidation:this.settings.fileSizeValidate,maxFileSize:this.settings.fileSizeMax,allowMultiple:this.settings.fileMultiple,allowBrowse:!0,allowDrop:!0,allowReorder:!0===window.clUploadReorder,allowPaste:!1,maxFiles:this.settings.fileCountMax,maxParallelUploads:1,allowFileGrid:this.settings.imagePreviewAppCloud,allowFileGridPreview:this.settings.imagePreview,fileGridFileVariant:(e,t)=>{if(this.files.hasOwnProperty(e)){let i=this.files[e];if(i.meta&&i.meta.variant===t)return i;if(i.childs)for(const e in i.childs){let n=i.childs[e];if(n.meta&&n.meta.variant===t)return n}}return null},allowFilePoster:!this.settings.imagePreviewAppCloud&&this.settings.imageEditor&&this.settings.imageEditorPintura,filePosterMaxHeight:!this.settings.imagePreviewAppCloud&&this.settings.imageEditor&&this.settings.imageEditorPintura?256:null,filePosterHeight:this.settings.imagePreviewAppCloud?this.settings.imagePreview?this.settings.imagePreviewHeight+42:85:null,allowImageValidateSize:this.settings.imageSizeValidate,allowImageValidateImage:this.settings.imageEditor,allowImageValidateImageFail:this.settings.convert&&this.settings.convertResize,imageValidateSupportImage:e=>this._fileEditable(e),imageValidateCompleteResult:(e,t)=>{if(this.files.hasOwnProperty(e)){let i=this.files[e];t?i.error&&(delete i.error,this._storeFile(i)):(i.error=!0,this._removeFile(i),this.files[e]=i)}},imageValidateCropRatios:this.settings.imageEditorCropRatios,imageValidateSizeMinWidth:this.settings.imageWidthMin,imageValidateSizeMaxWidth:this.settings.imageWidthMax,imageValidateSizeMinHeight:this.settings.imageHeightMin,imageValidateSizeMaxHeight:this.settings.imageHeightMax,imageValidateSizeMinResolution:this.settings.imageResolutionMin?this.settings.imageResolutionMin:null,imageValidateSizeMaxResolution:this.settings.imageResolutionMax?this.settings.imageResolutionMax:null,allowImageExifOrientation:!0,allowImagePreview:!this.settings.imageEditorPintura&&(this.settings.imagePreview||this.settings.imageEditor&&this.settings.imagePreviewAppCloud),allowImageResize:this.settings.imageResize,allowImageTransform:!this.settings.imageEditorPintura,allowImageEdit:this.settings.imageEditor&&!this.settings.imageEditorPintura,imageEditIconEdit:'',allowImageCrop:this.settings.imageCrop,imageTransformBeforeCreateBlob:this.settings.imageProcessCanvas,imageTransformAfterCreateBlob:this.settings.imageProcessBlob,imageResizeMode:"cover",imagePreviewMaxHeight:window.clUploadImagePreviewMax||265,imagePreviewMaxFileSize:"20MB",imageCropAspectRatio:this.settings.imageEditorCropRatio,imageTransformVariantsIncludeOriginal:this.settings.imageOriginal,imageTransformVariantsOriginalName:this.settings.imageEditor&&this.settings.imageOriginal||this.settings.imageTransformOriginal?"_original":"original",imageTransformVariantsIncludeDefault:this.settings.imageTransformOriginal||!1,imageTransformVariantsDefaultName:"original",imageTransformOutputMimeType:null==this.settings.imageTransformFormat?null:"png"===this.settings.imageTransformFormat?"image/png":"image/jpeg",imageTransformOutputStripImageHead:this.settings.imageTransformStrip||!1,imageTransformOutputQuality:window.clUploadOutputQuality||90,imageTransformVariants:this.settings.imageTransforms,imageEditInstantEdit:this.settings.imageEditorOpen,imageEditAllowEdit:!this.settings.imageEditorOpen,imageEditSupportImage:e=>this._fileEditable(e),imageEditEditor:this._doka,allowImageEditor:this.settings.imageEditor&&this.settings.imageEditorPintura,imageEditorSupportImage:e=>this._fileEditable(e),imageEditorDimensionMax:this.settings.convert&&this.settings.convertResize?225e6:void 0,imageEditor:this._pintura,imageEditorInstantEdit:this.settings.imageEditorOpen,imageEditorAllowEdit:!this.settings.imageEditorOpen,imageEditorAfterWriteImage:this._pintura?this._pintura.afterWriteImage:void 0,imageEditorIconEdit:'',labelIdle:this.settings.text?this.settings.text:d.get(e+"dragdrop"),labelFileWaitingForSize:d.get(e+"file.size.waiting"),labelFileSizeNotAvailable:d.get(e+"file.size.notavailable"),labelFileLoading:d.get(e+"file.loading"),labelFileLoadError:d.get(e+"file.load.error"),labelFileProcessing:d.get(e+"file.uploading"),labelFileProcessingComplete:d.get(e+"file.upload.complete"),labelFileProcessingAborted:d.get(e+"file.upload.canceled"),labelFileProcessingError:d.get(e+"file.upload.error"),labelFileProcessingRevertError:d.get(e+"file.upload.error.revert"),labelFileRemoveError:d.get(e+"file.upload.error.remove"),labelTapToCancel:d.get(e+"file.upload.cancel"),labelTapToRetry:d.get(e+"file.upload.retry"),labelTapToUndo:d.get(e+"file.upload.undo"),labelButtonRemoveItem:d.get(e+"file.button.remove"),labelButtonAbortItemLoad:d.get(e+"file.button.remove"),labelButtonRetryItemLoad:d.get(e+"file.button.retry"),labelButtonAbortItemProcessing:d.get(e+"file.button.cancel"),labelButtonUndoItemProcessing:d.get(e+"file.button.undo"),labelButtonRetryItemProcessing:d.get(e+"file.button.retry"),labelButtonProcessItem:d.get(e+"file.button.upload"),labelMaxFileSizeExceeded:d.get(e+"file.size.tobig"),labelMaxFileSize:d.get(e+"file.size.max"),labelFileTypeNotAllowed:d.get(e+"file.type.notallowed"),fileValidateTypeLabelExpectedTypes:d.get(e+"file.type.expected"),imageValidateSizeLabelFormatError:d.get(e+"image.type.notsupported"),imageValidateSizeLabelImageSizeTooSmall:d.get(e+"image.size.tosmall"),imageValidateSizeLabelExpectedMinSize:d.get(e+"image.size.expected.min"),imageValidateSizeLabelExpectedMaxSize:d.get(e+"image.size.expected.max"),imageValidateSizeLabelImageResolutionTooLow:d.get(e+"image.resolution.min"),imageValidateSizeLabelImageResolutionTooHigh:d.get(e+"image.resolution.max"),imageValidateSizeLabelExpectedMinResolution:d.get(e+"image.resolution.expected.min"),imageValidateSizeLabelExpectedMaxResolution:d.get(e+"image.resolution.expected.max"),imageValidateSizeLabelImageRatioInvalid:d.get(e+"image.ratio.invalid"),imageValidateSizeLabelImageRatioExpected:d.get(e+"image.ratio.expected")}}_mapEditorOptions(){const e=this.settings.translatePrefix;if(this.settings.imageEditorCropRatios&&this.settings.imageEditorCropRatios.length>0)for(let e=0;e{let t=[];for(let i=0;i1&&(r=Math.round(parseFloat(e[0])/parseFloat(e[1])*1e3)/1e3)}else r=n.value;t.push([r,n.label])}return t};let i={utils:this.settings.imageEditorPinturaConfig.utils};if(this._pinturaEditorImageWriterOptions=this._pinturaEditorImageWriterOptions||{},window.clUploadOutputQuality&&(this._pinturaEditorImageWriterOptions.quality=window.clUploadOutputQuality/100),this.settings.imageTransformFormat&&(this._pinturaEditorImageWriterOptions.mimeType="png"===this.settings.imageTransformFormat?"image/png":"image/jpeg"),this.settings.imageTransformStrip&&(this._pinturaEditorImageWriterOptions.copyImageHead=!1),void 0!==this.settings.imageEditorPinturaConfig.cropNoLimit&&(i.imageCropLimitToImage=!this.settings.imageEditorPinturaConfig.cropNoLimit),this.settings.imageEditorPinturaConfig.cropBgColor&&(i.imageBackgroundColor=pintura.colorStringToColorArray(this.settings.imageEditorPinturaConfig.cropBgColor)),-1!==this.settings.imageEditorPinturaConfig.utils.indexOf("crop")&&(i.imageCropMinSize=this.settings.imageSizeValidate?{width:this.settings.imageWidthMin?this.settings.imageWidthMin:1,height:this.settings.imageHeightMin?this.settings.imageHeightMin:1}:{width:1,height:1},i.cropSelectPresetOptions=t(this.settings.imageEditorCropRatios),i.imageCropAspectRatio=i.cropSelectPresetOptions.length?i.cropSelectPresetOptions[0][0]:void 0,i.cropEnableRotationInput=this.settings.imageEditorPinturaConfig.cropRotate,i.cropEnableButtonRotateLeft=this.settings.imageEditorPinturaConfig.cropRotate,i.cropEnableButtonRotateRight=!1,i.cropEnableZoomInput=this.settings.imageEditorPinturaConfig.cropZoom,i.cropEnableZoom=this.settings.imageEditorPinturaConfig.cropZoom,i.cropEnableCenterImageSelection=!this.settings.imageEditorPinturaConfig.cropZoom,i.cropEnableButtonFlipHorizontal=this.settings.imageEditorPinturaConfig.cropFlip,i.cropEnableButtonFlipVertical=this.settings.imageEditorPinturaConfig.cropFlip,this.settings.imageEditorPinturaConfig.cropShape&&this.settings.imageEditorPinturaConfig.cropShapes&&this.settings.imageEditorPinturaConfig.cropShapes.length?this._editorCropShapes(i):this._pintura&&this._pintura.editorOptions.cropWillRenderTools&&this._editorCropShapesReset(i)),-1!==this.settings.imageEditorPinturaConfig.utils.indexOf("annotate")){let e=[];this.settings.imageEditorPinturaConfig.annotateText&&e.push("text"),this.settings.imageEditorPinturaConfig.annotateDraw&&e.push("sharpie"),this.settings.imageEditorPinturaConfig.annotateShapes&&e.push("line","arrow","rectangle","ellipse"),i.markupEditorToolbar=pintura.createMarkupEditorToolbar(e),i.annotateActiveTool=e.length?e[0]:void 0,i.markupEditorToolStyles=pintura.createMarkupEditorToolStyles({text:pintura.createMarkupEditorToolStyle("text",{fontSize:"10%"})}),i.markupEditorShapeStyleControls=pintura.createMarkupEditorShapeStyleControls({lineHeightOptions:!1})}window.pinturaLocale||(window.pinturaLocale={...pintura.locale_en_gb,...pintura.markup_editor_locale_en_gb,...pintura.plugin_crop_locale_en_gb,...pintura.plugin_filter_locale_en_gb,...pintura.plugin_finetune_locale_en_gb,...pintura.plugin_annotate_locale_en_gb}),i.locale={...window.pinturaLocale,labelReset:d.get(e+"image.editor.button.reset"),labelClose:d.get(e+"image.editor.button.cancel"),labelButtonCancel:d.get(e+"image.editor.button.cancel"),labelButtonExport:d.get(e+"image.editor.button.confirm"),statusLabelLoadImage:t=>t&&t.task?t.error?"IMAGE_TOO_SMALL"===t.error.code?d.get(e+"image.size.expected.min"):d.get(e+"image.editor.status.error"):(t.task,d.get(e+"image.editor.status.loading")):d.get(e+"image.editor.status.waiting"),statusLabelProcessImage:t=>{if(t&&t.task)return"store"===t.task?t.error?d.get(e+"image.editor.status.error"):"Uploading image…":t.error?"Error processing image":d.get(e+"image.editor.status.processing")},cropLabel:d.get(e+"image.editor.util.crop"),cropLabelTabZoom:d.get(e+"image.editor.crop.zoom"),cropLabelButtonRotateLeft:d.get(e+"image.editor.crop.rotate.left"),cropLabelButtonRotateRight:d.get(e+"image.editor.crop.rotate.right"),cropLabelButtonFlipHorizontal:d.get(e+"image.editor.crop.flip.horizontal"),cropLabelButtonFlipVertical:d.get(e+"image.editor.crop.flip.vertical"),cropLabelSelectPreset:d.get(e+"image.editor.crop.aspect.ratio"),filterLabel:d.get(e+"image.editor.util.filter")},i.locale.cropLabelTabRotation=d.translations[e+"image.editor.crop.rotation"]?d.translations[e+"image.editor.crop.rotation"]:i.locale.cropLabelTabRotation,i.locale.filterLabel=d.translations[e+"image.editor.util.finetune"]?d.translations[e+"image.editor.util.finetune"]:i.locale.filterLabel,i.locale.annotateLabel=d.translations[e+"image.editor.util.annotate"]?d.translations[e+"image.editor.util.annotate"]:i.locale.annotateLabel,i.locale.labelButtonCancel=d.translations[e+"image.editor.cancel"]?d.translations[e+"image.editor.cancel"]:i.locale.labelButtonCancel,i.locale.labelButtonRevert=d.translations[e+"image.editor.revert"]?d.translations[e+"image.editor.revert"]:i.locale.labelButtonRevert,i.locale.labelButtonUndo=d.translations[e+"image.editor.undo"]?d.translations[e+"image.editor.undo"]:i.locale.labelButtonUndo,i.locale.labelButtonRedo=d.translations[e+"image.editor.redo"]?d.translations[e+"image.editor.redo"]:i.locale.labelButtonRedo;const n=e+"image.editor.pintura.";Object.keys(d.translations).forEach((e=>{0===e.indexOf(n)&&(i.locale[e.replace(n,"")]=d.translations[e])})),this.settings.imageEditorPinturaConfig.options&&Object.assign(i,this.settings.imageEditorPinturaConfig.options),this._pintura?Object.assign(this._pintura.editorOptions,i):this._pintura={createEditor:(e,t)=>(this._pintura.editor=pintura.openEditor(e,t),this._pintura.editor.on("load",(e=>{if(s.debug("pintura image loaded:",e),this._pintura.editor.cropSelectPresetOptions&&this._pintura.editor.cropSelectPresetOptions.length>0&&e.size.width&&e.size.height){let t=e.size.width/e.size.height,i=null,n=-1,r=this._pintura.editor.cropSelectPresetOptions;1!==t&&(r=r.filter((e=>void 0===e[0]||(t>1?e[0]>1:e[0]<1))));for(let e=0;e{this._triggerEvent("upload:editor:cancel")})),this._pintura.editor.on("process",(()=>{this._triggerEvent("upload:editor:confirm")})),this._pintura.editor.on("processerror",(e=>{s.error("pintura processerror",e)})),this._pintura.editor.on("loaderror",(e=>{s.error("pintura loaderror",e)})),this._pintura.editor),afterWriteImage:({src:e,dest:t,imageState:i})=>new Promise(((n,r)=>{let o=[];for(const n in this.settings.imageTransforms)if(this.settings.imageTransforms.hasOwnProperty(n)){let r=this.settings.imageTransforms[n]({}),a=null;if(r.resize&&(a={...this._pinturaEditorImageWriterOptions},a.targetSize={width:r.resize.size.width,height:r.resize.size.height,fit:window.clUploadThumbFit||"contain"}),"image/webp"===t.type&&(a=a||{...this._pinturaEditorImageWriterOptions},a.mimeType="image/png"),null!=a)o.push(pintura.processImage(e,{imageReader:pintura.createDefaultImageReader(),imageWriter:pintura.createDefaultImageWriter(a),imageState:i}).then((e=>({name:n,file:e.dest}))));else{const e={name:n,file:t};this.settings.imageEditorPinturaConfig.cropSave&&(e.meta={crop:JSON.stringify({...i.crop,rotation:0!==i.rotation?i.rotation:void 0,flipX:i.flipX?i.flipX:void 0,flipY:i.flipY?i.flipY:void 0})}),o.push(Promise.resolve(e))}}this.settings.imageEditorPinturaConfig.annotateTextSave&&((i.annotation||[]).length>0||(i.decoration||[]).length>0)&&o.push(new Promise((t=>{const n=new Image;n.onload=()=>{const e=window.clUploadTextScale||1,r=document.createElement("canvas");r.width=n.naturalWidth,r.height=n.naturalHeight,r.toBlob((r=>{const o={...i,backgroundColor:void 0},a={mimeType:"image/png"};if(1!==e){const t=window.clUploadTextScaleMaxPx||0;let i=Math.round(n.naturalWidth*e),r=Math.round(n.naturalHeight*e);if(t&&(i>t||r>t)){const e=t/Math.max(i,r);i=Math.round(i*e),r=Math.round(r*e)}a.targetSize={width:i,height:r,fit:"contain",upscale:!0}}pintura.processImage(r,{imageReader:pintura.createDefaultImageReader(),imageWriter:pintura.createDefaultImageWriter(a),imageState:o}).then((e=>{t({name:"_text",file:e.dest})}))}),"image/png")},n.src=URL.createObjectURL(e)}))),Promise.all(o).then((t=>{this.settings.imageOriginal&&t.push({name:"_original",file:e}),n(t)})).catch(r)})),imageReader:[pintura.createDefaultImageReader],imageWriter:[pintura.createDefaultImageWriter,this._pinturaEditorImageWriterOptions],imageProcessor:pintura.processImage,editorOptions:{...pintura.getEditorDefaults(),...i}}}else{let t={utils:["crop"],cropMinImageWidth:this.settings.imageSizeValidate&&this.settings.imageWidthMin?this.settings.imageWidthMin:1,cropMinImageHeight:this.settings.imageSizeValidate&&this.settings.imageHeightMin?this.settings.imageHeightMin:1,cropShowSize:!1,cropAllowInstructionZoom:!1,cropAllowResizeRect:!0,cropAspectRatio:null,cropAspectRatioOptions:this.settings.imageEditorCropRatios,outputCorrectImageExifOrientation:!0,onload:e=>{if(s.debug("doka image loaded:",e),this.settings.imageEditorCropRatios&&this.settings.imageEditorCropRatios.length>0&&e.width&&e.height){let t=e.height/e.width,i=null,n=-1;for(let e=0;e1){let o=parseFloat(e[1])/parseFloat(e[0]),a=Math.abs(o-t);s.debug("aspect ratio check : "+r.value+" diff: "+a),(-1===n||a{this.settings.imageSizeValidate&&this.settings.imageResolutionMin&&this._doka.setOptions({cropMinImageWidth:this.settings.imageSizeValidate&&this.settings.imageWidthMin?this.settings.imageWidthMin:1,cropMinImageHeight:this.settings.imageSizeValidate&&this.settings.imageHeightMin?this.settings.imageHeightMin:1}),this._triggerEvent("upload:editor:cancel")},onconfirm:()=>{this._doka.setOptions({cropMinImageWidth:this.settings.imageSizeValidate&&this.settings.imageWidthMin?this.settings.imageWidthMin:1,cropMinImageHeight:this.settings.imageSizeValidate&&this.settings.imageHeightMin?this.settings.imageHeightMin:1}),this._triggerEvent("upload:editor:confirm")},onloaderror:e=>{s.error("doka load error",e)},labelButtonReset:d.get(e+"image.editor.button.reset"),labelButtonCancel:d.get(e+"image.editor.button.cancel"),labelButtonConfirm:d.get(e+"image.editor.button.confirm"),labelStatusAwaitingImage:d.get(e+"image.editor.status.waiting"),labelStatusLoadingImage:d.get(e+"image.editor.status.loading"),labelStatusLoadImageError:d.get(e+"image.editor.status.error"),labelStatusProcessingImage:d.get(e+"image.editor.status.processing"),labelColorBrightness:d.get(e+"image.editor.color.brightness"),labelColorContrast:d.get(e+"image.editor.color.contrast"),labelColorExposure:d.get(e+"image.editor.color.exposure"),labelColorSaturation:d.get(e+"image.editor.color.saturation"),labelResizeWidth:d.get(e+"image.editor.resize.width"),labelResizeHeight:d.get(e+"image.editor.resize.height"),labelResizeApplyChanges:d.get(e+"image.editor.resize.apply"),labelButtonCropZoom:d.get(e+"image.editor.crop.zoom"),labelButtonCropRotateLeft:d.get(e+"image.editor.crop.rotate.left"),labelButtonCropRotateRight:d.get(e+"image.editor.crop.rotate.right"),labelButtonCropFlipHorizontal:d.get(e+"image.editor.crop.flip.horizontal"),labelButtonCropFlipVertical:d.get(e+"image.editor.crop.flip.vertical"),labelButtonCropAspectRatio:d.get(e+"image.editor.crop.aspect.ratio"),labelButtonUtilCrop:d.get(e+"image.editor.util.crop"),labelButtonUtilFilter:d.get(e+"image.editor.util.filter"),labelButtonUtilColor:d.get(e+"image.editor.util.color"),labelButtonUtilResize:d.get(e+"image.editor.util.resize"),labelButtonUtilMarkup:d.get(e+"image.editor.util.markup"),labelMarkupTypeEllipse:d.get(e+"image.editor.util.markup.circle"),labelMarkupTypeText:d.get(e+"image.editor.util.markup.text"),labelMarkupTypeLine:d.get(e+"image.editor.util.markup.arrow"),labelMarkupRemoveShape:d.get(e+"image.editor.util.markup.remove"),labelMarkupToolSelect:d.get(e+"image.editor.util.markup.select"),labelMarkupToolDraw:d.get(e+"image.editor.util.markup.draw"),labelMarkupToolLine:d.get(e+"image.editor.util.markup.arrow"),labelMarkupToolRect:d.get(e+"image.editor.util.markup.square"),labelMarkupToolEllipse:d.get(e+"image.editor.util.markup.circle"),labelMarkupSelectFontSize:d.get(e+"image.editor.util.markup.size")};this._doka?this._doka.setOptions(t):this._doka=Doka.create(t)}else this._doka?(this._doka.destroy(),delete this._doka):this._pintura&&(this._pintura.instance&&this._pintura.instance.destroy(),delete this._pintura)}_editorCropShapes(e){e.imageCropShape=this.settings.imageEditorPinturaConfig.cropShapes[0].label,this._cropShapeImg=this._cropShapeImg||{},this._cropShapeCanvas=this._cropShapeCanvas||{};let t=[],i={};const n=(e,t,i)=>{if(e)try{let n=document.createElement("div");const r=document.createRange().createContextualFragment(e);let o=r.firstElementChild;return o.getAttribute("viewbox")||o.setAttribute("viewbox","0 0 "+o.getAttribute("width")+" "+o.getAttribute("height")),o.setAttribute("width",t),o.setAttribute("height",i),o.firstElementChild&&o.firstElementChild.setAttribute("fill","currentColor"),n.appendChild(r),n.innerHTML}catch(t){s.error("failed to parse svg crop shape",e,t)}return``};for(let e=0;ethis._cropShapeImg[r.label]=e;try{e.src=URL.createObjectURL(new Blob([r.value],{type:"image/svg+xml"}))}catch(e){s.error("failed to parse svg crop shape",r,e)}}}const r=(e,t)=>{if(this._cropShapeCanvas.hasOwnProperty(e)&&this._cropShapeBgRatio===t){let t=this._cropShapeCanvas[e];if(t.width>1&&t.height>1)return t}let i=this._cropShapeImg[e];if(i){const n=document.createElement("canvas");n.width=1e3,n.height=n.width/t;const r=n.getContext("2d");let o,a,s,l;r.fillStyle="#505050",r.globalAlpha=window.clUploadShapeAlpha||.75,r.fillRect(0,0,n.width,n.height),r.globalAlpha=1;const u=i.naturalWidth/i.naturalHeight;return[o,a]=t<=u?[n.width,n.width/u]:[n.height*u,n.height],[s,l]=[(n.height-a)/2,(n.width-o)/2],r.globalCompositeOperation="destination-out",r.drawImage(i,l,s,o,a),this._cropShapeCanvas[e]=n,this._cropShapeBgRatio=t,n}return""};if(t.length>1){const n=this.settings.translatePrefix+"image.editor.crop.shapes",r={icon:this.settings.imageEditorPinturaConfig.cropShapes[0].value?i[t[0][0]]:i[t[1][0]],label:d.translations[n]?d.get(n):"Shapes",labelClass:"PinturaToolbarContentWide",options:t,selectedIndex:0,onchange:e=>{r.selectedIndex=e.index,r.icon=i[e.label],this._pintura.editor.imageCropShape=e.value,this._pinturaRedraw&&this._pinturaRedraw()},optionMapper:e=>(e.icon=i[e.label],{...e,disabled:!1})},o=["Dropdown","select-shape",r];e.cropWillRenderTools=(e,i,n)=>(this._pintura.editor.imageCropShape&&r.selectedIndex>0&&(r.selectedIndexe;e.willRenderCanvas=(e,t)=>{const{utilVisibility:i,selectionRect:n,lineColor:o,backgroundColor:a}=t;if(i.crop<=0)return e;if(!this._pintura.editor.imageCropShape||!this._cropShapeImg[this._pintura.editor.imageCropShape])return e;void 0===this._pintura.editor.imageCropAspectRatio&&(this._pintura.editor.imageCropAspectRatio=1);const{x:s,y:l,width:u,height:c}=n;return{...e,interfaceShapes:[{x:s,y:l,width:u,height:c,opacity:i.crop,backgroundImage:r(this._pintura.editor.imageCropShape,this._pintura.editor.imageCropAspectRatio),backgroundSize:"contain"},...e.interfaceShapes]}},this.settings.imageEditorPinturaConfig.cropShapeOverlay?this._pinturaEditorImageWriterOptions.postprocessImageData&&(delete this._pinturaEditorImageWriterOptions.mimeType,delete this._pinturaEditorImageWriterOptions.postprocessImageData):(this._pinturaEditorImageWriterOptions.mimeType="image/png",this._pinturaEditorImageWriterOptions.postprocessImageData=e=>new Promise((t=>{if(this._pintura.editor.imageCropShape){const i=this._cropShapeImg[this._pintura.editor.imageCropShape];if(i){const n=document.createElement("canvas");n.width=e.width,n.height=e.height;const r=n.getContext("2d"),o=i.naturalWidth/i.naturalHeight,a=n.width/n.height;let s,l,u,c;r.putImageData(e,0,0),r.globalCompositeOperation="destination-in",[s,l]=a<=o?[n.width,n.width/o]:[n.height*o,n.height],[u,c]=[(n.height-l)/2,(n.width-s)/2],r.drawImage(i,c,u,s,l),t(r.getImageData(0,0,n.width,n.height))}else t(e)}else t(e)})))}_editorCropShapesReset(e){e.imageCropShape="",e.cropWillRenderTools=e=>e,e.willRenderCanvas=e=>e,delete this._pinturaEditorImageWriterOptions.mimeType,delete this._pinturaEditorImageWriterOptions.postprocessImageData}_triggerEvent(e,t){const i=new CustomEvent(e,{detail:t,cancelable:!0,bubbles:!0});this._pond.element.dispatchEvent(i)}_storeFile(e){this.files[e.uuid]=e,e.parent&&this.files.hasOwnProperty(e.parent)&&(this.files[e.parent].childs||(this.files[e.parent].childs={}),this.files[e.parent].childs[e.uuid]=e),this._triggerEvent("upload:added",e),e.childs&&this._storeFiles(e.childs)}_storeFiles(e){for(const t in e)if(e.hasOwnProperty(t)){const i=e[t];this._storeFile(i)}}_removeFile(e){if(delete this.files[e.uuid],this._triggerEvent("upload:removed",e),e.childs)for(const t in e.childs){let e=this.files[t];delete this.files[t],this._triggerEvent("upload:removed",e)}}_addStoreFiles(e=!1){for(const t in this.files)if(this.files.hasOwnProperty(t)){const i=this.files[t];if(!i.parent){const n={type:"local",file:e?void 0:{serverId:t,name:i.name,size:i.size,type:i.mimeType},metadata:{imageSize:i.meta.width?{height:i.meta.height,width:i.meta.width}:void 0,imageValidate:this.settings.imageSizeValidate}};this._pond.addFile(t,n)}}}_corsUrl(e){return e=(e=e.replace("https://upload.dev.cloudlift.app/s/dev","https://storage.googleapis.com/cloudlift-app-cloud-dev-upload")).replace("https://upload.cloudlift.app/s","https://storage.googleapis.com/cloudlift-app-cloud-prod-upload")}_download(e,t,i="upload.jpg"){return new r(e,{method:"GET",responseType:"blob",onProgress:t}).then((e=>{if(200===e.xhr.status){return new File([e.data],i,{type:e.data.type})}return null}))}_upload(e,t){try{let i=this._provider.upload(e,t);const n=new Promise(((e,t)=>{i.then((i=>{for(let e=0;e{this._fileMeta.saveFile(n).then((t=>{const n=[];let r=this._editAsync(t);if(r)n.push(r);else{this._storeFile(t),this._storeAsyncFile(t);for(let e=1;e(this._storeFile(e),e))))}}Promise.all(n).then((i=>{i.unshift(t),e(i)}))})).catch((e=>{t(e)}))})).catch((t=>{e([])}))})),i.catch((e=>{t(e)}))}));return n.cancel=()=>{i.cancel()},n}catch(e){return Promise.reject(e)}}_remove(e){return this._fileMeta.removeFile(e).then((()=>{this._removeFile(e)})).catch((e=>{throw e}))}_fileEditable(e){let t=this._fileType(e);return(!this.settings.convert||!this.settings.convertMimeTypes.includes(t))&&this.settings.imageEditable(t)}_fileType(e){if(e?.type)return e.type;if(e?.mimeType)return e.mimeType;if(e?.name){const t=e.name.split(".").pop();if("aml"===t)return"application/aml";if("ampkg"===t)return"application/ampkg";if("cdr"===t)return"application/x-cdr";if("stl"===t)return"application/sla";if("heic"===t)return"image/heic"}return""}_editAsync(e){if(this.settings.convert&&(this.settings.convertMimeTypes.includes(this._fileType(e))||e.meta.imageError&&this.settings.convertResize)&&!e.meta.convert){e.meta.variant="convert",this.settings.apiConvert=this.settings.apiConvert||this.settings.api.replace("api","convert").replace("local","dev")+"/convert/";let t=this.settings.apiConvert+e.path,i=[];"application/pdf"===e.mimeType?(this.settings.pdfDpi&&i.push("dpi="+this.settings.pdfDpi),this.settings.pdfImageWidth&&i.push("width="+this.settings.pdfImageWidth),this.settings.pdfImageHeight&&i.push("height="+this.settings.pdfImageHeight),this.settings.pdfMultiPage||i.push("page=0"),this.settings.pdfTransparent&&i.push("output=png")):"image/svg+xml"===e.mimeType||"application/postscript"===e.mimeType?(i.push("output=png"),i.push("width="+(this.settings.convertResizeTo||2e3))):this.settings.convertResize&&("image/png"===e.mimeType&&i.push("output=png"),i.push("width="+(this.settings.convertResizeTo||5e3))),i.length&&(t+="?"+i.join("&"));let n=e.name,r=!1;this.settings.fileMimeTypesValidate&&!this.settings.fileMimeTypes.includes("image/*")&&(r=!0);let o="",a=this._pond.element.querySelectorAll(".filepond--list .filepond--item");for(let e=0;e';let n=t.querySelector(".filepond--file-info .filepond--file-info-sub"),r=t.querySelector(".filepond--file-status");n&&(o=n.innerText),r&&(r.querySelector(".filepond--file-status-main").innerText=d.get(this.settings.translatePrefix+"image.editor.status.processing"));break}return this._download(t,null,n).then((t=>{if(!t)return e.meta.variant="original",this._storeFile(e),{};let i,a=this._pond.getFiles();for(let e=0;e{if(this._asyncOriginal=e,o){const e=setInterval((()=>{let t=this._pond.element.querySelector('[data-filepond-item-state*="processing"]');if(t){let i=t.querySelector(".filepond--file-info .filepond--file-info-sub");i&&(i.innerText=o,clearInterval(e))}}),50)}return t.setMetadata("convert",!0,!1),{}}))})).catch((t=>(s.error("file conversion error",t),this._pond.removeFile(),this._remove(e).then((()=>{this._triggerEvent("upload:errors",[d.get(this.settings.translatePrefix+"error.fileConvert")])})),{}))).finally((()=>{r&&this._pond.setOptions({allowFileTypeValidation:!0})}))}return!1}_infoAsync(e){let t=this.settings.api.replace("api","convert").replace("local","dev")+"/info/"+e.path;return new r(t,{method:"GET",responseType:"json",queryParams:this.settings.queryParams}).then((t=>{let i=t.data;e.meta=n.extend(e.meta,i);let r=[];if(i.hasOwnProperty("pages")&&(this.settings.convertInfoPagesMin&&i.pagesthis.settings.convertInfoPagesMax&&r.push(d.get(this.settings.translatePrefix+"error.filePagesMax",{max:this.settings.convertInfoPagesMax}))),r.length){let e=new Error("info validate error");throw e.errors=r,e}return e})).catch((e=>{throw s.warn("file info error",e),this._pond.removeFile(),e.errors&&this._triggerEvent("upload:errors",e.errors),e}))}_storeAsyncFile(e){this._asyncOriginal&&(delete this._asyncOriginal.childs,this._asyncOriginal.parent=e.uuid,this._storeFile(this._asyncOriginal),delete this._asyncOriginal)}_getFilePondServerImpl(){return{process:(e,t,i,r,o,a,s)=>{Array.isArray(t)||(t=[{file:t}]);let l=[];for(let e=0;e{a(e.lengthComputable,e.loaded,e.total)}));return u.then((e=>{e&&e.length&&r(e[0].uuid)})),u.catch((e=>{o(e)})),{abort:()=>{u.cancel(),s()}}},revert:(e,t,i)=>{let n=this.files[e];n?this._remove(n).then((()=>t())).catch((e=>i(e))):(s.warn("no file found for: "+e),t())},remove:(e,t,i)=>{let n=this.files[e];n?this._remove(n).then((()=>t())).catch((e=>i(e))):(s.warn("no file found for source: "+e),t())},restore:(e,t,i,n,r,o)=>{let a=this.files[e];if(a){const e=a.url;let o=this._download(e,(e=>{n(e.lengthComputable,e.loaded,e.total)}));return o.then((e=>{t(e)})).catch((e=>{i(e)})),{abort:()=>{o.cancel(),r()}}}i("no file found for source: "+e)},load:(e,t,i,n,r,o)=>{let a=this.files[e];if(a){let e=a.url;if(a.childs)for(const t in a.childs){const i=a.childs[t];if("_original"===i.meta?.variant){e=i.url;break}}e=this._corsUrl(e);let o=this._download(e,(e=>{n(e.lengthComputable,e.loaded,e.total)}),a.name);return o.then((e=>{t(e)})).catch((e=>{i(e)})),{abort:()=>{o.cancel(),r()}}}i("no file found for source: "+e)},fetch:(e,t,i,n,r,o)=>{let a=e.substring(e.lastIndexOf("/")+1),s=this._download(e,(e=>{n(e.lengthComputable,e.loaded,e.total)}),a);return s.then((e=>{t(e)})).catch((e=>{i(e)})),{abort:()=>{s.cancel(),r()}}}}}constructor(e){let t={api:"http://api.cloudlift.local:8080",queryParams:{},selector:".cl-upload--files",provider:"google",field:"upload",text:void 0,required:!1,metaData:{},fileMimeTypes:[],fileMimeTypesValidate:!0,fileSizeValidate:!0,fileSizeMax:null,fileMultiple:!0,fileCountMin:null,fileCountMax:null,fileFetch:!0,fileFetchConfig:void 0,imagePreview:!1,imagePreviewAppCloud:!1,imagePreviewHeight:100,imageOriginal:!0,imageTransforms:{},imageTransformFormat:window.clUploadOutputType||null,imageResize:!1,imageSizeValidate:!0,imageWidthMin:1,imageWidthMax:65535,imageHeightMin:1,imageHeightMax:65535,imageResolutionMin:null,imageResolutionMax:null,convert:!1,convertMimeTypes:[],convertInfo:!1,convertInfoMimeTypes:["application/pdf","audio/mpeg","audio/wav","audio/x-wav","application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation"],convertInfoPagesQuantity:!1,convertInfoLengthQuantity:!1,convertInfoPagesMin:null,convertInfoPagesMax:null,convertResize:!1,convertResizeTo:null,imageCrop:!1,imageEditor:!1,imageEditorOpen:!0,imageEditorUtils:["crop"],imageEditorCropRatio:null,imageEditorCropRatios:[{label:"Free",value:null},{label:"Portrait",value:1.25},{label:"Square",value:1},{label:"Landscape",value:.75}],imageEditorPintura:!1,imageEditorPinturaConfig:{utils:["annotate","crop","filter","finetune"],cropRotate:!0,cropZoom:!0,cropFlip:!0,cropShape:!1,cropShapeOverlay:!1,cropShapes:[],cropSave:!1,cropNoLimit:window.clUploadCropNoLimit||!1,cropBgColor:window.clUploadCropBgColor,annotateText:!0,annotateDraw:!0,annotateShapes:!0,annotateTextSave:!1,options:{}},imageProcessUpload:!1,imageTransformOriginal:window.clUploadTransformOriginal||!1,imageTransformStrip:window.clStripImageHead||!1,imageProcessCanvas:null,imageProcessBlob:null,imageEditable:"function"==typeof window.clUploadEditable?window.clUploadEditable:e=>/^image/.test(e),translatePrefix:"upload."};this.files={},this.settings=n.extend(t,e||{}),n.isElement(this.settings.selector)?this.element=this.settings.selector:this.element=document.querySelector(this.settings.selector),null!=this.element?this._init():s.warn("no elements with selector found: ",this.settings.selector)}}Te.providers=[];var ye=Te,we={};!function(e,t){"function"==typeof define&&define.amd?define([],t):we=t()}(0,(function(){var e=function(){},t={},i={},n={};function r(e,t){if(e){var r=n[e];if(i[e]=t,r)for(;r.length;)r[0](e,t),r.splice(0,1)}}function o(t,i){t.call&&(t={success:t}),i.length?(t.error||e)(i):(t.success||e)(t)}function a(t,i,n,r){var o,s,l=document,u=n.async,c=(n.numRetries||0)+1,d=n.before||e,p=t.replace(/[\?|#].*$/,""),f=t.replace(/^(css|img)!/,"");r=r||0,/(^css!|\.css$)/.test(p)?((s=l.createElement("link")).rel="stylesheet",s.href=f,(o="hideFocus"in s)&&s.relList&&(o=0,s.rel="preload",s.as="style")):/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(p)?(s=l.createElement("img")).src=f:((s=l.createElement("script")).src=t,s.async=void 0===u||u),s.onload=s.onerror=s.onbeforeload=function(e){var l=e.type[0];if(o)try{s.sheet.cssText.length||(l="e")}catch(e){18!=e.code&&(l="e")}if("e"==l){if((r+=1){e(we).ready(t,(()=>{i(t)}))}))}static isDefined(t){return e(we).isDefined(t)}};class Ae{static getInstance(e){return Ae._instance||(Ae._instance=new Ae(e)),Ae._instance}fakeProduct(e){this.isProduct=()=>!0,this.getHandleFromUrl=()=>e}isAdmin(){return null!=document.getElementById("admin_bar_iframe")}isProduct(){return-1!==window.location.pathname.indexOf("/products/")||this.isProductPreview()}isProductPreview(){return-1!==window.location.pathname.indexOf("/products_preview")}getHandleFromUrl(e=location.pathname){window.Shopify&&window.Shopify.routes&&window.Shopify.routes.root&&"/"!==window.Shopify.routes.root&&(e=e.replace(window.Shopify.routes.root,"/"));let t=e.replace(/\/$/,"").split("/"),i=("products"==t[t.length-2]||"products_preview"===t.pop())&&t[t.length-1].replace(/(.*)?\?.*$/,"$1");return decodeURIComponent(i).toLowerCase()}tryGetProduct(){return this.isProduct()?this.getProduct():new Promise(((e,t)=>{e(null)}))}async tryGetProductMap(){return(this.isTheme("Dawn")||this.isTheme("Horizon"))&&await this.parseOfferJsonElements(),this.isProduct()&&await this.getProduct(),Ae.products}parseOfferJsonElements(){document.querySelectorAll('.featured-product form[id^="product_form_"]').forEach((e=>{e.setAttribute("id",e.getAttribute("id").replace("product_form_","product-form-installment-featured--")),s.debug("updated featured product form id: ",e,e.id)}));let e=document.querySelectorAll('script[type="application/ld+json"]'),t=[];if(e.length>0)for(let i=0;inew r(e.url+".js",{method:"GET",responseType:"json"}).then((e=>{let n=e.data;Ae.products[i]=n,t(n)})).catch((i=>{s.error("failed to fetch product: ",e.url,i),t(null)})))))}}catch(e){s.debug("error parsing ProductOffer: ",n,e)}}return Promise.all(t)}parseProductJsonElements(){let e=document.querySelectorAll('[id^="ProductJson-"]');if(0===e.length&&(e=document.querySelectorAll('[data-product-json], [data-section-type="dynamic-featured-product"]')),e.length>0)for(let t=0;t{t(Ae.products[e])}));let i,n=e+"."+t;return Ae.products[n]?new Promise(((e,t)=>{e(Ae.products[n])})):(e?i=this.settings.api+this.settings.path.products.replace("{handle}",e).replace("{view}",t):this.isProductPreview()&&(i=window.location.href.replace("products_preview","products_preview."+t)),new r(i,{method:"GET",responseType:"json"}).then((e=>{let i=e.data;return"json"===t&&(i=e.data.product),Ae.products[n]=i,i})).catch((e=>{throw e})))}isTheme(e){if(window.Shopify&&window.Shopify.theme){const t=window.Shopify.theme.theme_store_id;if("Dawn"===e&&(887===t||1368===t||1363===t||1356===t||1431===t||1434===t||1499===t||1500===t||1567===t||1864===t||1841===t||1891===t||2699===t))return!0;if("Horizon"===e&&customElements.get("fly-to-cart")&&customElements.get("dialog-component"))return!0;if(window.Shopify.theme.name&&-1!==window.Shopify.theme.name.toLowerCase().indexOf(e.toLowerCase()))return!0}return!1}isThemeEditor(){return window.Shopify&&window.Shopify.designMode}onThemeSectionEvent(e,t){return document.addEventListener("shopify:section:"+e,t)}findProductForms(e=document){return e.querySelectorAll('form[action*="/cart/add"]')}findProductFormBestMatch(e,t){let i="#product_form_"+e,n=document.querySelector(i);if(n&&null!=n.querySelector("shopify-payment-terms")&&(n=null),n&&document.querySelector(`[data-product-form="${e}"]`)&&(n=null),n&&this.isProductFormInstallment(n)&&(n=null),n&&this.isTheme("Dawn")){let t=document.querySelector('[data-type="add-to-cart-form"]');t&&(t.dataset.productForm=e.toString(),n=null)}if(n&&t.srcEl&&t.srcEl.closest(".shopify-app-block")&&(n=null),!n){let i=null;if(t&&t.srcEl){let e=t.srcEl.parentNode;for(;e;){if(i=this.findProductForms(e),i.length){t.parentEl=e;break}e=e.parentNode}}if(null!=i&&0!==i.length||(i=this.findProductForms()),1===i.length)return i[0];if(i.length>1)for(let t=0;t1){let e=i.closest("form");if(e&&this.isProductFormInstallment(e))continue;if(i.disabled)continue}return i}}if(e.elements instanceof HTMLFormControlsCollection){let t=e.id;if(t instanceof HTMLInputElement)return t}}return null}findProductFormVariantId(e){let t=this.findProductFormVariantIdEl(e);return t?t.value:null}onVariantIdChange(e,t){let i=this.findProductFormVariantIdEl(e);if(i)if(n.isNodeList(i))for(let e=0;et(e,n.value)))}else i.addEventListener("change",(e=>t(e,i.value))),this.isTheme("Horizon")&&e.addEventListener("variant:update",(e=>setTimeout((()=>t(e,i.value)))))}findProductFormQuantity(e,t){if(null!=e){let i=e.querySelector("[name=quantity]")||(t?t.querySelector("[name=quantity]"):null);if(null!=i)return parseInt(i.value)}return 1}getFormProperties(e){const t=new FormData(e);return Array.from(t.keys()).reduce(((e,i)=>{if(-1!==i.indexOf("properties")){let n=i.indexOf("["),r=i.indexOf("]");if(-1!==n&&-1!==r){let o=i.substring(n+1,r);if(e.hasOwnProperty(o)){let n=t.getAll(i);e[o]=n[n.length-1]}else e[o]=t.get(i)}}return e}),{})}findExpressPaymentButtons(e=document){return e.querySelectorAll('.shopify-payment-button, [data-shopify="payment-button"]')}findExpressDynamicCheckoutCart(e=document){return e.querySelectorAll('#dynamic-checkout-cart, [data-shopify="dynamic-checkout-cart"]')}isExpressPaymentButton(e){const t='.shopify-payment-button, [data-shopify="payment-button"]';return!!(e&&n.matches(e,t)||null!=n.findParent(e,t))}patchHistory(e,t){if("function"==typeof window.history[e]){const i=window.history[e];window.history[e]=function(e){return setTimeout((function(){t()}),300),i.apply(window.history,arguments)}}}constructor(e){this.settings=n.extend({api:"",path:{products:"/products/{handle}.{view}"}},e||{})}}Ae.products={},Ae.collections={};var Re=Ae;var Se=class{uploadFile(e){return this._upload?this._upload.upload(e):Promise.reject("upload not ready")}fileCount(){return this._upload.countFiles()}editFile(e){if(this._upload){let t;return"object"==typeof e&&(e.parent?t=e.parent:e.uuid&&(t=e.uuid)),this._upload.editFile(t)}}updateConfig(e){s.debug("uploadField.updateConfig: ",e);let t=this.config.fileMultiple,i=this.config.hidden,r=this.config.imageSizeValidate;this.config=n.extend(this.config,e);const o=this._mapOptions();this._upload.updateOptions(o),this._displayUpload(),this._displayCounter(),this._syncQuantity(),this._removeErrors(),t===this.config.fileMultiple&&i==this.config.hidden||this._rebuildInputs(),(r||e.imageSizeValidate)&&this._upload.validateFiles()}updateText(e){this._upload&&(e=d.translate(e),this.updateConfig({text:e}))}updateLabel(e){e=d.translate(e),this._label?e?this._label.innerHTML=e:(this._label.parentNode.removeChild(this._label),delete this._label):e&&(this._label=document.createElement("label"),this._label.className=this.settings.classNamePrefix+"--label",this._label.innerHTML=e,this._wrapper.insertBefore(this._label,this._uploadDiv))}updateCss(e){this.removeCss(),this._style=n.addStyleElement(e,this.settings.styleSelector)}updateInputFields(e){if(!this._inputFields||e&&0!==e.length||(this._inputFields.parentNode.removeChild(this._inputFields),delete this._inputFields),e&&e.length>0){if(this._inputFields)for(;this._inputFields.firstChild;)this._inputFields.removeChild(this._inputFields.lastChild);else this._inputFields=document.createElement("div"),this._inputFields.className=this.settings.classNamePrefix+"--input-fields",this._wrapper.insertBefore(this._inputFields,this._wrapper.firstChild);for(let t=0;t{let e=document.createElement("input");return e.type=i.type,e.required=!0===i.required,i.className?e.className=i.className:e.className=this.settings.classNamePrefix+"--input",i.min&&(e.minLength=i.min),i.max&&(e.maxLength=i.max),this.config.fieldProperty?e.name=this.config.fieldProperty+"["+i.field+"]":e.name=i.field,e.setAttribute("id",r),this._linkProductForm(e),e};if("select"===i.type){let e=document.createElement("select");if(e.required=!0===i.required,i.className?e.className=i.className:e.className=this.settings.classNamePrefix+"--input",this.config.fieldProperty?e.name=this.config.fieldProperty+"["+i.field+"]":e.name=i.field,e.setAttribute("id",r),this._linkProductForm(e),i.value){let t=i.value.split(",");for(let i=0;i1){e=!0,i.type="radio";for(let e=0;e';let a=o();a.value=i,a.style.display="none",0===e&&(a.checked=!0),r.insertBefore(a,r.firstChild),n.appendChild(r)}i.type="color"}}if(!e){let e=null;try{e=o(),e.value="!","color"===e.type&&"!"!==e.value?i.value&&(e.value=i.value):e=null}catch(t){e=null}null==e&&(i.type="text",e=o(),e.pattern="#[0-9A-Fa-f]{6}",e.placeholder="#000000",i.value&&(e.value=i.value)),n.appendChild(e)}}else{let e=o();"checkbox"===i.type&&(e.value="✔",n.style.display="flex",n.style.flexDirection="row-reverse",n.style.justifyContent="flex-end",e.style.marginRight="10px"),i.value&&"text"===i.type&&(e.placeholder=i.value),n.appendChild(e)}this._inputFields.appendChild(n)}}}removeCss(){this._style&&this._style.parentNode.removeChild(this._style)}validate(){let e=[];const t="upload.config.error.";let i=this._upload.countFiles();if(this.config.required&&i<=0&&e.push(d.get(t+"required")),0===e.length&&(ithis.config.fileCountMax&&e.push(d.get(t+"fileCountMax",{max:this.config.fileCountMax}))),this._upload.isReady()||e.push(d.get(t+"ready")),this._syncQuantity(),this._inputFields){let i=!0,n=this._inputFields.querySelectorAll("[required]");for(let e=0;e{this._removeErrors(),this._inputFields.removeEventListener("change",i)};this._inputFields.addEventListener("change",i)}}return s.debug("validated upload-config: ",this.config,e),!1===this.config.validate||(this._displayErrors(e),0===e.length)}clearValidations(){this._removeErrors()}clearFiles(){this._upload.removeFiles()}restore(e,t=!1,i=!1){this._upload.restoreFiles(e,t,i)}send(e,t){return this._upload._fileMeta.sendTemplate(e,t)}tag(e,t){return this._upload._fileMeta.tagOrder(e,t)}onSubmit(){this.config.fileSubmitRemove&&n.removeCookie("token"),this.config.fileSubmitClear&&setTimeout((()=>{this.clearFiles()}),1e3)}destroy(){try{this._upload&&this._upload.destroy(),this.removeCss(),this.element.removeChild(this._wrapper),this._styleGrid&&this._styleGrid.parentNode.removeChild(this._styleGrid)}catch(e){s.warn("[upload] destroy failed",e)}}_init(){this.config.css&&this.updateCss(this.config.css),this._wrapper=document.createElement("div"),this._wrapper.className=this.settings.classNamePrefix+"--wrapper "+this.config.className,this._wrapper.setAttribute("id",this.config.uuid),this._uploadDiv=document.createElement("div"),this._uploadDiv.className=this.settings.classNamePrefix+"--area",this._wrapper.appendChild(this._uploadDiv),this.element.appendChild(this._wrapper),this._findProductForm(),this.config.text&&(this.config.text=d.translate(this.config.text)),this.config.label&&this.updateLabel(this.config.label),this.config.inputFields&&this.updateInputFields(this.config.inputFields),this._loadResources().then((()=>{this._checkImageValidateVariants();let e=this._mapOptions();this._upload=new ye(e),this._uploadDiv=this._upload.getElement(),this._displayFileGrid(),this._displayImageEditor(),this._displayUpload(),this._subscribeEvents(),this._upload._triggerEvent("upload:ready",this),this._hasVariantConfigs()&&(this.settings.product&&this.settings.product.id?this._watchVariantChanges():s.warn("variantConfigs not supported - no product is set for config: "+this.config.uuid));let t=this._getAgent();!1!==window.clInApp&&this._isInApp(t)&&this._checkInAppFilePicker(t)}))}_mapOptions(){let e=this.config.fieldId;e+="[]";let t={};if(this.settings.product&&this.settings.product.id&&(t.productId=this.settings.product.id,t.productHandle=this.settings.product.handle,t.productTitle=this.settings.product.title),this.config.metaData&&(t=n.extend(t,this.config.metaData)),this.element.dataset)for(const e in this.element.dataset)if(this.element.dataset.hasOwnProperty(e)){let i=this.element.dataset[e];if("config"===e){try{let e=JSON.parse(i);this.config=n.extend(this.config,e)}catch(e){s.warn("failed to parse data-config: "+i,e)}continue}t[e]=isNaN(Number(i))?i:Number(i),"orderId"!==e&&"itemId"!==e||(this.settings.queryParams[e]=i)}this.settings.flow&&(this.settings.queryParams.flow="1");let i={};return this.config.imageThumbnail&&!this.config.serverTransform&&(i.thumbnail=e=>(e.resize={size:{width:this.config.imageThumbnailWidth,height:this.config.imageThumbnailHeight}},e)),this.config.imageEditor&&(i.original=e=>e),this.config.imageTransforms&&(i=this.config.imageTransforms),this.config.fileMultiple||(this.config.fileCountMin=0,this.config.fileCountMax=1),{selector:this._uploadDiv,provider:this.settings.provider,api:this.settings.api,queryParams:this.settings.queryParams,field:e,text:this.config.text,required:!1,metaData:t,fileMimeTypesValidate:this.config.fileMimeTypesValidate,fileMimeTypes:this.config.fileMimeTypes,fileSizeMax:(this.config.fileSizeMax&&this.config.fileSizeMax0?this.config.imageEditorCropRatios[0].value:null,imageEditorCropRatios:this.config.imageEditorCropRestrict?this.config.imageEditorCropRatios:[],imagePreview:this.config.imagePreview,imagePreviewAppCloud:this.config.fileGrid,imageSizeValidate:this.config.imageSizeValidate,imageWidthMin:this.config.imageWidthMin,imageWidthMax:this.config.imageWidthMax,imageHeightMin:this.config.imageHeightMin,imageHeightMax:this.config.imageHeightMax,imageResolutionMin:this.config.imageResolutionMin,imageResolutionMax:this.config.imageResolutionMax,imageTransformOriginal:this.config.imageTransformOriginal,imageTransformStrip:this.config.imageTransformStrip,imageEditorPintura:this.config.imageEditorPintura,imageEditorPinturaConfig:this.config.imageEditorPinturaConfig,imageProcessCanvas:this.config.imageProcessCanvas,imageProcessBlob:this.config.imageProcessBlob,translatePrefix:"upload.config."}}_loadResources(){let e="upload-lib";const t=[];return this.config.imageEditor&&("fetch"in window||t.push(this.settings.assets+"/static/lib/fetch/fetch.min.js"),"log10"in Math&&"sign"in Math&&"assign"in Object&&"from"in Array&&["find","findIndex","includes"].reduce((function(e,t){return t in Array.prototype&&e}),!0)||t.push(this.settings.assets+"/static/lib/doka/doka.polyfill.min.js"),this.config.imageEditorPintura?(e+="-pintura",t.push(this.settings.assets+"/static/lib/pintura/pintura-iife.js"),t.push(this.settings.assets+"/static/lib/pintura/pintura.css"),"en"!==d.locale&&-1!==["de","es","fr","ru","it"].indexOf(d.locale)&&t.push(this.settings.assets+"/static/lib/pintura/locale/"+d.locale+".js")):(t.push(this.settings.assets+"/static/lib/doka/doka.min.js"),t.push(this.settings.assets+"/static/lib/doka/doka.min.css"))),t.length>0?Oe.isDefined(e)?Oe.isReady(e).then((function(){s.info("upload resources ready")})):Oe.load(t,e,{async:!1}).then((function(){s.info("upload resources loaded")})).catch((function(e){s.error("failed to load resources: ",e)})):Promise.resolve()}_subscribeEvents(){this._inputs={},this.fileCounter=0,this._displayCounter(),this._syncQuantity(),this._uploadDiv.addEventListener("upload:added",(e=>{let t=e.detail,i=document.createElement("input");i.type="hidden",this._buildInputElement(i,t),this._inputs[t.uuid]=i,this._wrapper.appendChild(i),this._removeErrors(),this._displayCounter(),this._syncQuantity()})),this._uploadDiv.addEventListener("upload:removed",(e=>{let t=e.detail;if(t&&this._inputs[t.uuid]){if(this._wrapper.removeChild(this._inputs[t.uuid]),delete this._inputs[t.uuid],this._inputsX&&this._inputsX[t.uuid]){for(var i in this._inputsX[t.uuid])this._inputsX[t.uuid].hasOwnProperty(i)&&(this._wrapper.removeChild(this._inputsX[t.uuid][i]),delete this._inputsX[t.uuid][i]);delete this._inputsX[t.uuid]}this.config.fileMultiple&&null==t.parent&&this._rebuildInputs()}this._removeErrors(),this._displayCounter(),this._syncQuantity()})),this._uploadDiv.addEventListener("upload:errors",(e=>{let t=e.detail;this._displayErrors(t)})),this._uploadDiv.addEventListener("upload:sort",(e=>{this._fileSort=e.detail.fileIds.reverse(),this._rebuildInputs()}))}_linkProductForm(e){this._productFormLink&&e.setAttribute("form",this._productFormLink)}_buildInputElement(e,t){let i;if(i="thumbnail"===t.meta.variant?this.config.fieldThumbnail?this.config.fieldThumbnail:"_thumbnail":"_text"===t.meta.variant?"_"+(this.config.field?this.config.field:"upload")+"_text":"_original"===t.meta.variant?this.config.fieldOriginal?this.config.fieldOriginal:"original":"convert"===t.meta.variant?this.config.fieldConvert?this.config.fieldConvert:"source":this.config.field?this.config.field:"upload",this.config.fileMultiple){let e;if(null==t.parent){if(this.fileCounter++,e=this.fileCounter,this._fileSort){let i=this._fileSort.indexOf(t.uuid);s.trace("=> index of "+t.uuid+":",i),-1!==i&&(e=i+1)}s.debug("=> count: of "+t.uuid+":",e),t.meta.count=e}else t.parent&&this._upload.files[t.parent]&&(e=this._upload.files[t.parent].meta.count);e&&(i+="_"+e)}this.config.fieldProperty?e.name=this.config.fieldProperty+"["+i+"]":e.name=i,this.config.hidden&&(e.name=""),e.value=t.url,this._linkProductForm(e),this.config.fileName&&"original"===t.meta.variant&&this._buildInputElementExtend("name",t,this.config.fieldProperty+"["+i+"_name]",t.name),t.meta.crop&&this._buildInputElementExtend("crop",t,this.config.fieldProperty+"[_"+i+"_crop]",t.meta.crop)}_buildInputElementExtend(e,t,i,n){let r;this._inputsX=this._inputsX||{},this._inputsX[t.uuid]=this._inputsX[t.uuid]||{},this._inputsX[t.uuid][e]?r=this._inputsX[t.uuid][e]:(r=document.createElement("input"),r.type="hidden",this._inputsX[t.uuid][e]=r,this._wrapper.appendChild(r),this._linkProductForm(r)),r.name=i,r.value=n}_rebuildInputs(){this.fileCounter=0;for(const e in this._inputs)if(this._inputs.hasOwnProperty(e)){const t=this._upload.files[e],i=this._inputs[e];this._buildInputElement(i,t)}}_removeErrors(){if(this._errors&&(this._wrapper.removeChild(this._errors),delete this._errors,this._inputFields)){let e=this._inputFields.querySelectorAll("."+this.settings.classNamePrefix+"--invalid");for(let t=0;t{n.className+=" dismissed",setTimeout((()=>{this._errors.removeChild(n),this.element.querySelector('input[type="file"]').focus()}),500)};n.addEventListener("click",(e=>{a()})),n.addEventListener("keydown",(function(e){"Escape"===e.key&&a()})),this._errors.appendChild(n)}e.length&&setTimeout((()=>{this._errors.className+=" open",this._errors.firstElementChild.focus()}),100)}_displayUpload(){!0===this.config.hidden?(this._uploadDiv.classList.add("cl-hide"),this._label&&this._label.classList.add("cl-hide")):(this._uploadDiv.classList.remove("cl-hide"),this._label&&this._label.classList.remove("cl-hide"))}_displayCounter(){this.config.fileCounter&&(this.config.fileMultiple||this._counter)?(this._counter||(this._counter=document.createElement("div"),this._counter.className=this.settings.classNamePrefix+"--counter",this._wrapper.querySelector(".filepond--root").appendChild(this._counter)),this._counter.innerHTML=this._upload.countFiles()+"/"+this.config.fileCountMax):this._counter&&(this._counter.parentElement.removeChild(this._counter),delete this._counter)}_syncQuantity(){if(this.config.fileQuantity&&this.config.fileMultiple||(this.config.convertInfoPagesQuantity||this.config.convertInfoLengthQuantity)&&this.config.convertInfo&&this.config.convert){if(this.config.hidden)return;const e=()=>{let e=this._upload.countFiles();return Math.max("number"==typeof window.clQuantityMin?window.clQuantityMin:1,e)};if((!this._quantityEl||!n.isInPage(this._quantityEl))&&(this._quantityEl=document.querySelector("input[name=quantity]"),this._quantityEl)){if(("boolean"!=typeof window.clQuantityReadonly||window.clQuantityReadonly)&&this._quantityEl.addEventListener("change",(()=>{let t=e();t>1?(this._quantityEl.value==t||this.config.hidden||(this._quantityEl.value=t),this._quantityEl.readOnly=!0,this._quantityEl.style.background="#eeeeee"):(this._quantityEl.readOnly=!1,this._quantityEl.style.background="")})),this.shopifyStore.isTheme("Dawn")){let e=this._quantityEl.closest("product-info");null!=e&&(e.setQuantityBoundries=function(){})}}if(this._quantityEl){let t=e();(t>1||this._quantityEl.readOnly)&&this._quantityEl.value!=t&&(this._quantityEl.value=t,this._quantityEl.dispatchEvent(new Event("change")))}else s.warn("fileQuantity sync - no quantity el found")}}_displayFileGrid(){if(this.config.fileGrid){this._uploadDiv.classList.add(this.settings.classNamePrefix+"--grid");let e=-1;this._styleGrid=null;let t=()=>{let t=Math.min(this._uploadDiv.offsetWidth,window.screen.width);if(t!==e&&0!==t){e=t,null!=this._styleGrid&&this._styleGrid.parentNode.removeChild(this._styleGrid);let i=t/120;i=i>=2?2*Math.floor(i/2):1,s.debug("calculated fileGrid grid columns:",i);let r=100/i;this._styleGrid=n.addStyleElement("#"+this.config.uuid+" .filepond--item {\n width: calc("+r+"% - .5em);\n}")}};t(),window.addEventListener("resize",n.debounced(300,(()=>{t()}))),window.addEventListener("orientationchange",(e=>window.dispatchEvent(new Event("resize"))))}}_displayImageEditor(){if(this.config.imageEditorPintura){let e=this.config.styles;this.config.imageEditorPinturaConfig&&(this.config.imageEditorPinturaConfig.bgColor&&(e["background-color"]=this.config.imageEditorPinturaConfig.bgColor.replace("rgb(","").replace(")","")),this.config.imageEditorPinturaConfig.fgColor&&(e["foreground-color"]=this.config.imageEditorPinturaConfig.fgColor.replace("rgb(","").replace(")","")),this.config.imageEditorPinturaConfig.btnColor&&(e["area-background-color"]=this.config.imageEditorPinturaConfig.btnColor));let t=`\n .pintura-editor {\n --color-background: ${e["background-color"]||"255, 255, 255"};\n --color-foreground: ${e["foreground-color"]||"0, 0, 0"};\n --color-primary: ${e["area-background-color"]};\n --color-primary-dark: ${e["area-background-color"]};\n --color-primary-text: ${e["label-color-drop"]};\n --border-radius: ${"0.0px"===e["area-border-radius"]?"0.1px":e["area-border-radius"]};\n --border-radius-round: ${"0.0px"===e["area-border-radius"]?"0.1px":e["area-border-radius"]};\n }\n .PinturaButtonExport {\n min-width: 100px;\n }\n @media only screen and (max-width: 425px) {\n .PinturaNavTools > .PinturaNavGroup.PinturaNavGroupFloat {\n display:none;\n }\n }\n `;n.addStyleElement(t)}}_hasVariantConfigs(){return this.config.variantConfig&&this.config.variantConfigs&&this.config.variantConfigs.length>0}_findProductForm(){if(this.settings.product&&"properties"===this.config.fieldProperty){if(this._productForm=n.findParent(this.element,this.settings.selectorForm),!this._productForm){let e={srcEl:this.element};this._productForm=this.shopifyStore.findProductFormBestMatch(this.settings.product.id,e),e.parentEl&&(this._productFormParentEl=e.parentEl)}if(this._productForm){if(this._productFormParent=this._productForm.contains(this._wrapper),!this._productFormParent){let e=this._productForm.getAttribute("id");e&&(this._productFormLink=e)}if(this.config.required){let e=document.querySelector("shopify-paypal-button");e&&!0!==window.clBuyNow&&(e.style.display="none",s.warn("[upload-lift] hiding paypal buy now"))}}}else if("attributes"===this.config.fieldProperty){let e=document.querySelectorAll('button[name="checkout"][form], input[name="checkout"][form]');if(e.length){let t=e[0];this._productFormLink=t.getAttribute("form")}if(this.shopifyStore.isTheme("Dawn")){this.element.addEventListener("change",(e=>{s.debug("Dawn theme - preventing cart updates on changes",e),e.stopPropagation()}));let e=this.element.closest("form");e&&e.setAttribute("novalidate","")}}else"order"===this.config.fieldProperty&&(this._productForm=this.element.closest("form"));return null!==this._productForm}_watchVariantChanges(){if(this._productForm=this._productForm||this.shopifyStore.findProductFormBestMatch(this.settings.product.id),this._productForm){this._variantConfig={required:this.config.required,fileMultiple:this.config.fileMultiple,fileCountMin:this.config.fileCountMin,fileCountMax:this.config.fileCountMax,hidden:void 0!==this.config.hidden&&this.config.hidden,imageSizeValidate:this.config.imageSizeValidate,imageWidthMin:void 0!==this.config.imageWidthMin?this.config.imageWidthMin:null,imageHeightMin:void 0!==this.config.imageHeightMin?this.config.imageHeightMin:null,imageResolutionMin:void 0!==this.config.imageResolutionMin?this.config.imageResolutionMin:null,imageEditorCropRestrict:this.config.imageEditorCropRestrict,imageEditorCropRatios:this.config.imageEditorCropRatios};for(let e=0;ethis._onVariantChange(e))),this._productFormParent||this.shopifyStore.onVariantIdChange(this._productFormParentEl||this._productForm,((e,t)=>this._onVariantChange(e)))}else s.warn("variantConfig no productForm found for config: "+this.config.uuid)}_checkImageValidateVariants(){if(!this.config.imageSizeValidate&&this._hasVariantConfigs())for(let e=0;e-1||e.indexOf("FBAV")>-1}_isInstagram(e){return e.indexOf("Instagram")>-1}_isTiktok(e){return e.indexOf("Bytedance")>-1||e.indexOf("ByteLocale")>-1}_isSnapchat(e){return e.indexOf("Snapchat")>-1}_isIOS(e){return(e=e.toLowerCase()).indexOf("iphone")>-1||e.indexOf("ipad")>-1}_isAndroid(e){return(e=e.toLowerCase()).indexOf("android")>-1}_checkInAppFilePicker(e){let t="inapp",i=-1;const n=(t,i)=>{let n=document.createElement("div");n.className="cl-inapp--fail";const o="upload.config.error.";let a=this._isInstagram(e)?"instagram":this._isTiktok(e)?"tiktok":"facebook",s=this._isAndroid(e)?"android":"ios";n.innerHTML=((e,t)=>`\n \n \n

${d.get(o+"inapp."+e)}

\n \n `)(a,s),null==this.element.querySelector(".cl-inapp--fail")&&this.element.insertBefore(n,this._wrapper),this._upload._fileMeta.inAppFailed(t,i),this._uploadDiv.removeEventListener("click",r,{capture:!0})},r=e=>{if("INPUT"===e.target.nodeName){let e=null;const i=()=>{e&&(clearTimeout(e),e=null),this._uploadDiv.removeEventListener("upload:select",i)};this._uploadDiv.addEventListener("upload:select",i);let r=!1;const o=()=>{document.hidden?(r=!0,window.localStorage&&window.localStorage.setItem(t,(new Date).getTime().toString())):r&&(document.removeEventListener("visibilitychange",o),e=setTimeout((()=>{n(!1,!1)}),4e3))};document.addEventListener("visibilitychange",o)}};if(window.localStorage){let e=window.localStorage.getItem(t);e&&(i=(new Date).getTime()-parseInt(e)),window.localStorage.removeItem(t)}this._isTiktok(e)||this._isSnapchat(e)||(-1!==i&&i<1e4?n(!0,!1):this._uploadDiv.addEventListener("click",r,{capture:!0})),this._uploadDiv.addEventListener("upload:added",(e=>{const t=e.detail;t&&void 0!==t.meta.contentLength&&(t.size===t.meta.contentLength&&0!==t.meta.contentLength||(n(!1,!0),setTimeout((()=>this._upload._pond.removeFiles({revert:!0})),1e3)))}))}constructor(e,t){this.config=e,this.settings=n.extend({api:"https://api.cloudlift.app",assets:"https://assets.cloudlift.app",queryParams:{},provider:"google",selector:".upload-container",selectorForm:'form[action*="/cart/add"]',classNamePrefix:"cl-upload",product:{},flow:!1},t||{}),this.shopifyStore=Re.getInstance(),n.isElement(this.settings.selector)?this.element=this.settings.selector:this.element=document.querySelector(this.settings.selector),s.info("--\x3e new upload-field: ",this.element),null!=this.element?this._init():s.warn("no elements with selector found: ",this.settings.selector)}};class be{static getInstance(e){return be._instance||(be._instance=new be(e)),be._instance}addItem(e){return this._cartAdd(e)}_cartAdd(e){return this._cartRequest("/cart/add.js",{method:"POST",data:e})}_cartRequest(e,t){let i=n.extend(this.settings.requestOptions,t),o=this.settings.api+e;return new r(o,i).then((e=>(s.debug("[shopify-cart] "+o+" response",e.data),e.data))).catch((e=>{throw s.error("[shopify-cart] "+o+" error",e),e.data}))}constructor(e){this.cache=null,this.settings=n.extend({api:"",requestOptions:{responseType:"json",headers:{"Content-type":"application/json"}}},e||{})}}var Me=be;var Ce=class{upload(e,t){const i=[],n=[];for(let o=0;o{this._getSignedUrl(a).then((s=>{const l={method:"PUT",headers:{"Content-type":a.mimeType},data:a._file};0===o&&(l.onProgress=t);const u=new r(s.upload,l);n.push(u),u.then((t=>{a.url=s.download,a.path=s.path;let i=parseInt(t.xhr.getResponseHeader("x-goog-stored-content-length"));isNaN(i)||a.meta&&(a.meta.contentLength=i),e(a)})).catch((e=>{i(e)}))})).catch((e=>{i(e)}))})))}let o=Promise.all(i).then((e=>(s.info(e),e)));return o.cancel=()=>{for(let e=0;ee.data))}constructor(e){this.settings=n.extend({api:"",path:"/api/storage",queryParams:{}},e||{})}};class Pe{static register(e){return this.listeners.push(e),this.patched||this._patch(),()=>{let t=this.listeners.indexOf(e);-1!==t&&this.listeners.splice(t,1),0===this.listeners.length&&this._unpatch()}}static _callListeners(e){for(let t=0;t{"object"==typeof e&&e.pathname&&(e=e.pathname+e.search),Pe._callListeners({method:t,url:e})})),i}),this.patched=!0}static _unpatch(){Pe.originalOpen&&(XMLHttpRequest.prototype.open=Pe.originalOpen),Pe.originalFetch&&(window.fetch=Pe.originalFetch),this.patched=!1}}Pe.patched=!1,Pe.listeners=[];var Le=Pe;class De{async _init(){let e=this.element.dataset.uploadLiftOrder,t=null;if(!e&&!this.editorMode&&(t=n.getQueryParam(window.location.href,"c"),!t))return void this.renderLoggedOut();this.setupStyles();const i={dest:this.settings.shop,sub:"gid://shopify/Customer/"+e};if(this.token=`${btoa('{"alg":"HS256","typ":"JWT"}')}.${btoa(JSON.stringify(i))}.noop`,this.editorMode)return void this.showOrder("editor");let r=window.location.href.split("/"),o=r[r.length-1];if(o=o.split("?")[0],o.match(/^\d+$/)){let e=parseInt(o);isNaN(e)||this.showOrder(e,!1,t)}else this.renderOrderInput()}async showOrder(e,t=!1,i=null){this.showSpinner(),await this.fetchOrder(e,t,i),this.hideSpinner(),this.order?-1!==this.order.tags?.indexOf(this.settings.config.tagComplete)?this.renderOrderComplete():(this.renderOrder(),this.setup()):this.renderOrderInput()}async submitOrder(){const e=this.element.querySelector("[data-order-button]");e&&(e.disabled=!0,e.innerHTML=''),this.order.status.tag=this.settings.config.tagComplete;let t="";this.settings.orderNote&&(t=this.element.querySelector("[data-order-note]")?.value||"");const i="------";if(this.settings.orderNoteLinks&&(t+=`\n${i}\n`,!this.settings.orderItems)){let e=this.element.querySelectorAll('input[name^="order["], textarea[name^="order["], select[name^="order["]');e.length&&e.forEach((e=>{if(("radio"===e.type||"checkbox"===e.type)&&!e.checked)return;let i=e.name.replace("order[","").replace("]",""),n=e.value;t+=`${i}: ${n}\n`}))}if(this.order.items.forEach((e=>{if(this.settings.orderItemsQty&&e.quantity>1)for(let i=1;i<=e.quantity;i++){const n=this._generateItemId(e,i);t+=this._processOrderItemStatus(e,n,i)}else{const i=this._generateItemId(e);t+=this._processOrderItemStatus(e,i)}})),this.order.note){let e=this.order.note.indexOf(i);-1!==e&&(this.order.note=this.order.note.substring(0,e)),t=this.order.note+"\n\n"+t}this.order.status.note=t;let n=!1;try{n=await this.saveOrderStatus()}finally{e&&(e.disabled=!1,e.innerHTML=this.element.dataset.orderButton)}n&&this.renderOrderComplete()}renderOrder(){let e="";e=this.settings.orderItems?'
'+this.order.items.map((e=>this.settings.orderItemsQty&&e.quantity>1?Array.from({length:e.quantity},((t,i)=>this._renderOrderItemHTML(e,i+1))).join(""):this._renderOrderItemHTML(e))).join("")+"
":`
`,this.element.innerHTML=`
\n ${this.order.name}\n
${e}
\n ${this.settings.orderNote?``:""}\n \n
`,this.element.querySelector("form").onsubmit=e=>{e.preventDefault(),e.stopImmediatePropagation(),this.submitOrder()},this.settings.orderInstructionsEl&&this.settings.orderInstructionsEl.childElementCount&&this.element.insertBefore(this.settings.orderInstructionsEl,this.element.firstChild),this.editorMode&&this.element.appendChild(this.settings.orderCompleteEl),this.element.addEventListener("upload:ready",(e=>{const t=e.detail;let i=t.element.closest("[data-order-item]");if(i.dataset.uploadReady="true",this.settings.orderItemsHide&&i.classList.remove("cl-hide"),this.settings.orderSkip){let e=i.querySelector("[data-order-item-skip]");e&&(e.classList.remove("cl-hide"),e.querySelector("input[name=skip]").addEventListener("change",(function(e){t.config={...t.config,validate:!e.target.checked},t.clearValidations()})),this.order.status[i.dataset.orderItem]?.skip&&(t.config.validate=!1))}if(t.config.fileQuantity&&t.config.fileMultiple){let e=parseInt(this.order.items.find((e=>String(e.id)===i.dataset.orderItem))?.quantity);isNaN(e)||t.updateConfig({fileCountMin:e,fileCountMax:e})}}))}renderOrderComplete(){this.element.innerHTML="",this.element.appendChild(this.settings.orderCompleteEl)}renderOrderInput(){this.element.innerHTML='\n \n ';const e=this.element.querySelector("input"),t=async()=>{e&&e.value&&await this.showOrder(e.value.replace("#",""),!0)};e.addEventListener("keydown",(async t=>{"Enter"===t.key&&e.blur()})),e.addEventListener("blur",(async()=>{await t()}))}renderLoggedOut(){this.element.innerHTML='Login'}async fetchOrder(e,t,i){try{this.order=null;let n,r=[];i&&r.push(`c=${i}`),t&&r.push("name=1"),this.element.hasAttribute("data-admin")&&r.push("admin=1");let o=0;const a=2,l=1e3;for(;o<=a&&(n=await fetch(`${this.settings.api}/api/upload/order/${e}${r.length?"?"+r.join("&"):""}`,{method:"GET",headers:{Authorization:`Bearer ${this.token}`}}),200!==n.status)&&404===n.status&&osetTimeout(e,l*o)));200===n.status&&(this.order=await n.json(),this.order.status||(this.order.status={}),this.editorMode||await Promise.all(this.order.items.map((async e=>{await this.shopifyStore.getProduct(e.handle)}))),s.debug("upload order",this.order))}catch(e){s.error("failed to get order",e)}}async saveOrderStatus(){try{if(200===(await fetch(`${this.settings.api}/api/upload/order/${this.order.id}`,{method:"POST",body:JSON.stringify(this.order.status),headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.token}`}})).status)return!0}catch(e){s.error("failed to save order",e)}return!1}_generateItemId(e,t=null){return`${e.id}${t||""}`}_generateItemName(e,t=null){return`${e.name}${t?`-(${t})`:""}`}_processOrderItemStatus(e,t,i=null){let n=this.element.querySelector(`[data-order-item="${t}"][data-upload-ready]`),r="";if(n){this.order.status[t]=this.order.status[t]||{};const o=this.order.status[t];if(this.settings.orderSkip){let e=n.querySelector("input[name=skip]");e&&e.checked&&(o.skip=!0)}let a=n;if(this.settings.orderNoteLinks||(a=n.querySelector(".cl-upload--input-fields")),a){let t=a.querySelectorAll('input[name^="order["], textarea[name^="order["], select[name^="order["]');if(t.length){const n=this._generateItemName(e,i);r+=`\n${n}\n`,t.forEach((e=>{if(("radio"===e.type||"checkbox"===e.type)&&!e.checked)return;let t=e.name.replace("order[","").replace("]",""),i=e.value;r+=`${t}: ${i}\n`}))}}}return r}_renderOrderItemHTML(e,t=null){const i=this._generateItemId(e,t),r=this._generateItemName(e,t);return`\n
\n
\n
\n ${e.name}\n ${t?"":`${e.quantity}`}\n
\n
\n
\n
${e.name}
\n ${this.settings.orderItemsProperties&&e.properties?`\n
    \n ${Object.entries(e.properties).filter((([e,t])=>e&&!e.startsWith("_")&&""!==t&&null!=t)).map((([e,t])=>`\n
  • \n ${n.escapeHtml(String(e).trim())}\n ${n.escapeHtml(String(t).trim())}\n
  • `)).join("")}\n
\n `:""}\n
\n ${this.settings.orderSkip?``:""}\n
\n
\n `}setupStyles(){const e=document.createElement("style");e.textContent='\n .cl-upload--order-title {\n margin-bottom: 15px;\n display: block;\n font-size: 24px;\n font-weight: 600;\n color: #222;\n }\n .cl-upload--order-list {\n display: flex;\n flex-direction: column;\n gap: 20px;\n margin-bottom: 20px;\n }\n .cl-upload--order-item {\n display: flex;\n align-items: stretch;\n gap: 16px;\n background: #fafbfc;\n border-radius: 12px;\n padding: 12px 16px;\n box-shadow: 0 1px 4px rgba(0,0,0,0.03);\n }\n .cl-upload--order-item-wrap {\n position: relative;\n flex-shrink: 0;\n width: 70px;\n height: 70px;\n }\n .cl-upload--order-item-img {\n width: 100%;\n height: 100%;\n object-fit: cover;\n display: block;\n border-radius: 12px;\n background: #fff;\n border: 2px solid #e0e0e0;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);\n }\n .cl-upload--order-item-qty {\n position: absolute;\n top: -8px;\n right: -8px;\n background: #757575;\n color: #fff;\n border-radius: 50%;\n min-width: 22px;\n height: 22px;\n display: flex;\n align-items: center;\n justify-content: center;\n font-size: 1rem;\n font-weight: 600;\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);\n z-index: 2;\n }\n .cl-upload--order-item-left {\n display:flex;\n align-items: flex-start;\n }\n .cl-upload--order-item-content {\n flex: 1 1 0;\n min-width: 0;\n display: flex;\n flex-direction: column;\n justify-content: center;\n margin-left: 16px;\n }\n .cl-upload--order-item-content [data-upload-lift-order-item] {\n margin-top: 10px;\n }\n .cl-upload--order-item-name {\n font-size: 16px;\n font-weight: 600;\n color: #222;\n line-height: 1.2;\n }\n .cl-upload--order-item-skip {\n font-size: 14px;\n display: flex;\n align-items: center;\n }\n .cl-upload--order-item-properties {\n list-style: none;\n margin: 4px 0 0;\n padding: 0;\n font-size: 13px;\n color: #555;\n line-height: 1.4;\n }\n .cl-upload--order-item-property {\n display: flex;\n gap: 6px;\n }\n .cl-upload--order-item-property-key {\n font-weight: 600;\n color: #333;\n }\n .cl-upload--order-item-property-key::after {\n content: ":";\n }\n .cl-upload--order-input {\n width: 100%;\n box-sizing: border-box;\n padding: 10px 18px;\n margin:0;\n border: 1px solid #eee;\n border-radius: 5px;\n }\n .cl-upload--order-button {\n margin-top:10px;\n padding: 14px;\n font-size: 16px;\n font-weight: 600;\n width: 100%;\n cursor: pointer;\n border-radius: 8px;\n border:0px;\n background-color: var(--upload-button-bg);\n color: var(--upload-button-color);\n }\n .cl-upload--order-note {\n width: 100%;\n padding: 10px 18px;\n margin-top:10px;\n border: 1px solid #eee;\n border-radius: 5px;\n min-height: 80px;\n }\n .cl-spinner {\n margin:auto;\n display:block !important;\n width: 50px;\n height: 50px;\n border: 5px solid #f3f3f3;\n border-top: 5px solid #787878;\n border-radius: 50%;\n animation: cl-spin 1s linear infinite;\n }\n @keyframes cl-spin {\n 0% { transform: rotate(0deg); }\n 100% { transform: rotate(360deg); }\n }\n ',document.head.appendChild(e)}showSpinner(){this.hideSpinner();const e=document.createElement("div");e.className="cl-spinner",this.element.innerHTML="",this.element.appendChild(e),this.spinner=e}hideSpinner(){this.spinner?.remove()}constructor(e,t){let i={selector:De.selector,api:"",shop:"",orderItems:!0,orderItemsHide:!1,orderItemsQty:!1,orderItemsProperties:!1,orderNote:!1,orderSkip:!1,config:{tagComplete:"upload-complete"}};this.settings=n.extend(i,t||{}),n.isElement(this.settings.selector)?this.element=this.settings.selector:this.element=document.querySelector(this.settings.selector),this.settings.orderItems="true"===this.element.dataset.orderItems,this.settings.orderItemsHide="true"===this.element.dataset.orderItemsHide,this.settings.orderItemsQty="true"===this.element.dataset.orderItemsQty,this.settings.orderItemsProperties="true"===this.element.dataset.orderItemsP,this.settings.orderNote="true"===this.element.dataset.orderNote,this.settings.orderNoteLinks="true"===this.element.dataset.orderNoteLinks,this.settings.orderSkip="true"===this.element.dataset.orderSkip,this.settings.orderInstructionsEl=this.element.querySelector("[data-order-instructions]"),this.settings.orderCompleteEl=this.element.querySelector("[data-order-complete]"),this.setup=e,this.shopifyStore=Re.getInstance(),this.editorMode=this.shopifyStore.isThemeEditor()||"editor"===window.location.href.split("/").pop(),this._init()}}De.selector="[data-upload-lift-order]";var xe=De;var Ge=class{setup(e=!1){if(e&&(Re.products={}),this.destroy(),this.shopifyStore.parseProductJsonElements(),this.shopifyStore.tryGetProductMap().then((e=>{if(this.config.setup){for(let t=0;t evaluating upload-field:",i.uuid),0===i.conditionMode){let t=null;this.shopifyStore.isProduct()&&(t=e[this.shopifyStore.getHandleFromUrl()+".js"]);let n=this._createUploadField(i,t);s.debug("--\x3e evaluated upload-config:",i.uuid,t,n)}else if(i.conditions.length>0)for(let t in e)if(e.hasOwnProperty(t)){let n=e[t],r=this._evaluateConditions(i.conditions,i.conditionMode,n);if(r){if("properties"===i.fieldProperty){let e="#product_form_"+n.id;r=this._createUploadField(i,n,e)}else r=!1;r||(r=this._createUploadField(i,n))}s.debug("--\x3e evaluated upload-config:",i.uuid,n,r)}}0===this.fields.length&&this.shopifyStore.isThemeEditor()&&this._evaluateThemeEditor(e),this.fields.length>0&&(this._validateFormSubmit(this.fields),this.config.patchHistory&&this._watchVariantHistory(this.fields))}else s.debug("[setup] skipping upload fields setup=false")})),!1!==window.clProp){let e=this.config.fields.filter((e=>e.propertyTransform));e.length>0&&(this._watch||(this._watchCartProperties(e),this._watch=!0))}}destroy(){for(;this.fields.length;){this.fields.pop().destroy()}}async restoreUploads(e){let t=[];if(e.items.forEach((e=>{if(e.properties)for(let i in e.properties)if(e.properties.hasOwnProperty(i)){let n=e.properties[i];"string"==typeof n&&n.includes("cloudlift.app")&&n.startsWith("http")&&t.push(n)}})),t.length){const e=new a({api:this.config.api,queryParams:{shop:this.config.shop}});let i=await e.restoreFiles(t,!0);s.debug("restored uploads:",i)}return t}_createUploadField(e,t,i){let r=null,o=null;t&&(o='[data-upload-lift="'+t.id+'"]'),e.fieldBlock&&(o||(o=""),o+='[data-upload-field="'+e.fieldBlock+'"]'),i||(i='form[action*="/cart/add"]',"contact"===e.fieldProperty?(i='form[action*="/contact"]',r="contact",o=null):"customer[note]"===e.fieldProperty?(i='form[action="/account"]',r="create_customer",o=null):"attributes"===e.fieldProperty?(i='form[action="/cart"], form[action$="/cart"], form[action*="/cart?"]',o=null):"order"===e.fieldProperty&&(i="",o=null,this._orderUpload&&(this._orderUpload.settings.orderItems?e.selector='[data-upload-lift-order-item="'+(t?t.id:"x")+'"]':e.selector="[data-upload-lift-order-level]")));let a=this._findOrCreateContainer(e.selector,t,i,r,o);if(a){let i;i=Array.isArray(a)||n.isNodeList(a)?a:[a];for(let n=0;n1){let e=l.getAttribute("id");if(e&&(-1!==e.indexOf("installment")||-1!==e.indexOf("instalment")))continue}let t=l.querySelector("[type=submit],[name=checkout],.add_to_cart,.btn.add-to-cart"),i=document.createElement("div");i.className="upload-container",i.style.width="100%",t?t.parentNode.insertBefore(i,t):l.action&&-1!==l.action.indexOf("/cart/add")?l.insertBefore(i,l.firstChild):l.appendChild(i),s.debug("injected container into form:",l),a.push(i)}if(a.length)return s.debug("using injected container:",a),a}return null}_validateConfigs(e,t,i,r,o){let a=[];if(s.debug("validateConfigs:",i,r),0!==i.length){for(let e=0;e(i&&(window.location.href=i),e)))):(s.warn("[upload-lift] missing product variant for manualFormSubmit"),Promise.resolve(!1))}_validateFormSubmit(e){let t=[];for(let i=0;i{o.target&&(n.matches(o.target,r)||null!=n.findParent(o.target,r))&&this._validateConfigs(o,"click",e,i,t.length>1)}),{capture:!0})}else{o.addEventListener("submit",(n=>this._validateConfigs(n,"submit",e,i,t.length>1)));let n=o.querySelectorAll("[type=submit],.add_to_cart,.btn.add-to-cart");for(let r=0;rthis._validateConfigs(n,"click",e,i,t.length>1)))}let r=o.querySelectorAll(".shopify-payment-button");for(let n=0;nthis._validateConfigs(n,"click",e,i,t.length>1)),{capture:!0})}null!=l&&l.addEventListener("click",(n=>this._validateConfigs(n,"click",e,i,t.length>1)),{capture:!0})}o.dataset.clValidate=!0}}let i=document.querySelector("[data-upload-lift-sticky]");null!=i&&i.addEventListener("click",(e=>{let t=document.querySelector(i.dataset.uploadLiftSticky);t?(e.preventDefault(),e.stopImmediatePropagation(),t.click()):s.warn("[upload-lift] sticky - no button found with selector:",i.dataset.uploadSticky)}),{capture:!0})}_watchVariantHistory(e){const t=()=>{let t=[];e.forEach((e=>{let i=e._productForm;i&&-1===t.indexOf(i)&&(t.push(i),i.dispatchEvent(new Event("change",{bubbles:!0})))}))};this.shopifyStore.patchHistory("pushState",t),this.shopifyStore.patchHistory("replaceState",t)}_fixThemeStyles(){if(this.shopifyStore.isTheme("Dawn")||this.shopifyStore.isTheme("Ella")){let e="\n .cl-upload--wrapper a:empty, .cl-upload--wrapper div:empty, .cl-upload--wrapper dl:empty, .cl-upload--wrapper pl:empty, .cl-upload--wrapper section:empty, .cl-upload--wrapper ul:empty, .cl-upload--wrapper canvas:empty {\n display:block!important;\n }\n .doka--root a:empty, .doka--root div:empty, .doka--root dl:empty, .doka--rootpl:empty, .doka--root section:empty, .doka--root ul:empty, .doka--root canvas:empty {\n display:block!important;\n }\n .pintura-editor a:empty, .pintura-editor div:empty, .pintura-editor dl:empty, .pintura-editorpl:empty, .pintura-editor section:empty, .pintura-editor ul:empty, .pintura-editor canvas:empty {\n display:block!important;\n }\n .filepond--root {\n z-index:1;\n }\n ";n.addStyleElement(e)}}_evaluateThemeEditor(e){const t="cl_upload_theme";if("0"!==n.readCookie(t))for(let i in e)if(e.hasOwnProperty(i)){let r=e[i],o=this._findOrCreateContainer(null,r,'form[action*="/cart/add"]',null,'[data-upload-lift="'+r.id+'"]');if(o){let e,i=0===this.config.fields.length,r=`\n \n Upload Lift\n Upload field will appear here. ${i?"":"(only shown in editor)"}`;i&&(r+="NEXT: save the theme & continue with the setup in the app."),e=Array.isArray(o)||n.isNodeList(o)?o:[o];for(let a=0;aTo change the location visit: Upload Field App Block'),s.innerHTML=l,o.querySelector(".live-close").addEventListener("click",(e=>{o.parentElement.removeChild(o),n.writeCookie(t,"0",30,"/")}))}return}}}_evaluateConditions(e,t,i){let n=!1;for(let r=0;r=0?t.tags.split(", "):[t.tags]}for(let t=0;t-1:void 0}_watchCartProperties(e){this._processCartProperties(e);let t=n.debounced(1e3,(()=>this._processCartProperties(e)));Le.register((e=>{e.url.length<100&&/.*cart.*/.test(e.url)&&t()}));setTimeout((()=>t()),2e3)}_processCartProperties(e){if(this.fields.length)for(const e of this.fields)if("attributes"===e.config.fieldProperty&&(!n.isInPage(e.element)||0===e.element.childElementCount)){this.setup();break}let t=document.createNodeIterator(document.body,NodeFilter.SHOW_TEXT,{acceptNode:e=>-1!==e.textContent.indexOf("cloudlift.app")&&"SCRIPT"!==e.parentNode.tagName?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}),i=[],r=[];for(let t=0;t0){let e=n[0],a=document.createElement("span");a.className="cl-prop";let l="",u=o;for(let n=0;n<3;n++){let c=u.textContent.replace(e,"");for(let t=0;t',3===u.nodeType?o.parentNode.replaceChild(a,o):(u.innerHTML="",u.appendChild(a)),l=i;break}}if(""===l)for(let n=0;n'+d.get("upload.config.file.link")+""),o.parentNode.replaceChild(a,o),l=r;break}}if(""!==l){s.debug('found field "'+l+'" on node: ',u);break}if(s.getLevel()<=s.levels.TRACE&&s.debug("no field found on node: ",u),u=u.parentNode,2===n&&(a.innerHTML=t.replace(e,''+d.get("upload.config.file.link")+""),o.parentNode.replaceChild(a,o)),!u)break}}}}constructor(e,t){this.config=e,this.fields=[];let i={};if(window.Shopify&&window.Shopify.routes&&window.Shopify.routes.root&&"/"!==window.Shopify.routes.root){let e=window.Shopify.routes.root;i.api="/"===e[e.length-1]?e.substr(0,e.length-1):e}if(this.shopifyStore=Re.getInstance({api:i.api}),this.shopifyCart=Me.getInstance(i),ye.providers.google=new Ce({api:e.api,queryParams:{shop:e.shop}}),this._fixThemeStyles(),this.config.setup){if(this.config.extensions?.includes("customer")){if(null!==document.querySelector(xe.selector))return void(this._orderUpload=new xe(this.setup.bind(this),{api:e.api,shop:e.shop,config:this.config.customer}))}/complete|interactive|loaded/.test(document.readyState)?this.setup():(s.debug("---\x3e document not ready ("+document.readyState+") => waiting for DOMContentLoaded"),document.addEventListener("DOMContentLoaded",(()=>this.setup()),!1)),this.shopifyStore.onThemeSectionEvent("load",(e=>{this.setup()}))}window.dispatchEvent(new CustomEvent("upload:app",{detail:this,cancelable:!0,bubbles:!0}))}};let Ne=()=>{const e=window.Cloudlift.upload.config;s.setDefaultLevel(s.levels.ERROR);let t=s.getLevel();s.setLevel(void 0!==e.log?e.log:t),s.debug("got config",e),window.addEventListener("cloudlift.upload.ready",(e=>{s.debug("resources loaded")}));const i=-1===e.api.indexOf("local")?e.api.replace("api.","assets."):e.api;d.translations=e.i18n||{},e.setup?window.clTranslate?d.translations=n.extend(d.translations,window.clTranslate):(d.api=i+"/api/assets/"+e.app+"/translate/{locale}?shop="+e.shop,d.event+="."+e.app,d.locale&&e.locale&&d.locale!=e.locale&&d.fetch(d.locale)):window.Translate=d,window.Cloudlift.upload.lib={Upload:ye,UploadField:Se,Translate:d},d.ready.then((()=>{window.Cloudlift.upload.App=new Ge(e)}))};"Promise"in window&&"assign"in Object&&String.prototype.startsWith&&Array.prototype.flat?Ne():e(we)(window.Cloudlift.upload.config.assets+"/static/lib/core-js/core-js.min.js",Ne)}();