UNPKG

@uploadcare/file-uploader

Version:

Building blocks for Uploadcare products integration

29 lines 273 kB
/** * @license * MIT License * * Copyright (c) 2022 Uploadcare (hello@uploadcare.com). All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * */ "use strict";var UC=(()=>{var me=Object.defineProperty;var Kn=Object.getOwnPropertyDescriptor;var Zn=Object.getOwnPropertyNames;var Yn=Object.getPrototypeOf,Jn=Object.prototype.hasOwnProperty;var Qn=Reflect.get;var tl=(r,e,t)=>e in r?me(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var l=(r,e)=>me(r,"name",{value:e,configurable:!0});var el=(r,e)=>{for(var t in e)me(r,t,{get:e[t],enumerable:!0})},il=(r,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Zn(e))!Jn.call(r,s)&&s!==t&&me(r,s,{get:()=>e[s],enumerable:!(i=Kn(e,s))||i.enumerable});return r};var rl=r=>il(me({},"__esModule",{value:!0}),r);var h=(r,e,t)=>(tl(r,typeof e!="symbol"?e+"":e,t),t);var H=(r,e,t)=>Qn(Yn(r),t,e);var Xc={};el(Xc,{ActivityBlock:()=>_,ActivityHeader:()=>tr,BaseComponent:()=>$t,Block:()=>y,BtnUi:()=>ce,CameraSource:()=>Ve,CloudImageEditor:()=>rr,CloudImageEditorActivity:()=>Ji,CloudImageEditorBlock:()=>ct,Config:()=>pn,Copyright:()=>er,CropFrame:()=>Ge,Data:()=>T,DropArea:()=>ie,EditorCropButtonControl:()=>ne,EditorFilterControl:()=>Dt,EditorImageCropper:()=>Ze,EditorImageFader:()=>Zi,EditorOperationControl:()=>le,EditorScroller:()=>Ye,EditorSlider:()=>Xe,EditorToolbar:()=>Je,ExternalSource:()=>ii,ExternalUploadSource:()=>Mt,FileItem:()=>oe,FileUploaderInline:()=>oi,FileUploaderMinimal:()=>si,FileUploaderRegular:()=>he,FormInput:()=>Qi,Icon:()=>Zt,Img:()=>ji,LineLoaderUi:()=>Qe,Modal:()=>Ne,PACKAGE_NAME:()=>Lt,PACKAGE_VERSION:()=>Ut,PresenceToggle:()=>ti,ProgressBar:()=>He,ProgressBarCommon:()=>je,Select:()=>ri,SimpleBtn:()=>Qt,SliderUi:()=>ei,SolutionBlock:()=>st,SourceBtn:()=>re,SourceList:()=>Hi,StartFrom:()=>Fe,UID:()=>kt,UploadCtxProvider:()=>Un,UploadList:()=>ze,UploadSource:()=>L,UploaderBlock:()=>k,UrlSource:()=>Be,defineComponents:()=>sr,defineLocale:()=>Ur,loadFileUploaderFrom:()=>Xn,toKebabCase:()=>qt});var sl=Object.defineProperty,ol=l((r,e,t)=>e in r?sl(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,"__defNormalProp"),lr=l((r,e,t)=>(ol(r,typeof e!="symbol"?e+"":e,t),t),"__publicField");function nl(r){let e=l(t=>{var i;for(let s in t)((i=t[s])==null?void 0:i.constructor)===Object&&(t[s]=e(t[s]));return{...t}},"clone");return e(r)}l(nl,"cloneObj");var be,T=(be=class{constructor(e){e.constructor===Object?this.store=nl(e):(this._storeIsProxy=!0,this.store=e),this.callbackMap=Object.create(null)}static warn(e,t){console.warn(`Symbiote Data: cannot ${e}. Prop name: `+t)}read(e){return!this._storeIsProxy&&!this.store.hasOwnProperty(e)?(T.warn("read",e),null):this.store[e]}has(e){return this._storeIsProxy?this.store[e]!==void 0:this.store.hasOwnProperty(e)}add(e,t,i=!1){!i&&Object.keys(this.store).includes(e)||(this.store[e]=t,this.notify(e))}pub(e,t){if(!this._storeIsProxy&&!this.store.hasOwnProperty(e)){T.warn("publish",e);return}this.store[e]=t,this.notify(e)}multiPub(e){for(let t in e)this.pub(t,e[t])}notify(e){this.callbackMap[e]&&this.callbackMap[e].forEach(t=>{t(this.store[e])})}sub(e,t,i=!0){return!this._storeIsProxy&&!this.store.hasOwnProperty(e)?(T.warn("subscribe",e),null):(this.callbackMap[e]||(this.callbackMap[e]=new Set),this.callbackMap[e].add(t),i&&t(this.store[e]),{remove:()=>{this.callbackMap[e].delete(t),this.callbackMap[e].size||delete this.callbackMap[e]},callback:t})}static registerCtx(e,t=Symbol()){let i=T.globalStore.get(t);return i?console.warn('State: context UID "'+t+'" already in use'):(i=new T(e),T.globalStore.set(t,i)),i}static deleteCtx(e){T.globalStore.delete(e)}static getCtx(e,t=!0){return T.globalStore.get(e)||(t&&console.warn('State: wrong context UID - "'+e+'"'),null)}},l(be,"Data"),be);T.globalStore=new Map;var E=Object.freeze({BIND_ATTR:"set",ATTR_BIND_PRFX:"@",EXT_DATA_CTX_PRFX:"*",NAMED_DATA_CTX_SPLTR:"/",CTX_NAME_ATTR:"ctx-name",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx-name",EL_REF_ATTR:"ref",AUTO_TAG_PRFX:"sym",REPEAT_ATTR:"repeat",REPEAT_ITEM_TAG_ATTR:"repeat-item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL:"use-template",ROOT_STYLE_ATTR_NAME:"sym-component"}),qs="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",ll=qs.length-1,_e,kt=(_e=class{static generate(e="XXXXXXXXX-XXX"){let t="";for(let i=0;i<e.length;i++)t+=e[i]==="-"?e[i]:qs.charAt(Math.random()*ll);return t}},l(_e,"UID"),_e);function Ks(r,e,t){let i=!0,s,o=e.split(".");return o.forEach((n,a)=>{a<o.length-1?r=r[n]:s=n}),r?r[s]=t:i=!1,i}l(Ks,"setNestedProp");function al(r){return r.split("-").map((e,t)=>e&&t?e[0].toUpperCase()+e.slice(1):e).join("").split("_").map((e,t)=>e&&t?e.toUpperCase():e).join("")}l(al,"kebabToCamel");function cl(r,e){[...r.querySelectorAll(`[${E.REPEAT_ATTR}]`)].forEach(t=>{var n;let i=t.getAttribute(E.REPEAT_ITEM_TAG_ATTR),s;if(i&&(s=window.customElements.get(i)),!s){s=(n=class extends e.BaseComponent{constructor(){super(),i||(this.style.display="contents")}},l(n,"itemClass"),n);let a=t.innerHTML;s.template=a,s.reg(i)}for(;t.firstChild;)t.firstChild.remove();let o=t.getAttribute(E.REPEAT_ATTR);e.sub(o,a=>{if(!a){for(;t.firstChild;)t.firstChild.remove();return}let c=[...t.children],u,p=l(d=>{d.forEach((m,g)=>{if(c[g])if(c[g].set$)setTimeout(()=>{c[g].set$(m)});else for(let b in m)c[g][b]=m[b];else{u||(u=new DocumentFragment);let b=new s;Object.assign(b.init$,m),u.appendChild(b)}}),u&&t.appendChild(u);let f=c.slice(d.length,c.length);for(let m of f)m.remove()},"fillItems");if(a.constructor===Array)p(a);else if(a.constructor===Object){let d=[];for(let f in a){let m=a[f];Object.defineProperty(m,"_KEY_",{value:f,enumerable:!0}),d.push(m)}p(d)}else console.warn("Symbiote repeat data type error:"),console.log(a)}),t.removeAttribute(E.REPEAT_ATTR),t.removeAttribute(E.REPEAT_ITEM_TAG_ATTR)})}l(cl,"repeatProcessor");var Ws="__default__";function ul(r,e){if(e.shadowRoot)return;let t=[...r.querySelectorAll("slot")];if(!t.length)return;let i={};t.forEach(s=>{let o=s.getAttribute("name")||Ws;i[o]={slot:s,fr:document.createDocumentFragment()}}),e.initChildren.forEach(s=>{var o;let n=Ws;s instanceof Element&&s.hasAttribute("slot")&&(n=s.getAttribute("slot"),s.removeAttribute("slot")),(o=i[n])==null||o.fr.appendChild(s)}),Object.values(i).forEach(s=>{if(s.fr.childNodes.length)s.slot.parentNode.replaceChild(s.fr,s.slot);else if(s.slot.childNodes.length){let o=document.createDocumentFragment();o.append(...s.slot.childNodes),s.slot.parentNode.replaceChild(o,s.slot)}else s.slot.remove()})}l(ul,"slotProcessor");function hl(r,e){[...r.querySelectorAll(`[${E.EL_REF_ATTR}]`)].forEach(t=>{let i=t.getAttribute(E.EL_REF_ATTR);e.ref[i]=t,t.removeAttribute(E.EL_REF_ATTR)})}l(hl,"refProcessor");function dl(r,e){[...r.querySelectorAll(`[${E.BIND_ATTR}]`)].forEach(t=>{let s=t.getAttribute(E.BIND_ATTR).split(";");[...t.attributes].forEach(o=>{if(o.name.startsWith("-")&&o.value){let n=al(o.name.replace("-",""));s.push(n+":"+o.value),t.removeAttribute(o.name)}}),s.forEach(o=>{if(!o)return;let n=o.split(":").map(p=>p.trim()),a=n[0],c;a.indexOf(E.ATTR_BIND_PRFX)===0&&(c=!0,a=a.replace(E.ATTR_BIND_PRFX,""));let u=n[1].split(",").map(p=>p.trim());for(let p of u){let d;p.startsWith("!!")?(d="double",p=p.replace("!!","")):p.startsWith("!")&&(d="single",p=p.replace("!","")),e.sub(p,f=>{d==="double"?f=!!f:d==="single"&&(f=!f),c?(f==null?void 0:f.constructor)===Boolean?f?t.setAttribute(a,""):t.removeAttribute(a):t.setAttribute(a,f):Ks(t,a,f)||(t[E.SET_LATER_KEY]||(t[E.SET_LATER_KEY]=Object.create(null)),t[E.SET_LATER_KEY][a]=f)})}}),t.removeAttribute(E.BIND_ATTR)})}l(dl,"domSetProcessor");var ni="{{",ge="}}",pl="skip-text";function fl(r){let e,t=[],i=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,{acceptNode:s=>{var o;return!((o=s.parentElement)!=null&&o.hasAttribute(pl))&&s.textContent.includes(ni)&&s.textContent.includes(ge)&&1}});for(;e=i.nextNode();)t.push(e);return t}l(fl,"getTextNodesWithTokens");var ml=l(function(r,e){fl(r).forEach(i=>{let s=[],o;for(;i.textContent.includes(ge);)i.textContent.startsWith(ni)?(o=i.textContent.indexOf(ge)+ge.length,i.splitText(o),s.push(i)):(o=i.textContent.indexOf(ni),i.splitText(o)),i=i.nextSibling;s.forEach(n=>{let a=n.textContent.replace(ni,"").replace(ge,"");n.textContent="",e.sub(a,c=>{n.textContent=c})})})},"txtNodesProcessor"),gl=[cl,ul,hl,dl,ml],li="'",zt='"',bl=/\\([0-9a-fA-F]{1,6} ?)/g;function _l(r){return(r[0]===zt||r[0]===li)&&(r[r.length-1]===zt||r[r.length-1]===li)}l(_l,"hasLeadingTrailingQuotes");function yl(r){return(r[0]===zt||r[0]===li)&&(r=r.slice(1)),(r[r.length-1]===zt||r[r.length-1]===li)&&(r=r.slice(0,-1)),r}l(yl,"trimQuotes");function vl(r){let e="",t="";for(var i=0;i<r.length;i++){let s=r[i+1];r[i]==="\\"&&s==='"'?(e+='\\"',i++):r[i]==='"'&&t!=="\\"?e+='\\"':e+=r[i],t=r[i]}return e}l(vl,"escapeQuotes");function wl(r){let e=r;_l(r)&&(e=yl(e),e=e.replace(bl,(t,i)=>String.fromCodePoint(parseInt(i.trim(),16))),e=e.replaceAll(`\\ `,"\\n"),e=vl(e),e=zt+e+zt);try{return JSON.parse(e)}catch{throw new Error(`Failed to parse CSS property value: ${e}. Original input: ${r}`)}}l(wl,"parseCssPropertyValue");var Xs=0,Nt=null,dt=null,ye,yt=(ye=class extends HTMLElement{constructor(){super(),lr(this,"updateCssData",()=>{var e;this.dropCssDataCache(),(e=this.__boundCssProps)==null||e.forEach(t=>{let i=this.getCssData(this.__extractCssName(t),!0);i!==null&&this.$[t]!==i&&(this.$[t]=i)})}),this.init$=Object.create(null),this.cssInit$=Object.create(null),this.tplProcessors=new Set,this.ref=Object.create(null),this.allSubs=new Set,this.pauseRender=!1,this.renderShadow=!1,this.readyToDestroy=!0,this.processInnerHtml=!1,this.allowCustomTemplate=!1,this.ctxOwner=!1}get BaseComponent(){return yt}initCallback(){}__initCallback(){var e;this.__initialized||(this.__initialized=!0,(e=this.initCallback)==null||e.call(this))}render(e,t=this.renderShadow){let i;if((t||this.constructor.__shadowStylesUrl)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let o=this.getAttribute(E.USE_TPL);if(o){let n=this.getRootNode(),a=(n==null?void 0:n.querySelector(o))||document.querySelector(o);a?e=a.content.cloneNode(!0):console.warn(`Symbiote template "${o}" is not found...`)}}if(this.processInnerHtml)for(let o of this.tplProcessors)o(this,this);if(e||this.constructor.template){if(this.constructor.template&&!this.constructor.__tpl&&(this.constructor.__tpl=document.createElement("template"),this.constructor.__tpl.innerHTML=this.constructor.template),(e==null?void 0:e.constructor)===DocumentFragment)i=e;else if((e==null?void 0:e.constructor)===String){let o=document.createElement("template");o.innerHTML=e,i=o.content.cloneNode(!0)}else this.constructor.__tpl&&(i=this.constructor.__tpl.content.cloneNode(!0));for(let o of this.tplProcessors)o(i,this)}let s=l(()=>{i&&(t&&this.shadowRoot.appendChild(i)||this.appendChild(i)),this.__initCallback()},"addFr");if(this.constructor.__shadowStylesUrl){t=!0;let o=document.createElement("link");o.rel="stylesheet",o.href=this.constructor.__shadowStylesUrl,o.onload=s,this.shadowRoot.prepend(o)}else s()}addTemplateProcessor(e){this.tplProcessors.add(e)}get autoCtxName(){return this.__autoCtxName||(this.__autoCtxName=kt.generate(),this.style.setProperty(E.CSS_CTX_PROP,`'${this.__autoCtxName}'`)),this.__autoCtxName}get cssCtxName(){return this.getCssData(E.CSS_CTX_PROP,!0)}get ctxName(){var e;let t=((e=this.getAttribute(E.CTX_NAME_ATTR))==null?void 0:e.trim())||this.cssCtxName||this.__cachedCtxName||this.autoCtxName;return this.__cachedCtxName=t,t}get localCtx(){return this.__localCtx||(this.__localCtx=T.registerCtx({},this)),this.__localCtx}get nodeCtx(){return T.getCtx(this.ctxName,!1)||T.registerCtx({},this.ctxName)}static __parseProp(e,t){let i,s;if(e.startsWith(E.EXT_DATA_CTX_PRFX))i=t.nodeCtx,s=e.replace(E.EXT_DATA_CTX_PRFX,"");else if(e.includes(E.NAMED_DATA_CTX_SPLTR)){let o=e.split(E.NAMED_DATA_CTX_SPLTR);i=T.getCtx(o[0]),s=o[1]}else i=t.localCtx,s=e;return{ctx:i,name:s}}sub(e,t,i=!0){let s=l(n=>{this.isConnected&&t(n)},"subCb"),o=yt.__parseProp(e,this);o.ctx.has(o.name)?this.allSubs.add(o.ctx.sub(o.name,s,i)):window.setTimeout(()=>{this.allSubs.add(o.ctx.sub(o.name,s,i))})}notify(e){let t=yt.__parseProp(e,this);t.ctx.notify(t.name)}has(e){let t=yt.__parseProp(e,this);return t.ctx.has(t.name)}add(e,t,i=!1){let s=yt.__parseProp(e,this);s.ctx.add(s.name,t,i)}add$(e,t=!1){for(let i in e)this.add(i,e[i],t)}get $(){if(!this.__stateProxy){let e=Object.create(null);this.__stateProxy=new Proxy(e,{set:(t,i,s)=>{let o=yt.__parseProp(i,this);return o.ctx.pub(o.name,s),!0},get:(t,i)=>{let s=yt.__parseProp(i,this);return s.ctx.read(s.name)}})}return this.__stateProxy}set$(e,t=!1){for(let i in e){let s=e[i];t||![String,Number,Boolean].includes(s==null?void 0:s.constructor)?this.$[i]=s:this.$[i]!==s&&(this.$[i]=s)}}get __ctxOwner(){return this.ctxOwner||this.hasAttribute(E.CTX_OWNER_ATTR)&&this.getAttribute(E.CTX_OWNER_ATTR)!=="false"}__initDataCtx(){let e=this.constructor.__attrDesc;if(e)for(let t of Object.values(e))Object.keys(this.init$).includes(t)||(this.init$[t]="");for(let t in this.init$)if(t.startsWith(E.EXT_DATA_CTX_PRFX))this.nodeCtx.add(t.replace(E.EXT_DATA_CTX_PRFX,""),this.init$[t],this.__ctxOwner);else if(t.includes(E.NAMED_DATA_CTX_SPLTR)){let i=t.split(E.NAMED_DATA_CTX_SPLTR),s=i[0].trim(),o=i[1].trim();if(s&&o){let n=T.getCtx(s,!1);n||(n=T.registerCtx({},s)),n.add(o,this.init$[t])}}else this.localCtx.add(t,this.init$[t]);for(let t in this.cssInit$)this.bindCssData(t,this.cssInit$[t]);this.__dataCtxInitialized=!0}connectedCallback(){var e;if(this.isConnected){if(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),!this.connectedOnce){let t=(e=this.getAttribute(E.CTX_NAME_ATTR))==null?void 0:e.trim();if(t&&this.style.setProperty(E.CSS_CTX_PROP,`'${t}'`),this.__initDataCtx(),this[E.SET_LATER_KEY]){for(let i in this[E.SET_LATER_KEY])Ks(this,i,this[E.SET_LATER_KEY][i]);delete this[E.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let i of gl)this.addTemplateProcessor(i);if(this.pauseRender)this.__initCallback();else if(this.constructor.__rootStylesLink){let i=this.getRootNode();if(!i)return;if(i==null?void 0:i.querySelector(`link[${E.ROOT_STYLE_ATTR_NAME}="${this.constructor.is}"]`)){this.render();return}let o=this.constructor.__rootStylesLink.cloneNode(!0);o.setAttribute(E.ROOT_STYLE_ATTR_NAME,this.constructor.is),o.onload=()=>{this.render()},i.nodeType===Node.DOCUMENT_NODE?i.head.appendChild(o):i.prepend(o)}else this.render()}this.connectedOnce=!0}}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(this.__disconnectTimeout&&window.clearTimeout(this.__disconnectTimeout),this.__disconnectTimeout=window.setTimeout(()=>{this.destroyCallback();for(let e of this.allSubs)e.remove(),this.allSubs.delete(e);for(let e of this.tplProcessors)this.tplProcessors.delete(e);dt==null||dt.delete(this.updateCssData),dt!=null&&dt.size||(Nt==null||Nt.disconnect(),Nt=null,dt=null)},100)))}static reg(e,t=!1){e||(Xs++,e=`${E.AUTO_TAG_PRFX}-${Xs}`),this.__tag=e;let i=window.customElements.get(e);if(i){!t&&i!==this&&console.warn([`Element with tag name "${e}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(e,t?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(e){this.observedAttributes=Object.keys(e),this.__attrDesc=e}attributeChangedCallback(e,t,i){var s;if(t===i)return;let o=(s=this.constructor.__attrDesc)==null?void 0:s[e];o?this.__dataCtxInitialized?this.$[o]=i:this.init$[o]=i:this[e]=i}getCssData(e,t=!1){if(this.__cssDataCache||(this.__cssDataCache=Object.create(null)),!Object.keys(this.__cssDataCache).includes(e)){this.__computedStyle||(this.__computedStyle=window.getComputedStyle(this));let i=this.__computedStyle.getPropertyValue(e).trim();try{this.__cssDataCache[e]=wl(i)}catch{!t&&console.warn(`CSS Data error: ${e}`),this.__cssDataCache[e]=null}}return this.__cssDataCache[e]}__extractCssName(e){return e.split("--").map((t,i)=>i===0?"":t).join("--")}__initStyleAttrObserver(){dt||(dt=new Set),dt.add(this.updateCssData),Nt||(Nt=new MutationObserver(e=>{e[0].type==="attributes"&&dt.forEach(t=>{t()})}),Nt.observe(document,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["style"]}))}bindCssData(e,t=""){this.__boundCssProps||(this.__boundCssProps=new Set),this.__boundCssProps.add(e);let i=this.getCssData(this.__extractCssName(e),!0);i===null&&(i=t),this.add(e,i),this.__initStyleAttrObserver()}dropCssDataCache(){this.__cssDataCache=null,this.__computedStyle=null}defineAccessor(e,t,i){let s="__"+e;this[s]=this[e],Object.defineProperty(this,e,{set:o=>{this[s]=o,i?window.setTimeout(()=>{t==null||t(o)}):t==null||t(o)},get:()=>this[s]}),this[e]=this[s]}static set shadowStyles(e){let t=new Blob([e],{type:"text/css"});this.__shadowStylesUrl=URL.createObjectURL(t)}static set rootStyles(e){if(!this.__rootStylesLink){let t=new Blob([e],{type:"text/css"}),i=URL.createObjectURL(t),s=document.createElement("link");s.href=i,s.rel="stylesheet",this.__rootStylesLink=s}}},l(ye,"_BaseComponent"),ye),$t=yt;lr($t,"template");var ve,nr=(ve=class{static _print(e){console.warn(e)}static setDefaultTitle(e){this.defaultTitle=e}static setRoutingMap(e){Object.assign(this.appMap,e);for(let t in this.appMap)!this.defaultRoute&&this.appMap[t].default===!0?this.defaultRoute=t:!this.errorRoute&&this.appMap[t].error===!0&&(this.errorRoute=t)}static set routingEventName(e){this.__routingEventName=e}static get routingEventName(){return this.__routingEventName||"sym-on-route"}static readAddressBar(){let e={route:null,options:{}};return window.location.search.split(this.separator).forEach(i=>{if(i.includes("?"))e.route=i.replace("?","");else if(i.includes("=")){let s=i.split("=");e.options[s[0]]=decodeURI(s[1])}else e.options[i]=!0}),e}static notify(){let e=this.readAddressBar(),t=this.appMap[e.route];if(t&&t.title&&(document.title=t.title),e.route===null&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!t&&this.errorRoute){this.applyRoute(this.errorRoute);return}else if(!t&&this.defaultRoute){this.applyRoute(this.defaultRoute);return}else if(!t){this._print(`Route "${e.route}" not found...`);return}let i=new CustomEvent(nr.routingEventName,{detail:{route:e.route,options:Object.assign(t||{},e.options)}});window.dispatchEvent(i)}static reflect(e,t={}){let i=this.appMap[e];if(!i){this._print("Wrong route: "+e);return}let s="?"+e;for(let n in t)t[n]===!0?s+=this.separator+n:s+=this.separator+n+`=${t[n]}`;let o=i.title||this.defaultTitle||"";window.history.pushState(null,o,s),document.title=o}static applyRoute(e,t={}){this.reflect(e,t),this.notify()}static setSeparator(e){this._separator=e}static get separator(){return this._separator||"&"}static createRouterData(e,t){this.setRoutingMap(t);let i=T.registerCtx({route:null,options:null,title:null},e);return window.addEventListener(this.routingEventName,s=>{var o;i.multiPub({route:s.detail.route,options:s.detail.options,title:((o=s.detail.options)==null?void 0:o.title)||this.defaultTitle||""})}),nr.notify(),this.initPopstateListener(),i}static initPopstateListener(){this.__onPopstate||(this.__onPopstate=()=>{this.notify()},window.addEventListener("popstate",this.__onPopstate))}static removePopstateListener(){window.removeEventListener("popstate",this.__onPopstate),this.__onPopstate=null}},l(ve,"AppRouter"),ve);nr.appMap=Object.create(null);function xe(r,e){for(let t in e)t.includes("-")?r.style.setProperty(t,e[t]):r.style[t]=e[t]}l(xe,"applyStyles");function Cl(r,e){for(let t in e)e[t].constructor===Boolean?e[t]?r.setAttribute(t,""):r.removeAttribute(t):r.setAttribute(t,e[t])}l(Cl,"applyAttributes");function ar(r={tag:"div"}){let e=document.createElement(r.tag);if(r.attributes&&Cl(e,r.attributes),r.styles&&xe(e,r.styles),r.properties)for(let t in r.properties)e[t]=r.properties[t];return r.processors&&r.processors.forEach(t=>{t(e)}),r.children&&r.children.forEach(t=>{let i=ar(t);e.appendChild(i)}),e}l(ar,"create");var Zs="idb-store-ready",xl="symbiote-db",Al="symbiote-idb-update_",we,El=(we=class{_notifyWhenReady(e=null){window.dispatchEvent(new CustomEvent(Zs,{detail:{dbName:this.name,storeName:this.storeName,event:e}}))}get _updEventName(){return Al+this.name}_getUpdateEvent(e){return new CustomEvent(this._updEventName,{detail:{key:this.name,newValue:e}})}_notifySubscribers(e){window.localStorage.removeItem(this.name),window.localStorage.setItem(this.name,e),window.dispatchEvent(this._getUpdateEvent(e))}constructor(e,t){this.name=e,this.storeName=t,this.version=1,this.request=window.indexedDB.open(this.name,this.version),this.request.onupgradeneeded=i=>{this.db=i.target.result,this.objStore=this.db.createObjectStore(t,{keyPath:"_key"}),this.objStore.transaction.oncomplete=s=>{this._notifyWhenReady(s)}},this.request.onsuccess=i=>{this.db=i.target.result,this._notifyWhenReady(i)},this.request.onerror=i=>{console.error(i)},this._subscriptionsMap={},this._updateHandler=i=>{i.key===this.name&&this._subscriptionsMap[i.newValue]&&this._subscriptionsMap[i.newValue].forEach(async o=>{o(await this.read(i.newValue))})},this._localUpdateHandler=i=>{this._updateHandler(i.detail)},window.addEventListener("storage",this._updateHandler),window.addEventListener(this._updEventName,this._localUpdateHandler)}read(e){let i=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).get(e);return new Promise((s,o)=>{i.onsuccess=n=>{var a;(a=n.target.result)!=null&&a._value?s(n.target.result._value):(s(null),console.warn(`IDB: cannot read "${e}"`))},i.onerror=n=>{o(n)}})}write(e,t,i=!1){let s={_key:e,_value:t},n=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).put(s);return new Promise((a,c)=>{n.onsuccess=u=>{i||this._notifySubscribers(e),a(u.target.result)},n.onerror=u=>{c(u)}})}delete(e,t=!1){let s=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).delete(e);return new Promise((o,n)=>{s.onsuccess=a=>{t||this._notifySubscribers(e),o(a)},s.onerror=a=>{n(a)}})}getAll(){let t=this.db.transaction(this.storeName,"readwrite").objectStore(this.storeName).getAll();return new Promise((i,s)=>{t.onsuccess=o=>{let n=o.target.result;i(n.map(a=>a._value))},t.onerror=o=>{s(o)}})}subscribe(e,t){this._subscriptionsMap[e]||(this._subscriptionsMap[e]=new Set);let i=this._subscriptionsMap[e];return i.add(t),{remove:()=>{i.delete(t),i.size||delete this._subscriptionsMap[e]}}}stop(){window.removeEventListener("storage",this._updateHandler),this._subscriptionsMap=null,Ys.clear(this.name)}},l(we,"DbInstance"),we),Ce,Ys=(Ce=class{static get readyEventName(){return Zs}static open(e=xl,t="store"){let i=e+"/"+t;return this._reg[i]||(this._reg[i]=new El(e,t)),this._reg[i]}static clear(e){window.indexedDB.deleteDatabase(e);for(let t in this._reg)t.split("/")[0]===e&&delete this._reg[t]}},l(Ce,"IDB"),Ce);lr(Ys,"_reg",Object.create(null));var Js=l(r=>{if(typeof r!="string"||!r)return"";let e=r.trim();return e.startsWith("-/")?e=e.slice(2):e.startsWith("/")&&(e=e.slice(1)),e.endsWith("/")&&(e=e.slice(0,e.length-1)),e},"normalizeCdnOperation"),ai=l((...r)=>r.filter(e=>typeof e=="string"&&e).map(e=>Js(e)).join("/-/"),"joinCdnOperations"),N=l((...r)=>{let e=ai(...r);return e?`-/${e}/`:""},"createCdnUrlModifiers");function ci(r){let e=new URL(r),t=e.pathname+e.search+e.hash,i=t.lastIndexOf("http"),s=t.lastIndexOf("/"),o="";return i>=0?o=t.slice(i):s>=0&&(o=t.slice(s+1)),o}l(ci,"extractFilename");function ui(r){let e=new URL(r),{pathname:t}=e,i=t.indexOf("/"),s=t.indexOf("/",i+1);return t.substring(i+1,s)}l(ui,"extractUuid");function cr(r){let e=to(r),t=new URL(e),i=t.pathname.indexOf("/-/");return i===-1?"":t.pathname.substring(i).slice(1)}l(cr,"extractCdnUrlModifiers");function Qs(r){return cr(r).split("/-/").filter(Boolean).map(t=>Js(t))}l(Qs,"extractOperations");function to(r){let e=new URL(r),t=ci(r),i=eo(t)?io(t).pathname:t;return e.pathname=e.pathname.replace(i,""),e.search="",e.hash="",e.toString()}l(to,"trimFilename");function eo(r){return r.startsWith("http")}l(eo,"isFileUrl");function io(r){let e=new URL(r);return{pathname:e.origin+e.pathname||"",search:e.search||"",hash:e.hash||""}}l(io,"splitFileUrl");var M=l((r,e,t)=>{let i=new URL(to(r));if(t=t||ci(r),i.pathname.startsWith("//")&&(i.pathname=i.pathname.replace("//","/")),eo(t)){let s=io(t);i.pathname=i.pathname+(e||"")+(s.pathname||""),i.search=s.search,i.hash=s.hash}else i.pathname=i.pathname+(e||"")+(t||"");return i.toString()},"createCdnUrl"),vt=l((r,e)=>{let t=new URL(r);return t.pathname=e+"/",t.toString()},"createOriginalUrl");var z=l((r,e=",")=>r.trim().split(e).map(t=>t.trim()).filter(t=>t.length>0),"stringToArray");var q=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:!1,flip:!1,crop:void 0}),so=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Tl(r,e){if(typeof e=="number"){let t=e;return q[r]!==t?`${r}/${t}`:""}if(typeof e=="boolean"){let t=e;return q[r]!==t?`${r}`:""}if(r==="filter"&&e){let{name:t,amount:i}=e;return q.filter===i?"":`${r}/${t}/${i}`}if(r==="crop"&&e){let{dimensions:t,coords:i}=e;return`${r}/${t.join("x")}/${i.join(",")}`}return""}l(Tl,"transformationToStr");function wt(r){return ai(...so.filter(e=>typeof r[e]!="undefined"&&r[e]!==null).map(e=>{let t=r[e];return Tl(e,t)}).filter(e=>!!e))}l(wt,"transformationsToOperations");var hi=ai("format/auto","progressive/yes"),pt=l(([r])=>typeof r!="undefined"?Number(r):void 0,"asNumber"),ro=l(()=>!0,"asBoolean"),Sl=l(([r,e])=>({name:r,amount:typeof e!="undefined"?Number(e):100}),"asFilter"),kl=l(([r,e])=>{if(!/\d+x\d+/.test(r)||!/\d+,\d+/.test(e))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return{dimensions:z(r,"x").map(Number),coords:z(e).map(Number)}},"asCrop"),$l=Object.freeze({enhance:pt,brightness:pt,exposure:pt,gamma:pt,contrast:pt,saturation:pt,vibrance:pt,warmth:pt,filter:Sl,mirror:ro,flip:ro,rotate:pt,crop:kl});function oo(r){let e={};for(let t of r){let[i,...s]=t.split("/");if(!so.includes(i))continue;let o=i,n=$l[o];try{let a=n(s);e[o]=a}catch(a){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,a instanceof Error?`Error message: "${a.message}"`:a,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `))}}return e}l(oo,"operationsToTransformations");var O=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),G=[O.CROP,O.TUNING,O.FILTERS],no=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],lo=["adaris","briaril","calarel","carris","cynarel","cyren","elmet","elonni","enzana","erydark","fenralan","ferand","galen","gavin","gethriel","iorill","iothari","iselva","jadis","lavra","misiara","namala","nerion","nethari","pamaya","sarnar","sedis","sewen","sorahel","sorlen","tarian","thellassan","varriel","varven","vevera","virkas","yedis","yllara","zatvel","zevcen"],ao=["rotate","mirror","flip"],rt=Object.freeze({brightness:{zero:q.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:q.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:q.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:q.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:q.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:q.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:q.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:q.enhance,range:[0,100],keypointsNumber:1},filter:{zero:q.filter,range:[0,100],keypointsNumber:1}});var co=l(r=>r?r.split(",").map(e=>e.trim()):[],"deserealizeCsv"),Bt=l(r=>r?r.join(","):"","serializeCsv");var Il="https://ucarecdn.com",Ol="https://upload.uploadcare.com",Ll="https://social.uploadcare.com",Q={pubkey:"",multiple:!0,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",store:"auto",cameraMirror:!1,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",cloudImageEditorTabs:Bt(G),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",imageShrink:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:Il,baseUrl:Ol,socialBaseUrl:Ll,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:1,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",debug:!1,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:10*60*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[]};var $=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created"}),ur=class ur{constructor(e){h(this,"_timeoutStore",new Map);h(this,"_targets",new Set);h(this,"_debugPrint",null);this._debugPrint=e}bindTarget(e){this._targets.add(e)}unbindTarget(e){this._targets.delete(e)}_dispatch(e,t){var i;for(let s of this._targets)s.dispatchEvent(new CustomEvent(e,{detail:t}));(i=this._debugPrint)==null||i.call(this,()=>{let s=t&&typeof t=="object"?{...t}:t;return[`event "${e}"`,s]})}emit(e,t,{debounce:i}={}){if(typeof i!="number"&&!i){this._dispatch(e,typeof t=="function"?t():t);return}this._timeoutStore.has(e)&&window.clearTimeout(this._timeoutStore.get(e));let s=typeof i=="number"?i:20,o=window.setTimeout(()=>{this._dispatch(e,typeof t=="function"?t():t),this._timeoutStore.delete(e)},s);this._timeoutStore.set(e,o)}};l(ur,"EventEmitter");var di=ur;function U(r,e){let t,i=l((...s)=>{clearTimeout(t),t=setTimeout(()=>r(...s),e)},"debounced");return i.cancel=()=>{clearTimeout(t)},i}l(U,"debounce");var uo="--uploadcare-blocks-window-height",Ae=class Ae{static registerClient(e){this.clientsRegistry.size===0&&this.attachTracker(),this.clientsRegistry.add(e)}static unregisterClient(e){this.clientsRegistry.delete(e),this.clientsRegistry.size===0&&this.detachTracker()}static attachTracker(){window.addEventListener("resize",this.flush,{passive:!0,capture:!0}),this.flush()}static detachTracker(){window.removeEventListener("resize",this.flush,{capture:!0}),document.documentElement.style.removeProperty(uo)}};l(Ae,"WindowHeightTracker"),h(Ae,"clientsRegistry",new Set),h(Ae,"flush",U(()=>{document.documentElement.style.setProperty(uo,`${window.innerHeight}px`)},100));var Ee=Ae;var ho=l(r=>{var i;let e=new Intl.Locale(r),t="ltr";return typeof e.getTextInfo=="function"&&e.getTextInfo().direction?t=e.getTextInfo().direction:"textInfo"in e&&((i=e.textInfo)!=null&&i.direction)&&(t=e.textInfo.direction),t},"getLocaleDirection");var pi=l((r,e)=>new Intl.PluralRules(r).select(e),"getPluralForm");var Ul=l(r=>r,"DEFAULT_TRANSFORMER"),hr="{{",fo="}}",po="plural:";function Te(r,e,t={}){var n;let{openToken:i=hr,closeToken:s=fo,transform:o=Ul}=t;for(let a in e){let c=(n=e[a])==null?void 0:n.toString();r=r.replaceAll(i+a+s,typeof c=="string"?o(c):c)}return r}l(Te,"applyTemplateData");function mo(r){let e=[],t=r.indexOf(hr);for(;t!==-1;){let i=r.indexOf(fo,t),s=r.substring(t+2,i);if(s.startsWith(po)){let o=r.substring(t+2,i).replace(po,""),n=o.substring(0,o.indexOf("(")),a=o.substring(o.indexOf("(")+1,o.indexOf(")"));e.push({variable:s,pluralKey:n,countVariable:a})}t=r.indexOf(hr,i)}return e}l(mo,"getPluralObjects");var go=l(({element:r,attribute:e,onSuccess:t,onTimeout:i,timeout:s=300})=>{let o=r.getAttribute(e);if(o!==null){t(o);return}let n=new MutationObserver(u=>{let p=u[u.length-1];c(p)});n.observe(r,{attributes:!0,attributeFilter:[e]});let a=setTimeout(()=>{n.disconnect(),i()},s),c=l(u=>{let p=r.getAttribute(e);u.type==="attributes"&&u.attributeName===e&&p!==null&&(clearTimeout(a),n.disconnect(),t(p))},"handleMutation")},"waitForAttribute");function bo(r){return Object.prototype.toString.call(r)==="[object Object]"}l(bo,"isObject");var Ml=/\W|_/g;function Pl(r){return r.split(Ml).map((e,t)=>e.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+e.slice(1)).join("")}l(Pl,"camelizeString");function _o(r,{ignoreKeys:e}={ignoreKeys:[]}){return Array.isArray(r)?r.map(t=>gt(t,{ignoreKeys:e})):r}l(_o,"camelizeArrayItems");function gt(r,{ignoreKeys:e}={ignoreKeys:[]}){if(Array.isArray(r))return _o(r,{ignoreKeys:e});if(!bo(r))return r;let t={};for(let i of Object.keys(r)){let s=r[i];if(e.includes(i)){t[i]=s;continue}bo(s)?s=gt(s,{ignoreKeys:e}):Array.isArray(s)&&(s=_o(s,{ignoreKeys:e})),t[Pl(i)]=s}return t}l(gt,"camelizeKeys");var Rl=l(r=>new Promise(e=>setTimeout(e,r)),"delay");function _r({libraryName:r,libraryVersion:e,userAgent:t,publicKey:i="",integration:s=""}){let o="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:i,libraryName:r,libraryVersion:e,languageName:o,integration:s});let n=[r,e,i].filter(Boolean).join("/"),a=[o,s].filter(Boolean).join("; ");return`${n} (${a})`}l(_r,"getUserAgent$1");var Fl={factor:2,time:100};function Dl(r,e=Fl){let t=0;function i(s){let o=Math.round(e.time*e.factor**t);return s({attempt:t,retry:l(a=>Rl(a!=null?a:o).then(()=>(t+=1,i(s))),"retry")})}return l(i,"runAttempt"),i(r)}l(Dl,"retrier");var Ar=class Ar extends Error{};l(Ar,"UploadcareError");var Se=Ar,mi=class mi extends Se{constructor(t){super();h(this,"originalProgressEvent");this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,mi.prototype),this.originalProgressEvent=t}};l(mi,"NetworkError");var Vt=mi,_i=l((r,e)=>{r&&(r.aborted?Promise.resolve().then(e):r.addEventListener("abort",()=>e(),{once:!0}))},"onCancel"),gi=class gi extends Se{constructor(t="Request canceled"){super(t);h(this,"isCancel",!0);this.name="CancelError",Object.setPrototypeOf(this,gi.prototype)}};l(gi,"CancelError");var Ct=gi,Nl=500,vo=l(({check:r,interval:e=Nl,timeout:t,signal:i})=>new Promise((s,o)=>{let n,a;_i(i,()=>{n&&clearTimeout(n),o(new Ct("Poll cancelled"))}),t&&(a=setTimeout(()=>{n&&clearTimeout(n),o(new Ct("Timed out"))},t));let c=l(()=>{try{Promise.resolve(r(i)).then(u=>{u?(a&&clearTimeout(a),s(u)):n=setTimeout(c,e)}).catch(u=>{a&&clearTimeout(a),o(u)})}catch(u){a&&clearTimeout(a),o(u)}},"tick");n=setTimeout(c,0)}),"poll"),S={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",maxContentLength:50*1024*1024,retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,multipartMinLastPartSize:1024*1024,maxConcurrentRequests:4,pollingTimeoutMilliseconds:1e4,pusherKey:"79ae88bd931ea68464d9"},yi="application/octet-stream",wo="original",xt=l(({method:r,url:e,data:t,headers:i={},signal:s,onProgress:o})=>new Promise((n,a)=>{let c=new XMLHttpRequest,u=(r==null?void 0:r.toUpperCase())||"GET",p=!1;c.open(u,e,!0),i&&Object.entries(i).forEach(d=>{let[f,m]=d;typeof m!="undefined"&&!Array.isArray(m)&&c.setRequestHeader(f,m)}),c.responseType="text",_i(s,()=>{p=!0,c.abort(),a(new Ct)}),c.onload=()=>{if(c.status!=200)a(new Error(`Error ${c.status}: ${c.statusText}`));else{let d={method:u,url:e,data:t,headers:i||void 0,signal:s,onProgress:o},f=c.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};f.forEach(function(w){let C=w.split(": "),v=C.shift(),x=C.join(": ");v&&typeof v!="undefined"&&(m[v]=x)});let g=c.response,b=c.status;n({request:d,data:g,headers:m,status:b})}},c.onerror=d=>{p||a(new Vt(d))},o&&typeof o=="function"&&(c.upload.onprogress=d=>{d.lengthComputable?o({isComputable:!0,value:d.loaded/d.total}):o({isComputable:!1})}),t?c.send(t):c.send()}),"request");function zl(r,...e){return r}l(zl,"identity");var Bl=l(({name:r})=>r?[r]:[],"getFileOptions"),Vl=zl,jl=l(()=>new FormData,"getFormData"),Co=l(r=>!1,"isBuffer"),vi=l(r=>typeof Blob!="undefined"&&r instanceof Blob,"isBlob"),wi=l(r=>typeof File!="undefined"&&r instanceof File,"isFile"),Ci=l(r=>!!r&&typeof r=="object"&&!Array.isArray(r)&&"uri"in r&&typeof r.uri=="string","isReactNativeAsset"),jt=l(r=>vi(r)||wi(r)||Co()||Ci(r),"isFileData"),Hl=l(r=>typeof r=="string"||typeof r=="number"||typeof r=="undefined","isSimpleValue"),Gl=l(r=>!!r&&typeof r=="object"&&!Array.isArray(r),"isObjectValue"),Wl=l(r=>!!r&&typeof r=="object"&&"data"in r&&jt(r.data),"isFileValue");function xo(r,e,t){if(Array.isArray(t))for(let i of t)xo(r,`${e}[]`,i);else if(Wl(t)){let{name:i,contentType:s}=t,o=Vl(t.data,i,s!=null?s:yi),n=Bl({name:i,contentType:s});r.push([e,o,...n])}else if(Gl(t))for(let[i,s]of Object.entries(t))typeof s!="undefined"&&r.push([`${e}[${i}]`,String(s)]);else Hl(t)&&t&&r.push([e,t.toString()])}l(xo,"collectParams");function Xl(r){let e=[];for(let[t,i]of Object.entries(r))xo(e,t,i);return e}l(Xl,"getFormDataParams");function xi(r){let e=jl(),t=Xl(r);for(let i of t){let[s,o,...n]=i;e.append(s,o,...n)}return e}l(xi,"buildFormData");var bi=class bi extends Se{constructor(t,i,s,o,n){super();h(this,"code");h(this,"request");h(this,"response");h(this,"headers");this.name="UploadError",this.message=t,this.code=i,this.request=s,this.response=o,this.headers=n,Object.setPrototypeOf(this,bi.prototype)}};l(bi,"UploadError");var B=bi,ql=l(r=>{let e=new URLSearchParams;for(let[t,i]of Object.entries(r))i&&typeof i=="object"&&!Array.isArray(i)?Object.entries(i).filter(s=>{var o;return(o=s[1])!=null?o:!1}).forEach(s=>e.set(`${t}[${s[0]}]`,String(s[1]))):Array.isArray(i)?i.forEach(s=>{e.append(`${t}[]`,s)}):typeof i=="string"&&i?e.set(t,i):typeof i=="number"&&e.set(t,i.toString());return e.toString()},"buildSearchParams"),ft=l((r,e,t)=>{let i=new URL(r);return i.pathname=(i.pathname+e).replace("//","/"),t&&(i.search=ql(t)),i.toString()},"getUrl"),Kl="6.14.1",Zl="UploadcareUploadClient",Yl=Kl;function It(r){return _r({libraryName:Zl,libraryVersion:Yl,...r})}l(It,"getUserAgent");var Jl="RequestThrottledError",yo=15e3,Ql=1e3;function ta(r){let{headers:e}=r||{};if(!e||typeof e["retry-after"]!="string")return yo;let t=parseInt(e["retry-after"],10);return Number.isFinite(t)?t*1e3:yo}l(ta,"getTimeoutFromThrottledRequest");function At(r,e){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:i}=e;return Dl(({attempt:s,retry:o})=>r().catch(n=>{if("response"in n&&(n==null?void 0:n.code)===Jl&&s<t)return o(ta(n));if(n instanceof Vt&&s<i)return o((s+1)*Ql);throw n}))}l(At,"retryIfFailed");var Ao=l(r=>{let e="";return(vi(r)||wi(r)||Ci(r))&&(e=r.type),e||yi},"getContentType"),Eo=l(r=>{let e="";return wi(r)&&r.name?e=r.name:vi(r)||Co()?e="":Ci(r)&&r.name&&(e=r.name),e||wo},"getFileName");function yr(r){return typeof r=="undefined"||r==="auto"?"auto":r?"1":"0"}l(yr,"getStoreValue");function ea(r,{publicKey:e,fileName:t,contentType:i,baseURL:s=S.baseURL,secureSignature:o,secureExpire:n,store:a,signal:c,onProgress:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=S.retryNetworkErrorMaxTimes,metadata:b}){return At(()=>xt({method:"POST",url:ft(s,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":It({publicKey:e,integration:d,userAgent:f})},data:xi({file:{data:r,name:t||Eo(r),contentType:i||Ao(r)},UPLOADCARE_PUB_KEY:e,UPLOADCARE_STORE:yr(a),signature:o,expire:n,source:p,metadata:b}),signal:c,onProgress:u}).then(({data:w,headers:C,request:v})=>{let x=gt(JSON.parse(w));if("error"in x)throw new B(x.error.content,x.error.errorCode,v,x,C);return x}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}l(ea,"base");var fr;(function(r){r.Token="token",r.FileInfo="file_info"})(fr||(fr={}));function ia(r,{publicKey:e,baseURL:t=S.baseURL,store:i,fileName:s,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:c,source:u="url",signal:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=S.retryNetworkErrorMaxTimes,metadata:b}){return At(()=>xt({method:"POST",headers:{"X-UC-User-Agent":It({publicKey:e,integration:d,userAgent:f})},url:ft(t,"/from_url/",{jsonerrors:1,pub_key:e,source_url:r,store:yr(i),filename:s,check_URL_duplicates:o?1:void 0,save_URL_duplicates:n?1:void 0,signature:a,expire:c,source:u,metadata:b}),signal:p}).then(({data:w,headers:C,request:v})=>{let x=gt(JSON.parse(w));if("error"in x)throw new B(x.error.content,x.error.errorCode,v,x,C);return x}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}l(ia,"fromUrl");var W;(function(r){r.Unknown="unknown",r.Waiting="waiting",r.Progress="progress",r.Error="error",r.Success="success"})(W||(W={}));var ra=l(r=>"status"in r&&r.status===W.Error,"isErrorResponse");function sa(r,{publicKey:e,baseURL:t=S.baseURL,signal:i,integration:s,userAgent:o,retryThrottledRequestMaxTimes:n=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=S.retryNetworkErrorMaxTimes}={}){return At(()=>xt({method:"GET",headers:e?{"X-UC-User-Agent":It({publicKey:e,integration:s,userAgent:o})}:void 0,url:ft(t,"/from_url/status/",{jsonerrors:1,token:r}),signal:i}).then(({data:c,headers:u,request:p})=>{let d=gt(JSON.parse(c));if("error"in d&&!ra(d))throw new B(d.error.content,d.error.errorCode,p,d,u);return d}),{retryNetworkErrorMaxTimes:a,retryThrottledRequestMaxTimes:n})}l(sa,"fromUrlStatus");function oa(r,{publicKey:e,baseURL:t=S.baseURL,jsonpCallback:i,secureSignature:s,secureExpire:o,signal:n,source:a,integration:c,userAgent:u,retryThrottledRequestMaxTimes:p=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=S.retryNetworkErrorMaxTimes}){return At(()=>xt({method:"POST",headers:{"X-UC-User-Agent":It({publicKey:e,integration:c,userAgent:u})},url:ft(t,"/group/",{jsonerrors:1}),data:xi({files:r,callback:i,pub_key:e,signature:s,expire:o,source:a}),signal:n}).then(({data:f,headers:m,request:g})=>{let b=gt(JSON.parse(f));if("error"in b)throw new B(b.error.content,b.error.errorCode,g,b,m);return b}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:p})}l(oa,"group");function To(r,{publicKey:e,baseURL:t=S.baseURL,signal:i,source:s,integration:o,userAgent:n,retryThrottledRequestMaxTimes:a=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=S.retryNetworkErrorMaxTimes}){return At(()=>xt({method:"GET",headers:{"X-UC-User-Agent":It({publicKey:e,integration:o,userAgent:n})},url:ft(t,"/info/",{jsonerrors:1,pub_key:e,file_id:r,source:s}),signal:i}).then(({data:u,headers:p,request:d})=>{let f=gt(JSON.parse(u));if("error"in f)throw new B(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c})}l(To,"info");function na(r,{publicKey:e,contentType:t,fileName:i,multipartChunkSize:s=S.multipartChunkSize,baseURL:o="",secureSignature:n,secureExpire:a,store:c,signal:u,source:p="local",integration:d,userAgent:f,retryThrottledRequestMaxTimes:m=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=S.retryNetworkErrorMaxTimes,metadata:b}){return At(()=>xt({method:"POST",url:ft(o,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":It({publicKey:e,integration:d,userAgent:f})},data:xi({filename:i||wo,size:r,content_type:t||yi,part_size:s,UPLOADCARE_STORE:yr(c),UPLOADCARE_PUB_KEY:e,signature:n,expire:a,source:p,metadata:b}),signal:u}).then(({data:w,headers:C,request:v})=>{let x=gt(JSON.parse(w));if("error"in x)throw new B(x.error.content,x.error.errorCode,v,x,C);return x.parts=Object.keys(x.parts).map(P=>x.parts[Number(P)]),x}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})}l(na,"multipartStart");function la(r,e,{contentType:t,signal:i,onProgress:s,retryThrottledRequestMaxTimes:o=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=S.retryNetworkErrorMaxTimes}){return At(()=>xt({method:"PUT",url:e,data:r,onProgress:s,signal:i,headers:{"Content-Type":t||yi}}).then(a=>(s&&s({isComputable:!0,value:1}),a)).then(({status:a})=>({code:a})),{retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n})}l(la,"multipartUpload");function aa(r,{publicKey:e,baseURL:t=S.baseURL,source:i="local",signal:s,integration:o,userAgent:n,retryThrottledRequestMaxTimes:a=S.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=S.retryNetworkErrorMaxTimes}){return At(()=>xt({method:"POST",url:ft(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":It({publicKey:e,integration:o,userAgent:n})},data:xi({uuid:r,UPLOADCARE_PUB_KEY:e,source:i}),signal:s}).then(({data:u,headers:p,request:d})=>{let f=gt(JSON.parse(u));if("error"in f)throw new B(f.error.content,f.error.errorCode,d,f,p);return f}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:c})}l(aa,"multipartComplete");function vr(r,{publicKey:e,baseURL:t,source:i,integration:s,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a,signal:c,onProgress:u}){return vo({check:p=>To(r,{publicKey:e,baseURL:t,signal:p,source:i,integration:s,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a}).then(d=>d.isReady?d:(u&&u({isComputable:!0,value:1}),!1)),signal:c})}l(vr,"isReadyPoll");function ca(r){return"defaultEffects"in r}l(ca,"isGroupFileInfo");var Er=class Er{constructor(e,{baseCDN:t=S.baseCDN,fileName:i}={}){h(this,"uuid");h(this,"name",null);h(this,"size",null);h(this,"isStored",null);h(this,"isImage",null);h(this,"mimeType",null);h(this,"cdnUrl",null);h(this,"s3Url",null);h(this,"originalFilename",null);h(this,"imageInfo",null);h(this,"videoInfo",null);h(this,"contentInfo",null);h(this,"metadata",null);h(this,"s3Bucket",null);h(this,"defaultEffects",null);let{uuid:s,s3Bucket:o}=e,n=ft(t,`${s}/`),a=o?ft(`https://${o}.s3.amazonaws.com/`,`${s}/${e.filename}`):null;this.uuid=s,this.name=i||e.filename,this.size=e.size,this.isStored=e.isStored,this.isImage=e.isImage,this.mimeType=e.mimeType,this.cdnUrl=n,this.originalFilename=e.originalFilename,this.imageInfo=e.imageInfo,this.videoInfo=e.videoInfo,this.contentInfo=e.contentInfo,this.metadata=e.metadata||null,this.s3Bucket=o||null,this.s3Url=a,ca(e)&&(this.defaultEffects=e.defaultEffects)}};l(Er,"UploadcareFile");var mt=Er,ua=l((r,{publicKey:e,fileName:t,baseURL:i,secureSignature:s,secureExpire:o,store:n,contentType:a,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,baseCDN:b,metadata:w})=>ea(r,{publicKey:e,fileName:t,contentType:a,baseURL:i,secureSignature:s,secureExpire:o,store:n,signal:c,onProgress:u,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,metadata:w}).then(({file:C})=>vr(C,{publicKey:e,baseURL:i,source:p,integration:d,userAgent:f,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:u,signal:c})).then(C=>new mt(C,{baseCDN:b})),"uploadDirect"),ha=l((r,{publicKey:e,fileName:t,baseURL:i,signal:s,onProgress:o,source:n,integration:a,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p,baseCDN:d})=>To(r,{publicKey:e,baseURL:i,signal:s,source:n,integration:a,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p}).then(f=>new mt(f,{baseCDN:d,fileName:t})).then(f=>(o&&o({isComputable:!0,value:1}),f)),"uploadFromUploaded"),da=l((r,{signal:e}={})=>{let t=null,i=null,s=r.map(()=>new AbortController),o=l(n=>()=>{i=n,s.forEach((a,c)=>c!==n&&a.abort())},"createStopRaceCallback");return _i(e,()=>{s.forEach(n=>n.abort())}),Promise.all(r.map((n,a)=>{let c=o(a);return Promise.resolve().then(()=>n({stopRace:c,signal:s[a].signal})).then(u=>(c(),u)).catch(u=>(t=u,null))})).then(n=>{if(i===null)throw t;return n[i]})},"race"),pa=window.WebSocket,Tr=class Tr{constructor(){h(this,"events",Object.create({}))}emit(e,t){var i;(i=this.events[e])==null||i.forEach(s=>s(t))}on(e,t){this.events[e]=this.events[e]||[],this.events[e].push(t)}off(e,t){t?this.events[e]=this.events[e].filter(i=>i!==t):this.events[e]=[]}};l(Tr,"Events");var mr=Tr,fa=l((r,e)=>r==="success"?{status:W.Success,...e}:r==="progress"?{status:W.Progress,...e}:{status:W.Error,...e},"response"),Sr=class Sr{constructor(e,t=3e4){h(this,"key");h(this,"disconnectTime");h(this,"ws");h(this,"queue",[]);h(this,"isConnected",!1);h(this,"subscribers",0);h(this,"emmitter",new mr);h(this,"disconnectTimeoutId",null);this.key=e,this.