UNPKG

@uploadcare/file-uploader

Version:

Building blocks for Uploadcare products integration

7 lines 145 kB
/** * @license * Package: @uploadcare/file-uploader@1.28.0 (MIT) * License: https://github.com/uploadcare/blob/main/LICENSE * Built: 2026-04-03T13:57:57.237Z */ var Ls=Object.defineProperty;var Ms=Object.getOwnPropertyDescriptor;var p=(r,i,t,e)=>{for(var s=e>1?void 0:e?Ms(i,t):i,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=(e?n(i,t,s):n(s))||s);return e&&s&&Ls(i,t,s),s};var ue=globalThis,pe=ue.ShadowRoot&&(ue.ShadyCSS===void 0||ue.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Di=Symbol(),_i=new WeakMap,de=class{constructor(i,t,e){if(this.ys=true,e!==Di)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(pe&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=_i.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&_i.set(t,i));}return i}toString(){return this.cssText}},Fi=r=>new de(typeof r=="string"?r:r+"",void 0,Di);var Ki=(r,i)=>{if(pe)r.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),s=ue.litNonce;s!==void 0&&e.setAttribute("nonce",s),e.textContent=t.cssText,r.appendChild(e);}},ri=pe?r=>r:r=>r instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return Fi(t)})(r):r;var{is:Is,defineProperty:Ps,getOwnPropertyDescriptor:$s,getOwnPropertyNames:Us,getOwnPropertySymbols:Ns,getPrototypeOf:_s}=Object,he=globalThis,Vi=he.trustedTypes,Ds=Vi?Vi.emptyScript:"",Fs=he.reactiveElementPolyfillSupport,jt=(r,i)=>r,zt={toAttribute(r,i){switch(i){case Boolean:r=r?Ds: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}},fe=(r,i)=>!Is(r,i),ji={attribute:true,type:String,converter:zt,reflect:false,useDefault:false,hasChanged:fe};Symbol.metadata??=Symbol("metadata"),he.litPropertyMetadata??=new WeakMap;var Z=class extends HTMLElement{static addInitializer(i){this.Rt(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.Be&&[...this.Be.keys()]}static createProperty(i,t=ji){if(t.state&&(t.attribute=false),this.Rt(),this.prototype.hasOwnProperty(i)&&((t=Object.create(t)).wrapped=true),this.elementProperties.set(i,t),!t.noAccessor){let e=Symbol(),s=this.getPropertyDescriptor(i,e,t);s!==void 0&&Ps(this.prototype,i,s);}}static getPropertyDescriptor(i,t,e){let{get:s,set:o}=$s(this.prototype,i)??{get(){return this[t]},set(n){this[t]=n;}};return {get:s,set(n){let a=s?.call(this);o?.call(this,n),this.requestUpdate(i,a,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??ji}static Rt(){if(this.hasOwnProperty(jt("elementProperties")))return;let i=_s(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(jt("finalized")))return;if(this.finalized=true,this.Rt(),this.hasOwnProperty(jt("properties"))){let t=this.properties,e=[...Us(t),...Ns(t)];for(let s of e)this.createProperty(s,t[s]);}let i=this[Symbol.metadata];if(i!==null){let t=litPropertyMetadata.get(i);if(t!==void 0)for(let[e,s]of t)this.elementProperties.set(e,s);}this.Be=new Map;for(let[t,e]of this.elementProperties){let s=this.Lt(t,e);s!==void 0&&this.Be.set(s,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 s of e)t.unshift(ri(s));}else i!==void 0&&t.push(ri(i));return t}static Lt(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.Ge=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.ge=null,this.gs();}gs(){this.Mt=new Promise(i=>this.enableUpdating=i),this.ie=new Map,this.vs(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this.Oe??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.Oe?.delete(i);}vs(){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.Ge=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ki(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.Oe?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this.Oe?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.It(i,e);}bs(i,t){let e=this.constructor.elementProperties.get(i),s=this.constructor.Lt(i,e);if(s!==void 0&&e.reflect===true){let o=(e.converter?.toAttribute!==void 0?e.converter:zt).toAttribute(t,e.type);this.ge=i,o==null?this.removeAttribute(s):this.setAttribute(s,o),this.ge=null;}}It(i,t){let e=this.constructor,s=e.Be.get(i);if(s!==void 0&&this.ge!==s){let o=e.getPropertyOptions(s),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:zt;this.ge=s;let a=n.fromAttribute(t,o.type);this[s]=a??this.Pt?.get(s)??a,this.ge=null;}}requestUpdate(i,t,e,s=false,o){if(i!==void 0){let n=this.constructor;if(s===false&&(o=this[i]),e??=n.getPropertyOptions(i),!((e.hasChanged??fe)(o,t)||e.useDefault&&e.reflect&&o===this.Pt?.get(i)&&!this.hasAttribute(n.Lt(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.Mt=this.Ts());}C(i,t,{useDefault:e,reflect:s,wrapped:o},n){e&&!(this.Pt??=new Map).has(i)&&(this.Pt.set(i,n??t??this[i]),o!==true||n!==void 0)||(this.ie.has(i)||(this.hasUpdated||e||(t=void 0),this.ie.set(i,t)),s===true&&this.ge!==i&&(this.Li??=new Set).add(i));}async Ts(){this.isUpdatePending=true;try{await this.Mt;}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.Ge){for(let[s,o]of this.Ge)this[s]=o;this.Ge=void 0;}let e=this.constructor.elementProperties;if(e.size>0)for(let[s,o]of e){let{wrapped:n}=o,a=this[s];n!==true||this.ie.has(s)||a===void 0||this.C(s,void 0,o,a);}}let i=false,t=this.ie;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.Oe?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.$t();}catch(e){throw i=false,this.$t(),e}i&&this.xs(t);}willUpdate(i){}xs(i){this.Oe?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}$t(){this.ie=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.Mt}shouldUpdate(i){return true}update(i){this.Li&&=this.Li.forEach(t=>this.bs(t,this[t])),this.$t();}updated(i){}firstUpdated(i){}};Z.elementStyles=[],Z.shadowRootOptions={mode:"open"},Z[jt("elementProperties")]=new Map,Z[jt("finalized")]=new Map,Fs?.({ReactiveElement:Z}),(he.reactiveElementVersions??=[]).push("2.1.2");var oi=globalThis,zi=r=>r,me=oi.trustedTypes,Hi=me?me.createPolicy("lit-html",{createHTML:r=>r}):void 0,ni="$lit$",Q=`lit$${Math.random().toFixed(9).slice(2)}$`,ai="?"+Q,Ks=`<${ai}>`,wt=document,Bt=()=>wt.createComment(""),Gt=r=>r===null||typeof r!="object"&&typeof r!="function",li=Array.isArray,Yi=r=>li(r)||typeof r?.[Symbol.iterator]=="function",si=`[ \f\r]`,Ht=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Bi=/-->/g,Gi=/>/g,bt=RegExp(`>|${si}(?:([^\\s"'>=/]+)(${si}*=${si}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),qi=/'/g,Wi=/"/g,Zi=/^(?:script|style|textarea|title)$/i,ci=r=>(i,...t)=>({re:r,strings:i,values:t}),m=ci(1),D=Symbol.for("lit-noChange"),T=Symbol.for("lit-nothing"),Xi=new WeakMap,Tt=wt.createTreeWalker(wt,129);function Qi(r,i){if(!li(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Hi!==void 0?Hi.createHTML(i):i}var Ji=(r,i)=>{let t=r.length-1,e=[],s,o=i===2?"<svg>":i===3?"<math>":"",n=Ht;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===Ht?d[1]==="!--"?n=Bi:d[1]!==void 0?n=Gi:d[2]!==void 0?(Zi.test(d[2])&&(s=RegExp("</"+d[2],"g")),n=bt):d[3]!==void 0&&(n=bt):n===bt?d[0]===">"?(n=s??Ht,u=-1):d[1]===void 0?u=-2:(u=n.lastIndex-d[2].length,c=d[1],n=d[3]===void 0?bt:d[3]==='"'?Wi:qi):n===Wi||n===qi?n=bt:n===Bi||n===Gi?n=Ht:(n=bt,s=void 0);let f=n===bt&&r[a+1].startsWith("/>")?" ":"";o+=n===Ht?l+Ks:u>=0?(e.push(c),l.slice(0,u)+ni+l.slice(u)+Q+f):l+Q+(u===-2?a:f);}return [Qi(r,o+(r[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},qt=class r{constructor({strings:i,re:t},e){let s;this.parts=[];let o=0,n=0,a=i.length-1,l=this.parts,[c,d]=Ji(i,t);if(this.el=r.createElement(c,e),Tt.currentNode=this.el.content,t===2||t===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes);}for(;(s=Tt.nextNode())!==null&&l.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(let u of s.getAttributeNames())if(u.endsWith(ni)){let h=d[n++],f=s.getAttribute(u).split(Q),v=/([.?@])?(.*)/.exec(h);l.push({type:1,index:o,name:v[2],strings:f,ctor:v[1]==="."?ge:v[1]==="?"?ve:v[1]==="@"?be:Et}),s.removeAttribute(u);}else u.startsWith(Q)&&(l.push({type:6,index:o}),s.removeAttribute(u));if(Zi.test(s.tagName)){let u=s.textContent.split(Q),h=u.length-1;if(h>0){s.textContent=me?me.emptyScript:"";for(let f=0;f<h;f++)s.append(u[f],Bt()),Tt.nextNode(),l.push({type:2,index:++o});s.append(u[h],Bt());}}}else if(s.nodeType===8)if(s.data===ai)l.push({type:2,index:o});else {let u=-1;for(;(u=s.data.indexOf(Q,u+1))!==-1;)l.push({type:7,index:o}),u+=Q.length-1;}o++;}}static createElement(i,t){let e=wt.createElement("template");return e.innerHTML=i,e}};function xt(r,i,t=r,e){if(i===D)return i;let s=e!==void 0?t.Es?.[e]:t.Cs,o=Gt(i)?void 0:i.Ut;return s?.constructor!==o&&(s?.Mi?.(false),o===void 0?s=void 0:(s=new o(r),s.Nt(r,t,e)),e!==void 0?(t.Es??=[])[e]=s:t.Cs=s),s!==void 0&&(i=xt(r,s.Ss(r,i.values),s,e)),i}var ye=class{constructor(i,t){this.Ii=[],this.S=void 0,this.Pi=i,this.n=t;}get parentNode(){return this.n.parentNode}get g(){return this.n.g}u(i){let{el:{content:t},parts:e}=this.Pi,s=(i?.creationScope??wt).importNode(t,true);Tt.currentNode=s;let o=Tt.nextNode(),n=0,a=0,l=e[0];for(;l!==void 0;){if(n===l.index){let c;l.type===2?c=new Lt(o,o.nextSibling,this,i):l.type===1?c=new l.ctor(o,l.name,l.strings,this,i):l.type===6&&(c=new Te(o,this,i)),this.Ii.push(c),l=e[++a];}n!==l?.index&&(o=Tt.nextNode(),n++);}return Tt.currentNode=wt,s}p(i){let t=0;for(let e of this.Ii)e!==void 0&&(e.strings!==void 0?(e._(i,e,t),t+=e.strings.length-2):e._(i[t])),t++;}},Lt=class r{get g(){return this.n?.g??this.$i}constructor(i,t,e,s){this.type=2,this.e=T,this.S=void 0,this.q=i,this.ve=t,this.n=e,this.options=s,this.$i=s?.isConnected??true;}get parentNode(){let i=this.q.parentNode,t=this.n;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.q}get endNode(){return this.ve}_(i,t=this){i=xt(this,i,t),Gt(i)?i===T||i==null||i===""?(this.e!==T&&this.be(),this.e=T):i!==this.e&&i!==D&&this.Ui(i):i.re!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):Yi(i)?this.k(i):this.Ui(i);}O(i){return this.q.parentNode.insertBefore(i,this.ve)}T(i){this.e!==i&&(this.be(),this.e=this.O(i));}Ui(i){this.e!==T&&Gt(this.e)?this.q.nextSibling.data=i:this.T(wt.createTextNode(i)),this.e=i;}$(i){let{values:t,re:e}=i,s=typeof e=="number"?this.ks(i):(e.el===void 0&&(e.el=qt.createElement(Qi(e.h,e.h[0]),this.options)),e);if(this.e?.Pi===s)this.e.p(t);else {let o=new ye(s,this),n=o.u(this.options);o.p(t),this.T(n),this.e=o;}}ks(i){let t=Xi.get(i.strings);return t===void 0&&Xi.set(i.strings,t=new qt(i)),t}k(i){li(this.e)||(this.e=[],this.be());let t=this.e,e,s=0;for(let o of i)s===t.length?t.push(e=new r(this.O(Bt()),this.O(Bt()),this,this.options)):e=t[s],e._(o),s++;s<t.length&&(this.be(e&&e.ve.nextSibling,s),t.length=s);}be(i=this.q.nextSibling,t){for(this.qe?.(false,true,t);i!==this.ve;){let e=zi(i).nextSibling;zi(i).remove(),i=e;}}setConnected(i){this.n===void 0&&(this.$i=i,this.qe?.(i));}},Et=class{get tagName(){return this.element.tagName}get g(){return this.n.g}constructor(i,t,e,s,o){this.type=1,this.e=T,this.S=void 0,this.element=i,this.name=t,this.n=s,this.options=o,e.length>2||e[0]!==""||e[1]!==""?(this.e=Array(e.length-1).fill(new String),this.strings=e):this.e=T;}_(i,t=this,e,s){let o=this.strings,n=false;if(o===void 0)i=xt(this,i,t,0),n=!Gt(i)||i!==this.e&&i!==D,n&&(this.e=i);else {let a=i,l,c;for(i=o[0],l=0;l<o.length-1;l++)c=xt(this,a[e+l],t,l),c===D&&(c=this.e[l]),n||=!Gt(c)||c!==this.e[l],c===T?i=T:i!==T&&(i+=(c??"")+o[l+1]),this.e[l]=c;}n&&!s&&this.j(i);}j(i){i===T?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},ge=class extends Et{constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===T?void 0:i;}},ve=class extends Et{constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==T);}},be=class extends Et{constructor(i,t,e,s,o){super(i,t,e,s,o),this.type=5;}_(i,t=this){if((i=xt(this,i,t,0)??T)===D)return;let e=this.e,s=i===T&&e!==T||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,o=i!==T&&(e===T||s);s&&this.element.removeEventListener(this.name,this,e),o&&this.element.addEventListener(this.name,this,i),this.e=i;}handleEvent(i){typeof this.e=="function"?this.e.call(this.options?.host??this.element,i):this.e.handleEvent(i);}},Te=class{constructor(i,t,e){this.element=i,this.type=6,this.S=void 0,this.n=t,this.options=e;}get g(){return this.n.g}_(i){xt(this,i);}},Vs=oi.litHtmlPolyfillSupport;Vs?.(qt,Lt),(oi.litHtmlVersions??=[]).push("3.3.2");var er=(r,i,t)=>{let e=t?.renderBefore??i,s=e.Os;if(s===void 0){let o=t?.renderBefore??null;e.Os=s=new Lt(i.insertBefore(Bt(),o),o,void 0,t??{});}return s._(r),s};var ui=globalThis,at=class extends Z{constructor(){super(...arguments),this.renderOptions={host:this},this._t=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._t=er(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._t?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._t?.setConnected(false);}render(){return D}};at.ln=true,at.finalized=true,ui.litElementHydrateSupport?.({LitElement:at});var js=ui.litElementPolyfillSupport;js?.({LitElement:at});(ui.litElementVersions??=[]).push("4.2.2");var zs={attribute:true,type:String,converter:zt,reflect:false,hasChanged:fe},Hs=(r=zs,i,t)=>{let{kind:e,metadata:s}=t,o=globalThis.litPropertyMetadata.get(s);if(o===void 0&&globalThis.litPropertyMetadata.set(s,o=new Map),e==="setter"&&((r=Object.create(r)).wrapped=true),o.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 g(r){return (i,t)=>typeof t=="object"?Hs(r,i,t):((e,s,o)=>{let n=s.hasOwnProperty(o);return s.constructor.createProperty(o,e),n?Object.getOwnPropertyDescriptor(s,o):void 0})(r,i,t)}function y(r){return g({...r,state:true,attribute:false})}var ir=r=>r.strings===void 0;var lt={ATTRIBUTE:1,CHILD:2},z=r=>(...i)=>({Ut:r,values:i}),q=class{constructor(i){}get g(){return this.n.g}Nt(i,t,e){this.We=i,this.n=t,this.Rs=e;}Ss(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var Wt=(r,i)=>{let t=r.S;if(t===void 0)return false;for(let e of t)e.Mi?.(i,false),Wt(e,i);return true},xe=r=>{let i,t;do{if((i=r.n)===void 0)break;t=i.S,t.delete(r),r=i;}while(t?.size===0)},rr=r=>{for(let i;i=r.n;r=i){let t=i.S;if(t===void 0)i.S=t=new Set;else if(t.has(r))break;t.add(r),qs(i);}};function Bs(r){this.S!==void 0?(xe(this),this.n=r,rr(this)):this.n=r;}function Gs(r,i=false,t=0){let e=this.e,s=this.S;if(s!==void 0&&s.size!==0)if(i)if(Array.isArray(e))for(let o=t;o<e.length;o++)Wt(e[o],false),xe(e[o]);else e!=null&&(Wt(e,false),xe(e));else Wt(this,r);}var qs=r=>{r.type==lt.CHILD&&(r.qe??=Gs,r.As??=Bs);},Ee=class extends q{constructor(){super(...arguments),this.S=void 0;}Nt(i,t,e){super.Nt(i,t,e),rr(this),this.isConnected=i.g;}Mi(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(Wt(this,i),xe(this));}setValue(i){if(ir(this.We))this.We._(i,this);else {let t=[...this.We.e];t[this.Rs]=i,this.We._(t,this,0);}}disconnected(){}reconnected(){}};var C=()=>new pi,pi=class{},di=new WeakMap,k=z(class extends Ee{render(r){return T}update(r,[i]){let t=i!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=i,this.ht=r.options?.host,this.rt(this.ct=r.element)),T}rt(r){if(this.isConnected||(r=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=di.get(i);t===void 0&&(t=new WeakMap,di.set(i,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,r),r!==void 0&&this.G.call(this.ht,r);}else this.G.value=r;}get lt(){return typeof this.G=="function"?di.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0);}reconnected(){this.rt(this.ct);}});var Ct=class extends q{constructor(i){if(super(i),this.it=T,i.type!==lt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===T||i==null)return this.Ni=void 0,this.it=i;if(i===D)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.Ni;this.it=i;let t=[i];return t.raw=t,this.Ni={re:this.constructor.resultType,strings:t,values:[]}}};Ct.directiveName="unsafeHTML",Ct.resultType=1;var Xt=class extends Ct{};Xt.directiveName="unsafeSVG",Xt.resultType=2;var sr=z(Xt);function Yt(r,i,t){return r?i(r):t?.(r)}var or;(function(r){r.Token="token",r.FileInfo="file_info";})(or||(or={}));var nr;(function(r){r.Unknown="unknown",r.Waiting="waiting",r.Progress="progress",r.Error="error",r.Success="success";})(nr||(nr={}));var Ce=class{Xe=1;Dt=[];Ye=0;Ft=new Map;Kt=new Map;constructor(i){this.Xe=i;}run(){let i=this.Xe-this.Ye;for(let t=0;t<i;t++){let e=this.Dt.shift();if(!e)return;let s=this.Ft.get(e),o=this.Kt.get(e);if(!s||!o)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.Ye+=1,e().finally(()=>{this.Ft.delete(e),this.Kt.delete(e),this.Ye-=1,this.run();}).then(n=>s(n)).catch(n=>o(n));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,s)=>{this.Ft.set(i,e),this.Kt.set(i,s),this.Dt.push(i),t&&this.run();})}get pending(){return this.Dt.length}get running(){return this.Ye}set concurrency(i){this.Xe=i,this.run();}get concurrency(){return this.Xe}};var ar=()=>({});var lr=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var x=r=>`*cfg/${r}`;var St=r=>r?r.split(",").map(i=>i.trim()).filter(Boolean):[],kt=r=>r.join(",");var cr=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},Se=(...r)=>r.filter(i=>typeof i=="string"&&!!i).map(i=>cr(i)).join("/-/"),J=(...r)=>{let i=Se(...r);return i?`-/${i}/`:""};function ke(r){let i=new URL(r),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),s=t.lastIndexOf("/"),o="";return e>=0?o=t.slice(e):s>=0&&(o=t.slice(s+1)),o}function Oe(r){let i=new URL(r),{pathname:t}=i,e=t.indexOf("/"),s=t.indexOf("/",e+1);return t.substring(e+1,s)}function hi(r){let i=ur(r),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}function fi(r){return hi(r).split("/-/").filter(Boolean).map(t=>cr(t))}function ur(r){let i=new URL(r),t=ke(r),e=dr(t)?pr(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function dr(r){return r.startsWith("http")}function pr(r){let i=new URL(r);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}var tt=(r,i,t)=>{let e=new URL(ur(r)),s=ke(r),o=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),s&&dr(s)){let n=pr(s);e.pathname=`${e.pathname}${o}${n.pathname||""}`,e.search=n.search,e.hash=n.hash;}else e.pathname=`${e.pathname}${o}${s||""}`;return e.toString()},mi=(r,i)=>{let t=new URL(r);return t.pathname=`${i}/`,t.toString()};var Zt=(r,i=",")=>r.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var Qt=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}),fr=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Ws(r,i){if(typeof i=="number"){let t=i;return Qt[r]!==t?`${r}/${t}`:""}if(typeof i=="boolean"){let t=i;return Qt[r]!==t?`${r}`:""}if(r==="filter"&&i){let{name:t,amount:e}=i;return Qt.filter===e?"":`${r}/${t}/${e}`}if(r==="crop"&&i){let{dimensions:t,coords:e}=i;return `${r}/${t.join("x")}/${e.join(",")}`}return ""}function ct(r){return Se(...fr.filter(i=>typeof r[i]<"u"&&r[i]!==null).map(i=>{let t=r[i];return Ws(i,t)}).filter(i=>!!i))}var Ae=Se("format/auto","progressive/yes"),et=([r])=>typeof r<"u"?Number(r):void 0,hr=()=>true,Xs=([r,i])=>({name:r,amount:typeof i<"u"?Number(i):100}),Ys=([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:Zt(r,"x").map(Number),coords:Zt(i).map(Number)}},Zs=Object.freeze({enhance:et,brightness:et,exposure:et,gamma:et,contrast:et,saturation:et,vibrance:et,warmth:et,filter:Xs,mirror:hr,flip:hr,rotate:et,crop:r=>{let[i,t]=r,{dimensions:e,coords:s}=Ys([i,t]);return {dimensions:e,coords:s}}});function yi(r){let i={};for(let t of r){let[e,...s]=t.split("/");if(!e||!fr.includes(e))continue;let o=e,n=Zs[o];try{let a=n(s);i[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 i}var O=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),$=Object.freeze([O.CROP,O.TUNING,O.FILTERS]),mr=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),yr=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"]),gr=Object.freeze(["rotate","mirror","flip"]),it=Qt,H=Object.freeze({brightness:{zero:it.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:it.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:it.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:it.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:it.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:it.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:it.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:it.enhance,range:[0,100],keypointsNumber:1},filter:{zero:it.filter,range:[0,100],keypointsNumber:1}});var gi="https://ucarecdn.com",Qs="https://upload.uploadcare.com",Js="https://social.uploadcare.com",to="https://ucarecd.net",eo={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:kt($),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:false,useLocalImageEditor:false,useCloudImageEditor:true,removeCopyright:false,cropPreset:"",imageShrink:"",modalScrollLock:true,modalBackdropStrokes:false,sourceListWrap:true,remoteTabSessionKey:"",cdnCname:gi,cdnCnamePrefixed:to,baseUrl:Qs,socialBaseUrl:Js,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"},L=Object.freeze(eo);var Re=(r,i)=>(...t)=>{let e=r();if(!e.read(x("debug")))return;let s=t;if(typeof t?.[0]=="function"){let n=t[0];s=n();}let o=[e.id,i].filter(Boolean);console.log(`[${o.join("][")}]`,...s);};var j=class{constructor(i){this.Vt=new Set;this.se=null;this.oe=Re(()=>this.b.ctx,this.constructor.name);this.b=i,this.s=i.ctx;}addSub(i){this.Vt.add(i);}get _i(){if(!this.se){let i={};this.se=new Proxy(i,{set:()=>{throw new Error("SharedInstance cfg proxy is read-only")},get:(t,e)=>{if(typeof e!="string")return;let s=x(e);return this.b.ctx.has(s)?this.b.ctx.read(s):L[e]}});}return this.se}destroy(){for(let i of this.Vt)try{i();}catch{}this.Vt.clear();}},W=(r,i,t=true)=>{let e=r.has(i),s=e?r.read(i):null;if(e&&s||!t)return s;throw new Error(`Unexpected error: shared instance for key "${String(i)}" is not available`)},vr=r=>({get ctx(){return r()},get modalManager(){return W(r(),"*modalManager",false)},get telemetryManager(){return W(r(),"*telemetryManager")},get localeManager(){return W(r(),"*localeManager")},get a11y(){return W(r(),"*a11y")},get blocksRegistry(){return W(r(),"*blocksRegistry")},get eventEmitter(){return W(r(),"*eventEmitter")},get uploadCollection(){return W(r(),"*uploadCollection")},get secureUploadsManager(){return W(r(),"*secureUploadsManager",false)},get api(){return W(r(),"*publicApi")},get validationManager(){return W(r(),"*validationManager")}});var Le=class extends j{constructor(t){super(t);this.scopes=new Set;this.listener=this.Ls.bind(this),window.addEventListener("paste",this.listener);}openUploadList(){this.b.api.setCurrentActivity(lr.UPLOAD_LIST),this.b.api.setModalState(true);}async Ls(t){if(t.clipboardData){for(let e of this.scopes)if(e.isConnected)switch(this._i.pasteScope){case "global":await this.handlePaste(t);break;case "local":if(!e.contains(t.target))continue;await this.handlePaste(t);break;default:continue}}}async handlePaste(t){let e=Array.from(t.clipboardData.items),s=e.map(n=>n.getAsFile()).filter(n=>n!==null),o=e.filter(n=>n.kind==="string"&&n.type==="text/plain").map(n=>new Promise(a=>{n.getAsString(l=>{a(l);});}));s.length>0&&(s.forEach(n=>{this.b.api.addFileFromObject(n,{source:"clipboard"});}),this.openUploadList()),o.length>0&&((await Promise.all(o)).forEach(a=>{this.b.api.addFileFromUrl(a,{source:"clipboard"});}),this.openUploadList());}registerBlock(t){return this.scopes.add(t),()=>{this.scopes.delete(t);}}destroy(){super.destroy(),window.removeEventListener("paste",this.listener),this.scopes.clear();}};var io={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function Jt(r,i){i.tabIndex=0,i.focus(),r.tabIndex=-1;}function vi(r){let i=r.role||r.type||r.tagName;if(!i)return null;let t=io[i.toLowerCase()];if(!t)return null;for(let e of t){let s=r.closest(`[role=${e}]`);if(s)return s}}function bi(r,i){return i.role==="toolbar"?ro(i):i.querySelectorAll(`[role=${r.role}]`)}function ro(r){return [...r.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}function so(r){let i=r.getAttribute("aria-orientation");if(i==="vertical")return false;if(i==="horizontal")return true;let t=r.role;return t==="menubar"||t==="tablist"||t==="toolbar"}function br(r){return i=>{let t=false,e=300,s=0,o="";function n(u){let h=vi(u.target);if(!h){a();return}let f=bi(u.target,h),v=Array.from(f).indexOf(u.target),I="ArrowDown",R="ArrowUp";if(so(h)&&(i.document.dir==="rtl"?(I="ArrowLeft",R="ArrowRight"):(I="ArrowRight",R="ArrowLeft")),u.key===I)u.preventDefault(),Jt(u.target,f[v+1]||f[0]);else if(u.key===R)u.preventDefault(),Jt(u.target,f[v-1]||f[f.length-1]);else if(u.key==="Home")u.preventDefault(),Jt(u.target,f[0]);else if(u.key==="End")u.preventDefault(),Jt(u.target,f[f.length-1]);else if(u.key.length===1&&h.role!=="tablist"){let P=Date.now();P-s<=e?o+=u.key.toLowerCase():o=u.key.toLowerCase(),s=P;let vt=Array.from(f).find(Rs=>Rs.textContent?.trim()?.toLowerCase()?.startsWith(o));vt&&(u.preventDefault(),Jt(u.target,vt));}}function a(){t=false,i.removeEventListener("keydown",n);}function l(u){let h=vi(u.target);if(h){t||(t=true,i.addEventListener("keydown",n));let f=bi(u.target,h);for(let v of f)v!==u.target&&v.setAttribute("tabindex",-1);}else t&&a();}function c(u){(!u.relatedTarget||u.relatedTarget===i.document)&&a();}function d(u){let h=vi(u.target);if(h){let f=bi(u.target,h);for(let v of f)v!==u.target&&v.setAttribute("tabindex",-1);u.target.setAttribute("tabindex",0);}}return i.addEventListener("click",d),i.addEventListener("focusin",l),i.addEventListener("focusout",c),()=>{a(),i.removeEventListener("click",d),i.removeEventListener("focusin",l),i.removeEventListener("focusout",c);}}}function Tr(){return r=>{let i,t;function e(o){if(o.target.getAttribute("aria-hidden")==="true"){i=o.target,i.setAttribute("aria-hidden","false"),t=i.hidden,t&&(i.hidden=false);let n=o.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');n&&(n.tabIndex=0);}}function s(o){i&&i.contains(o.target)&&(!o.relatedTarget||!i.contains(o.relatedTarget))&&(o.target.tabIndex=-1,i.setAttribute("aria-hidden","true"),t&&(i.hidden=true),i=null);}return r.addEventListener("keyuxJump",e),r.addEventListener("focusout",s),()=>{r.removeEventListener("keyuxJump",e),r.removeEventListener("focusout",s);}}}function wr(){return r=>{let i=[];function t(l){let c=r.document.activeElement;c&&c!==r.document.body&&i.push(new WeakRef(c)),l.focus({focusVisible:true});}function e(){let l=i.pop();if(!l){r.document.activeElement.blur();return}let c=l.deref();c&&c.isConnected?c.focus():e();}let s=0,o;function n(l){clearInterval(o);let c=l.getAttribute("aria-controls");o=setInterval(()=>{if(s++>50){clearInterval(o);return}let d=r.document.getElementById(c);if(d){let u=d.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');u&&(clearInterval(o),d.dispatchEvent(new r.CustomEvent("keyuxJump",{bubbles:true})),t(u));}},50);}function a(l){l.target.getAttribute("aria-controls")&&l.key==="Enter"&&n(l.target),l.key==="Escape"&&e();}return r.addEventListener("keydown",a),()=>{r.removeEventListener("keydown",a);}}}function xr(r){let i,t=r.split(" "),e;function s(a){a.key==="Enter"&&(a.target.tagName==="BUTTON"||a.target.tagName==="A")&&(o(),a.target.classList.add(...t),i=a.target,e=a.target);}function o(){i&&i.classList.remove(...t),e=null;}function n(a){a.clientX===0&&a.clientY===0&&e!==a.target&&(o(),a.target.classList.add(...t),i=a.target);}return a=>(a.addEventListener("click",n),a.addEventListener("keydown",s),a.addEventListener("keyup",o),()=>{a.removeEventListener("click",n),a.removeEventListener("keydown",s),a.removeEventListener("keyup",o);})}function Er(r,i){let t=i.map(e=>e(r));return ()=>{t.forEach(e=>e());}}var Ti=class{constructor(){this.Ae=new Map;this.zt=[];}addEventListener(i,t){let e=s=>{let o=s.target;o instanceof Node&&this.zt.some(n=>n===o||n.contains(o))&&t(s);};this.Ae.set(t,e),window.addEventListener(i,e);}removeEventListener(i,t){let e=this.Ae.get(t);e&&window.removeEventListener(i,e),this.Ae.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this.zt.push(i);}destroy(){this.zt=[];for(let i of this.Ae.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.Ae.clear();}},Me=class{constructor(){this.Ze=new Ti,this.Di=Er(this.Ze,[br(),xr("is-pressed"),wr(),Tr()]);}registerBlock(i){this.Ze.registerScope(i);}destroy(){this.Di?.(),this.Ze.destroy();}};var te={"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 wi=new Map,Cr=new Map,Sr=(r,i)=>{wi.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`);let t={...te,...i};return wi.set(r,t),t},oo=(r,i)=>{Cr.set(r,i);},no=(r,i)=>{typeof i=="function"?oo(r,i):Sr(r,i);},kr=async r=>{let i=wi.get(r);if(!i){let t=Cr.get(r);if(!t)throw new Error(`Locale ${r} is not defined`);let e=await t();i=Sr(r,e);}return i};no("en",te);var rt=r=>`*l10n/${r}`,ao="en",Ie=class extends j{constructor(t){super(t);this.jt="";for(let[e,s]of Object.entries(te)){let o=this.s.has(rt(e))?!this.s.read(rt(e)):true;this.s.add(rt(e),s,o);}this.addSub(this.s.sub(x("localeName"),async e=>{if(!e)return;this.jt=e;let s=await kr(e);if(e!==ao&&this.jt!==e)return;let o=this._i.localeDefinitionOverride?.[e];for(let[n,a]of Object.entries(s)){let l=o?.[n];this.s.add(rt(n),l??a,true);}})),this.addSub(this.s.sub(x("localeDefinitionOverride"),e=>{if(!e)return;let s=e[this.jt];if(s)for(let[o,n]of Object.entries(s))this.s.add(rt(o),n,true);}));}};var Mt=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),Pe=class extends j{constructor(){super(...arguments);this.ne=new Map;this.K=new Set;this.X=new Map;}registerModal(t,e){this.ne.set(t,e),this.Te(Mt.ADD,{id:t,modal:e});}deleteModal(t){let e=this.ne.get(t);return e?(this.ne.delete(t),this.K.delete(t),this.Te(Mt.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.ne.get(t);return e?(this.K.add(t),this.Te(Mt.OPEN,{modal:e,id:t}),true):(this.oe(`Modal with ID "${t}" not found`),false)}close(t){let e=this.ne.get(t);return !e||!this.K.has(t)?(this.oe(`Modal with ID "${t}" not found or not active`),false):(this.K.delete(t),this.Te(Mt.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.ne.has(t)?this.K.has(t)?this.close(t):this.open(t):(this.oe(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.K.size>0}back(){if(this.K.size===0)return this.oe("No active modals to go back from"),false;let t=Array.from(this.K).pop();return t?this.close(t):false}closeAll(){let t=this.K.size;return this.K.clear(),this.Te(Mt.CLOSE_ALL,{}),t}subscribe(t,e){return this.X.has(t)||this.X.set(t,new Set),this.X.get(t)?.add(e),()=>this.unsubscribe(t,e)}unsubscribe(t,e){this.X.has(t)&&this.X.get(t)?.delete(e);}Te(t,e){if(this.X.has(t))for(let s of this.X.get(t)??new Set)try{s(e);}catch(o){this.b.telemetryManager.sendEventError(o,"modal subscriber"),this.oe("Error in modal subscriber:",o);}}destroy(){super.destroy(),this.closeAll(),this.ne.clear(),this.X.clear(),this.Te(Mt.DESTROY,{});}};function lo(r){return r.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}function Ei(r){return Array.isArray(r)?r.map(i=>typeof i=="object"&&i!==null?Ei(i):i):typeof r!="object"||r===null?r:Object.fromEntries(Object.entries(r).map(([i,t])=>{let e=lo(i);return typeof t=="object"&&t!==null?[e,Ei(t)]:[e,t]}))}function co(r){return {ok:true,value:r}}function xi(r){return {ok:false,error:r}}var uo="https://tlm.uploadcare.com/api/",Ci=class{constructor(i=uo){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let s=await fetch(e,t);if(!s.ok)return xi(new Error(`Got non-200 response from "${e}". Status: ${s.status.toString()}`));try{let o=await s.json();return co(o)}catch(o){return xi(new Error(`Error parsing JSON from "${e}". Error: ${o}`))}}catch(s){return xi(new Error(`Error fetching data from "${e}". Error: ${s}`))}}async post(i,t,e={}){return await this.base(i,{...e,method:"POST",body:JSON.stringify(Ei(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},po=async(r,i)=>({success:true,data:i}),ho=async r=>po(void 0,r),$e=class extends Ci{constructor(){super();}async sendEvent(i,t){let e=await ho(i);if(!e.success)throw console.error("TelemetryAPIService: events: body is invalid",e.error),new Error("TelemetryAPIService: events: body is invalid");return this.post("v1/events",i,t)}};var fo=20,st=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),ot=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"}),Ue=class extends j{constructor(){super(...arguments);this.Re=new Map;this.Qe=new Set;}bindTarget(t){return this.Qe.add(t),()=>{this.Qe.delete(t);}}Fi(t,e){for(let s of this.Qe)s.dispatchEvent(new CustomEvent(t,{detail:e}));this.oe?.(()=>{let s=e&&typeof e=="object"?{...e}:e;return [`event "${t}"`,s]});}emit(t,e,s={}){let{debounce:o}=s;if(typeof o!="number"&&!o){this.Fi(t,typeof e=="function"?e():e);return}this.Re.has(t)&&window.clearTimeout(this.Re.get(t));let n=typeof o=="number"?o:fo,a=window.setTimeout(()=>{try{let l=typeof e=="function"?e():e;this.Fi(t,l),this.Re.delete(t);}catch(l){this.oe?.(()=>`Error while getting payload for event "${t}"`,l);}},n);this.Re.set(t,a);}destroy(){for(let t of this.Re.values())window.clearTimeout(t);this.Qe.clear();}};var Or="1.28.0";var It="blocks",Pt=Or;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 Ne=class extends j{constructor(t){super(t);this.Ms=ut.generateRandomUUID();this.we=structuredClone(L);this.Ht=false;this.Bt=null;this.Gt=false;this.Ki=new $e,this.Vi=new Ce(10),this.addSub(this.s.sub(x("qualityInsights"),e=>{this.Gt=!!e;}));for(let e of Object.keys(this.we))this.addSub(this.s.sub(x(e),s=>{this.Gt&&(this.Ht&&this.we[e]!==s&&this.sendEvent({eventType:st.CHANGE_CONFIG}),this.Is(e,s));}));}Ps(t){t===st.INIT_SOLUTION&&!this.Ht&&(this.Ht=true);}Is(t,e){this.we[t]!==e&&(this.we[t]=e);}$s(t){let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let s={...t};return (t.eventType===st.INIT_SOLUTION||t.eventType===st.CHANGE_CONFIG)&&(s.config=this.we),{...s,appVersion:Pt,appName:It,sessionId:this.Ms,component:this.Us,activity:this.Ns,projectPubkey:this.we.pubkey,userAgent:navigator.userAgent,eventType:s.eventType??"",eventTimestamp:this._s,payload:{location:this.Ds,...e}}}Fs(t){return !!(t&&[ot.CHANGE,ot.COMMON_UPLOAD_PROGRESS,ot.FILE_ADDED,ot.FILE_REMOVED,ot.FILE_UPLOAD_START,ot.FILE_UPLOAD_PROGRESS,ot.FILE_UPLOAD_SUCCESS,ot.FILE_UPLOAD_FAILED].includes(t))}sendEvent(t){if(!this.Gt)return;let e=this.$s({eventType:t.eventType,payload:t.payload,config:t.config});this.Ps(t.eventType),!(this.Fs(t.eventType)||this.Bt&&this.zi(this.Bt,e))&&this.Vi.add(async()=>{this.Bt=e,await this.Ki.sendEvent(e);});}sendEventError(t,e="unknown"){this.sendEvent({eventType:st.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}});}sendEventCloudImageEditor(t,e,s={}){this.sendEvent({eventType:st.ACTION_EVENT,payload:{metadata:{tabId:e,node:t.currentTarget?.tagName,event:t.type,...s}}});}zi(t,e){if(JSON.stringify(t)===JSON.stringify(e))return true;if(typeof t!="object"||typeof e!="object"||t==null||e==null)return false;let s=Object.keys(t),o=Object.keys(e);if(s.length!==o.length)return false;for(let n of s)if(!Object.hasOwn(e,n)||!this.zi(t[n],e[n]))return false;return true}get _s(){return Date.now()}get Us(){if(!this.s.has("*solution"))return null;let t=this.s.read("*solution");return t?t.toLowerCase():null}get Ns(){return this.s.has("*currentActivity")?this.s.read("*currentActivity"):null}get Ds(){return location.origin}};var B=[],dt=0,_e=4,Ar=r=>{let i=[],t={get(){return t.lc||t.listen(()=>{})(),t.value},lc:0,listen(e){return t.lc=i.push(e),()=>{for(let o=dt+_e;o<B.length;)B[o]===e?B.splice(o,_e):o+=_e;let s=i.indexOf(e);~s&&(i.splice(s,1),--t.lc||t.off());}},notify(e,s){let o=!B.length;for(let n of i)B.push(n,t.value,e,s);if(o){for(dt=0;dt<B.length;dt+=_e)B[dt](B[dt+1],B[dt+2],B[dt+3]);B.length=0;}},off(){},set(e){let s=t.value;s!==e&&(t.value=e,t.notify(s));},subscribe(e){let s=t.listen(e);return e(t.value),s},value:r};return t};function De(r,i,t){let e=new Set(i).add(void 0);return r.listen((s,o,n)=>{e.has(n)&&t(s,o,n);})}function Si(r,i,t){let e=De(r,i,t);return t(r.value),e}var ki=(r={})=>{let i=Ar(r);return i.setKey=function(t,e){let s=i.value;typeof e>"u"&&t in i.value?(i.value={...i.value},delete i.value[t],i.notify(s,t)):i.value[t]!==e&&(i.value={...i.value,[t]:e},i.notify(s,t));},i};var Ot=class r{static{this.Le=new Map;}constructor(i,t){this.ji=i,this.z=t;}get id(){return this.ji}pub(i,t){i in this.z.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.z.setKey(i,t);}sub(i,t,e=true){return (e?Si:De)(this.z,[i],o=>{t(o[i]);})}read(i){return i in this.z.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.z.get()[i]}add(i,t,e=false){(!(i in this.z.get())||e)&&this.z.setKey(i,t);}has(i){return i in this.z.get()}get store(){return this.z.get()}static registerCtx(i,t){if(r.Le.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=ki(i);return r.Le.set(t,e),new r(t,e)}static deleteCtx(i){r.Le.delete(i);}static getCtx(i){let t=r.Le.get(i);return t?new r(i,t):null}static hasCtx(i){return r.Le.has(i)}};var Rr=r=>{let i=new Intl.Locale(r),t="ltr",e=i.getTextInfo?.().direction;return e?t=e:i.textInfo?.direction&&(t=i.textInfo.direction),t};var go=r=>r;var Lr="plural:";function Fe(r,i={},t={}){let{openToken:e="{{",closeToken:s="}}",transform:o=go}=t;for(let n in i){let a=i[n],l=a?.toString(),c=typeof l=="string"?o(l):String(l);r=r.replaceAll(e+n+s,c);}return r}function Mr(r){let i=[],t=r.indexOf("{{");for(;t!==-1;){let e=r.indexOf("}}",t);if(e===-1)break;let s=r.substring(t+2,e);if(s.startsWith(Lr)){let o=r.substring(t+2,e).replace(Lr,""),n=o.substring(0,o.indexOf("(")),a=o.substring(o.indexOf("(")+1,o.indexOf(")"));i.push({variable:s,pluralKey:n,countVariable:a});}t=r.indexOf("{{",e);}return i}function U(r,i){let t,e=((...s)=>{t&&clearTimeout(t),t=setTimeout(()=>r(...s),i);});return e.cancel=()=>{t&&clearTimeout(t);},e}var Ir="--uploadcare-blocks-window-height",ee=class r{static{this.clientsRegistry=new Set;}static{this.flush=U(()=>{document.documentElement.style.setProperty(Ir,`${window.innerHeight}px`);},100);}static registerClient(i){r.clientsRegistry.size===0&&r.attachTracker(),r.clientsRegistry.add(i);}static unregisterClient(i){r.clientsRegistry.delete(i),r.clientsRegistry.size===0&&r.detachTracker();}static attachTracker(){window.addEventListener("resize",r.flush,{passive:true,capture:true}),r.flush();}static detachTracker(){window.removeEventListener("resize",r.flush,{capture:true}),document.documentElement.style.removeProperty(Ir);}};var vo=/\\([0-9a-fA-F]{1,6} ?)/g;function bo(r){return r.length<2?false:(r[0]==='"'||r[0]==="'")&&(r[r.length-1]==='"'||r[r.length-1]==="'")}function To(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 wo(r){let i="",t="";for(let e=0;e<r.length;e++){let s=r[e+1];r[e]==="\\"&&s==='"'?(i+='\\"',e++):r[e]==='"'&&t!=="\\"?i+='\\"':i+=r[e],t=r[e]??"";}return i}function Pr(r){let i=r;bo(r)&&(i=To(i),i=i.replace(vo,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=wo(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}function $r(r){class i extends r{constructor(){super(...arguments);this.Hi=null;this.qt=null;}getCssData(s,o=false){let n=this.Hi??Object.create(null);if(!Object.keys(n).includes(s)||!n[s]){this.qt||(this.qt=window.getComputedStyle(this));let a=this.qt.getPropertyValue(s).trim();try{n[s]=Pr(a);}catch(l){o||console.warn(`CSS Data error: ${s}`,l),n[s]=null;}}return this.Hi=n,n[s]}}return i}function Ur(r){class i extends r{constructor(){super(...arguments);this.willYield=true;this.ae={};this.le=null;this.Je=false;}createRenderRoot(){return this}connectedCallback(){this.le||(this.le=Array.from(this.childNodes)),super.connectedCallback();}Ks(){if(this.Je)retu