@uploadcare/file-uploader
Version:
Building blocks for Uploadcare products integration
7 lines • 308 kB
JavaScript
/**
* @license
* Package: @uploadcare/file-uploader@1.28.0 (MIT)
* License: https://github.com/uploadcare/blob/main/LICENSE
* Built: 2026-04-03T13:57:48.690Z
*/
var pl=Object.defineProperty;var hl=Object.getOwnPropertyDescriptor;var p=(r,i,t,e)=>{for(var o=e>1?void 0:e?hl(i,t):i,s=r.length-1,n;s>=0;s--)(n=r[s])&&(o=(e?n(i,t,o):n(o))||o);return e&&o&&pl(i,t,o),o};var Ct=[],Wt=0,Ai=4,ks=r=>{let i=[],t={get(){return t.lc||t.listen(()=>{})(),t.value},lc:0,listen(e){return t.lc=i.push(e),()=>{for(let s=Wt+Ai;s<Ct.length;)Ct[s]===e?Ct.splice(s,Ai):s+=Ai;let o=i.indexOf(e);~o&&(i.splice(o,1),--t.lc||t.off());}},notify(e,o){let s=!Ct.length;for(let n of i)Ct.push(n,t.value,e,o);if(s){for(Wt=0;Wt<Ct.length;Wt+=Ai)Ct[Wt](Ct[Wt+1],Ct[Wt+2],Ct[Wt+3]);Ct.length=0;}},off(){},set(e){let o=t.value;o!==e&&(t.value=e,t.notify(o));},subscribe(e){let o=t.listen(e);return e(t.value),o},value:r};return t};function ki(r,i,t){let e=new Set(i).add(void 0);return r.listen((o,s,n)=>{e.has(n)&&t(o,s,n);})}function to(r,i,t){let e=ki(r,i,t);return t(r.value),e}var eo=(r={})=>{let i=ks(r);return i.setKey=function(t,e){let o=i.value;typeof e>"u"&&t in i.value?(i.value={...i.value},delete i.value[t],i.notify(o,t)):i.value[t]!==e&&(i.value={...i.value,[t]:e},i.notify(o,t));},i};var B=class r{static{this.De=new Map;}constructor(i,t){this.Q=i,this.gt=t;}get id(){return this.Q}pub(i,t){i in this.gt.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.gt.setKey(i,t);}sub(i,t,e=true){return (e?to:ki)(this.gt,[i],s=>{t(s[i]);})}read(i){return i in this.gt.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.gt.get()[i]}add(i,t,e=false){(!(i in this.gt.get())||e)&&this.gt.setKey(i,t);}has(i){return i in this.gt.get()}get store(){return this.gt.get()}static registerCtx(i,t){if(r.De.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=eo(i);return r.De.set(t,e),new r(t,e)}static deleteCtx(i){r.De.delete(i);}static getCtx(i){let t=r.De.get(i);return t?new r(i,t):null}static hasCtx(i){return r.De.has(i)}};var Oi=globalThis,Ii=Oi.ShadowRoot&&(Oi.ShadyCSS===void 0||Oi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ms=Symbol(),Os=new WeakMap,Mi=class{constructor(i,t,e){if(this.zl=true,e!==Ms)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=i,this.t=t;}get styleSheet(){let i=this.o,t=this.t;if(Ii&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=Os.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&Os.set(t,i));}return i}toString(){return this.cssText}},Is=r=>new Mi(typeof r=="string"?r:r+"",void 0,Ms);var Ls=(r,i)=>{if(Ii)r.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),o=Oi.litNonce;o!==void 0&&e.setAttribute("nonce",o),e.textContent=t.cssText,r.appendChild(e);}},io=Ii?r=>r:r=>r instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return Is(t)})(r):r;var{is:fl,defineProperty:gl,getOwnPropertyDescriptor:vl,getOwnPropertyNames:yl,getOwnPropertySymbols:bl,getPrototypeOf:wl}=Object,Li=globalThis,Us=Li.trustedTypes,El=Us?Us.emptyScript:"",Tl=Li.reactiveElementPolyfillSupport,Xe=(r,i)=>r,Ye={toAttribute(r,i){switch(i){case Boolean:r=r?El:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r);}return r},fromAttribute(r,i){let t=r;switch(i){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r);}catch{t=null;}}return t}},Ui=(r,i)=>!fl(r,i),Ps={attribute:true,type:String,converter:Ye,reflect:false,useDefault:false,hasChanged:Ui};Symbol.metadata??=Symbol("metadata"),Li.litPropertyMetadata??=new WeakMap;var Vt=class extends HTMLElement{static addInitializer(i){this.br(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.vi&&[...this.vi.keys()]}static createProperty(i,t=Ps){if(t.state&&(t.attribute=false),this.br(),this.prototype.hasOwnProperty(i)&&((t=Object.create(t)).wrapped=true),this.elementProperties.set(i,t),!t.noAccessor){let e=Symbol(),o=this.getPropertyDescriptor(i,e,t);o!==void 0&&gl(this.prototype,i,o);}}static getPropertyDescriptor(i,t,e){let{get:o,set:s}=vl(this.prototype,i)??{get(){return this[t]},set(n){this[t]=n;}};return {get:o,set(n){let a=o?.call(this);s?.call(this,n),this.requestUpdate(i,a,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??Ps}static br(){if(this.hasOwnProperty(Xe("elementProperties")))return;let i=wl(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(Xe("finalized")))return;if(this.finalized=true,this.br(),this.hasOwnProperty(Xe("properties"))){let t=this.properties,e=[...yl(t),...bl(t)];for(let o of e)this.createProperty(o,t[o]);}let i=this[Symbol.metadata];if(i!==null){let t=litPropertyMetadata.get(i);if(t!==void 0)for(let[e,o]of t)this.elementProperties.set(e,o);}this.vi=new Map;for(let[t,e]of this.elementProperties){let o=this.wr(t,e);o!==void 0&&this.vi.set(o,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(i){let t=[];if(Array.isArray(i)){let e=new Set(i.flat(1/0).reverse());for(let o of e)t.unshift(io(o));}else i!==void 0&&t.push(io(i));return t}static wr(i,t){let e=t.attribute;return e===false?void 0:typeof e=="string"?e:typeof i=="string"?i.toLowerCase():void 0}constructor(){super(),this.yi=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.ue=null,this.Hl();}Hl(){this.Er=new Promise(i=>this.enableUpdating=i),this.Kt=new Map,this.Kl(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this.Fe??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.Fe?.delete(i);}Kl(){let i=new Map,t=this.constructor.elementProperties;for(let e of t.keys())this.hasOwnProperty(e)&&(i.set(e,this[e]),delete this[e]);i.size>0&&(this.yi=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ls(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.Fe?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this.Fe?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.Tr(i,e);}jl(i,t){let e=this.constructor.elementProperties.get(i),o=this.constructor.wr(i,e);if(o!==void 0&&e.reflect===true){let s=(e.converter?.toAttribute!==void 0?e.converter:Ye).toAttribute(t,e.type);this.ue=i,s==null?this.removeAttribute(o):this.setAttribute(o,s),this.ue=null;}}Tr(i,t){let e=this.constructor,o=e.vi.get(i);if(o!==void 0&&this.ue!==o){let s=e.getPropertyOptions(o),n=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:Ye;this.ue=o;let a=n.fromAttribute(t,s.type);this[o]=a??this.xr?.get(o)??a,this.ue=null;}}requestUpdate(i,t,e,o=false,s){if(i!==void 0){let n=this.constructor;if(o===false&&(s=this[i]),e??=n.getPropertyOptions(i),!((e.hasChanged??Ui)(s,t)||e.useDefault&&e.reflect&&s===this.xr?.get(i)&&!this.hasAttribute(n.wr(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.Er=this.Gl());}C(i,t,{useDefault:e,reflect:o,wrapped:s},n){e&&!(this.xr??=new Map).has(i)&&(this.xr.set(i,n??t??this[i]),s!==true||n!==void 0)||(this.Kt.has(i)||(this.hasUpdated||e||(t=void 0),this.Kt.set(i,t)),o===true&&this.ue!==i&&(this.bs??=new Set).add(i));}async Gl(){this.isUpdatePending=true;try{await this.Er;}catch(t){Promise.reject(t);}let i=this.scheduleUpdate();return i!=null&&await i,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this.yi){for(let[o,s]of this.yi)this[o]=s;this.yi=void 0;}let e=this.constructor.elementProperties;if(e.size>0)for(let[o,s]of e){let{wrapped:n}=s,a=this[o];n!==true||this.Kt.has(o)||a===void 0||this.C(o,void 0,s,a);}}let i=false,t=this.Kt;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.Fe?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.Cr();}catch(e){throw i=false,this.Cr(),e}i&&this.ql(t);}willUpdate(i){}ql(i){this.Fe?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}Cr(){this.Kt=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.Er}shouldUpdate(i){return true}update(i){this.bs&&=this.bs.forEach(t=>this.jl(t,this[t])),this.Cr();}updated(i){}firstUpdated(i){}};Vt.elementStyles=[],Vt.shadowRootOptions={mode:"open"},Vt[Xe("elementProperties")]=new Map,Vt[Xe("finalized")]=new Map,Tl?.({ReactiveElement:Vt}),(Li.reactiveElementVersions??=[]).push("2.1.2");var oo=globalThis,Rs=r=>r,Pi=oo.trustedTypes,$s=Pi?Pi.createPolicy("lit-html",{createHTML:r=>r}):void 0,so="$lit$",_t=`lit$${Math.random().toFixed(9).slice(2)}$`,no="?"+_t,xl=`<${no}>`,pe=document,Je=()=>pe.createComment(""),ti=r=>r===null||typeof r!="object"&&typeof r!="function",ao=Array.isArray,Bs=r=>ao(r)||typeof r?.[Symbol.iterator]=="function",ro=`[ \f\r]`,Qe=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ds=/-->/g,Fs=/>/g,ue=RegExp(`>|${ro}(?:([^\\s"'>=/]+)(${ro}*=${ro}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),Vs=/'/g,_s=/"/g,zs=/^(?:script|style|textarea|title)$/i,lo=r=>(i,...t)=>({jt:r,strings:i,values:t}),v=lo(1),J=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),Ns=new WeakMap,de=pe.createTreeWalker(pe,129);function Hs(r,i){if(!ao(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return $s!==void 0?$s.createHTML(i):i}var js=(r,i)=>{let t=r.length-1,e=[],o,s=i===2?"<svg>":i===3?"<math>":"",n=Qe;for(let a=0;a<t;a++){let l=r[a],c,d,u=-1,h=0;for(;h<l.length&&(n.lastIndex=h,d=n.exec(l),d!==null);)h=n.lastIndex,n===Qe?d[1]==="!--"?n=Ds:d[1]!==void 0?n=Fs:d[2]!==void 0?(zs.test(d[2])&&(o=RegExp("</"+d[2],"g")),n=ue):d[3]!==void 0&&(n=ue):n===ue?d[0]===">"?(n=o??Qe,u=-1):d[1]===void 0?u=-2:(u=n.lastIndex-d[2].length,c=d[1],n=d[3]===void 0?ue:d[3]==='"'?_s:Vs):n===_s||n===Vs?n=ue:n===Ds||n===Fs?n=Qe:(n=ue,o=void 0);let m=n===ue&&r[a+1].startsWith("/>")?" ":"";s+=n===Qe?l+xl:u>=0?(e.push(c),l.slice(0,u)+so+l.slice(u)+_t+m):l+_t+(u===-2?a:m);}return [Hs(r,s+(r[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},ei=class r{constructor({strings:i,jt:t},e){let o;this.parts=[];let s=0,n=0,a=i.length-1,l=this.parts,[c,d]=js(i,t);if(this.el=r.createElement(c,e),de.currentNode=this.el.content,t===2||t===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes);}for(;(o=de.nextNode())!==null&&l.length<a;){if(o.nodeType===1){if(o.hasAttributes())for(let u of o.getAttributeNames())if(u.endsWith(so)){let h=d[n++],m=o.getAttribute(u).split(_t),g=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:g[2],strings:m,ctor:g[1]==="."?$i:g[1]==="?"?Di:g[1]==="@"?Fi:me}),o.removeAttribute(u);}else u.startsWith(_t)&&(l.push({type:6,index:s}),o.removeAttribute(u));if(zs.test(o.tagName)){let u=o.textContent.split(_t),h=u.length-1;if(h>0){o.textContent=Pi?Pi.emptyScript:"";for(let m=0;m<h;m++)o.append(u[m],Je()),de.nextNode(),l.push({type:2,index:++s});o.append(u[h],Je());}}}else if(o.nodeType===8)if(o.data===no)l.push({type:2,index:s});else {let u=-1;for(;(u=o.data.indexOf(_t,u+1))!==-1;)l.push({type:7,index:s}),u+=_t.length-1;}s++;}}static createElement(i,t){let e=pe.createElement("template");return e.innerHTML=i,e}};function he(r,i,t=r,e){if(i===J)return i;let o=e!==void 0?t.Wl?.[e]:t.Zl,s=ti(i)?void 0:i.Sr;return o?.constructor!==s&&(o?.Es?.(false),s===void 0?o=void 0:(o=new s(r),o.Ar(r,t,e)),e!==void 0?(t.Wl??=[])[e]=o:t.Zl=o),o!==void 0&&(i=he(r,o.Xl(r,i.values),o,e)),i}var Ri=class{constructor(i,t){this.Ts=[],this.vt=void 0,this.xs=i,this.c=t;}get parentNode(){return this.c.parentNode}get W(){return this.c.W}u(i){let{el:{content:t},parts:e}=this.xs,o=(i?.creationScope??pe).importNode(t,true);de.currentNode=o;let s=de.nextNode(),n=0,a=0,l=e[0];for(;l!==void 0;){if(n===l.index){let c;l.type===2?c=new Ae(s,s.nextSibling,this,i):l.type===1?c=new l.ctor(s,l.name,l.strings,this,i):l.type===6&&(c=new Vi(s,this,i)),this.Ts.push(c),l=e[++a];}n!==l?.index&&(s=de.nextNode(),n++);}return de.currentNode=pe,o}p(i){let t=0;for(let e of this.Ts)e!==void 0&&(e.strings!==void 0?(e.yt(i,e,t),t+=e.strings.length-2):e.yt(i[t])),t++;}},Ae=class r{get W(){return this.c?.W??this.Cs}constructor(i,t,e,o){this.type=2,this.i=P,this.vt=void 0,this.St=i,this.de=t,this.c=e,this.options=o,this.Cs=o?.isConnected??true;}get parentNode(){let i=this.St.parentNode,t=this.c;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.St}get endNode(){return this.de}yt(i,t=this){i=he(this,i,t),ti(i)?i===P||i==null||i===""?(this.i!==P&&this.pe(),this.i=P):i!==this.i&&i!==J&&this.Ss(i):i.jt!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):Bs(i)?this.k(i):this.Ss(i);}O(i){return this.St.parentNode.insertBefore(i,this.de)}T(i){this.i!==i&&(this.pe(),this.i=this.O(i));}Ss(i){this.i!==P&&ti(this.i)?this.St.nextSibling.data=i:this.T(pe.createTextNode(i)),this.i=i;}$(i){let{values:t,jt:e}=i,o=typeof e=="number"?this.Yl(i):(e.el===void 0&&(e.el=ei.createElement(Hs(e.h,e.h[0]),this.options)),e);if(this.i?.xs===o)this.i.p(t);else {let s=new Ri(o,this),n=s.u(this.options);s.p(t),this.T(n),this.i=s;}}Yl(i){let t=Ns.get(i.strings);return t===void 0&&Ns.set(i.strings,t=new ei(i)),t}k(i){ao(this.i)||(this.i=[],this.pe());let t=this.i,e,o=0;for(let s of i)o===t.length?t.push(e=new r(this.O(Je()),this.O(Je()),this,this.options)):e=t[o],e.yt(s),o++;o<t.length&&(this.pe(e&&e.de.nextSibling,o),t.length=o);}pe(i=this.St.nextSibling,t){for(this.bi?.(false,true,t);i!==this.de;){let e=Rs(i).nextSibling;Rs(i).remove(),i=e;}}setConnected(i){this.c===void 0&&(this.Cs=i,this.bi?.(i));}},me=class{get tagName(){return this.element.tagName}get W(){return this.c.W}constructor(i,t,e,o,s){this.type=1,this.i=P,this.vt=void 0,this.element=i,this.name=t,this.c=o,this.options=s,e.length>2||e[0]!==""||e[1]!==""?(this.i=Array(e.length-1).fill(new String),this.strings=e):this.i=P;}yt(i,t=this,e,o){let s=this.strings,n=false;if(s===void 0)i=he(this,i,t,0),n=!ti(i)||i!==this.i&&i!==J,n&&(this.i=i);else {let a=i,l,c;for(i=s[0],l=0;l<s.length-1;l++)c=he(this,a[e+l],t,l),c===J&&(c=this.i[l]),n||=!ti(c)||c!==this.i[l],c===P?i=P:i!==P&&(i+=(c??"")+s[l+1]),this.i[l]=c;}n&&!o&&this.j(i);}j(i){i===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},$i=class extends me{constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===P?void 0:i;}},Di=class extends me{constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==P);}},Fi=class extends me{constructor(i,t,e,o,s){super(i,t,e,o,s),this.type=5;}yt(i,t=this){if((i=he(this,i,t,0)??P)===J)return;let e=this.i,o=i===P&&e!==P||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,s=i!==P&&(e===P||o);o&&this.element.removeEventListener(this.name,this,e),s&&this.element.addEventListener(this.name,this,i),this.i=i;}handleEvent(i){typeof this.i=="function"?this.i.call(this.options?.host??this.element,i):this.i.handleEvent(i);}},Vi=class{constructor(i,t,e){this.element=i,this.type=6,this.vt=void 0,this.c=t,this.options=e;}get W(){return this.c.W}yt(i){he(this,i);}},Ks={I:Ae},Cl=oo.litHtmlPolyfillSupport;Cl?.(ei,Ae),(oo.litHtmlVersions??=[]).push("3.3.2");var Gs=(r,i,t)=>{let e=t?.renderBefore??i,o=e.Ql;if(o===void 0){let s=t?.renderBefore??null;e.Ql=o=new Ae(i.insertBefore(Je(),s),s,void 0,t??{});}return o.yt(r),o};var co=globalThis,yt=class extends Vt{constructor(){super(...arguments),this.renderOptions={host:this},this.kr=void 0;}createRenderRoot(){let i=super.createRenderRoot();return this.renderOptions.renderBefore??=i.firstChild,i}update(i){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(i),this.kr=Gs(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.kr?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.kr?.setConnected(false);}render(){return J}};yt.np=true,yt.finalized=true,co.litElementHydrateSupport?.({LitElement:yt});var Sl=co.litElementPolyfillSupport;Sl?.({LitElement:yt});(co.litElementVersions??=[]).push("4.2.2");var Al=/\\([0-9a-fA-F]{1,6} ?)/g;function kl(r){return r.length<2?false:(r[0]==='"'||r[0]==="'")&&(r[r.length-1]==='"'||r[r.length-1]==="'")}function Ol(r){let i=r;return (i[0]==='"'||i[0]==="'")&&(i=i.slice(1)),(i[i.length-1]==='"'||i[i.length-1]==="'")&&(i=i.slice(0,-1)),i}function Ml(r){let i="",t="";for(let e=0;e<r.length;e++){let o=r[e+1];r[e]==="\\"&&o==='"'?(i+='\\"',e++):r[e]==='"'&&t!=="\\"?i+='\\"':i+=r[e],t=r[e]??"";}return i}function qs(r){let i=r;kl(r)&&(i=Ol(i),i=i.replace(Al,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=Ml(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}function ke(r){class i extends r{constructor(){super(...arguments);this.As=null;this.Or=null;}getCssData(o,s=false){let n=this.As??Object.create(null);if(!Object.keys(n).includes(o)||!n[o]){this.Or||(this.Or=window.getComputedStyle(this));let a=this.Or.getPropertyValue(o).trim();try{n[o]=qs(a);}catch(l){s||console.warn(`CSS Data error: ${o}`,l),n[o]=null;}}return this.As=n,n[o]}}return i}function _i(r){class i extends r{constructor(){super(...arguments);this.willYield=true;this.Gt={};this.qt=null;this.wi=false;}createRenderRoot(){return this}connectedCallback(){this.qt||(this.qt=Array.from(this.childNodes)),super.connectedCallback();}Jl(){if(this.wi)return;this.wi=true,this.Gt={};let o=Array.from(this.childNodes),s=o.length?o:this.qt??[];for(let n of s){let a=this.ks(n),l=this.Gt[a]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),l.push(n),this.Gt[a]=l;}this.qt=null;}ks(o){return o instanceof Comment&&o.nextSibling instanceof Element?this.ks(o.nextSibling):"contentFor"in o?o.contentFor||"":o instanceof Element&&o.hasAttribute("content-for")&&o.getAttribute("content-for")||""}tc(o){return !o.textContent||!o.textContent.trim()}ec(o){let s=this.Gt[o];return !s||s.every(n=>n instanceof Comment||n instanceof Text&&this.tc(n))}update(o){!this.hasUpdated&&this.willYield&&this.Jl(),super.update(o);}yield(o,s){if(o===""&&!this.Gt[o]&&!this.wi&&this.qt?.length){let a=[];for(let l of this.qt)l instanceof Element&&(l.removeAttribute("slot"),l.removeAttribute("content-for")),a.push(l);this.Gt[o]=a,this.wi=true,this.qt=null;}let n=this.Gt[o];return v` ${n} ${this.ec(o)?s:void 0} `}}return i}function Oe(r){class i extends r{static reg(e){let o=this,s=window.customElements.get(e);if(s){s!==o&&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,o);}}return i}var Zt=class extends Event{constructor(i,t,e,o){super("context-request",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t,this.callback=e,this.subscribe=o??false;}};var Me=class{constructor(i,t,e,o){if(this.subscribe=false,this.provided=false,this.value=void 0,this.t=(s,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=false,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=true,this.callback&&this.callback(s,n)),this.unsubscribe=n;},this.host=i,t.context!==void 0){let s=t;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??false;}else this.context=t,this.callback=e,this.subscribe=o??false;this.host.addController(this);}hostConnected(){this.dispatchRequest();}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0);}dispatchRequest(){this.host.dispatchEvent(new Zt(this.context,this.host,this.t,this.subscribe));}};var Ni=class{get value(){return this.o}set value(i){this.setValue(i);}setValue(i,t=false){let e=t||!Object.is(i,this.o);this.o=i,e&&this.updateObservers();}constructor(i){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:e}]of this.subscriptions)t(this.o,e);},i!==void 0&&(this.value=i);}addCallback(i,t,e){if(!e)return void i(this.value);this.subscriptions.has(i)||this.subscriptions.set(i,{disposer:()=>{this.subscriptions.delete(i);},consumerHost:t});let{disposer:o}=this.subscriptions.get(i);i(this.value,o);}clearCallbacks(){this.subscriptions.clear();}};var uo=class extends Event{constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},Ie=class extends Ni{constructor(i,t,e){super(t.context!==void 0?t.initialValue:e),this.onContextRequest=o=>{if(o.context!==this.context)return;let s=o.contextTarget??o.composedPath()[0];s!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,s,o.subscribe));},this.onProviderRequest=o=>{if(o.context!==this.context||(o.contextTarget??o.composedPath()[0])===this.host)return;let s=new Set;for(let[n,{consumerHost:a}]of this.subscriptions)s.has(n)||(s.add(n),a.dispatchEvent(new Zt(this.context,a,n,true)));o.stopPropagation();},this.host=i,t.context!==void 0?this.context=t.context:this.context=t,this.attachListeners(),this.host.addController?.(this);}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest);}hostConnected(){this.host.dispatchEvent(new uo(this.context,this.host));}};var Ll={attribute:true,type:String,converter:Ye,reflect:false,hasChanged:Ui},Ul=(r=Ll,i,t)=>{let{kind:e,metadata:o}=t,s=globalThis.litPropertyMetadata.get(o);if(s===void 0&&globalThis.litPropertyMetadata.set(o,s=new Map),e==="setter"&&((r=Object.create(r)).wrapped=true),s.set(t.name,r),e==="accessor"){let{name:n}=t;return {set(a){let l=i.get.call(this);i.set.call(this,a),this.requestUpdate(n,l,r,true,a);},init(a){return a!==void 0&&this.C(n,void 0,r,a),a}}}if(e==="setter"){let{name:n}=t;return function(a){let l=this[n];i.call(this,a),this.requestUpdate(n,l,r,true,a);}}throw Error("Unsupported decorator location: "+e)};function y(r){return (i,t)=>typeof t=="object"?Ul(r,i,t):((e,o,s)=>{let n=o.hasOwnProperty(s);return o.constructor.createProperty(s,e),n?Object.getOwnPropertyDescriptor(o,s):void 0})(r,i,t)}function f(r){return y({...r,state:true,attribute:false})}function $(r,i){let t,e=((...o)=>{t&&clearTimeout(t),t=setTimeout(()=>r(...o),i);});return e.cancel=()=>{t&&clearTimeout(t);},e}var Ws="ctx-name-context";function zi(){return function(r){class i extends r{constructor(...o){super(...o);this.J=null;this.Ne=false;this.Mr=false;this.Ir=void 0;this.he=new Map;this.Ve=new Set;this.init$={};this.ctxOwner=false;this.Ei=void 0;this.Ti=false;this.ctxName=this.Pt;this.Rt=false;this.Ei=this.getAttribute("ctx-name")||void 0,this.ctxName=this.Pt,this.ic=new Me(this,{context:Ws,callback:s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.Is=s,this.Ms();},subscribe:true});}static set template(o){console.error("Caution: static 'template' property is deprecated and has no effect. See https://github.com/uploadcare/file-uploader/releases/tag/v1.25.0 for details.");}get Os(){return this.Ei}set Os(o){let s=o??void 0;this.Ei!==s&&(this.Ei=s,this.Ms());}shouldUpdate(o){return this.Rt?super.shouldUpdate(o):false}get Pt(){return this.Os||this.Is||void 0}Ms(){if(this.ctxName=this.Pt,!(!this.ctxName||this.Ne)){if(this.isConnected){this.Lr();return}this.Ti=true;}}willUpdate(o){super.willUpdate(o),this.ctxName=this.Pt,this.ctxName&&(this.Ir?this.Ir.setValue(this.ctxName):this.Ir=new Ie(this,{context:Ws,initialValue:this.ctxName}));}Ls(){if(!(!this.J||this.he.size===0)){for(let[o,{value:s,rewrite:n}]of this.he)this.J.add(o,s,n);this.he.clear();}}Us(){return !this.J&&this.Pt&&this.Ur(),this.J&&this.Ls(),this.J}xi(){let o=this.Us();if(!o)throw new Error("SymbioteMixin: Shared context is not initialized.");return o}Ur(){let o=this.init$,s=this.Pt;if(!s){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.J){this.J=B.getCtx(s)??B.registerCtx(o,s);for(let[n,a]of Object.entries(this.init$))this.J.add(n,a,this.ctxOwner);this.Ls();}}get $(){return this.Pt&&this.Ur(),new Proxy({},{get:(o,s)=>{if(typeof s=="string")return this.J?.read(s)},set:(o,s,n)=>(typeof s!="string"||this.J?.pub(s,n),true)})}sub(o,s,n=true){let a=this.xi().sub(o,s,n);if(!a||typeof a!="function")return ()=>{};let l=a.bind(a),c=false,d=()=>{c||(c=true,l(),this.Ve.delete(d));};return this.Ve.add(d),d}pub(o,s){this.xi().pub(o,s);}set$(o){for(let[s,n]of Object.entries(o))this.pub(s,n);}get sharedCtx(){return this.xi()}has(o){return this.J?.has(o)??false}add(o,s,n=false){let a=this.Us();if(!a){if(!n&&this.he.has(o))return;this.he.set(o,{value:s,rewrite:n});return}this.he.delete(o),a.add(o,s,n);}add$(o,s=false){for(let[n,a]of Object.entries(o))this.add(n,a,s);}connectedCallback(){super.connectedCallback(),this.Ne?this.Rt&&this.Mr&&(this.Mr=false,this.initCallback()):this.ctxName?(this.Ti=false,this.Lr()):this.Ti&&this.Pt&&(this.Ti=false,this.Lr());}Lr(){if(this.Ne)return;this.Ne=true,this.Ur();let o=this.init$;if(Object.keys(o).length>0){let s=this.xi();for(let[n,a]of Object.entries(o))s.read(n)===void 0&&s.pub(n,a),this.sub(n,$(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.Rt=true,this.requestUpdate();}firstUpdated(o){super.firstUpdated(o);}disconnectedCallback(){this.rc(),super.disconnectedCallback(),this.Ne&&(this.Mr=true);}rc(){if(this.Ve.size!==0){for(let o of [...this.Ve])o();this.Ve.clear();}}initCallback(){}}return p([y({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"Os",1),p([f()],i.prototype,"Is",2),p([f()],i.prototype,"ctxName",2),p([f()],i.prototype,"Rt",2),i}}var po=class extends Oe(zi()(ke(_i(yt)))){};var ut=class r{static generateFastUid(){return `uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}static generateRandomUUID(){let i=globalThis.crypto;return i&&typeof i.randomUUID=="function"?i.randomUUID():r.generateFastUid()}};var Pl=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function ho(r){for(let i in r){if(Pl.includes(i))continue;let t=[...i].reduce((e,o)=>(o.toUpperCase()===o&&(o=`-${o.toLowerCase()}`),e+=o,e),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("uc-")||(t=`uc-${t}`),r[i].reg&&r[i].reg(t);}}var mo="UC";function Rl(r,i=false){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[mo]){t(window[mo]);return}let o=document.createElement("script");o.async=true,o.src=r,o.onerror=()=>{e();},o.onload=()=>{let s=window[mo];i&&ho(s),t(s);},document.head.appendChild(o);})}var ii={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","drop-file-here":"Drop file here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"OneDrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-draw":"Draw","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning","a11y-cloud-editor-apply-aspect-ratio":"Apply operation {{name}} {{value}}",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}","queued-uploading":"Queued for upload","queued-validation":"Queued for validation",validation:"Validating","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop"};var fo=new Map,Zs=new Map,Xs=(r,i)=>{fo.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`);let t={...ii,...i};return fo.set(r,t),t},$l=(r,i)=>{Zs.set(r,i);},Ys=(r,i)=>{typeof i=="function"?$l(r,i):Xs(r,i);},Qs=async r=>{let i=fo.get(r);if(!i){let t=Zs.get(r);if(!t)throw new Error(`Locale ${r} is not defined`);let e=await t();i=Xs(r,e);}return i};Ys("en",ii);var L=r=>`*cfg/${r}`;var at=r=>r?r.split(",").map(i=>i.trim()).filter(Boolean):[],Nt=r=>r.join(",");var Js=r=>{if(typeof r!="string"||!r)return "";let i=r.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},Hi=(...r)=>r.filter(i=>typeof i=="string"&&!!i).map(i=>Js(i)).join("/-/"),tt=(...r)=>{let i=Hi(...r);return i?`-/${i}/`:""};function ji(r){let i=new URL(r),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),o=t.lastIndexOf("/"),s="";return e>=0?s=t.slice(e):o>=0&&(s=t.slice(o+1)),s}function Ki(r){let i=new URL(r),{pathname:t}=i,e=t.indexOf("/"),o=t.indexOf("/",e+1);return t.substring(e+1,o)}function go(r){let i=tn(r),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}function vo(r){return go(r).split("/-/").filter(Boolean).map(t=>Js(t))}function tn(r){let i=new URL(r),t=ji(r),e=en(t)?rn(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function en(r){return r.startsWith("http")}function rn(r){let i=new URL(r);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}var K=(r,i,t)=>{let e=new URL(tn(r)),o=t??ji(r),s=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),o&&en(o)){let n=rn(o);e.pathname=`${e.pathname}${s}${n.pathname||""}`,e.search=n.search,e.hash=n.hash;}else e.pathname=`${e.pathname}${s}${o||""}`;return e.toString()},Xt=(r,i)=>{let t=new URL(r);return t.pathname=`${i}/`,t.toString()};var G=(r,i=",")=>r.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var ri=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:false,flip:false,crop:void 0}),sn=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Dl(r,i){if(typeof i=="number"){let t=i;return ri[r]!==t?`${r}/${t}`:""}if(typeof i=="boolean"){let t=i;return ri[r]!==t?`${r}`:""}if(r==="filter"&&i){let{name:t,amount:e}=i;return ri.filter===e?"":`${r}/${t}/${e}`}if(r==="crop"&&i){let{dimensions:t,coords:e}=i;return `${r}/${t.join("x")}/${e.join(",")}`}return ""}function Yt(r){return Hi(...sn.filter(i=>typeof r[i]<"u"&&r[i]!==null).map(i=>{let t=r[i];return Dl(i,t)}).filter(i=>!!i))}var Gi=Hi("format/auto","progressive/yes"),Bt=([r])=>typeof r<"u"?Number(r):void 0,on=()=>true,Fl=([r,i])=>({name:r,amount:typeof i<"u"?Number(i):100}),Vl=([r,i])=>{if(!/\d+x\d+/.test(r)||!/\d+,\d+/.test(i))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return {dimensions:G(r,"x").map(Number),coords:G(i).map(Number)}},_l=Object.freeze({enhance:Bt,brightness:Bt,exposure:Bt,gamma:Bt,contrast:Bt,saturation:Bt,vibrance:Bt,warmth:Bt,filter:Fl,mirror:on,flip:on,rotate:Bt,crop:r=>{let[i,t]=r,{dimensions:e,coords:o}=Vl([i,t]);return {dimensions:e,coords:o}}});function yo(r){let i={};for(let t of r){let[e,...o]=t.split("/");if(!e||!sn.includes(e))continue;let s=e,n=_l[s];try{let a=n(o);i[s]=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 i}var _=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),et=Object.freeze([_.CROP,_.TUNING,_.FILTERS]),nn=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),an=Object.freeze(["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"]),ln=Object.freeze(["rotate","mirror","flip"]),zt=ri,St=Object.freeze({brightness:{zero:zt.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:zt.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:zt.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:zt.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:zt.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:zt.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:zt.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:zt.enhance,range:[0,100],keypointsNumber:1},filter:{zero:zt.filter,range:[0,100],keypointsNumber:1}});var oi="https://ucarecdn.com",Nl="https://upload.uploadcare.com",Bl="https://social.uploadcare.com",zl="https://ucarecd.net",Hl={pubkey:"",multiple:true,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:false,imgOnly:false,accept:"",externalSourcesPreferredTypes:"",externalSourcesEmbedCss:"",store:"auto",cameraMirror:false,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",topLevelOrigin:"",cloudImageEditorTabs:Nt(et),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:false,useLocalImageEditor:false,useCloudImageEditor:true,removeCopyright:false,cropPreset:"",imageShrink:"",modalScrollLock:true,modalBackdropStrokes:false,sourceListWrap:true,remoteTabSessionKey:"",cdnCname:oi,cdnCnamePrefixed:zl,baseUrl:Nl,socialBaseUrl:Bl,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:3,retryNetworkErrorMaxTimes:3,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:false,saveUrlForRecurrentUploads:false,groupOutput:false,userAgentIntegration:"",debug:false,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:600*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[],validationTimeout:15*1e3,validationConcurrency:100,cameraModes:"photo, video",defaultCameraMode:null,enableAudioRecording:true,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null,filesViewMode:"list",gridShowFileNames:false,cloudImageEditorAutoOpen:false,cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true,pasteScope:"local"},Y=Object.freeze(Hl);var qi=(r,i)=>(...t)=>{let e=r();if(!e.read(L("debug")))return;let o=t;if(typeof t?.[0]=="function"){let n=t[0];o=n();}let s=[e.id,i].filter(Boolean);console.log(`[${s.join("][")}]`,...o);};var W=class{constructor(i){this.Pr=new Set;this.Wt=null;this.z=qi(()=>this.r.ctx,this.constructor.name);this.r=i,this.e=i.ctx;}addSub(i){this.Pr.add(i);}get Zt(){if(!this.Wt){let i={};this.Wt=new Proxy(i,{set:()=>{throw new Error("SharedInstance cfg proxy is read-only")},get:(t,e)=>{if(typeof e!="string")return;let o=L(e);return this.r.ctx.has(o)?this.r.ctx.read(o):Y[e]}});}return this.Wt}destroy(){for(let i of this.Pr)try{i();}catch{}this.Pr.clear();}},It=(r,i,t=true)=>{let e=r.has(i),o=e?r.read(i):null;if(e&&o||!t)return o;throw new Error(`Unexpected error: shared instance for key "${String(i)}" is not available`)},cn=r=>({get ctx(){return r()},get modalManager(){return It(r(),"*modalManager",false)},get telemetryManager(){return It(r(),"*telemetryManager")},get localeManager(){return It(r(),"*localeManager")},get a11y(){return It(r(),"*a11y")},get blocksRegistry(){return It(r(),"*blocksRegistry")},get eventEmitter(){return It(r(),"*eventEmitter")},get uploadCollection(){return It(r(),"*uploadCollection")},get secureUploadsManager(){return It(r(),"*secureUploadsManager",false)},get api(){return It(r(),"*publicApi")},get validationManager(){return It(r(),"*validationManager")}});var q=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),Wi=class extends W{constructor(){super(...arguments);this.Xt=new Map;this.bt=new Set;this.w=new Map;}registerModal(t,e){this.Xt.set(t,e),this.K(q.ADD,{id:t,modal:e});}deleteModal(t){let e=this.Xt.get(t);return e?(this.Xt.delete(t),this.bt.delete(t),this.K(q.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.Xt.get(t);return e?(this.bt.add(t),this.K(q.OPEN,{modal:e,id:t}),true):(this.z(`Modal with ID "${t}" not found`),false)}close(t){let e=this.Xt.get(t);return !e||!this.bt.has(t)?(this.z(`Modal with ID "${t}" not found or not active`),false):(this.bt.delete(t),this.K(q.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.Xt.has(t)?this.bt.has(t)?this.close(t):this.open(t):(this.z(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.bt.size>0}back(){if(this.bt.size===0)return this.z("No active modals to go back from"),false;let t=Array.from(this.bt).pop();return t?this.close(t):false}closeAll(){let t=this.bt.size;return this.bt.clear(),this.K(q.CLOSE_ALL,{}),t}subscribe(t,e){return this.w.has(t)||this.w.set(t,new Set),this.w.get(t)?.add(e),()=>this.unsubscribe(t,e)}unsubscribe(t,e){this.w.has(t)&&this.w.get(t)?.delete(e);}K(t,e){if(this.w.has(t))for(let o of this.w.get(t)??new Set)try{o(e);}catch(s){this.r.telemetryManager.sendEventError(s,"modal subscriber"),this.z("Error in modal subscriber:",s);}}destroy(){super.destroy(),this.closeAll(),this.Xt.clear(),this.w.clear(),this.K(q.DESTROY,{});}};var si=r=>r.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(i=>i.toLowerCase()).join("-");function un(r){return Object.prototype.toString.call(r)==="[object Object]"}var jl=/\W|_/g;function Kl(r){return r.split(jl).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}function dn(r,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(r)?r.map(t=>jt(t,{ignoreKeys:i})):r}function jt(r,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(r))return dn(r,{ignoreKeys:i});if(!un(r))return r;let t={};for(let e of Object.keys(r)){let o=r[e];if(i.includes(e)){t[e]=o;continue}un(o)?o=jt(o,{ignoreKeys:i}):Array.isArray(o)&&(o=dn(o,{ignoreKeys:i})),t[Kl(e)]=o;}return t}var Gl=r=>new Promise(i=>setTimeout(i,r));function So({libraryName:r,libraryVersion:i,userAgent:t,publicKey:e="",integration:o=""}){let s="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:r,libraryVersion:i,languageName:s,integration:o});let n=[r,i,e].filter(Boolean).join("/"),a=[s,o].filter(Boolean).join("; ");return `${n} (${a})`}var ql={factor:2,time:100};function Wl(r,i=ql){let t=0;function e(o){let s=Math.round(i.time*i.factor**t);return o({attempt:t,retry:a=>Gl(a??s).then(()=>(t+=1,e(o)))})}return e(r)}var fe=class extends Error{},Le=class r extends fe{originalProgressEvent;constructor(i){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,r.prototype),this.originalProgressEvent=i;}},Zi=(r,i)=>{r&&(r.aborted?Promise.resolve().then(i):r.addEventListener("abort",()=>i(),{once:true}));},Qt=class r extends fe{isCancel=true;constructor(i="Request canceled"){super(i),this.name="CancelError",Object.setPrototypeOf(this,r.prototype);}},Zl=500,hn=({check:r,interval:i=Zl,timeout:t,signal:e})=>new Promise((o,s)=>{let n,a;Zi(e,()=>{n&&clearTimeout(n),s(new Qt("Poll cancelled"));}),t&&(a=setTimeout(()=>{n&&clearTimeout(n),s(new Qt("Timed out"));},t));let l=()=>{try{Promise.resolve(r(e)).then(c=>{c?(a&&clearTimeout(a),o(c)):n=setTimeout(l,i);}).catch(c=>{a&&clearTimeout(a),s(c);});}catch(c){a&&clearTimeout(a),s(c);}};n=setTimeout(l,0);}),U={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,maxConcurrentRequests:4,pusherKey:"79ae88bd931ea68464d9"},Xi="application/octet-stream",mn="original",te=({method:r,url:i,data:t,headers:e={},signal:o,onProgress:s})=>new Promise((n,a)=>{let l=new XMLHttpRequest,c=r?.toUpperCase()||"GET",d=false;l.open(c,i,true),e&&Object.entries(e).forEach(u=>{let[h,m]=u;typeof m<"u"&&!Array.isArray(m)&&l.setRequestHeader(h,m);}),l.responseType="text",Zi(o,()=>{d=true,l.abort(),a(new Qt);}),l.onload=()=>{if(l.status!=200)a(new Error(`Error ${l.status}: ${l.statusText}`));else {let u={method:c,url:i,data:t,headers:e||void 0,signal:o,onProgress:s},h=l.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};h.forEach(function(w){let x=w.split(": "),T=x.shift(),S=x.join(": ");T&&typeof T<"u"&&(m[T]=S);});let g=l.response,b=l.status;n({request:u,data:g,headers:m,status:b});}},l.onerror=u=>{d||a(new Le(u));},s&&typeof s=="function"&&(l.upload.onprogress=u=>{u.lengthComputable?s({isComputable:true,value:u.loaded/u.total}):s({isComputable:false});}),t?l.send(t):l.send();});function Xl(r,...i){return r}var Yl=({name:r})=>r?[r]:[],Ql=Xl,Jl=()=>new FormData,fn=r=>false,Yi=r=>typeof Blob<"u"&&r instanceof Blob,Qi=r=>typeof File<"u"&&r instanceof File,Ji=r=>!!r&&typeof r=="object"&&!Array.isArray(r)&&"uri"in r&&typeof r.uri=="string",Ue=r=>Yi(r)||Qi(r)||fn()||Ji(r),tc=r=>typeof r=="string"||typeof r=="number"||typeof r>"u",ec=r=>!!r&&typeof r=="object"&&!Array.isArray(r),ic=r=>!!r&&typeof r=="object"&&"data"in r&&Ue(r.data);function gn(r,i,t){if(Array.isArray(t))for(let e of t)gn(r,`${i}[]`,e);else if(ic(t)){let{name:e,contentType:o}=t,s=Ql(t.data,e,o??Xi),n=Yl({name:e});r.push([i,s,...n]);}else if(ec(t))for(let[e,o]of Object.entries(t))typeof o<"u"&&r.push([`${i}[${e}]`,String(o)]);else tc(t)&&t&&r.push([i,t.toString()]);}function rc(r){let i=[];for(let[t,e]of Object.entries(r))gn(i,t,e);return i}function tr(r){let i=Jl(),t=rc(r);for(let e of t){let[o,s,...n]=e;i.append(o,s,...n);}return i}var it=class r extends fe{code;request;response;headers;constructor(i,t,e,o,s){super(),this.name="UploadError",this.message=i,this.code=t,this.request=e,this.response=o,this.headers=s,Object.setPrototypeOf(this,r.prototype);}},oc=r=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(r))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(o=>o[1]??false).forEach(o=>i.set(`${t}[${o[0]}]`,String(o[1]))):Array.isArray(e)?e.forEach(o=>{i.append(`${t}[]`,o);}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},Ht=(r,i,t)=>{let e=new URL(r);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=oc(t)),e.toString()},sc="6.18.4",nc="UploadcareUploadClient",ac=sc;function ve(r){return So({libraryName:nc,libraryVersion:ac,...r})}var lc="RequestThrottledError",pn=15e3,cc=1e3;function uc(r){let{headers:i}=r||{};if(!i||typeof i["retry-after"]!="string")return pn;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:pn}function ee(r,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return Wl(({attempt:o,retry:s})=>r().catch(n=>{if("response"in n&&n?.code===lc&&o<t)return s(uc(n));if(n instanceof Le&&o<e)return s((o+1)*cc);throw n}))}var vn=r=>{let i="";return (Yi(r)||Qi(r)||Ji(r))&&(i=r.type),i||Xi},yn=r=>{let i="";return Qi(r)&&r.name?i=r.name:Yi(r)||fn()?i="":Ji(r)&&r.name&&(i=r.name),i||mn};function Ao(r){return typeof r>"u"||r==="auto"?"auto":r?"1":"0"}function dc(r,{publicKey:i,fileName:t,contentType:e,baseURL:o=U.baseURL,secureSignature:s,secureExpire:n,store:a,signal:l,onProgress:c,source:d="local",integration:u,userAgent:h,retryThrottledRequestMaxTimes:m=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=U.retryNetworkErrorMaxTimes,metadata:b}){return ee(()=>te({method:"POST",url:Ht(o,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":ve({publicKey:i,integration:u,userAgent:h})},data:tr({file:{data:r,name:t||yn(r),contentType:e||vn(r)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Ao(a),signature:s,expire:n,source:d,metadata:b}),signal:l,onProgress:c}).then(({data:w,headers:x,request:T})=>{let S=jt(JSON.parse(w));if("error"in S)throw new it(S.error.content,S.error.errorCode,T,S,x);return S}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}var Eo;(function(r){r.Token="token",r.FileInfo="file_info";})(Eo||(Eo={}));function pc(r,{publicKey:i,baseURL:t=U.baseURL,store:e,fileName:o,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,source:c="url",signal:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=U.retryNetworkErrorMaxTimes,metadata:b}){return ee(()=>te({method:"POST",headers:{"X-UC-User-Agent":ve({publicKey:i,integration:u,userAgent:h})},url:Ht(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:r,store:Ao(e),filename:o,check_URL_duplicates:s?1:void 0,save_URL_duplicates:n?1:void 0,signature:a,expire:l,source:c,metadata:b}),signal:d}).then(({data:w,headers:x,request:T})=>{let S=jt(JSON.parse(w));if("error"in S)throw new it(S.error.content,S.error.errorCode,T,S,x);return S}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}var lt;(function(r){r.Unknown="unknown",r.Waiting="waiting",r.Progress="progress",r.Error="error",r.Success="success";})(lt||(lt={}));var hc=r=>"status"in r&&r.status===lt.Error;function mc(r,{publicKey:i,baseURL:t=U.baseURL,signal:e,integration:o,userAgent:s,retryThrottledRequestMaxTimes:n=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=U.retryNetworkErrorMaxTimes}={}){return ee(()=>te({method:"GET",headers:i?{"X-UC-User-Agent":ve({publicKey:i,integration:o,userAgent:s})}:void 0,url:Ht(t,"/from_url/status/",{jsonerrors:1,token:r}),signal:e}).then(({data:l,headers:c,request:d})=>{let u=jt(JSON.parse(l));if("error"in u&&!hc(u))throw new it(u.error.content,u.error.errorCode,d,u,c);return u}),{retryNetworkErrorMaxTimes:a,retryThrottledRequestMaxTimes:n})}function fc(r,{publicKey:i,baseURL:t=U.baseURL,jsonpCallback:e,secureSignature:o,secureExpire:s,signal:n,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:d=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:u=U.retryNetworkErrorMaxTimes}){return ee(()=>te({method:"POST",headers:{"X-UC-User-Agent":ve({publicKey:i,integration:l,userAgent:c})},url:Ht(t,"/group/",{jsonerrors:1}),data:tr({files:r,callback:e,pub_key:i,signature:o,expire:s,source:a}),signal:n}).then(({data:h,headers:m,request:g})=>{let b=jt(JSON.parse(h));if("error"in b)throw new it(b.error.content,b.error.errorCode,g,b,m);return b}),{retryNetworkErrorMaxTimes:u,retryThrottledRequestMaxTimes:d})}fu