@uploadcare/file-uploader 1.5.3-alpha.3 → 1.5.3-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,7 +24,7 @@
24
24
  * SOFTWARE.
25
25
  *
26
26
  */
27
- var vn=Object.defineProperty;var wn=Object.getPrototypeOf;var Cn=Reflect.get;var xn=(r,i,t)=>i in r?vn(r,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[i]=t;var u=(r,i,t)=>(xn(r,typeof i!="symbol"?i+"":i,t),t),ur=(r,i,t)=>{if(!i.has(r))throw TypeError("Cannot "+t)};var _=(r,i,t)=>(ur(r,i,"read from private field"),t?t.call(r):i.get(r)),O=(r,i,t)=>{if(i.has(r))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(r):i.set(r,t)},F=(r,i,t,e)=>(ur(r,i,"write to private field"),e?e.call(r,t):i.set(r,t),t);var P=(r,i,t)=>(ur(r,i,"access private method"),t),q=(r,i,t)=>Cn(wn(r),t,i);var g={BIND_ATTR:"bind",ATTR_BIND_PX:"@",SHARED_CTX_PX:"*",PARENT_CTX_PX:"^",NAMED_CTX_SPLTR:"/",COMPUTED_PX:"+",CSS_DATA_PX:"--",CTX_NAME_ATTR:"ctx",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx",EL_REF_ATTR:"ref",AUTO_TAG_PX:"sym",LIST_ATTR:"itemize",LIST_ITEM_TAG_ATTR:"item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL_ATTR:"use-template",DEFAULT_SLOT_KEY:"__default__",TEXT_NODE_SKIP_ATTR:"skip-text-nodes",TEXT_NODE_OPEN_TOKEN:"{{",TEXT_NODE_CLOSE_TOKEN:"}}"};function En(r){let i=t=>{var e;for(let s in t)((e=t[s])==null?void 0:e.constructor)===Object&&(t[s]=i(t[s]));return{...t}};return i(r)}var te,ee,Ot,Lt,Qt,ri,fs,H=class H{constructor(i){O(this,te,void 0);O(this,ee,void 0);O(this,Ot,void 0);i.constructor===Object?this.store=En(i):(F(this,Ot,!0),this.store=i),this.callbackMap=Object.create(null)}read(i){var t,e;if(!_(this,Ot)&&!this.store.hasOwnProperty(i))return P(t=H,Lt,Qt).call(t,"read",i),null;if(typeof i=="string"&&i.startsWith(g.COMPUTED_PX)){let s=this.store[i];if((s==null?void 0:s.constructor)!==Function){P(e=H,Lt,Qt).call(e,"compute",i);return}this.__computedMap||(this.__computedMap={});let o=s();return Object.keys(this.__computedMap).includes(i)||(this.__computedMap[i]=o,this.notify(i)),o}else return this.store[i]}has(i){return _(this,Ot)?this.store[i]!==void 0:this.store.hasOwnProperty(i)}add(i,t,e=!1){!e&&Object.keys(this.store).includes(i)||(this.store[i]=t,this.notify(i))}pub(i,t){var e,s;if(!_(this,Ot)&&!this.store.hasOwnProperty(i)){P(e=H,Lt,Qt).call(e,"publish",i);return}if(i!=null&&i.startsWith(g.COMPUTED_PX)&&t.constructor!==Function){P(s=H,Lt,Qt).call(s,"publish computed",i);return}!(this.store[i]===null||t===null)&&typeof this.store[i]!=typeof t&&console.warn(`Symbiote PubSub: type warning for "${i}" [${typeof this.store[i]} -> ${typeof t}]`),this.store[i]=t,this.notify(i)}get proxy(){if(!_(this,ee)){let i=Object.create(null);F(this,ee,new Proxy(i,{set:(t,e,s)=>(this.pub(e,s),!0),get:(t,e)=>{this.read(e)}}))}return _(this,ee)}multiPub(i){for(let t in i)this.pub(t,i[t])}notify(i){var e;let t=i==null?void 0:i.startsWith(g.COMPUTED_PX);if(this.callbackMap[i]){let s=this.read(i);this.callbackMap[i].forEach(o=>{o(s)}),t&&(this.__computedMap[i]=s)}!t&&P(e=H,ri,fs).call(e,this,i)}sub(i,t,e=!0){var s;return!_(this,Ot)&&!this.store.hasOwnProperty(i)?(P(s=H,Lt,Qt).call(s,"subscribe",i),null):(this.callbackMap[i]||(this.callbackMap[i]=new Set),this.callbackMap[i].add(t),e&&t(this.read(i)),{remove:()=>{this.callbackMap[i].delete(t),this.callbackMap[i].size||delete this.callbackMap[i]},callback:t})}set uid(i){!_(this,te)&&F(this,te,i)}get uid(){return _(this,te)}static registerCtx(i,t=Symbol()){let e=H.globalStore.get(t);return e?console.warn('PubSub: context UID "'+t+'" is already in use'):(e=new H(i),e.uid=t,H.globalStore.set(t,e)),e}static deleteCtx(i){H.globalStore.delete(i)}static getCtx(i,t=!0){return H.globalStore.get(i)||(t&&console.warn('PubSub: wrong context UID - "'+i+'"'),null)}};te=new WeakMap,ee=new WeakMap,Ot=new WeakMap,Lt=new WeakSet,Qt=function(i,t){console.warn(`Symbiote PubSub: cannot ${i}. Prop name: `+t)},ri=new WeakSet,fs=function(i,t){this.globalStore.forEach(e=>{e.__computedMap&&Object.keys(e.__computedMap).forEach(s=>{if(e===i&&t===s)return;let o=`__${s}_timeout`;e[o]&&window.clearTimeout(e[o]),e[o]=window.setTimeout(()=>{let n=e.read(s);n!==e.__computedMap[s]&&(e.__computedMap[s]=n,e.notify(s))})})})},O(H,Lt),O(H,ri);var $=H;$.globalStore=new Map;var wt=$;var ms="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",An=ms.length-1,nt=class{static generate(i="XXXXXXXXX-XXX"){let t="";for(let e=0;e<i.length;e++)t+=i[e]==="-"?i[e]:ms.charAt(Math.random()*An);return t}};function _e(r,i,t){let e=!0,s,o=i.split(".");return o.forEach((n,l)=>{l<o.length-1?r=r[n]:s=n}),r?r[s]=t:e=!1,e}function hr(r){let i;return r.constructor===CSSStyleSheet?i=r:r.constructor===String&&(i=new CSSStyleSheet,i.replaceSync(r)),i}function gs(r,i){[...r.querySelectorAll(`[${g.LIST_ATTR}]`)].filter(t=>!t.matches(`[${g.LIST_ATTR}] [${g.LIST_ATTR}]`)).forEach(t=>{var n;let e=t.getAttribute(g.LIST_ITEM_TAG_ATTR),s;for(e&&(s=window.customElements.get(e)),s||(s=class extends i.Symbiote{constructor(){super(),e||(this.style.display="contents")}},s.template=((n=t.querySelector("template"))==null?void 0:n.innerHTML)||t.innerHTML,s.reg(e));t.firstChild;)t.firstChild.remove();let o=t.getAttribute(g.LIST_ATTR);i.sub(o,l=>{if(!l){for(;t.firstChild;)t.firstChild.remove();return}let a=[...t.children],c,d=h=>{h.forEach((f,m)=>{if(a[m])if(a[m].set$)a[m].set$(f);else for(let y in f)a[m][y]=f[y];else{c||(c=new DocumentFragment);let y=new s;Object.assign((y==null?void 0:y.init$)||y,f),c.appendChild(y)}}),c&&t.appendChild(c);let p=a.slice(h.length,a.length);for(let f of p)f.remove()};if(l.constructor===Array)d(l);else if(l.constructor===Object){let h=[];for(let p in l){let f=l[p];Object.defineProperty(f,"_KEY_",{value:p,enumerable:!0}),h.push(f)}d(h)}else console.warn("Symbiote list data type error:"),console.log(l)}),t.removeAttribute(g.LIST_ATTR),t.removeAttribute(g.LIST_ITEM_TAG_ATTR)})}function Tn(r,i){[...r.querySelectorAll(`[${g.EL_REF_ATTR}]`)].forEach(t=>{let e=t.getAttribute(g.EL_REF_ATTR);i.ref[e]=t,t.removeAttribute(g.EL_REF_ATTR)})}function Sn(r,i){[...r.querySelectorAll(`[${g.BIND_ATTR}]`)].forEach(t=>{t.getAttribute(g.BIND_ATTR).split(";").forEach(o=>{if(!o)return;let n=o.split(":").map(d=>d.trim()),l=n[0],a;l.indexOf(g.ATTR_BIND_PX)===0&&(a=!0,l=l.replace(g.ATTR_BIND_PX,""));let c=n[1].split(",").map(d=>d.trim());for(let d of c){let h;d.startsWith("!!")?(h="double",d=d.replace("!!","")):d.startsWith("!")&&(h="single",d=d.replace("!","")),!i.has(d)&&i.allowTemplateInits&&(d.startsWith(g.ATTR_BIND_PX)?i.add(d,i.getAttribute(d.replace(g.ATTR_BIND_PX,""))):i.add(d,null)),i.sub(d,p=>{h==="double"?p=!!p:h==="single"&&(p=!p),a?(p==null?void 0:p.constructor)===Boolean?p?t.setAttribute(l,""):t.removeAttribute(l):t.setAttribute(l,p):_e(t,l,p)||(t[g.SET_LATER_KEY]||(t[g.SET_LATER_KEY]=Object.create(null)),t[g.SET_LATER_KEY][l]=p)},!(i.ssrMode&&(l==="textContent"||a)))}}),t.removeAttribute(g.BIND_ATTR)})}function kn(r){let i,t=[],e=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,{acceptNode:s=>{var o;return!((o=s.parentElement)!=null&&o.hasAttribute(g.TEXT_NODE_SKIP_ATTR))&&s.textContent.includes(g.TEXT_NODE_OPEN_TOKEN)&&s.textContent.includes(g.TEXT_NODE_CLOSE_TOKEN)&&1}});for(;i=e.nextNode();)t.push(i);return t}var $n=function(r,i){kn(r).forEach(e=>{let s=[],o;for(;e.textContent.includes(g.TEXT_NODE_CLOSE_TOKEN);)e.textContent.startsWith(g.TEXT_NODE_OPEN_TOKEN)?(o=e.textContent.indexOf(g.TEXT_NODE_CLOSE_TOKEN)+g.TEXT_NODE_CLOSE_TOKEN.length,e.splitText(o),s.push(e)):(o=e.textContent.indexOf(g.TEXT_NODE_OPEN_TOKEN),e.splitText(o)),e=e.nextSibling;s.forEach(n=>{let l=n.textContent.replace(g.TEXT_NODE_OPEN_TOKEN,"").replace(g.TEXT_NODE_CLOSE_TOKEN,"");n.textContent="",!i.has(l)&&i.allowTemplateInits&&(l.startsWith(g.ATTR_BIND_PX)?(i.add(l,i.getAttribute(l.replace(g.ATTR_BIND_PX,""))),i.initAttributeObserver()):i.add(l,null)),i.sub(l,a=>{n.textContent=a})})})},bs=[gs,Tn,Sn,$n];var si="'",ie='"',In=/\\([0-9a-fA-F]{1,6} ?)/g;function On(r){return(r[0]===ie||r[0]===si)&&(r[r.length-1]===ie||r[r.length-1]===si)}function Ln(r){return(r[0]===ie||r[0]===si)&&(r=r.slice(1)),(r[r.length-1]===ie||r[r.length-1]===si)&&(r=r.slice(0,-1)),r}function Un(r){let i="",t="";for(var 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 ys(r){let i=r;On(r)&&(i=Ln(i),i=i.replace(In,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\
28
- `,"\\n"),i=Un(i),i=ie+i+ie);try{return JSON.parse(i)}catch{throw new Error(`Failed to parse CSS property value: ${i}. Original input: ${r}`)}}var Mn=[g.LIST_ATTR,g.LIST_ITEM_TAG_ATTR,g.EL_REF_ATTR,g.USE_TPL_ATTR,g.CTX_NAME_ATTR,g.CTX_OWNER_ATTR];function b(r,...i){let t="";return r.forEach((e,s)=>{var o;if(t+=e,((o=i[s])==null?void 0:o.constructor)===Object){let n="";for(let l in i[s])Mn.includes(l)?t+=` ${l}="${i[s][l]}"`:n+=`${l}:${i[s][l]};`;n&&(t+=` ${g.BIND_ATTR}="${n}"`)}else i[s]&&(t+=i[s])}),t}function lt(r,...i){let t="",e=new CSSStyleSheet;return r.forEach((s,o)=>{t+=s+i[o]}),lt.processors.forEach(s=>{t=s(t)}),lt.clearProcessors(),e.replaceSync(t),e}lt.processors=[];lt.clearProcessors=function(){lt.processors=[]};lt.useProcessor=function(...r){return lt.processors=[...lt.processors,...r],lt};var _s=0,ve,jt,we,Ut,re,Ce,Mt,dt,Gt,Xt,D,xe,pr,Ct,Ht,oi,vs,ni,ws,Ee,fr,li,Cs,Ae,mr,it=class it extends HTMLElement{constructor(){super();O(this,xe);O(this,oi);O(this,ni);O(this,Ee);O(this,li);O(this,Ae);O(this,ve,void 0);O(this,jt,void 0);O(this,we,void 0);O(this,Ut,void 0);O(this,re,void 0);O(this,Ce,void 0);O(this,Mt,void 0);O(this,dt,void 0);O(this,Gt,void 0);O(this,Xt,void 0);O(this,D,this.constructor);u(this,"updateCssData",()=>{var t;this.dropCssDataCache(),(t=_(this,Xt))==null||t.forEach(e=>{let s=this.getCssData(P(this,Ae,mr).call(this,e),!0);s!==null&&this.$[e]!==s&&(this.$[e]=s)})});this.init$=Object.create(null),this.cssInit$=Object.create(null),this.tplProcessors=new Set,this.ref=Object.create(null),this.allSubs=new Set,this.pauseRender=!1,this.renderShadow=!1,this.readyToDestroy=!0,this.processInnerHtml=!1,this.ssrMode=!1,this.allowCustomTemplate=!1,this.ctxOwner=!1,this.isVirtual=!1,this.allowTemplateInits=!0}get Symbiote(){return it}initCallback(){}renderCallback(){}render(t,e=this.renderShadow){let s;if((e||_(this,D).shadowStyleSheets)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let n=this.getAttribute(g.USE_TPL_ATTR);if(n){let l=this.getRootNode(),a=(l==null?void 0:l.querySelector(n))||document.querySelector(n);a?t=a.content.cloneNode(!0):console.warn(`Symbiote template "${n}" is not found...`)}}if(this.processInnerHtml||this.ssrMode)for(let n of this.tplProcessors)n(this,this);if(t||_(this,D).template){if(_(this,D).template&&!_(this,D).__tpl&&(_(this,D).__tpl=document.createElement("template"),_(this,D).__tpl.innerHTML=_(this,D).template),(t==null?void 0:t.constructor)===DocumentFragment)s=t;else if((t==null?void 0:t.constructor)===String){let n=document.createElement("template");n.innerHTML=t,s=n.content.cloneNode(!0)}else _(this,D).__tpl&&(s=_(this,D).__tpl.content.cloneNode(!0));for(let n of this.tplProcessors)n(s,this)}let o=()=>{var n;s&&this.isVirtual?this.replaceWith(s):s&&(e&&this.shadowRoot.appendChild(s)||this.appendChild(s)),P(this,xe,pr).call(this),(n=this.renderCallback)==null||n.call(this)};_(this,D).shadowStyleSheets&&(e=!0,this.shadowRoot.adoptedStyleSheets=[..._(this,D).shadowStyleSheets]),o()}addTemplateProcessor(t){this.tplProcessors.add(t)}get autoCtxName(){return _(this,jt)||(F(this,jt,nt.generate()),this.style.setProperty(g.CSS_CTX_PROP,`'${_(this,jt)}'`)),_(this,jt)}get cssCtxName(){return this.getCssData(g.CSS_CTX_PROP,!0)}get ctxName(){var e;let t=((e=this.getAttribute(g.CTX_NAME_ATTR))==null?void 0:e.trim())||this.cssCtxName||_(this,we)||this.autoCtxName;return F(this,we,t),t}get localCtx(){return _(this,Ut)||F(this,Ut,wt.registerCtx({})),_(this,Ut)}get sharedCtx(){return wt.getCtx(this.ctxName,!1)||wt.registerCtx({},this.ctxName)}sub(t,e,s=!0){var l;let o=a=>{_(this,Ee,fr)||e(a)},n=P(l=it,Ct,Ht).call(l,t,this);n.ctx.has(n.name)?this.allSubs.add(n.ctx.sub(n.name,o,s)):window.setTimeout(()=>{this.allSubs.add(n.ctx.sub(n.name,o,s))})}notify(t){var s;let e=P(s=it,Ct,Ht).call(s,t,this);e.ctx.notify(e.name)}has(t){var s;let e=P(s=it,Ct,Ht).call(s,t,this);return e.ctx.has(e.name)}add(t,e,s=!1){var n;let o=P(n=it,Ct,Ht).call(n,t,this);o.ctx.add(o.name,e,s)}add$(t,e=!1){for(let s in t)this.add(s,t[s],e)}get $(){if(!_(this,re)){let t=Object.create(null);F(this,re,new Proxy(t,{set:(e,s,o)=>{var l;let n=P(l=it,Ct,Ht).call(l,s,this);return n.ctx.pub(n.name,o),!0},get:(e,s)=>{var n;let o=P(n=it,Ct,Ht).call(n,s,this);return o.ctx.read(o.name)}}))}return _(this,re)}set$(t,e=!1){for(let s in t){let o=t[s];e||![String,Number,Boolean].includes(o==null?void 0:o.constructor)?this.$[s]=o:this.$[s]!==o&&(this.$[s]=o)}}initAttributeObserver(){this.attributeMutationObserver||(this.attributeMutationObserver=new MutationObserver(t=>{for(let e of t)if(e.type==="attributes"){let s=g.ATTR_BIND_PX+e.attributeName;this.has(s)&&(this.$[s]=this.getAttribute(e.attributeName))}}),this.attributeMutationObserver.observe(this,{attributes:!0}))}connectedCallback(){P(this,li,Cs).call(this)}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(_(this,Mt)&&window.clearTimeout(_(this,Mt)),F(this,Mt,window.setTimeout(()=>{this.destroyCallback(),this.attributeMutationObserver&&this.attributeMutationObserver.disconnect();for(let t of this.allSubs)t.remove(),this.allSubs.delete(t);_(this,Ut)&&wt.deleteCtx(_(this,Ut).uid);for(let t of this.tplProcessors)this.tplProcessors.delete(t)},100))))}static reg(t,e=!1){t||(_s++,t=`${g.AUTO_TAG_PX}-${_s}`),this.__tag=t;let s=window.customElements.get(t);if(s){!e&&s!==this&&console.warn([`Element with tag name "${t}" 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(`
29
- `));return}window.customElements.define(t,e?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(t){this.observedAttributes=[...new Set((this.observedAttributes||[]).concat(Object.keys(t)))],this.__attrDesc=t}attributeChangedCallback(t,e,s){var n;if(e===s)return;let o=(n=_(this,D).__attrDesc)==null?void 0:n[t];o?_(this,Ce)?this.$[o]=s:this.init$[o]=s:this[t]=s}getCssData(t,e=!1){if(_(this,dt)||F(this,dt,Object.create(null)),!Object.keys(_(this,dt)).includes(t)){_(this,Gt)||F(this,Gt,window.getComputedStyle(this));let s=_(this,Gt).getPropertyValue(t).trim();try{_(this,dt)[t]=ys(s)}catch{!e&&console.warn(`CSS Data error: ${t}`),_(this,dt)[t]=null}}return _(this,dt)[t]}bindCssData(t,e=""){_(this,Xt)||F(this,Xt,new Set),_(this,Xt).add(t);let s=this.getCssData(P(this,Ae,mr).call(this,t),!0);s===null&&(s=e),t.startsWith(g.CSS_DATA_PX)?this.localCtx.add(t,s):this.add(t,s)}dropCssDataCache(){F(this,dt,null),F(this,Gt,null)}defineAccessor(t,e,s){let o="#"+t;this[o]=this[t],Object.defineProperty(this,t,{set:n=>{this[o]=n,s?window.setTimeout(()=>{e==null||e(n)}):e==null||e(n)},get:()=>this[o]}),this[t]=this[o]}static addRootStyles(t){this.rootStyleSheets||(this.rootStyleSheets=[]),this.rootStyleSheets.push(hr(t))}static addShadowStyles(t){this.shadowStyleSheets||(this.shadowStyleSheets=[]),this.shadowStyleSheets.push(hr(t))}static set rootStyles(t){this.rootStyleSheets=[],this.addRootStyles(t)}static set shadowStyles(t){this.shadowStyleSheets=[],this.addShadowStyles(t)}};ve=new WeakMap,jt=new WeakMap,we=new WeakMap,Ut=new WeakMap,re=new WeakMap,Ce=new WeakMap,Mt=new WeakMap,dt=new WeakMap,Gt=new WeakMap,Xt=new WeakMap,D=new WeakMap,xe=new WeakSet,pr=function(){var t;_(this,ve)||(F(this,ve,!0),(t=this.initCallback)==null||t.call(this))},Ct=new WeakSet,Ht=function(t,e){var n;let s,o;if(t.startsWith(g.SHARED_CTX_PX))s=e.sharedCtx,o=t.replace(g.SHARED_CTX_PX,"");else if(t.startsWith(g.PARENT_CTX_PX)){o=t.replace(g.PARENT_CTX_PX,"");let l=e;for(;l&&!((n=l==null?void 0:l.has)!=null&&n.call(l,o));)l=l.parentElement||l.parentNode||l.host;s=(l==null?void 0:l.localCtx)||e.localCtx}else if(t.includes(g.NAMED_CTX_SPLTR)){let l=t.split(g.NAMED_CTX_SPLTR);s=wt.getCtx(l[0]),o=l[1]}else t.startsWith(g.CSS_DATA_PX)?(s=e.localCtx,o=t,s.has(o)||e.bindCssData(o)):(s=e.localCtx,o=t);return{ctx:s,name:o}},oi=new WeakSet,vs=function(){return this.ctxOwner||this.hasAttribute(g.CTX_OWNER_ATTR)&&this.getAttribute(g.CTX_OWNER_ATTR)!=="false"},ni=new WeakSet,ws=function(){let t=_(this,D).__attrDesc;if(t)for(let e of Object.values(t))Object.keys(this.init$).includes(e)||(this.init$[e]="");for(let e in this.init$)if(e.startsWith(g.SHARED_CTX_PX))this.sharedCtx.add(e.replace(g.SHARED_CTX_PX,""),this.init$[e],_(this,oi,vs));else if(e.startsWith(g.ATTR_BIND_PX))this.localCtx.add(e,this.getAttribute(e.replace(g.ATTR_BIND_PX,""))||this.init$[e]),this.initAttributeObserver();else if(e.includes(g.NAMED_CTX_SPLTR)){let s=e.split(g.NAMED_CTX_SPLTR),o=s[0].trim(),n=s[1].trim();if(o&&n){let l=wt.getCtx(o,!1);l||(l=wt.registerCtx({},o)),l.add(n,this.init$[e])}}else this.localCtx.add(e,this.init$[e]);for(let e in this.cssInit$)this.bindCssData(e,this.cssInit$[e]);F(this,Ce,!0)},Ee=new WeakSet,fr=function(){return!this.isVirtual&&!this.isConnected},li=new WeakSet,Cs=function(){var t;if(!_(this,Ee,fr)){if(_(this,Mt)&&window.clearTimeout(_(this,Mt)),!this.connectedOnce){let e=(t=this.getAttribute(g.CTX_NAME_ATTR))==null?void 0:t.trim();if(e&&this.style.setProperty(g.CSS_CTX_PROP,`'${e}'`),P(this,ni,ws).call(this),this[g.SET_LATER_KEY]){for(let s in this[g.SET_LATER_KEY])_e(this,s,this[g.SET_LATER_KEY][s]);delete this[g.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let s of bs)this.addTemplateProcessor(s);if(this.pauseRender)P(this,xe,pr).call(this);else{if(_(this,D).rootStyleSheets){let s=this.getRootNode();if(!s)return;let o=new Set([...s.adoptedStyleSheets,..._(this,D).rootStyleSheets]);s.adoptedStyleSheets=[...o]}this.render()}}this.connectedOnce=!0}},Ae=new WeakSet,mr=function(t){return t.split("--").map((e,s)=>s===0?"":e).join("--")},O(it,Ct),u(it,"__tpl"),u(it,"template");var dr=it,xt=dr;function Wt(r,i){for(let t in i)t.includes("-")?r.style.setProperty(t,i[t]):r.style[t]=i[t]}function xs(r,i){for(let t in i)i[t].constructor===Boolean?i[t]?r.setAttribute(t,""):r.removeAttribute(t):r.setAttribute(t,i[t])}function Te(r={tag:"div"}){let i=document.createElement(r.tag);if(r.attributes&&xs(i,r.attributes),r.styles&&Wt(i,r.styles),r.properties)for(let t in r.properties)i[t]=r.properties[t];return r.processors&&r.processors.forEach(t=>{t(i)}),r.children&&r.children.forEach(t=>{let e=Te(t);i.appendChild(e)}),i}function gr(r){Object.assign(g,r)}function br(r,i){if(i.shadowRoot)return;let t=[...r.querySelectorAll("slot")];if(!t.length)return;let e={};t.forEach(s=>{let o=s.getAttribute("name")||g.DEFAULT_SLOT_KEY;e[o]={slot:s,fr:document.createDocumentFragment()}}),i.initChildren.forEach(s=>{var n;let o=g.DEFAULT_SLOT_KEY;s instanceof Element&&s.hasAttribute("slot")&&(o=s.getAttribute("slot"),s.removeAttribute("slot")),(n=e[o])==null||n.fr.appendChild(s)}),Object.values(e).forEach(s=>{if(s.fr.childNodes.length)s.slot.parentNode.replaceChild(s.fr,s.slot);else if(s.slot.childNodes.length){let o=document.createDocumentFragment();o.append(...s.slot.childNodes),s.slot.parentNode.replaceChild(o,s.slot)}else s.slot.remove()})}gr({BIND_ATTR:"set",CTX_NAME_ATTR:"ctx-name",CSS_CTX_PROP:"--ctx-name"});var Es=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},ai=(...r)=>r.filter(i=>typeof i=="string"&&i).map(i=>Es(i)).join("/-/"),j=(...r)=>{let i=ai(...r);return i?`-/${i}/`:""};function ci(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 ui(r){let i=new URL(r),{pathname:t}=i,e=t.indexOf("/"),s=t.indexOf("/",e+1);return t.substring(e+1,s)}function yr(r){let i=Ts(r),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}function As(r){return yr(r).split("/-/").filter(Boolean).map(t=>Es(t))}function Ts(r){let i=new URL(r),t=ci(r),e=Ss(t)?ks(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function Ss(r){return r.startsWith("http")}function ks(r){let i=new URL(r);return{pathname:i.origin+i.pathname||"",search:i.search||"",hash:i.hash||""}}var R=(r,i,t)=>{let e=new URL(Ts(r));if(t=t||ci(r),e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),Ss(t)){let s=ks(t);e.pathname=e.pathname+(i||"")+(s.pathname||""),e.search=s.search,e.hash=s.hash}else e.pathname=e.pathname+(i||"")+(t||"");return e.toString()},Pt=(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 tt=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:!1,flip:!1,crop:void 0}),Is=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Pn(r,i){if(typeof i=="number"){let t=i;return tt[r]!==t?`${r}/${t}`:""}if(typeof i=="boolean"){let t=i;return tt[r]!==t?`${r}`:""}if(r==="filter"&&i){let{name:t,amount:e}=i;return tt.filter===e?"":`${r}/${t}/${e}`}if(r==="crop"&&i){let{dimensions:t,coords:e}=i;return`${r}/${t.join("x")}/${e.join(",")}`}return""}function Rt(r){return ai(...Is.filter(i=>typeof r[i]!="undefined"&&r[i]!==null).map(i=>{let t=r[i];return Pn(i,t)}).filter(i=>!!i))}var hi=ai("format/auto","progressive/yes"),Et=([r])=>typeof r!="undefined"?Number(r):void 0,$s=()=>!0,Rn=([r,i])=>({name:r,amount:typeof i!="undefined"?Number(i):100}),Fn=([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)}},Dn=Object.freeze({enhance:Et,brightness:Et,exposure:Et,gamma:Et,contrast:Et,saturation:Et,vibrance:Et,warmth:Et,filter:Rn,mirror:$s,flip:$s,rotate:Et,crop:Fn});function Os(r){let i={};for(let t of r){let[e,...s]=t.split("/");if(!Is.includes(e))continue;let o=e,n=Dn[o];try{let l=n(s);i[o]=l}catch(l){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,l instanceof Error?`Error message: "${l.message}"`:l,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(`
30
- `))}}return i}var U=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),Z=[U.CROP,U.TUNING,U.FILTERS],Ls=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],Us=["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"],Ms=["rotate","mirror","flip"],pt=Object.freeze({brightness:{zero:tt.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:tt.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:tt.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:tt.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:tt.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:tt.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:tt.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:tt.enhance,range:[0,100],keypointsNumber:1},filter:{zero:tt.filter,range:[0,100],keypointsNumber:1}});var Ps=r=>r?r.split(",").map(i=>i.trim()):[],se=r=>r?r.join(","):"";var Nn="https://ucarecdn.com",Bn="https://upload.uploadcare.com",zn="https://social.uploadcare.com",at={pubkey:"",multiple:!0,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",store:"auto",cameraMirror:!1,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",cloudImageEditorTabs:se(Z),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",imageShrink:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:Nn,baseUrl:Bn,socialBaseUrl:zn,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:1,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",debug:!1,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:10*60*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[]};var I=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"}),di=class{constructor(i){u(this,"_timeoutStore",new Map);u(this,"_targets",new Set);u(this,"_debugPrint",null);this._debugPrint=i}bindTarget(i){this._targets.add(i)}unbindTarget(i){this._targets.delete(i)}_dispatch(i,t){var e;for(let s of this._targets)s.dispatchEvent(new CustomEvent(i,{detail:t}));(e=this._debugPrint)==null||e.call(this,()=>{let s=t&&typeof t=="object"?{...t}:t;return[`event "${i}"`,s]})}emit(i,t,{debounce:e}={}){if(typeof e!="number"&&!e){this._dispatch(i,typeof t=="function"?t():t);return}this._timeoutStore.has(i)&&window.clearTimeout(this._timeoutStore.get(i));let s=typeof e=="number"?e:20,o=window.setTimeout(()=>{this._dispatch(i,typeof t=="function"?t():t),this._timeoutStore.delete(i)},s);this._timeoutStore.set(i,o)}};function M(r,i){let t,e=(...s)=>{clearTimeout(t),t=setTimeout(()=>r(...s),i)};return e.cancel=()=>{clearTimeout(t)},e}var Rs="--uploadcare-blocks-window-height",Kt=class{static registerClient(i){this.clientsRegistry.size===0&&this.attachTracker(),this.clientsRegistry.add(i)}static unregisterClient(i){this.clientsRegistry.delete(i),this.clientsRegistry.size===0&&this.detachTracker()}static attachTracker(){window.addEventListener("resize",this.flush,{passive:!0,capture:!0}),this.flush()}static detachTracker(){window.removeEventListener("resize",this.flush,{capture:!0}),document.documentElement.style.removeProperty(Rs)}};u(Kt,"clientsRegistry",new Set),u(Kt,"flush",M(()=>{document.documentElement.style.setProperty(Rs,`${window.innerHeight}px`)},100));var Fs=r=>{var e;let i=new Intl.Locale(r),t="ltr";return typeof i.getTextInfo=="function"&&i.getTextInfo().direction?t=i.getTextInfo().direction:"textInfo"in i&&((e=i.textInfo)!=null&&e.direction)&&(t=i.textInfo.direction),t};var pi=(r,i)=>new Intl.PluralRules(r).select(i);var Vn=r=>r,_r="{{",Ns="}}",Ds="plural:";function Se(r,i,t={}){var n;let{openToken:e=_r,closeToken:s=Ns,transform:o=Vn}=t;for(let l in i){let a=(n=i[l])==null?void 0:n.toString();r=r.replaceAll(e+l+s,typeof a=="string"?o(a):a)}return r}function Bs(r){let i=[],t=r.indexOf(_r);for(;t!==-1;){let e=r.indexOf(Ns,t),s=r.substring(t+2,e);if(s.startsWith(Ds)){let o=r.substring(t+2,e).replace(Ds,""),n=o.substring(0,o.indexOf("(")),l=o.substring(o.indexOf("(")+1,o.indexOf(")"));i.push({variable:s,pluralKey:n,countVariable:l})}t=r.indexOf(_r,e)}return i}function zs(){let r,i,t=new Promise((e,s)=>{r=e,i=s});return{resolve:r,reject:i,promise:t}}var Vs=async({element:r,attribute:i,timeout:t=300})=>{let{promise:e,resolve:s}=zs(),o=r.getAttribute(i);if(o!==null)return s({success:!0,value:o,attribute:i}),e;let n=new MutationObserver(c=>{let d=c[c.length-1];a(d)});n.observe(r,{attributes:!0,attributeFilter:[i]});let l=setTimeout(()=>{n.disconnect(),s({success:!1,attribute:i})},t),a=c=>{let d=r.getAttribute(i);c.type==="attributes"&&c.attributeName===i&&d!==null&&(clearTimeout(l),n.disconnect(),s({success:!0,value:d,attribute:i}))};return e};function Hs(r){return Object.prototype.toString.call(r)==="[object Object]"}var Hn=/\W|_/g;function jn(r){return r.split(Hn).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}function js(r,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(r)?r.map(t=>St(t,{ignoreKeys:i})):r}function St(r,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(r))return js(r,{ignoreKeys:i});if(!Hs(r))return r;let t={};for(let e of Object.keys(r)){let s=r[e];if(i.includes(e)){t[e]=s;continue}Hs(s)?s=St(s,{ignoreKeys:i}):Array.isArray(s)&&(s=js(s,{ignoreKeys:i})),t[jn(e)]=s}return t}var Gn=r=>new Promise(i=>setTimeout(i,r));function Tr({libraryName:r,libraryVersion:i,userAgent:t,publicKey:e="",integration:s=""}){let o="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:r,libraryVersion:i,languageName:o,integration:s});let n=[r,i,e].filter(Boolean).join("/"),l=[o,s].filter(Boolean).join("; ");return`${n} (${l})`}var Xn={factor:2,time:100};function Wn(r,i=Xn){let t=0;function e(s){let o=Math.round(i.time*i.factor**t);return s({attempt:t,retry:l=>Gn(l!=null?l:o).then(()=>(t+=1,e(s)))})}return e(r)}var ke=class extends Error{},oe=class r extends ke{constructor(t){super();u(this,"originalProgressEvent");this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,r.prototype),this.originalProgressEvent=t}},mi=(r,i)=>{r&&(r.aborted?Promise.resolve().then(i):r.addEventListener("abort",()=>i(),{once:!0}))},Ft=class r extends ke{constructor(t="Request canceled"){super(t);u(this,"isCancel",!0);this.name="CancelError",Object.setPrototypeOf(this,r.prototype)}},Kn=500,Xs=({check:r,interval:i=Kn,timeout:t,signal:e})=>new Promise((s,o)=>{let n,l;mi(e,()=>{n&&clearTimeout(n),o(new Ft("Poll cancelled"))}),t&&(l=setTimeout(()=>{n&&clearTimeout(n),o(new Ft("Timed out"))},t));let a=()=>{try{Promise.resolve(r(e)).then(c=>{c?(l&&clearTimeout(l),s(c)):n=setTimeout(a,i)}).catch(c=>{l&&clearTimeout(l),o(c)})}catch(c){l&&clearTimeout(l),o(c)}};n=setTimeout(a,0)}),k={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",maxContentLength:50*1024*1024,retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,multipartMinLastPartSize:1024*1024,maxConcurrentRequests:4,pollingTimeoutMilliseconds:1e4,pusherKey:"79ae88bd931ea68464d9"},gi="application/octet-stream",Ws="original",Dt=({method:r,url:i,data:t,headers:e={},signal:s,onProgress:o})=>new Promise((n,l)=>{let a=new XMLHttpRequest,c=(r==null?void 0:r.toUpperCase())||"GET",d=!1;a.open(c,i,!0),e&&Object.entries(e).forEach(h=>{let[p,f]=h;typeof f!="undefined"&&!Array.isArray(f)&&a.setRequestHeader(p,f)}),a.responseType="text",mi(s,()=>{d=!0,a.abort(),l(new Ft)}),a.onload=()=>{if(a.status!=200)l(new Error(`Error ${a.status}: ${a.statusText}`));else{let h={method:c,url:i,data:t,headers:e||void 0,signal:s,onProgress:o},p=a.getAllResponseHeaders().trim().split(/[\r\n]+/),f={};p.forEach(function(x){let E=x.split(": "),C=E.shift(),A=E.join(": ");C&&typeof C!="undefined"&&(f[C]=A)});let m=a.response,y=a.status;n({request:h,data:m,headers:f,status:y})}},a.onerror=h=>{d||l(new oe(h))},o&&typeof o=="function"&&(a.upload.onprogress=h=>{h.lengthComputable?o({isComputable:!0,value:h.loaded/h.total}):o({isComputable:!1})}),t?a.send(t):a.send()});function qn(r,...i){return r}var Zn=({name:r})=>r?[r]:[],Yn=qn,Jn=()=>new FormData,Ks=r=>!1,bi=r=>typeof Blob!="undefined"&&r instanceof Blob,yi=r=>typeof File!="undefined"&&r instanceof File,_i=r=>!!r&&typeof r=="object"&&!Array.isArray(r)&&"uri"in r&&typeof r.uri=="string",ne=r=>bi(r)||yi(r)||Ks()||_i(r),Qn=r=>typeof r=="string"||typeof r=="number"||typeof r=="undefined",tl=r=>!!r&&typeof r=="object"&&!Array.isArray(r),el=r=>!!r&&typeof r=="object"&&"data"in r&&ne(r.data);function qs(r,i,t){if(Array.isArray(t))for(let e of t)qs(r,`${i}[]`,e);else if(el(t)){let{name:e,contentType:s}=t,o=Yn(t.data,e,s!=null?s:gi),n=Zn({name:e,contentType:s});r.push([i,o,...n])}else if(tl(t))for(let[e,s]of Object.entries(t))typeof s!="undefined"&&r.push([`${i}[${e}]`,String(s)]);else Qn(t)&&t&&r.push([i,t.toString()])}function il(r){let i=[];for(let[t,e]of Object.entries(r))qs(i,t,e);return i}function vi(r){let i=Jn(),t=il(r);for(let e of t){let[s,o,...n]=e;i.append(s,o,...n)}return i}var X=class r extends ke{constructor(t,e,s,o,n){super();u(this,"code");u(this,"request");u(this,"response");u(this,"headers");this.name="UploadError",this.message=t,this.code=e,this.request=s,this.response=o,this.headers=n,Object.setPrototypeOf(this,r.prototype)}},rl=r=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(r))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(s=>{var o;return(o=s[1])!=null?o:!1}).forEach(s=>i.set(`${t}[${s[0]}]`,String(s[1]))):Array.isArray(e)?e.forEach(s=>{i.append(`${t}[]`,s)}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},At=(r,i,t)=>{let e=new URL(r);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=rl(t)),e.toString()},sl="6.14.1",ol="UploadcareUploadClient",nl=sl;function qt(r){return Tr({libraryName:ol,libraryVersion:nl,...r})}var ll="RequestThrottledError",Gs=15e3,al=1e3;function cl(r){let{headers:i}=r||{};if(!i||typeof i["retry-after"]!="string")return Gs;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:Gs}function Nt(r,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return Wn(({attempt:s,retry:o})=>r().catch(n=>{if("response"in n&&(n==null?void 0:n.code)===ll&&s<t)return o(cl(n));if(n instanceof oe&&s<e)return o((s+1)*al);throw n}))}var Zs=r=>{let i="";return(bi(r)||yi(r)||_i(r))&&(i=r.type),i||gi},Ys=r=>{let i="";return yi(r)&&r.name?i=r.name:bi(r)||Ks()?i="":_i(r)&&r.name&&(i=r.name),i||Ws};function Sr(r){return typeof r=="undefined"||r==="auto"?"auto":r?"1":"0"}function ul(r,{publicKey:i,fileName:t,contentType:e,baseURL:s=k.baseURL,secureSignature:o,secureExpire:n,store:l,signal:a,onProgress:c,source:d="local",integration:h,userAgent:p,retryThrottledRequestMaxTimes:f=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=k.retryNetworkErrorMaxTimes,metadata:y}){return Nt(()=>Dt({method:"POST",url:At(s,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":qt({publicKey:i,integration:h,userAgent:p})},data:vi({signature:o,expire:n,file:{data:r,name:t||Ys(r),contentType:e||Zs(r)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Sr(l),source:d,metadata:y}),signal:a,onProgress:c}).then(({data:x,headers:E,request:C})=>{let A=St(JSON.parse(x));if("error"in A)throw new X(A.error.content,A.error.errorCode,C,A,E);return A}),{retryNetworkErrorMaxTimes:m,retryThrottledRequestMaxTimes:f})}var Cr;(function(r){r.Token="token",r.FileInfo="file_info"})(Cr||(Cr={}));function hl(r,{publicKey:i,baseURL:t=k.baseURL,store:e,fileName:s,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:a,source:c="url",signal:d,integration:h,userAgent:p,retryThrottledRequestMaxTimes:f=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=k.retryNetworkErrorMaxTimes,metadata:y}){return Nt(()=>Dt({method:"POST",headers:{"X-UC-User-Agent":qt({publicKey:i,integration:h,userAgent:p})},url:At(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:r,store:Sr(e),filename:s,check_URL_duplicates:o?1:void 0,save_URL_duplicates:n?1:void 0,signature:l,expire:a,source:c,metadata:y}),signal:d}).then(({data:x,headers:E,request:C})=>{let A=St(JSON.parse(x));if("error"in A)throw new X(A.error.content,A.error.errorCode,C,A,E);return A}),{retryNetworkErrorMaxTimes:m,retryThrottledRequestMaxTimes:f})}var Y;(function(r){r.Unknown="unknown",r.Waiting="waiting",r.Progress="progress",r.Error="error",r.Success="success"})(Y||(Y={}));var dl=r=>"status"in r&&r.status===Y.Error;function pl(r,{publicKey:i,baseURL:t=k.baseURL,signal:e,integration:s,userAgent:o,retryThrottledRequestMaxTimes:n=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=k.retryNetworkErrorMaxTimes}={}){return Nt(()=>Dt({method:"GET",headers:i?{"X-UC-User-Agent":qt({publicKey:i,integration:s,userAgent:o})}:void 0,url:At(t,"/from_url/status/",{jsonerrors:1,token:r}),signal:e}).then(({data:a,headers:c,request:d})=>{let h=St(JSON.parse(a));if("error"in h&&!dl(h))throw new X(h.error.content,h.error.errorCode,d,h,c);return h}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:n})}function fl(r,{publicKey:i,baseURL:t=k.baseURL,jsonpCallback:e,secureSignature:s,secureExpire:o,signal:n,source:l,integration:a,userAgent:c,retryThrottledRequestMaxTimes:d=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:h=k.retryNetworkErrorMaxTimes}){return Nt(()=>Dt({method:"POST",headers:{"X-UC-User-Agent":qt({publicKey:i,integration:a,userAgent:c})},url:At(t,"/group/",{jsonerrors:1}),data:vi({files:r,callback:e,pub_key:i,signature:s,expire:o,source:l}),signal:n}).then(({data:p,headers:f,request:m})=>{let y=St(JSON.parse(p));if("error"in y)throw new X(y.error.content,y.error.errorCode,m,y,f);return y}),{retryNetworkErrorMaxTimes:h,retryThrottledRequestMaxTimes:d})}function Js(r,{publicKey:i,baseURL:t=k.baseURL,signal:e,source:s,integration:o,userAgent:n,retryThrottledRequestMaxTimes:l=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=k.retryNetworkErrorMaxTimes}){return Nt(()=>Dt({method:"GET",headers:{"X-UC-User-Agent":qt({publicKey:i,integration:o,userAgent:n})},url:At(t,"/info/",{jsonerrors:1,pub_key:i,file_id:r,source:s}),signal:e}).then(({data:c,headers:d,request:h})=>{let p=St(JSON.parse(c));if("error"in p)throw new X(p.error.content,p.error.errorCode,h,p,d);return p}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function ml(r,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:s=k.multipartChunkSize,baseURL:o="",secureSignature:n,secureExpire:l,store:a,signal:c,source:d="local",integration:h,userAgent:p,retryThrottledRequestMaxTimes:f=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=k.retryNetworkErrorMaxTimes,metadata:y}){return Nt(()=>Dt({method:"POST",url:At(o,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":qt({publicKey:i,integration:h,userAgent:p})},data:vi({filename:e||Ws,size:r,content_type:t||gi,part_size:s,UPLOADCARE_STORE:Sr(a),UPLOADCARE_PUB_KEY:i,signature:n,expire:l,source:d,metadata:y}),signal:c}).then(({data:x,headers:E,request:C})=>{let A=St(JSON.parse(x));if("error"in A)throw new X(A.error.content,A.error.errorCode,C,A,E);return A.parts=Object.keys(A.parts).map(N=>A.parts[Number(N)]),A}),{retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m})}function gl(r,i,{contentType:t,signal:e,onProgress:s,retryThrottledRequestMaxTimes:o=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=k.retryNetworkErrorMaxTimes}){return Nt(()=>Dt({method:"PUT",url:i,data:r,onProgress:s,signal:e,headers:{"Content-Type":t||gi}}).then(l=>(s&&s({isComputable:!0,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n})}function bl(r,{publicKey:i,baseURL:t=k.baseURL,source:e="local",signal:s,integration:o,userAgent:n,retryThrottledRequestMaxTimes:l=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=k.retryNetworkErrorMaxTimes}){return Nt(()=>Dt({method:"POST",url:At(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":qt({publicKey:i,integration:o,userAgent:n})},data:vi({uuid:r,UPLOADCARE_PUB_KEY:i,source:e}),signal:s}).then(({data:c,headers:d,request:h})=>{let p=St(JSON.parse(c));if("error"in p)throw new X(p.error.content,p.error.errorCode,h,p,d);return p}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function kr(r,{publicKey:i,baseURL:t,source:e,integration:s,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l,signal:a,onProgress:c}){return Xs({check:d=>Js(r,{publicKey:i,baseURL:t,signal:d,source:e,integration:s,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l}).then(h=>h.isReady?h:(c&&c({isComputable:!0,value:1}),!1)),signal:a})}function yl(r){return"defaultEffects"in r}var Tt=class{constructor(i,{baseCDN:t=k.baseCDN,fileName:e}={}){u(this,"uuid");u(this,"name",null);u(this,"size",null);u(this,"isStored",null);u(this,"isImage",null);u(this,"mimeType",null);u(this,"cdnUrl",null);u(this,"s3Url",null);u(this,"originalFilename",null);u(this,"imageInfo",null);u(this,"videoInfo",null);u(this,"contentInfo",null);u(this,"metadata",null);u(this,"s3Bucket",null);u(this,"defaultEffects",null);let{uuid:s,s3Bucket:o}=i,n=At(t,`${s}/`),l=o?At(`https://${o}.s3.amazonaws.com/`,`${s}/${i.filename}`):null;this.uuid=s,this.name=e||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=n,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=o||null,this.s3Url=l,yl(i)&&(this.defaultEffects=i.defaultEffects)}},_l=(r,{publicKey:i,fileName:t,baseURL:e,secureSignature:s,secureExpire:o,store:n,contentType:l,signal:a,onProgress:c,source:d,integration:h,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:y,metadata:x})=>ul(r,{publicKey:i,fileName:t,contentType:l,baseURL:e,secureSignature:s,secureExpire:o,store:n,signal:a,onProgress:c,source:d,integration:h,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,metadata:x}).then(({file:E})=>kr(E,{publicKey:i,baseURL:e,source:d,integration:h,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,onProgress:c,signal:a})).then(E=>new Tt(E,{baseCDN:y})),vl=(r,{publicKey:i,fileName:t,baseURL:e,signal:s,onProgress:o,source:n,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:d,baseCDN:h})=>Js(r,{publicKey:i,baseURL:e,signal:s,source:n,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:d}).then(p=>new Tt(p,{baseCDN:h,fileName:t})).then(p=>(o&&o({isComputable:!0,value:1}),p)),wl=(r,{signal:i}={})=>{let t=null,e=null,s=r.map(()=>new AbortController),o=n=>()=>{e=n,s.forEach((l,a)=>a!==n&&l.abort())};return mi(i,()=>{s.forEach(n=>n.abort())}),Promise.all(r.map((n,l)=>{let a=o(l);return Promise.resolve().then(()=>n({stopRace:a,signal:s[l].signal})).then(c=>(a(),c)).catch(c=>(t=c,null))})).then(n=>{if(e===null)throw t;return n[e]})},Cl=window.WebSocket,xr=class{constructor(){u(this,"events",Object.create({}))}emit(i,t){var e;(e=this.events[i])==null||e.forEach(s=>s(t))}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t)}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[]}},xl=(r,i)=>r==="success"?{status:Y.Success,...i}:r==="progress"?{status:Y.Progress,...i}:{status:Y.Error,...i},Er=class{constructor(i,t=3e4){u(this,"key");u(this,"disconnectTime");u(this,"ws");u(this,"queue",[]);u(this,"isConnected",!1);u(this,"subscribers",0);u(this,"emmitter",new xr);u(this,"disconnectTimeoutId",null);this.key=i,this.disconnectTime=t}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let i=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new Cl(i),this.ws.addEventListener("error",t=>{this.emmitter.emit("error",new Error(t.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,this.queue.forEach(t=>this.send(t.event,t.data)),this.queue=[]}),this.ws.addEventListener("message",t=>{let e=JSON.parse(t.data.toString());switch(e.event){case"pusher:connection_established":{this.emmitter.emit("connected",void 0);break}case"pusher:ping":{this.send("pusher:pong",{});break}case"progress":case"success":case"fail":this.emmitter.emit(e.channel,xl(e.event,JSON.parse(e.data)))}})}}disconnect(){let i=()=>{var t;(t=this.ws)==null||t.close(),this.ws=void 0,this.isConnected=!1};this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i()},this.disconnectTime):i()}send(i,t){var s;let e=JSON.stringify({event:i,data:t});(s=this.ws)==null||s.send(e)}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,s={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(s.event,s.data):this.queue.push(s)}unsubscribe(i){this.subscribers-=1;let t=`task-status-${i}`,e={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(e.event,e.data):this.queue=this.queue.filter(s=>s.data.channel!==t),this.subscribers===0&&this.disconnect()}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},vr=null,$r=r=>{if(!vr){let i=typeof window=="undefined"?0:3e4;vr=new Er(r,i)}return vr},El=r=>{$r(r).connect()};function Al({token:r,publicKey:i,baseURL:t,integration:e,userAgent:s,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n,onProgress:l,signal:a}){return Xs({check:c=>pl(r,{publicKey:i,baseURL:t,integration:e,userAgent:s,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n,signal:c}).then(d=>{switch(d.status){case Y.Error:return new X(d.error,d.errorCode);case Y.Waiting:return!1;case Y.Unknown:return new X(`Token "${r}" was not found.`);case Y.Progress:return l&&(d.total==="unknown"?l({isComputable:!1}):l({isComputable:!0,value:d.done/d.total})),!1;case Y.Success:return l&&l({isComputable:!0,value:d.done/d.total}),d;default:throw new Error("Unknown status")}}),signal:a})}var Tl=({token:r,pusherKey:i,signal:t,onProgress:e})=>new Promise((s,o)=>{let n=$r(i),l=n.onError(o),a=()=>{l(),n.unsubscribe(r)};mi(t,()=>{a(),o(new Ft("pusher cancelled"))}),n.subscribe(r,c=>{switch(c.status){case Y.Progress:{e&&(c.total==="unknown"?e({isComputable:!1}):e({isComputable:!0,value:c.done/c.total}));break}case Y.Success:{a(),e&&e({isComputable:!0,value:c.done/c.total}),s(c);break}case Y.Error:a(),o(new X(c.msg,c.error_code))}})}),Sl=(r,{publicKey:i,fileName:t,baseURL:e,baseCDN:s,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:a,store:c,signal:d,onProgress:h,source:p,integration:f,userAgent:m,retryThrottledRequestMaxTimes:y,pusherKey:x=k.pusherKey,metadata:E})=>Promise.resolve(El(x)).then(()=>hl(r,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:a,store:c,signal:d,source:p,integration:f,userAgent:m,retryThrottledRequestMaxTimes:y,metadata:E})).catch(C=>{let A=$r(x);return A==null||A.disconnect(),Promise.reject(C)}).then(C=>C.type===Cr.FileInfo?C:wl([({signal:A})=>Al({token:C.token,publicKey:i,baseURL:e,integration:f,userAgent:m,retryThrottledRequestMaxTimes:y,onProgress:h,signal:A}),({signal:A})=>Tl({token:C.token,pusherKey:x,signal:A,onProgress:h})],{signal:d})).then(C=>{if(C instanceof X)throw C;return C}).then(C=>kr(C.uuid,{publicKey:i,baseURL:e,integration:f,userAgent:m,retryThrottledRequestMaxTimes:y,onProgress:h,signal:d})).then(C=>new Tt(C,{baseCDN:s})),wr=new WeakMap,kl=async r=>{if(wr.has(r))return wr.get(r);let i=await fetch(r.uri).then(t=>t.blob());return wr.set(r,i),i},Qs=async r=>{if(yi(r)||bi(r))return r.size;if(_i(r))return(await kl(r)).size;throw new Error("Unknown file type. Cannot determine file size.")},$l=(r,i=k.multipartMinFileSize)=>r>=i,to=r=>{let i="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(i);return!ne(r)&&t.test(r)},Ir=r=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return!ne(r)&&t.test(r)},Il=(r,i)=>new Promise((t,e)=>{let s=[],o=!1,n=i.length,l=[...i],a=()=>{let c=i.length-l.length,d=l.shift();d&&d().then(h=>{o||(s[c]=h,n-=1,n?a():t(s))}).catch(h=>{o=!0,e(h)})};for(let c=0;c<r;c++)a()}),Ol=(r,i,t,e)=>{let s=e*i,o=Math.min(s+e,t);return r.slice(s,o)},Ll=async(r,i,t)=>e=>Ol(r,e,i,t),Ul=(r,i,{publicKey:t,contentType:e,onProgress:s,signal:o,integration:n,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})=>gl(r,i,{publicKey:t,contentType:e,onProgress:s,signal:o,integration:n,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a}),Ml=async(r,{publicKey:i,fileName:t,fileSize:e,baseURL:s,secureSignature:o,secureExpire:n,store:l,signal:a,onProgress:c,source:d,integration:h,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:y,multipartChunkSize:x=k.multipartChunkSize,maxConcurrentRequests:E=k.maxConcurrentRequests,baseCDN:C,metadata:A})=>{let N=e!=null?e:await Qs(r),et,ut=(B,K)=>{if(!c)return;et||(et=Array(B).fill(0));let ot=ht=>ht.reduce((vt,cr)=>vt+cr,0);return ht=>{ht.isComputable&&(et[K]=ht.value,c({isComputable:!0,value:ot(et)/B}))}};return y||(y=Zs(r)),ml(N,{publicKey:i,contentType:y,fileName:t||Ys(r),baseURL:s,secureSignature:o,secureExpire:n,store:l,signal:a,source:d,integration:h,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,metadata:A}).then(async({uuid:B,parts:K})=>{let ot=await Ll(r,N,x);return Promise.all([B,Il(E,K.map((ht,vt)=>()=>Ul(ot(vt),ht,{publicKey:i,contentType:y,onProgress:ut(K.length,vt),signal:a,integration:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m})))])}).then(([B])=>bl(B,{publicKey:i,baseURL:s,source:d,integration:h,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m})).then(B=>B.isReady?B:kr(B.uuid,{publicKey:i,baseURL:s,source:d,integration:h,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,onProgress:c,signal:a})).then(B=>new Tt(B,{baseCDN:C}))};async function Or(r,{publicKey:i,fileName:t,baseURL:e=k.baseURL,secureSignature:s,secureExpire:o,store:n,signal:l,onProgress:a,source:c,integration:d,userAgent:h,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:f,contentType:m,multipartMinFileSize:y,multipartChunkSize:x,maxConcurrentRequests:E,baseCDN:C=k.baseCDN,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:N,pusherKey:et,metadata:ut}){if(ne(r)){let B=await Qs(r);return $l(B,y)?Ml(r,{publicKey:i,contentType:m,multipartChunkSize:x,fileSize:B,fileName:t,baseURL:e,secureSignature:s,secureExpire:o,store:n,signal:l,onProgress:a,source:c,integration:d,userAgent:h,maxConcurrentRequests:E,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:f,baseCDN:C,metadata:ut}):_l(r,{publicKey:i,fileName:t,contentType:m,baseURL:e,secureSignature:s,secureExpire:o,store:n,signal:l,onProgress:a,source:c,integration:d,userAgent:h,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:f,baseCDN:C,metadata:ut})}if(Ir(r))return Sl(r,{publicKey:i,fileName:t,baseURL:e,baseCDN:C,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:N,secureSignature:s,secureExpire:o,store:n,signal:l,onProgress:a,source:c,integration:d,userAgent:h,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:f,pusherKey:et,metadata:ut});if(to(r))return vl(r,{publicKey:i,fileName:t,baseURL:e,signal:l,onProgress:a,source:c,integration:d,userAgent:h,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:f,baseCDN:C});throw new TypeError(`File uploading from "${r}" is not supported`)}var Ar=class{constructor(i,{baseCDN:t=k.baseCDN}={}){u(this,"uuid");u(this,"filesCount");u(this,"totalSize");u(this,"isStored");u(this,"isImage");u(this,"cdnUrl");u(this,"files");u(this,"createdAt");u(this,"storedAt",null);this.uuid=i.id,this.filesCount=i.filesCount;let e=i.files.filter(Boolean);this.totalSize=Object.values(e).reduce((s,o)=>s+o.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(e).filter(s=>s.isImage).length,this.cdnUrl=i.cdnUrl,this.files=e.map(s=>new Tt(s,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored}},Pl=r=>{for(let i of r)if(!ne(i))return!1;return!0},Rl=r=>{for(let i of r)if(!to(i))return!1;return!0},Fl=r=>{for(let i of r)if(!Ir(i))return!1;return!0};function eo(r,{publicKey:i,fileName:t,baseURL:e=k.baseURL,secureSignature:s,secureExpire:o,store:n,signal:l,onProgress:a,source:c,integration:d,userAgent:h,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:f,contentType:m,multipartChunkSize:y=k.multipartChunkSize,baseCDN:x=k.baseCDN,checkForUrlDuplicates:E,saveUrlForRecurrentUploads:C,jsonpCallback:A}){if(!Pl(r)&&!Fl(r)&&!Rl(r))throw new TypeError(`Group uploading from "${r}" is not supported`);let N,et=!0,ut=r.length,B=(K,ot)=>{if(!a)return;N||(N=Array(K).fill(0));let ht=vt=>vt.reduce((cr,_n)=>cr+_n)/K;return vt=>{if(!vt.isComputable||!et){et=!1,a({isComputable:!1});return}N[ot]=vt.value,a({isComputable:!0,value:ht(N)})}};return Promise.all(r.map((K,ot)=>ne(K)||Ir(K)?Or(K,{publicKey:i,fileName:t,baseURL:e,secureSignature:s,secureExpire:o,store:n,signal:l,onProgress:B(ut,ot),source:c,integration:d,userAgent:h,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:f,contentType:m,multipartChunkSize:y,baseCDN:x,checkForUrlDuplicates:E,saveUrlForRecurrentUploads:C}).then(ht=>ht.uuid):K)).then(K=>fl(K,{publicKey:i,baseURL:e,jsonpCallback:A,secureSignature:s,secureExpire:o,signal:l,source:c,integration:d,userAgent:h,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:f}).then(ot=>new Ar(ot,{baseCDN:x})).then(ot=>(a&&a({isComputable:!0,value:1}),ot)))}var fi=class{constructor(i){u(this,"_concurrency",1);u(this,"_pending",[]);u(this,"_running",0);u(this,"_resolvers",new Map);u(this,"_rejectors",new Map);this._concurrency=i}_run(){let i=this._concurrency-this._running;for(let t=0;t<i;t++){let e=this._pending.shift();if(!e)return;let s=this._resolvers.get(e),o=this._rejectors.get(e);if(!s||!o)throw new Error("Unexpected behavior: resolver or rejector is undefined");this._running+=1,e().finally(()=>{this._resolvers.delete(e),this._rejectors.delete(e),this._running-=1,this._run()}).then(n=>s(n)).catch(n=>o(n))}}add(i){return new Promise((t,e)=>{this._resolvers.set(i,t),this._rejectors.set(i,e),this._pending.push(i),this._run()})}get pending(){return this._pending.length}get running(){return this._running}set concurrency(i){this._concurrency=i,this._run()}get concurrency(){return this._concurrency}};var Lr=()=>({}),Ur=r=>({...Lr(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{r.set$({"*currentActivity":null,"*modalActive":!1})}}),wi=r=>({...Ur(r),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new fi(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set,"*secureUploadsManager":null});var $e={"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","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":"Selected:","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-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-instagram":"Instagram","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 ocurred. 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",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}"};var Ci=new Map,Mr=new Map,io=(r,i)=>{Ci.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`),Ci.set(r,{...$e,...i})},Dl=(r,i)=>{Mr.set(r,i)},ro=(r,i)=>{typeof i=="function"?Dl(r,i):io(r,i)},so=async r=>{if(!Ci.has(r)){if(!Mr.has(r))throw new Error(`Locale ${r} is not defined`);let t=await Mr.get(r)();io(r,t)}return Ci.get(r)};ro("en",$e);var kt=r=>`*l10n/${r}`,Nl="en",xi=class{constructor(i){u(this,"_blockInstance",null);u(this,"_localeName","");u(this,"_callbacks",new Set);u(this,"_boundBlocks",new Map);this._blockInstance=i;for(let[t,e]of Object.entries($e))this._blockInstance.add(kt(t),e,!1);setTimeout(()=>{i.subConfigValue("localeName",async t=>{var o;if(!this._blockInstance||!t)return;this._localeName=t;let e=await so(t);if(t!==Nl&&this._localeName!==t)return;let s=(o=this._blockInstance.cfg.localeDefinitionOverride)==null?void 0:o[t];for(let[n,l]of Object.entries(e)){let a=s==null?void 0:s[n];this._blockInstance.add(kt(n),a!=null?a:l,!0);for(let c of this._callbacks)c()}}),i.subConfigValue("localeDefinitionOverride",t=>{var s;if(!t)return;let e=t[this._localeName];if(e)for(let[o,n]of Object.entries(e)){(s=this._blockInstance)==null||s.add(kt(o),n,!0);for(let l of this._callbacks)l()}})})}onLocaleChange(i){let t=M(i,0);return this._callbacks.add(t),()=>{this._callbacks.delete(t)}}bindL10n(i,t,e){var o,n,l;i.$[t]=e(),this._boundBlocks.has(i)||this._boundBlocks.set(i,new Map),(n=(o=this._boundBlocks.get(i))==null?void 0:o.get(t))==null||n();let s=this.onLocaleChange(()=>{i.$[t]=e()});(l=this._boundBlocks.get(i))==null||l.set(t,s)}destroyL10nBindings(i){let t=this._boundBlocks.get(i);if(t){for(let e of t.values())e();this._boundBlocks.delete(i)}}destroy(){this._callbacks.clear()}};var Bl={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function Ie(r,i){i.tabIndex=0,i.focus(),r.tabIndex=-1}function Pr(r){let i=r.role||r.type||r.tagName;if(!i)return null;let t=Bl[i.toLowerCase()];if(!t)return null;for(let e of t){let s=r.closest(`[role=${e}]`);if(s)return s}}function Rr(r,i){return i.role==="toolbar"?zl(i):i.querySelectorAll(`[role=${r.role}]`)}function zl(r){return[...r.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}function Vl(r){let i=r.getAttribute("aria-orientation");if(i==="vertical")return!1;if(i==="horizontal")return!0;let t=r.role;return t==="menubar"||t==="tablist"||t==="toolbar"}function oo(r){return i=>{let t=!1,e=(r==null?void 0:r.searchDelayMs)||300,s=0,o="";function n(h){let p=Pr(h.target);if(!p){l();return}let f=Rr(h.target,p),m=Array.from(f).indexOf(h.target),y="ArrowDown",x="ArrowUp";if(Vl(p)&&(i.document.dir==="rtl"?(y="ArrowLeft",x="ArrowRight"):(y="ArrowRight",x="ArrowLeft")),h.key===y)h.preventDefault(),Ie(h.target,f[m+1]||f[0]);else if(h.key===x)h.preventDefault(),Ie(h.target,f[m-1]||f[f.length-1]);else if(h.key==="Home")h.preventDefault(),Ie(h.target,f[0]);else if(h.key==="End")h.preventDefault(),Ie(h.target,f[f.length-1]);else if(h.key.length===1&&p.role!=="tablist"){let E=Date.now();E-s<=e?o+=h.key.toLowerCase():o=h.key.toLowerCase(),s=E;let C=Array.from(f).find(A=>{var N,et,ut;return(ut=(et=(N=A.textContent)==null?void 0:N.trim())==null?void 0:et.toLowerCase())==null?void 0:ut.startsWith(o)});C&&(h.preventDefault(),Ie(h.target,C))}}function l(){t=!1,i.removeEventListener("keydown",n)}function a(h){let p=Pr(h.target);if(p){t||(t=!0,i.addEventListener("keydown",n));let f=Rr(h.target,p);for(let m of f)m!==h.target&&m.setAttribute("tabindex",-1)}else t&&l()}function c(h){(!h.relatedTarget||h.relatedTarget===i.document)&&l()}function d(h){let p=Pr(h.target);if(p){let f=Rr(h.target,p);for(let m of f)m!==h.target&&m.setAttribute("tabindex",-1);h.target.setAttribute("tabindex",0)}}return i.addEventListener("click",d),i.addEventListener("focusin",a),i.addEventListener("focusout",c),()=>{l(),i.removeEventListener("click",d),i.removeEventListener("focusin",a),i.removeEventListener("focusout",c)}}}function no(){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=!1);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=!0),i=null)}return r.addEventListener("keyuxJump",e),r.addEventListener("focusout",s),()=>{r.removeEventListener("keyuxJump",e),r.removeEventListener("focusout",s)}}}function lo(){return r=>{let i=[];function t(c){let d=r.document.activeElement;d&&d!==r.document.body&&i.push(new WeakRef(d)),c.focus({focusVisible:!0})}function e(){let c=i.pop();if(!c){r.document.activeElement.blur();return}let d=c.deref();d&&d.isConnected?d.focus():e()}let s=0,o;function n(c){clearInterval(o);let d=c.getAttribute("aria-controls");d&&(o=setInterval(()=>{if(s++>50){clearInterval(o);return}let h=r.document.getElementById(d);if(h){let p=h.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');p&&(clearInterval(o),h.dispatchEvent(new r.CustomEvent("keyuxJump",{bubbles:!0})),t(p))}},50))}function l(c){c.clientX===0&&c.clientY===0&&n(c.target)}function a(c){c.target.tagName==="INPUT"&&c.key==="Enter"&&n(c.target),c.key==="Escape"&&e()}return r.addEventListener("click",l),r.addEventListener("keydown",a),()=>{r.removeEventListener("click",l),r.removeEventListener("keydown",a)}}}function ao(r){let i,t=r.split(" ");function e(){i&&i.classList.remove(...t)}function s(o){o.clientX===0&&o.clientY===0&&(e(),o.target.classList.add(...t),i=o.target)}return o=>(o.addEventListener("keyup",e),o.addEventListener("click",s),()=>{o.removeEventListener("keyup",e),o.removeEventListener("click",s)})}function co(r,i){let t=i.map(e=>e(r));return()=>{t.forEach(e=>e())}}var Fr=class{constructor(){u(this,"_listeners",new Map);u(this,"_scope",[])}addEventListener(i,t){let e=s=>{let o=s.target;o&&this._scope.some(n=>n===s.target||n.contains(o))&&t(s)};this._listeners.set(t,e),window.addEventListener(i,e)}removeEventListener(i,t){let e=this._listeners.get(t);e&&window.removeEventListener(i,e),this._listeners.delete(t)}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this._scope.push(i)}destroy(){this._scope=[],this._listeners.forEach((i,t)=>{window.removeEventListener("keydown",i),window.removeEventListener("keyup",i),this._listeners.delete(t)})}},Ei=class{constructor(){u(this,"_destroyKeyUX");u(this,"_scopedWindow");this._scopedWindow=new Fr,this._destroyKeyUX=co(this._scopedWindow,[oo(),ao("is-pressed"),lo(),no()])}registerBlock(i){this._scopedWindow.registerScope(i)}destroy(){var i;(i=this._destroyKeyUX)==null||i.call(this),this._scopedWindow.destroy()}};function uo(r,i){[...r.querySelectorAll("[l10n]")].forEach(t=>{let e=t.getAttribute("l10n");if(!e)return;let s="textContent",o=!1;if(e.includes(":")){let a=e.split(":");s=a[0],e=a[1],s.startsWith("@")&&(s=s.slice(1),o=!0)}let n=e;i.has(n)&&i.sub(n,a=>{if(!a)return;i.l10nProcessorSubs.has(n)||i.l10nProcessorSubs.set(n,new Set);let c=i.l10nProcessorSubs.get(n);c==null||c.forEach(p=>{p.remove(),c.delete(p),i.allSubs.delete(p)});let d=kt(a).replace("*","");i.sharedCtx.has(d)||i.sharedCtx.add(d,a);let h=i.sharedCtx.sub(d,()=>{t[s]=i.l10n(a)});c==null||c.add(h),i.allSubs.add(h),t.removeAttribute("l10n")});let l=kt(e);i.has(l)||i.add(l,""),i.sub(l,()=>{e=e,o?t.setAttribute(s,i.l10n(e)):t[s]=i.l10n(e)}),t.removeAttribute("l10n")})}var J=r=>`*cfg/${r}`;var Hl="uc-",w=class extends xt{constructor(){super();u(this,"requireCtxName",!1);u(this,"activityType",null);u(this,"init$",Lr());this.l10nProcessorSubs=new Map,this.addTemplateProcessor(uo),this.addTemplateProcessor(br)}l10n(t,e={}){if(!t)return"";let s=this.$[kt(t)]||t,o=Bs(s);for(let l of o)e[l.variable]=this.pluralize(l.pluralKey,Number(e[l.countVariable]));return Se(s,e)}pluralize(t,e){let s=this.l10n("locale-id")||"en",o=pi(s,e);return this.l10n(`${t}__${o}`)}bindL10n(t,e){var s;(s=this.localeManager)==null||s.bindL10n(this,t,e)}emit(t,e,s){let o=this.has("*eventEmitter")&&this.$["*eventEmitter"];o&&o.emit(t,e,s)}hasBlockInCtx(t){for(let e of this.blocksRegistry)if(t(e))return!0;return!1}setOrAddState(t,e){this.add$({[t]:e},!0)}connectedCallback(){this.constructor.styleAttrs.forEach(e=>{this.setAttribute(e,"")}),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?Vs({element:this,attribute:g.CTX_NAME_ATTR}).then(e=>{e.success?super.connectedCallback():console.error(`Attribute "${g.CTX_NAME_ATTR}" is required and it is not set.`)}):super.connectedCallback(),Kt.registerClient(this)}disconnectedCallback(){super.disconnectedCallback(),Kt.unregisterClient(this)}initCallback(){this.has("*blocksRegistry")||this.add("*blocksRegistry",new Set),this.$["*blocksRegistry"].add(this),this.has("*eventEmitter")||this.add("*eventEmitter",new di(this.debugPrint.bind(this))),this.has("*localeManager")||this.add("*localeManager",new xi(this)),this.has("*a11y")||this.add("*a11y",new Ei),this.sub(kt("locale-id"),e=>{let s=Fs(e);this.style.direction=s==="ltr"?"":s})}get localeManager(){return this.has("*localeManager")?this.$["*localeManager"]:null}get a11y(){return this.has("*a11y")?this.$["*a11y"]:null}get blocksRegistry(){return this.$["*blocksRegistry"]}destroyCallback(){var e;super.destroyCallback();let t=this.blocksRegistry;t==null||t.delete(this),(e=this.localeManager)==null||e.destroyL10nBindings(this),this.l10nProcessorSubs=new Map,$.deleteCtx(this.localCtx.uid),(t==null?void 0:t.size)===0&&setTimeout(()=>{this.destroyCtxCallback()},0)}destroyCtxCallback(){var t;$.deleteCtx(this.ctxName),(t=this.localeManager)==null||t.destroy()}async proxyUrl(t){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(t,{uuid:ui(t),cdnUrlModifiers:yr(t),fileName:ci(t)})}catch(e){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",e),t}return this.cfg.secureDeliveryProxy?Se(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:e=>window.encodeURIComponent(e)}):t}get cfg(){if(!this.__cfgProxy){let t=Object.create(null);this.__cfgProxy=new Proxy(t,{set:(e,s,o)=>{if(typeof s!="string")return!1;let n=J(s);return this.has(n)||this.add(n,at[s]),this.$[n]=o,!0},get:(e,s)=>{let o=J(s);return this.has(o)||this.add(o,at[s]),this.$[J(s)]}})}return this.__cfgProxy}subConfigValue(t,e){let s=J(t);this.has(s)||this.add(s,at[t]),this.sub(s,e)}debugPrint(...t){if(!this.cfg.debug)return;let e=t;if(typeof(t==null?void 0:t[0])=="function"){let s=t[0];e=s()}console.log(`[${this.ctxName}]`,...e)}static reg(t){if(!t){super.reg();return}t.startsWith(Hl)&&super.reg(t)}};u(w,"StateConsumerScope",null),u(w,"styleAttrs",[]);var ho="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-instagram' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.225 12a5.775 5.775 0 1 1 11.55 0 5.775 5.775 0 0 1-11.55 0zM12 7.725a4.275 4.275 0 1 0 0 8.55 4.275 4.275 0 0 0 0-8.55zm6.425-.75a1.4 1.4 0 1 0 0-2.8 1.4 1.4 0 0 0 0 2.8zm-6.467-6.8h.084c2.152 0 3.823 0 5.152.132 1.35.134 2.427.41 3.362 1.013a7.15 7.15 0 0 1 2.124 2.124c.604.935.88 2.012 1.013 3.362.132 1.329.132 3 .132 5.152v.084c0 2.152 0 3.823-.132 5.152-.134 1.35-.41 2.427-1.013 3.362a7.15 7.15 0 0 1-2.124 2.124c-.935.604-2.012.88-3.362 1.013-1.329.132-3 .132-5.152.132h-.084c-2.152 0-3.824 0-5.153-.132-1.35-.134-2.427-.409-3.36-1.013a7.15 7.15 0 0 1-2.125-2.124C.716 19.62.44 18.544.307 17.194c-.132-1.329-.132-3-.132-5.152v-.084c0-2.152 0-3.823.132-5.152.133-1.35.409-2.427 1.013-3.362A7.15 7.15 0 0 1 3.444 1.32C4.378.716 5.456.44 6.805.307c1.33-.132 3-.132 5.153-.132zM6.953 1.799c-1.234.123-2.043.36-2.695.78A5.65 5.65 0 0 0 2.58 4.26c-.42.65-.657 1.46-.78 2.695C1.676 8.2 1.675 9.797 1.675 12s0 3.8.124 5.046c.123 1.235.36 2.044.78 2.696a5.649 5.649 0 0 0 1.68 1.678c.65.421 1.46.658 2.694.78 1.247.124 2.844.125 5.047.125s3.8 0 5.046-.124c1.235-.123 2.044-.36 2.695-.78a5.648 5.648 0 0 0 1.68-1.68c.42-.65.657-1.46.78-2.694.123-1.247.124-2.844.124-5.047s-.001-3.8-.125-5.046c-.122-1.235-.359-2.044-.78-2.695a5.65 5.65 0 0 0-1.679-1.68c-.651-.42-1.46-.657-2.695-.78-1.246-.123-2.843-.124-5.046-.124-2.203 0-3.8 0-5.047.124z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='apuc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#apuc-icon-id__a)'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#asuc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#asuc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#asuc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#asuc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#asuc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#asuc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#asuc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#asuc-icon-id__h)'/><defs><linearGradient id='asuc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var ft=class extends w{constructor(){super(...arguments);u(this,"requireCtxName",!0);u(this,"init$",wi(this));u(this,"_template",null)}initCallback(){var t;super.initCallback(),(t=this.a11y)==null||t.registerBlock(this)}static set template(t){this._template=ho+t+"<slot></slot>"}static get template(){return this._template}};u(ft,"styleAttrs",["uc-wgt-common"]);var po="active",Oe="___ACTIVITY_IS_ACTIVE___",$t=class $t extends w{constructor(){super(...arguments);u(this,"historyTracked",!1);u(this,"init$",Ur(this));u(this,"_debouncedHistoryFlush",M(this._historyFlush.bind(this),10))}_deactivate(){var e;let t=$t._activityCallbacks.get(this);this[Oe]=!1,this.removeAttribute(po),(e=t==null?void 0:t.deactivateCallback)==null||e.call(t)}_activate(){var e;let t=$t._activityCallbacks.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Oe]=!0,this.setAttribute(po,""),(e=t==null?void 0:t.activateCallback)==null||e.call(t),this._debouncedHistoryFlush(),this.emit(I.ACTIVITY_CHANGE,{activity:this.activityType})}initCallback(){super.initCallback(),this.hasAttribute("current-activity")&&this.sub("*currentActivity",t=>{this.setAttribute("current-activity",t)}),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{var e;try{this.activityType!==t&&this[Oe]?this._deactivate():this.activityType===t&&!this[Oe]&&this._activate()}catch(s){console.error(`Error in activity "${this.activityType}". `,s),this.$["*currentActivity"]=(e=this.$["*history"][this.$["*history"].length-1])!=null?e:null}t||(this.$["*history"]=[])}),this.has("*modalActive")&&this.sub("*modalActive",t=>{!t&&this.activityType===this.$["*currentActivity"]&&(this.$["*currentActivity"]=null)}))}_historyFlush(){let t=this.$["*history"];t&&(t.length>10&&(t=t.slice(t.length-11,t.length-1)),this.historyTracked&&t[t.length-1]!==this.activityType&&t.push(this.activityType),this.$["*history"]=t)}_isActivityRegistered(){return this.activityType&&$t._activityCallbacks.has(this)}get isActivityActive(){return this[Oe]}get couldOpenActivity(){return!0}registerActivity(t,e={}){let{onActivate:s,onDeactivate:o}=e;$t._activityCallbacks.set(this,{activateCallback:s,deactivateCallback:o})}unregisterActivity(){this.isActivityActive&&this._deactivate(),$t._activityCallbacks.delete(this)}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity();let t=this.$["*currentActivity"];!![...this.blocksRegistry].find(s=>s instanceof $t&&s.activityType===t)||(this.$["*currentActivity"]=null,this.setOrAddState("*modalActive",!1))}get activityKey(){return this.ctxName+this.activityType}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")}get doneActivity(){return this.getCssData("--cfg-done-activity")}historyBack(){var e;let t=this.$["*history"];if(t){let s=t.pop();for(;s===this.activityType;)s=t.pop();let o=!!s;if(s){let n=[...this.blocksRegistry].find(l=>l.activityType===s);o=(e=n==null?void 0:n.couldOpenActivity)!=null?e:!1}s=o?s:void 0,this.$["*currentActivity"]=s,this.$["*history"]=t,s||this.setOrAddState("*modalActive",!1)}}};u($t,"_activityCallbacks",new Map);var v=$t;v.activities=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 Le=33.333333333333336,T=1,Dr=24,fo=6;function Zt(r,i){for(let t in i)r.setAttributeNS(null,t,i[t].toString())}function rt(r,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",r);return Zt(t,i),t}function mo(r,i,t){let{x:e,y:s,width:o,height:n}=r,l=i.includes("w")?0:1,a=i.includes("n")?0:1,c=[-1,1][l],d=[-1,1][a],h=[e+l*o+1.5*c,s+a*n+1.5*d-24*t*d],p=[e+l*o+1.5*c,s+a*n+1.5*d],f=[e+l*o-24*t*c+1.5*c,s+a*n+1.5*d];return{d:`M ${h[0]} ${h[1]} L ${p[0]} ${p[1]} L ${f[0]} ${f[1]}`,center:p}}function go(r,i,t){let{x:e,y:s,width:o,height:n}=r,l=["n","s"].includes(i)?.5:{w:0,e:1}[i],a=["w","e"].includes(i)?.5:{n:0,s:1}[i],c=[-1,1][l],d=[-1,1][a],h,p;["n","s"].includes(i)?(h=[e+l*o-34*t/2,s+a*n+1.5*d],p=[e+l*o+34*t/2,s+a*n+1.5*d]):(h=[e+l*o+1.5*c,s+a*n-34*t/2],p=[e+l*o+1.5*c,s+a*n+34*t/2]);let f=`M ${h[0]} ${h[1]} L ${p[0]} ${p[1]}`,m=[p[0]-(p[0]-h[0])/2,p[1]-(p[1]-h[1])/2];return{d:f,center:m}}function bo(r){return r===""?"move":["e","w"].includes(r)?"ew-resize":["n","s"].includes(r)?"ns-resize":["nw","se"].includes(r)?"nwse-resize":"nesw-resize"}function yo({rect:r,delta:[i,t],imageBox:e}){return ae({...r,x:r.x+i,y:r.y+t},e)}function ae(r,i){let{x:t}=r,{y:e}=r;return r.x<i.x?t=i.x:r.x+r.width>i.x+i.width&&(t=i.x+i.width-r.width),r.y<i.y?e=i.y:r.y+r.height>i.y+i.height&&(e=i.y+i.height-r.height),{...r,x:t,y:e}}function jl({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,s]=i,{y:o,width:n,height:l}=r;o+=s,l-=s,t&&(n=l*t);let a=r.x+r.width/2-n/2;return o<=e.y&&(o=e.y,l=r.y+r.height-o,t&&(n=l*t,a=r.x+r.width/2-n/2)),a<=e.x&&(a=e.x,o=r.y+r.height-l),a+n>=e.x+e.width&&(a=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-a,t&&(l=n/t),o=r.y+r.height-l),l<T&&(l=T,t&&(n=l*t,a=r.x+r.width/2-n/2),o=r.y+r.height-l),n<T&&(n=T,t&&(l=n/t,a=r.x+r.width/2-n/2),o=r.y+r.height-l),{x:a,y:o,width:n,height:l}}function Gl({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s]=i,{x:o,width:n,height:l}=r;o+=s,n-=s,t&&(l=n/t);let a=r.y+r.height/2-l/2;return o<=e.x&&(o=e.x,n=r.x+r.width-o,t&&(l=n/t,a=r.y+r.height/2-l/2)),a<=e.y&&(a=e.y,o=r.x+r.width-n),a+l>=e.y+e.height&&(a=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-a,t&&(n=l*t),o=r.x+r.width-n),l<T&&(l=T,t&&(n=l*t),a=r.y+r.height/2-l/2,o=r.x+r.width-n),n<T&&(n=T,t&&(l=n/t),a=r.y+r.height/2-l/2,o=r.x+r.width-n),{x:o,y:a,width:n,height:l}}function Xl({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,s]=i,{y:o,width:n,height:l}=r;l+=s,t&&(n=l*t);let a=r.x+r.width/2-n/2;return o+l>=e.y+e.height&&(l=e.y+e.height-o,t&&(n=l*t),a=r.x+r.width/2-n/2),a<=e.x&&(a=e.x,o=r.y),a+n>=e.x+e.width&&(a=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-a,t&&(l=n/t),o=r.y),l<T&&(l=T,t&&(n=l*t),a=r.x+r.width/2-n/2),n<T&&(n=T,t&&(l=n/t),a=r.x+r.width/2-n/2),{x:a,y:o,width:n,height:l}}function Wl({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s]=i,{x:o,width:n,height:l}=r;n+=s,t&&(l=n/t);let a=r.y+r.height/2-l/2;return o+n>=e.x+e.width&&(n=e.x+e.width-o,t&&(l=n/t),a=r.y+r.height/2-l/2),a<=e.y&&(a=e.y,o=r.x),a+l>=e.y+e.height&&(a=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-a,t&&(n=l*t),o=r.x),l<T&&(l=T,t&&(n=l*t),a=r.y+r.height/2-l/2),n<T&&(n=T,t&&(l=n/t),a=r.y+r.height/2-l/2),{x:o,y:a,width:n,height:l}}function Kl({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s,o]=i,{x:n,y:l,width:a,height:c}=r;return n+s<e.x&&(s=e.x-n),l+o<e.y&&(o=e.y-l),n+=s,a-=s,l+=o,c-=o,t&&Math.abs(a/c)>t?(o=a/t-c,c+=o,l-=o,l<=e.y&&(c=c-(e.y-l),a=c*t,n=r.x+r.width-a,l=e.y)):t&&(s=c*t-a,a=a+s,n-=s,n<=e.x&&(a=a-(e.x-n),c=a/t,n=e.x,l=r.y+r.height-c)),c<T&&(c=T,t&&(a=c*t),n=r.x+r.width-a,l=r.y+r.height-c),a<T&&(a=T,t&&(c=a/t),n=r.x+r.width-a,l=r.y+r.height-c),{x:n,y:l,width:a,height:c}}function ql({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s,o]=i,{x:n,y:l,width:a,height:c}=r;return n+a+s>e.x+e.width&&(s=e.x+e.width-n-a),l+o<e.y&&(o=e.y-l),a+=s,l+=o,c-=o,t&&Math.abs(a/c)>t?(o=a/t-c,c+=o,l-=o,l<=e.y&&(c=c-(e.y-l),a=c*t,n=r.x,l=e.y)):t&&(s=c*t-a,a+=s,n+a>=e.x+e.width&&(a=e.x+e.width-n,c=a/t,n=e.x+e.width-a,l=r.y+r.height-c)),c<T&&(c=T,t&&(a=c*t),l=r.y+r.height-c),a<T&&(a=T,t&&(c=a/t),l=r.y+r.height-c),{x:n,y:l,width:a,height:c}}function Zl({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s,o]=i,{x:n,y:l,width:a,height:c}=r;return n+s<e.x&&(s=e.x-n),l+c+o>e.y+e.height&&(o=e.y+e.height-l-c),n+=s,a-=s,c+=o,t&&Math.abs(a/c)>t?(o=a/t-c,c+=o,l+c>=e.y+e.height&&(c=e.y+e.height-l,a=c*t,n=r.x+r.width-a,l=e.y+e.height-c)):t&&(s=c*t-a,a+=s,n-=s,n<=e.x&&(a=a-(e.x-n),c=a/t,n=e.x,l=r.y)),c<T&&(c=T,t&&(a=c*t),n=r.x+r.width-a),a<T&&(a=T,t&&(c=a/t),n=r.x+r.width-a),{x:n,y:l,width:a,height:c}}function Yl({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s,o]=i,{x:n,y:l,width:a,height:c}=r;return n+a+s>e.x+e.width&&(s=e.x+e.width-n-a),l+c+o>e.y+e.height&&(o=e.y+e.height-l-c),a+=s,c+=o,t&&Math.abs(a/c)>t?(o=a/t-c,c+=o,l+c>=e.y+e.height&&(c=e.y+e.height-l,a=c*t,n=r.x,l=e.y+e.height-c)):t&&(s=c*t-a,a+=s,n+a>=e.x+e.width&&(a=e.x+e.width-n,c=a/t,n=e.x+e.width-a,l=r.y)),c<T&&(c=T,t&&(a=c*t)),a<T&&(a=T,t&&(c=a/t)),{x:n,y:l,width:a,height:c}}function _o({direction:r,...i}){switch(r){case"n":return jl(i);case"w":return Gl(i);case"s":return Xl(i);case"e":return Wl(i);case"nw":return Kl(i);case"ne":return ql(i);case"sw":return Zl(i);case"se":return Yl(i);default:return i.rect}}function vo(r,[i,t]){return r.x<=i&&i<=r.x+r.width&&r.y<=t&&t<=r.y+r.height}function wo(r,i){return r.x>=i.x&&r.y>=i.y&&r.x+r.width<=i.x+i.width&&r.y+r.height<=i.y+i.height}function Co(r,i){return Math.abs(r.width/r.height-i)<.1}function ce({width:r,height:i},t){let e=t/90%2!==0;return{width:e?i:r,height:e?r:i}}function xo(r,i,t){let e=r/i,s,o;e>t?(s=Math.round(i*t),o=i):(s=r,o=Math.round(r/t));let n=Math.round((r-s)/2),l=Math.round((i-o)/2);return n+s>r&&(s=r-n),l+o>i&&(o=i-l),{x:n,y:l,width:s,height:o}}function ue(r){return{x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)}}function Bt(r,i,t){return Math.min(Math.max(r,i),t)}var Ti=r=>{if(!r)return[];let[i,t]=r.split(":").map(Number);if(!Number.isFinite(i)||!Number.isFinite(t)){console.error(`Invalid crop preset: ${r}`);return}return[{type:"aspect-ratio",width:i,height:t}]};var he="blocks",de="1.5.2";function Eo(r){return Tr({...r,libraryName:he,libraryVersion:de})}var Ao=r=>Math.floor(r/1e3),To=(r,{threshold:i})=>{let{secureExpire:t}=r,e=Ao(Date.now()),s=Number(t),o=Ao(i);return e+o>=s};var Si=class{constructor(i){u(this,"_block");u(this,"_secureToken",null);this._block=i}_debugPrint(...i){this._block.debugPrint("[secure-uploads]",...i)}async getSecureToken(){let{secureSignature:i,secureExpire:t,secureUploadsSignatureResolver:e}=this._block.cfg;if((i||t)&&e&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),e){if(!this._secureToken||To(this._secureToken,{threshold:this._block.cfg.secureUploadsExpireThreshold})){this._secureToken?this._debugPrint("Secure signature is expired. Resolving a new one..."):this._debugPrint("Secure signature is not set yet.");try{let s=await e();s?!s.secureSignature||!s.secureExpire?console.error("Secure signature resolver returned an invalid result:",s):(this._debugPrint("Secure signature resolved:",s),this._debugPrint("Secure signature will expire in",new Date(Number(s.secureExpire)*1e3).toISOString()),this._secureToken=s):(this._debugPrint("Secure signature resolver returned nothing."),this._secureToken=null)}catch(s){console.error("Secure signature resolving failed. Falling back to the previous one.",s)}}return this._secureToken}return i&&t?(this._debugPrint("Secure signature and expire are set. Using them...",{secureSignature:i,secureExpire:t}),{secureSignature:i,secureExpire:t}):null}};var So="[Typed State] Wrong property name: ",Jl="[Typed State] Wrong property type: ",ki=class{constructor(i,t){this.__typedSchema=i,this.__ctxId=t||nt.generate(),this.__schema=Object.keys(i).reduce((e,s)=>(e[s]=i[s].value,e),{}),this.__data=$.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(i,t){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(So+i);return}let e=this.__typedSchema[i];if((t==null?void 0:t.constructor)===e.type||t instanceof e.type||e.nullable&&t===null){this.__data.pub(i,t);return}console.warn(Jl+i)}setMultipleValues(i){for(let t in i)this.setValue(t,i[t])}getValue(i){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(So+i);return}return this.__data.read(i)}subscribe(i,t){return this.__data.sub(i,t)}remove(){$.deleteCtx(this.__ctxId)}};var $i=class{constructor(i){this.__typedSchema=i.typedSchema,this.__ctxId=i.ctxName||nt.generate(),this.__data=$.registerCtx({},this.__ctxId),this.__watchList=i.watchList||[],this.__subsMap=Object.create(null),this.__propertyObservers=new Set,this.__collectionObservers=new Set,this.__items=new Set,this.__removed=new Set,this.__added=new Set;let t=Object.create(null);this.__notifyObservers=(e,s)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),t[e]||(t[e]=new Set),t[e].add(s),this.__observeTimeout=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.__propertyObservers.forEach(o=>{o({...t})}),t=Object.create(null))})}}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{let i=new Set(this.__added),t=new Set(this.__removed);this.__added.clear(),this.__removed.clear();for(let e of this.__collectionObservers)e==null||e([...this.__items],i,t)})}observeCollection(i){return this.__collectionObservers.add(i),this.__items.size>0&&this.notify(),()=>{this.unobserveCollection(i)}}unobserveCollection(i){var t;(t=this.__collectionObservers)==null||t.delete(i)}add(i){let t=new ki(this.__typedSchema);for(let e in i)t.setValue(e,i[e]);return this.__items.add(t.uid),this.notify(),this.__data.add(t.uid,t),this.__added.add(t),this.__watchList.forEach(e=>{this.__subsMap[t.uid]||(this.__subsMap[t.uid]=[]),this.__subsMap[t.uid].push(t.subscribe(e,()=>{this.__notifyObservers(e,t.uid)}))}),t.uid}read(i){return this.__data.read(i)}readProp(i,t){return this.read(i).getValue(t)}publishProp(i,t,e){this.read(i).setValue(t,e)}remove(i){this.__removed.add(this.__data.read(i)),this.__items.delete(i),this.notify(),this.__data.pub(i,null),delete this.__subsMap[i]}clearAll(){this.__items.forEach(i=>{this.remove(i)})}observeProperties(i){return this.__propertyObservers.add(i),()=>{this.unobserveProperties(i)}}unobserveProperties(i){var t;(t=this.__propertyObservers)==null||t.delete(i)}findItems(i){let t=[];return this.__items.forEach(e=>{let s=this.read(e);i(s)&&t.push(e)}),t}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){$.deleteCtx(this.__ctxId),this.__propertyObservers=null,this.__collectionObservers=null;for(let i in this.__subsMap)this.__subsMap[i].forEach(t=>{t.remove()}),delete this.__subsMap[i]}};var Q=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",URL_TAB:"url-tab",CAMERA:"camera",EXTERNAL:"external",API:"js-api"});var Ue=["image/*","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Ii=r=>r?r.filter(i=>typeof i=="string").map(i=>G(i)).flat():[],Nr=(r,i)=>i.some(t=>t.endsWith("*")?(t=t.replace("*",""),r.startsWith(t)):r===t),ko=(r,i)=>i.some(t=>t.startsWith(".")?r.toLowerCase().endsWith(t.toLowerCase()):!1),$o=r=>{let i=r==null?void 0:r.type;return i?Nr(i,Ue):!1};var Ql=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,ta=new RegExp(`^/?(${Ql.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),Io=({url:r,cdnBase:i})=>{let t=new URL(i),e=new URL(r);if(t.host!==e.host)return null;let[,s,o,n]=ta.exec(e.pathname);return{uuid:s,cdnUrlModifiers:o||"",filename:n||null}};var Oo=r=>{let i=new Map;return(...t)=>{let e=JSON.stringify(t);if(i.has(e))return i.get(e);let s=r(...t);return i.set(e,s),s}};var Lo=new Set;function Uo(r){Lo.has(r)||(Lo.add(r),console.warn(r))}function ea(r){let i=!1;return setTimeout(()=>{i=!0},0),e=>(...s)=>(i&&Uo(r),e(...s))}function Mo(r){let i={progress:()=>r.$["*commonProgress"],errors:()=>r.$["*collectionErrors"],group:()=>r.$["*groupInfo"],totalCount:()=>r.uploadCollection.size,failedCount:()=>t.failedEntries.length,successCount:()=>t.successEntries.length,uploadingCount:()=>t.uploadingEntries.length,status:()=>t.isFailed?"failed":t.isUploading?"uploading":t.isSuccess?"success":"idle",isSuccess:()=>t.allEntries.length>0&&t.errors.length===0&&t.successEntries.length===t.allEntries.length,isUploading:()=>t.allEntries.some(s=>s.status==="uploading"),isFailed:()=>t.errors.length>0||t.failedEntries.length>0,allEntries:()=>r.getOutputData(),successEntries:()=>t.allEntries.filter(s=>s.status==="success"),failedEntries:()=>t.allEntries.filter(s=>s.status==="failed"),uploadingEntries:()=>t.allEntries.filter(s=>s.status==="uploading"),idleEntries:()=>t.allEntries.filter(s=>s.status==="idle")},t={},e=ea("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[s,o]of Object.entries(i)){let n=s,a=Oo(e(o));Object.defineProperty(t,n,{get:a,enumerable:!0})}return t}var Oi=class{constructor(i){u(this,"_ctx");u(this,"addFileFromUrl",(i,{silent:t,fileName:e,source:s}={})=>{let o=this._uploadCollection.add({externalUrl:i,fileName:e!=null?e:null,silent:t!=null?t:!1,source:s!=null?s:Q.API});return this.getOutputItem(o)});u(this,"addFileFromUuid",(i,{silent:t,fileName:e,source:s}={})=>{let o=this._uploadCollection.add({uuid:i,fileName:e!=null?e:null,silent:t!=null?t:!1,source:s!=null?s:Q.API});return this.getOutputItem(o)});u(this,"addFileFromCdnUrl",(i,{silent:t,fileName:e,source:s}={})=>{var l;let o=Io({url:i,cdnBase:this.cfg.cdnCname});if(!o)throw new Error("Invalid CDN URL");let n=this._uploadCollection.add({uuid:o.uuid,cdnUrl:i,cdnUrlModifiers:o.cdnUrlModifiers,fileName:(l=e!=null?e:o.filename)!=null?l:null,silent:t!=null?t:!1,source:s!=null?s:Q.API});return this.getOutputItem(n)});u(this,"addFileFromObject",(i,{silent:t,fileName:e,source:s,fullPath:o}={})=>{let n=this._uploadCollection.add({file:i,isImage:$o(i),mimeType:i.type,fileName:e!=null?e:i.name,fileSize:i.size,silent:t!=null?t:!1,source:s!=null?s:Q.API,fullPath:o!=null?o:null});return this.getOutputItem(n)});u(this,"removeFileByInternalId",i=>{if(!this._uploadCollection.read(i))throw new Error(`File with internalId ${i} not found`);this._uploadCollection.remove(i)});u(this,"uploadAll",()=>{let i=this._uploadCollection.items().filter(t=>{let e=this._uploadCollection.read(t);return!e.getValue("isRemoved")&&!e.getValue("isUploading")&&!e.getValue("fileInfo")});i.length!==0&&(this._ctx.$["*uploadTrigger"]=new Set(i),this._ctx.emit(I.COMMON_UPLOAD_START,this.getOutputCollectionState()))});u(this,"openSystemDialog",(i={})=>{var o;let t=se(Ii([(o=this.cfg.accept)!=null?o:"",...this.cfg.imgOnly?Ue:[]]));this.cfg.accept&&this.cfg.imgOnly&&console.warn("There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list.");let e="uploadcare-file-input",s=document.createElement("input");s.setAttribute(e,""),Wt(s,{opacity:0,height:0,width:0,visibility:"hidden"}),s.type="file",s.multiple=this.cfg.multiple,i.captureCamera?(s.capture=this.cfg.cameraCapture,s.accept="image/*"):s.accept=t,s.addEventListener("change",()=>{s.files&&([...s.files].forEach(n=>this.addFileFromObject(n,{source:i.captureCamera?Q.CAMERA:Q.LOCAL})),this._ctx.$["*currentActivity"]=v.activities.UPLOAD_LIST,this._ctx.setOrAddState("*modalActive",!0),s.remove())},{once:!0}),document.querySelectorAll(`[${e}]`).forEach(n=>n.remove()),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"))});u(this,"getOutputItem",i=>{var n,l,a,c,d,h,p,f,m,y;let t=$.getCtx(i).store,e=t.fileInfo,s=t.isRemoved?"removed":t.errors.length>0?"failed":t.fileInfo?"success":t.isUploading?"uploading":"idle";return{uuid:(l=(n=e==null?void 0:e.uuid)!=null?n:t.uuid)!=null?l:null,internalId:i,name:(a=e==null?void 0:e.originalFilename)!=null?a:t.fileName,size:(c=e==null?void 0:e.size)!=null?c:t.fileSize,isImage:(d=e==null?void 0:e.isImage)!=null?d:t.isImage,mimeType:(h=e==null?void 0:e.mimeType)!=null?h:t.mimeType,file:t.file,externalUrl:t.externalUrl,cdnUrlModifiers:t.cdnUrlModifiers,cdnUrl:(f=(p=t.cdnUrl)!=null?p:e==null?void 0:e.cdnUrl)!=null?f:null,fullPath:t.fullPath,uploadProgress:t.uploadProgress,fileInfo:e!=null?e:null,metadata:(y=(m=t.metadata)!=null?m:e==null?void 0:e.metadata)!=null?y:null,isSuccess:s==="success",isUploading:s==="uploading",isFailed:s==="failed",isRemoved:s==="removed",errors:t.errors,status:s}});u(this,"getOutputCollectionState",()=>Mo(this._ctx));u(this,"initFlow",(i=!1)=>{var t;if(this._uploadCollection.size>0&&!i)this._ctx.set$({"*currentActivity":v.activities.UPLOAD_LIST}),this._ctx.setOrAddState("*modalActive",!0);else if(((t=this._sourceList)==null?void 0:t.length)===1){let e=this._sourceList[0];if(e==="local"){this._ctx.$["*currentActivity"]=v.activities.UPLOAD_LIST,this.openSystemDialog();return}let s=this._ctx.$["*blocksRegistry"],o=l=>"type"in l&&l.type===e,n=[...s].find(o);n==null||n.activate(),this._ctx.$["*currentActivity"]&&this._ctx.setOrAddState("*modalActive",!0)}else this._ctx.set$({"*currentActivity":v.activities.START_FROM}),this._ctx.setOrAddState("*modalActive",!0)});u(this,"doneFlow",()=>{this._ctx.set$({"*currentActivity":this._ctx.doneActivity,"*history":this._ctx.doneActivity?[this._ctx.doneActivity]:[]}),this._ctx.$["*currentActivity"]||this._ctx.setOrAddState("*modalActive",!1)});u(this,"setCurrentActivity",(i,t=void 0)=>{if(this._ctx.hasBlockInCtx(e=>e.activityType===i)){this._ctx.set$({"*currentActivityParams":t!=null?t:{},"*currentActivity":i});return}console.warn(`Activity type "${i}" not found in the context`)});u(this,"getCurrentActivity",()=>this._ctx.$["*currentActivity"]);u(this,"setModalState",i=>{if(i&&!this._ctx.$["*currentActivity"]){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}this._ctx.setOrAddState("*modalActive",i)});this._ctx=i}get _uploadCollection(){return this._ctx.uploadCollection}get cfg(){return this._ctx.cfg}get l10n(){return this._ctx.l10n.bind(this._ctx)}removeAllFiles(){this._uploadCollection.clearAll()}get _sourceList(){let i=[];return this.cfg.sourceList&&(i=G(this.cfg.sourceList)),i}};var Br=(r,i)=>{let t=i.cfg.imgOnly,e=r.isImage;if(!(!t||e)&&!(!r.fileInfo&&r.externalUrl)&&!(!r.fileInfo&&!r.mimeType))return{type:"NOT_AN_IMAGE",message:i.l10n("images-only-accepted"),payload:{entry:r}}};var zr=(r,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,s=Ii([...t?Ue:[],e]);if(!s.length)return;let o=r.mimeType,n=r.name;if(!o||!n)return;let l=Nr(o,s),a=ko(n,s);if(!l&&!a)return{type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:r}}};var gt=1e3,Yt=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Me=r=>Math.ceil(r*100)/100,Po=(r,i=Yt.AUTO)=>{let t=i===Yt.AUTO;if(i===Yt.BYTE||t&&r<gt**1){let e=pi("en-US",r),s={one:"byte",other:"bytes"}[e];return`${r} ${s}`}return i===Yt.KB||t&&r<gt**2?`${Me(r/gt**1)} KB`:i===Yt.MB||t&&r<gt**3?`${Me(r/gt**2)} MB`:i===Yt.GB||t&&r<gt**4?`${Me(r/gt**3)} GB`:i===Yt.TB||t&&r<gt**5?`${Me(r/gt**4)} TB`:`${Me(r/gt**5)} PB`};var Vr=(r,i)=>{let t=i.cfg.maxLocalFileSizeBytes,e=r.size;if(t&&e&&e>t)return{type:"FILE_SIZE_EXCEEDED",message:i.l10n("files-max-size-limit-error",{maxFileSize:Po(t)}),payload:{entry:r}}};var Hr=(r,i)=>{let{internalId:t}=r,e=i._uploadCollection.read(t),s=e==null?void 0:e.getValue("uploadError");if(!s)return;if(s instanceof X)return{type:"UPLOAD_ERROR",message:s.message,payload:{entry:r,error:s}};if(s instanceof oe)return{type:"NETWORK_ERROR",message:s.message,payload:{entry:r,error:s}};let o=s instanceof Error?s:new Error("Unknown error",{cause:s});return{type:"UNKNOWN_ERROR",message:o.message,payload:{entry:r,error:o}}};var jr=(r,i)=>{if(r.failedCount>0)return{type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}};var Gr=(r,i)=>{let t=r.totalCount,e=i.cfg.multiple?i.cfg.multipleMin:0,s=i.cfg.multiple?i.cfg.multipleMax:1;if(e&&t<e)return{type:"TOO_FEW_FILES",message:i.l10n("files-count-limit-error-too-few",{min:e,max:s,total:t}),payload:{total:t,min:e,max:s}};if(s&&t>s)return{type:"TOO_MANY_FILES",message:i.l10n("files-count-limit-error-too-many",{min:e,max:s,total:t}),payload:{total:t,min:e,max:s}}};var Li={file:"File validator execution has failed",collection:"Collection validator execution has failed",message:"Missing message. We recommend adding message: value."},Ui=class{constructor(i){u(this,"_blockInstance");u(this,"_fileValidators",[Br,zr,Vr,Hr]);u(this,"_collectionValidators",[Gr,jr]);this._blockInstance=i,this._uploadCollection=this._blockInstance.uploadCollection;let t=()=>{this.runFileValidators(),this.runCollectionValidators()};this._blockInstance.subConfigValue("maxLocalFileSizeBytes",t),this._blockInstance.subConfigValue("multipleMin",t),this._blockInstance.subConfigValue("multipleMax",t),this._blockInstance.subConfigValue("multiple",t),this._blockInstance.subConfigValue("imgOnly",t),this._blockInstance.subConfigValue("accept",t)}runFileValidators(i){let t=i!=null?i:this._uploadCollection.items();for(let e of t){let s=this._uploadCollection.read(e);s&&this._runFileValidatorsForEntry(s)}}runCollectionValidators(){let i=this._blockInstance.api.getOutputCollectionState(),t=[];for(let e of[...this._collectionValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.collectionValidators)])try{let s=e(i,this._blockInstance.api);if(!s)continue;s&&(t.push(s),s.message||console.warn(Li.message))}catch(s){console.warn(Li.collection,s)}this._blockInstance.$["*collectionErrors"]=t,t.length>0&&this._blockInstance.emit(I.COMMON_UPLOAD_FAILED,()=>this._blockInstance.api.getOutputCollectionState(),{debounce:!0})}_runFileValidatorsForEntry(i){let t=this._blockInstance.api.getOutputItem(i.uid),e=[];for(let s of[...this._fileValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.fileValidators)])try{let o=s(t,this._blockInstance.api);if(!o)continue;o&&(e.push(o),o.message||console.warn(Li.message))}catch(o){console.warn(Li.file,o)}i.setValue("errors",e)}_addCustomTypeToValidators(i){return i.map(t=>(...e)=>{let s=t(...e);return s?{...s,type:"CUSTOM_ERROR"}:void 0})}};var Ro=Object.freeze({file:{type:File,value:null},externalUrl:{type:String,value:null},fileName:{type:String,value:null,nullable:!0},fileSize:{type:Number,value:null,nullable:!0},lastModified:{type:Number,value:Date.now()},uploadProgress:{type:Number,value:0},uuid:{type:String,value:null},isImage:{type:Boolean,value:!1},mimeType:{type:String,value:null,nullable:!0},ctxName:{type:String,value:null},cdnUrl:{type:String,value:null},cdnUrlModifiers:{type:String,value:null},fileInfo:{type:Tt,value:null},isUploading:{type:Boolean,value:!1},abortController:{type:AbortController,value:null,nullable:!0},thumbUrl:{type:String,value:null,nullable:!0},silent:{type:Boolean,value:!1},source:{type:String,value:null,nullable:!0},fullPath:{type:String,value:null,nullable:!0},metadata:{type:Object,value:null,nullable:!0},errors:{type:Array,value:[]},uploadError:{type:Error,value:null,nullable:!0},isRemoved:{type:Boolean,value:!1}});var S=class r extends v{constructor(){super(...arguments);u(this,"couldBeCtxOwner",!1);u(this,"isCtxOwner",!1);u(this,"init$",wi(this));u(this,"_flushOutputItems",M(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(I.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this._createGroup(e)},300));u(this,"_handleCollectionUpdate",(t,e,s)=>{var o;(e.size||s.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators(),this.validationManager.runCollectionValidators();for(let n of e)n.getValue("silent")||this.emit(I.FILE_ADDED,this.api.getOutputItem(n.uid));for(let n of s)this.$["*uploadTrigger"].delete(n.uid),(o=n.getValue("abortController"))==null||o.abort(),n.setMultipleValues({isRemoved:!0,abortController:null,isUploading:!1,uploadProgress:0}),URL.revokeObjectURL(n==null?void 0:n.getValue("thumbUrl")),this.emit(I.FILE_REMOVED,this.api.getOutputItem(n.uid));this.$["*uploadList"]=t.map(n=>({uid:n})),this._flushCommonUploadProgress(),this._flushOutputItems()});u(this,"_handleCollectionPropertiesUpdate",t=>{this._flushOutputItems();let e=this.uploadCollection,s=[...new Set(Object.entries(t).filter(([o])=>["uploadError","fileInfo"].includes(o)).map(([,o])=>[...o]).flat())];if(s.length>0&&setTimeout(()=>{this.validationManager.runFileValidators(s)}),t.uploadProgress){for(let o of t.uploadProgress){let{isUploading:n,silent:l}=$.getCtx(o).store;n&&!l&&this.emit(I.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(o))}this._flushCommonUploadProgress()}if(t.isUploading)for(let o of t.isUploading){let{isUploading:n,silent:l}=$.getCtx(o).store;n&&!l&&this.emit(I.FILE_UPLOAD_START,this.api.getOutputItem(o))}if(t.fileInfo){for(let o of t.fileInfo){let{fileInfo:n,silent:l}=$.getCtx(o).store;n&&!l&&this.emit(I.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(o))}this.cfg.cropPreset&&this.setInitialCrop()}if(t.errors){for(let l of t.errors){let{errors:a}=$.getCtx(l).store;a.length>0&&(this.emit(I.FILE_UPLOAD_FAILED,this.api.getOutputItem(l)),this.emit(I.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:!0}))}let o=e.findItems(l=>!!l.getValue("fileInfo")),n=e.findItems(l=>l.getValue("errors").length>0);e.size>0&&n.length===0&&e.size===o.length&&this.$["*collectionErrors"].length===0&&this.emit(I.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState())}t.cdnUrl&&([...t.cdnUrl].filter(n=>{var l;return!!((l=this.uploadCollection.read(n))!=null&&l.getValue("cdnUrl"))}).forEach(n=>{this.emit(I.FILE_URL_CHANGED,this.api.getOutputItem(n))}),this.$["*groupInfo"]=null)});u(this,"_flushCommonUploadProgress",()=>{let t=0,s=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));s.forEach(n=>{let l=this.uploadCollection.readProp(n,"uploadProgress");t+=l});let o=s.length?Math.round(t/s.length):0;this.$["*commonProgress"]!==o&&(this.$["*commonProgress"]=o,this.emit(I.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()))})}get hasCtxOwner(){return this.hasBlockInCtx(t=>t instanceof r?t.isCtxOwner&&t.isConnected&&t!==this:!1)}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let t=new $i({typedSchema:Ro,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading"]});this.add("*uploadCollection",t)}this.has("*publicApi")||this.add("*publicApi",new Oi(this)),this.has("*validationManager")||this.add("*validationManager",new Ui(this)),!this.hasCtxOwner&&this.couldBeCtxOwner&&this.initCtxOwner()}get validationManager(){if(!this.has("*validationManager"))throw new Error("Unexpected error: ValidationManager is not initialized");return this.$["*validationManager"]}get api(){if(!this.has("*publicApi"))throw new Error("Unexpected error: UploaderPublicApi is not initialized");return this.$["*publicApi"]}getAPI(){return this.api}get uploadCollection(){if(!this.has("*uploadCollection"))throw new Error("Unexpected error: TypedCollection is not initialized");return this.$["*uploadCollection"]}destroyCtxCallback(){var t,e;(t=this._unobserveCollectionProperties)==null||t.call(this),(e=this._unobserveCollection)==null||e.call(this),this.uploadCollection.destroy(),this.$["*uploadCollection"]=null,super.destroyCtxCallback()}initCtxOwner(){this.isCtxOwner=!0,this._unobserveCollection=this.uploadCollection.observeCollection(this._handleCollectionUpdate),this._unobserveCollectionProperties=this.uploadCollection.observeProperties(this._handleCollectionPropertiesUpdate),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1}),this.$["*secureUploadsManager"]||(this.$["*secureUploadsManager"]=new Si(this)),this.has("*modalActive")&&this.sub("*modalActive",t=>{t&&!this.$["*currentActivity"]&&(this.$["*modalActive"]=!1)})}async _createGroup(t){let e=await this.getUploadClientOptions(),s=t.allEntries.map(a=>a.uuid+(a.cdnUrlModifiers?`/${a.cdnUrlModifiers}`:"")),o=new AbortController,n=await eo(s,{...e,signal:o.signal});if(this.$["*collectionState"]!==t){o.abort();return}this.$["*groupInfo"]=n;let l=this.api.getOutputCollectionState();this.emit(I.GROUP_CREATED,l),this.emit(I.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.$["*collectionState"]=l}setInitialCrop(){let t=Ti(this.cfg.cropPreset);if(t){let[e]=t,s=this.uploadCollection.findItems(o=>{var n;return o.getValue("fileInfo")&&o.getValue("isImage")&&!((n=o.getValue("cdnUrlModifiers"))!=null&&n.includes("/crop/"))}).map(o=>this.uploadCollection.read(o));for(let o of s){let n=o.getValue("fileInfo"),{width:l,height:a}=n.imageInfo,c=e.width/e.height,d=xo(l,a,c),h=j(`crop/${d.width}x${d.height}/${d.x},${d.y}`,"preview");o.setMultipleValues({cdnUrlModifiers:h,cdnUrl:R(o.getValue("cdnUrl"),h)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(p=>p.activityType===v.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:o.uid},this.$["*currentActivity"]=v.activities.CLOUD_IMG_EDIT)}}}async getMetadataFor(t){let e=this.cfg.metadata||void 0;if(typeof e=="function"){let s=this.api.getOutputItem(t);return await e(s)}return e}async getUploadClientOptions(){let e=await this.$["*secureUploadsManager"].getSecureToken().catch(()=>null);return{store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:Eo,integration:this.cfg.userAgentIntegration,secureSignature:e==null?void 0:e.secureSignature,secureExpire:e==null?void 0:e.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads}}getOutputData(){return this.uploadCollection.items().map(s=>this.api.getOutputItem(s))}};S.extSrcList=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",INSTAGRAM:"instagram",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"});S.sourceTypes=Object.freeze({LOCAL:"local",URL:"url",CAMERA:"camera",DRAW:"draw",...S.extSrcList});var Pe=r=>{var i;return(i=r.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:i.map(t=>t.toLowerCase()).join("-")};var z=r=>String(r),ct=r=>{let i=Number(r);if(Number.isNaN(i))throw new Error(`Invalid number: "${r}"`);return i},L=r=>{if(typeof r=="undefined"||r===null)return!1;if(typeof r=="boolean")return r;if(r==="true"||r==="")return!0;if(r==="false")return!1;throw new Error(`Invalid boolean: "${r}"`)},ia=r=>r==="auto"?r:L(r),ra=r=>{let i=z(r);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid "cameraCapture" value: "${i}"`);return i},sa=r=>{if(typeof r=="object"&&!Array.isArray(r)||typeof r=="function")return r;throw new Error("Invalid metadata value. Must be an object or function.")},oa=r=>{if(typeof r=="object")return r;throw new Error("Invalid value. Must be an object.")},Xr=r=>{if(typeof r=="function")return r;throw new Error("Invalid value. Must be a function.")},Fo=r=>{if(Array.isArray(r))return r;throw new Error("Must be an array.")},na={pubkey:z,multiple:L,multipleMin:ct,multipleMax:ct,confirmUpload:L,imgOnly:L,accept:z,externalSourcesPreferredTypes:z,store:ia,cameraMirror:L,cameraCapture:ra,sourceList:z,maxLocalFileSizeBytes:ct,thumbSize:ct,showEmptyList:L,useLocalImageEditor:L,useCloudImageEditor:L,cloudImageEditorTabs:z,removeCopyright:L,cropPreset:z,imageShrink:z,modalScrollLock:L,modalBackdropStrokes:L,sourceListWrap:L,remoteTabSessionKey:z,cdnCname:z,baseUrl:z,socialBaseUrl:z,secureSignature:z,secureExpire:z,secureDeliveryProxy:z,retryThrottledRequestMaxTimes:ct,multipartMinFileSize:ct,multipartChunkSize:ct,maxConcurrentRequests:ct,multipartMaxConcurrentRequests:ct,multipartMaxAttempts:ct,checkForUrlDuplicates:L,saveUrlForRecurrentUploads:L,groupOutput:L,userAgentIntegration:z,debug:L,localeName:z,metadata:sa,secureUploadsExpireThreshold:ct,localeDefinitionOverride:oa,secureUploadsSignatureResolver:Xr,secureDeliveryProxyUrlResolver:Xr,iconHrefResolver:Xr,fileValidators:Fo,collectionValidators:Fo},Do=(r,i)=>{if(!(typeof i=="undefined"||i===null))try{return na[r](i)}catch(t){return console.error(`Invalid value for config key "${r}".`,t),at[r]}};var Wr=[...new Set(["debug",...Object.keys(at)])],la=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators"],aa=r=>la.includes(r),pe=Wr.filter(r=>!aa(r)),ca={...Object.fromEntries(pe.map(r=>[Pe(r),r])),...Object.fromEntries(pe.map(r=>[r.toLowerCase(),r]))},ua={...Object.fromEntries(pe.map(r=>[Pe(r),J(r)])),...Object.fromEntries(pe.map(r=>[r.toLowerCase(),J(r)]))},No=r=>"__"+r,Re=class extends w{constructor(){super();u(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(at).map(([t,e])=>[J(t),e]))}}_flushValueToAttribute(t,e){if(pe.includes(t)){let s=[...new Set([Pe(t),t.toLowerCase()])];for(let o of s)typeof e=="undefined"||e===null?this.removeAttribute(o):this.getAttribute(o)!==e.toString()&&this.setAttribute(o,e.toString())}}_flushValueToState(t,e){this.$[J(t)]!==e&&(typeof e=="undefined"||e===null?this.$[J(t)]=at[t]:this.$[J(t)]=e)}_setValue(t,e){let s=this,o=Do(t,e),n=No(t);s[n]!==o&&(this._assertSameValueDifferentReference(t,s[n],o),s[n]=o,this._flushValueToAttribute(t,o),this._flushValueToState(t,o),this.debugPrint(`[uc-config] "${t}"`,o))}_getValue(t){let e=this,s=No(t);return e[s]}_assertSameValueDifferentReference(t,e,s){this.cfg.debug&&s!==e&&typeof s=="object"&&typeof e=="object"&&JSON.stringify(s)===JSON.stringify(e)&&(console.warn(`[uc-config] Option "${t}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${t}" previous value:`,e),console.warn(`[uc-config] "${t}" new value:`,s))}initCallback(){var e;super.initCallback();let t=this;for(let s of pe)this.sub(J(s),o=>{this._setValue(s,o)},!1);for(let s of Wr){let o=(e=t[s])!=null?e:this.$[J(s)];o!==at[s]&&this._setValue(s,o),Object.defineProperty(this,s,{set:n=>{this._setValue(s,n)},get:()=>this._getValue(s)})}}attributeChangedCallback(t,e,s){if(e===s)return;let o=this,n=ca[t];o[n]=s}};Re.bindAttributes(ua);for(let r of Wr)Re.prototype[r]=void 0;var ha=Re;var Fe=class extends w{constructor(){super(),this.init$={...this.init$,name:"",href:""}}initCallback(){super.initCallback(),this.sub("name",i=>{if(!i)return;let t=`#uc-icon-${i}`;this.subConfigValue("iconHrefResolver",e=>{if(e){let s=e(i);t=s!=null?s:t}this.$.href=t})})}};Fe.template=b`<svg ref="svg" xmlns="http://www.w3.org/2000/svg"><use set="@href: href;"></use></svg>`;Fe.bindAttributes({name:"name"});var Bo=r=>[...new Set(r)];var zo=r=>Object.entries(r).filter(([,i])=>i!==void 0&&i!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`);var da="https://ucarecdn.com",De=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:da},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});var fe="--uc-img-",Kr="unresolved";var qr=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),Zr=3e3,Yr=5e3,Jr=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var Ho=Object.create(null),Vo;for(let r in De)Ho[fe+r]=((Vo=De[r])==null?void 0:Vo.default)||"";var Mi=class extends xt{constructor(){super(...arguments);u(this,"cssInit$",Ho)}$$(t){return this.$[fe+t]}set$$(t){for(let e in t)this.$[fe+e]=t[e]}sub$$(t,e){this.sub(fe+t,s=>{s===null||s===""||e(s)})}analyticsParams(){return`-/@clib/${he}/${de}/uc-img/`}initAttributes(t){[...this.attributes].forEach(e=>{De[e.name]||t.setAttribute(e.name,e.value)})}initIntersection(t,e){let s={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(o=>{o.forEach(n=>{n.isIntersecting&&(e(),this._isnObserver.unobserve(t))})},s),this._isnObserver.observe(t),this._observed||(this._observed=new Set),this._observed.add(t)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(t=>{this._isnObserver.unobserve(t)}),this._isnObserver=null),$.deleteCtx(this)}static get observedAttributes(){return Object.keys(De)}attributeChangedCallback(t,e,s){window.setTimeout(()=>{this.$[fe+t]=s})}};var Fi=class extends Mi{constructor(){super(...arguments);u(this,"_img",new Image);u(this,"_imgPreview",new Image)}_fmtAbs(t){return!t.includes("//")&&!qr&&(t=new URL(t,document.baseURI).href),t}_validateSize(t){if((t==null?void 0:t.trim())!==""){let e=t.match(/\d+/)[0],s=t.match(/[a-zA-Z]+/)[0],o=parseInt(e,10);if(Number(o)>Yr&&this.hasFormatJPG)return Yr+s;if(Number(o)>Zr&&!this.hasFormatJPG)return Zr+s}return t}_getCdnModifiers(t,e){let s={format:this.$$("format"),quality:this.$$("quality"),resize:this._validateSize(t),blur:e,"cdn-operations":this.$$("cdn-operations"),analytics:this.analyticsParams()};return j(...zo(s))}_getUrlBase(t="",e=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(qr&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let s=this._getCdnModifiers(t,e);if(this.$$("src").startsWith(this.$$("cdn-cname")))return R(this.$$("src"),s);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl(R(Pt(this.$$("cdn-cname"),this.$$("uuid")),s));if(this.$$("uuid"))return this._proxyUrl(R(Pt(this.$$("cdn-cname"),this.$$("uuid")),s));if(this.$$("proxy-cname"))return this._proxyUrl(R(this.$$("proxy-cname"),s,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl(R(`https://${this.$$("pubkey")}.ucr.io/`,s,this._fmtAbs(this.$$("src"))))}_proxyUrl(t){return this.$$("secure-delivery-proxy")?Se(this.$$("secure-delivery-proxy"),{previewUrl:t},{transform:s=>window.encodeURIComponent(s)}):t}_getElSize(t,e=1,s=!0){let o=t.getBoundingClientRect(),n=e*Math.round(o.width),l=s?"":e*Math.round(o.height);return n||l?`${n||""}x${l||""}`:null}_setupEventProxy(t){let e=o=>{o.stopPropagation();let n=new Event(o.type,o);this.dispatchEvent(n)},s=["load","error"];for(let o of s)t.addEventListener(o,e)}get img(){return this.hasPreviewImage||(this._setupConfigForImage({elNode:this._img}),this.appendChild(this._img)),this._img}get currentImg(){return this.hasPreviewImage?{type:Jr.PREVIEW,img:this._imgPreview}:{type:Jr.MAIN,img:this.img}}get hasPreviewImage(){return this.$$("is-preview-blur")}get bgSelector(){return this.$$("is-background-for")}get breakpoints(){if(this.$$("breakpoints")){let t=G(this.$$("breakpoints"));return Bo(t.map(e=>parseInt(e,10)))}else return null}get hasFormatJPG(){return this.$$("format").toLowerCase()==="jpeg"}renderBg(t){let e=new Set;e.add(`url("${this._getUrlBase(this._getElSize(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,3))}") ${3}x`);let s=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",s),t.style.setProperty("background-image","-webkit-"+s)}getSrcset(){let t=new Set;return this.breakpoints?this.breakpoints.forEach(e=>{t.add(this._getUrlBase(e+"x")+` ${this._validateSize(e+"w")}`),this.$$("hi-res-support")&&t.add(this._getUrlBase(e*2+"x")+` ${this._validateSize(e*2+"w")}`),this.$$("ultra-res-support")&&t.add(this._getUrlBase(e*3+"x")+` ${this._validateSize(e*3+"w")}`)}):(t.add(this._getUrlBase(this._getElSize(this.currentImg.img))+" 1x"),this.$$("hi-res-support")&&t.add(this._getUrlBase(this._getElSize(this.currentImg.img,2))+" 2x"),this.$$("ultra-res-support")&&t.add(this._getUrlBase(this._getElSize(this.currentImg.img,3))+" 3x")),[...t].join()}getSrc(){return this._getUrlBase()}get srcUrlPreview(){return this._getUrlBase("100x","100")}renderBackground(){[...document.querySelectorAll(this.bgSelector)].forEach(t=>{this.$$("intersection")?this.initIntersection(t,()=>{this.renderBg(t)}):this.renderBg(t)})}_appendURL({elNode:t,src:e,srcset:s}){e&&(t.src=e),s&&(t.srcset=s)}_setupConfigForImage({elNode:t}){this._setupEventProxy(t),this.initAttributes(t)}loaderImage({src:t,srcset:e,elNode:s}){return new Promise((o,n)=>{this._setupConfigForImage({elNode:s}),s.setAttribute(Kr,""),s.addEventListener("load",()=>{s.removeAttribute(Kr),o(s)}),s.addEventListener("error",()=>{n(!1)}),this._appendURL({elNode:s,src:t,srcset:e})})}async renderImage(){var t,e;if(this.$$("intersection")){this.hasPreviewImage&&(this._setupConfigForImage({elNode:this._imgPreview}),this.appendChild(this._imgPreview)),this.initIntersection(this.currentImg.img,async()=>{var s;this.hasPreviewImage&&(this._imgPreview.src=this.srcUrlPreview);try{await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await this._imgPreview.remove(),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((s=this._imgPreview)==null?void 0:s.remove()),this.appendChild(this._img)}});return}try{this.hasPreviewImage&&(await this.loaderImage({src:this.srcUrlPreview,elNode:this._imgPreview}),this.appendChild(this._imgPreview)),await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await((t=this._imgPreview)==null?void 0:t.remove()),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((e=this._imgPreview)==null?void 0:e.remove()),this.appendChild(this._img)}}init(){this.bgSelector?this.renderBackground():this.renderImage()}};var Qr=class extends Fi{initCallback(){super.initCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",i=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=i?"lazy":"eager")})}};var Ne=class Ne extends S{constructor(){super();u(this,"couldBeCtxOwner",!0);this.init$={...this.init$,withDropZone:!0,onClick:()=>{this.api.initFlow()},"button-text":""}}initCallback(){super.initCallback(),this.defineAccessor("dropzone",t=>{typeof t!="undefined"&&(this.$.withDropZone=L(t))}),this.subConfigValue("multiple",t=>{this.$["button-text"]=t?"upload-files":"upload-file"})}};u(Ne,"styleAttrs",[...q(Ne,Ne,"styleAttrs"),"uc-simple-btn"]);var Be=Ne;Be.template=b`<uc-drop-area set="@disabled: !withDropZone"><button type="button" set="onclick: onClick"><uc-icon name="upload"></uc-icon><span l10n="button-text"></span><slot></slot><div class="uc-visual-drop-area" l10n="drop-files-here"></div></button></uc-drop-area>`;Be.bindAttributes({dropzone:null});var Di=class extends v{constructor(){super(...arguments);u(this,"historyTracked",!0);u(this,"activityType","start-from")}initCallback(){super.initCallback(),this.registerActivity(this.activityType)}};Di.template=b`<div class="uc-content"><slot></slot></div>`;function pa(r){return new Promise(i=>{typeof window.FileReader!="function"&&i(!1);try{let t=new FileReader;t.onerror=()=>{i(!0)};let e=s=>{s.type!=="loadend"&&t.abort(),i(!1)};t.onloadend=e,t.onprogress=e,t.readAsDataURL(r)}catch{i(!1)}})}function fa(r,i){return new Promise(t=>{let e=0,s=[],o=l=>{l||(console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null)),l.isFile?(e++,l.file(a=>{e--;let c=new File([a],a.name,{type:a.type||i});s.push({type:"file",file:c,fullPath:l.fullPath}),e===0&&t(s)})):l.isDirectory&&n(l.createReader())},n=l=>{e++,l.readEntries(a=>{e--;for(let c of a)o(c);e===0&&t(s)})};o(r)})}function jo(r){let i=[],t=[];for(let e=0;e<r.items.length;e++){let s=r.items[e];if(s)if(s.kind==="file"){let o=s.type;if(typeof s.webkitGetAsEntry=="function"||typeof s.getAsEntry=="function"){let l=typeof s.webkitGetAsEntry=="function"?s.webkitGetAsEntry():s.getAsEntry();t.push(fa(l,o).then(a=>{a&&i.push(...a)}));continue}let n=s.getAsFile();n&&t.push(pa(n).then(l=>{l||i.push({type:"file",file:n})}))}else s.kind==="string"&&s.type.match("^text/uri-list")&&t.push(new Promise(o=>{s.getAsString(n=>{i.push({type:"url",url:n}),o(void 0)})}))}return Promise.all(t).then(()=>i)}var W={ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3},Go=["focus"],ma=100,ts=new Map;function ga(r,i){let t=Math.max(Math.min(r[0],i.x+i.width),i.x),e=Math.max(Math.min(r[1],i.y+i.height),i.y);return Math.sqrt((r[0]-t)*(r[0]-t)+(r[1]-e)*(r[1]-e))}function es(r){let i=0,t=document.body,e=new Set,s=m=>e.add(m),o=W.INACTIVE,n=m=>{r.shouldIgnore()&&m!==W.INACTIVE||(o!==m&&e.forEach(y=>y(m)),o=m)},l=()=>i>0;s(m=>r.onChange(m));let a=()=>{i=0,n(W.INACTIVE)},c=()=>{i+=1,o===W.INACTIVE&&n(W.ACTIVE)},d=()=>{i-=1,l()||n(W.INACTIVE)},h=m=>{m.preventDefault(),i=0,n(W.INACTIVE)},p=m=>{if(r.shouldIgnore())return;l()||(i+=1);let y=[m.x,m.y],x=r.element.getBoundingClientRect(),E=Math.floor(ga(y,x)),C=E<ma,A=m.composedPath().includes(r.element);ts.set(r.element,E);let N=Math.min(...ts.values())===E;A&&N?(m.preventDefault(),n(W.OVER)):n(C&&N?W.NEAR:W.ACTIVE)},f=async m=>{if(r.shouldIgnore())return;m.preventDefault();let y=await jo(m.dataTransfer);r.onItems(y),n(W.INACTIVE)};return t.addEventListener("drop",h),t.addEventListener("dragleave",d),t.addEventListener("dragenter",c),t.addEventListener("dragover",p),r.element.addEventListener("drop",f),Go.forEach(m=>{window.addEventListener(m,a)}),()=>{ts.delete(r.element),t.removeEventListener("drop",h),t.removeEventListener("dragleave",d),t.removeEventListener("dragenter",c),t.removeEventListener("dragover",p),r.element.removeEventListener("drop",f),Go.forEach(m=>{window.removeEventListener(m,a)})}}var Xo="uc-drop-area",me=`${Xo}/registry`,ze=class ze extends S{constructor(){super(),this.init$={...this.init$,state:W.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,text:"",[me]:null}}isActive(){if(!this.$.isEnabled)return!1;let i=this.getBoundingClientRect(),t=i.width>0&&i.height>0,e=i.top>=0&&i.left>=0&&i.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&i.right<=(window.innerWidth||document.documentElement.clientWidth),s=window.getComputedStyle(this),o=s.visibility!=="hidden"&&s.display!=="none";return t&&o&&e}initCallback(){super.initCallback(),this.bindL10n("text",()=>this.l10n("drop-files-here")),this.$[me]||(this.$[me]=new Set),this.$[me].add(this),this.defineAccessor("disabled",t=>{this.set$({isEnabled:!L(t)})}),this.defineAccessor("clickable",t=>{this.set$({isClickable:L(t)})}),this.defineAccessor("with-icon",t=>{this.set$({withIcon:L(t)})}),this.defineAccessor("fullscreen",t=>{this.set$({isFullscreen:L(t)})}),this.defineAccessor("text",t=>{typeof t=="string"?this.bindL10n("text",()=>this.l10n(t)||t):this.bindL10n("text",()=>this.l10n("drop-files-here"))}),this._destroyDropzone=es({element:this,shouldIgnore:()=>this._shouldIgnore(),onChange:t=>{this.$.state=t},onItems:t=>{t.length&&(t.forEach(e=>{e.type==="url"?this.api.addFileFromUrl(e.url,{source:Q.DROP_AREA}):e.type==="file"&&this.api.addFileFromObject(e.file,{source:Q.DROP_AREA,fullPath:e.fullPath})}),this.uploadCollection.size&&(this.set$({"*currentActivity":v.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0)))}});let i=this.ref["content-wrapper"];i&&(this._destroyContentWrapperDropzone=es({element:i,onChange:t=>{var s;let e=(s=Object.entries(W).find(([,o])=>o===t))==null?void 0:s[0].toLowerCase();e&&i.setAttribute("drag-state",e)},onItems:()=>{},shouldIgnore:()=>this._shouldIgnore()})),this.sub("state",t=>{var s;let e=(s=Object.entries(W).find(([,o])=>o===t))==null?void 0:s[0].toLowerCase();e&&this.setAttribute("drag-state",e)}),this.subConfigValue("sourceList",t=>{let e=G(t);this.$.isEnabled=e.includes(S.sourceTypes.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",t=>{this.toggleAttribute("hidden",!t)}),this.sub("isClickable",t=>{this.toggleAttribute("clickable",t)}),this.$.isClickable&&(this._onAreaClicked=t=>{t.type==="keydown"?(t.code==="Space"||t.code==="Enter")&&this.api.openSystemDialog():t.type==="click"&&this.api.openSystemDialog()},this.addEventListener("keydown",this._onAreaClicked),this.addEventListener("click",this._onAreaClicked))}_shouldIgnore(){return!this.$.isEnabled||!this._couldHandleFiles()?!0:this.$.isFullscreen?[...this.$[me]].filter(e=>e!==this).filter(e=>e.isActive()).length>0:!1}_couldHandleFiles(){let i=this.cfg.multiple,t=this.cfg.multipleMax,e=this.uploadCollection.size;return!(i&&t&&e>=t||!i&&e>0)}destroyCallback(){var t,e;super.destroyCallback();let i=this.$[me];i&&(i.delete(this),i.size===0&&$.deleteCtx(Xo)),(t=this._destroyDropzone)==null||t.call(this),(e=this._destroyContentWrapperDropzone)==null||e.call(this),this._onAreaClicked&&(this.removeEventListener("keydown",this._onAreaClicked),this.removeEventListener("click",this._onAreaClicked))}};u(ze,"styleAttrs",[...q(ze,ze,"styleAttrs"),"uc-drop-area"]);var Ve=ze;Ve.template=b`<slot><div data-default-slot hidden></div><div ref="content-wrapper" class="uc-content-wrapper" set="@hidden: !isVisible"><div class="uc-icon-container" set="@hidden: !withIcon"><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">{{text}}</span></div></slot>`;Ve.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null});var ba="src-type-",He=class extends S{constructor(){super();u(this,"couldBeCtxOwner",!0);u(this,"type");u(this,"_registeredTypes",{});this.init$={...this.init$,iconName:"default","src-type":""}}initTypes(){this.registerType({type:S.sourceTypes.LOCAL,activate:()=>(this.api.openSystemDialog(),!1)}),this.registerType({type:S.sourceTypes.URL,activity:v.activities.URL,textKey:"from-url"}),this.registerType({type:S.sourceTypes.CAMERA,activity:v.activities.CAMERA,activate:()=>{let t="capture"in document.createElement("input");return t&&this.api.openSystemDialog({captureCamera:!0}),!t}}),this.registerType({type:"draw",activity:v.activities.DRAW,icon:"edit-draw"});for(let t of Object.values(S.extSrcList))this.registerType({type:t,activity:v.activities.EXTERNAL,activityParams:{externalSourceType:t}})}initCallback(){super.initCallback(),this.initTypes(),this.defineAccessor("type",t=>{t&&this.applyType(t)})}registerType(t){this._registeredTypes[t.type]=t}getType(t){return this._registeredTypes[t]}activate(){if(!this.type)return;let t=this._registeredTypes[this.type],{activity:e,activate:s,activityParams:o={}}=t;(s?s():!!e)&&this.set$({"*currentActivityParams":o,"*currentActivity":e})}applyType(t){let e=this._registeredTypes[t];if(!e){console.warn("Unsupported source type: "+t);return}let{textKey:s=t,icon:o=t}=e;this.$["src-type"]=`${ba}${s}`,this.$.iconName=o,this.onclick=()=>{this.activate()}}};He.template=b`<button type="button"><uc-icon set="@name: iconName"></uc-icon><div class="uc-txt" l10n="src-type"></div></button>`;He.bindAttributes({type:null});var is=class extends w{initCallback(){super.initCallback(),this.subConfigValue("sourceList",i=>{let t=G(i),e="";t.forEach(s=>{e+=b`<uc-source-btn type="${s}"></uc-source-btn>`}),this.cfg.sourceListWrap?this.innerHTML=e:this.outerHTML=e})}};var Bi=()=>{let r=[];return{stack:r,promiseReadJpegChunks:t=>new Promise((e,s)=>{let o=2,n=(c,d)=>{let h=new FileReader;h.addEventListener("load",()=>{d(new DataView(h.result))}),h.addEventListener("error",p=>{s(`Reader error: ${p}`)}),h.readAsArrayBuffer(c)},l=()=>n(t.slice(o,o+128),c=>{let d,h,p;for(d=h=0,p=c.byteLength;p>=0?h<p:h>p;d=p>=0?++h:--h)if(c.getUint8(d)===255){o+=d;break}a()}),a=()=>{let c=o;return n(t.slice(o,o+=4),d=>{if(d.byteLength!==4||d.getUint8(0)!==255){s("Corrupted");return}let h=d.getUint8(1);if(h===218){e(!0);return}let p=d.getUint16(2)-2;return n(t.slice(o,o+=p),f=>{if(f.byteLength!==p){s("Corrupted");return}r.push({startPos:c,length:p,marker:h,view:f}),l()})})};FileReader&&DataView||s("Not Support"),n(t.slice(0,2),c=>{c.getUint16(0)!==65496&&s("Not jpeg"),l()})})}},ya=async r=>{let i=[],{promiseReadJpegChunks:t,stack:e}=Bi();return await t(r),e.forEach(({marker:s,view:o})=>{s===226&&o.getUint32(0)===1229144927&&o.getUint32(4)===1347571526&&o.getUint32(8)===1229735168&&i.push(o)}),i},Ko=async(r,i,t)=>{{let e=[],s=[],{promiseReadJpegChunks:o,stack:n}=Bi();await o(r),n.forEach(c=>{if(c.marker===i)return e.push(c.startPos),s.push(c.length)});let l=[r.slice(0,2)];for(let c of t){let d=new DataView(new ArrayBuffer(4));d.setUint16(0,65280+i),d.setUint16(2,c.byteLength+2),l.push(d.buffer),l.push(c)}let a=2;for(let c=0;c<e.length;c++)e[c]>a&&l.push(r.slice(a,e[c])),a=e[c]+s[c]+4;return l.push(r.slice(a,r.size)),new Blob(l,{type:r.type})}};var qo=(r,i)=>Ko(r,226,i.map(t=>t.buffer)),_a=async r=>{try{return await qo(r,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},va=(r,i,t)=>new Promise((e,s)=>{let o=n=>{if(!n){s("Failed to convert canvas to blob");return}e(n)};r.toBlob(o,i,t),r.width=r.height=1}),je=()=>{let r=document.createElement("canvas"),i=r.getContext("2d");return{canvas:r,ctx:i}},wa=r=>{let{ctx:t,canvas:e}=je();e.width=e.height=50,t.drawImage(r,0,0,50,50);let s=t.getImageData(0,0,50,50).data;e.width=e.height=1;for(let o=3;o<s.length;o+=4)if(s[o]<254)return!0;return!1},Ca=async r=>{let i=null,{promiseReadJpegChunks:t,stack:e}=Bi();return await t(r),e.forEach(({marker:s,view:o})=>{if(!i&&s===225&&o.byteLength>=14&&o.getUint32(0)===1165519206&&o.getUint16(4)===0){i=o;return}}),i},xa="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",Ni,Ea=()=>new Promise(r=>{if(Ni!==void 0)r(Ni);else{let i=new Image;i.addEventListener("load",()=>{Ni=i.naturalWidth<i.naturalHeight,i.src="//:0",r(Ni)}),i.src=xa}}),Aa=(r,i)=>{let t,e,s,o;if(!r||r.byteLength<14||r.getUint32(0)!==1165519206||r.getUint16(4)!==0)return;if(r.getUint16(6)===18761)e=!0;else if(r.getUint16(6)===19789)e=!1;else return;if(r.getUint16(8,e)!==42)return;s=8+r.getUint32(10,e);let n=r.getUint16(s-2,e);for(t=0,o=n;o>=0?t<o:t>o;o>=0?++t:--t){if(r.byteLength<s+10)return;r.getUint16(s,e)===274&&i(s+8,e),s+=12}},Ta=(r,i)=>{Aa(r,(t,e)=>r.setUint16(t,i,e))},Sa=async(r,i,t)=>(t&&Ta(i,1),Ko(r,225,[i.buffer])),ka=(r,i)=>new Promise((t,e)=>{i&&(r.src=i),r.complete?t(r):(r.addEventListener("load",()=>{t(r)}),r.addEventListener("error",()=>{e(new Error("Failed to load image. Probably not an image."))}))}),$a=r=>ka(new Image,r),Ia=[1,3],Oa=[192,193,194,195,197,198,199,201,202,203,205,206,207],Wo={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},La=async r=>{let i=!1,{promiseReadJpegChunks:t,stack:e}=Bi();return await t(r).then(()=>(e.forEach(({marker:s,view:o})=>{if(!i&&Oa.indexOf(s)>=0){let n=o.getUint8(5);Ia.indexOf(n)<0&&(i=!0)}}),i)).catch(()=>i)},Zo=(r,i)=>{let t={};return(...e)=>{let s=i(e,t);return s in t?t[s]:t[s]=r(...e)}},Yo=(r,i)=>{let[t]=r,e=Object.keys(i).map(s=>parseInt(s,10)).sort((s,o)=>s-o);for(let s=0;s<e.length;s++){let o=e[s],n=!!i[o];if(o>t&&n||o<t&&!n)return o}return t},zt={R:55,G:110,B:165,A:255},Ua=`rgba(${zt.R}, ${zt.G}, ${zt.B}, ${zt.A/255})`,Jo=(r,i)=>{try{let t=[r-1,i-1,1,1],{canvas:e,ctx:s}=je();e.width=1,e.height=1;let{canvas:o,ctx:n}=je();o.width=r,o.height=i,n&&(n.fillStyle=Ua,n.fillRect(...t),s.drawImage(o,r-1,i-1,1,1,0,0,1,1));let l=s&&s.getImageData(0,0,1,1).data,a=!1;return l&&(a=l[0]===zt.R&&l[1]===zt.G&&l[2]===zt.B&&l[3]===zt.A),o.width=o.height=1,a}catch{return console.error(`Failed to test for max canvas size of ${r}x${i}.`),!1}};function Qo(r){return(...i)=>new Promise(t=>{setTimeout(()=>{let e=r(...i);t(e)},0)})}var Ma=Qo(Zo(Jo,Yo)),Pa=Qo(Zo(Jo,Yo)),tn=async(r,i)=>{let t=Wo.squareSide.find(n=>n*n>=r*i),e=Wo.dimension.find(n=>n>=r&&n>=i);if(!t||!e)throw new Error("Not supported");let[s,o]=await Promise.all([Ma(t,t),Pa(e,1)]);if(s&&o)return!0;throw new Error("Not supported")},en=async(r,i,t)=>{try{let{ctx:e,canvas:s}=je();return s.width=i,s.height=t,e.imageSmoothingQuality="high",e.drawImage(r,0,0,i,t),r instanceof HTMLImageElement&&(r.src="//:0"),r instanceof HTMLCanvasElement&&(r.width=r.height=1),s}catch(e){throw new Error("Canvas resize error",{cause:e})}},Ra=({img:r,targetW:i,targetH:t})=>en(r,i,t),Fa=function({sourceW:r,targetW:i,targetH:t,step:e}){let s=[],o=i,n=t;do s.push([o,n]),o=Math.round(o/e),n=Math.round(n/e);while(o<r*e);return s.reverse()},Da=({img:r,sourceW:i,targetW:t,targetH:e,step:s})=>Fa({sourceW:i,targetW:t,targetH:e,step:s}).reduce((n,[l,a])=>n.then(c=>tn(l,a).then(()=>en(c,l,a)).catch(()=>c)),Promise.resolve(r)),Na=()=>/iPad|iPhone|iPod/.test(navigator.platform)?!0:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),Ba=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),rs=.71,za=(r,i)=>{if(r.width*rs*r.height*rs<i.size)throw new Error("Not required");let t=r.width,e=r.height,s=t/e,o=Math.floor(Math.sqrt(i.size*s)),n=Math.floor(i.size/Math.sqrt(i.size*s));return tn(o,n).then(()=>{let{ctx:l}=je();return"imageSmoothingQuality"in l&&!Na()&&!Ba?Ra({img:r,targetW:o,targetH:n}):Da({img:r,sourceW:t,targetW:o,targetH:n,step:rs})}).catch(()=>Promise.reject("Not supported"))},rn=async(r,i)=>{try{if(await La(r))throw new Error("Should skipped");let e=await Promise.allSettled([Ca(r),Ea(),ya(r)]),o=!e.some(y=>y.status==="rejected"),[n,l,a]=e,c=await _a(r).catch(()=>r),d=await $a(URL.createObjectURL(c));URL.revokeObjectURL(d.src);let h=await za(d,i),p="image/jpeg",f=(i==null?void 0:i.quality)||.8;!o&&wa(h)&&(p="image/png",f=void 0);let m=await va(h,p,f);if(o&&n.status==="fulfilled"&&n.value){let y=n.value,x=l.status==="fulfilled"?l.value:!1;m=await Sa(m,y,x)}return o&&a.status==="fulfilled"&&a.value.length>0&&(m=await qo(m,a.value)),m}catch(t){let e;throw t instanceof Error&&(e=t.message),typeof t=="string"&&(e=t),new Error(`Failed to shrink image. ${e?`Message: "${e}".`:""}`,{cause:t})}};function Va(r){let i=new Blob([r],{type:"image/svg+xml"});return URL.createObjectURL(i)}function ss(r="hsl(209, 21%, 65%)",i=32,t=32){return Va(`<svg width="${i}" height="${t}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${r}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`)}function sn(r,i=40){if(r.type==="image/svg+xml")return URL.createObjectURL(r);let t=document.createElement("canvas"),e=t.getContext("2d"),s=new Image,o=new Promise((n,l)=>{s.onload=()=>{let a=s.height/s.width;a>1?(t.width=i,t.height=i*a):(t.height=i,t.width=i/a),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(s,0,0,t.width,t.height),t.toBlob(c=>{if(!c){l();return}let d=URL.createObjectURL(c);n(d)})},s.onerror=a=>{l(a)}});return s.src=URL.createObjectURL(r),o}var Ha=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,on=r=>{let i=Ha.exec(r==null?void 0:r.toLocaleLowerCase())||[];if(!i.length)return!1;let t=i[1]*i[2],e=16384*16384;return t>e?(console.warn(`Shrinked size can not be larger than ${Math.floor(e/1e3/1e3)}MP. You have set ${i[1]}x${i[2]} (${Math.ceil(t/1e3/100)/10}MP).`),!1):{quality:i[3]?i[3]/100:void 0,size:t}};var st=Object.freeze({FINISHED:Symbol("FINISHED"),FAILED:Symbol("FAILED"),UPLOADING:Symbol("UPLOADING"),IDLE:Symbol("IDLE")}),Ge=class r extends S{constructor(){super();u(this,"couldBeCtxOwner",!0);u(this,"pauseRender",!0);u(this,"_entrySubs",new Set);u(this,"_entry",null);u(this,"_isIntersecting",!1);u(this,"_debouncedGenerateThumb",M(this._generateThumbnail.bind(this),100));u(this,"_debouncedCalculateState",M(this._calculateState.bind(this),100));u(this,"_renderedOnce",!1);this.init$={...this.init$,uid:"",itemName:"",errorText:"",thumbUrl:"",progressValue:0,progressVisible:!1,badgeIcon:"",isFinished:!1,isFailed:!1,isUploading:!1,isFocused:!1,isEditable:!1,state:st.IDLE,ariaLabelStatusFile:"",onEdit:()=>{this.$["*currentActivityParams"]={internalId:this._entry.uid},this.$["*currentActivity"]=v.activities.CLOUD_IMG_EDIT},onRemove:()=>{this.uploadCollection.remove(this.$.uid)},onUpload:()=>{this.upload()}}}_reset(){for(let t of this._entrySubs)t.remove();this._debouncedGenerateThumb.cancel(),this._debouncedCalculateState.cancel(),this._entrySubs=new Set,this._entry=null}_observerCallback(t){let[e]=t;this._isIntersecting=e.isIntersecting,e.isIntersecting&&!this._renderedOnce&&(this.render(),this._renderedOnce=!0),e.intersectionRatio===0?this._debouncedGenerateThumb.cancel():this._debouncedGenerateThumb()}_calculateState(){if(!this._entry)return;let t=this._entry,e=st.IDLE;t.getValue("errors").length>0?e=st.FAILED:t.getValue("isUploading")?e=st.UPLOADING:t.getValue("fileInfo")&&(e=st.FINISHED),this.$.state=e}async _generateThumbnail(){var e;if(!this._entry)return;let t=this._entry;if(t.getValue("fileInfo")&&t.getValue("isImage")){let s=this.cfg.thumbSize,o=await this.proxyUrl(R(Pt(this.cfg.cdnCname,this._entry.getValue("uuid")),j(t.getValue("cdnUrlModifiers"),`scale_crop/${s}x${s}/center`))),n=t.getValue("thumbUrl");n!==o&&(t.setValue("thumbUrl",o),n!=null&&n.startsWith("blob:")&&URL.revokeObjectURL(n));return}if(!t.getValue("thumbUrl"))if((e=t.getValue("file"))!=null&&e.type.includes("image"))try{let s=await sn(t.getValue("file"),this.cfg.thumbSize);t.setValue("thumbUrl",s)}catch{let o=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",ss(o))}else{let s=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",ss(s))}}_subEntry(t,e){let s=this._entry.subscribe(t,o=>{this.isConnected&&e(o)});this._entrySubs.add(s)}_handleEntryId(t){var s;this._reset();let e=(s=this.uploadCollection)==null?void 0:s.read(t);this._entry=e,e&&(this._subEntry("uploadProgress",o=>{this.$.progressValue=o}),this._subEntry("fileName",o=>{this.$.itemName=o||e.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState()}),this._subEntry("externalUrl",o=>{this.$.itemName=e.getValue("fileName")||o||this.l10n("file-no-name")}),this._subEntry("fileInfo",o=>{this._debouncedCalculateState(),o&&this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("cdnUrlModifiers",()=>{this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("thumbUrl",o=>{this.$.thumbUrl=o?`url(${o})`:""}),this._subEntry("errors",()=>this._debouncedCalculateState()),this._subEntry("isUploading",()=>this._debouncedCalculateState()),this._subEntry("fileSize",()=>this._debouncedCalculateState()),this._subEntry("mimeType",()=>this._debouncedCalculateState()),this._subEntry("isImage",()=>this._debouncedCalculateState()),this._isIntersecting&&this._debouncedGenerateThumb())}initCallback(){super.initCallback(),this.sub("uid",t=>{this._handleEntryId(t)}),this.sub("state",t=>{this._handleState(t)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.onclick=()=>{r.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused")})},this.sub("*uploadTrigger",t=>{t.has(this._entry.uid)&&setTimeout(()=>this.isConnected&&this.upload())}),r.activeInstances.add(this)}_handleState(t){var e,s,o,n,l,a,c,d;t===st.FAILED?this.$.badgeIcon="badge-error":t===st.FINISHED&&(this.$.badgeIcon="badge-success"),t===st.UPLOADING?this.$.isFocused=!1:this.$.progressValue=0,this.set$({isFailed:t===st.FAILED,isUploading:t===st.UPLOADING,isFinished:t===st.FINISHED,progressVisible:t===st.UPLOADING,isEditable:this.cfg.useCloudImageEditor&&((e=this._entry)==null?void 0:e.getValue("isImage"))&&((s=this._entry)==null?void 0:s.getValue("cdnUrl")),errorText:(l=(n=(o=this._entry.getValue("errors"))==null?void 0:o[0])==null?void 0:n.message)!=null?l:"",ariaLabelStatusFile:this.l10n("a11y-file-item-status",{fileName:(a=this._entry)==null?void 0:a.getValue("fileName"),status:this.l10n((d=(c=t==null?void 0:t.description)==null?void 0:c.toLocaleLowerCase())!=null?d:"").toLocaleLowerCase()})})}destroyCallback(){super.destroyCallback(),r.activeInstances.delete(this),this._reset()}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]}),this._observer.observe(this)}disconnectedCallback(){var t;super.disconnectedCallback(),this._debouncedGenerateThumb.cancel(),(t=this._observer)==null||t.disconnect()}_settingsOfShrink(){return on(this.cfg.imageShrink)}_processShrink(t){return rn(t,this._settingsOfShrink())}async upload(){var s,o,n,l,a;let t=this._entry;if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("errors").length>0)return;let e=this.cfg.multiple?this.cfg.multipleMax:1;if(!(e&&this.uploadCollection.size>e)){this._debouncedCalculateState(),t.setValue("isUploading",!0),t.setValue("errors",[]);try{let c=new AbortController;t.setValue("abortController",c);let d=async()=>{let p=t.getValue("file");p&&this.cfg.imageShrink&&(p=await this._processShrink(p).catch(()=>p));let f=p||t.getValue("externalUrl")||t.getValue("uuid"),y={...await this.getUploadClientOptions(),fileName:t.getValue("fileName"),source:t.getValue("source"),onProgress:x=>{if(x.isComputable){let E=x.value*100;t.setValue("uploadProgress",E)}},signal:c.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",f,y),Or(f,y)},h=await this.$["*uploadQueue"].add(d);t.setMultipleValues({fileInfo:h,isUploading:!1,fileName:h.originalFilename,fileSize:h.size,isImage:h.isImage,mimeType:(n=(o=(s=h.contentInfo)==null?void 0:s.mime)==null?void 0:o.mime)!=null?n:h.mimeType,uuid:h.uuid,cdnUrl:(l=t.getValue("cdnUrl"))!=null?l:h.cdnUrl,cdnUrlModifiers:(a=t.getValue("cdnUrlModifiers"))!=null?a:"",uploadProgress:100}),t===this._entry&&this._debouncedCalculateState()}catch(c){c instanceof Ft&&c.isCancel?t.setMultipleValues({isUploading:!1,uploadProgress:0}):t.setMultipleValues({isUploading:!1,uploadProgress:0,uploadError:c}),t===this._entry&&this._debouncedCalculateState()}}}};Ge.template=b`<div class="uc-inner" set="@finished: isFinished; @uploading: isUploading; @failed: isFailed; @focused: isFocused"><div class="uc-thumb" set="style.backgroundImage: thumbUrl"><div class="uc-badge"><uc-icon set="@name: badgeIcon"></uc-icon></div></div><div aria-live="polite" class="uc-file-name-wrapper" set="@aria-label:ariaLabelStatusFile;"><span class="uc-file-name" set="@title: itemName">{{itemName}}</span><span class="uc-file-error" set="@hidden: !errorText">{{errorText}}</span></div><div class="uc-file-actions"><button type="button" l10n="@title:file-item-edit-button" class="uc-edit-btn uc-mini-btn" set="onclick: onEdit; @hidden: !isEditable" ><uc-icon name="edit-file"></uc-icon></button><button type="button" l10n="@title:file-item-remove-button" class="uc-remove-btn uc-mini-btn" set="onclick: onRemove;" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" set="onclick: onUpload;"><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" set="value: progressValue; visible: progressVisible;"></uc-progress-bar></div>`;Ge.activeInstances=new Set;var ge=class ge extends w{constructor(){super();u(this,"_handleBackdropClick",()=>{this._closeDialog()});u(this,"_closeDialog",()=>{this.setOrAddState("*modalActive",!1)});u(this,"_handleDialogClose",()=>{this._closeDialog()});u(this,"_handleDialogMouseDown",t=>{this._mouseDownTarget=t.target});u(this,"_handleDialogMouseUp",t=>{t.target===this.ref.dialog&&t.target===this._mouseDownTarget&&this._closeDialog()});this.init$={...this.init$,"*modalActive":!1,isOpen:!1,closeClicked:this._handleDialogClose}}show(){this.ref.dialog.showModal?this.ref.dialog.showModal():this.ref.dialog.setAttribute("open","")}hide(){this.ref.dialog.close?this.ref.dialog.close():this.ref.dialog.removeAttribute("open")}initCallback(){if(super.initCallback(),typeof HTMLDialogElement=="function")this.ref.dialog.addEventListener("close",this._handleDialogClose),this.ref.dialog.addEventListener("mousedown",this._handleDialogMouseDown),this.ref.dialog.addEventListener("mouseup",this._handleDialogMouseUp);else{this.setAttribute("dialog-fallback","");let t=document.createElement("div");t.className="uc-backdrop",this.appendChild(t),t.addEventListener("click",this._handleBackdropClick)}this.sub("*modalActive",t=>{this.$.isOpen!==t&&(this.$.isOpen=t),t&&this.cfg.modalScrollLock?document.body.style.overflow="hidden":document.body.style.overflow=""}),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes")}),this.sub("isOpen",t=>{t?(this.show(),this.setAttribute("aria-modal","true")):(this.hide(),this.setAttribute("aria-modal","false"))})}destroyCallback(){super.destroyCallback(),document.body.style.overflow="",this._mouseDownTarget=void 0,this.ref.dialog.removeEventListener("close",this._handleDialogClose),this.ref.dialog.removeEventListener("mousedown",this._handleDialogMouseDown),this.ref.dialog.removeEventListener("mouseup",this._handleDialogMouseUp)}};u(ge,"styleAttrs",[...q(ge,ge,"styleAttrs"),"uc-modal"]),u(ge,"StateConsumerScope","modal");var zi=ge;zi.template=b`<dialog ref="dialog"><slot></slot></dialog>`;var Vi=(r,i)=>{let t,e,s,o=(...n)=>{t?(clearTimeout(e),e=setTimeout(()=>{Date.now()-s>=i&&(r(...n),s=Date.now())},Math.max(i-(Date.now()-s),0))):(r(...n),s=Date.now(),t=!0)};return Object.defineProperty(o,"cancel",{configurable:!1,writable:!1,enumerable:!1,value:()=>{clearTimeout(e)}}),o};var Hi=class extends S{constructor(){super();u(this,"couldBeCtxOwner",!0);u(this,"historyTracked",!0);u(this,"activityType",v.activities.UPLOAD_LIST);u(this,"_throttledHandleCollectionUpdate",Vi(()=>{this.isConnected&&(this._updateUploadsState(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack())},300));this.init$={...this.init$,doneBtnVisible:!1,doneBtnEnabled:!1,uploadBtnVisible:!1,addMoreBtnVisible:!1,addMoreBtnEnabled:!1,headerText:"",commonErrorMessage:"",hasFiles:!1,onAdd:()=>{this.api.initFlow(!0)},onUpload:()=>{this.emit(I.UPLOAD_CLICK),this.api.uploadAll(),this._throttledHandleCollectionUpdate()},onDone:()=>{this.emit(I.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow()},onCancel:()=>{this.uploadCollection.clearAll()}}}_updateUploadsState(){let t=this.api.getOutputCollectionState(),e={total:t.totalCount,succeed:t.successCount,uploading:t.uploadingCount,failed:t.failedCount},s=!t.errors.some(p=>p.type==="TOO_MANY_FILES"||p.type==="TOO_FEW_FILES"),o=t.errors.some(p=>p.type==="TOO_MANY_FILES"),n=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),l=e.failed===0&&t.errors.length===0,a=!1,c=!1,d=!1;if(e.total-e.succeed-e.uploading-e.failed>0&&s)a=!0;else{c=!0;let p=this.cfg.groupOutput?!!t.group:!0;d=e.total===e.succeed&&s&&l&&p}this.set$({doneBtnVisible:c,doneBtnEnabled:d,uploadBtnVisible:a,addMoreBtnEnabled:e.total===0||!o&&!n,addMoreBtnVisible:!n||this.cfg.multiple}),this.bindL10n("headerText",()=>this._getHeaderText(e))}_getHeaderText(t){let e=s=>{let o=t[s];return this.l10n(`header-${s}`,{count:o})};return t.uploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this._throttledHandleCollectionUpdate),this.subConfigValue("multipleMin",this._throttledHandleCollectionUpdate),this.subConfigValue("multipleMax",this._throttledHandleCollectionUpdate),this.sub("*groupInfo",t=>{t&&this._throttledHandleCollectionUpdate()}),this.sub("*currentActivity",t=>{!this.couldOpenActivity&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observeProperties(this._throttledHandleCollectionUpdate),this.sub("*uploadList",t=>{this._throttledHandleCollectionUpdate(),this.set$({hasFiles:t.length>0}),this.cfg.confirmUpload||this.api.uploadAll()},!1),this.sub("*collectionErrors",t=>{let e=t.filter(s=>s.type!=="SOME_FILES_HAS_ERRORS")[0];if(!e){this.set$({commonErrorMessage:null});return}this.set$({commonErrorMessage:e.message})})}destroyCallback(){super.destroyCallback(),this.uploadCollection.unobserveProperties(this._throttledHandleCollectionUpdate)}};Hi.template=b`<uc-activity-header><span aria-live="polite" class="uc-header-text">{{headerText}}</span><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal" l10n="@title:a11y-activity-header-button-close" ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" set="@hidden: hasFiles"><slot name="empty"><span l10n="no-files"></span></slot></div><div class="uc-files" itemize="*uploadList" item-tag="uc-file-item"></div><div class="uc-common-error" set="@hidden: !commonErrorMessage; textContent: commonErrorMessage;"></div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" set="onclick: onCancel;" l10n="clear"></button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" set="onclick: onAdd; @disabled: !addMoreBtnEnabled; @hidden: !addMoreBtnVisible" ><uc-icon name="add"></uc-icon><span l10n="add-more"></span></button><button type="button" class="uc-upload-btn uc-primary-btn" set="@hidden: !uploadBtnVisible; onclick: onUpload;" l10n="upload" ></button><button type="button" class="uc-done-btn uc-primary-btn" set="@hidden: !doneBtnVisible; onclick: onDone; @disabled: !doneBtnEnabled" l10n="done" ></button></div><uc-drop-area ghost></uc-drop-area>`;var ji=class extends S{constructor(){super(...arguments);u(this,"couldBeCtxOwner",!0);u(this,"activityType",v.activities.URL);u(this,"init$",{...this.init$,importDisabled:!0,onUpload:t=>{t.preventDefault();let e=this.ref.input.value;this.api.addFileFromUrl(e,{source:Q.URL_TAB}),this.$["*currentActivity"]=v.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()},onInput:t=>{let e=t.target.value;this.set$({importDisabled:!e})}})}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{this.ref.input.value="",this.ref.input.focus()}})}};ji.template=b`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack"><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span l10n="caption-from-url"></span></div><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal"><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content"><input placeholder="https://" class="uc-url-input" type="text" ref="input" set="oninput: onInput" /><button type="submit" class="uc-url-upload-btn uc-primary-btn" set="onclick: onUpload; @disabled: importDisabled" l10n="upload-url" ></button></form>`;var os=()=>typeof navigator.permissions!="undefined";var Gi=class extends S{constructor(){super(...arguments);u(this,"couldBeCtxOwner",!0);u(this,"activityType",v.activities.CAMERA);u(this,"_unsubPermissions",null);u(this,"init$",{...this.init$,video:null,videoTransformCss:null,shotBtnDisabled:!0,videoHidden:!0,messageHidden:!0,requestBtnHidden:os(),cameraSelectOptions:null,cameraSelectHidden:!0,l10nMessage:"",onCameraSelectChange:t=>{this._selectedCameraId=t.target.value,this._capture()},onCancel:()=>{this.historyBack()},onShot:()=>{this._shot()},onRequestPermissions:()=>{this._capture()}});u(this,"_onActivate",()=>{os()&&this._subscribePermissions(),this._capture()});u(this,"_onDeactivate",()=>{this._unsubPermissions&&this._unsubPermissions(),this._stopCapture()});u(this,"_handlePermissionsChange",()=>{this._capture()});u(this,"_setPermissionsState",M(t=>{this.classList.toggle("uc-initialized",t==="granted"),t==="granted"?this.set$({videoHidden:!1,shotBtnDisabled:!1,messageHidden:!0}):t==="prompt"?(this.$.l10nMessage="camera-permissions-prompt",this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture()):(this.$.l10nMessage="camera-permissions-denied",this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture())},300))}async _subscribePermissions(){try{(await navigator.permissions.query({name:"camera"})).addEventListener("change",this._handlePermissionsChange)}catch(t){console.log("Failed to use permissions API. Fallback to manual request mode.",t),this._capture()}}async _capture(){let t={video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1};this._selectedCameraId&&(t.video.deviceId={exact:this._selectedCameraId}),this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d");try{this._setPermissionsState("prompt");let e=await navigator.mediaDevices.getUserMedia(t);e.addEventListener("inactive",()=>{this._setPermissionsState("denied")}),this.$.video=e,this._capturing=!0,this._setPermissionsState("granted")}catch(e){this._setPermissionsState("denied"),console.error("Failed to capture camera",e)}}_stopCapture(){var t;this._capturing&&((t=this.$.video)==null||t.getTracks()[0].stop(),this.$.video=null,this._capturing=!1)}_shot(){this._canvas.height=this.ref.video.videoHeight,this._canvas.width=this.ref.video.videoWidth,this._ctx.drawImage(this.ref.video,0,0);let t=Date.now(),e=`camera-${t}.jpeg`,s="image/jpeg";this._canvas.toBlob(o=>{let n=new File([o],e,{lastModified:t,type:s});this.api.addFileFromObject(n,{source:Q.CAMERA}),this.set$({"*currentActivity":v.activities.UPLOAD_LIST})},s)}async initCallback(){var t;super.initCallback(),this.registerActivity(this.activityType,{onActivate:this._onActivate,onDeactivate:this._onDeactivate}),this.subConfigValue("cameraMirror",e=>{this.$.videoTransformCss=e?"scaleX(-1)":null});try{let s=(await navigator.mediaDevices.enumerateDevices()).filter(o=>o.kind==="videoinput").map((o,n)=>({text:o.label.trim()||`${this.l10n("caption-camera")} ${n+1}`,value:o.deviceId}));s.length>1&&(this.$.cameraSelectOptions=s,this.$.cameraSelectHidden=!1),this._selectedCameraId=(t=s[0])==null?void 0:t.value}catch{}}};Gi.template=b`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack"><uc-icon name="back"></uc-icon></button><div set="@hidden: !cameraSelectHidden"><uc-icon name="camera"></uc-icon><span l10n="caption-camera"></span></div><uc-select class="uc-camera-select" set="options: cameraSelectOptions; @hidden: cameraSelectHidden; onchange: onCameraSelectChange" ></uc-select><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal"><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><video autoplay playsinline set="srcObject: video; style.transform: videoTransformCss; @hidden: videoHidden" ref="video" ></video><div class="uc-message-box" set="@hidden: messageHidden"><span l10n="l10nMessage"></span><button type="button" set="onclick: onRequestPermissions; @hidden: requestBtnHidden" l10n="camera-permissions-request" ></button></div><button type="button" class="uc-shot-btn" set="onclick: onShot; @disabled: shotBtnDisabled"><uc-icon name="camera"></uc-icon></button></div>`;var Xi=class extends S{constructor(){super(...arguments);u(this,"requireCtxName",!0)}initCallback(){super.initCallback(),this.$["*eventEmitter"].bindTarget(this)}destroyCallback(){super.destroyCallback(),this.$["*eventEmitter"].unbindTarget(this)}};Xi.EventType=I;var ja=Xi;var Wi=class extends S{constructor(){super(...arguments);u(this,"init$",{...this.init$,visible:!1,value:0,"*commonProgress":0})}initCallback(){super.initCallback(),this._unobserveCollection=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e).getValue("isUploading"));this.$.visible=t}),this.sub("visible",t=>{t?this.setAttribute("active",""):this.removeAttribute("active")}),this.sub("*commonProgress",t=>{this.$.value=t})}destroyCallback(){var t;super.destroyCallback(),(t=this._unobserveCollection)==null||t.call(this)}};Wi.template=b`<uc-progress-bar set="visible: visible; value: value"></uc-progress-bar>`;var Ki=class extends w{constructor(){super(...arguments);u(this,"_value",0);u(this,"init$",{...this.init$,width:0,opacity:0})}initCallback(){super.initCallback(),this.defineAccessor("value",t=>{if(t===void 0)return;let e=this._value;if(this._value=t,t===0&&e>0){this.ref.line.addEventListener("transitionend",()=>{this.style.setProperty("--l-width",this._value.toString())});return}this.style.setProperty("--l-width",this._value.toString())}),this.defineAccessor("visible",t=>{this.ref.line.classList.toggle("uc-progress--hidden",!t)})}};Ki.template=b`<div ref="line" class="uc-progress"></div>`;var bt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function nn(...r){return r.reduce((i,t)=>{if(typeof t=="string")return i[t]=!0,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}function V(...r){let i=nn(...r);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}function ln(r,...i){let t=nn(...i);for(let e of Object.keys(t))r.classList.toggle(e,t[e])}var an=r=>{if(!r)return Z;let i=Ps(r).filter(t=>Z.includes(t));return i.length===0?Z:i};function cn(r){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*tabList":Z,"*tabId":U.CROP,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:bt,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:se(Z),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":()=>{let i=r.querySelectorAll("img");for(let t of i){let e=t.src;t.src=bt,t.src=e}r.$["*networkProblems"]=!1},"*on.apply":i=>{if(!i)return;let t=r.$["*originalUrl"],e=j(Rt(i),"preview"),s=R(t,e),o={originalUrl:t,cdnUrlModifiers:e,cdnUrl:s,transformations:i};r.dispatchEvent(new CustomEvent("apply",{detail:o,bubbles:!0,composed:!0})),r.remove()},"*on.cancel":()=>{r.remove(),r.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))}}}var un="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='puc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#puc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#suc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#suc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#suc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#suc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#suc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#suc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#suc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#suc-icon-id__h)'/><defs><linearGradient id='suc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var hn=b`${un} <div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" set="visible: presence.networkProblems;"><div class="uc-network_problems_content"><div class="uc-network_problems_icon"><uc-icon name="sad"></uc-icon></div><div class="uc-network_problems_text">Network error</div></div><div class="uc-network_problems_footer"><uc-btn-ui theme="primary" text="Retry" set="onclick: *on.retryNetwork"></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">{{fileType}}</div></div><div class="uc-image_container" ref="img-container-el"><img src="${bt}" class="uc-image uc-image_visible_from_editor" ref="img-el" /><uc-editor-image-cropper ref="cropper-el"></uc-editor-image-cropper><uc-editor-image-fader ref="fader-el"></uc-editor-image-fader></div><div class="uc-info_pan">{{msg}}</div></div><div class="uc-toolbar"><uc-line-loader-ui set="active: showLoader"></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor"><uc-editor-toolbar></uc-editor-toolbar></div></div></div>`;var yt=class extends w{constructor(){super();u(this,"ctxOwner",!0);u(this,"_debouncedShowLoader",M(this._showLoader.bind(this),300));this.init$={...this.init$,...cn(this)}}_showLoader(t){this.$.showLoader=t}_waitForSize(){return new Promise((e,s)=>{let o=setTimeout(()=>{s(new Error("[cloud-image-editor] timeout waiting for non-zero container size"))},3e3),n=new ResizeObserver(([l])=>{l.contentRect.width>0&&l.contentRect.height>0&&(e(),clearTimeout(o),n.disconnect())});n.observe(this)})}initCallback(){super.initCallback(),this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async updateImage(){if(this.isConnected){if(await this._waitForSize(),this.$.cdnUrl){let t=ui(this.$.cdnUrl),e=Pt(this.$.cdnUrl,t);if(e===this.$["*originalUrl"])return;this.$["*originalUrl"]=e;let s=As(this.$.cdnUrl),o=Os(s);this.$["*editorTransformations"]=o}else if(this.$.uuid){let t=Pt(this.cfg.cdnCname,this.$.uuid);if(t===this.$["*originalUrl"])return;this.$["*originalUrl"]=t,this.$["*editorTransformations"]={}}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===U.CROP?this.$["*cropperEl"].deactivate({reset:!0}):this.$["*faderEl"].deactivate();try{let t=await this.proxyUrl(R(this.$["*originalUrl"],j("json"))),e=await fetch(t).then(n=>n.json()),{width:s,height:o}=e;this.$["*imageSize"]={width:s,height:o},this.$["*tabId"]===U.CROP?this.$["*cropperEl"].activate(this.$["*imageSize"]):this.$["*faderEl"].activate({url:this.$["*originalUrl"]})}catch(t){t&&console.error("Failed to load image info",t)}}}async initEditor(){try{await this._waitForSize()}catch(t){this.isConnected&&console.error(t.message);return}this.ref["img-el"].addEventListener("load",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$.src!==bt&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",t=>{let e=this.ref["img-el"];e.src!==t&&(this._imgLoading=!0,e.src=t||bt)}),this.sub("cropPreset",t=>{this.$["*cropPresetList"]=Ti(t)}),this.sub("tabs",t=>{this.$["*tabList"]=an(t)}),this.sub("*tabId",t=>{this.ref["img-el"].className=V("uc-image",{"uc-image_hidden_to_cropper":t===U.CROP,"uc-image_hidden_effects":t!==U.CROP})}),this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{this.$["presence.networkProblems"]=t,this.$["presence.modalCaption"]=!t}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],s=j(Rt(t),"preview"),o=R(e,s),n={originalUrl:e,cdnUrlModifiers:s,cdnUrl:o,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0}))},!1),this.sub("uuid",t=>t&&this.updateImage()),this.sub("cdnUrl",t=>t&&this.updateImage())}};u(yt,"styleAttrs",["uc-cloud-image-editor"]);yt.template=hn;yt.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var qi=class extends w{constructor(){super(),this.init$={...this.init$,dragging:!1},this._handlePointerUp=this._handlePointerUp_.bind(this),this._handlePointerMove=this._handlePointerMove_.bind(this),this._handleSvgPointerMove=this._handleSvgPointerMove_.bind(this)}_shouldThumbBeDisabled(i){let t=this.$["*imageBox"];if(!t)return;if(i===""&&t.height<=T&&t.width<=T)return!0;let e=t.height<=T&&(i.includes("n")||i.includes("s")),s=t.width<=T&&(i.includes("e")||i.includes("w"));return e||s}_createBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:s,height:o}=i,n=this.ref["svg-el"],l=rt("mask",{id:"backdrop-mask"}),a=rt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),c=rt("rect",{x:t,y:e,width:s,height:o,fill:"black"});l.appendChild(a),l.appendChild(c);let d=rt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});n.appendChild(d),n.appendChild(l),this._backdropMask=l,this._backdropMaskInner=c}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block")}))}_updateBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:s,height:o}=i;this._backdropMaskInner&&Zt(this._backdropMaskInner,{x:t,y:e,width:s,height:o})}_updateFrame(){let i=this.$["*cropBox"];if(!(!i||!this._frameGuides||!this._frameThumbs)){for(let t of Object.values(this._frameThumbs)){let{direction:e,pathNode:s,interactionNode:o,groupNode:n}=t,l=e==="",a=e.length===2,{x:c,y:d,width:h,height:p}=i;if(l){let m={x:c+h/3,y:d+p/3,width:h/3,height:p/3};Zt(o,m)}else{let m=Bt(Math.min(h,p)/(24*2+34)/2,0,1),{d:y,center:x}=a?mo(i,e,m):go(i,e,m),E=Math.max(Dr*Bt(Math.min(h,p)/Dr/3,0,1),fo);Zt(o,{x:x[0]-E,y:x[1]-E,width:E*2,height:E*2}),Zt(s,{d:y})}let f=this._shouldThumbBeDisabled(e);n.setAttribute("class",V("uc-thumb",{"uc-thumb--hidden":f,"uc-thumb--visible":!f}))}Zt(this._frameGuides,{x:i.x-1*.5,y:i.y-1*.5,width:i.width+1,height:i.height+1})}}_createThumbs(){let i={};for(let t=0;t<3;t++)for(let e=0;e<3;e++){let s=`${["n","","s"][t]}${["w","","e"][e]}`,o=rt("g");o.classList.add("uc-thumb"),o.setAttribute("with-effects","");let n=rt("rect",{fill:"transparent"}),l=rt("path",{stroke:"currentColor",fill:"none","stroke-width":3});o.appendChild(l),o.appendChild(n),i[s]={direction:s,pathNode:l,interactionNode:n,groupNode:o},n.addEventListener("pointerdown",this._handlePointerDown.bind(this,s))}return i}_createGuides(){let i=rt("svg"),t=rt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});i.appendChild(t);for(let e=1;e<=2;e++){let s=rt("line",{x1:`${Le*e}%`,y1:"0%",x2:`${Le*e}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});i.appendChild(s)}for(let e=1;e<=2;e++){let s=rt("line",{x1:"0%",y1:`${Le*e}%`,x2:"100%",y2:`${Le*e}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});i.appendChild(s)}return i.classList.add("uc-guides","uc-guides--semi-hidden"),i}_createFrame(){let i=this.ref["svg-el"],t=document.createDocumentFragment(),e=this._createGuides();t.appendChild(e);let s=this._createThumbs();for(let{groupNode:o}of Object.values(s))t.appendChild(o);i.appendChild(t),this._frameThumbs=s,this._frameGuides=e}_handlePointerDown(i,t){if(!this._frameThumbs)return;let e=this._frameThumbs[i];if(this._shouldThumbBeDisabled(i))return;let s=this.$["*cropBox"],{x:o,y:n}=this.ref["svg-el"].getBoundingClientRect(),l=t.x-o,a=t.y-n;this.$.dragging=!0,this._draggingThumb=e,this._dragStartPoint=[l,a],this._dragStartCrop={...s}}_handlePointerUp_(i){this._updateCursor(),this.$.dragging&&(i.stopPropagation(),i.preventDefault(),this.$.dragging=!1)}_handlePointerMove_(i){if(!this.$.dragging||!this._dragStartPoint||!this._draggingThumb)return;i.stopPropagation(),i.preventDefault();let t=this.ref["svg-el"],{x:e,y:s}=t.getBoundingClientRect(),o=i.x-e,n=i.y-s,l=o-this._dragStartPoint[0],a=n-this._dragStartPoint[1],{direction:c}=this._draggingThumb,d=this._calcCropBox(c,[l,a]);d&&(this.$["*cropBox"]=d)}_calcCropBox(i,t){var c,d;let[e,s]=t,o=this.$["*imageBox"],n=(c=this._dragStartCrop)!=null?c:this.$["*cropBox"],l=(d=this.$["*cropPresetList"])==null?void 0:d[0],a=l?l.width/l.height:void 0;if(i===""?n=yo({rect:n,delta:[e,s],imageBox:o}):n=_o({rect:n,delta:[e,s],direction:i,aspectRatio:a,imageBox:o}),!Object.values(n).every(h=>Number.isFinite(h)&&h>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:n});return}return ae(ue(n),this.$["*imageBox"])}_handleSvgPointerMove_(i){if(!this._frameThumbs)return;let t=Object.values(this._frameThumbs).find(e=>{if(this._shouldThumbBeDisabled(e.direction))return!1;let o=e.interactionNode.getBoundingClientRect(),n={x:o.x,y:o.y,width:o.width,height:o.height};return vo(n,[i.x,i.y])});this._hoverThumb=t,this._updateCursor()}_updateCursor(){let i=this._hoverThumb;this.ref["svg-el"].style.cursor=i?bo(i.direction):"initial"}_render(){this._updateBackdrop(),this._updateFrame()}toggleThumbs(i){this._frameThumbs&&Object.values(this._frameThumbs).map(({groupNode:t})=>t).forEach(t=>{t.setAttribute("class",V("uc-thumb",{"uc-thumb--hidden":!i,"uc-thumb--visible":i}))})}initCallback(){super.initCallback(),this._createBackdrop(),this._createFrame(),this.sub("*imageBox",()=>{this._resizeBackdrop(),window.requestAnimationFrame(()=>{this._render()})}),this.sub("*cropBox",i=>{i&&(this._guidesHidden=i.height<=T||i.width<=T,window.requestAnimationFrame(()=>{this._render()}))}),this.sub("dragging",i=>{this._frameGuides&&this._frameGuides.setAttribute("class",V({"uc-guides--hidden":this._guidesHidden,"uc-guides--visible":!this._guidesHidden&&i,"uc-guides--semi-hidden":!this._guidesHidden&&!i}))}),this.ref["svg-el"].addEventListener("pointermove",this._handleSvgPointerMove,!0),document.addEventListener("pointermove",this._handlePointerMove,!0),document.addEventListener("pointerup",this._handlePointerUp,!0)}destroyCallback(){super.destroyCallback(),document.removeEventListener("pointermove",this._handlePointerMove),document.removeEventListener("pointerup",this._handlePointerUp)}};qi.template=b`<svg class="uc-svg" ref="svg-el" xmlns="http://www.w3.org/2000/svg"></svg>`;var It=class extends w{constructor(){super(...arguments);u(this,"init$",{...this.init$,active:!1,title:"",icon:"","on.click":null,"title-prop":""})}initCallback(){super.initCallback(),this._titleEl=this.ref["title-el"],this._iconEl=this.ref["icon-el"],this.sub("title",t=>{this._titleEl&&(this._titleEl.style.display=t?"block":"none")}),this.sub("active",t=>{this.className=V({"uc-active":t,"uc-not_active":!t})}),this.sub("on.click",t=>{this.onclick=t})}};It.template=b`<button type="button" role="option" l10n="@title:title-prop"><uc-icon set="@name: icon;"></uc-icon><div class="uc-title" ref="title-el">{{title}}</div></button>`;function Xa(r){let i=r+90;return i=i>=360?0:i,i}function Wa(r,i){return r==="rotate"?Xa(i):["mirror","flip"].includes(r)?!i:null}var Xe=class extends It{initCallback(){super.initCallback(),this.defineAccessor("operation",i=>{i&&(this._operation=i,this.$.icon=i,this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(i).toLowerCase()})))}),this.$["on.click"]=()=>{let i=this.$["*cropperEl"].getValue(this._operation),t=Wa(this._operation,i);this.$["*cropperEl"].setValue(this._operation,t)}}};var We={FILTER:"filter",COLOR_OPERATION:"color_operation"},_t="original",Zi=class extends w{constructor(){super(...arguments);u(this,"init$",{...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":t=>{this.$["*faderEl"].set(t),this.$.value=t}})}setOperation(t,e){this._controlType=t==="filter"?We.FILTER:We.COLOR_OPERATION,this._operation=t,this._iconName=t,this._title=t.toUpperCase(),this._filter=e,this._initializeValues(),this.$["*faderEl"].activate({url:this.$["*originalUrl"],operation:this._operation,value:this._filter===_t?void 0:this.$.value,filter:this._filter===_t?void 0:this._filter,fromViewer:!1})}_initializeValues(){let{range:t,zero:e}=pt[this._operation],[s,o]=t;this.$.min=s,this.$.max=o,this.$.zero=e;let n=this.$["*editorTransformations"][this._operation];if(this._controlType===We.FILTER){let l=o;if(n){let{name:a,amount:c}=n;l=a===this._filter?c:o}this.$.value=l,this.$.defaultValue=l}if(this._controlType===We.COLOR_OPERATION){let l=typeof n!="undefined"?n:e;this.$.value=l,this.$.defaultValue=l}}apply(){let t;this._controlType===We.FILTER?this._filter===_t?t=null:t={name:this._filter,amount:this.$.value}:t=this.$.value;let e={...this.$["*editorTransformations"],[this._operation]:t};this.$["*editorTransformations"]=e}cancel(){this.$["*faderEl"].deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{this._originalUrl=t}),this.sub("value",t=>{let e=`${this._filter||this._operation} ${t}`;this.$["*operationTooltip"]=e})}};Zi.template=b`<uc-slider-ui ref="slider-el" set="disabled: disabled; min: min; max: max; defaultValue: defaultValue; zero: zero; onInput: on.input;" ></uc-slider-ui>`;function Ke(r){let i=new Image;return{promise:new Promise((s,o)=>{i.src=r,i.onload=s,i.onerror=o}),image:i,cancel:()=>{i.naturalWidth===0&&(i.src=bt)}}}function qe(r){let i=[];for(let o of r){let n=Ke(o);i.push(n)}let t=i.map(o=>o.image);return{promise:Promise.allSettled(i.map(o=>o.promise)),images:t,cancel:()=>{i.forEach(o=>{o.cancel()})}}}var be=class extends It{constructor(){super(),this.init$={...this.init$,active:!1,title:"",icon:"",isOriginal:!1,"on.click":null}}_previewSrc(){let i=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),t=window.devicePixelRatio,e=Math.ceil(t*i),s=t>=2?"lightest":"normal",o=100,n={...this.$["*editorTransformations"]};return n[this._operation]=this._filter!==_t?{name:this._filter,amount:o}:void 0,R(this._originalUrl,j(hi,Rt(n),`quality/${s}`,`scale_crop/${e}x${e}/center`))}async _observerCallback(i,t){var s;if(i[0].isIntersecting){let o=await this.proxyUrl(this._previewSrc()),n=this.ref["preview-el"],{promise:l,cancel:a}=Ke(o);this._cancelPreload=a,l.catch(c=>{this.$["*networkProblems"]=!0,console.error("Failed to load image",{error:c})}).finally(()=>{n.style.backgroundImage=`url(${o})`,n.setAttribute("loaded",""),t.unobserve(this)})}else(s=this._cancelPreload)==null||s.call(this)}initCallback(){super.initCallback(),this.$["on.click"]=()=>{this.$.active?this.$.isOriginal||(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*showSlider"]=!0):(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*sliderEl"].apply()),this.$["*currentFilter"]=this._filter},this.defineAccessor("filter",t=>{this._operation="filter",this._filter=t,this.$.isOriginal=t===_t,this.$.icon=this.$.isOriginal?"original":"slider",this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()}))}),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let i=this.$["*originalUrl"];this._originalUrl=i,this.$.isOriginal?this.ref["icon-el"].classList.add("uc-original-icon"):this._observer.observe(this),this.sub("*currentFilter",t=>{this.$.active=t&&t===this._filter}),this.sub("active",t=>{if(this.$.isOriginal)return;let e=this.ref["icon-el"];e.style.opacity=t?"1":"0";let s=this.ref["preview-el"];t?s.style.opacity="0":s.style.backgroundImage&&(s.style.opacity="1")}),this.sub("*networkProblems",async t=>{if(!t){let e=await this.proxyUrl(this._previewSrc()),s=this.ref["preview-el"];s.style.backgroundImage&&(s.style.backgroundImage="none",s.style.backgroundImage=`url(${e})`)}})}destroyCallback(){var i,t;super.destroyCallback(),(i=this._observer)==null||i.disconnect(),(t=this._cancelPreload)==null||t.call(this)}};be.template=b`<button type="button" role="option" l10n="@title:title-prop"><div class="uc-preview" ref="preview-el"></div><uc-icon ref="icon-el" set="@name: icon; @size: iconSize;"></uc-icon></button>`;var Ze=class extends It{constructor(){super(...arguments);u(this,"_operation","")}initCallback(){super.initCallback(),this.$["on.click"]=()=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation},this.defineAccessor("operation",t=>{t&&(this._operation=t,this.$.icon=t,this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()})),this.bindL10n("title",()=>this.l10n(t)))}),this.sub("*editorTransformations",t=>{if(!this._operation)return;let{zero:e}=pt[this._operation],s=t[this._operation],o=typeof s!="undefined"?s!==e:!1;this.$.active=o})}};function dn(r,i){let t={};for(let e of i){let s=r[e];(r.hasOwnProperty(e)||s!==void 0)&&(t[e]=s)}return t}function ye(r,i,t){let s=window.devicePixelRatio,o=Math.min(Math.ceil(i*s),3e3),n=s>=2?"lightest":"normal";return R(r,j(hi,Rt(t),`quality/${n}`,`stretch/off/-/resize/${o}x`,`@clib/${he}/${de}/uc-cloud-image-editor/`))}function Ka(r){return r?[({dimensions:t,coords:e})=>[...t,...e].every(s=>Number.isInteger(s)&&Number.isFinite(s)),({dimensions:t,coords:e})=>t.every(s=>s>0)&&e.every(s=>s>=0)].every(t=>t(r)):!0}var Yi=class extends w{constructor(){super();u(this,"ctxOwner",!0);this.init$={...this.init$,image:null,"*padding":20,"*operations":{rotate:0,mirror:!1,flip:!1},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this._commitDebounced=M(this._commit.bind(this),300),this._handleResizeThrottled=Vi(this._handleResize.bind(this),100),this._imageSize={width:0,height:0}}_handleResize(){!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw())}_syncTransformations(){let t=this.$["*editorTransformations"],e=dn(t,Object.keys(this.$["*operations"])),s={...this.$["*operations"],...e};this.$["*operations"]=s}_initCanvas(){let t=this.ref["canvas-el"],e=t.getContext("2d"),s=this.offsetWidth,o=this.offsetHeight,n=window.devicePixelRatio;t.style.width=`${s}px`,t.style.height=`${o}px`,t.width=s*n,t.height=o*n,e==null||e.scale(n,n),this._canvas=t,this._ctx=e}_alignImage(){if(!this._isActive||!this.$.image)return;let t=this.$.image,e=this.$["*padding"],s=this.$["*operations"],{rotate:o}=s,n={width:this.offsetWidth,height:this.offsetHeight},l=ce({width:t.naturalWidth,height:t.naturalHeight},o),a;if(l.width>n.width-e*2||l.height>n.height-e*2){let c=l.width/l.height,d=n.width/n.height;if(c>d){let h=n.width-e*2,p=h/c,f=0+e,m=e+(n.height-e*2)/2-p/2;a={x:f,y:m,width:h,height:p}}else{let h=n.height-e*2,p=h*c,f=e+(n.width-e*2)/2-p/2,m=0+e;a={x:f,y:m,width:p,height:h}}}else{let{width:c,height:d}=l,h=e+(n.width-e*2)/2-c/2,p=e+(n.height-e*2)/2-d/2;a={x:h,y:p,width:c,height:d}}this.$["*imageBox"]=ue(a)}_alignCrop(){var p;let t=this.$["*cropBox"],e=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,n=this.$["*editorTransformations"].crop,{width:l,x:a,y:c}=this.$["*imageBox"];if(n){let{dimensions:[f,m],coords:[y,x]}=n,{width:E}=ce(this._imageSize,o),C=l/E;t=ae(ue({x:a+y*C,y:c+x*C,width:f*C,height:m*C}),this.$["*imageBox"])}let d=(p=this.$["*cropPresetList"])==null?void 0:p[0],h=d?d.width/d.height:void 0;if(!wo(t,e)||h&&!Co(t,h)){let f=e.width/e.height,m=e.width,y=e.height;h&&(f>h?m=Math.min(e.height*h,e.width):y=Math.min(e.width/h,e.height)),t={x:e.x+e.width/2-m/2,y:e.y+e.height/2-y/2,width:m,height:y}}this.$["*cropBox"]=ae(ue(t),this.$["*imageBox"])}_drawImage(){let t=this._ctx;if(!t)return;let e=this.$.image,s=this.$["*imageBox"],o=this.$["*operations"],{mirror:n,flip:l,rotate:a}=o,c=ce({width:s.width,height:s.height},a);t.save(),t.translate(s.x+s.width/2,s.y+s.height/2),t.rotate(a*Math.PI*-1/180),t.scale(n?-1:1,l?-1:1),t.drawImage(e,-c.width/2,-c.height/2,c.width,c.height),t.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let t=this._canvas;this._ctx.clearRect(0,0,t.width,t.height),this._drawImage()}_animateIn({fromViewer:t}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=V({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":!1})}))}_getCropDimensions(){let t=this.$["*cropBox"],e=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,{width:n,height:l}=e,{width:a,height:c}=ce(this._imageSize,o),{width:d,height:h}=t,p=n/a,f=l/c;return[Bt(Math.round(d/p),1,a),Bt(Math.round(h/f),1,c)]}_getCropTransformation(){let t=this.$["*cropBox"],e=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,{width:n,height:l,x:a,y:c}=e,{width:d,height:h}=ce(this._imageSize,o),{x:p,y:f}=t,m=n/d,y=l/h,x=this._getCropDimensions(),E={dimensions:x,coords:[Bt(Math.round((p-a)/m),0,d-x[0]),Bt(Math.round((f-c)/y),0,h-x[1])]};if(!Ka(E)){console.error("Cropper is trying to create invalid crop object",{payload:E});return}if(!(x[0]===d&&x[1]===h))return E}_commit(){if(!this.isConnected||!this._imageSize)return;let t=this.$["*operations"],{rotate:e,mirror:s,flip:o}=t,n=this._getCropTransformation(),a={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:s,flip:o};this.$["*editorTransformations"]=a}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this._isActive){this._isActive=!0,this._imageSize=t,this.removeEventListener("transitionend",this._reset);try{this.$.image=await this._waitForImage(this.$["*originalUrl"],this.$["*editorTransformations"]),this._syncTransformations(),this._animateIn({fromViewer:e})}catch(s){console.error("Failed to activate cropper",{error:s})}this._observer=new ResizeObserver(([s])=>{s.contentRect.width>0&&s.contentRect.height>0&&this._isActive&&this.$.image&&this._handleResizeThrottled()}),this._observer.observe(this)}}deactivate({reset:t=!1}={}){var e;this._isActive&&(!t&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=V({"uc-active_from_viewer":!1,"uc-active_from_editor":!1,"uc-inactive_to_editor":!0}),this.ref["frame-el"].toggleThumbs(!1),this.addEventListener("transitionend",this._reset,{once:!0}),(e=this._observer)==null||e.disconnect())}_transitionToCrop(){let t=this._getCropDimensions(),e=Math.min(this.offsetWidth,t[0])/this.$["*cropBox"].width,s=Math.min(this.offsetHeight,t[1])/this.$["*cropBox"].height,o=Math.min(e,s),n=this.$["*cropBox"].x+this.$["*cropBox"].width/2,l=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform=`scale(${o}) translate(${(this.offsetWidth/2-n)/o}px, ${(this.offsetHeight/2-l)/o}px)`,this.style.transformOrigin=`${n}px ${l}px`}_transitionToImage(){let t=this.$["*cropBox"].x+this.$["*cropBox"].width/2,e=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${t}px ${e}px`}_reset(){this._isActive||(this.$.image=null)}async _waitForImage(t,e){var d;let s=this.offsetWidth;e={...e,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let o=await this.proxyUrl(ye(t,s,e)),{promise:n,cancel:l,image:a}=Ke(o),c=this._handleImageLoading(o);return a.addEventListener("load",c,{once:!0}),a.addEventListener("error",c,{once:!0}),(d=this._cancelPreload)==null||d.call(this),this._cancelPreload=l,n.then(()=>a).catch(h=>(console.error("Failed to load image",{error:h}),this.$["*networkProblems"]=!0,Promise.resolve(a)))}_handleImageLoading(t){let e="crop",s=this.$["*loadingOperations"];return s.get(e)||s.set(e,new Map),s.get(e).get(t)||(s.set(e,s.get(e).set(t,!0)),this.$["*loadingOperations"]=s),()=>{var o;(o=s==null?void 0:s.get(e))!=null&&o.has(t)&&(s.get(e).delete(t),this.$["*loadingOperations"]=s)}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw()}),this.sub("*cropBox",()=>{this.$.image&&this._commitDebounced()}),this.sub("*cropPresetList",()=>{this._alignCrop()}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){var t;super.destroyCallback(),(t=this._observer)==null||t.disconnect()}};Yi.template=b`<canvas class="uc-canvas" ref="canvas-el"></canvas><uc-crop-frame ref="frame-el"></uc-crop-frame>`;function ns(r,i,t){let e=Array(t);t--;for(let s=t;s>=0;s--)e[s]=Math.ceil((s*i+(t-s)*r)/t);return e}function qa(r){return r.reduce((i,t,e)=>e<r.length-1?[...i,[t,r[e+1]]]:i,[])}function Za(r,i,t){let e=qa(r).find(([s,o])=>s<=i&&i<=o);return r.map(s=>{let o=Math.abs(e[0]-e[1]),n=Math.abs(i-e[0])/o;return e[0]===s?i>t?1:1-n:e[1]===s?i>=t?n:1:0})}function Ya(r,i){return r.map((t,e)=>t<i?r.length-e:e)}function pn(r,i){let t=pt[r].keypointsNumber,{range:e,zero:s}=pt[r];return[...new Set([...ns(e[0],s,t+1),...ns(s,e[1],t+1),s,i])].sort((o,n)=>o-n)}var ls=class extends w{constructor(){super(),this._isActive=!1,this._hidden=!0,this._addKeypointDebounced=M(this._addKeypoint.bind(this),600),this.classList.add("uc-inactive_to_cropper")}_handleImageLoading(i){let t=this._operation,e=this.$["*loadingOperations"];return e.get(t)||e.set(t,new Map),e.get(t).get(i)||(e.set(t,e.get(t).set(i,!0)),this.$["*loadingOperations"]=e),()=>{var s;(s=e==null?void 0:e.get(t))!=null&&s.has(i)&&(e.get(t).delete(i),this.$["*loadingOperations"]=e)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let i of this._keypoints){let{image:t}=i;t&&(t.style.opacity=i.opacity.toString(),t.style.zIndex=i.zIndex.toString())}})}async _imageSrc({url:i=this._url,filter:t=this._filter,operation:e,value:s}={}){let o={...this._transformations};e&&(o[e]=t?{name:t,amount:s}:s);let n=this.offsetWidth;return await this.proxyUrl(ye(i,n,o))}async _constructKeypoint(i,t){return{src:await this._imageSrc({operation:i,value:t}),image:null,opacity:0,zIndex:0,value:t}}_isSame(i,t){return this._operation===i&&this._filter===t}async _addKeypoint(i,t,e){let s=()=>!this._isSame(i,t)||this._value!==e||!!this._keypoints.find(a=>a.value===e);if(s())return;let o=await this._constructKeypoint(i,e),n=new Image;n.src=o.src;let l=this._handleImageLoading(o.src);n.addEventListener("load",l,{once:!0}),n.addEventListener("error",l,{once:!0}),o.image=n,n.classList.add("uc-fader-image"),n.addEventListener("load",()=>{if(s())return;let a=this._keypoints,c=a.findIndex(h=>h.value>e),d=c<a.length?a[c].image:null;!this._container||d&&!this._container.contains(d)||(a.splice(c,0,o),this._container.insertBefore(n,d),this._update(i,e))},{once:!0}),n.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}set(i){i=typeof i=="string"?parseInt(i,10):i,this._update(this._operation,i),this._addKeypointDebounced(this._operation,this._filter,i)}_update(i,t){this._operation=i,this._value=t;let{zero:e}=pt[i],s=this._keypoints.map(l=>l.value),o=Za(s,t,e),n=Ya(s,e);for(let[l,a]of Object.entries(this._keypoints))a.opacity=o[l],a.zIndex=n[l];this._flush()}_createPreviewImage(){let i=new Image;return i.classList.add("uc-fader-image","uc-fader-image--preview"),i.style.opacity="0",i}async _initNodes(){let i=document.createDocumentFragment();this._previewImage=this._previewImage||this._createPreviewImage(),!this.contains(this._previewImage)&&i.appendChild(this._previewImage);let t=document.createElement("div");i.appendChild(t);let e=this._keypoints.map(c=>c.src),{images:s,promise:o,cancel:n}=qe(e);s.forEach(c=>{let d=this._handleImageLoading(c.src);c.addEventListener("load",d),c.addEventListener("error",d)}),this._cancelLastImages=()=>{n(),this._cancelLastImages=void 0};let l=this._operation,a=this._filter;await o,this._isActive&&this._isSame(l,a)&&(this._container&&this._container.remove(),this._container=t,this._keypoints.forEach((c,d)=>{let h=s[d];h.classList.add("uc-fader-image"),c.image=h,this._container.appendChild(h)}),this.appendChild(i),this._flush())}async setTransformations(i){if(this._transformations=i,this._previewImage){let t=await this._imageSrc(),e=this._handleImageLoading(t);this._previewImage.src=t,this._previewImage.addEventListener("load",e,{once:!0}),this._previewImage.addEventListener("error",e,{once:!0}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}}async preload({url:i,filter:t,operation:e,value:s}){this._cancelBatchPreload&&this._cancelBatchPreload();let o=pn(e,s),n=await Promise.all(o.map(a=>this._imageSrc({url:i,filter:t,operation:e,value:a}))),{cancel:l}=qe(n);this._cancelBatchPreload=l}_setOriginalSrc(i){let t=this._previewImage||this._createPreviewImage();if(!this.contains(t)&&this.appendChild(t),this._previewImage=t,t.src===i){t.style.opacity="1",t.style.transform="scale(1)",this.className=V({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1});return}t.style.opacity="0";let e=this._handleImageLoading(i);t.addEventListener("error",e,{once:!0}),t.src=i,t.addEventListener("load",()=>{e(),t&&(t.style.opacity="1",t.style.transform="scale(1)",this.className=V({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1}))},{once:!0}),t.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}async activate({url:i,operation:t,value:e,filter:s,fromViewer:o}){if(this._isActive=!0,this._hidden=!1,this._url=i,this._operation=t||"initial",this._value=e,this._filter=s,this._fromViewer=o,typeof e!="number"&&!s){let l=await this._imageSrc({operation:t,value:e});this._setOriginalSrc(l),this._container&&this._container.remove();return}this._keypoints=await Promise.all(pn(t,e).map(l=>this._constructKeypoint(t,l))),this._update(t,e),this._initNodes()}deactivate({hide:i=!0}={}){this._isActive=!1,this._cancelLastImages&&this._cancelLastImages(),this._cancelBatchPreload&&this._cancelBatchPreload(),i&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=V({"uc-active_from_viewer":!1,"uc-active_from_cropper":!1,"uc-inactive_to_cropper":!0}),this.addEventListener("transitionend",()=>{this._container&&this._container.remove()},{once:!0})):this._container&&this._container.remove()}};var Ja=1,Ji=class extends w{initCallback(){super.initCallback(),this.addEventListener("wheel",i=>{i.preventDefault();let{deltaY:t,deltaX:e}=i;Math.abs(e)>Ja?this.scrollLeft+=e:this.scrollLeft+=t},{passive:!1}),this.addEventListener("scroll",()=>{},{passive:!0})}};Ji.template=b`<slot></slot>`;function Qa(r){return`<uc-presence-toggle class="uc-tab-toggle" set="visible: presence.tabToggle.${r}; styles: presence.tabToggleStyles;" ><uc-btn-ui theme="tab" ref="tab-toggle-${r}" data-id="${r}" icon="${r}" set="onclick: on.clickTab; aria-role:tab_role; aria-controls:tab_${r}; title-prop: a11y-editor-tab-${r}" ></uc-btn-ui></uc-presence-toggle>`}function tc(r){return b`<uc-presence-toggle id="tab_${r}" class="uc-tab-content" set="visible: presence.tabContent.${r}; styles: presence.tabContentStyles" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner" ref="controls-list-${r}" ></div></div></uc-editor-scroller></uc-presence-toggle>`}var Qi=class extends w{constructor(){super();u(this,"_updateInfoTooltip",M(()=>{var n,l;let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],s="",o=!1;if(this.$["*tabId"]===U.FILTERS)if(o=!0,this.$["*currentFilter"]&&((n=t==null?void 0:t.filter)==null?void 0:n.name)===this.$["*currentFilter"]){let a=((l=t==null?void 0:t.filter)==null?void 0:l.amount)||100;s=this.$["*currentFilter"]+" "+a}else s=this.l10n(_t);else if(this.$["*tabId"]===U.TUNING&&e){o=!0;let a=(t==null?void 0:t[e])||pt[e].zero;s=this.l10n(e)+" "+a}o&&(this.$["*operationTooltip"]=s),this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible",o)},0));this.init$={...this.init$,"*sliderEl":null,"*loadingOperations":new Map,"*showSlider":!1,"*currentFilter":_t,"*currentOperation":null,showLoader:!1,filters:Us,colorOperations:Ls,cropOperations:Ms,"*operationTooltip":null,"presence.mainToolbar":!0,"presence.subToolbar":!1,"presence.tabToggles":!0,"presence.tabContent.crop":!1,"presence.tabContent.tuning":!1,"presence.tabContent.filters":!1,"presence.tabToggle.crop":!0,"presence.tabToggle.tuning":!0,"presence.tabToggle.filters":!0,"presence.subTopToolbarStyles":{hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"},"presence.subBottomToolbarStyles":{hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"},"presence.tabContentStyles":{hidden:"uc-tab-content--hidden",visible:"uc-tab-content--visible"},"presence.tabToggleStyles":{hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"},"presence.tabTogglesStyles":{hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"},"on.cancel":()=>{var t;(t=this._cancelPreload)==null||t.call(this),this.$["*on.cancel"]()},"on.apply":()=>{this.$["*on.apply"](this.$["*editorTransformations"])},"on.applySlider":()=>{this.ref["slider-el"].apply(),this._onSliderClose()},"on.cancelSlider":()=>{this.ref["slider-el"].cancel(),this._onSliderClose()},"on.clickTab":t=>{let e=t.currentTarget.getAttribute("data-id");e&&this._activateTab(e,{fromViewer:!1})},tab_role:"tab",[`tab_${U.TUNING}`]:`tab_${U.TUNING}`,[`tab_${U.CROP}`]:`tab_${U.CROP}`,[`tab_${U.FILTERS}`]:`tab_${U.FILTERS}`,cancel:"cancel",apply:"apply","a11y-editor-tab-filters":"a11y-editor-tab-filters","a11y-editor-tab-tuning":"a11y-editor-tab-tuning","a11y-editor-tab-crop":"a11y-editor-tab-crop"},this._debouncedShowLoader=M(this._showLoader.bind(this),500)}_onSliderClose(){this.$["*showSlider"]=!1,this.$["*tabId"]===U.TUNING&&this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible",!1)}_createOperationControl(t){let e=new Ze;return e.operation=t,e}_createFilterControl(t){let e=new be;return e.filter=t,e}_createToggleControl(t){let e=new Xe;return e.operation=t,e}_renderControlsList(t){let e=this.ref[`controls-list-${t}`],s=document.createDocumentFragment();t===U.CROP?this.$.cropOperations.forEach(o=>{let n=this._createToggleControl(o);s.appendChild(n)}):t===U.FILTERS?[_t,...this.$.filters].forEach(o=>{let n=this._createFilterControl(o);s.appendChild(n)}):t===U.TUNING&&this.$.colorOperations.forEach(o=>{let n=this._createOperationControl(o);s.appendChild(n)}),[...s.children].forEach((o,n)=>{n===s.childNodes.length-1&&o.classList.add("uc-controls-list_last-item")}),e.innerHTML="",e.appendChild(s)}_activateTab(t,{fromViewer:e}){this.$["*tabId"]=t,t===U.CROP?(this.$["*faderEl"].deactivate(),this.$["*cropperEl"].activate(this.$["*imageSize"],{fromViewer:e})):(this.$["*faderEl"].activate({url:this.$["*originalUrl"],fromViewer:e}),this.$["*cropperEl"].deactivate());for(let s of Z){let o=s===t,n=this.ref[`tab-toggle-${s}`];n.active=o,o?(this._renderControlsList(t),this._syncTabIndicator()):this._unmountTabControls(s),this.$[`presence.tabContent.${s}`]=o}}_unmountTabControls(t){let e=this.ref[`controls-list-${t}`];e&&(e.innerHTML="")}_syncTabIndicator(){let t=this.ref[`tab-toggle-${this.$["*tabId"]}`],e=this.ref["tabs-indicator"];e.style.transform=`translateX(${t.offsetLeft}px)`}async _preloadEditedImage(){var t;if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let e=this.$["*imgContainerEl"].offsetWidth,s=await this.proxyUrl(ye(this.$["*originalUrl"],e,this.$["*editorTransformations"]));(t=this._cancelPreload)==null||t.call(this);let{cancel:o}=qe([s]);this._cancelPreload=()=>{o(),this._cancelPreload=void 0}}}_showLoader(t){this.$.showLoader=t}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.sub("*imageSize",t=>{t&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",t=>{var s;let e=(s=t==null?void 0:t.filter)==null?void 0:s.name;this.$["*currentFilter"]!==e&&(this.$["*currentFilter"]=e!=null?e:null)}),this.sub("*currentFilter",()=>{this._updateInfoTooltip()}),this.sub("*currentOperation",()=>{this._updateInfoTooltip()}),this.sub("*tabId",()=>{this._updateInfoTooltip()}),this.sub("*originalUrl",()=>{this.$["*faderEl"]&&this.$["*faderEl"].deactivate()}),this.sub("*editorTransformations",t=>{this._preloadEditedImage(),this.$["*faderEl"]&&this.$["*faderEl"].setTransformations(t)}),this.sub("*loadingOperations",t=>{let e=!1;for(let[,s]of t.entries()){if(e)break;for(let[,o]of s.entries())if(o){e=!0;break}}this._debouncedShowLoader(e)}),this.sub("*showSlider",t=>{this.$["presence.subToolbar"]=t,this.$["presence.mainToolbar"]=!t}),this.sub("*tabList",t=>{this.$["presence.tabToggles"]=t.length>1;for(let e of Z){this.$[`presence.tabToggle.${e}`]=t.includes(e);let s=this.ref[`tab-toggle-${e}`];s.style.gridColumn=t.indexOf(e)+1}t.includes(this.$["*tabId"])||this._activateTab(t[0],{fromViewer:!1})}),this._updateInfoTooltip()}};Qi.template=b`<uc-line-loader-ui set="active: showLoader"></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div ref="tooltip-el" class="uc-info-tooltip uc-info-tooltip_hidden">{{*operationTooltip}}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" set="visible: presence.mainToolbar; styles: presence.subTopToolbarStyles" ><div class="uc-tab-content-row">${Z.map(tc).join("")}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" set="visible: presence.tabToggles; styles: presence.tabTogglesStyles" ><div ref="tabs-indicator" class="uc-tab-toggles_indicator"></div> ${Z.map(Qa).join("")} </uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" set="onclick: on.cancel; title-prop:cancel"></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" set="onclick: on.apply; title-prop:apply"></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" set="visible: presence.subToolbar; styles: presence.subBottomToolbarStyles" ><div class="uc-slider"><uc-editor-slider ref="slider-el"></uc-editor-slider></div><div class="uc-controls-row"><uc-btn-ui theme="secondary" set="onclick: on.cancelSlider" l10n="@text:cancel"></uc-btn-ui><uc-btn-ui theme="primary" set="onclick: on.applySlider" l10n="@text:apply"></uc-btn-ui></div></uc-presence-toggle></div>`;var Ye=class extends w{constructor(){super(),this._iconReversed=!1,this._iconSingle=!1,this._iconHidden=!1,this.init$={...this.init$,text:"",icon:"",iconCss:this._iconCss(),theme:null,"aria-role":"","aria-controls":"","title-prop":""},this.defineAccessor("active",i=>{i?this.setAttribute("active",""):this.removeAttribute("active")})}_iconCss(){return V("uc-icon",{"uc-icon_left":!this._iconReversed,"uc-icon_right":this._iconReversed,"uc-icon_hidden":this._iconHidden,"uc-icon_single":this._iconSingle})}initCallback(){super.initCallback(),this.sub("icon",i=>{this._iconSingle=!this.$.text,this._iconHidden=!i,this.$.iconCss=this._iconCss()}),this.sub("theme",i=>{i!=="custom"&&(this.className=`uc-${i}`)}),this.sub("text",()=>{this._iconSingle=!1}),this.hasAttribute("theme")||this.setAttribute("theme","default"),this.defineAccessor("aria-role",i=>{this.$["aria-role"]=i||""}),this.defineAccessor("aria-controls",i=>{this.$["aria-controls"]=i||""}),this.defineAccessor("title-prop",i=>{this.$["title-prop"]=i||""})}set reverse(i){this.hasAttribute("reverse")?(this.style.flexDirection="row-reverse",this._iconReversed=!0):(this._iconReversed=!1,this.style.flexDirection=null)}};Ye.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});Ye.template=b`<button type="button" set="@role:aria-role; @aria-controls: aria-controls;" l10n="@title:title-prop"><uc-icon set="className: iconCss; @name: icon; @hidden: !icon"></uc-icon><div class="uc-text">{{text}}</div></button>`;var tr=class extends w{constructor(){super(),this._active=!1,this._handleTransitionEndRight=()=>{let i=this.ref["line-el"];i.style.transition="initial",i.style.opacity="0",i.style.transform="translateX(-101%)",this._active&&this._start()}}initCallback(){super.initCallback(),this.defineAccessor("active",i=>{typeof i=="boolean"&&(i?this._start():this._stop())})}_start(){this._active=!0;let{width:i}=this.getBoundingClientRect(),t=this.ref["line-el"];t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${i}px)`,t.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){this._active=!1}};tr.template=b`<div class="uc-inner"><div class="uc-line" ref="line-el"></div></div>`;var er={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},ir=class extends w{constructor(){super(),this._visible=!1,this._visibleStyle=er.visible,this._hiddenStyle=er.hidden,this._externalTransitions=!1,this.defineAccessor("styles",i=>{i&&(this._externalTransitions=!0,this._visibleStyle=i.visible,this._hiddenStyle=i.hidden)}),this.defineAccessor("visible",i=>{typeof i=="boolean"&&(this._visible=i,this._handleVisible())})}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",ln(this,{[er.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.setAttribute("aria-hidden",this._visible?"false":"true")}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",!0),this._externalTransitions||this.classList.add(er.transition),this._handleVisible(),setTimeout(()=>{this.classList.toggle("uc-initial",!1)},0)}};ir.template=b`<slot></slot>`;var rr=class extends w{constructor(){super();u(this,"init$",{...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:null,"on.sliderInput":()=>{let t=parseInt(this.ref["input-el"].value,10);this._updateValue(t),this.$.onInput&&this.$.onInput(t)},"on.sliderChange":()=>{let t=parseInt(this.ref["input-el"].value,10);this.$.onChange&&this.$.onChange(t)}});this.setAttribute("with-effects","")}initCallback(){super.initCallback(),this.defineAccessor("disabled",e=>{this.$.disabled=e}),this.defineAccessor("min",e=>{this.$.min=e}),this.defineAccessor("max",e=>{this.$.max=e}),this.defineAccessor("defaultValue",e=>{this.$.defaultValue=e,this.ref["input-el"].value=e,this._updateValue(e)}),this.defineAccessor("zero",e=>{this._zero=e}),this.defineAccessor("onInput",e=>{e&&(this.$.onInput=e)}),this.defineAccessor("onChange",e=>{e&&(this.$.onChange=e)}),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps();let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)}),this._observer.observe(this),this._thumbSize=parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10),setTimeout(()=>{let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)},0),this.sub("disabled",e=>{let s=this.ref["input-el"];e?s.setAttribute("disabled","disabled"):s.removeAttribute("disabled")});let t=this.ref["input-el"];t.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),t.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_updateValue(t){this._updateZeroDot(t);let{width:e}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(t-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this.ref["thumb-el"].style.transform=`translateX(${n}px)`})}_updateZeroDot(t){if(!this._zeroDotEl)return;t===this._zero?this._zeroDotEl.style.opacity="0":this._zeroDotEl.style.opacity="0.2";let{width:e}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(this._zero-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl.style.transform=`translateX(${n}px)`})}_updateSteps(){let e=this.ref["steps-el"],{width:s}=e.getBoundingClientRect(),o=Math.ceil(s/2),n=Math.ceil(o/15)-2;if(this._stepsCount===n)return;let l=document.createDocumentFragment(),a=document.createElement("div"),c=document.createElement("div");a.className="uc-minor-step",c.className="uc-border-step",l.appendChild(c);for(let h=0;h<n;h++)l.appendChild(a.cloneNode());l.appendChild(c.cloneNode());for(let h=0;h<n;h++)l.appendChild(a.cloneNode());l.appendChild(c.cloneNode());let d=document.createElement("div");d.className="uc-zero-dot",l.appendChild(d),this._zeroDotEl=d,e.innerHTML="",e.appendChild(l),this._stepsCount=n}destroyCallback(){var t;super.destroyCallback(),(t=this._observer)==null||t.disconnect()}};rr.template=b`<div class="uc-steps" ref="steps-el"></div><div ref="thumb-el" class="uc-thumb"></div><input class="uc-input" type="range" ref="input-el" set="oninput: on.sliderInput; onchange: on.sliderChange; @min: min; @max: max; @value: defaultValue;" />`;var as=class extends S{constructor(){super(...arguments);u(this,"couldBeCtxOwner",!0);u(this,"activityType",v.activities.CLOUD_IMG_EDIT);u(this,"_entry");u(this,"_instance")}get activityParams(){let t=super.activityParams;if("internalId"in t)return t;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>this.mountEditor(),onDeactivate:()=>this.unmountEditor()}),this.subConfigValue("cropPreset",t=>{this._instance&&this._instance.getAttribute("crop-preset")!==t&&this._instance.setAttribute("crop-preset",t)}),this.subConfigValue("cloudImageEditorTabs",t=>{this._instance&&this._instance.getAttribute("tabs")!==t&&this._instance.setAttribute("tabs",t)})}handleApply(t){if(!this._entry)return;let e=t.detail;this._entry.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.historyBack()}handleCancel(){this.historyBack()}mountEditor(){let{internalId:t}=this.activityParams;if(this._entry=this.uploadCollection.read(t),!this._entry)throw new Error(`Entry with internalId "${t}" not found`);let e=this._entry.getValue("cdnUrl");if(!e)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);let s=new yt,o=this.cfg.cropPreset,n=this.cfg.cloudImageEditorTabs;s.setAttribute(g.CTX_NAME_ATTR,this.ctxName),s.setAttribute("cdn-url",e),o&&s.setAttribute("crop-preset",o),n&&s.setAttribute("tabs",n),s.addEventListener("apply",l=>{let a=l;this.handleApply(a),this.debugPrint('editor event "apply"',a.detail)}),s.addEventListener("cancel",l=>{let a=l;this.handleCancel(),this.debugPrint('editor event "cancel"',a.detail)}),s.addEventListener("change",l=>{let a=l;this.debugPrint('editor event "change"',a.detail)}),this.innerHTML="",this.appendChild(s),this._instance=s}unmountEditor(){this._instance=void 0,this._entry=void 0,this.innerHTML=""}};var ec=function(r){return r.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},fn=function(r,i="i"){let t=r.split("*").map(ec);return new RegExp("^"+t.join(".+")+"$",i)};var ic=r=>Object.keys(r).reduce((t,e)=>{let s=r[e],o=Object.keys(s).reduce((n,l)=>{let a=s[l];return n+`${l}: ${a};`},"");return t+`${e}{${o}}`},"");function mn({textColor:r,backgroundColor:i,linkColor:t,linkColorHover:e,secondaryColor:s,secondaryHover:o,secondaryForegroundColor:n,fontFamily:l,fontSize:a,radius:c}){let d=`solid 1px ${s}`;return ic({body:{color:r,"background-color":i,"font-family":l,"font-size":a},".side-bar":{background:"inherit","border-right":d},".main-content":{background:"inherit"},".main-content-header":{background:"inherit"},".main-content-footer":{background:"inherit"},".list-table-row":{color:"inherit"},".list-table-row:hover":{background:s},".list-table-row .list-table-cell-a, .list-table-row .list-table-cell-b":{"border-top":d},".list-table-body .list-items":{"border-bottom":d},".bread-crumbs a":{color:t},".bread-crumbs a:hover":{color:e},".main-content.loading":{background:`${i} url(/static/images/loading_spinner.gif) center no-repeat`,"background-size":"25px 25px"},".list-icons-item":{"background-color":s},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a":{color:t},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a:hover":{color:e},".side-bar-menu a":{color:t},".side-bar-menu a:hover":{color:e},".source-gdrive .side-bar-menu .current, .source-gdrive .side-bar-menu a:hover, .source-gphotos .side-bar-menu .current, .source-gphotos .side-bar-menu a:hover":{color:e},".source-vk .side-bar-menu a":{color:t},".source-vk .side-bar-menu a:hover":{color:e,background:"none"},"input[type=submit], .button, button":{color:n,background:s,"box-shadow":"none",border:"none","border-radius":c},"input[type=submit]:hover, .button:hover, button:hover":{background:o},".text-field, input[type=search], input[type=text], input[type=url], textarea":{color:n,"border-radius":c,background:s,border:d}})}var Vt={};window.addEventListener("message",r=>{let i;try{i=JSON.parse(r.data)}catch{return}if((i==null?void 0:i.type)in Vt){let t=Vt[i.type];for(let[e,s]of t)r.source===e&&s(i)}});var gn=function(r,i,t){r in Vt||(Vt[r]=[]),Vt[r].push([i,t])},bn=function(r,i){r in Vt&&(Vt[r]=Vt[r].filter(t=>t[0]!==i))};function yn(r){let i=[];for(let[t,e]of Object.entries(r))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}var sr=class extends S{constructor(){super();u(this,"couldBeCtxOwner",!0);u(this,"activityType",v.activities.EXTERNAL);u(this,"_iframe",null);this.init$={...this.init$,activityIcon:"",activityCaption:"",selectedList:[],counter:0,multiple:!1,onDone:()=>{for(let t of this.$.selectedList){let e=this.extractUrlFromMessage(t),{filename:s}=t,{externalSourceType:o}=this.activityParams;this.api.addFileFromUrl(e,{fileName:s,source:o})}this.$["*currentActivity"]=v.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()}}}get activityParams(){let t=super.activityParams;if("externalSourceType"in t)return t;throw new Error("External Source activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{let{externalSourceType:t}=this.activityParams;if(!t){this.$["*currentActivity"]=null,this.setOrAddState("*modalActive",!1),console.error(`Param "externalSourceType" is required for activity "${this.activityType}"`);return}this.set$({activityCaption:`${t==null?void 0:t[0].toUpperCase()}${t==null?void 0:t.slice(1)}`,activityIcon:t}),this.mountIframe()}}),this.sub("*currentActivityParams",()=>{this.isActivityActive&&(this.unmountIframe(),this.mountIframe())}),this.sub("*currentActivity",t=>{t!==this.activityType&&this.unmountIframe()}),this.sub("selectedList",t=>{this.$.counter=t.length}),this.subConfigValue("multiple",t=>{this.$.multiple=t})}extractUrlFromMessage(t){if(t.alternatives){let e=G(this.cfg.externalSourcesPreferredTypes);for(let s of e){let o=fn(s);for(let[n,l]of Object.entries(t.alternatives))if(o.test(n))return l}}return t.url}sendMessage(t){var e,s;(s=(e=this._iframe)==null?void 0:e.contentWindow)==null||s.postMessage(JSON.stringify(t),"*")}async handleFileSelected(t){!this.$.multiple&&this.$.selectedList.length||(this.$.selectedList=[...this.$.selectedList,t],this.$.multiple||this.$.onDone())}handleIframeLoad(){this.applyStyles()}getCssValue(t){return window.getComputedStyle(this).getPropertyValue(t).trim()}applyStyles(){let t={radius:this.getCssValue("--uc-radius"),backgroundColor:this.getCssValue("--uc-background"),textColor:this.getCssValue("--uc-foreground"),secondaryColor:this.getCssValue("--uc-secondary"),secondaryForegroundColor:this.getCssValue("--uc-secondary-foreground"),secondaryHover:this.getCssValue("--uc-secondary-hover"),linkColor:this.getCssValue("--uc-primary"),linkColorHover:this.getCssValue("--uc-primary-hover"),fontFamily:this.getCssValue("--uc-font-family"),fontSize:this.getCssValue("--uc-font-size")};this.sendMessage({type:"embed-css",style:mn(t)})}remoteUrl(){var c,d;let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:s}=this.cfg,{externalSourceType:o}=this.activityParams,l={lang:((d=(c=this.l10n("social-source-lang"))==null?void 0:c.split("-"))==null?void 0:d[0])||"en",public_key:t,images_only:"false",pass_window_open:!1,session_key:e},a=new URL(`/window3/${o}`,s);return a.search=yn(l),a.toString()}mountIframe(){let t=Te({tag:"iframe",attributes:{src:this.remoteUrl(),marginheight:0,marginwidth:0,frameborder:0,allowTransparency:!0}});t.addEventListener("load",this.handleIframeLoad.bind(this)),this.ref.iframeWrapper.innerHTML="",this.ref.iframeWrapper.appendChild(t),gn("file-selected",t.contentWindow,this.handleFileSelected.bind(this)),this._iframe=t,this.$.selectedList=[]}unmountIframe(){this._iframe&&bn("file-selected",this._iframe.contentWindow),this.ref.iframeWrapper.innerHTML="",this._iframe=null,this.$.selectedList=[],this.$.counter=0}};sr.template=b`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack"><uc-icon name="back"></uc-icon></button><div><uc-icon set="@name: activityIcon"></uc-icon><span>{{activityCaption}}</span></div><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *historyBack"><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ref="iframeWrapper" class="uc-iframe-wrapper"></div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" set="onclick: onCancel" l10n="cancel"></button><div></div><div set="@hidden: !multiple" class="uc-selected-counter"><span l10n="selected-count"></span>{{counter}}</div><button type="button" class="uc-done-btn uc-primary-btn" set="onclick: onDone; @disabled: !counter" l10n="done" ></button></div></div>`;var cs=class extends S{constructor(){super(...arguments);u(this,"requireCtxName",!0)}_createValidationInput(){let t=document.createElement("input");return t.type="text",t.name=this.ctxName,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,Wt(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this._validationInputElement=this._createValidationInput(),this.appendChild(this._validationInputElement),this.sub("*collectionState",t=>{var e;{if(this._dynamicInputsContainer||(this._dynamicInputsContainer=document.createElement("div"),this.appendChild(this._dynamicInputsContainer)),!this._validationInputElement){let l=this._createValidationInput();this.appendChild(l),this._validationInputElement=l}if(this._dynamicInputsContainer.innerHTML="",t.status==="uploading"||t.status==="idle"){this._validationInputElement.value="",this._validationInputElement.setCustomValidity("");return}if(t.status==="failed"){let l=(e=t.errors[0])==null?void 0:e.message;this._validationInputElement.value="",this._validationInputElement.setCustomValidity(l);return}let s=t.group?t.group:null;if(s){this._validationInputElement.value=s.cdnUrl,this._validationInputElement.setCustomValidity("");return}let o=t.allEntries.map(l=>l.cdnUrl);if(!this.cfg.multiple&&o.length===1){this._validationInputElement.value=o[0],this._validationInputElement.setCustomValidity("");return}this._validationInputElement.remove(),this._validationInputElement=null;let n=new DocumentFragment;for(let l of o){let a=document.createElement("input");a.type="hidden",a.name=`${this.ctxName}[]`,a.value=l,n.appendChild(a)}this._dynamicInputsContainer.replaceChildren(n)}},!1)}};var us=class extends v{};var or=class extends w{constructor(){super(...arguments);u(this,"init$",{...this.init$,currentText:"",options:[],selectHtml:"",onSelect:t=>{var e;t.preventDefault(),t.stopPropagation(),this.value=this.ref.select.value,this.$.currentText=((e=this.$.options.find(s=>s.value==this.value))==null?void 0:e.text)||"",this.dispatchEvent(new Event("change"))}})}initCallback(){super.initCallback(),this.defineAccessor("options",t=>{var s;this.$.currentText=((s=t==null?void 0:t[0])==null?void 0:s.text)||"";let e="";t==null||t.forEach(o=>{e+=b`<option value="${o.value}">${o.text}</option>`}),this.$.selectHtml=e})}};or.template=b`<select ref="select" set="innerHTML: selectHtml; onchange: onSelect"></select>`;var nr=class extends w{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i)})}};u(nr,"template",b`<a href="https://uploadcare.com/?utm_source=copyright&utm_medium=referral&utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`);var Je=class Je extends ft{constructor(){super(),this.init$={...this.init$,isHidden:!1}}initCallback(){super.initCallback(),this.defineAccessor("headless",i=>{this.set$({isHidden:L(i)})}),this.sub("*modalActive",i=>{this._lastModalActive!==i&&this.emit(i?I.MODAL_OPEN:I.MODAL_CLOSE,void 0,{debounce:!0}),this._lastModalActive=i},!1)}};u(Je,"styleAttrs",[...q(Je,Je,"styleAttrs"),"uc-file-uploader-regular"]);var Qe=Je;Qe.template=b`<uc-simple-btn set="@hidden: isHidden"></uc-simple-btn><uc-modal strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-secondary-btn" set="onclick: *historyBack"></button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-camera-source></uc-camera-source><uc-url-source></uc-url-source><uc-external-source></uc-external-source><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`;Qe.bindAttributes({headless:null});var ti=class ti extends ft{initCallback(){super.initCallback();let i=this.ref.uBlock;this.sub("*currentActivity",t=>{t||(this.$["*currentActivity"]=i.initActivity||v.activities.START_FROM)}),this.sub("*uploadList",t=>{(t==null?void 0:t.length)>0?this.$["*currentActivity"]=v.activities.UPLOAD_LIST:this.$["*currentActivity"]=i.initActivity||v.activities.START_FROM}),this.subConfigValue("sourceList",t=>{t!=="local"&&(this.cfg.sourceList="local")}),this.subConfigValue("confirmUpload",t=>{t!==!1&&(this.cfg.confirmUpload=!1)})}};u(ti,"styleAttrs",[...q(ti,ti,"styleAttrs"),"uc-file-uploader-minimal"]);var lr=ti;lr.template=b`<uc-start-from><uc-drop-area tabindex="0" clickable l10n="choose-file"></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list ref="uBlock"></uc-upload-list>`;var ei=class ei extends ft{constructor(){super(),this.init$={...this.init$,couldCancel:!1,cancel:()=>{this.couldHistoryBack?this.$["*historyBack"]():this.couldShowList&&(this.$["*currentActivity"]=v.activities.UPLOAD_LIST)}}}get couldHistoryBack(){let i=this.$["*history"];return i.length>1&&i[i.length-1]!==v.activities.START_FROM}get couldShowList(){return this.cfg.showEmptyList||this.$["*uploadList"].length>0}initCallback(){super.initCallback();let i=this.ref.uBlock;this.sub("*currentActivity",t=>{t||(this.$["*currentActivity"]=i.initActivity||v.activities.START_FROM)}),this.sub("*uploadList",t=>{(t==null?void 0:t.length)>0&&this.$["*currentActivity"]===(i.initActivity||v.activities.START_FROM)&&(this.$["*currentActivity"]=v.activities.UPLOAD_LIST)}),this.sub("*history",()=>{this.$.couldCancel=this.couldHistoryBack||this.couldShowList})}};u(ei,"styleAttrs",[...q(ei,ei,"styleAttrs"),"uc-file-uploader-inline"]);var ar=ei;ar.template=b`<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-cancel-btn uc-secondary-btn" set="onclick: cancel; @hidden: !couldCancel" ></button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list ref="uBlock"></uc-upload-list><uc-camera-source></uc-camera-source><uc-url-source></uc-url-source><uc-external-source></uc-external-source><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>`;var ii=class ii extends yt{initCallback(){var i;super.initCallback(),(i=this.a11y)==null||i.registerBlock(this)}};u(ii,"styleAttrs",[...q(ii,ii,"styleAttrs"),"uc-wgt-common"]);var hs=ii;var rc=["Symbiote","BaseComponent","UploaderBlock","ActivityBlock","Block","SolutionBlock"];function ds(r){for(let i in r){if(rc.includes(i))continue;let t=[...i].reduce((e,s)=>(s.toUpperCase()===s&&(s="-"+s.toLowerCase()),e+=s),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("uc-")||(t="uc-"+t),r[i].reg&&r[i].reg(t)}}var ps="UC";async function sc(r,i=!1){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[ps]){t(window[ps]);return}let s=document.createElement("script");s.async=!0,s.src=r,s.onerror=()=>{e()},s.onload=()=>{let o=window[ps];i&&ds(o),t(o)},document.head.appendChild(s)})}export{v as ActivityBlock,us as ActivityHeader,xt as BaseComponent,w as Block,Ye as BtnUi,Gi as CameraSource,hs as CloudImageEditor,as as CloudImageEditorActivity,yt as CloudImageEditorBlock,ha as Config,nr as Copyright,qi as CropFrame,$ as Data,Ve as DropArea,Xe as EditorCropButtonControl,be as EditorFilterControl,Yi as EditorImageCropper,ls as EditorImageFader,Ze as EditorOperationControl,Ji as EditorScroller,Zi as EditorSlider,Qi as EditorToolbar,sr as ExternalSource,Ge as FileItem,ar as FileUploaderInline,lr as FileUploaderMinimal,Qe as FileUploaderRegular,cs as FormInput,Fe as Icon,Qr as Img,tr as LineLoaderUi,zi as Modal,he as PACKAGE_NAME,de as PACKAGE_VERSION,ir as PresenceToggle,Ki as ProgressBar,Wi as ProgressBarCommon,$ as PubSub,or as Select,Be as SimpleBtn,rr as SliderUi,ft as SolutionBlock,He as SourceBtn,is as SourceList,Di as StartFrom,xt as Symbiote,nt as UID,ja as UploadCtxProvider,Hi as UploadList,S as UploaderBlock,ji as UrlSource,ds as defineComponents,ro as defineLocale,b as html,sc as loadFileUploaderFrom,Pe as toKebabCase};
27
+ var wn=Object.defineProperty;var Cn=Object.getPrototypeOf;var xn=Reflect.get;var En=(r,i,t)=>i in r?wn(r,i,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[i]=t;var u=(r,i,t)=>(En(r,typeof i!="symbol"?i+"":i,t),t),hr=(r,i,t)=>{if(!i.has(r))throw TypeError("Cannot "+t)};var _=(r,i,t)=>(hr(r,i,"read from private field"),t?t.call(r):i.get(r)),O=(r,i,t)=>{if(i.has(r))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(r):i.set(r,t)},F=(r,i,t,e)=>(hr(r,i,"write to private field"),e?e.call(r,t):i.set(r,t),t);var P=(r,i,t)=>(hr(r,i,"access private method"),t),q=(r,i,t)=>xn(Cn(r),t,i);var g={BIND_ATTR:"bind",ATTR_BIND_PX:"@",SHARED_CTX_PX:"*",PARENT_CTX_PX:"^",NAMED_CTX_SPLTR:"/",COMPUTED_PX:"+",CSS_DATA_PX:"--",CTX_NAME_ATTR:"ctx",CTX_OWNER_ATTR:"ctx-owner",CSS_CTX_PROP:"--ctx",EL_REF_ATTR:"ref",AUTO_TAG_PX:"sym",LIST_ATTR:"itemize",LIST_ITEM_TAG_ATTR:"item-tag",SET_LATER_KEY:"__toSetLater__",USE_TPL_ATTR:"use-template",DEFAULT_SLOT_KEY:"__default__",TEXT_NODE_SKIP_ATTR:"skip-text-nodes",TEXT_NODE_OPEN_TOKEN:"{{",TEXT_NODE_CLOSE_TOKEN:"}}"};function An(r){let i=t=>{var e;for(let s in t)((e=t[s])==null?void 0:e.constructor)===Object&&(t[s]=i(t[s]));return{...t}};return i(r)}var te,ee,Ot,Lt,Qt,si,ms,H=class H{constructor(i){O(this,te,void 0);O(this,ee,void 0);O(this,Ot,void 0);i.constructor===Object?this.store=An(i):(F(this,Ot,!0),this.store=i),this.callbackMap=Object.create(null)}read(i){var t,e;if(!_(this,Ot)&&!this.store.hasOwnProperty(i))return P(t=H,Lt,Qt).call(t,"read",i),null;if(typeof i=="string"&&i.startsWith(g.COMPUTED_PX)){let s=this.store[i];if((s==null?void 0:s.constructor)!==Function){P(e=H,Lt,Qt).call(e,"compute",i);return}this.__computedMap||(this.__computedMap={});let o=s();return Object.keys(this.__computedMap).includes(i)||(this.__computedMap[i]=o,this.notify(i)),o}else return this.store[i]}has(i){return _(this,Ot)?this.store[i]!==void 0:this.store.hasOwnProperty(i)}add(i,t,e=!1){!e&&Object.keys(this.store).includes(i)||(this.store[i]=t,this.notify(i))}pub(i,t){var e,s;if(!_(this,Ot)&&!this.store.hasOwnProperty(i)){P(e=H,Lt,Qt).call(e,"publish",i);return}if(i!=null&&i.startsWith(g.COMPUTED_PX)&&t.constructor!==Function){P(s=H,Lt,Qt).call(s,"publish computed",i);return}!(this.store[i]===null||t===null)&&typeof this.store[i]!=typeof t&&console.warn(`Symbiote PubSub: type warning for "${i}" [${typeof this.store[i]} -> ${typeof t}]`),this.store[i]=t,this.notify(i)}get proxy(){if(!_(this,ee)){let i=Object.create(null);F(this,ee,new Proxy(i,{set:(t,e,s)=>(this.pub(e,s),!0),get:(t,e)=>{this.read(e)}}))}return _(this,ee)}multiPub(i){for(let t in i)this.pub(t,i[t])}notify(i){var e;let t=i==null?void 0:i.startsWith(g.COMPUTED_PX);if(this.callbackMap[i]){let s=this.read(i);this.callbackMap[i].forEach(o=>{o(s)}),t&&(this.__computedMap[i]=s)}!t&&P(e=H,si,ms).call(e,this,i)}sub(i,t,e=!0){var s;return!_(this,Ot)&&!this.store.hasOwnProperty(i)?(P(s=H,Lt,Qt).call(s,"subscribe",i),null):(this.callbackMap[i]||(this.callbackMap[i]=new Set),this.callbackMap[i].add(t),e&&t(this.read(i)),{remove:()=>{this.callbackMap[i].delete(t),this.callbackMap[i].size||delete this.callbackMap[i]},callback:t})}set uid(i){!_(this,te)&&F(this,te,i)}get uid(){return _(this,te)}static registerCtx(i,t=Symbol()){let e=H.globalStore.get(t);return e?console.warn('PubSub: context UID "'+t+'" is already in use'):(e=new H(i),e.uid=t,H.globalStore.set(t,e)),e}static deleteCtx(i){H.globalStore.delete(i)}static getCtx(i,t=!0){return H.globalStore.get(i)||(t&&console.warn('PubSub: wrong context UID - "'+i+'"'),null)}};te=new WeakMap,ee=new WeakMap,Ot=new WeakMap,Lt=new WeakSet,Qt=function(i,t){console.warn(`Symbiote PubSub: cannot ${i}. Prop name: `+t)},si=new WeakSet,ms=function(i,t){this.globalStore.forEach(e=>{e.__computedMap&&Object.keys(e.__computedMap).forEach(s=>{if(e===i&&t===s)return;let o=`__${s}_timeout`;e[o]&&window.clearTimeout(e[o]),e[o]=window.setTimeout(()=>{let n=e.read(s);n!==e.__computedMap[s]&&(e.__computedMap[s]=n,e.notify(s))})})})},O(H,Lt),O(H,si);var $=H;$.globalStore=new Map;var wt=$;var gs="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",Tn=gs.length-1,nt=class{static generate(i="XXXXXXXXX-XXX"){let t="";for(let e=0;e<i.length;e++)t+=i[e]==="-"?i[e]:gs.charAt(Math.random()*Tn);return t}};function _e(r,i,t){let e=!0,s,o=i.split(".");return o.forEach((n,l)=>{l<o.length-1?r=r[n]:s=n}),r?r[s]=t:e=!1,e}function dr(r){let i;return r.constructor===CSSStyleSheet?i=r:r.constructor===String&&(i=new CSSStyleSheet,i.replaceSync(r)),i}function bs(r,i){[...r.querySelectorAll(`[${g.LIST_ATTR}]`)].filter(t=>!t.matches(`[${g.LIST_ATTR}] [${g.LIST_ATTR}]`)).forEach(t=>{var n;let e=t.getAttribute(g.LIST_ITEM_TAG_ATTR),s;for(e&&(s=window.customElements.get(e)),s||(s=class extends i.Symbiote{constructor(){super(),e||(this.style.display="contents")}},s.template=((n=t.querySelector("template"))==null?void 0:n.innerHTML)||t.innerHTML,s.reg(e));t.firstChild;)t.firstChild.remove();let o=t.getAttribute(g.LIST_ATTR);i.sub(o,l=>{if(!l){for(;t.firstChild;)t.firstChild.remove();return}let a=[...t.children],c,d=h=>{h.forEach((f,m)=>{if(a[m])if(a[m].set$)a[m].set$(f);else for(let y in f)a[m][y]=f[y];else{c||(c=new DocumentFragment);let y=new s;Object.assign((y==null?void 0:y.init$)||y,f),c.appendChild(y)}}),c&&t.appendChild(c);let p=a.slice(h.length,a.length);for(let f of p)f.remove()};if(l.constructor===Array)d(l);else if(l.constructor===Object){let h=[];for(let p in l){let f=l[p];Object.defineProperty(f,"_KEY_",{value:p,enumerable:!0}),h.push(f)}d(h)}else console.warn("Symbiote list data type error:"),console.log(l)}),t.removeAttribute(g.LIST_ATTR),t.removeAttribute(g.LIST_ITEM_TAG_ATTR)})}function Sn(r,i){[...r.querySelectorAll(`[${g.EL_REF_ATTR}]`)].forEach(t=>{let e=t.getAttribute(g.EL_REF_ATTR);i.ref[e]=t,t.removeAttribute(g.EL_REF_ATTR)})}function kn(r,i){[...r.querySelectorAll(`[${g.BIND_ATTR}]`)].forEach(t=>{t.getAttribute(g.BIND_ATTR).split(";").forEach(o=>{if(!o)return;let n=o.split(":").map(d=>d.trim()),l=n[0],a;l.indexOf(g.ATTR_BIND_PX)===0&&(a=!0,l=l.replace(g.ATTR_BIND_PX,""));let c=n[1].split(",").map(d=>d.trim());for(let d of c){let h;d.startsWith("!!")?(h="double",d=d.replace("!!","")):d.startsWith("!")&&(h="single",d=d.replace("!","")),!i.has(d)&&i.allowTemplateInits&&(d.startsWith(g.ATTR_BIND_PX)?i.add(d,i.getAttribute(d.replace(g.ATTR_BIND_PX,""))):i.add(d,null)),i.sub(d,p=>{h==="double"?p=!!p:h==="single"&&(p=!p),a?(p==null?void 0:p.constructor)===Boolean?p?t.setAttribute(l,""):t.removeAttribute(l):t.setAttribute(l,p):_e(t,l,p)||(t[g.SET_LATER_KEY]||(t[g.SET_LATER_KEY]=Object.create(null)),t[g.SET_LATER_KEY][l]=p)},!(i.ssrMode&&(l==="textContent"||a)))}}),t.removeAttribute(g.BIND_ATTR)})}function $n(r){let i,t=[],e=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,{acceptNode:s=>{var o;return!((o=s.parentElement)!=null&&o.hasAttribute(g.TEXT_NODE_SKIP_ATTR))&&s.textContent.includes(g.TEXT_NODE_OPEN_TOKEN)&&s.textContent.includes(g.TEXT_NODE_CLOSE_TOKEN)&&1}});for(;i=e.nextNode();)t.push(i);return t}var In=function(r,i){$n(r).forEach(e=>{let s=[],o;for(;e.textContent.includes(g.TEXT_NODE_CLOSE_TOKEN);)e.textContent.startsWith(g.TEXT_NODE_OPEN_TOKEN)?(o=e.textContent.indexOf(g.TEXT_NODE_CLOSE_TOKEN)+g.TEXT_NODE_CLOSE_TOKEN.length,e.splitText(o),s.push(e)):(o=e.textContent.indexOf(g.TEXT_NODE_OPEN_TOKEN),e.splitText(o)),e=e.nextSibling;s.forEach(n=>{let l=n.textContent.replace(g.TEXT_NODE_OPEN_TOKEN,"").replace(g.TEXT_NODE_CLOSE_TOKEN,"");n.textContent="",!i.has(l)&&i.allowTemplateInits&&(l.startsWith(g.ATTR_BIND_PX)?(i.add(l,i.getAttribute(l.replace(g.ATTR_BIND_PX,""))),i.initAttributeObserver()):i.add(l,null)),i.sub(l,a=>{n.textContent=a})})})},ys=[bs,Sn,kn,In];var oi="'",ie='"',On=/\\([0-9a-fA-F]{1,6} ?)/g;function Ln(r){return(r[0]===ie||r[0]===oi)&&(r[r.length-1]===ie||r[r.length-1]===oi)}function Un(r){return(r[0]===ie||r[0]===oi)&&(r=r.slice(1)),(r[r.length-1]===ie||r[r.length-1]===oi)&&(r=r.slice(0,-1)),r}function Mn(r){let i="",t="";for(var 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 _s(r){let i=r;Ln(r)&&(i=Un(i),i=i.replace(On,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\
28
+ `,"\\n"),i=Mn(i),i=ie+i+ie);try{return JSON.parse(i)}catch{throw new Error(`Failed to parse CSS property value: ${i}. Original input: ${r}`)}}var Pn=[g.LIST_ATTR,g.LIST_ITEM_TAG_ATTR,g.EL_REF_ATTR,g.USE_TPL_ATTR,g.CTX_NAME_ATTR,g.CTX_OWNER_ATTR];function b(r,...i){let t="";return r.forEach((e,s)=>{var o;if(t+=e,((o=i[s])==null?void 0:o.constructor)===Object){let n="";for(let l in i[s])Pn.includes(l)?t+=` ${l}="${i[s][l]}"`:n+=`${l}:${i[s][l]};`;n&&(t+=` ${g.BIND_ATTR}="${n}"`)}else i[s]&&(t+=i[s])}),t}function lt(r,...i){let t="",e=new CSSStyleSheet;return r.forEach((s,o)=>{t+=s+i[o]}),lt.processors.forEach(s=>{t=s(t)}),lt.clearProcessors(),e.replaceSync(t),e}lt.processors=[];lt.clearProcessors=function(){lt.processors=[]};lt.useProcessor=function(...r){return lt.processors=[...lt.processors,...r],lt};var vs=0,ve,jt,we,Ut,re,Ce,Mt,dt,Gt,Xt,D,xe,fr,Ct,Ht,ni,ws,li,Cs,Ee,mr,ai,xs,Ae,gr,it=class it extends HTMLElement{constructor(){super();O(this,xe);O(this,ni);O(this,li);O(this,Ee);O(this,ai);O(this,Ae);O(this,ve,void 0);O(this,jt,void 0);O(this,we,void 0);O(this,Ut,void 0);O(this,re,void 0);O(this,Ce,void 0);O(this,Mt,void 0);O(this,dt,void 0);O(this,Gt,void 0);O(this,Xt,void 0);O(this,D,this.constructor);u(this,"updateCssData",()=>{var t;this.dropCssDataCache(),(t=_(this,Xt))==null||t.forEach(e=>{let s=this.getCssData(P(this,Ae,gr).call(this,e),!0);s!==null&&this.$[e]!==s&&(this.$[e]=s)})});this.init$=Object.create(null),this.cssInit$=Object.create(null),this.tplProcessors=new Set,this.ref=Object.create(null),this.allSubs=new Set,this.pauseRender=!1,this.renderShadow=!1,this.readyToDestroy=!0,this.processInnerHtml=!1,this.ssrMode=!1,this.allowCustomTemplate=!1,this.ctxOwner=!1,this.isVirtual=!1,this.allowTemplateInits=!0}get Symbiote(){return it}initCallback(){}renderCallback(){}render(t,e=this.renderShadow){let s;if((e||_(this,D).shadowStyleSheets)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let n=this.getAttribute(g.USE_TPL_ATTR);if(n){let l=this.getRootNode(),a=(l==null?void 0:l.querySelector(n))||document.querySelector(n);a?t=a.content.cloneNode(!0):console.warn(`Symbiote template "${n}" is not found...`)}}if(this.processInnerHtml||this.ssrMode)for(let n of this.tplProcessors)n(this,this);if(t||_(this,D).template){if(_(this,D).template&&!_(this,D).__tpl&&(_(this,D).__tpl=document.createElement("template"),_(this,D).__tpl.innerHTML=_(this,D).template),(t==null?void 0:t.constructor)===DocumentFragment)s=t;else if((t==null?void 0:t.constructor)===String){let n=document.createElement("template");n.innerHTML=t,s=n.content.cloneNode(!0)}else _(this,D).__tpl&&(s=_(this,D).__tpl.content.cloneNode(!0));for(let n of this.tplProcessors)n(s,this)}let o=()=>{var n;s&&this.isVirtual?this.replaceWith(s):s&&(e&&this.shadowRoot.appendChild(s)||this.appendChild(s)),P(this,xe,fr).call(this),(n=this.renderCallback)==null||n.call(this)};_(this,D).shadowStyleSheets&&(e=!0,this.shadowRoot.adoptedStyleSheets=[..._(this,D).shadowStyleSheets]),o()}addTemplateProcessor(t){this.tplProcessors.add(t)}get autoCtxName(){return _(this,jt)||(F(this,jt,nt.generate()),this.style.setProperty(g.CSS_CTX_PROP,`'${_(this,jt)}'`)),_(this,jt)}get cssCtxName(){return this.getCssData(g.CSS_CTX_PROP,!0)}get ctxName(){var e;let t=((e=this.getAttribute(g.CTX_NAME_ATTR))==null?void 0:e.trim())||this.cssCtxName||_(this,we)||this.autoCtxName;return F(this,we,t),t}get localCtx(){return _(this,Ut)||F(this,Ut,wt.registerCtx({})),_(this,Ut)}get sharedCtx(){return wt.getCtx(this.ctxName,!1)||wt.registerCtx({},this.ctxName)}sub(t,e,s=!0){var l;let o=a=>{_(this,Ee,mr)||e(a)},n=P(l=it,Ct,Ht).call(l,t,this);n.ctx.has(n.name)?this.allSubs.add(n.ctx.sub(n.name,o,s)):window.setTimeout(()=>{this.allSubs.add(n.ctx.sub(n.name,o,s))})}notify(t){var s;let e=P(s=it,Ct,Ht).call(s,t,this);e.ctx.notify(e.name)}has(t){var s;let e=P(s=it,Ct,Ht).call(s,t,this);return e.ctx.has(e.name)}add(t,e,s=!1){var n;let o=P(n=it,Ct,Ht).call(n,t,this);o.ctx.add(o.name,e,s)}add$(t,e=!1){for(let s in t)this.add(s,t[s],e)}get $(){if(!_(this,re)){let t=Object.create(null);F(this,re,new Proxy(t,{set:(e,s,o)=>{var l;let n=P(l=it,Ct,Ht).call(l,s,this);return n.ctx.pub(n.name,o),!0},get:(e,s)=>{var n;let o=P(n=it,Ct,Ht).call(n,s,this);return o.ctx.read(o.name)}}))}return _(this,re)}set$(t,e=!1){for(let s in t){let o=t[s];e||![String,Number,Boolean].includes(o==null?void 0:o.constructor)?this.$[s]=o:this.$[s]!==o&&(this.$[s]=o)}}initAttributeObserver(){this.attributeMutationObserver||(this.attributeMutationObserver=new MutationObserver(t=>{for(let e of t)if(e.type==="attributes"){let s=g.ATTR_BIND_PX+e.attributeName;this.has(s)&&(this.$[s]=this.getAttribute(e.attributeName))}}),this.attributeMutationObserver.observe(this,{attributes:!0}))}connectedCallback(){P(this,ai,xs).call(this)}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(_(this,Mt)&&window.clearTimeout(_(this,Mt)),F(this,Mt,window.setTimeout(()=>{this.destroyCallback(),this.attributeMutationObserver&&this.attributeMutationObserver.disconnect();for(let t of this.allSubs)t.remove(),this.allSubs.delete(t);_(this,Ut)&&wt.deleteCtx(_(this,Ut).uid);for(let t of this.tplProcessors)this.tplProcessors.delete(t)},100))))}static reg(t,e=!1){t||(vs++,t=`${g.AUTO_TAG_PX}-${vs}`),this.__tag=t;let s=window.customElements.get(t);if(s){!e&&s!==this&&console.warn([`Element with tag name "${t}" 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(`
29
+ `));return}window.customElements.define(t,e?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(t){this.observedAttributes=[...new Set((this.observedAttributes||[]).concat(Object.keys(t)))],this.__attrDesc=t}attributeChangedCallback(t,e,s){var n;if(e===s)return;let o=(n=_(this,D).__attrDesc)==null?void 0:n[t];o?_(this,Ce)?this.$[o]=s:this.init$[o]=s:this[t]=s}getCssData(t,e=!1){if(_(this,dt)||F(this,dt,Object.create(null)),!Object.keys(_(this,dt)).includes(t)){_(this,Gt)||F(this,Gt,window.getComputedStyle(this));let s=_(this,Gt).getPropertyValue(t).trim();try{_(this,dt)[t]=_s(s)}catch{!e&&console.warn(`CSS Data error: ${t}`),_(this,dt)[t]=null}}return _(this,dt)[t]}bindCssData(t,e=""){_(this,Xt)||F(this,Xt,new Set),_(this,Xt).add(t);let s=this.getCssData(P(this,Ae,gr).call(this,t),!0);s===null&&(s=e),t.startsWith(g.CSS_DATA_PX)?this.localCtx.add(t,s):this.add(t,s)}dropCssDataCache(){F(this,dt,null),F(this,Gt,null)}defineAccessor(t,e,s){let o="#"+t;this[o]=this[t],Object.defineProperty(this,t,{set:n=>{this[o]=n,s?window.setTimeout(()=>{e==null||e(n)}):e==null||e(n)},get:()=>this[o]}),this[t]=this[o]}static addRootStyles(t){this.rootStyleSheets||(this.rootStyleSheets=[]),this.rootStyleSheets.push(dr(t))}static addShadowStyles(t){this.shadowStyleSheets||(this.shadowStyleSheets=[]),this.shadowStyleSheets.push(dr(t))}static set rootStyles(t){this.rootStyleSheets=[],this.addRootStyles(t)}static set shadowStyles(t){this.shadowStyleSheets=[],this.addShadowStyles(t)}};ve=new WeakMap,jt=new WeakMap,we=new WeakMap,Ut=new WeakMap,re=new WeakMap,Ce=new WeakMap,Mt=new WeakMap,dt=new WeakMap,Gt=new WeakMap,Xt=new WeakMap,D=new WeakMap,xe=new WeakSet,fr=function(){var t;_(this,ve)||(F(this,ve,!0),(t=this.initCallback)==null||t.call(this))},Ct=new WeakSet,Ht=function(t,e){var n;let s,o;if(t.startsWith(g.SHARED_CTX_PX))s=e.sharedCtx,o=t.replace(g.SHARED_CTX_PX,"");else if(t.startsWith(g.PARENT_CTX_PX)){o=t.replace(g.PARENT_CTX_PX,"");let l=e;for(;l&&!((n=l==null?void 0:l.has)!=null&&n.call(l,o));)l=l.parentElement||l.parentNode||l.host;s=(l==null?void 0:l.localCtx)||e.localCtx}else if(t.includes(g.NAMED_CTX_SPLTR)){let l=t.split(g.NAMED_CTX_SPLTR);s=wt.getCtx(l[0]),o=l[1]}else t.startsWith(g.CSS_DATA_PX)?(s=e.localCtx,o=t,s.has(o)||e.bindCssData(o)):(s=e.localCtx,o=t);return{ctx:s,name:o}},ni=new WeakSet,ws=function(){return this.ctxOwner||this.hasAttribute(g.CTX_OWNER_ATTR)&&this.getAttribute(g.CTX_OWNER_ATTR)!=="false"},li=new WeakSet,Cs=function(){let t=_(this,D).__attrDesc;if(t)for(let e of Object.values(t))Object.keys(this.init$).includes(e)||(this.init$[e]="");for(let e in this.init$)if(e.startsWith(g.SHARED_CTX_PX))this.sharedCtx.add(e.replace(g.SHARED_CTX_PX,""),this.init$[e],_(this,ni,ws));else if(e.startsWith(g.ATTR_BIND_PX))this.localCtx.add(e,this.getAttribute(e.replace(g.ATTR_BIND_PX,""))||this.init$[e]),this.initAttributeObserver();else if(e.includes(g.NAMED_CTX_SPLTR)){let s=e.split(g.NAMED_CTX_SPLTR),o=s[0].trim(),n=s[1].trim();if(o&&n){let l=wt.getCtx(o,!1);l||(l=wt.registerCtx({},o)),l.add(n,this.init$[e])}}else this.localCtx.add(e,this.init$[e]);for(let e in this.cssInit$)this.bindCssData(e,this.cssInit$[e]);F(this,Ce,!0)},Ee=new WeakSet,mr=function(){return!this.isVirtual&&!this.isConnected},ai=new WeakSet,xs=function(){var t;if(!_(this,Ee,mr)){if(_(this,Mt)&&window.clearTimeout(_(this,Mt)),!this.connectedOnce){let e=(t=this.getAttribute(g.CTX_NAME_ATTR))==null?void 0:t.trim();if(e&&this.style.setProperty(g.CSS_CTX_PROP,`'${e}'`),P(this,li,Cs).call(this),this[g.SET_LATER_KEY]){for(let s in this[g.SET_LATER_KEY])_e(this,s,this[g.SET_LATER_KEY][s]);delete this[g.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let s of ys)this.addTemplateProcessor(s);if(this.pauseRender)P(this,xe,fr).call(this);else{if(_(this,D).rootStyleSheets){let s=this.getRootNode();if(!s)return;let o=new Set([...s.adoptedStyleSheets,..._(this,D).rootStyleSheets]);s.adoptedStyleSheets=[...o]}this.render()}}this.connectedOnce=!0}},Ae=new WeakSet,gr=function(t){return t.split("--").map((e,s)=>s===0?"":e).join("--")},O(it,Ct),u(it,"__tpl"),u(it,"template");var pr=it,xt=pr;function Wt(r,i){for(let t in i)t.includes("-")?r.style.setProperty(t,i[t]):r.style[t]=i[t]}function Es(r,i){for(let t in i)i[t].constructor===Boolean?i[t]?r.setAttribute(t,""):r.removeAttribute(t):r.setAttribute(t,i[t])}function Te(r={tag:"div"}){let i=document.createElement(r.tag);if(r.attributes&&Es(i,r.attributes),r.styles&&Wt(i,r.styles),r.properties)for(let t in r.properties)i[t]=r.properties[t];return r.processors&&r.processors.forEach(t=>{t(i)}),r.children&&r.children.forEach(t=>{let e=Te(t);i.appendChild(e)}),i}function br(r){return Object.assign(g,r),g}function yr(r,i){if(i.shadowRoot)return;let t=[...r.querySelectorAll("slot")];if(!t.length)return;let e={};t.forEach(s=>{let o=s.getAttribute("name")||g.DEFAULT_SLOT_KEY;e[o]={slot:s,fr:document.createDocumentFragment()}}),i.initChildren.forEach(s=>{var n;let o=g.DEFAULT_SLOT_KEY;s instanceof Element&&s.hasAttribute("slot")&&(o=s.getAttribute("slot"),s.removeAttribute("slot")),(n=e[o])==null||n.fr.appendChild(s)}),Object.values(e).forEach(s=>{if(s.fr.childNodes.length)s.slot.parentNode.replaceChild(s.fr,s.slot);else if(s.slot.childNodes.length){let o=document.createDocumentFragment();o.append(...s.slot.childNodes),s.slot.parentNode.replaceChild(o,s.slot)}else s.slot.remove()})}var Se=br({BIND_ATTR:"set",CTX_NAME_ATTR:"ctx-name",CSS_CTX_PROP:"--ctx-name"});var As=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},ci=(...r)=>r.filter(i=>typeof i=="string"&&i).map(i=>As(i)).join("/-/"),j=(...r)=>{let i=ci(...r);return i?`-/${i}/`:""};function ui(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 hi(r){let i=new URL(r),{pathname:t}=i,e=t.indexOf("/"),s=t.indexOf("/",e+1);return t.substring(e+1,s)}function _r(r){let i=Ss(r),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}function Ts(r){return _r(r).split("/-/").filter(Boolean).map(t=>As(t))}function Ss(r){let i=new URL(r),t=ui(r),e=ks(t)?$s(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function ks(r){return r.startsWith("http")}function $s(r){let i=new URL(r);return{pathname:i.origin+i.pathname||"",search:i.search||"",hash:i.hash||""}}var R=(r,i,t)=>{let e=new URL(Ss(r));if(t=t||ui(r),e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),ks(t)){let s=$s(t);e.pathname=e.pathname+(i||"")+(s.pathname||""),e.search=s.search,e.hash=s.hash}else e.pathname=e.pathname+(i||"")+(t||"");return e.toString()},Pt=(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 tt=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:!1,flip:!1,crop:void 0}),Os=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Rn(r,i){if(typeof i=="number"){let t=i;return tt[r]!==t?`${r}/${t}`:""}if(typeof i=="boolean"){let t=i;return tt[r]!==t?`${r}`:""}if(r==="filter"&&i){let{name:t,amount:e}=i;return tt.filter===e?"":`${r}/${t}/${e}`}if(r==="crop"&&i){let{dimensions:t,coords:e}=i;return`${r}/${t.join("x")}/${e.join(",")}`}return""}function Rt(r){return ci(...Os.filter(i=>typeof r[i]!="undefined"&&r[i]!==null).map(i=>{let t=r[i];return Rn(i,t)}).filter(i=>!!i))}var di=ci("format/auto","progressive/yes"),Et=([r])=>typeof r!="undefined"?Number(r):void 0,Is=()=>!0,Fn=([r,i])=>({name:r,amount:typeof i!="undefined"?Number(i):100}),Dn=([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)}},Nn=Object.freeze({enhance:Et,brightness:Et,exposure:Et,gamma:Et,contrast:Et,saturation:Et,vibrance:Et,warmth:Et,filter:Fn,mirror:Is,flip:Is,rotate:Et,crop:Dn});function Ls(r){let i={};for(let t of r){let[e,...s]=t.split("/");if(!Os.includes(e))continue;let o=e,n=Nn[o];try{let l=n(s);i[o]=l}catch(l){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,l instanceof Error?`Error message: "${l.message}"`:l,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(`
30
+ `))}}return i}var U=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),Z=[U.CROP,U.TUNING,U.FILTERS],Us=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],Ms=["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"],Ps=["rotate","mirror","flip"],pt=Object.freeze({brightness:{zero:tt.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:tt.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:tt.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:tt.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:tt.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:tt.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:tt.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:tt.enhance,range:[0,100],keypointsNumber:1},filter:{zero:tt.filter,range:[0,100],keypointsNumber:1}});var Rs=r=>r?r.split(",").map(i=>i.trim()):[],se=r=>r?r.join(","):"";var Bn="https://ucarecdn.com",zn="https://upload.uploadcare.com",Vn="https://social.uploadcare.com",at={pubkey:"",multiple:!0,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:!1,imgOnly:!1,accept:"",externalSourcesPreferredTypes:"",store:"auto",cameraMirror:!1,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",cloudImageEditorTabs:se(Z),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",imageShrink:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:Bn,baseUrl:zn,socialBaseUrl:Vn,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:1,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:!1,saveUrlForRecurrentUploads:!1,groupOutput:!1,userAgentIntegration:"",debug:!1,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:10*60*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[]};var I=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"}),pi=class{constructor(i){u(this,"_timeoutStore",new Map);u(this,"_targets",new Set);u(this,"_debugPrint",null);this._debugPrint=i}bindTarget(i){this._targets.add(i)}unbindTarget(i){this._targets.delete(i)}_dispatch(i,t){var e;for(let s of this._targets)s.dispatchEvent(new CustomEvent(i,{detail:t}));(e=this._debugPrint)==null||e.call(this,()=>{let s=t&&typeof t=="object"?{...t}:t;return[`event "${i}"`,s]})}emit(i,t,{debounce:e}={}){if(typeof e!="number"&&!e){this._dispatch(i,typeof t=="function"?t():t);return}this._timeoutStore.has(i)&&window.clearTimeout(this._timeoutStore.get(i));let s=typeof e=="number"?e:20,o=window.setTimeout(()=>{this._dispatch(i,typeof t=="function"?t():t),this._timeoutStore.delete(i)},s);this._timeoutStore.set(i,o)}};function M(r,i){let t,e=(...s)=>{clearTimeout(t),t=setTimeout(()=>r(...s),i)};return e.cancel=()=>{clearTimeout(t)},e}var Fs="--uploadcare-blocks-window-height",Kt=class{static registerClient(i){this.clientsRegistry.size===0&&this.attachTracker(),this.clientsRegistry.add(i)}static unregisterClient(i){this.clientsRegistry.delete(i),this.clientsRegistry.size===0&&this.detachTracker()}static attachTracker(){window.addEventListener("resize",this.flush,{passive:!0,capture:!0}),this.flush()}static detachTracker(){window.removeEventListener("resize",this.flush,{capture:!0}),document.documentElement.style.removeProperty(Fs)}};u(Kt,"clientsRegistry",new Set),u(Kt,"flush",M(()=>{document.documentElement.style.setProperty(Fs,`${window.innerHeight}px`)},100));var Ds=r=>{var e;let i=new Intl.Locale(r),t="ltr";return typeof i.getTextInfo=="function"&&i.getTextInfo().direction?t=i.getTextInfo().direction:"textInfo"in i&&((e=i.textInfo)!=null&&e.direction)&&(t=i.textInfo.direction),t};var fi=(r,i)=>new Intl.PluralRules(r).select(i);var Hn=r=>r,vr="{{",Bs="}}",Ns="plural:";function ke(r,i,t={}){var n;let{openToken:e=vr,closeToken:s=Bs,transform:o=Hn}=t;for(let l in i){let a=(n=i[l])==null?void 0:n.toString();r=r.replaceAll(e+l+s,typeof a=="string"?o(a):a)}return r}function zs(r){let i=[],t=r.indexOf(vr);for(;t!==-1;){let e=r.indexOf(Bs,t),s=r.substring(t+2,e);if(s.startsWith(Ns)){let o=r.substring(t+2,e).replace(Ns,""),n=o.substring(0,o.indexOf("(")),l=o.substring(o.indexOf("(")+1,o.indexOf(")"));i.push({variable:s,pluralKey:n,countVariable:l})}t=r.indexOf(vr,e)}return i}function Vs(){let r,i,t=new Promise((e,s)=>{r=e,i=s});return{resolve:r,reject:i,promise:t}}var Hs=async({element:r,attribute:i,timeout:t=300})=>{let{promise:e,resolve:s}=Vs(),o=r.getAttribute(i);if(o!==null)return s({success:!0,value:o,attribute:i}),e;let n=new MutationObserver(c=>{let d=c[c.length-1];a(d)});n.observe(r,{attributes:!0,attributeFilter:[i]});let l=setTimeout(()=>{n.disconnect(),s({success:!1,attribute:i})},t),a=c=>{let d=r.getAttribute(i);c.type==="attributes"&&c.attributeName===i&&d!==null&&(clearTimeout(l),n.disconnect(),s({success:!0,value:d,attribute:i}))};return e};function js(r){return Object.prototype.toString.call(r)==="[object Object]"}var jn=/\W|_/g;function Gn(r){return r.split(jn).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}function Gs(r,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(r)?r.map(t=>St(t,{ignoreKeys:i})):r}function St(r,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(r))return Gs(r,{ignoreKeys:i});if(!js(r))return r;let t={};for(let e of Object.keys(r)){let s=r[e];if(i.includes(e)){t[e]=s;continue}js(s)?s=St(s,{ignoreKeys:i}):Array.isArray(s)&&(s=Gs(s,{ignoreKeys:i})),t[Gn(e)]=s}return t}var Xn=r=>new Promise(i=>setTimeout(i,r));function Sr({libraryName:r,libraryVersion:i,userAgent:t,publicKey:e="",integration:s=""}){let o="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:r,libraryVersion:i,languageName:o,integration:s});let n=[r,i,e].filter(Boolean).join("/"),l=[o,s].filter(Boolean).join("; ");return`${n} (${l})`}var Wn={factor:2,time:100};function Kn(r,i=Wn){let t=0;function e(s){let o=Math.round(i.time*i.factor**t);return s({attempt:t,retry:l=>Xn(l!=null?l:o).then(()=>(t+=1,e(s)))})}return e(r)}var $e=class extends Error{},oe=class r extends $e{constructor(t){super();u(this,"originalProgressEvent");this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,r.prototype),this.originalProgressEvent=t}},gi=(r,i)=>{r&&(r.aborted?Promise.resolve().then(i):r.addEventListener("abort",()=>i(),{once:!0}))},Ft=class r extends $e{constructor(t="Request canceled"){super(t);u(this,"isCancel",!0);this.name="CancelError",Object.setPrototypeOf(this,r.prototype)}},qn=500,Ws=({check:r,interval:i=qn,timeout:t,signal:e})=>new Promise((s,o)=>{let n,l;gi(e,()=>{n&&clearTimeout(n),o(new Ft("Poll cancelled"))}),t&&(l=setTimeout(()=>{n&&clearTimeout(n),o(new Ft("Timed out"))},t));let a=()=>{try{Promise.resolve(r(e)).then(c=>{c?(l&&clearTimeout(l),s(c)):n=setTimeout(a,i)}).catch(c=>{l&&clearTimeout(l),o(c)})}catch(c){l&&clearTimeout(l),o(c)}};n=setTimeout(a,0)}),k={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",maxContentLength:50*1024*1024,retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,multipartMinLastPartSize:1024*1024,maxConcurrentRequests:4,pollingTimeoutMilliseconds:1e4,pusherKey:"79ae88bd931ea68464d9"},bi="application/octet-stream",Ks="original",Dt=({method:r,url:i,data:t,headers:e={},signal:s,onProgress:o})=>new Promise((n,l)=>{let a=new XMLHttpRequest,c=(r==null?void 0:r.toUpperCase())||"GET",d=!1;a.open(c,i,!0),e&&Object.entries(e).forEach(h=>{let[p,f]=h;typeof f!="undefined"&&!Array.isArray(f)&&a.setRequestHeader(p,f)}),a.responseType="text",gi(s,()=>{d=!0,a.abort(),l(new Ft)}),a.onload=()=>{if(a.status!=200)l(new Error(`Error ${a.status}: ${a.statusText}`));else{let h={method:c,url:i,data:t,headers:e||void 0,signal:s,onProgress:o},p=a.getAllResponseHeaders().trim().split(/[\r\n]+/),f={};p.forEach(function(x){let E=x.split(": "),C=E.shift(),A=E.join(": ");C&&typeof C!="undefined"&&(f[C]=A)});let m=a.response,y=a.status;n({request:h,data:m,headers:f,status:y})}},a.onerror=h=>{d||l(new oe(h))},o&&typeof o=="function"&&(a.upload.onprogress=h=>{h.lengthComputable?o({isComputable:!0,value:h.loaded/h.total}):o({isComputable:!1})}),t?a.send(t):a.send()});function Zn(r,...i){return r}var Yn=({name:r})=>r?[r]:[],Jn=Zn,Qn=()=>new FormData,qs=r=>!1,yi=r=>typeof Blob!="undefined"&&r instanceof Blob,_i=r=>typeof File!="undefined"&&r instanceof File,vi=r=>!!r&&typeof r=="object"&&!Array.isArray(r)&&"uri"in r&&typeof r.uri=="string",ne=r=>yi(r)||_i(r)||qs()||vi(r),tl=r=>typeof r=="string"||typeof r=="number"||typeof r=="undefined",el=r=>!!r&&typeof r=="object"&&!Array.isArray(r),il=r=>!!r&&typeof r=="object"&&"data"in r&&ne(r.data);function Zs(r,i,t){if(Array.isArray(t))for(let e of t)Zs(r,`${i}[]`,e);else if(il(t)){let{name:e,contentType:s}=t,o=Jn(t.data,e,s!=null?s:bi),n=Yn({name:e,contentType:s});r.push([i,o,...n])}else if(el(t))for(let[e,s]of Object.entries(t))typeof s!="undefined"&&r.push([`${i}[${e}]`,String(s)]);else tl(t)&&t&&r.push([i,t.toString()])}function rl(r){let i=[];for(let[t,e]of Object.entries(r))Zs(i,t,e);return i}function wi(r){let i=Qn(),t=rl(r);for(let e of t){let[s,o,...n]=e;i.append(s,o,...n)}return i}var X=class r extends $e{constructor(t,e,s,o,n){super();u(this,"code");u(this,"request");u(this,"response");u(this,"headers");this.name="UploadError",this.message=t,this.code=e,this.request=s,this.response=o,this.headers=n,Object.setPrototypeOf(this,r.prototype)}},sl=r=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(r))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(s=>{var o;return(o=s[1])!=null?o:!1}).forEach(s=>i.set(`${t}[${s[0]}]`,String(s[1]))):Array.isArray(e)?e.forEach(s=>{i.append(`${t}[]`,s)}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},At=(r,i,t)=>{let e=new URL(r);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=sl(t)),e.toString()},ol="6.14.1",nl="UploadcareUploadClient",ll=ol;function qt(r){return Sr({libraryName:nl,libraryVersion:ll,...r})}var al="RequestThrottledError",Xs=15e3,cl=1e3;function ul(r){let{headers:i}=r||{};if(!i||typeof i["retry-after"]!="string")return Xs;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:Xs}function Nt(r,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return Kn(({attempt:s,retry:o})=>r().catch(n=>{if("response"in n&&(n==null?void 0:n.code)===al&&s<t)return o(ul(n));if(n instanceof oe&&s<e)return o((s+1)*cl);throw n}))}var Ys=r=>{let i="";return(yi(r)||_i(r)||vi(r))&&(i=r.type),i||bi},Js=r=>{let i="";return _i(r)&&r.name?i=r.name:yi(r)||qs()?i="":vi(r)&&r.name&&(i=r.name),i||Ks};function kr(r){return typeof r=="undefined"||r==="auto"?"auto":r?"1":"0"}function hl(r,{publicKey:i,fileName:t,contentType:e,baseURL:s=k.baseURL,secureSignature:o,secureExpire:n,store:l,signal:a,onProgress:c,source:d="local",integration:h,userAgent:p,retryThrottledRequestMaxTimes:f=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=k.retryNetworkErrorMaxTimes,metadata:y}){return Nt(()=>Dt({method:"POST",url:At(s,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":qt({publicKey:i,integration:h,userAgent:p})},data:wi({signature:o,expire:n,file:{data:r,name:t||Js(r),contentType:e||Ys(r)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:kr(l),source:d,metadata:y}),signal:a,onProgress:c}).then(({data:x,headers:E,request:C})=>{let A=St(JSON.parse(x));if("error"in A)throw new X(A.error.content,A.error.errorCode,C,A,E);return A}),{retryNetworkErrorMaxTimes:m,retryThrottledRequestMaxTimes:f})}var xr;(function(r){r.Token="token",r.FileInfo="file_info"})(xr||(xr={}));function dl(r,{publicKey:i,baseURL:t=k.baseURL,store:e,fileName:s,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:a,source:c="url",signal:d,integration:h,userAgent:p,retryThrottledRequestMaxTimes:f=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=k.retryNetworkErrorMaxTimes,metadata:y}){return Nt(()=>Dt({method:"POST",headers:{"X-UC-User-Agent":qt({publicKey:i,integration:h,userAgent:p})},url:At(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:r,store:kr(e),filename:s,check_URL_duplicates:o?1:void 0,save_URL_duplicates:n?1:void 0,signature:l,expire:a,source:c,metadata:y}),signal:d}).then(({data:x,headers:E,request:C})=>{let A=St(JSON.parse(x));if("error"in A)throw new X(A.error.content,A.error.errorCode,C,A,E);return A}),{retryNetworkErrorMaxTimes:m,retryThrottledRequestMaxTimes:f})}var Y;(function(r){r.Unknown="unknown",r.Waiting="waiting",r.Progress="progress",r.Error="error",r.Success="success"})(Y||(Y={}));var pl=r=>"status"in r&&r.status===Y.Error;function fl(r,{publicKey:i,baseURL:t=k.baseURL,signal:e,integration:s,userAgent:o,retryThrottledRequestMaxTimes:n=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=k.retryNetworkErrorMaxTimes}={}){return Nt(()=>Dt({method:"GET",headers:i?{"X-UC-User-Agent":qt({publicKey:i,integration:s,userAgent:o})}:void 0,url:At(t,"/from_url/status/",{jsonerrors:1,token:r}),signal:e}).then(({data:a,headers:c,request:d})=>{let h=St(JSON.parse(a));if("error"in h&&!pl(h))throw new X(h.error.content,h.error.errorCode,d,h,c);return h}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:n})}function ml(r,{publicKey:i,baseURL:t=k.baseURL,jsonpCallback:e,secureSignature:s,secureExpire:o,signal:n,source:l,integration:a,userAgent:c,retryThrottledRequestMaxTimes:d=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:h=k.retryNetworkErrorMaxTimes}){return Nt(()=>Dt({method:"POST",headers:{"X-UC-User-Agent":qt({publicKey:i,integration:a,userAgent:c})},url:At(t,"/group/",{jsonerrors:1}),data:wi({files:r,callback:e,pub_key:i,signature:s,expire:o,source:l}),signal:n}).then(({data:p,headers:f,request:m})=>{let y=St(JSON.parse(p));if("error"in y)throw new X(y.error.content,y.error.errorCode,m,y,f);return y}),{retryNetworkErrorMaxTimes:h,retryThrottledRequestMaxTimes:d})}function Qs(r,{publicKey:i,baseURL:t=k.baseURL,signal:e,source:s,integration:o,userAgent:n,retryThrottledRequestMaxTimes:l=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=k.retryNetworkErrorMaxTimes}){return Nt(()=>Dt({method:"GET",headers:{"X-UC-User-Agent":qt({publicKey:i,integration:o,userAgent:n})},url:At(t,"/info/",{jsonerrors:1,pub_key:i,file_id:r,source:s}),signal:e}).then(({data:c,headers:d,request:h})=>{let p=St(JSON.parse(c));if("error"in p)throw new X(p.error.content,p.error.errorCode,h,p,d);return p}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function gl(r,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:s=k.multipartChunkSize,baseURL:o="",secureSignature:n,secureExpire:l,store:a,signal:c,source:d="local",integration:h,userAgent:p,retryThrottledRequestMaxTimes:f=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=k.retryNetworkErrorMaxTimes,metadata:y}){return Nt(()=>Dt({method:"POST",url:At(o,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":qt({publicKey:i,integration:h,userAgent:p})},data:wi({filename:e||Ks,size:r,content_type:t||bi,part_size:s,UPLOADCARE_STORE:kr(a),UPLOADCARE_PUB_KEY:i,signature:n,expire:l,source:d,metadata:y}),signal:c}).then(({data:x,headers:E,request:C})=>{let A=St(JSON.parse(x));if("error"in A)throw new X(A.error.content,A.error.errorCode,C,A,E);return A.parts=Object.keys(A.parts).map(N=>A.parts[Number(N)]),A}),{retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m})}function bl(r,i,{contentType:t,signal:e,onProgress:s,retryThrottledRequestMaxTimes:o=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=k.retryNetworkErrorMaxTimes}){return Nt(()=>Dt({method:"PUT",url:i,data:r,onProgress:s,signal:e,headers:{"Content-Type":t||bi}}).then(l=>(s&&s({isComputable:!0,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n})}function yl(r,{publicKey:i,baseURL:t=k.baseURL,source:e="local",signal:s,integration:o,userAgent:n,retryThrottledRequestMaxTimes:l=k.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=k.retryNetworkErrorMaxTimes}){return Nt(()=>Dt({method:"POST",url:At(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":qt({publicKey:i,integration:o,userAgent:n})},data:wi({uuid:r,UPLOADCARE_PUB_KEY:i,source:e}),signal:s}).then(({data:c,headers:d,request:h})=>{let p=St(JSON.parse(c));if("error"in p)throw new X(p.error.content,p.error.errorCode,h,p,d);return p}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})}function $r(r,{publicKey:i,baseURL:t,source:e,integration:s,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l,signal:a,onProgress:c}){return Ws({check:d=>Qs(r,{publicKey:i,baseURL:t,signal:d,source:e,integration:s,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l}).then(h=>h.isReady?h:(c&&c({isComputable:!0,value:1}),!1)),signal:a})}function _l(r){return"defaultEffects"in r}var Tt=class{constructor(i,{baseCDN:t=k.baseCDN,fileName:e}={}){u(this,"uuid");u(this,"name",null);u(this,"size",null);u(this,"isStored",null);u(this,"isImage",null);u(this,"mimeType",null);u(this,"cdnUrl",null);u(this,"s3Url",null);u(this,"originalFilename",null);u(this,"imageInfo",null);u(this,"videoInfo",null);u(this,"contentInfo",null);u(this,"metadata",null);u(this,"s3Bucket",null);u(this,"defaultEffects",null);let{uuid:s,s3Bucket:o}=i,n=At(t,`${s}/`),l=o?At(`https://${o}.s3.amazonaws.com/`,`${s}/${i.filename}`):null;this.uuid=s,this.name=e||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=n,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=o||null,this.s3Url=l,_l(i)&&(this.defaultEffects=i.defaultEffects)}},vl=(r,{publicKey:i,fileName:t,baseURL:e,secureSignature:s,secureExpire:o,store:n,contentType:l,signal:a,onProgress:c,source:d,integration:h,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,baseCDN:y,metadata:x})=>hl(r,{publicKey:i,fileName:t,contentType:l,baseURL:e,secureSignature:s,secureExpire:o,store:n,signal:a,onProgress:c,source:d,integration:h,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,metadata:x}).then(({file:E})=>$r(E,{publicKey:i,baseURL:e,source:d,integration:h,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,onProgress:c,signal:a})).then(E=>new Tt(E,{baseCDN:y})),wl=(r,{publicKey:i,fileName:t,baseURL:e,signal:s,onProgress:o,source:n,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:d,baseCDN:h})=>Qs(r,{publicKey:i,baseURL:e,signal:s,source:n,integration:l,userAgent:a,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:d}).then(p=>new Tt(p,{baseCDN:h,fileName:t})).then(p=>(o&&o({isComputable:!0,value:1}),p)),Cl=(r,{signal:i}={})=>{let t=null,e=null,s=r.map(()=>new AbortController),o=n=>()=>{e=n,s.forEach((l,a)=>a!==n&&l.abort())};return gi(i,()=>{s.forEach(n=>n.abort())}),Promise.all(r.map((n,l)=>{let a=o(l);return Promise.resolve().then(()=>n({stopRace:a,signal:s[l].signal})).then(c=>(a(),c)).catch(c=>(t=c,null))})).then(n=>{if(e===null)throw t;return n[e]})},xl=window.WebSocket,Er=class{constructor(){u(this,"events",Object.create({}))}emit(i,t){var e;(e=this.events[i])==null||e.forEach(s=>s(t))}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t)}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[]}},El=(r,i)=>r==="success"?{status:Y.Success,...i}:r==="progress"?{status:Y.Progress,...i}:{status:Y.Error,...i},Ar=class{constructor(i,t=3e4){u(this,"key");u(this,"disconnectTime");u(this,"ws");u(this,"queue",[]);u(this,"isConnected",!1);u(this,"subscribers",0);u(this,"emmitter",new Er);u(this,"disconnectTimeoutId",null);this.key=i,this.disconnectTime=t}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let i=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new xl(i),this.ws.addEventListener("error",t=>{this.emmitter.emit("error",new Error(t.message))}),this.emmitter.on("connected",()=>{this.isConnected=!0,this.queue.forEach(t=>this.send(t.event,t.data)),this.queue=[]}),this.ws.addEventListener("message",t=>{let e=JSON.parse(t.data.toString());switch(e.event){case"pusher:connection_established":{this.emmitter.emit("connected",void 0);break}case"pusher:ping":{this.send("pusher:pong",{});break}case"progress":case"success":case"fail":this.emmitter.emit(e.channel,El(e.event,JSON.parse(e.data)))}})}}disconnect(){let i=()=>{var t;(t=this.ws)==null||t.close(),this.ws=void 0,this.isConnected=!1};this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i()},this.disconnectTime):i()}send(i,t){var s;let e=JSON.stringify({event:i,data:t});(s=this.ws)==null||s.send(e)}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,s={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(s.event,s.data):this.queue.push(s)}unsubscribe(i){this.subscribers-=1;let t=`task-status-${i}`,e={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(e.event,e.data):this.queue=this.queue.filter(s=>s.data.channel!==t),this.subscribers===0&&this.disconnect()}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},wr=null,Ir=r=>{if(!wr){let i=typeof window=="undefined"?0:3e4;wr=new Ar(r,i)}return wr},Al=r=>{Ir(r).connect()};function Tl({token:r,publicKey:i,baseURL:t,integration:e,userAgent:s,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n,onProgress:l,signal:a}){return Ws({check:c=>fl(r,{publicKey:i,baseURL:t,integration:e,userAgent:s,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n,signal:c}).then(d=>{switch(d.status){case Y.Error:return new X(d.error,d.errorCode);case Y.Waiting:return!1;case Y.Unknown:return new X(`Token "${r}" was not found.`);case Y.Progress:return l&&(d.total==="unknown"?l({isComputable:!1}):l({isComputable:!0,value:d.done/d.total})),!1;case Y.Success:return l&&l({isComputable:!0,value:d.done/d.total}),d;default:throw new Error("Unknown status")}}),signal:a})}var Sl=({token:r,pusherKey:i,signal:t,onProgress:e})=>new Promise((s,o)=>{let n=Ir(i),l=n.onError(o),a=()=>{l(),n.unsubscribe(r)};gi(t,()=>{a(),o(new Ft("pusher cancelled"))}),n.subscribe(r,c=>{switch(c.status){case Y.Progress:{e&&(c.total==="unknown"?e({isComputable:!1}):e({isComputable:!0,value:c.done/c.total}));break}case Y.Success:{a(),e&&e({isComputable:!0,value:c.done/c.total}),s(c);break}case Y.Error:a(),o(new X(c.msg,c.error_code))}})}),kl=(r,{publicKey:i,fileName:t,baseURL:e,baseCDN:s,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:a,store:c,signal:d,onProgress:h,source:p,integration:f,userAgent:m,retryThrottledRequestMaxTimes:y,pusherKey:x=k.pusherKey,metadata:E})=>Promise.resolve(Al(x)).then(()=>dl(r,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:a,store:c,signal:d,source:p,integration:f,userAgent:m,retryThrottledRequestMaxTimes:y,metadata:E})).catch(C=>{let A=Ir(x);return A==null||A.disconnect(),Promise.reject(C)}).then(C=>C.type===xr.FileInfo?C:Cl([({signal:A})=>Tl({token:C.token,publicKey:i,baseURL:e,integration:f,userAgent:m,retryThrottledRequestMaxTimes:y,onProgress:h,signal:A}),({signal:A})=>Sl({token:C.token,pusherKey:x,signal:A,onProgress:h})],{signal:d})).then(C=>{if(C instanceof X)throw C;return C}).then(C=>$r(C.uuid,{publicKey:i,baseURL:e,integration:f,userAgent:m,retryThrottledRequestMaxTimes:y,onProgress:h,signal:d})).then(C=>new Tt(C,{baseCDN:s})),Cr=new WeakMap,$l=async r=>{if(Cr.has(r))return Cr.get(r);let i=await fetch(r.uri).then(t=>t.blob());return Cr.set(r,i),i},to=async r=>{if(_i(r)||yi(r))return r.size;if(vi(r))return(await $l(r)).size;throw new Error("Unknown file type. Cannot determine file size.")},Il=(r,i=k.multipartMinFileSize)=>r>=i,eo=r=>{let i="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(i);return!ne(r)&&t.test(r)},Or=r=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return!ne(r)&&t.test(r)},Ol=(r,i)=>new Promise((t,e)=>{let s=[],o=!1,n=i.length,l=[...i],a=()=>{let c=i.length-l.length,d=l.shift();d&&d().then(h=>{o||(s[c]=h,n-=1,n?a():t(s))}).catch(h=>{o=!0,e(h)})};for(let c=0;c<r;c++)a()}),Ll=(r,i,t,e)=>{let s=e*i,o=Math.min(s+e,t);return r.slice(s,o)},Ul=async(r,i,t)=>e=>Ll(r,e,i,t),Ml=(r,i,{publicKey:t,contentType:e,onProgress:s,signal:o,integration:n,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a})=>bl(r,i,{publicKey:t,contentType:e,onProgress:s,signal:o,integration:n,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:a}),Pl=async(r,{publicKey:i,fileName:t,fileSize:e,baseURL:s,secureSignature:o,secureExpire:n,store:l,signal:a,onProgress:c,source:d,integration:h,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,contentType:y,multipartChunkSize:x=k.multipartChunkSize,maxConcurrentRequests:E=k.maxConcurrentRequests,baseCDN:C,metadata:A})=>{let N=e!=null?e:await to(r),et,ut=(B,K)=>{if(!c)return;et||(et=Array(B).fill(0));let ot=ht=>ht.reduce((vt,ur)=>vt+ur,0);return ht=>{ht.isComputable&&(et[K]=ht.value,c({isComputable:!0,value:ot(et)/B}))}};return y||(y=Ys(r)),gl(N,{publicKey:i,contentType:y,fileName:t||Js(r),baseURL:s,secureSignature:o,secureExpire:n,store:l,signal:a,source:d,integration:h,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,metadata:A}).then(async({uuid:B,parts:K})=>{let ot=await Ul(r,N,x);return Promise.all([B,Ol(E,K.map((ht,vt)=>()=>Ml(ot(vt),ht,{publicKey:i,contentType:y,onProgress:ut(K.length,vt),signal:a,integration:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m})))])}).then(([B])=>yl(B,{publicKey:i,baseURL:s,source:d,integration:h,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m})).then(B=>B.isReady?B:$r(B.uuid,{publicKey:i,baseURL:s,source:d,integration:h,userAgent:p,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:m,onProgress:c,signal:a})).then(B=>new Tt(B,{baseCDN:C}))};async function Lr(r,{publicKey:i,fileName:t,baseURL:e=k.baseURL,secureSignature:s,secureExpire:o,store:n,signal:l,onProgress:a,source:c,integration:d,userAgent:h,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:f,contentType:m,multipartMinFileSize:y,multipartChunkSize:x,maxConcurrentRequests:E,baseCDN:C=k.baseCDN,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:N,pusherKey:et,metadata:ut}){if(ne(r)){let B=await to(r);return Il(B,y)?Pl(r,{publicKey:i,contentType:m,multipartChunkSize:x,fileSize:B,fileName:t,baseURL:e,secureSignature:s,secureExpire:o,store:n,signal:l,onProgress:a,source:c,integration:d,userAgent:h,maxConcurrentRequests:E,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:f,baseCDN:C,metadata:ut}):vl(r,{publicKey:i,fileName:t,contentType:m,baseURL:e,secureSignature:s,secureExpire:o,store:n,signal:l,onProgress:a,source:c,integration:d,userAgent:h,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:f,baseCDN:C,metadata:ut})}if(Or(r))return kl(r,{publicKey:i,fileName:t,baseURL:e,baseCDN:C,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:N,secureSignature:s,secureExpire:o,store:n,signal:l,onProgress:a,source:c,integration:d,userAgent:h,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:f,pusherKey:et,metadata:ut});if(eo(r))return wl(r,{publicKey:i,fileName:t,baseURL:e,signal:l,onProgress:a,source:c,integration:d,userAgent:h,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:f,baseCDN:C});throw new TypeError(`File uploading from "${r}" is not supported`)}var Tr=class{constructor(i,{baseCDN:t=k.baseCDN}={}){u(this,"uuid");u(this,"filesCount");u(this,"totalSize");u(this,"isStored");u(this,"isImage");u(this,"cdnUrl");u(this,"files");u(this,"createdAt");u(this,"storedAt",null);this.uuid=i.id,this.filesCount=i.filesCount;let e=i.files.filter(Boolean);this.totalSize=Object.values(e).reduce((s,o)=>s+o.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(e).filter(s=>s.isImage).length,this.cdnUrl=i.cdnUrl,this.files=e.map(s=>new Tt(s,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored}},Rl=r=>{for(let i of r)if(!ne(i))return!1;return!0},Fl=r=>{for(let i of r)if(!eo(i))return!1;return!0},Dl=r=>{for(let i of r)if(!Or(i))return!1;return!0};function io(r,{publicKey:i,fileName:t,baseURL:e=k.baseURL,secureSignature:s,secureExpire:o,store:n,signal:l,onProgress:a,source:c,integration:d,userAgent:h,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:f,contentType:m,multipartChunkSize:y=k.multipartChunkSize,baseCDN:x=k.baseCDN,checkForUrlDuplicates:E,saveUrlForRecurrentUploads:C,jsonpCallback:A}){if(!Rl(r)&&!Dl(r)&&!Fl(r))throw new TypeError(`Group uploading from "${r}" is not supported`);let N,et=!0,ut=r.length,B=(K,ot)=>{if(!a)return;N||(N=Array(K).fill(0));let ht=vt=>vt.reduce((ur,vn)=>ur+vn)/K;return vt=>{if(!vt.isComputable||!et){et=!1,a({isComputable:!1});return}N[ot]=vt.value,a({isComputable:!0,value:ht(N)})}};return Promise.all(r.map((K,ot)=>ne(K)||Or(K)?Lr(K,{publicKey:i,fileName:t,baseURL:e,secureSignature:s,secureExpire:o,store:n,signal:l,onProgress:B(ut,ot),source:c,integration:d,userAgent:h,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:f,contentType:m,multipartChunkSize:y,baseCDN:x,checkForUrlDuplicates:E,saveUrlForRecurrentUploads:C}).then(ht=>ht.uuid):K)).then(K=>ml(K,{publicKey:i,baseURL:e,jsonpCallback:A,secureSignature:s,secureExpire:o,signal:l,source:c,integration:d,userAgent:h,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:f}).then(ot=>new Tr(ot,{baseCDN:x})).then(ot=>(a&&a({isComputable:!0,value:1}),ot)))}var mi=class{constructor(i){u(this,"_concurrency",1);u(this,"_pending",[]);u(this,"_running",0);u(this,"_resolvers",new Map);u(this,"_rejectors",new Map);this._concurrency=i}_run(){let i=this._concurrency-this._running;for(let t=0;t<i;t++){let e=this._pending.shift();if(!e)return;let s=this._resolvers.get(e),o=this._rejectors.get(e);if(!s||!o)throw new Error("Unexpected behavior: resolver or rejector is undefined");this._running+=1,e().finally(()=>{this._resolvers.delete(e),this._rejectors.delete(e),this._running-=1,this._run()}).then(n=>s(n)).catch(n=>o(n))}}add(i){return new Promise((t,e)=>{this._resolvers.set(i,t),this._rejectors.set(i,e),this._pending.push(i),this._run()})}get pending(){return this._pending.length}get running(){return this._running}set concurrency(i){this._concurrency=i,this._run()}get concurrency(){return this._concurrency}};var Ur=()=>({}),Mr=r=>({...Ur(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{r.set$({"*currentActivity":null,"*modalActive":!1})}}),Ci=r=>({...Mr(r),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new mi(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set,"*secureUploadsManager":null});var Ie={"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","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":"Selected:","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-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-instagram":"Instagram","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 ocurred. 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",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}"};var xi=new Map,Pr=new Map,ro=(r,i)=>{xi.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`),xi.set(r,{...Ie,...i})},Nl=(r,i)=>{Pr.set(r,i)},so=(r,i)=>{typeof i=="function"?Nl(r,i):ro(r,i)},oo=async r=>{if(!xi.has(r)){if(!Pr.has(r))throw new Error(`Locale ${r} is not defined`);let t=await Pr.get(r)();ro(r,t)}return xi.get(r)};so("en",Ie);var kt=r=>`*l10n/${r}`,Bl="en",Ei=class{constructor(i){u(this,"_blockInstance",null);u(this,"_localeName","");u(this,"_callbacks",new Set);u(this,"_boundBlocks",new Map);this._blockInstance=i;for(let[t,e]of Object.entries(Ie))this._blockInstance.add(kt(t),e,!1);setTimeout(()=>{i.subConfigValue("localeName",async t=>{var o;if(!this._blockInstance||!t)return;this._localeName=t;let e=await oo(t);if(t!==Bl&&this._localeName!==t)return;let s=(o=this._blockInstance.cfg.localeDefinitionOverride)==null?void 0:o[t];for(let[n,l]of Object.entries(e)){let a=s==null?void 0:s[n];this._blockInstance.add(kt(n),a!=null?a:l,!0);for(let c of this._callbacks)c()}}),i.subConfigValue("localeDefinitionOverride",t=>{var s;if(!t)return;let e=t[this._localeName];if(e)for(let[o,n]of Object.entries(e)){(s=this._blockInstance)==null||s.add(kt(o),n,!0);for(let l of this._callbacks)l()}})})}onLocaleChange(i){let t=M(i,0);return this._callbacks.add(t),()=>{this._callbacks.delete(t)}}bindL10n(i,t,e){var o,n,l;i.$[t]=e(),this._boundBlocks.has(i)||this._boundBlocks.set(i,new Map),(n=(o=this._boundBlocks.get(i))==null?void 0:o.get(t))==null||n();let s=this.onLocaleChange(()=>{i.$[t]=e()});(l=this._boundBlocks.get(i))==null||l.set(t,s)}destroyL10nBindings(i){let t=this._boundBlocks.get(i);if(t){for(let e of t.values())e();this._boundBlocks.delete(i)}}destroy(){this._callbacks.clear()}};var zl={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function Oe(r,i){i.tabIndex=0,i.focus(),r.tabIndex=-1}function Rr(r){let i=r.role||r.type||r.tagName;if(!i)return null;let t=zl[i.toLowerCase()];if(!t)return null;for(let e of t){let s=r.closest(`[role=${e}]`);if(s)return s}}function Fr(r,i){return i.role==="toolbar"?Vl(i):i.querySelectorAll(`[role=${r.role}]`)}function Vl(r){return[...r.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}function Hl(r){let i=r.getAttribute("aria-orientation");if(i==="vertical")return!1;if(i==="horizontal")return!0;let t=r.role;return t==="menubar"||t==="tablist"||t==="toolbar"}function no(r){return i=>{let t=!1,e=(r==null?void 0:r.searchDelayMs)||300,s=0,o="";function n(h){let p=Rr(h.target);if(!p){l();return}let f=Fr(h.target,p),m=Array.from(f).indexOf(h.target),y="ArrowDown",x="ArrowUp";if(Hl(p)&&(i.document.dir==="rtl"?(y="ArrowLeft",x="ArrowRight"):(y="ArrowRight",x="ArrowLeft")),h.key===y)h.preventDefault(),Oe(h.target,f[m+1]||f[0]);else if(h.key===x)h.preventDefault(),Oe(h.target,f[m-1]||f[f.length-1]);else if(h.key==="Home")h.preventDefault(),Oe(h.target,f[0]);else if(h.key==="End")h.preventDefault(),Oe(h.target,f[f.length-1]);else if(h.key.length===1&&p.role!=="tablist"){let E=Date.now();E-s<=e?o+=h.key.toLowerCase():o=h.key.toLowerCase(),s=E;let C=Array.from(f).find(A=>{var N,et,ut;return(ut=(et=(N=A.textContent)==null?void 0:N.trim())==null?void 0:et.toLowerCase())==null?void 0:ut.startsWith(o)});C&&(h.preventDefault(),Oe(h.target,C))}}function l(){t=!1,i.removeEventListener("keydown",n)}function a(h){let p=Rr(h.target);if(p){t||(t=!0,i.addEventListener("keydown",n));let f=Fr(h.target,p);for(let m of f)m!==h.target&&m.setAttribute("tabindex",-1)}else t&&l()}function c(h){(!h.relatedTarget||h.relatedTarget===i.document)&&l()}function d(h){let p=Rr(h.target);if(p){let f=Fr(h.target,p);for(let m of f)m!==h.target&&m.setAttribute("tabindex",-1);h.target.setAttribute("tabindex",0)}}return i.addEventListener("click",d),i.addEventListener("focusin",a),i.addEventListener("focusout",c),()=>{l(),i.removeEventListener("click",d),i.removeEventListener("focusin",a),i.removeEventListener("focusout",c)}}}function lo(){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=!1);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=!0),i=null)}return r.addEventListener("keyuxJump",e),r.addEventListener("focusout",s),()=>{r.removeEventListener("keyuxJump",e),r.removeEventListener("focusout",s)}}}function ao(){return r=>{let i=[];function t(c){let d=r.document.activeElement;d&&d!==r.document.body&&i.push(new WeakRef(d)),c.focus({focusVisible:!0})}function e(){let c=i.pop();if(!c){r.document.activeElement.blur();return}let d=c.deref();d&&d.isConnected?d.focus():e()}let s=0,o;function n(c){clearInterval(o);let d=c.getAttribute("aria-controls");d&&(o=setInterval(()=>{if(s++>50){clearInterval(o);return}let h=r.document.getElementById(d);if(h){let p=h.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');p&&(clearInterval(o),h.dispatchEvent(new r.CustomEvent("keyuxJump",{bubbles:!0})),t(p))}},50))}function l(c){c.clientX===0&&c.clientY===0&&n(c.target)}function a(c){c.target.tagName==="INPUT"&&c.key==="Enter"&&n(c.target),c.key==="Escape"&&e()}return r.addEventListener("click",l),r.addEventListener("keydown",a),()=>{r.removeEventListener("click",l),r.removeEventListener("keydown",a)}}}function co(r){let i,t=r.split(" ");function e(){i&&i.classList.remove(...t)}function s(o){o.clientX===0&&o.clientY===0&&(e(),o.target.classList.add(...t),i=o.target)}return o=>(o.addEventListener("keyup",e),o.addEventListener("click",s),()=>{o.removeEventListener("keyup",e),o.removeEventListener("click",s)})}function uo(r,i){let t=i.map(e=>e(r));return()=>{t.forEach(e=>e())}}var Dr=class{constructor(){u(this,"_listeners",new Map);u(this,"_scope",[])}addEventListener(i,t){let e=s=>{let o=s.target;o&&this._scope.some(n=>n===s.target||n.contains(o))&&t(s)};this._listeners.set(t,e),window.addEventListener(i,e)}removeEventListener(i,t){let e=this._listeners.get(t);e&&window.removeEventListener(i,e),this._listeners.delete(t)}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this._scope.push(i)}destroy(){this._scope=[],this._listeners.forEach((i,t)=>{window.removeEventListener("keydown",i),window.removeEventListener("keyup",i),this._listeners.delete(t)})}},Ai=class{constructor(){u(this,"_destroyKeyUX");u(this,"_scopedWindow");this._scopedWindow=new Dr,this._destroyKeyUX=uo(this._scopedWindow,[no(),co("is-pressed"),ao(),lo()])}registerBlock(i){this._scopedWindow.registerScope(i)}destroy(){var i;(i=this._destroyKeyUX)==null||i.call(this),this._scopedWindow.destroy()}};function ho(r,i){[...r.querySelectorAll("[l10n]")].forEach(t=>{let e=t.getAttribute("l10n");if(!e)return;let s="textContent",o=!1;if(e.includes(":")){let a=e.split(":");s=a[0],e=a[1],s.startsWith("@")&&(s=s.slice(1),o=!0)}let n=e;i.has(n)&&i.sub(n,a=>{if(!a)return;i.l10nProcessorSubs.has(n)||i.l10nProcessorSubs.set(n,new Set);let c=i.l10nProcessorSubs.get(n);c==null||c.forEach(p=>{p.remove(),c.delete(p),i.allSubs.delete(p)});let d=kt(a).replace("*","");i.sharedCtx.has(d)||i.sharedCtx.add(d,a);let h=i.sharedCtx.sub(d,()=>{t[s]=i.l10n(a)});c==null||c.add(h),i.allSubs.add(h),t.removeAttribute("l10n")});let l=kt(e);i.has(l)||i.add(l,""),i.sub(l,()=>{e=e,o?t.setAttribute(s,i.l10n(e)):t[s]=i.l10n(e)}),t.removeAttribute("l10n")})}var J=r=>`*cfg/${r}`;var jl="uc-",w=class extends xt{constructor(){super();u(this,"requireCtxName",!1);u(this,"activityType",null);u(this,"init$",Ur());this.l10nProcessorSubs=new Map,this.addTemplateProcessor(ho),this.addTemplateProcessor(yr)}l10n(t,e={}){if(!t)return"";let s=this.$[kt(t)]||t,o=zs(s);for(let l of o)e[l.variable]=this.pluralize(l.pluralKey,Number(e[l.countVariable]));return ke(s,e)}pluralize(t,e){let s=this.l10n("locale-id")||"en",o=fi(s,e);return this.l10n(`${t}__${o}`)}bindL10n(t,e){var s;(s=this.localeManager)==null||s.bindL10n(this,t,e)}emit(t,e,s){let o=this.has("*eventEmitter")&&this.$["*eventEmitter"];o&&o.emit(t,e,s)}hasBlockInCtx(t){for(let e of this.blocksRegistry)if(t(e))return!0;return!1}setOrAddState(t,e){this.add$({[t]:e},!0)}connectedCallback(){this.constructor.styleAttrs.forEach(e=>{this.setAttribute(e,"")}),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?Hs({element:this,attribute:Se.CTX_NAME_ATTR}).then(e=>{e.success?super.connectedCallback():console.error(`Attribute "${Se.CTX_NAME_ATTR}" is required and it is not set.`)}):super.connectedCallback(),Kt.registerClient(this)}disconnectedCallback(){super.disconnectedCallback(),Kt.unregisterClient(this)}initCallback(){this.has("*blocksRegistry")||this.add("*blocksRegistry",new Set),this.$["*blocksRegistry"].add(this),this.has("*eventEmitter")||this.add("*eventEmitter",new pi(this.debugPrint.bind(this))),this.has("*localeManager")||this.add("*localeManager",new Ei(this)),this.has("*a11y")||this.add("*a11y",new Ai),this.sub(kt("locale-id"),e=>{let s=Ds(e);this.style.direction=s==="ltr"?"":s})}get localeManager(){return this.has("*localeManager")?this.$["*localeManager"]:null}get a11y(){return this.has("*a11y")?this.$["*a11y"]:null}get blocksRegistry(){return this.$["*blocksRegistry"]}destroyCallback(){var e;super.destroyCallback();let t=this.blocksRegistry;t==null||t.delete(this),(e=this.localeManager)==null||e.destroyL10nBindings(this),this.l10nProcessorSubs=new Map,$.deleteCtx(this.localCtx.uid),(t==null?void 0:t.size)===0&&setTimeout(()=>{this.destroyCtxCallback()},0)}destroyCtxCallback(){var t;$.deleteCtx(this.ctxName),(t=this.localeManager)==null||t.destroy()}async proxyUrl(t){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(t,{uuid:hi(t),cdnUrlModifiers:_r(t),fileName:ui(t)})}catch(e){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",e),t}return this.cfg.secureDeliveryProxy?ke(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:e=>window.encodeURIComponent(e)}):t}get cfg(){if(!this.__cfgProxy){let t=Object.create(null);this.__cfgProxy=new Proxy(t,{set:(e,s,o)=>{if(typeof s!="string")return!1;let n=J(s);return this.has(n)||this.add(n,at[s]),this.$[n]=o,!0},get:(e,s)=>{let o=J(s);return this.has(o)||this.add(o,at[s]),this.$[J(s)]}})}return this.__cfgProxy}subConfigValue(t,e){let s=J(t);this.has(s)||this.add(s,at[t]),this.sub(s,e)}debugPrint(...t){if(!this.cfg.debug)return;let e=t;if(typeof(t==null?void 0:t[0])=="function"){let s=t[0];e=s()}console.log(`[${this.ctxName}]`,...e)}static reg(t){if(!t){super.reg();return}t.startsWith(jl)&&super.reg(t)}};u(w,"StateConsumerScope",null),u(w,"styleAttrs",[]);var po="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-instagram' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.225 12a5.775 5.775 0 1 1 11.55 0 5.775 5.775 0 0 1-11.55 0zM12 7.725a4.275 4.275 0 1 0 0 8.55 4.275 4.275 0 0 0 0-8.55zm6.425-.75a1.4 1.4 0 1 0 0-2.8 1.4 1.4 0 0 0 0 2.8zm-6.467-6.8h.084c2.152 0 3.823 0 5.152.132 1.35.134 2.427.41 3.362 1.013a7.15 7.15 0 0 1 2.124 2.124c.604.935.88 2.012 1.013 3.362.132 1.329.132 3 .132 5.152v.084c0 2.152 0 3.823-.132 5.152-.134 1.35-.41 2.427-1.013 3.362a7.15 7.15 0 0 1-2.124 2.124c-.935.604-2.012.88-3.362 1.013-1.329.132-3 .132-5.152.132h-.084c-2.152 0-3.824 0-5.153-.132-1.35-.134-2.427-.409-3.36-1.013a7.15 7.15 0 0 1-2.125-2.124C.716 19.62.44 18.544.307 17.194c-.132-1.329-.132-3-.132-5.152v-.084c0-2.152 0-3.823.132-5.152.133-1.35.409-2.427 1.013-3.362A7.15 7.15 0 0 1 3.444 1.32C4.378.716 5.456.44 6.805.307c1.33-.132 3-.132 5.153-.132zM6.953 1.799c-1.234.123-2.043.36-2.695.78A5.65 5.65 0 0 0 2.58 4.26c-.42.65-.657 1.46-.78 2.695C1.676 8.2 1.675 9.797 1.675 12s0 3.8.124 5.046c.123 1.235.36 2.044.78 2.696a5.649 5.649 0 0 0 1.68 1.678c.65.421 1.46.658 2.694.78 1.247.124 2.844.125 5.047.125s3.8 0 5.046-.124c1.235-.123 2.044-.36 2.695-.78a5.648 5.648 0 0 0 1.68-1.68c.42-.65.657-1.46.78-2.694.123-1.247.124-2.844.124-5.047s-.001-3.8-.125-5.046c-.122-1.235-.359-2.044-.78-2.695a5.65 5.65 0 0 0-1.679-1.68c-.651-.42-1.46-.657-2.695-.78-1.246-.123-2.843-.124-5.046-.124-2.203 0-3.8 0-5.047.124z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='apuc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#apuc-icon-id__a)'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#asuc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#asuc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#asuc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#asuc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#asuc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#asuc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#asuc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#asuc-icon-id__h)'/><defs><linearGradient id='asuc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='asuc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var ft=class extends w{constructor(){super(...arguments);u(this,"requireCtxName",!0);u(this,"init$",Ci(this));u(this,"_template",null)}initCallback(){var t;super.initCallback(),(t=this.a11y)==null||t.registerBlock(this)}static set template(t){this._template=po+t+"<slot></slot>"}static get template(){return this._template}};u(ft,"styleAttrs",["uc-wgt-common"]);var fo="active",Le="___ACTIVITY_IS_ACTIVE___",$t=class $t extends w{constructor(){super(...arguments);u(this,"historyTracked",!1);u(this,"init$",Mr(this));u(this,"_debouncedHistoryFlush",M(this._historyFlush.bind(this),10))}_deactivate(){var e;let t=$t._activityCallbacks.get(this);this[Le]=!1,this.removeAttribute(fo),(e=t==null?void 0:t.deactivateCallback)==null||e.call(t)}_activate(){var e;let t=$t._activityCallbacks.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Le]=!0,this.setAttribute(fo,""),(e=t==null?void 0:t.activateCallback)==null||e.call(t),this._debouncedHistoryFlush(),this.emit(I.ACTIVITY_CHANGE,{activity:this.activityType})}initCallback(){super.initCallback(),this.hasAttribute("current-activity")&&this.sub("*currentActivity",t=>{this.setAttribute("current-activity",t)}),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{var e;try{this.activityType!==t&&this[Le]?this._deactivate():this.activityType===t&&!this[Le]&&this._activate()}catch(s){console.error(`Error in activity "${this.activityType}". `,s),this.$["*currentActivity"]=(e=this.$["*history"][this.$["*history"].length-1])!=null?e:null}t||(this.$["*history"]=[])}),this.has("*modalActive")&&this.sub("*modalActive",t=>{!t&&this.activityType===this.$["*currentActivity"]&&(this.$["*currentActivity"]=null)}))}_historyFlush(){let t=this.$["*history"];t&&(t.length>10&&(t=t.slice(t.length-11,t.length-1)),this.historyTracked&&t[t.length-1]!==this.activityType&&t.push(this.activityType),this.$["*history"]=t)}_isActivityRegistered(){return this.activityType&&$t._activityCallbacks.has(this)}get isActivityActive(){return this[Le]}get couldOpenActivity(){return!0}registerActivity(t,e={}){let{onActivate:s,onDeactivate:o}=e;$t._activityCallbacks.set(this,{activateCallback:s,deactivateCallback:o})}unregisterActivity(){this.isActivityActive&&this._deactivate(),$t._activityCallbacks.delete(this)}destroyCallback(){super.destroyCallback(),this._isActivityRegistered()&&this.unregisterActivity();let t=this.$["*currentActivity"];!![...this.blocksRegistry].find(s=>s instanceof $t&&s.activityType===t)||(this.$["*currentActivity"]=null,this.setOrAddState("*modalActive",!1))}get activityKey(){return this.ctxName+this.activityType}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")}get doneActivity(){return this.getCssData("--cfg-done-activity")}historyBack(){var e;let t=this.$["*history"];if(t){let s=t.pop();for(;s===this.activityType;)s=t.pop();let o=!!s;if(s){let n=[...this.blocksRegistry].find(l=>l.activityType===s);o=(e=n==null?void 0:n.couldOpenActivity)!=null?e:!1}s=o?s:void 0,this.$["*currentActivity"]=s,this.$["*history"]=t,s||this.setOrAddState("*modalActive",!1)}}};u($t,"_activityCallbacks",new Map);var v=$t;v.activities=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 Ue=33.333333333333336,T=1,Nr=24,mo=6;function Zt(r,i){for(let t in i)r.setAttributeNS(null,t,i[t].toString())}function rt(r,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",r);return Zt(t,i),t}function go(r,i,t){let{x:e,y:s,width:o,height:n}=r,l=i.includes("w")?0:1,a=i.includes("n")?0:1,c=[-1,1][l],d=[-1,1][a],h=[e+l*o+1.5*c,s+a*n+1.5*d-24*t*d],p=[e+l*o+1.5*c,s+a*n+1.5*d],f=[e+l*o-24*t*c+1.5*c,s+a*n+1.5*d];return{d:`M ${h[0]} ${h[1]} L ${p[0]} ${p[1]} L ${f[0]} ${f[1]}`,center:p}}function bo(r,i,t){let{x:e,y:s,width:o,height:n}=r,l=["n","s"].includes(i)?.5:{w:0,e:1}[i],a=["w","e"].includes(i)?.5:{n:0,s:1}[i],c=[-1,1][l],d=[-1,1][a],h,p;["n","s"].includes(i)?(h=[e+l*o-34*t/2,s+a*n+1.5*d],p=[e+l*o+34*t/2,s+a*n+1.5*d]):(h=[e+l*o+1.5*c,s+a*n-34*t/2],p=[e+l*o+1.5*c,s+a*n+34*t/2]);let f=`M ${h[0]} ${h[1]} L ${p[0]} ${p[1]}`,m=[p[0]-(p[0]-h[0])/2,p[1]-(p[1]-h[1])/2];return{d:f,center:m}}function yo(r){return r===""?"move":["e","w"].includes(r)?"ew-resize":["n","s"].includes(r)?"ns-resize":["nw","se"].includes(r)?"nwse-resize":"nesw-resize"}function _o({rect:r,delta:[i,t],imageBox:e}){return ae({...r,x:r.x+i,y:r.y+t},e)}function ae(r,i){let{x:t}=r,{y:e}=r;return r.x<i.x?t=i.x:r.x+r.width>i.x+i.width&&(t=i.x+i.width-r.width),r.y<i.y?e=i.y:r.y+r.height>i.y+i.height&&(e=i.y+i.height-r.height),{...r,x:t,y:e}}function Gl({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,s]=i,{y:o,width:n,height:l}=r;o+=s,l-=s,t&&(n=l*t);let a=r.x+r.width/2-n/2;return o<=e.y&&(o=e.y,l=r.y+r.height-o,t&&(n=l*t,a=r.x+r.width/2-n/2)),a<=e.x&&(a=e.x,o=r.y+r.height-l),a+n>=e.x+e.width&&(a=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-a,t&&(l=n/t),o=r.y+r.height-l),l<T&&(l=T,t&&(n=l*t,a=r.x+r.width/2-n/2),o=r.y+r.height-l),n<T&&(n=T,t&&(l=n/t,a=r.x+r.width/2-n/2),o=r.y+r.height-l),{x:a,y:o,width:n,height:l}}function Xl({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s]=i,{x:o,width:n,height:l}=r;o+=s,n-=s,t&&(l=n/t);let a=r.y+r.height/2-l/2;return o<=e.x&&(o=e.x,n=r.x+r.width-o,t&&(l=n/t,a=r.y+r.height/2-l/2)),a<=e.y&&(a=e.y,o=r.x+r.width-n),a+l>=e.y+e.height&&(a=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-a,t&&(n=l*t),o=r.x+r.width-n),l<T&&(l=T,t&&(n=l*t),a=r.y+r.height/2-l/2,o=r.x+r.width-n),n<T&&(n=T,t&&(l=n/t),a=r.y+r.height/2-l/2,o=r.x+r.width-n),{x:o,y:a,width:n,height:l}}function Wl({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,s]=i,{y:o,width:n,height:l}=r;l+=s,t&&(n=l*t);let a=r.x+r.width/2-n/2;return o+l>=e.y+e.height&&(l=e.y+e.height-o,t&&(n=l*t),a=r.x+r.width/2-n/2),a<=e.x&&(a=e.x,o=r.y),a+n>=e.x+e.width&&(a=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-a,t&&(l=n/t),o=r.y),l<T&&(l=T,t&&(n=l*t),a=r.x+r.width/2-n/2),n<T&&(n=T,t&&(l=n/t),a=r.x+r.width/2-n/2),{x:a,y:o,width:n,height:l}}function Kl({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s]=i,{x:o,width:n,height:l}=r;n+=s,t&&(l=n/t);let a=r.y+r.height/2-l/2;return o+n>=e.x+e.width&&(n=e.x+e.width-o,t&&(l=n/t),a=r.y+r.height/2-l/2),a<=e.y&&(a=e.y,o=r.x),a+l>=e.y+e.height&&(a=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-a,t&&(n=l*t),o=r.x),l<T&&(l=T,t&&(n=l*t),a=r.y+r.height/2-l/2),n<T&&(n=T,t&&(l=n/t),a=r.y+r.height/2-l/2),{x:o,y:a,width:n,height:l}}function ql({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s,o]=i,{x:n,y:l,width:a,height:c}=r;return n+s<e.x&&(s=e.x-n),l+o<e.y&&(o=e.y-l),n+=s,a-=s,l+=o,c-=o,t&&Math.abs(a/c)>t?(o=a/t-c,c+=o,l-=o,l<=e.y&&(c=c-(e.y-l),a=c*t,n=r.x+r.width-a,l=e.y)):t&&(s=c*t-a,a=a+s,n-=s,n<=e.x&&(a=a-(e.x-n),c=a/t,n=e.x,l=r.y+r.height-c)),c<T&&(c=T,t&&(a=c*t),n=r.x+r.width-a,l=r.y+r.height-c),a<T&&(a=T,t&&(c=a/t),n=r.x+r.width-a,l=r.y+r.height-c),{x:n,y:l,width:a,height:c}}function Zl({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s,o]=i,{x:n,y:l,width:a,height:c}=r;return n+a+s>e.x+e.width&&(s=e.x+e.width-n-a),l+o<e.y&&(o=e.y-l),a+=s,l+=o,c-=o,t&&Math.abs(a/c)>t?(o=a/t-c,c+=o,l-=o,l<=e.y&&(c=c-(e.y-l),a=c*t,n=r.x,l=e.y)):t&&(s=c*t-a,a+=s,n+a>=e.x+e.width&&(a=e.x+e.width-n,c=a/t,n=e.x+e.width-a,l=r.y+r.height-c)),c<T&&(c=T,t&&(a=c*t),l=r.y+r.height-c),a<T&&(a=T,t&&(c=a/t),l=r.y+r.height-c),{x:n,y:l,width:a,height:c}}function Yl({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s,o]=i,{x:n,y:l,width:a,height:c}=r;return n+s<e.x&&(s=e.x-n),l+c+o>e.y+e.height&&(o=e.y+e.height-l-c),n+=s,a-=s,c+=o,t&&Math.abs(a/c)>t?(o=a/t-c,c+=o,l+c>=e.y+e.height&&(c=e.y+e.height-l,a=c*t,n=r.x+r.width-a,l=e.y+e.height-c)):t&&(s=c*t-a,a+=s,n-=s,n<=e.x&&(a=a-(e.x-n),c=a/t,n=e.x,l=r.y)),c<T&&(c=T,t&&(a=c*t),n=r.x+r.width-a),a<T&&(a=T,t&&(c=a/t),n=r.x+r.width-a),{x:n,y:l,width:a,height:c}}function Jl({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s,o]=i,{x:n,y:l,width:a,height:c}=r;return n+a+s>e.x+e.width&&(s=e.x+e.width-n-a),l+c+o>e.y+e.height&&(o=e.y+e.height-l-c),a+=s,c+=o,t&&Math.abs(a/c)>t?(o=a/t-c,c+=o,l+c>=e.y+e.height&&(c=e.y+e.height-l,a=c*t,n=r.x,l=e.y+e.height-c)):t&&(s=c*t-a,a+=s,n+a>=e.x+e.width&&(a=e.x+e.width-n,c=a/t,n=e.x+e.width-a,l=r.y)),c<T&&(c=T,t&&(a=c*t)),a<T&&(a=T,t&&(c=a/t)),{x:n,y:l,width:a,height:c}}function vo({direction:r,...i}){switch(r){case"n":return Gl(i);case"w":return Xl(i);case"s":return Wl(i);case"e":return Kl(i);case"nw":return ql(i);case"ne":return Zl(i);case"sw":return Yl(i);case"se":return Jl(i);default:return i.rect}}function wo(r,[i,t]){return r.x<=i&&i<=r.x+r.width&&r.y<=t&&t<=r.y+r.height}function Co(r,i){return r.x>=i.x&&r.y>=i.y&&r.x+r.width<=i.x+i.width&&r.y+r.height<=i.y+i.height}function xo(r,i){return Math.abs(r.width/r.height-i)<.1}function ce({width:r,height:i},t){let e=t/90%2!==0;return{width:e?i:r,height:e?r:i}}function Eo(r,i,t){let e=r/i,s,o;e>t?(s=Math.round(i*t),o=i):(s=r,o=Math.round(r/t));let n=Math.round((r-s)/2),l=Math.round((i-o)/2);return n+s>r&&(s=r-n),l+o>i&&(o=i-l),{x:n,y:l,width:s,height:o}}function ue(r){return{x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)}}function Bt(r,i,t){return Math.min(Math.max(r,i),t)}var Si=r=>{if(!r)return[];let[i,t]=r.split(":").map(Number);if(!Number.isFinite(i)||!Number.isFinite(t)){console.error(`Invalid crop preset: ${r}`);return}return[{type:"aspect-ratio",width:i,height:t}]};var he="blocks",de="1.5.2";function Ao(r){return Sr({...r,libraryName:he,libraryVersion:de})}var To=r=>Math.floor(r/1e3),So=(r,{threshold:i})=>{let{secureExpire:t}=r,e=To(Date.now()),s=Number(t),o=To(i);return e+o>=s};var ki=class{constructor(i){u(this,"_block");u(this,"_secureToken",null);this._block=i}_debugPrint(...i){this._block.debugPrint("[secure-uploads]",...i)}async getSecureToken(){let{secureSignature:i,secureExpire:t,secureUploadsSignatureResolver:e}=this._block.cfg;if((i||t)&&e&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),e){if(!this._secureToken||So(this._secureToken,{threshold:this._block.cfg.secureUploadsExpireThreshold})){this._secureToken?this._debugPrint("Secure signature is expired. Resolving a new one..."):this._debugPrint("Secure signature is not set yet.");try{let s=await e();s?!s.secureSignature||!s.secureExpire?console.error("Secure signature resolver returned an invalid result:",s):(this._debugPrint("Secure signature resolved:",s),this._debugPrint("Secure signature will expire in",new Date(Number(s.secureExpire)*1e3).toISOString()),this._secureToken=s):(this._debugPrint("Secure signature resolver returned nothing."),this._secureToken=null)}catch(s){console.error("Secure signature resolving failed. Falling back to the previous one.",s)}}return this._secureToken}return i&&t?(this._debugPrint("Secure signature and expire are set. Using them...",{secureSignature:i,secureExpire:t}),{secureSignature:i,secureExpire:t}):null}};var ko="[Typed State] Wrong property name: ",Ql="[Typed State] Wrong property type: ",$i=class{constructor(i,t){this.__typedSchema=i,this.__ctxId=t||nt.generate(),this.__schema=Object.keys(i).reduce((e,s)=>(e[s]=i[s].value,e),{}),this.__data=$.registerCtx(this.__schema,this.__ctxId)}get uid(){return this.__ctxId}setValue(i,t){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(ko+i);return}let e=this.__typedSchema[i];if((t==null?void 0:t.constructor)===e.type||t instanceof e.type||e.nullable&&t===null){this.__data.pub(i,t);return}console.warn(Ql+i)}setMultipleValues(i){for(let t in i)this.setValue(t,i[t])}getValue(i){if(!this.__typedSchema.hasOwnProperty(i)){console.warn(ko+i);return}return this.__data.read(i)}subscribe(i,t){return this.__data.sub(i,t)}remove(){$.deleteCtx(this.__ctxId)}};var Ii=class{constructor(i){this.__typedSchema=i.typedSchema,this.__ctxId=i.ctxName||nt.generate(),this.__data=$.registerCtx({},this.__ctxId),this.__watchList=i.watchList||[],this.__subsMap=Object.create(null),this.__propertyObservers=new Set,this.__collectionObservers=new Set,this.__items=new Set,this.__removed=new Set,this.__added=new Set;let t=Object.create(null);this.__notifyObservers=(e,s)=>{this.__observeTimeout&&window.clearTimeout(this.__observeTimeout),t[e]||(t[e]=new Set),t[e].add(s),this.__observeTimeout=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.__propertyObservers.forEach(o=>{o({...t})}),t=Object.create(null))})}}notify(){this.__notifyTimeout&&window.clearTimeout(this.__notifyTimeout),this.__notifyTimeout=window.setTimeout(()=>{let i=new Set(this.__added),t=new Set(this.__removed);this.__added.clear(),this.__removed.clear();for(let e of this.__collectionObservers)e==null||e([...this.__items],i,t)})}observeCollection(i){return this.__collectionObservers.add(i),this.__items.size>0&&this.notify(),()=>{this.unobserveCollection(i)}}unobserveCollection(i){var t;(t=this.__collectionObservers)==null||t.delete(i)}add(i){let t=new $i(this.__typedSchema);for(let e in i)t.setValue(e,i[e]);return this.__items.add(t.uid),this.notify(),this.__data.add(t.uid,t),this.__added.add(t),this.__watchList.forEach(e=>{this.__subsMap[t.uid]||(this.__subsMap[t.uid]=[]),this.__subsMap[t.uid].push(t.subscribe(e,()=>{this.__notifyObservers(e,t.uid)}))}),t.uid}read(i){return this.__data.read(i)}readProp(i,t){return this.read(i).getValue(t)}publishProp(i,t,e){this.read(i).setValue(t,e)}remove(i){this.__removed.add(this.__data.read(i)),this.__items.delete(i),this.notify(),this.__data.pub(i,null),delete this.__subsMap[i]}clearAll(){this.__items.forEach(i=>{this.remove(i)})}observeProperties(i){return this.__propertyObservers.add(i),()=>{this.unobserveProperties(i)}}unobserveProperties(i){var t;(t=this.__propertyObservers)==null||t.delete(i)}findItems(i){let t=[];return this.__items.forEach(e=>{let s=this.read(e);i(s)&&t.push(e)}),t}items(){return[...this.__items]}get size(){return this.__items.size}destroy(){$.deleteCtx(this.__ctxId),this.__propertyObservers=null,this.__collectionObservers=null;for(let i in this.__subsMap)this.__subsMap[i].forEach(t=>{t.remove()}),delete this.__subsMap[i]}};var Q=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",URL_TAB:"url-tab",CAMERA:"camera",EXTERNAL:"external",API:"js-api"});var Me=["image/*","image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Oi=r=>r?r.filter(i=>typeof i=="string").map(i=>G(i)).flat():[],Br=(r,i)=>i.some(t=>t.endsWith("*")?(t=t.replace("*",""),r.startsWith(t)):r===t),$o=(r,i)=>i.some(t=>t.startsWith(".")?r.toLowerCase().endsWith(t.toLowerCase()):!1),Io=r=>{let i=r==null?void 0:r.type;return i?Br(i,Me):!1};var ta=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,ea=new RegExp(`^/?(${ta.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),Oo=({url:r,cdnBase:i})=>{let t=new URL(i),e=new URL(r);if(t.host!==e.host)return null;let[,s,o,n]=ea.exec(e.pathname);return{uuid:s,cdnUrlModifiers:o||"",filename:n||null}};var Lo=r=>{let i=new Map;return(...t)=>{let e=JSON.stringify(t);if(i.has(e))return i.get(e);let s=r(...t);return i.set(e,s),s}};var Uo=new Set;function Mo(r){Uo.has(r)||(Uo.add(r),console.warn(r))}function ia(r){let i=!1;return setTimeout(()=>{i=!0},0),e=>(...s)=>(i&&Mo(r),e(...s))}function Po(r){let i={progress:()=>r.$["*commonProgress"],errors:()=>r.$["*collectionErrors"],group:()=>r.$["*groupInfo"],totalCount:()=>r.uploadCollection.size,failedCount:()=>t.failedEntries.length,successCount:()=>t.successEntries.length,uploadingCount:()=>t.uploadingEntries.length,status:()=>t.isFailed?"failed":t.isUploading?"uploading":t.isSuccess?"success":"idle",isSuccess:()=>t.allEntries.length>0&&t.errors.length===0&&t.successEntries.length===t.allEntries.length,isUploading:()=>t.allEntries.some(s=>s.status==="uploading"),isFailed:()=>t.errors.length>0||t.failedEntries.length>0,allEntries:()=>r.getOutputData(),successEntries:()=>t.allEntries.filter(s=>s.status==="success"),failedEntries:()=>t.allEntries.filter(s=>s.status==="failed"),uploadingEntries:()=>t.allEntries.filter(s=>s.status==="uploading"),idleEntries:()=>t.allEntries.filter(s=>s.status==="idle")},t={},e=ia("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[s,o]of Object.entries(i)){let n=s,a=Lo(e(o));Object.defineProperty(t,n,{get:a,enumerable:!0})}return t}var Li=class{constructor(i){u(this,"_ctx");u(this,"addFileFromUrl",(i,{silent:t,fileName:e,source:s}={})=>{let o=this._uploadCollection.add({externalUrl:i,fileName:e!=null?e:null,silent:t!=null?t:!1,source:s!=null?s:Q.API});return this.getOutputItem(o)});u(this,"addFileFromUuid",(i,{silent:t,fileName:e,source:s}={})=>{let o=this._uploadCollection.add({uuid:i,fileName:e!=null?e:null,silent:t!=null?t:!1,source:s!=null?s:Q.API});return this.getOutputItem(o)});u(this,"addFileFromCdnUrl",(i,{silent:t,fileName:e,source:s}={})=>{var l;let o=Oo({url:i,cdnBase:this.cfg.cdnCname});if(!o)throw new Error("Invalid CDN URL");let n=this._uploadCollection.add({uuid:o.uuid,cdnUrl:i,cdnUrlModifiers:o.cdnUrlModifiers,fileName:(l=e!=null?e:o.filename)!=null?l:null,silent:t!=null?t:!1,source:s!=null?s:Q.API});return this.getOutputItem(n)});u(this,"addFileFromObject",(i,{silent:t,fileName:e,source:s,fullPath:o}={})=>{let n=this._uploadCollection.add({file:i,isImage:Io(i),mimeType:i.type,fileName:e!=null?e:i.name,fileSize:i.size,silent:t!=null?t:!1,source:s!=null?s:Q.API,fullPath:o!=null?o:null});return this.getOutputItem(n)});u(this,"removeFileByInternalId",i=>{if(!this._uploadCollection.read(i))throw new Error(`File with internalId ${i} not found`);this._uploadCollection.remove(i)});u(this,"uploadAll",()=>{let i=this._uploadCollection.items().filter(t=>{let e=this._uploadCollection.read(t);return!e.getValue("isRemoved")&&!e.getValue("isUploading")&&!e.getValue("fileInfo")});i.length!==0&&(this._ctx.$["*uploadTrigger"]=new Set(i),this._ctx.emit(I.COMMON_UPLOAD_START,this.getOutputCollectionState()))});u(this,"openSystemDialog",(i={})=>{var o;let t=se(Oi([(o=this.cfg.accept)!=null?o:"",...this.cfg.imgOnly?Me:[]]));this.cfg.accept&&this.cfg.imgOnly&&console.warn("There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list.");let e="uploadcare-file-input",s=document.createElement("input");s.setAttribute(e,""),Wt(s,{opacity:0,height:0,width:0,visibility:"hidden"}),s.type="file",s.multiple=this.cfg.multiple,i.captureCamera?(s.capture=this.cfg.cameraCapture,s.accept="image/*"):s.accept=t,s.addEventListener("change",()=>{s.files&&([...s.files].forEach(n=>this.addFileFromObject(n,{source:i.captureCamera?Q.CAMERA:Q.LOCAL})),this._ctx.$["*currentActivity"]=v.activities.UPLOAD_LIST,this._ctx.setOrAddState("*modalActive",!0),s.remove())},{once:!0}),document.querySelectorAll(`[${e}]`).forEach(n=>n.remove()),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"))});u(this,"getOutputItem",i=>{var n,l,a,c,d,h,p,f,m,y;let t=$.getCtx(i).store,e=t.fileInfo,s=t.isRemoved?"removed":t.errors.length>0?"failed":t.fileInfo?"success":t.isUploading?"uploading":"idle";return{uuid:(l=(n=e==null?void 0:e.uuid)!=null?n:t.uuid)!=null?l:null,internalId:i,name:(a=e==null?void 0:e.originalFilename)!=null?a:t.fileName,size:(c=e==null?void 0:e.size)!=null?c:t.fileSize,isImage:(d=e==null?void 0:e.isImage)!=null?d:t.isImage,mimeType:(h=e==null?void 0:e.mimeType)!=null?h:t.mimeType,file:t.file,externalUrl:t.externalUrl,cdnUrlModifiers:t.cdnUrlModifiers,cdnUrl:(f=(p=t.cdnUrl)!=null?p:e==null?void 0:e.cdnUrl)!=null?f:null,fullPath:t.fullPath,uploadProgress:t.uploadProgress,fileInfo:e!=null?e:null,metadata:(y=(m=t.metadata)!=null?m:e==null?void 0:e.metadata)!=null?y:null,isSuccess:s==="success",isUploading:s==="uploading",isFailed:s==="failed",isRemoved:s==="removed",errors:t.errors,status:s}});u(this,"getOutputCollectionState",()=>Po(this._ctx));u(this,"initFlow",(i=!1)=>{var t;if(this._uploadCollection.size>0&&!i)this._ctx.set$({"*currentActivity":v.activities.UPLOAD_LIST}),this._ctx.setOrAddState("*modalActive",!0);else if(((t=this._sourceList)==null?void 0:t.length)===1){let e=this._sourceList[0];if(e==="local"){this._ctx.$["*currentActivity"]=v.activities.UPLOAD_LIST,this.openSystemDialog();return}let s=this._ctx.$["*blocksRegistry"],o=l=>"type"in l&&l.type===e,n=[...s].find(o);n==null||n.activate(),this._ctx.$["*currentActivity"]&&this._ctx.setOrAddState("*modalActive",!0)}else this._ctx.set$({"*currentActivity":v.activities.START_FROM}),this._ctx.setOrAddState("*modalActive",!0)});u(this,"doneFlow",()=>{this._ctx.set$({"*currentActivity":this._ctx.doneActivity,"*history":this._ctx.doneActivity?[this._ctx.doneActivity]:[]}),this._ctx.$["*currentActivity"]||this._ctx.setOrAddState("*modalActive",!1)});u(this,"setCurrentActivity",(i,t=void 0)=>{if(this._ctx.hasBlockInCtx(e=>e.activityType===i)){this._ctx.set$({"*currentActivityParams":t!=null?t:{},"*currentActivity":i});return}console.warn(`Activity type "${i}" not found in the context`)});u(this,"getCurrentActivity",()=>this._ctx.$["*currentActivity"]);u(this,"setModalState",i=>{if(i&&!this._ctx.$["*currentActivity"]){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}this._ctx.setOrAddState("*modalActive",i)});this._ctx=i}get _uploadCollection(){return this._ctx.uploadCollection}get cfg(){return this._ctx.cfg}get l10n(){return this._ctx.l10n.bind(this._ctx)}removeAllFiles(){this._uploadCollection.clearAll()}get _sourceList(){let i=[];return this.cfg.sourceList&&(i=G(this.cfg.sourceList)),i}};var zr=(r,i)=>{let t=i.cfg.imgOnly,e=r.isImage;if(!(!t||e)&&!(!r.fileInfo&&r.externalUrl)&&!(!r.fileInfo&&!r.mimeType))return{type:"NOT_AN_IMAGE",message:i.l10n("images-only-accepted"),payload:{entry:r}}};var Vr=(r,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,s=Oi([...t?Me:[],e]);if(!s.length)return;let o=r.mimeType,n=r.name;if(!o||!n)return;let l=Br(o,s),a=$o(n,s);if(!l&&!a)return{type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:r}}};var gt=1e3,Yt=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Pe=r=>Math.ceil(r*100)/100,Ro=(r,i=Yt.AUTO)=>{let t=i===Yt.AUTO;if(i===Yt.BYTE||t&&r<gt**1){let e=fi("en-US",r),s={one:"byte",other:"bytes"}[e];return`${r} ${s}`}return i===Yt.KB||t&&r<gt**2?`${Pe(r/gt**1)} KB`:i===Yt.MB||t&&r<gt**3?`${Pe(r/gt**2)} MB`:i===Yt.GB||t&&r<gt**4?`${Pe(r/gt**3)} GB`:i===Yt.TB||t&&r<gt**5?`${Pe(r/gt**4)} TB`:`${Pe(r/gt**5)} PB`};var Hr=(r,i)=>{let t=i.cfg.maxLocalFileSizeBytes,e=r.size;if(t&&e&&e>t)return{type:"FILE_SIZE_EXCEEDED",message:i.l10n("files-max-size-limit-error",{maxFileSize:Ro(t)}),payload:{entry:r}}};var jr=(r,i)=>{let{internalId:t}=r,e=i._uploadCollection.read(t),s=e==null?void 0:e.getValue("uploadError");if(!s)return;if(s instanceof X)return{type:"UPLOAD_ERROR",message:s.message,payload:{entry:r,error:s}};if(s instanceof oe)return{type:"NETWORK_ERROR",message:s.message,payload:{entry:r,error:s}};let o=s instanceof Error?s:new Error("Unknown error",{cause:s});return{type:"UNKNOWN_ERROR",message:o.message,payload:{entry:r,error:o}}};var Gr=(r,i)=>{if(r.failedCount>0)return{type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}};var Xr=(r,i)=>{let t=r.totalCount,e=i.cfg.multiple?i.cfg.multipleMin:0,s=i.cfg.multiple?i.cfg.multipleMax:1;if(e&&t<e)return{type:"TOO_FEW_FILES",message:i.l10n("files-count-limit-error-too-few",{min:e,max:s,total:t}),payload:{total:t,min:e,max:s}};if(s&&t>s)return{type:"TOO_MANY_FILES",message:i.l10n("files-count-limit-error-too-many",{min:e,max:s,total:t}),payload:{total:t,min:e,max:s}}};var Ui={file:"File validator execution has failed",collection:"Collection validator execution has failed",message:"Missing message. We recommend adding message: value."},Mi=class{constructor(i){u(this,"_blockInstance");u(this,"_fileValidators",[zr,Vr,Hr,jr]);u(this,"_collectionValidators",[Xr,Gr]);this._blockInstance=i,this._uploadCollection=this._blockInstance.uploadCollection;let t=()=>{this.runFileValidators(),this.runCollectionValidators()};this._blockInstance.subConfigValue("maxLocalFileSizeBytes",t),this._blockInstance.subConfigValue("multipleMin",t),this._blockInstance.subConfigValue("multipleMax",t),this._blockInstance.subConfigValue("multiple",t),this._blockInstance.subConfigValue("imgOnly",t),this._blockInstance.subConfigValue("accept",t)}runFileValidators(i){let t=i!=null?i:this._uploadCollection.items();for(let e of t){let s=this._uploadCollection.read(e);s&&this._runFileValidatorsForEntry(s)}}runCollectionValidators(){let i=this._blockInstance.api.getOutputCollectionState(),t=[];for(let e of[...this._collectionValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.collectionValidators)])try{let s=e(i,this._blockInstance.api);if(!s)continue;s&&(t.push(s),s.message||console.warn(Ui.message))}catch(s){console.warn(Ui.collection,s)}this._blockInstance.$["*collectionErrors"]=t,t.length>0&&this._blockInstance.emit(I.COMMON_UPLOAD_FAILED,()=>this._blockInstance.api.getOutputCollectionState(),{debounce:!0})}_runFileValidatorsForEntry(i){let t=this._blockInstance.api.getOutputItem(i.uid),e=[];for(let s of[...this._fileValidators,...this._addCustomTypeToValidators(this._blockInstance.cfg.fileValidators)])try{let o=s(t,this._blockInstance.api);if(!o)continue;o&&(e.push(o),o.message||console.warn(Ui.message))}catch(o){console.warn(Ui.file,o)}i.setValue("errors",e)}_addCustomTypeToValidators(i){return i.map(t=>(...e)=>{let s=t(...e);return s?{...s,type:"CUSTOM_ERROR"}:void 0})}};var Fo=Object.freeze({file:{type:File,value:null},externalUrl:{type:String,value:null},fileName:{type:String,value:null,nullable:!0},fileSize:{type:Number,value:null,nullable:!0},lastModified:{type:Number,value:Date.now()},uploadProgress:{type:Number,value:0},uuid:{type:String,value:null},isImage:{type:Boolean,value:!1},mimeType:{type:String,value:null,nullable:!0},ctxName:{type:String,value:null},cdnUrl:{type:String,value:null},cdnUrlModifiers:{type:String,value:null},fileInfo:{type:Tt,value:null},isUploading:{type:Boolean,value:!1},abortController:{type:AbortController,value:null,nullable:!0},thumbUrl:{type:String,value:null,nullable:!0},silent:{type:Boolean,value:!1},source:{type:String,value:null,nullable:!0},fullPath:{type:String,value:null,nullable:!0},metadata:{type:Object,value:null,nullable:!0},errors:{type:Array,value:[]},uploadError:{type:Error,value:null,nullable:!0},isRemoved:{type:Boolean,value:!1}});var S=class r extends v{constructor(){super(...arguments);u(this,"couldBeCtxOwner",!1);u(this,"isCtxOwner",!1);u(this,"init$",Ci(this));u(this,"_flushOutputItems",M(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(I.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this._createGroup(e)},300));u(this,"_handleCollectionUpdate",(t,e,s)=>{var o;(e.size||s.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators(),this.validationManager.runCollectionValidators();for(let n of e)n.getValue("silent")||this.emit(I.FILE_ADDED,this.api.getOutputItem(n.uid));for(let n of s)this.$["*uploadTrigger"].delete(n.uid),(o=n.getValue("abortController"))==null||o.abort(),n.setMultipleValues({isRemoved:!0,abortController:null,isUploading:!1,uploadProgress:0}),URL.revokeObjectURL(n==null?void 0:n.getValue("thumbUrl")),this.emit(I.FILE_REMOVED,this.api.getOutputItem(n.uid));this.$["*uploadList"]=t.map(n=>({uid:n})),this._flushCommonUploadProgress(),this._flushOutputItems()});u(this,"_handleCollectionPropertiesUpdate",t=>{this._flushOutputItems();let e=this.uploadCollection,s=[...new Set(Object.entries(t).filter(([o])=>["uploadError","fileInfo"].includes(o)).map(([,o])=>[...o]).flat())];if(s.length>0&&setTimeout(()=>{this.validationManager.runFileValidators(s)}),t.uploadProgress){for(let o of t.uploadProgress){let{isUploading:n,silent:l}=$.getCtx(o).store;n&&!l&&this.emit(I.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(o))}this._flushCommonUploadProgress()}if(t.isUploading)for(let o of t.isUploading){let{isUploading:n,silent:l}=$.getCtx(o).store;n&&!l&&this.emit(I.FILE_UPLOAD_START,this.api.getOutputItem(o))}if(t.fileInfo){for(let o of t.fileInfo){let{fileInfo:n,silent:l}=$.getCtx(o).store;n&&!l&&this.emit(I.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(o))}this.cfg.cropPreset&&this.setInitialCrop()}if(t.errors){for(let l of t.errors){let{errors:a}=$.getCtx(l).store;a.length>0&&(this.emit(I.FILE_UPLOAD_FAILED,this.api.getOutputItem(l)),this.emit(I.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:!0}))}let o=e.findItems(l=>!!l.getValue("fileInfo")),n=e.findItems(l=>l.getValue("errors").length>0);e.size>0&&n.length===0&&e.size===o.length&&this.$["*collectionErrors"].length===0&&this.emit(I.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState())}t.cdnUrl&&([...t.cdnUrl].filter(n=>{var l;return!!((l=this.uploadCollection.read(n))!=null&&l.getValue("cdnUrl"))}).forEach(n=>{this.emit(I.FILE_URL_CHANGED,this.api.getOutputItem(n))}),this.$["*groupInfo"]=null)});u(this,"_flushCommonUploadProgress",()=>{let t=0,s=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));s.forEach(n=>{let l=this.uploadCollection.readProp(n,"uploadProgress");t+=l});let o=s.length?Math.round(t/s.length):0;this.$["*commonProgress"]!==o&&(this.$["*commonProgress"]=o,this.emit(I.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()))})}get hasCtxOwner(){return this.hasBlockInCtx(t=>t instanceof r?t.isCtxOwner&&t.isConnected&&t!==this:!1)}initCallback(){if(super.initCallback(),!this.has("*uploadCollection")){let t=new Ii({typedSchema:Fo,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading"]});this.add("*uploadCollection",t)}this.has("*publicApi")||this.add("*publicApi",new Li(this)),this.has("*validationManager")||this.add("*validationManager",new Mi(this)),!this.hasCtxOwner&&this.couldBeCtxOwner&&this.initCtxOwner()}get validationManager(){if(!this.has("*validationManager"))throw new Error("Unexpected error: ValidationManager is not initialized");return this.$["*validationManager"]}get api(){if(!this.has("*publicApi"))throw new Error("Unexpected error: UploaderPublicApi is not initialized");return this.$["*publicApi"]}getAPI(){return this.api}get uploadCollection(){if(!this.has("*uploadCollection"))throw new Error("Unexpected error: TypedCollection is not initialized");return this.$["*uploadCollection"]}destroyCtxCallback(){var t,e;(t=this._unobserveCollectionProperties)==null||t.call(this),(e=this._unobserveCollection)==null||e.call(this),this.uploadCollection.destroy(),this.$["*uploadCollection"]=null,super.destroyCtxCallback()}initCtxOwner(){this.isCtxOwner=!0,this._unobserveCollection=this.uploadCollection.observeCollection(this._handleCollectionUpdate),this._unobserveCollectionProperties=this.uploadCollection.observeProperties(this._handleCollectionPropertiesUpdate),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1}),this.$["*secureUploadsManager"]||(this.$["*secureUploadsManager"]=new ki(this)),this.has("*modalActive")&&this.sub("*modalActive",t=>{t&&!this.$["*currentActivity"]&&(this.$["*modalActive"]=!1)})}async _createGroup(t){let e=await this.getUploadClientOptions(),s=t.allEntries.map(a=>a.uuid+(a.cdnUrlModifiers?`/${a.cdnUrlModifiers}`:"")),o=new AbortController,n=await io(s,{...e,signal:o.signal});if(this.$["*collectionState"]!==t){o.abort();return}this.$["*groupInfo"]=n;let l=this.api.getOutputCollectionState();this.emit(I.GROUP_CREATED,l),this.emit(I.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:!0}),this.$["*collectionState"]=l}setInitialCrop(){let t=Si(this.cfg.cropPreset);if(t){let[e]=t,s=this.uploadCollection.findItems(o=>{var n;return o.getValue("fileInfo")&&o.getValue("isImage")&&!((n=o.getValue("cdnUrlModifiers"))!=null&&n.includes("/crop/"))}).map(o=>this.uploadCollection.read(o));for(let o of s){let n=o.getValue("fileInfo"),{width:l,height:a}=n.imageInfo,c=e.width/e.height,d=Eo(l,a,c),h=j(`crop/${d.width}x${d.height}/${d.x},${d.y}`,"preview");o.setMultipleValues({cdnUrlModifiers:h,cdnUrl:R(o.getValue("cdnUrl"),h)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(p=>p.activityType===v.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:o.uid},this.$["*currentActivity"]=v.activities.CLOUD_IMG_EDIT)}}}async getMetadataFor(t){let e=this.cfg.metadata||void 0;if(typeof e=="function"){let s=this.api.getOutputItem(t);return await e(s)}return e}async getUploadClientOptions(){let e=await this.$["*secureUploadsManager"].getSecureToken().catch(()=>null);return{store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:Ao,integration:this.cfg.userAgentIntegration,secureSignature:e==null?void 0:e.secureSignature,secureExpire:e==null?void 0:e.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads}}getOutputData(){return this.uploadCollection.items().map(s=>this.api.getOutputItem(s))}};S.extSrcList=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",INSTAGRAM:"instagram",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"});S.sourceTypes=Object.freeze({LOCAL:"local",URL:"url",CAMERA:"camera",DRAW:"draw",...S.extSrcList});var Re=r=>{var i;return(i=r.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g))==null?void 0:i.map(t=>t.toLowerCase()).join("-")};var z=r=>String(r),ct=r=>{let i=Number(r);if(Number.isNaN(i))throw new Error(`Invalid number: "${r}"`);return i},L=r=>{if(typeof r=="undefined"||r===null)return!1;if(typeof r=="boolean")return r;if(r==="true"||r==="")return!0;if(r==="false")return!1;throw new Error(`Invalid boolean: "${r}"`)},ra=r=>r==="auto"?r:L(r),sa=r=>{let i=z(r);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid "cameraCapture" value: "${i}"`);return i},oa=r=>{if(typeof r=="object"&&!Array.isArray(r)||typeof r=="function")return r;throw new Error("Invalid metadata value. Must be an object or function.")},na=r=>{if(typeof r=="object")return r;throw new Error("Invalid value. Must be an object.")},Wr=r=>{if(typeof r=="function")return r;throw new Error("Invalid value. Must be a function.")},Do=r=>{if(Array.isArray(r))return r;throw new Error("Must be an array.")},la={pubkey:z,multiple:L,multipleMin:ct,multipleMax:ct,confirmUpload:L,imgOnly:L,accept:z,externalSourcesPreferredTypes:z,store:ra,cameraMirror:L,cameraCapture:sa,sourceList:z,maxLocalFileSizeBytes:ct,thumbSize:ct,showEmptyList:L,useLocalImageEditor:L,useCloudImageEditor:L,cloudImageEditorTabs:z,removeCopyright:L,cropPreset:z,imageShrink:z,modalScrollLock:L,modalBackdropStrokes:L,sourceListWrap:L,remoteTabSessionKey:z,cdnCname:z,baseUrl:z,socialBaseUrl:z,secureSignature:z,secureExpire:z,secureDeliveryProxy:z,retryThrottledRequestMaxTimes:ct,multipartMinFileSize:ct,multipartChunkSize:ct,maxConcurrentRequests:ct,multipartMaxConcurrentRequests:ct,multipartMaxAttempts:ct,checkForUrlDuplicates:L,saveUrlForRecurrentUploads:L,groupOutput:L,userAgentIntegration:z,debug:L,localeName:z,metadata:oa,secureUploadsExpireThreshold:ct,localeDefinitionOverride:na,secureUploadsSignatureResolver:Wr,secureDeliveryProxyUrlResolver:Wr,iconHrefResolver:Wr,fileValidators:Do,collectionValidators:Do},No=(r,i)=>{if(!(typeof i=="undefined"||i===null))try{return la[r](i)}catch(t){return console.error(`Invalid value for config key "${r}".`,t),at[r]}};var Kr=[...new Set(["debug",...Object.keys(at)])],aa=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators"],ca=r=>aa.includes(r),pe=Kr.filter(r=>!ca(r)),ua={...Object.fromEntries(pe.map(r=>[Re(r),r])),...Object.fromEntries(pe.map(r=>[r.toLowerCase(),r]))},ha={...Object.fromEntries(pe.map(r=>[Re(r),J(r)])),...Object.fromEntries(pe.map(r=>[r.toLowerCase(),J(r)]))},Bo=r=>"__"+r,Fe=class extends w{constructor(){super();u(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(at).map(([t,e])=>[J(t),e]))}}_flushValueToAttribute(t,e){if(pe.includes(t)){let s=[...new Set([Re(t),t.toLowerCase()])];for(let o of s)typeof e=="undefined"||e===null?this.removeAttribute(o):this.getAttribute(o)!==e.toString()&&this.setAttribute(o,e.toString())}}_flushValueToState(t,e){this.$[J(t)]!==e&&(typeof e=="undefined"||e===null?this.$[J(t)]=at[t]:this.$[J(t)]=e)}_setValue(t,e){let s=this,o=No(t,e),n=Bo(t);s[n]!==o&&(this._assertSameValueDifferentReference(t,s[n],o),s[n]=o,this._flushValueToAttribute(t,o),this._flushValueToState(t,o),this.debugPrint(`[uc-config] "${t}"`,o))}_getValue(t){let e=this,s=Bo(t);return e[s]}_assertSameValueDifferentReference(t,e,s){this.cfg.debug&&s!==e&&typeof s=="object"&&typeof e=="object"&&JSON.stringify(s)===JSON.stringify(e)&&(console.warn(`[uc-config] Option "${t}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${t}" previous value:`,e),console.warn(`[uc-config] "${t}" new value:`,s))}initCallback(){var e;super.initCallback();let t=this;for(let s of pe)this.sub(J(s),o=>{this._setValue(s,o)},!1);for(let s of Kr){let o=(e=t[s])!=null?e:this.$[J(s)];o!==at[s]&&this._setValue(s,o),Object.defineProperty(this,s,{set:n=>{this._setValue(s,n)},get:()=>this._getValue(s)})}}attributeChangedCallback(t,e,s){if(e===s)return;let o=this,n=ua[t];o[n]=s}};Fe.bindAttributes(ha);for(let r of Kr)Fe.prototype[r]=void 0;var da=Fe;var De=class extends w{constructor(){super(),this.init$={...this.init$,name:"",href:""}}initCallback(){super.initCallback(),this.sub("name",i=>{if(!i)return;let t=`#uc-icon-${i}`;this.subConfigValue("iconHrefResolver",e=>{if(e){let s=e(i);t=s!=null?s:t}this.$.href=t})})}};De.template=b`<svg ref="svg" xmlns="http://www.w3.org/2000/svg"><use set="@href: href;"></use></svg>`;De.bindAttributes({name:"name"});var zo=r=>[...new Set(r)];var Vo=r=>Object.entries(r).filter(([,i])=>i!==void 0&&i!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`);var pa="https://ucarecdn.com",Ne=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:pa},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});var fe="--uc-img-",qr="unresolved";var Zr=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),Yr=3e3,Jr=5e3,Qr=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var jo=Object.create(null),Ho;for(let r in Ne)jo[fe+r]=((Ho=Ne[r])==null?void 0:Ho.default)||"";var Pi=class extends xt{constructor(){super(...arguments);u(this,"cssInit$",jo)}$$(t){return this.$[fe+t]}set$$(t){for(let e in t)this.$[fe+e]=t[e]}sub$$(t,e){this.sub(fe+t,s=>{s===null||s===""||e(s)})}analyticsParams(){return`-/@clib/${he}/${de}/uc-img/`}initAttributes(t){[...this.attributes].forEach(e=>{Ne[e.name]||t.setAttribute(e.name,e.value)})}initIntersection(t,e){let s={root:null,rootMargin:"0px"};this._isnObserver=new IntersectionObserver(o=>{o.forEach(n=>{n.isIntersecting&&(e(),this._isnObserver.unobserve(t))})},s),this._isnObserver.observe(t),this._observed||(this._observed=new Set),this._observed.add(t)}destroyCallback(){super.destroyCallback(),this._isnObserver&&(this._observed.forEach(t=>{this._isnObserver.unobserve(t)}),this._isnObserver=null),$.deleteCtx(this)}static get observedAttributes(){return Object.keys(Ne)}attributeChangedCallback(t,e,s){window.setTimeout(()=>{this.$[fe+t]=s})}};var Di=class extends Pi{constructor(){super(...arguments);u(this,"_img",new Image);u(this,"_imgPreview",new Image)}_fmtAbs(t){return!t.includes("//")&&!Zr&&(t=new URL(t,document.baseURI).href),t}_validateSize(t){if((t==null?void 0:t.trim())!==""){let e=t.match(/\d+/)[0],s=t.match(/[a-zA-Z]+/)[0],o=parseInt(e,10);if(Number(o)>Jr&&this.hasFormatJPG)return Jr+s;if(Number(o)>Yr&&!this.hasFormatJPG)return Yr+s}return t}_getCdnModifiers(t,e){let s={format:this.$$("format"),quality:this.$$("quality"),resize:this._validateSize(t),blur:e,"cdn-operations":this.$$("cdn-operations"),analytics:this.analyticsParams()};return j(...Vo(s))}_getUrlBase(t="",e=""){if(this.$$("src").startsWith("data:")||this.$$("src").startsWith("blob:"))return this.$$("src");if(Zr&&this.$$("src")&&!this.$$("src").includes("//"))return this._proxyUrl(this.$$("src"));let s=this._getCdnModifiers(t,e);if(this.$$("src").startsWith(this.$$("cdn-cname")))return R(this.$$("src"),s);if(this.$$("cdn-cname")&&this.$$("uuid"))return this._proxyUrl(R(Pt(this.$$("cdn-cname"),this.$$("uuid")),s));if(this.$$("uuid"))return this._proxyUrl(R(Pt(this.$$("cdn-cname"),this.$$("uuid")),s));if(this.$$("proxy-cname"))return this._proxyUrl(R(this.$$("proxy-cname"),s,this._fmtAbs(this.$$("src"))));if(this.$$("pubkey"))return this._proxyUrl(R(`https://${this.$$("pubkey")}.ucr.io/`,s,this._fmtAbs(this.$$("src"))))}_proxyUrl(t){return this.$$("secure-delivery-proxy")?ke(this.$$("secure-delivery-proxy"),{previewUrl:t},{transform:s=>window.encodeURIComponent(s)}):t}_getElSize(t,e=1,s=!0){let o=t.getBoundingClientRect(),n=e*Math.round(o.width),l=s?"":e*Math.round(o.height);return n||l?`${n||""}x${l||""}`:null}_setupEventProxy(t){let e=o=>{o.stopPropagation();let n=new Event(o.type,o);this.dispatchEvent(n)},s=["load","error"];for(let o of s)t.addEventListener(o,e)}get img(){return this.hasPreviewImage||(this._setupConfigForImage({elNode:this._img}),this.appendChild(this._img)),this._img}get currentImg(){return this.hasPreviewImage?{type:Qr.PREVIEW,img:this._imgPreview}:{type:Qr.MAIN,img:this.img}}get hasPreviewImage(){return this.$$("is-preview-blur")}get bgSelector(){return this.$$("is-background-for")}get breakpoints(){if(this.$$("breakpoints")){let t=G(this.$$("breakpoints"));return zo(t.map(e=>parseInt(e,10)))}else return null}get hasFormatJPG(){return this.$$("format").toLowerCase()==="jpeg"}renderBg(t){let e=new Set;e.add(`url("${this._getUrlBase(this._getElSize(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this._getUrlBase(this._getElSize(t,3))}") ${3}x`);let s=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",s),t.style.setProperty("background-image","-webkit-"+s)}getSrcset(){let t=new Set;return this.breakpoints?this.breakpoints.forEach(e=>{t.add(this._getUrlBase(e+"x")+` ${this._validateSize(e+"w")}`),this.$$("hi-res-support")&&t.add(this._getUrlBase(e*2+"x")+` ${this._validateSize(e*2+"w")}`),this.$$("ultra-res-support")&&t.add(this._getUrlBase(e*3+"x")+` ${this._validateSize(e*3+"w")}`)}):(t.add(this._getUrlBase(this._getElSize(this.currentImg.img))+" 1x"),this.$$("hi-res-support")&&t.add(this._getUrlBase(this._getElSize(this.currentImg.img,2))+" 2x"),this.$$("ultra-res-support")&&t.add(this._getUrlBase(this._getElSize(this.currentImg.img,3))+" 3x")),[...t].join()}getSrc(){return this._getUrlBase()}get srcUrlPreview(){return this._getUrlBase("100x","100")}renderBackground(){[...document.querySelectorAll(this.bgSelector)].forEach(t=>{this.$$("intersection")?this.initIntersection(t,()=>{this.renderBg(t)}):this.renderBg(t)})}_appendURL({elNode:t,src:e,srcset:s}){e&&(t.src=e),s&&(t.srcset=s)}_setupConfigForImage({elNode:t}){this._setupEventProxy(t),this.initAttributes(t)}loaderImage({src:t,srcset:e,elNode:s}){return new Promise((o,n)=>{this._setupConfigForImage({elNode:s}),s.setAttribute(qr,""),s.addEventListener("load",()=>{s.removeAttribute(qr),o(s)}),s.addEventListener("error",()=>{n(!1)}),this._appendURL({elNode:s,src:t,srcset:e})})}async renderImage(){var t,e;if(this.$$("intersection")){this.hasPreviewImage&&(this._setupConfigForImage({elNode:this._imgPreview}),this.appendChild(this._imgPreview)),this.initIntersection(this.currentImg.img,async()=>{var s;this.hasPreviewImage&&(this._imgPreview.src=this.srcUrlPreview);try{await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await this._imgPreview.remove(),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((s=this._imgPreview)==null?void 0:s.remove()),this.appendChild(this._img)}});return}try{this.hasPreviewImage&&(await this.loaderImage({src:this.srcUrlPreview,elNode:this._imgPreview}),this.appendChild(this._imgPreview)),await this.loaderImage({src:this.getSrc(),srcset:this.getSrcset(),elNode:this._img}),this.hasPreviewImage&&await((t=this._imgPreview)==null?void 0:t.remove()),this.appendChild(this._img)}catch{this.hasPreviewImage&&await((e=this._imgPreview)==null?void 0:e.remove()),this.appendChild(this._img)}}init(){this.bgSelector?this.renderBackground():this.renderImage()}};var ts=class extends Di{initCallback(){super.initCallback(),this.sub$$("src",()=>{this.init()}),this.sub$$("uuid",()=>{this.init()}),this.sub$$("lazy",i=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=i?"lazy":"eager")})}};var Be=class Be extends S{constructor(){super();u(this,"couldBeCtxOwner",!0);this.init$={...this.init$,withDropZone:!0,onClick:()=>{this.api.initFlow()},"button-text":""}}initCallback(){super.initCallback(),this.defineAccessor("dropzone",t=>{typeof t!="undefined"&&(this.$.withDropZone=L(t))}),this.subConfigValue("multiple",t=>{this.$["button-text"]=t?"upload-files":"upload-file"})}};u(Be,"styleAttrs",[...q(Be,Be,"styleAttrs"),"uc-simple-btn"]);var ze=Be;ze.template=b`<uc-drop-area set="@disabled: !withDropZone"><button type="button" set="onclick: onClick"><uc-icon name="upload"></uc-icon><span l10n="button-text"></span><slot></slot><div class="uc-visual-drop-area" l10n="drop-files-here"></div></button></uc-drop-area>`;ze.bindAttributes({dropzone:null});var Ni=class extends v{constructor(){super(...arguments);u(this,"historyTracked",!0);u(this,"activityType","start-from")}initCallback(){super.initCallback(),this.registerActivity(this.activityType)}};Ni.template=b`<div class="uc-content"><slot></slot></div>`;function fa(r){return new Promise(i=>{typeof window.FileReader!="function"&&i(!1);try{let t=new FileReader;t.onerror=()=>{i(!0)};let e=s=>{s.type!=="loadend"&&t.abort(),i(!1)};t.onloadend=e,t.onprogress=e,t.readAsDataURL(r)}catch{i(!1)}})}function ma(r,i){return new Promise(t=>{let e=0,s=[],o=l=>{l||(console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null)),l.isFile?(e++,l.file(a=>{e--;let c=new File([a],a.name,{type:a.type||i});s.push({type:"file",file:c,fullPath:l.fullPath}),e===0&&t(s)})):l.isDirectory&&n(l.createReader())},n=l=>{e++,l.readEntries(a=>{e--;for(let c of a)o(c);e===0&&t(s)})};o(r)})}function Go(r){let i=[],t=[];for(let e=0;e<r.items.length;e++){let s=r.items[e];if(s)if(s.kind==="file"){let o=s.type;if(typeof s.webkitGetAsEntry=="function"||typeof s.getAsEntry=="function"){let l=typeof s.webkitGetAsEntry=="function"?s.webkitGetAsEntry():s.getAsEntry();t.push(ma(l,o).then(a=>{a&&i.push(...a)}));continue}let n=s.getAsFile();n&&t.push(fa(n).then(l=>{l||i.push({type:"file",file:n})}))}else s.kind==="string"&&s.type.match("^text/uri-list")&&t.push(new Promise(o=>{s.getAsString(n=>{i.push({type:"url",url:n}),o(void 0)})}))}return Promise.all(t).then(()=>i)}var W={ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3},Xo=["focus"],ga=100,es=new Map;function ba(r,i){let t=Math.max(Math.min(r[0],i.x+i.width),i.x),e=Math.max(Math.min(r[1],i.y+i.height),i.y);return Math.sqrt((r[0]-t)*(r[0]-t)+(r[1]-e)*(r[1]-e))}function is(r){let i=0,t=document.body,e=new Set,s=m=>e.add(m),o=W.INACTIVE,n=m=>{r.shouldIgnore()&&m!==W.INACTIVE||(o!==m&&e.forEach(y=>y(m)),o=m)},l=()=>i>0;s(m=>r.onChange(m));let a=()=>{i=0,n(W.INACTIVE)},c=()=>{i+=1,o===W.INACTIVE&&n(W.ACTIVE)},d=()=>{i-=1,l()||n(W.INACTIVE)},h=m=>{m.preventDefault(),i=0,n(W.INACTIVE)},p=m=>{if(r.shouldIgnore())return;l()||(i+=1);let y=[m.x,m.y],x=r.element.getBoundingClientRect(),E=Math.floor(ba(y,x)),C=E<ga,A=m.composedPath().includes(r.element);es.set(r.element,E);let N=Math.min(...es.values())===E;A&&N?(m.preventDefault(),n(W.OVER)):n(C&&N?W.NEAR:W.ACTIVE)},f=async m=>{if(r.shouldIgnore())return;m.preventDefault();let y=await Go(m.dataTransfer);r.onItems(y),n(W.INACTIVE)};return t.addEventListener("drop",h),t.addEventListener("dragleave",d),t.addEventListener("dragenter",c),t.addEventListener("dragover",p),r.element.addEventListener("drop",f),Xo.forEach(m=>{window.addEventListener(m,a)}),()=>{es.delete(r.element),t.removeEventListener("drop",h),t.removeEventListener("dragleave",d),t.removeEventListener("dragenter",c),t.removeEventListener("dragover",p),r.element.removeEventListener("drop",f),Xo.forEach(m=>{window.removeEventListener(m,a)})}}var Wo="uc-drop-area",me=`${Wo}/registry`,Ve=class Ve extends S{constructor(){super(),this.init$={...this.init$,state:W.INACTIVE,withIcon:!1,isClickable:!1,isFullscreen:!1,isEnabled:!0,isVisible:!0,text:"",[me]:null}}isActive(){if(!this.$.isEnabled)return!1;let i=this.getBoundingClientRect(),t=i.width>0&&i.height>0,e=i.top>=0&&i.left>=0&&i.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&i.right<=(window.innerWidth||document.documentElement.clientWidth),s=window.getComputedStyle(this),o=s.visibility!=="hidden"&&s.display!=="none";return t&&o&&e}initCallback(){super.initCallback(),this.bindL10n("text",()=>this.l10n("drop-files-here")),this.$[me]||(this.$[me]=new Set),this.$[me].add(this),this.defineAccessor("disabled",t=>{this.set$({isEnabled:!L(t)})}),this.defineAccessor("clickable",t=>{this.set$({isClickable:L(t)})}),this.defineAccessor("with-icon",t=>{this.set$({withIcon:L(t)})}),this.defineAccessor("fullscreen",t=>{this.set$({isFullscreen:L(t)})}),this.defineAccessor("text",t=>{typeof t=="string"?this.bindL10n("text",()=>this.l10n(t)||t):this.bindL10n("text",()=>this.l10n("drop-files-here"))}),this._destroyDropzone=is({element:this,shouldIgnore:()=>this._shouldIgnore(),onChange:t=>{this.$.state=t},onItems:t=>{t.length&&(t.forEach(e=>{e.type==="url"?this.api.addFileFromUrl(e.url,{source:Q.DROP_AREA}):e.type==="file"&&this.api.addFileFromObject(e.file,{source:Q.DROP_AREA,fullPath:e.fullPath})}),this.uploadCollection.size&&(this.set$({"*currentActivity":v.activities.UPLOAD_LIST}),this.setOrAddState("*modalActive",!0)))}});let i=this.ref["content-wrapper"];i&&(this._destroyContentWrapperDropzone=is({element:i,onChange:t=>{var s;let e=(s=Object.entries(W).find(([,o])=>o===t))==null?void 0:s[0].toLowerCase();e&&i.setAttribute("drag-state",e)},onItems:()=>{},shouldIgnore:()=>this._shouldIgnore()})),this.sub("state",t=>{var s;let e=(s=Object.entries(W).find(([,o])=>o===t))==null?void 0:s[0].toLowerCase();e&&this.setAttribute("drag-state",e)}),this.subConfigValue("sourceList",t=>{let e=G(t);this.$.isEnabled=e.includes(S.sourceTypes.LOCAL),this.$.isVisible=this.$.isEnabled||!this.querySelector("[data-default-slot]")}),this.sub("isVisible",t=>{this.toggleAttribute("hidden",!t)}),this.sub("isClickable",t=>{this.toggleAttribute("clickable",t)}),this.$.isClickable&&(this._onAreaClicked=t=>{t.type==="keydown"?(t.code==="Space"||t.code==="Enter")&&this.api.openSystemDialog():t.type==="click"&&this.api.openSystemDialog()},this.addEventListener("keydown",this._onAreaClicked),this.addEventListener("click",this._onAreaClicked))}_shouldIgnore(){return!this.$.isEnabled||!this._couldHandleFiles()?!0:this.$.isFullscreen?[...this.$[me]].filter(e=>e!==this).filter(e=>e.isActive()).length>0:!1}_couldHandleFiles(){let i=this.cfg.multiple,t=this.cfg.multipleMax,e=this.uploadCollection.size;return!(i&&t&&e>=t||!i&&e>0)}destroyCallback(){var t,e;super.destroyCallback();let i=this.$[me];i&&(i.delete(this),i.size===0&&$.deleteCtx(Wo)),(t=this._destroyDropzone)==null||t.call(this),(e=this._destroyContentWrapperDropzone)==null||e.call(this),this._onAreaClicked&&(this.removeEventListener("keydown",this._onAreaClicked),this.removeEventListener("click",this._onAreaClicked))}};u(Ve,"styleAttrs",[...q(Ve,Ve,"styleAttrs"),"uc-drop-area"]);var He=Ve;He.template=b`<slot><div data-default-slot hidden></div><div ref="content-wrapper" class="uc-content-wrapper" set="@hidden: !isVisible"><div class="uc-icon-container" set="@hidden: !withIcon"><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">{{text}}</span></div></slot>`;He.bindAttributes({"with-icon":null,clickable:null,text:null,fullscreen:null,disabled:null});var ya="src-type-",je=class extends S{constructor(){super();u(this,"couldBeCtxOwner",!0);u(this,"type");u(this,"_registeredTypes",{});this.init$={...this.init$,iconName:"default","src-type":""}}initTypes(){this.registerType({type:S.sourceTypes.LOCAL,activate:()=>(this.api.openSystemDialog(),!1)}),this.registerType({type:S.sourceTypes.URL,activity:v.activities.URL,textKey:"from-url"}),this.registerType({type:S.sourceTypes.CAMERA,activity:v.activities.CAMERA,activate:()=>{let t="capture"in document.createElement("input");return t&&this.api.openSystemDialog({captureCamera:!0}),!t}}),this.registerType({type:"draw",activity:v.activities.DRAW,icon:"edit-draw"});for(let t of Object.values(S.extSrcList))this.registerType({type:t,activity:v.activities.EXTERNAL,activityParams:{externalSourceType:t}})}initCallback(){super.initCallback(),this.initTypes(),this.defineAccessor("type",t=>{t&&this.applyType(t)})}registerType(t){this._registeredTypes[t.type]=t}getType(t){return this._registeredTypes[t]}activate(){if(!this.type)return;let t=this._registeredTypes[this.type],{activity:e,activate:s,activityParams:o={}}=t;(s?s():!!e)&&this.set$({"*currentActivityParams":o,"*currentActivity":e})}applyType(t){let e=this._registeredTypes[t];if(!e){console.warn("Unsupported source type: "+t);return}let{textKey:s=t,icon:o=t}=e;this.$["src-type"]=`${ya}${s}`,this.$.iconName=o,this.onclick=()=>{this.activate()}}};je.template=b`<button type="button"><uc-icon set="@name: iconName"></uc-icon><div class="uc-txt" l10n="src-type"></div></button>`;je.bindAttributes({type:null});var rs=class extends w{initCallback(){super.initCallback(),this.subConfigValue("sourceList",i=>{let t=G(i),e="";t.forEach(s=>{e+=b`<uc-source-btn type="${s}"></uc-source-btn>`}),this.cfg.sourceListWrap?this.innerHTML=e:this.outerHTML=e})}};var zi=()=>{let r=[];return{stack:r,promiseReadJpegChunks:t=>new Promise((e,s)=>{let o=2,n=(c,d)=>{let h=new FileReader;h.addEventListener("load",()=>{d(new DataView(h.result))}),h.addEventListener("error",p=>{s(`Reader error: ${p}`)}),h.readAsArrayBuffer(c)},l=()=>n(t.slice(o,o+128),c=>{let d,h,p;for(d=h=0,p=c.byteLength;p>=0?h<p:h>p;d=p>=0?++h:--h)if(c.getUint8(d)===255){o+=d;break}a()}),a=()=>{let c=o;return n(t.slice(o,o+=4),d=>{if(d.byteLength!==4||d.getUint8(0)!==255){s("Corrupted");return}let h=d.getUint8(1);if(h===218){e(!0);return}let p=d.getUint16(2)-2;return n(t.slice(o,o+=p),f=>{if(f.byteLength!==p){s("Corrupted");return}r.push({startPos:c,length:p,marker:h,view:f}),l()})})};FileReader&&DataView||s("Not Support"),n(t.slice(0,2),c=>{c.getUint16(0)!==65496&&s("Not jpeg"),l()})})}},_a=async r=>{let i=[],{promiseReadJpegChunks:t,stack:e}=zi();return await t(r),e.forEach(({marker:s,view:o})=>{s===226&&o.getUint32(0)===1229144927&&o.getUint32(4)===1347571526&&o.getUint32(8)===1229735168&&i.push(o)}),i},qo=async(r,i,t)=>{{let e=[],s=[],{promiseReadJpegChunks:o,stack:n}=zi();await o(r),n.forEach(c=>{if(c.marker===i)return e.push(c.startPos),s.push(c.length)});let l=[r.slice(0,2)];for(let c of t){let d=new DataView(new ArrayBuffer(4));d.setUint16(0,65280+i),d.setUint16(2,c.byteLength+2),l.push(d.buffer),l.push(c)}let a=2;for(let c=0;c<e.length;c++)e[c]>a&&l.push(r.slice(a,e[c])),a=e[c]+s[c]+4;return l.push(r.slice(a,r.size)),new Blob(l,{type:r.type})}};var Zo=(r,i)=>qo(r,226,i.map(t=>t.buffer)),va=async r=>{try{return await Zo(r,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},wa=(r,i,t)=>new Promise((e,s)=>{let o=n=>{if(!n){s("Failed to convert canvas to blob");return}e(n)};r.toBlob(o,i,t),r.width=r.height=1}),Ge=()=>{let r=document.createElement("canvas"),i=r.getContext("2d");return{canvas:r,ctx:i}},Ca=r=>{let{ctx:t,canvas:e}=Ge();e.width=e.height=50,t.drawImage(r,0,0,50,50);let s=t.getImageData(0,0,50,50).data;e.width=e.height=1;for(let o=3;o<s.length;o+=4)if(s[o]<254)return!0;return!1},xa=async r=>{let i=null,{promiseReadJpegChunks:t,stack:e}=zi();return await t(r),e.forEach(({marker:s,view:o})=>{if(!i&&s===225&&o.byteLength>=14&&o.getUint32(0)===1165519206&&o.getUint16(4)===0){i=o;return}}),i},Ea="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",Bi,Aa=()=>new Promise(r=>{if(Bi!==void 0)r(Bi);else{let i=new Image;i.addEventListener("load",()=>{Bi=i.naturalWidth<i.naturalHeight,i.src="//:0",r(Bi)}),i.src=Ea}}),Ta=(r,i)=>{let t,e,s,o;if(!r||r.byteLength<14||r.getUint32(0)!==1165519206||r.getUint16(4)!==0)return;if(r.getUint16(6)===18761)e=!0;else if(r.getUint16(6)===19789)e=!1;else return;if(r.getUint16(8,e)!==42)return;s=8+r.getUint32(10,e);let n=r.getUint16(s-2,e);for(t=0,o=n;o>=0?t<o:t>o;o>=0?++t:--t){if(r.byteLength<s+10)return;r.getUint16(s,e)===274&&i(s+8,e),s+=12}},Sa=(r,i)=>{Ta(r,(t,e)=>r.setUint16(t,i,e))},ka=async(r,i,t)=>(t&&Sa(i,1),qo(r,225,[i.buffer])),$a=(r,i)=>new Promise((t,e)=>{i&&(r.src=i),r.complete?t(r):(r.addEventListener("load",()=>{t(r)}),r.addEventListener("error",()=>{e(new Error("Failed to load image. Probably not an image."))}))}),Ia=r=>$a(new Image,r),Oa=[1,3],La=[192,193,194,195,197,198,199,201,202,203,205,206,207],Ko={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},Ua=async r=>{let i=!1,{promiseReadJpegChunks:t,stack:e}=zi();return await t(r).then(()=>(e.forEach(({marker:s,view:o})=>{if(!i&&La.indexOf(s)>=0){let n=o.getUint8(5);Oa.indexOf(n)<0&&(i=!0)}}),i)).catch(()=>i)},Yo=(r,i)=>{let t={};return(...e)=>{let s=i(e,t);return s in t?t[s]:t[s]=r(...e)}},Jo=(r,i)=>{let[t]=r,e=Object.keys(i).map(s=>parseInt(s,10)).sort((s,o)=>s-o);for(let s=0;s<e.length;s++){let o=e[s],n=!!i[o];if(o>t&&n||o<t&&!n)return o}return t},zt={R:55,G:110,B:165,A:255},Ma=`rgba(${zt.R}, ${zt.G}, ${zt.B}, ${zt.A/255})`,Qo=(r,i)=>{try{let t=[r-1,i-1,1,1],{canvas:e,ctx:s}=Ge();e.width=1,e.height=1;let{canvas:o,ctx:n}=Ge();o.width=r,o.height=i,n&&(n.fillStyle=Ma,n.fillRect(...t),s.drawImage(o,r-1,i-1,1,1,0,0,1,1));let l=s&&s.getImageData(0,0,1,1).data,a=!1;return l&&(a=l[0]===zt.R&&l[1]===zt.G&&l[2]===zt.B&&l[3]===zt.A),o.width=o.height=1,a}catch{return console.error(`Failed to test for max canvas size of ${r}x${i}.`),!1}};function tn(r){return(...i)=>new Promise(t=>{setTimeout(()=>{let e=r(...i);t(e)},0)})}var Pa=tn(Yo(Qo,Jo)),Ra=tn(Yo(Qo,Jo)),en=async(r,i)=>{let t=Ko.squareSide.find(n=>n*n>=r*i),e=Ko.dimension.find(n=>n>=r&&n>=i);if(!t||!e)throw new Error("Not supported");let[s,o]=await Promise.all([Pa(t,t),Ra(e,1)]);if(s&&o)return!0;throw new Error("Not supported")},rn=async(r,i,t)=>{try{let{ctx:e,canvas:s}=Ge();return s.width=i,s.height=t,e.imageSmoothingQuality="high",e.drawImage(r,0,0,i,t),r instanceof HTMLImageElement&&(r.src="//:0"),r instanceof HTMLCanvasElement&&(r.width=r.height=1),s}catch(e){throw new Error("Canvas resize error",{cause:e})}},Fa=({img:r,targetW:i,targetH:t})=>rn(r,i,t),Da=function({sourceW:r,targetW:i,targetH:t,step:e}){let s=[],o=i,n=t;do s.push([o,n]),o=Math.round(o/e),n=Math.round(n/e);while(o<r*e);return s.reverse()},Na=({img:r,sourceW:i,targetW:t,targetH:e,step:s})=>Da({sourceW:i,targetW:t,targetH:e,step:s}).reduce((n,[l,a])=>n.then(c=>en(l,a).then(()=>rn(c,l,a)).catch(()=>c)),Promise.resolve(r)),Ba=()=>/iPad|iPhone|iPod/.test(navigator.platform)?!0:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),za=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),ss=.71,Va=(r,i)=>{if(r.width*ss*r.height*ss<i.size)throw new Error("Not required");let t=r.width,e=r.height,s=t/e,o=Math.floor(Math.sqrt(i.size*s)),n=Math.floor(i.size/Math.sqrt(i.size*s));return en(o,n).then(()=>{let{ctx:l}=Ge();return"imageSmoothingQuality"in l&&!Ba()&&!za?Fa({img:r,targetW:o,targetH:n}):Na({img:r,sourceW:t,targetW:o,targetH:n,step:ss})}).catch(()=>Promise.reject("Not supported"))},sn=async(r,i)=>{try{if(await Ua(r))throw new Error("Should skipped");let e=await Promise.allSettled([xa(r),Aa(),_a(r)]),o=!e.some(y=>y.status==="rejected"),[n,l,a]=e,c=await va(r).catch(()=>r),d=await Ia(URL.createObjectURL(c));URL.revokeObjectURL(d.src);let h=await Va(d,i),p="image/jpeg",f=(i==null?void 0:i.quality)||.8;!o&&Ca(h)&&(p="image/png",f=void 0);let m=await wa(h,p,f);if(o&&n.status==="fulfilled"&&n.value){let y=n.value,x=l.status==="fulfilled"?l.value:!1;m=await ka(m,y,x)}return o&&a.status==="fulfilled"&&a.value.length>0&&(m=await Zo(m,a.value)),m}catch(t){let e;throw t instanceof Error&&(e=t.message),typeof t=="string"&&(e=t),new Error(`Failed to shrink image. ${e?`Message: "${e}".`:""}`,{cause:t})}};function Ha(r){let i=new Blob([r],{type:"image/svg+xml"});return URL.createObjectURL(i)}function os(r="hsl(209, 21%, 65%)",i=32,t=32){return Ha(`<svg width="${i}" height="${t}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${r}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`)}function on(r,i=40){if(r.type==="image/svg+xml")return URL.createObjectURL(r);let t=document.createElement("canvas"),e=t.getContext("2d"),s=new Image,o=new Promise((n,l)=>{s.onload=()=>{let a=s.height/s.width;a>1?(t.width=i,t.height=i*a):(t.height=i,t.width=i/a),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(s,0,0,t.width,t.height),t.toBlob(c=>{if(!c){l();return}let d=URL.createObjectURL(c);n(d)})},s.onerror=a=>{l(a)}});return s.src=URL.createObjectURL(r),o}var ja=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,nn=r=>{let i=ja.exec(r==null?void 0:r.toLocaleLowerCase())||[];if(!i.length)return!1;let t=i[1]*i[2],e=16384*16384;return t>e?(console.warn(`Shrinked size can not be larger than ${Math.floor(e/1e3/1e3)}MP. You have set ${i[1]}x${i[2]} (${Math.ceil(t/1e3/100)/10}MP).`),!1):{quality:i[3]?i[3]/100:void 0,size:t}};var st=Object.freeze({FINISHED:Symbol("FINISHED"),FAILED:Symbol("FAILED"),UPLOADING:Symbol("UPLOADING"),IDLE:Symbol("IDLE")}),Xe=class r extends S{constructor(){super();u(this,"couldBeCtxOwner",!0);u(this,"pauseRender",!0);u(this,"_entrySubs",new Set);u(this,"_entry",null);u(this,"_isIntersecting",!1);u(this,"_debouncedGenerateThumb",M(this._generateThumbnail.bind(this),100));u(this,"_debouncedCalculateState",M(this._calculateState.bind(this),100));u(this,"_renderedOnce",!1);this.init$={...this.init$,uid:"",itemName:"",errorText:"",thumbUrl:"",progressValue:0,progressVisible:!1,badgeIcon:"",isFinished:!1,isFailed:!1,isUploading:!1,isFocused:!1,isEditable:!1,state:st.IDLE,ariaLabelStatusFile:"",onEdit:()=>{this.$["*currentActivityParams"]={internalId:this._entry.uid},this.$["*currentActivity"]=v.activities.CLOUD_IMG_EDIT},onRemove:()=>{this.uploadCollection.remove(this.$.uid)},onUpload:()=>{this.upload()}}}_reset(){for(let t of this._entrySubs)t.remove();this._debouncedGenerateThumb.cancel(),this._debouncedCalculateState.cancel(),this._entrySubs=new Set,this._entry=null}_observerCallback(t){let[e]=t;this._isIntersecting=e.isIntersecting,e.isIntersecting&&!this._renderedOnce&&(this.render(),this._renderedOnce=!0),e.intersectionRatio===0?this._debouncedGenerateThumb.cancel():this._debouncedGenerateThumb()}_calculateState(){if(!this._entry)return;let t=this._entry,e=st.IDLE;t.getValue("errors").length>0?e=st.FAILED:t.getValue("isUploading")?e=st.UPLOADING:t.getValue("fileInfo")&&(e=st.FINISHED),this.$.state=e}async _generateThumbnail(){var e;if(!this._entry)return;let t=this._entry;if(t.getValue("fileInfo")&&t.getValue("isImage")){let s=this.cfg.thumbSize,o=await this.proxyUrl(R(Pt(this.cfg.cdnCname,this._entry.getValue("uuid")),j(t.getValue("cdnUrlModifiers"),`scale_crop/${s}x${s}/center`))),n=t.getValue("thumbUrl");n!==o&&(t.setValue("thumbUrl",o),n!=null&&n.startsWith("blob:")&&URL.revokeObjectURL(n));return}if(!t.getValue("thumbUrl"))if((e=t.getValue("file"))!=null&&e.type.includes("image"))try{let s=await on(t.getValue("file"),this.cfg.thumbSize);t.setValue("thumbUrl",s)}catch{let o=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",os(o))}else{let s=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",os(s))}}_subEntry(t,e){let s=this._entry.subscribe(t,o=>{this.isConnected&&e(o)});this._entrySubs.add(s)}_handleEntryId(t){var s;this._reset();let e=(s=this.uploadCollection)==null?void 0:s.read(t);this._entry=e,e&&(this._subEntry("uploadProgress",o=>{this.$.progressValue=o}),this._subEntry("fileName",o=>{this.$.itemName=o||e.getValue("externalUrl")||this.l10n("file-no-name"),this._debouncedCalculateState()}),this._subEntry("externalUrl",o=>{this.$.itemName=e.getValue("fileName")||o||this.l10n("file-no-name")}),this._subEntry("fileInfo",o=>{this._debouncedCalculateState(),o&&this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("cdnUrlModifiers",()=>{this._isIntersecting&&this._debouncedGenerateThumb()}),this._subEntry("thumbUrl",o=>{this.$.thumbUrl=o?`url(${o})`:""}),this._subEntry("errors",()=>this._debouncedCalculateState()),this._subEntry("isUploading",()=>this._debouncedCalculateState()),this._subEntry("fileSize",()=>this._debouncedCalculateState()),this._subEntry("mimeType",()=>this._debouncedCalculateState()),this._subEntry("isImage",()=>this._debouncedCalculateState()),this._isIntersecting&&this._debouncedGenerateThumb())}initCallback(){super.initCallback(),this.sub("uid",t=>{this._handleEntryId(t)}),this.sub("state",t=>{this._handleState(t)}),this.subConfigValue("useCloudImageEditor",()=>this._debouncedCalculateState()),this.onclick=()=>{r.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused")})},this.sub("*uploadTrigger",t=>{t.has(this._entry.uid)&&setTimeout(()=>this.isConnected&&this.upload())}),r.activeInstances.add(this)}_handleState(t){var e,s,o,n,l,a,c,d;t===st.FAILED?this.$.badgeIcon="badge-error":t===st.FINISHED&&(this.$.badgeIcon="badge-success"),t===st.UPLOADING?this.$.isFocused=!1:this.$.progressValue=0,this.set$({isFailed:t===st.FAILED,isUploading:t===st.UPLOADING,isFinished:t===st.FINISHED,progressVisible:t===st.UPLOADING,isEditable:this.cfg.useCloudImageEditor&&((e=this._entry)==null?void 0:e.getValue("isImage"))&&((s=this._entry)==null?void 0:s.getValue("cdnUrl")),errorText:(l=(n=(o=this._entry.getValue("errors"))==null?void 0:o[0])==null?void 0:n.message)!=null?l:"",ariaLabelStatusFile:this.l10n("a11y-file-item-status",{fileName:(a=this._entry)==null?void 0:a.getValue("fileName"),status:this.l10n((d=(c=t==null?void 0:t.description)==null?void 0:c.toLocaleLowerCase())!=null?d:"").toLocaleLowerCase()})})}destroyCallback(){super.destroyCallback(),r.activeInstances.delete(this),this._reset()}connectedCallback(){super.connectedCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]}),this._observer.observe(this)}disconnectedCallback(){var t;super.disconnectedCallback(),this._debouncedGenerateThumb.cancel(),(t=this._observer)==null||t.disconnect()}_settingsOfShrink(){return nn(this.cfg.imageShrink)}_processShrink(t){return sn(t,this._settingsOfShrink())}async upload(){var s,o,n,l,a;let t=this._entry;if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("errors").length>0)return;let e=this.cfg.multiple?this.cfg.multipleMax:1;if(!(e&&this.uploadCollection.size>e)){this._debouncedCalculateState(),t.setValue("isUploading",!0),t.setValue("errors",[]);try{let c=new AbortController;t.setValue("abortController",c);let d=async()=>{let p=t.getValue("file");p&&this.cfg.imageShrink&&(p=await this._processShrink(p).catch(()=>p));let f=p||t.getValue("externalUrl")||t.getValue("uuid"),y={...await this.getUploadClientOptions(),fileName:t.getValue("fileName"),source:t.getValue("source"),onProgress:x=>{if(x.isComputable){let E=x.value*100;t.setValue("uploadProgress",E)}},signal:c.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",f,y),Lr(f,y)},h=await this.$["*uploadQueue"].add(d);t.setMultipleValues({fileInfo:h,isUploading:!1,fileName:h.originalFilename,fileSize:h.size,isImage:h.isImage,mimeType:(n=(o=(s=h.contentInfo)==null?void 0:s.mime)==null?void 0:o.mime)!=null?n:h.mimeType,uuid:h.uuid,cdnUrl:(l=t.getValue("cdnUrl"))!=null?l:h.cdnUrl,cdnUrlModifiers:(a=t.getValue("cdnUrlModifiers"))!=null?a:"",uploadProgress:100}),t===this._entry&&this._debouncedCalculateState()}catch(c){c instanceof Ft&&c.isCancel?t.setMultipleValues({isUploading:!1,uploadProgress:0}):t.setMultipleValues({isUploading:!1,uploadProgress:0,uploadError:c}),t===this._entry&&this._debouncedCalculateState()}}}};Xe.template=b`<div class="uc-inner" set="@finished: isFinished; @uploading: isUploading; @failed: isFailed; @focused: isFocused"><div class="uc-thumb" set="style.backgroundImage: thumbUrl"><div class="uc-badge"><uc-icon set="@name: badgeIcon"></uc-icon></div></div><div aria-live="polite" class="uc-file-name-wrapper" set="@aria-label:ariaLabelStatusFile;"><span class="uc-file-name" set="@title: itemName">{{itemName}}</span><span class="uc-file-error" set="@hidden: !errorText">{{errorText}}</span></div><div class="uc-file-actions"><button type="button" l10n="@title:file-item-edit-button" class="uc-edit-btn uc-mini-btn" set="onclick: onEdit; @hidden: !isEditable" ><uc-icon name="edit-file"></uc-icon></button><button type="button" l10n="@title:file-item-remove-button" class="uc-remove-btn uc-mini-btn" set="onclick: onRemove;" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" set="onclick: onUpload;"><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" set="value: progressValue; visible: progressVisible;"></uc-progress-bar></div>`;Xe.activeInstances=new Set;var ge=class ge extends w{constructor(){super();u(this,"_handleBackdropClick",()=>{this._closeDialog()});u(this,"_closeDialog",()=>{this.setOrAddState("*modalActive",!1)});u(this,"_handleDialogClose",()=>{this._closeDialog()});u(this,"_handleDialogMouseDown",t=>{this._mouseDownTarget=t.target});u(this,"_handleDialogMouseUp",t=>{t.target===this.ref.dialog&&t.target===this._mouseDownTarget&&this._closeDialog()});this.init$={...this.init$,"*modalActive":!1,isOpen:!1,closeClicked:this._handleDialogClose}}show(){this.ref.dialog.showModal?this.ref.dialog.showModal():this.ref.dialog.setAttribute("open","")}hide(){this.ref.dialog.close?this.ref.dialog.close():this.ref.dialog.removeAttribute("open")}initCallback(){if(super.initCallback(),typeof HTMLDialogElement=="function")this.ref.dialog.addEventListener("close",this._handleDialogClose),this.ref.dialog.addEventListener("mousedown",this._handleDialogMouseDown),this.ref.dialog.addEventListener("mouseup",this._handleDialogMouseUp);else{this.setAttribute("dialog-fallback","");let t=document.createElement("div");t.className="uc-backdrop",this.appendChild(t),t.addEventListener("click",this._handleBackdropClick)}this.sub("*modalActive",t=>{this.$.isOpen!==t&&(this.$.isOpen=t),t&&this.cfg.modalScrollLock?document.body.style.overflow="hidden":document.body.style.overflow=""}),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes")}),this.sub("isOpen",t=>{t?(this.show(),this.setAttribute("aria-modal","true")):(this.hide(),this.setAttribute("aria-modal","false"))})}destroyCallback(){super.destroyCallback(),document.body.style.overflow="",this._mouseDownTarget=void 0,this.ref.dialog.removeEventListener("close",this._handleDialogClose),this.ref.dialog.removeEventListener("mousedown",this._handleDialogMouseDown),this.ref.dialog.removeEventListener("mouseup",this._handleDialogMouseUp)}};u(ge,"styleAttrs",[...q(ge,ge,"styleAttrs"),"uc-modal"]),u(ge,"StateConsumerScope","modal");var Vi=ge;Vi.template=b`<dialog ref="dialog"><slot></slot></dialog>`;var Hi=(r,i)=>{let t,e,s,o=(...n)=>{t?(clearTimeout(e),e=setTimeout(()=>{Date.now()-s>=i&&(r(...n),s=Date.now())},Math.max(i-(Date.now()-s),0))):(r(...n),s=Date.now(),t=!0)};return Object.defineProperty(o,"cancel",{configurable:!1,writable:!1,enumerable:!1,value:()=>{clearTimeout(e)}}),o};var ji=class extends S{constructor(){super();u(this,"couldBeCtxOwner",!0);u(this,"historyTracked",!0);u(this,"activityType",v.activities.UPLOAD_LIST);u(this,"_throttledHandleCollectionUpdate",Hi(()=>{this.isConnected&&(this._updateUploadsState(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack())},300));this.init$={...this.init$,doneBtnVisible:!1,doneBtnEnabled:!1,uploadBtnVisible:!1,addMoreBtnVisible:!1,addMoreBtnEnabled:!1,headerText:"",commonErrorMessage:"",hasFiles:!1,onAdd:()=>{this.api.initFlow(!0)},onUpload:()=>{this.emit(I.UPLOAD_CLICK),this.api.uploadAll(),this._throttledHandleCollectionUpdate()},onDone:()=>{this.emit(I.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow()},onCancel:()=>{this.uploadCollection.clearAll()}}}_updateUploadsState(){let t=this.api.getOutputCollectionState(),e={total:t.totalCount,succeed:t.successCount,uploading:t.uploadingCount,failed:t.failedCount},s=!t.errors.some(p=>p.type==="TOO_MANY_FILES"||p.type==="TOO_FEW_FILES"),o=t.errors.some(p=>p.type==="TOO_MANY_FILES"),n=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),l=e.failed===0&&t.errors.length===0,a=!1,c=!1,d=!1;if(e.total-e.succeed-e.uploading-e.failed>0&&s)a=!0;else{c=!0;let p=this.cfg.groupOutput?!!t.group:!0;d=e.total===e.succeed&&s&&l&&p}this.set$({doneBtnVisible:c,doneBtnEnabled:d,uploadBtnVisible:a,addMoreBtnEnabled:e.total===0||!o&&!n,addMoreBtnVisible:!n||this.cfg.multiple}),this.bindL10n("headerText",()=>this._getHeaderText(e))}_getHeaderText(t){let e=s=>{let o=t[s];return this.l10n(`header-${s}`,{count:o})};return t.uploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this._throttledHandleCollectionUpdate),this.subConfigValue("multipleMin",this._throttledHandleCollectionUpdate),this.subConfigValue("multipleMax",this._throttledHandleCollectionUpdate),this.sub("*groupInfo",t=>{t&&this._throttledHandleCollectionUpdate()}),this.sub("*currentActivity",t=>{!this.couldOpenActivity&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity)}),this.uploadCollection.observeProperties(this._throttledHandleCollectionUpdate),this.sub("*uploadList",t=>{this._throttledHandleCollectionUpdate(),this.set$({hasFiles:t.length>0}),this.cfg.confirmUpload||this.api.uploadAll()},!1),this.sub("*collectionErrors",t=>{let e=t.filter(s=>s.type!=="SOME_FILES_HAS_ERRORS")[0];if(!e){this.set$({commonErrorMessage:null});return}this.set$({commonErrorMessage:e.message})})}destroyCallback(){super.destroyCallback(),this.uploadCollection.unobserveProperties(this._throttledHandleCollectionUpdate)}};ji.template=b`<uc-activity-header><span aria-live="polite" class="uc-header-text">{{headerText}}</span><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal" l10n="@title:a11y-activity-header-button-close" ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" set="@hidden: hasFiles"><slot name="empty"><span l10n="no-files"></span></slot></div><div class="uc-files" itemize="*uploadList" item-tag="uc-file-item"></div><div class="uc-common-error" set="@hidden: !commonErrorMessage; textContent: commonErrorMessage;"></div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" set="onclick: onCancel;" l10n="clear"></button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" set="onclick: onAdd; @disabled: !addMoreBtnEnabled; @hidden: !addMoreBtnVisible" ><uc-icon name="add"></uc-icon><span l10n="add-more"></span></button><button type="button" class="uc-upload-btn uc-primary-btn" set="@hidden: !uploadBtnVisible; onclick: onUpload;" l10n="upload" ></button><button type="button" class="uc-done-btn uc-primary-btn" set="@hidden: !doneBtnVisible; onclick: onDone; @disabled: !doneBtnEnabled" l10n="done" ></button></div><uc-drop-area ghost></uc-drop-area>`;var Gi=class extends S{constructor(){super(...arguments);u(this,"couldBeCtxOwner",!0);u(this,"activityType",v.activities.URL);u(this,"init$",{...this.init$,importDisabled:!0,onUpload:t=>{t.preventDefault();let e=this.ref.input.value;this.api.addFileFromUrl(e,{source:Q.URL_TAB}),this.$["*currentActivity"]=v.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()},onInput:t=>{let e=t.target.value;this.set$({importDisabled:!e})}})}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{this.ref.input.value="",this.ref.input.focus()}})}};Gi.template=b`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack"><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span l10n="caption-from-url"></span></div><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal"><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content"><input placeholder="https://" class="uc-url-input" type="text" ref="input" set="oninput: onInput" /><button type="submit" class="uc-url-upload-btn uc-primary-btn" set="onclick: onUpload; @disabled: importDisabled" l10n="upload-url" ></button></form>`;var ns=()=>typeof navigator.permissions!="undefined";var Xi=class extends S{constructor(){super(...arguments);u(this,"couldBeCtxOwner",!0);u(this,"activityType",v.activities.CAMERA);u(this,"_unsubPermissions",null);u(this,"init$",{...this.init$,video:null,videoTransformCss:null,shotBtnDisabled:!0,videoHidden:!0,messageHidden:!0,requestBtnHidden:ns(),cameraSelectOptions:null,cameraSelectHidden:!0,l10nMessage:"",onCameraSelectChange:t=>{this._selectedCameraId=t.target.value,this._capture()},onCancel:()=>{this.historyBack()},onShot:()=>{this._shot()},onRequestPermissions:()=>{this._capture()}});u(this,"_onActivate",()=>{ns()&&this._subscribePermissions(),this._capture()});u(this,"_onDeactivate",()=>{this._unsubPermissions&&this._unsubPermissions(),this._stopCapture()});u(this,"_handlePermissionsChange",()=>{this._capture()});u(this,"_setPermissionsState",M(t=>{this.classList.toggle("uc-initialized",t==="granted"),t==="granted"?this.set$({videoHidden:!1,shotBtnDisabled:!1,messageHidden:!0}):t==="prompt"?(this.$.l10nMessage="camera-permissions-prompt",this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture()):(this.$.l10nMessage="camera-permissions-denied",this.set$({videoHidden:!0,shotBtnDisabled:!0,messageHidden:!1}),this._stopCapture())},300))}async _subscribePermissions(){try{(await navigator.permissions.query({name:"camera"})).addEventListener("change",this._handlePermissionsChange)}catch(t){console.log("Failed to use permissions API. Fallback to manual request mode.",t),this._capture()}}async _capture(){let t={video:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},audio:!1};this._selectedCameraId&&(t.video.deviceId={exact:this._selectedCameraId}),this._canvas=document.createElement("canvas"),this._ctx=this._canvas.getContext("2d");try{this._setPermissionsState("prompt");let e=await navigator.mediaDevices.getUserMedia(t);e.addEventListener("inactive",()=>{this._setPermissionsState("denied")}),this.$.video=e,this._capturing=!0,this._setPermissionsState("granted")}catch(e){this._setPermissionsState("denied"),console.error("Failed to capture camera",e)}}_stopCapture(){var t;this._capturing&&((t=this.$.video)==null||t.getTracks()[0].stop(),this.$.video=null,this._capturing=!1)}_shot(){this._canvas.height=this.ref.video.videoHeight,this._canvas.width=this.ref.video.videoWidth,this._ctx.drawImage(this.ref.video,0,0);let t=Date.now(),e=`camera-${t}.jpeg`,s="image/jpeg";this._canvas.toBlob(o=>{let n=new File([o],e,{lastModified:t,type:s});this.api.addFileFromObject(n,{source:Q.CAMERA}),this.set$({"*currentActivity":v.activities.UPLOAD_LIST})},s)}async initCallback(){var t;super.initCallback(),this.registerActivity(this.activityType,{onActivate:this._onActivate,onDeactivate:this._onDeactivate}),this.subConfigValue("cameraMirror",e=>{this.$.videoTransformCss=e?"scaleX(-1)":null});try{let s=(await navigator.mediaDevices.enumerateDevices()).filter(o=>o.kind==="videoinput").map((o,n)=>({text:o.label.trim()||`${this.l10n("caption-camera")} ${n+1}`,value:o.deviceId}));s.length>1&&(this.$.cameraSelectOptions=s,this.$.cameraSelectHidden=!1),this._selectedCameraId=(t=s[0])==null?void 0:t.value}catch{}}};Xi.template=b`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack"><uc-icon name="back"></uc-icon></button><div set="@hidden: !cameraSelectHidden"><uc-icon name="camera"></uc-icon><span l10n="caption-camera"></span></div><uc-select class="uc-camera-select" set="options: cameraSelectOptions; @hidden: cameraSelectHidden; onchange: onCameraSelectChange" ></uc-select><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *closeModal"><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><video autoplay playsinline set="srcObject: video; style.transform: videoTransformCss; @hidden: videoHidden" ref="video" ></video><div class="uc-message-box" set="@hidden: messageHidden"><span l10n="l10nMessage"></span><button type="button" set="onclick: onRequestPermissions; @hidden: requestBtnHidden" l10n="camera-permissions-request" ></button></div><button type="button" class="uc-shot-btn" set="onclick: onShot; @disabled: shotBtnDisabled"><uc-icon name="camera"></uc-icon></button></div>`;var Wi=class extends S{constructor(){super(...arguments);u(this,"requireCtxName",!0)}initCallback(){super.initCallback(),this.$["*eventEmitter"].bindTarget(this)}destroyCallback(){super.destroyCallback(),this.$["*eventEmitter"].unbindTarget(this)}};Wi.EventType=I;var Ga=Wi;var Ki=class extends S{constructor(){super(...arguments);u(this,"init$",{...this.init$,visible:!1,value:0,"*commonProgress":0})}initCallback(){super.initCallback(),this._unobserveCollection=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e).getValue("isUploading"));this.$.visible=t}),this.sub("visible",t=>{t?this.setAttribute("active",""):this.removeAttribute("active")}),this.sub("*commonProgress",t=>{this.$.value=t})}destroyCallback(){var t;super.destroyCallback(),(t=this._unobserveCollection)==null||t.call(this)}};Ki.template=b`<uc-progress-bar set="visible: visible; value: value"></uc-progress-bar>`;var qi=class extends w{constructor(){super(...arguments);u(this,"_value",0);u(this,"init$",{...this.init$,width:0,opacity:0})}initCallback(){super.initCallback(),this.defineAccessor("value",t=>{if(t===void 0)return;let e=this._value;if(this._value=t,t===0&&e>0){this.ref.line.addEventListener("transitionend",()=>{this.style.setProperty("--l-width",this._value.toString())});return}this.style.setProperty("--l-width",this._value.toString())}),this.defineAccessor("visible",t=>{this.ref.line.classList.toggle("uc-progress--hidden",!t)})}};qi.template=b`<div ref="line" class="uc-progress"></div>`;var bt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function ln(...r){return r.reduce((i,t)=>{if(typeof t=="string")return i[t]=!0,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}function V(...r){let i=ln(...r);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}function an(r,...i){let t=ln(...i);for(let e of Object.keys(t))r.classList.toggle(e,t[e])}var cn=r=>{if(!r)return Z;let i=Rs(r).filter(t=>Z.includes(t));return i.length===0?Z:i};function un(r){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*tabList":Z,"*tabId":U.CROP,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:bt,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:se(Z),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":()=>{let i=r.querySelectorAll("img");for(let t of i){let e=t.src;t.src=bt,t.src=e}r.$["*networkProblems"]=!1},"*on.apply":i=>{if(!i)return;let t=r.$["*originalUrl"],e=j(Rt(i),"preview"),s=R(t,e),o={originalUrl:t,cdnUrlModifiers:e,cdnUrl:s,transformations:i};r.dispatchEvent(new CustomEvent("apply",{detail:o,bubbles:!0,composed:!0})),r.remove()},"*on.cancel":()=>{r.remove(),r.dispatchEvent(new CustomEvent("cancel",{bubbles:!0,composed:!0}))}}}var hn="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='puc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#puc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#suc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#suc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#suc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#suc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#suc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#suc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#suc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#suc-icon-id__h)'/><defs><linearGradient id='suc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='suc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var dn=b`${hn} <div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" set="visible: presence.networkProblems;"><div class="uc-network_problems_content"><div class="uc-network_problems_icon"><uc-icon name="sad"></uc-icon></div><div class="uc-network_problems_text">Network error</div></div><div class="uc-network_problems_footer"><uc-btn-ui theme="primary" text="Retry" set="onclick: *on.retryNetwork"></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">{{fileType}}</div></div><div class="uc-image_container" ref="img-container-el"><img src="${bt}" class="uc-image uc-image_visible_from_editor" ref="img-el" /><uc-editor-image-cropper ref="cropper-el"></uc-editor-image-cropper><uc-editor-image-fader ref="fader-el"></uc-editor-image-fader></div><div class="uc-info_pan">{{msg}}</div></div><div class="uc-toolbar"><uc-line-loader-ui set="active: showLoader"></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor"><uc-editor-toolbar></uc-editor-toolbar></div></div></div>`;var yt=class extends w{constructor(){super();u(this,"ctxOwner",!0);u(this,"_debouncedShowLoader",M(this._showLoader.bind(this),300));this.init$={...this.init$,...un(this)}}_showLoader(t){this.$.showLoader=t}_waitForSize(){return new Promise((e,s)=>{let o=setTimeout(()=>{s(new Error("[cloud-image-editor] timeout waiting for non-zero container size"))},3e3),n=new ResizeObserver(([l])=>{l.contentRect.width>0&&l.contentRect.height>0&&(e(),clearTimeout(o),n.disconnect())});n.observe(this)})}initCallback(){super.initCallback(),this.$["*faderEl"]=this.ref["fader-el"],this.$["*cropperEl"]=this.ref["cropper-el"],this.$["*imgContainerEl"]=this.ref["img-container-el"],this.initEditor()}async updateImage(){if(this.isConnected){if(await this._waitForSize(),this.$.cdnUrl){let t=hi(this.$.cdnUrl),e=Pt(this.$.cdnUrl,t);if(e===this.$["*originalUrl"])return;this.$["*originalUrl"]=e;let s=Ts(this.$.cdnUrl),o=Ls(s);this.$["*editorTransformations"]=o}else if(this.$.uuid){let t=Pt(this.cfg.cdnCname,this.$.uuid);if(t===this.$["*originalUrl"])return;this.$["*originalUrl"]=t,this.$["*editorTransformations"]={}}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===U.CROP?this.$["*cropperEl"].deactivate({reset:!0}):this.$["*faderEl"].deactivate();try{let t=await this.proxyUrl(R(this.$["*originalUrl"],j("json"))),e=await fetch(t).then(n=>n.json()),{width:s,height:o}=e;this.$["*imageSize"]={width:s,height:o},this.$["*tabId"]===U.CROP?this.$["*cropperEl"].activate(this.$["*imageSize"]):this.$["*faderEl"].activate({url:this.$["*originalUrl"]})}catch(t){t&&console.error("Failed to load image info",t)}}}async initEditor(){try{await this._waitForSize()}catch(t){this.isConnected&&console.error(t.message);return}this.ref["img-el"].addEventListener("load",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$.src!==bt&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",t=>{let e=this.ref["img-el"];e.src!==t&&(this._imgLoading=!0,e.src=t||bt)}),this.sub("cropPreset",t=>{this.$["*cropPresetList"]=Si(t)}),this.sub("tabs",t=>{this.$["*tabList"]=cn(t)}),this.sub("*tabId",t=>{this.ref["img-el"].className=V("uc-image",{"uc-image_hidden_to_cropper":t===U.CROP,"uc-image_hidden_effects":t!==U.CROP})}),this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{this.$["presence.networkProblems"]=t,this.$["presence.modalCaption"]=!t}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],s=j(Rt(t),"preview"),o=R(e,s),n={originalUrl:e,cdnUrlModifiers:s,cdnUrl:o,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0}))},!1),this.sub("uuid",t=>t&&this.updateImage()),this.sub("cdnUrl",t=>t&&this.updateImage())}};u(yt,"styleAttrs",["uc-cloud-image-editor"]);yt.template=dn;yt.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var Zi=class extends w{constructor(){super(),this.init$={...this.init$,dragging:!1},this._handlePointerUp=this._handlePointerUp_.bind(this),this._handlePointerMove=this._handlePointerMove_.bind(this),this._handleSvgPointerMove=this._handleSvgPointerMove_.bind(this)}_shouldThumbBeDisabled(i){let t=this.$["*imageBox"];if(!t)return;if(i===""&&t.height<=T&&t.width<=T)return!0;let e=t.height<=T&&(i.includes("n")||i.includes("s")),s=t.width<=T&&(i.includes("e")||i.includes("w"));return e||s}_createBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:s,height:o}=i,n=this.ref["svg-el"],l=rt("mask",{id:"backdrop-mask"}),a=rt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),c=rt("rect",{x:t,y:e,width:s,height:o,fill:"black"});l.appendChild(a),l.appendChild(c);let d=rt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});n.appendChild(d),n.appendChild(l),this._backdropMask=l,this._backdropMaskInner=c}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block")}))}_updateBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:t,y:e,width:s,height:o}=i;this._backdropMaskInner&&Zt(this._backdropMaskInner,{x:t,y:e,width:s,height:o})}_updateFrame(){let i=this.$["*cropBox"];if(!(!i||!this._frameGuides||!this._frameThumbs)){for(let t of Object.values(this._frameThumbs)){let{direction:e,pathNode:s,interactionNode:o,groupNode:n}=t,l=e==="",a=e.length===2,{x:c,y:d,width:h,height:p}=i;if(l){let m={x:c+h/3,y:d+p/3,width:h/3,height:p/3};Zt(o,m)}else{let m=Bt(Math.min(h,p)/(24*2+34)/2,0,1),{d:y,center:x}=a?go(i,e,m):bo(i,e,m),E=Math.max(Nr*Bt(Math.min(h,p)/Nr/3,0,1),mo);Zt(o,{x:x[0]-E,y:x[1]-E,width:E*2,height:E*2}),Zt(s,{d:y})}let f=this._shouldThumbBeDisabled(e);n.setAttribute("class",V("uc-thumb",{"uc-thumb--hidden":f,"uc-thumb--visible":!f}))}Zt(this._frameGuides,{x:i.x-1*.5,y:i.y-1*.5,width:i.width+1,height:i.height+1})}}_createThumbs(){let i={};for(let t=0;t<3;t++)for(let e=0;e<3;e++){let s=`${["n","","s"][t]}${["w","","e"][e]}`,o=rt("g");o.classList.add("uc-thumb"),o.setAttribute("with-effects","");let n=rt("rect",{fill:"transparent"}),l=rt("path",{stroke:"currentColor",fill:"none","stroke-width":3});o.appendChild(l),o.appendChild(n),i[s]={direction:s,pathNode:l,interactionNode:n,groupNode:o},n.addEventListener("pointerdown",this._handlePointerDown.bind(this,s))}return i}_createGuides(){let i=rt("svg"),t=rt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});i.appendChild(t);for(let e=1;e<=2;e++){let s=rt("line",{x1:`${Ue*e}%`,y1:"0%",x2:`${Ue*e}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});i.appendChild(s)}for(let e=1;e<=2;e++){let s=rt("line",{x1:"0%",y1:`${Ue*e}%`,x2:"100%",y2:`${Ue*e}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});i.appendChild(s)}return i.classList.add("uc-guides","uc-guides--semi-hidden"),i}_createFrame(){let i=this.ref["svg-el"],t=document.createDocumentFragment(),e=this._createGuides();t.appendChild(e);let s=this._createThumbs();for(let{groupNode:o}of Object.values(s))t.appendChild(o);i.appendChild(t),this._frameThumbs=s,this._frameGuides=e}_handlePointerDown(i,t){if(!this._frameThumbs)return;let e=this._frameThumbs[i];if(this._shouldThumbBeDisabled(i))return;let s=this.$["*cropBox"],{x:o,y:n}=this.ref["svg-el"].getBoundingClientRect(),l=t.x-o,a=t.y-n;this.$.dragging=!0,this._draggingThumb=e,this._dragStartPoint=[l,a],this._dragStartCrop={...s}}_handlePointerUp_(i){this._updateCursor(),this.$.dragging&&(i.stopPropagation(),i.preventDefault(),this.$.dragging=!1)}_handlePointerMove_(i){if(!this.$.dragging||!this._dragStartPoint||!this._draggingThumb)return;i.stopPropagation(),i.preventDefault();let t=this.ref["svg-el"],{x:e,y:s}=t.getBoundingClientRect(),o=i.x-e,n=i.y-s,l=o-this._dragStartPoint[0],a=n-this._dragStartPoint[1],{direction:c}=this._draggingThumb,d=this._calcCropBox(c,[l,a]);d&&(this.$["*cropBox"]=d)}_calcCropBox(i,t){var c,d;let[e,s]=t,o=this.$["*imageBox"],n=(c=this._dragStartCrop)!=null?c:this.$["*cropBox"],l=(d=this.$["*cropPresetList"])==null?void 0:d[0],a=l?l.width/l.height:void 0;if(i===""?n=_o({rect:n,delta:[e,s],imageBox:o}):n=vo({rect:n,delta:[e,s],direction:i,aspectRatio:a,imageBox:o}),!Object.values(n).every(h=>Number.isFinite(h)&&h>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:n});return}return ae(ue(n),this.$["*imageBox"])}_handleSvgPointerMove_(i){if(!this._frameThumbs)return;let t=Object.values(this._frameThumbs).find(e=>{if(this._shouldThumbBeDisabled(e.direction))return!1;let o=e.interactionNode.getBoundingClientRect(),n={x:o.x,y:o.y,width:o.width,height:o.height};return wo(n,[i.x,i.y])});this._hoverThumb=t,this._updateCursor()}_updateCursor(){let i=this._hoverThumb;this.ref["svg-el"].style.cursor=i?yo(i.direction):"initial"}_render(){this._updateBackdrop(),this._updateFrame()}toggleThumbs(i){this._frameThumbs&&Object.values(this._frameThumbs).map(({groupNode:t})=>t).forEach(t=>{t.setAttribute("class",V("uc-thumb",{"uc-thumb--hidden":!i,"uc-thumb--visible":i}))})}initCallback(){super.initCallback(),this._createBackdrop(),this._createFrame(),this.sub("*imageBox",()=>{this._resizeBackdrop(),window.requestAnimationFrame(()=>{this._render()})}),this.sub("*cropBox",i=>{i&&(this._guidesHidden=i.height<=T||i.width<=T,window.requestAnimationFrame(()=>{this._render()}))}),this.sub("dragging",i=>{this._frameGuides&&this._frameGuides.setAttribute("class",V({"uc-guides--hidden":this._guidesHidden,"uc-guides--visible":!this._guidesHidden&&i,"uc-guides--semi-hidden":!this._guidesHidden&&!i}))}),this.ref["svg-el"].addEventListener("pointermove",this._handleSvgPointerMove,!0),document.addEventListener("pointermove",this._handlePointerMove,!0),document.addEventListener("pointerup",this._handlePointerUp,!0)}destroyCallback(){super.destroyCallback(),document.removeEventListener("pointermove",this._handlePointerMove),document.removeEventListener("pointerup",this._handlePointerUp)}};Zi.template=b`<svg class="uc-svg" ref="svg-el" xmlns="http://www.w3.org/2000/svg"></svg>`;var It=class extends w{constructor(){super(...arguments);u(this,"init$",{...this.init$,active:!1,title:"",icon:"","on.click":null,"title-prop":""})}initCallback(){super.initCallback(),this._titleEl=this.ref["title-el"],this._iconEl=this.ref["icon-el"],this.sub("title",t=>{this._titleEl&&(this._titleEl.style.display=t?"block":"none")}),this.sub("active",t=>{this.className=V({"uc-active":t,"uc-not_active":!t})}),this.sub("on.click",t=>{this.onclick=t})}};It.template=b`<button type="button" role="option" l10n="@title:title-prop"><uc-icon set="@name: icon;"></uc-icon><div class="uc-title" ref="title-el">{{title}}</div></button>`;function Wa(r){let i=r+90;return i=i>=360?0:i,i}function Ka(r,i){return r==="rotate"?Wa(i):["mirror","flip"].includes(r)?!i:null}var We=class extends It{initCallback(){super.initCallback(),this.defineAccessor("operation",i=>{i&&(this._operation=i,this.$.icon=i,this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(i).toLowerCase()})))}),this.$["on.click"]=()=>{let i=this.$["*cropperEl"].getValue(this._operation),t=Ka(this._operation,i);this.$["*cropperEl"].setValue(this._operation,t)}}};var Ke={FILTER:"filter",COLOR_OPERATION:"color_operation"},_t="original",Yi=class extends w{constructor(){super(...arguments);u(this,"init$",{...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":t=>{this.$["*faderEl"].set(t),this.$.value=t}})}setOperation(t,e){this._controlType=t==="filter"?Ke.FILTER:Ke.COLOR_OPERATION,this._operation=t,this._iconName=t,this._title=t.toUpperCase(),this._filter=e,this._initializeValues(),this.$["*faderEl"].activate({url:this.$["*originalUrl"],operation:this._operation,value:this._filter===_t?void 0:this.$.value,filter:this._filter===_t?void 0:this._filter,fromViewer:!1})}_initializeValues(){let{range:t,zero:e}=pt[this._operation],[s,o]=t;this.$.min=s,this.$.max=o,this.$.zero=e;let n=this.$["*editorTransformations"][this._operation];if(this._controlType===Ke.FILTER){let l=o;if(n){let{name:a,amount:c}=n;l=a===this._filter?c:o}this.$.value=l,this.$.defaultValue=l}if(this._controlType===Ke.COLOR_OPERATION){let l=typeof n!="undefined"?n:e;this.$.value=l,this.$.defaultValue=l}}apply(){let t;this._controlType===Ke.FILTER?this._filter===_t?t=null:t={name:this._filter,amount:this.$.value}:t=this.$.value;let e={...this.$["*editorTransformations"],[this._operation]:t};this.$["*editorTransformations"]=e}cancel(){this.$["*faderEl"].deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{this._originalUrl=t}),this.sub("value",t=>{let e=`${this._filter||this._operation} ${t}`;this.$["*operationTooltip"]=e})}};Yi.template=b`<uc-slider-ui ref="slider-el" set="disabled: disabled; min: min; max: max; defaultValue: defaultValue; zero: zero; onInput: on.input;" ></uc-slider-ui>`;function qe(r){let i=new Image;return{promise:new Promise((s,o)=>{i.src=r,i.onload=s,i.onerror=o}),image:i,cancel:()=>{i.naturalWidth===0&&(i.src=bt)}}}function Ze(r){let i=[];for(let o of r){let n=qe(o);i.push(n)}let t=i.map(o=>o.image);return{promise:Promise.allSettled(i.map(o=>o.promise)),images:t,cancel:()=>{i.forEach(o=>{o.cancel()})}}}var be=class extends It{constructor(){super(),this.init$={...this.init$,active:!1,title:"",icon:"",isOriginal:!1,"on.click":null}}_previewSrc(){let i=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),t=window.devicePixelRatio,e=Math.ceil(t*i),s=t>=2?"lightest":"normal",o=100,n={...this.$["*editorTransformations"]};return n[this._operation]=this._filter!==_t?{name:this._filter,amount:o}:void 0,R(this._originalUrl,j(di,Rt(n),`quality/${s}`,`scale_crop/${e}x${e}/center`))}async _observerCallback(i,t){var s;if(i[0].isIntersecting){let o=await this.proxyUrl(this._previewSrc()),n=this.ref["preview-el"],{promise:l,cancel:a}=qe(o);this._cancelPreload=a,l.catch(c=>{this.$["*networkProblems"]=!0,console.error("Failed to load image",{error:c})}).finally(()=>{n.style.backgroundImage=`url(${o})`,n.setAttribute("loaded",""),t.unobserve(this)})}else(s=this._cancelPreload)==null||s.call(this)}initCallback(){super.initCallback(),this.$["on.click"]=()=>{this.$.active?this.$.isOriginal||(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*showSlider"]=!0):(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*sliderEl"].apply()),this.$["*currentFilter"]=this._filter},this.defineAccessor("filter",t=>{this._operation="filter",this._filter=t,this.$.isOriginal=t===_t,this.$.icon=this.$.isOriginal?"original":"slider",this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()}))}),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let i=this.$["*originalUrl"];this._originalUrl=i,this.$.isOriginal?this.ref["icon-el"].classList.add("uc-original-icon"):this._observer.observe(this),this.sub("*currentFilter",t=>{this.$.active=t&&t===this._filter}),this.sub("active",t=>{if(this.$.isOriginal)return;let e=this.ref["icon-el"];e.style.opacity=t?"1":"0";let s=this.ref["preview-el"];t?s.style.opacity="0":s.style.backgroundImage&&(s.style.opacity="1")}),this.sub("*networkProblems",async t=>{if(!t){let e=await this.proxyUrl(this._previewSrc()),s=this.ref["preview-el"];s.style.backgroundImage&&(s.style.backgroundImage="none",s.style.backgroundImage=`url(${e})`)}})}destroyCallback(){var i,t;super.destroyCallback(),(i=this._observer)==null||i.disconnect(),(t=this._cancelPreload)==null||t.call(this)}};be.template=b`<button type="button" role="option" l10n="@title:title-prop"><div class="uc-preview" ref="preview-el"></div><uc-icon ref="icon-el" set="@name: icon; @size: iconSize;"></uc-icon></button>`;var Ye=class extends It{constructor(){super(...arguments);u(this,"_operation","")}initCallback(){super.initCallback(),this.$["on.click"]=()=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation},this.defineAccessor("operation",t=>{t&&(this._operation=t,this.$.icon=t,this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()})),this.bindL10n("title",()=>this.l10n(t)))}),this.sub("*editorTransformations",t=>{if(!this._operation)return;let{zero:e}=pt[this._operation],s=t[this._operation],o=typeof s!="undefined"?s!==e:!1;this.$.active=o})}};function pn(r,i){let t={};for(let e of i){let s=r[e];(r.hasOwnProperty(e)||s!==void 0)&&(t[e]=s)}return t}function ye(r,i,t){let s=window.devicePixelRatio,o=Math.min(Math.ceil(i*s),3e3),n=s>=2?"lightest":"normal";return R(r,j(di,Rt(t),`quality/${n}`,`stretch/off/-/resize/${o}x`,`@clib/${he}/${de}/uc-cloud-image-editor/`))}function qa(r){return r?[({dimensions:t,coords:e})=>[...t,...e].every(s=>Number.isInteger(s)&&Number.isFinite(s)),({dimensions:t,coords:e})=>t.every(s=>s>0)&&e.every(s=>s>=0)].every(t=>t(r)):!0}var Ji=class extends w{constructor(){super();u(this,"ctxOwner",!0);this.init$={...this.init$,image:null,"*padding":20,"*operations":{rotate:0,mirror:!1,flip:!1},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this._commitDebounced=M(this._commit.bind(this),300),this._handleResizeThrottled=Hi(this._handleResize.bind(this),100),this._imageSize={width:0,height:0}}_handleResize(){!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw())}_syncTransformations(){let t=this.$["*editorTransformations"],e=pn(t,Object.keys(this.$["*operations"])),s={...this.$["*operations"],...e};this.$["*operations"]=s}_initCanvas(){let t=this.ref["canvas-el"],e=t.getContext("2d"),s=this.offsetWidth,o=this.offsetHeight,n=window.devicePixelRatio;t.style.width=`${s}px`,t.style.height=`${o}px`,t.width=s*n,t.height=o*n,e==null||e.scale(n,n),this._canvas=t,this._ctx=e}_alignImage(){if(!this._isActive||!this.$.image)return;let t=this.$.image,e=this.$["*padding"],s=this.$["*operations"],{rotate:o}=s,n={width:this.offsetWidth,height:this.offsetHeight},l=ce({width:t.naturalWidth,height:t.naturalHeight},o),a;if(l.width>n.width-e*2||l.height>n.height-e*2){let c=l.width/l.height,d=n.width/n.height;if(c>d){let h=n.width-e*2,p=h/c,f=0+e,m=e+(n.height-e*2)/2-p/2;a={x:f,y:m,width:h,height:p}}else{let h=n.height-e*2,p=h*c,f=e+(n.width-e*2)/2-p/2,m=0+e;a={x:f,y:m,width:p,height:h}}}else{let{width:c,height:d}=l,h=e+(n.width-e*2)/2-c/2,p=e+(n.height-e*2)/2-d/2;a={x:h,y:p,width:c,height:d}}this.$["*imageBox"]=ue(a)}_alignCrop(){var p;let t=this.$["*cropBox"],e=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,n=this.$["*editorTransformations"].crop,{width:l,x:a,y:c}=this.$["*imageBox"];if(n){let{dimensions:[f,m],coords:[y,x]}=n,{width:E}=ce(this._imageSize,o),C=l/E;t=ae(ue({x:a+y*C,y:c+x*C,width:f*C,height:m*C}),this.$["*imageBox"])}let d=(p=this.$["*cropPresetList"])==null?void 0:p[0],h=d?d.width/d.height:void 0;if(!Co(t,e)||h&&!xo(t,h)){let f=e.width/e.height,m=e.width,y=e.height;h&&(f>h?m=Math.min(e.height*h,e.width):y=Math.min(e.width/h,e.height)),t={x:e.x+e.width/2-m/2,y:e.y+e.height/2-y/2,width:m,height:y}}this.$["*cropBox"]=ae(ue(t),this.$["*imageBox"])}_drawImage(){let t=this._ctx;if(!t)return;let e=this.$.image,s=this.$["*imageBox"],o=this.$["*operations"],{mirror:n,flip:l,rotate:a}=o,c=ce({width:s.width,height:s.height},a);t.save(),t.translate(s.x+s.width/2,s.y+s.height/2),t.rotate(a*Math.PI*-1/180),t.scale(n?-1:1,l?-1:1),t.drawImage(e,-c.width/2,-c.height/2,c.width,c.height),t.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let t=this._canvas;this._ctx.clearRect(0,0,t.width,t.height),this._drawImage()}_animateIn({fromViewer:t}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=V({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":!1})}))}_getCropDimensions(){let t=this.$["*cropBox"],e=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,{width:n,height:l}=e,{width:a,height:c}=ce(this._imageSize,o),{width:d,height:h}=t,p=n/a,f=l/c;return[Bt(Math.round(d/p),1,a),Bt(Math.round(h/f),1,c)]}_getCropTransformation(){let t=this.$["*cropBox"],e=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,{width:n,height:l,x:a,y:c}=e,{width:d,height:h}=ce(this._imageSize,o),{x:p,y:f}=t,m=n/d,y=l/h,x=this._getCropDimensions(),E={dimensions:x,coords:[Bt(Math.round((p-a)/m),0,d-x[0]),Bt(Math.round((f-c)/y),0,h-x[1])]};if(!qa(E)){console.error("Cropper is trying to create invalid crop object",{payload:E});return}if(!(x[0]===d&&x[1]===h))return E}_commit(){if(!this.isConnected||!this._imageSize)return;let t=this.$["*operations"],{rotate:e,mirror:s,flip:o}=t,n=this._getCropTransformation(),a={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:s,flip:o};this.$["*editorTransformations"]=a}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this._isActive){this._isActive=!0,this._imageSize=t,this.removeEventListener("transitionend",this._reset);try{this.$.image=await this._waitForImage(this.$["*originalUrl"],this.$["*editorTransformations"]),this._syncTransformations(),this._animateIn({fromViewer:e})}catch(s){console.error("Failed to activate cropper",{error:s})}this._observer=new ResizeObserver(([s])=>{s.contentRect.width>0&&s.contentRect.height>0&&this._isActive&&this.$.image&&this._handleResizeThrottled()}),this._observer.observe(this)}}deactivate({reset:t=!1}={}){var e;this._isActive&&(!t&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=V({"uc-active_from_viewer":!1,"uc-active_from_editor":!1,"uc-inactive_to_editor":!0}),this.ref["frame-el"].toggleThumbs(!1),this.addEventListener("transitionend",this._reset,{once:!0}),(e=this._observer)==null||e.disconnect())}_transitionToCrop(){let t=this._getCropDimensions(),e=Math.min(this.offsetWidth,t[0])/this.$["*cropBox"].width,s=Math.min(this.offsetHeight,t[1])/this.$["*cropBox"].height,o=Math.min(e,s),n=this.$["*cropBox"].x+this.$["*cropBox"].width/2,l=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform=`scale(${o}) translate(${(this.offsetWidth/2-n)/o}px, ${(this.offsetHeight/2-l)/o}px)`,this.style.transformOrigin=`${n}px ${l}px`}_transitionToImage(){let t=this.$["*cropBox"].x+this.$["*cropBox"].width/2,e=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${t}px ${e}px`}_reset(){this._isActive||(this.$.image=null)}async _waitForImage(t,e){var d;let s=this.offsetWidth;e={...e,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let o=await this.proxyUrl(ye(t,s,e)),{promise:n,cancel:l,image:a}=qe(o),c=this._handleImageLoading(o);return a.addEventListener("load",c,{once:!0}),a.addEventListener("error",c,{once:!0}),(d=this._cancelPreload)==null||d.call(this),this._cancelPreload=l,n.then(()=>a).catch(h=>(console.error("Failed to load image",{error:h}),this.$["*networkProblems"]=!0,Promise.resolve(a)))}_handleImageLoading(t){let e="crop",s=this.$["*loadingOperations"];return s.get(e)||s.set(e,new Map),s.get(e).get(t)||(s.set(e,s.get(e).set(t,!0)),this.$["*loadingOperations"]=s),()=>{var o;(o=s==null?void 0:s.get(e))!=null&&o.has(t)&&(s.get(e).delete(t),this.$["*loadingOperations"]=s)}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw()}),this.sub("*cropBox",()=>{this.$.image&&this._commitDebounced()}),this.sub("*cropPresetList",()=>{this._alignCrop()}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){var t;super.destroyCallback(),(t=this._observer)==null||t.disconnect()}};Ji.template=b`<canvas class="uc-canvas" ref="canvas-el"></canvas><uc-crop-frame ref="frame-el"></uc-crop-frame>`;function ls(r,i,t){let e=Array(t);t--;for(let s=t;s>=0;s--)e[s]=Math.ceil((s*i+(t-s)*r)/t);return e}function Za(r){return r.reduce((i,t,e)=>e<r.length-1?[...i,[t,r[e+1]]]:i,[])}function Ya(r,i,t){let e=Za(r).find(([s,o])=>s<=i&&i<=o);return r.map(s=>{let o=Math.abs(e[0]-e[1]),n=Math.abs(i-e[0])/o;return e[0]===s?i>t?1:1-n:e[1]===s?i>=t?n:1:0})}function Ja(r,i){return r.map((t,e)=>t<i?r.length-e:e)}function fn(r,i){let t=pt[r].keypointsNumber,{range:e,zero:s}=pt[r];return[...new Set([...ls(e[0],s,t+1),...ls(s,e[1],t+1),s,i])].sort((o,n)=>o-n)}var as=class extends w{constructor(){super(),this._isActive=!1,this._hidden=!0,this._addKeypointDebounced=M(this._addKeypoint.bind(this),600),this.classList.add("uc-inactive_to_cropper")}_handleImageLoading(i){let t=this._operation,e=this.$["*loadingOperations"];return e.get(t)||e.set(t,new Map),e.get(t).get(i)||(e.set(t,e.get(t).set(i,!0)),this.$["*loadingOperations"]=e),()=>{var s;(s=e==null?void 0:e.get(t))!=null&&s.has(i)&&(e.get(t).delete(i),this.$["*loadingOperations"]=e)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let i of this._keypoints){let{image:t}=i;t&&(t.style.opacity=i.opacity.toString(),t.style.zIndex=i.zIndex.toString())}})}async _imageSrc({url:i=this._url,filter:t=this._filter,operation:e,value:s}={}){let o={...this._transformations};e&&(o[e]=t?{name:t,amount:s}:s);let n=this.offsetWidth;return await this.proxyUrl(ye(i,n,o))}async _constructKeypoint(i,t){return{src:await this._imageSrc({operation:i,value:t}),image:null,opacity:0,zIndex:0,value:t}}_isSame(i,t){return this._operation===i&&this._filter===t}async _addKeypoint(i,t,e){let s=()=>!this._isSame(i,t)||this._value!==e||!!this._keypoints.find(a=>a.value===e);if(s())return;let o=await this._constructKeypoint(i,e),n=new Image;n.src=o.src;let l=this._handleImageLoading(o.src);n.addEventListener("load",l,{once:!0}),n.addEventListener("error",l,{once:!0}),o.image=n,n.classList.add("uc-fader-image"),n.addEventListener("load",()=>{if(s())return;let a=this._keypoints,c=a.findIndex(h=>h.value>e),d=c<a.length?a[c].image:null;!this._container||d&&!this._container.contains(d)||(a.splice(c,0,o),this._container.insertBefore(n,d),this._update(i,e))},{once:!0}),n.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}set(i){i=typeof i=="string"?parseInt(i,10):i,this._update(this._operation,i),this._addKeypointDebounced(this._operation,this._filter,i)}_update(i,t){this._operation=i,this._value=t;let{zero:e}=pt[i],s=this._keypoints.map(l=>l.value),o=Ya(s,t,e),n=Ja(s,e);for(let[l,a]of Object.entries(this._keypoints))a.opacity=o[l],a.zIndex=n[l];this._flush()}_createPreviewImage(){let i=new Image;return i.classList.add("uc-fader-image","uc-fader-image--preview"),i.style.opacity="0",i}async _initNodes(){let i=document.createDocumentFragment();this._previewImage=this._previewImage||this._createPreviewImage(),!this.contains(this._previewImage)&&i.appendChild(this._previewImage);let t=document.createElement("div");i.appendChild(t);let e=this._keypoints.map(c=>c.src),{images:s,promise:o,cancel:n}=Ze(e);s.forEach(c=>{let d=this._handleImageLoading(c.src);c.addEventListener("load",d),c.addEventListener("error",d)}),this._cancelLastImages=()=>{n(),this._cancelLastImages=void 0};let l=this._operation,a=this._filter;await o,this._isActive&&this._isSame(l,a)&&(this._container&&this._container.remove(),this._container=t,this._keypoints.forEach((c,d)=>{let h=s[d];h.classList.add("uc-fader-image"),c.image=h,this._container.appendChild(h)}),this.appendChild(i),this._flush())}async setTransformations(i){if(this._transformations=i,this._previewImage){let t=await this._imageSrc(),e=this._handleImageLoading(t);this._previewImage.src=t,this._previewImage.addEventListener("load",e,{once:!0}),this._previewImage.addEventListener("error",e,{once:!0}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}}async preload({url:i,filter:t,operation:e,value:s}){this._cancelBatchPreload&&this._cancelBatchPreload();let o=fn(e,s),n=await Promise.all(o.map(a=>this._imageSrc({url:i,filter:t,operation:e,value:a}))),{cancel:l}=Ze(n);this._cancelBatchPreload=l}_setOriginalSrc(i){let t=this._previewImage||this._createPreviewImage();if(!this.contains(t)&&this.appendChild(t),this._previewImage=t,t.src===i){t.style.opacity="1",t.style.transform="scale(1)",this.className=V({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1});return}t.style.opacity="0";let e=this._handleImageLoading(i);t.addEventListener("error",e,{once:!0}),t.src=i,t.addEventListener("load",()=>{e(),t&&(t.style.opacity="1",t.style.transform="scale(1)",this.className=V({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1}))},{once:!0}),t.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}async activate({url:i,operation:t,value:e,filter:s,fromViewer:o}){if(this._isActive=!0,this._hidden=!1,this._url=i,this._operation=t||"initial",this._value=e,this._filter=s,this._fromViewer=o,typeof e!="number"&&!s){let l=await this._imageSrc({operation:t,value:e});this._setOriginalSrc(l),this._container&&this._container.remove();return}this._keypoints=await Promise.all(fn(t,e).map(l=>this._constructKeypoint(t,l))),this._update(t,e),this._initNodes()}deactivate({hide:i=!0}={}){this._isActive=!1,this._cancelLastImages&&this._cancelLastImages(),this._cancelBatchPreload&&this._cancelBatchPreload(),i&&!this._hidden?(this._hidden=!0,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=V({"uc-active_from_viewer":!1,"uc-active_from_cropper":!1,"uc-inactive_to_cropper":!0}),this.addEventListener("transitionend",()=>{this._container&&this._container.remove()},{once:!0})):this._container&&this._container.remove()}};var Qa=1,Qi=class extends w{initCallback(){super.initCallback(),this.addEventListener("wheel",i=>{i.preventDefault();let{deltaY:t,deltaX:e}=i;Math.abs(e)>Qa?this.scrollLeft+=e:this.scrollLeft+=t},{passive:!1}),this.addEventListener("scroll",()=>{},{passive:!0})}};Qi.template=b`<slot></slot>`;function tc(r){return`<uc-presence-toggle class="uc-tab-toggle" set="visible: presence.tabToggle.${r}; styles: presence.tabToggleStyles;" ><uc-btn-ui theme="tab" ref="tab-toggle-${r}" data-id="${r}" icon="${r}" set="onclick: on.clickTab; aria-role:tab_role; aria-controls:tab_${r}; title-prop: a11y-editor-tab-${r}" ></uc-btn-ui></uc-presence-toggle>`}function ec(r){return b`<uc-presence-toggle id="tab_${r}" class="uc-tab-content" set="visible: presence.tabContent.${r}; styles: presence.tabContentStyles" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner" ref="controls-list-${r}" ></div></div></uc-editor-scroller></uc-presence-toggle>`}var tr=class extends w{constructor(){super();u(this,"_updateInfoTooltip",M(()=>{var n,l;let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],s="",o=!1;if(this.$["*tabId"]===U.FILTERS)if(o=!0,this.$["*currentFilter"]&&((n=t==null?void 0:t.filter)==null?void 0:n.name)===this.$["*currentFilter"]){let a=((l=t==null?void 0:t.filter)==null?void 0:l.amount)||100;s=this.$["*currentFilter"]+" "+a}else s=this.l10n(_t);else if(this.$["*tabId"]===U.TUNING&&e){o=!0;let a=(t==null?void 0:t[e])||pt[e].zero;s=this.l10n(e)+" "+a}o&&(this.$["*operationTooltip"]=s),this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible",o)},0));this.init$={...this.init$,"*sliderEl":null,"*loadingOperations":new Map,"*showSlider":!1,"*currentFilter":_t,"*currentOperation":null,showLoader:!1,filters:Ms,colorOperations:Us,cropOperations:Ps,"*operationTooltip":null,"presence.mainToolbar":!0,"presence.subToolbar":!1,"presence.tabToggles":!0,"presence.tabContent.crop":!1,"presence.tabContent.tuning":!1,"presence.tabContent.filters":!1,"presence.tabToggle.crop":!0,"presence.tabToggle.tuning":!0,"presence.tabToggle.filters":!0,"presence.subTopToolbarStyles":{hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"},"presence.subBottomToolbarStyles":{hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"},"presence.tabContentStyles":{hidden:"uc-tab-content--hidden",visible:"uc-tab-content--visible"},"presence.tabToggleStyles":{hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"},"presence.tabTogglesStyles":{hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"},"on.cancel":()=>{var t;(t=this._cancelPreload)==null||t.call(this),this.$["*on.cancel"]()},"on.apply":()=>{this.$["*on.apply"](this.$["*editorTransformations"])},"on.applySlider":()=>{this.ref["slider-el"].apply(),this._onSliderClose()},"on.cancelSlider":()=>{this.ref["slider-el"].cancel(),this._onSliderClose()},"on.clickTab":t=>{let e=t.currentTarget.getAttribute("data-id");e&&this._activateTab(e,{fromViewer:!1})},tab_role:"tab",[`tab_${U.TUNING}`]:`tab_${U.TUNING}`,[`tab_${U.CROP}`]:`tab_${U.CROP}`,[`tab_${U.FILTERS}`]:`tab_${U.FILTERS}`,cancel:"cancel",apply:"apply","a11y-editor-tab-filters":"a11y-editor-tab-filters","a11y-editor-tab-tuning":"a11y-editor-tab-tuning","a11y-editor-tab-crop":"a11y-editor-tab-crop"},this._debouncedShowLoader=M(this._showLoader.bind(this),500)}_onSliderClose(){this.$["*showSlider"]=!1,this.$["*tabId"]===U.TUNING&&this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible",!1)}_createOperationControl(t){let e=new Ye;return e.operation=t,e}_createFilterControl(t){let e=new be;return e.filter=t,e}_createToggleControl(t){let e=new We;return e.operation=t,e}_renderControlsList(t){let e=this.ref[`controls-list-${t}`],s=document.createDocumentFragment();t===U.CROP?this.$.cropOperations.forEach(o=>{let n=this._createToggleControl(o);s.appendChild(n)}):t===U.FILTERS?[_t,...this.$.filters].forEach(o=>{let n=this._createFilterControl(o);s.appendChild(n)}):t===U.TUNING&&this.$.colorOperations.forEach(o=>{let n=this._createOperationControl(o);s.appendChild(n)}),[...s.children].forEach((o,n)=>{n===s.childNodes.length-1&&o.classList.add("uc-controls-list_last-item")}),e.innerHTML="",e.appendChild(s)}_activateTab(t,{fromViewer:e}){this.$["*tabId"]=t,t===U.CROP?(this.$["*faderEl"].deactivate(),this.$["*cropperEl"].activate(this.$["*imageSize"],{fromViewer:e})):(this.$["*faderEl"].activate({url:this.$["*originalUrl"],fromViewer:e}),this.$["*cropperEl"].deactivate());for(let s of Z){let o=s===t,n=this.ref[`tab-toggle-${s}`];n.active=o,o?(this._renderControlsList(t),this._syncTabIndicator()):this._unmountTabControls(s),this.$[`presence.tabContent.${s}`]=o}}_unmountTabControls(t){let e=this.ref[`controls-list-${t}`];e&&(e.innerHTML="")}_syncTabIndicator(){let t=this.ref[`tab-toggle-${this.$["*tabId"]}`],e=this.ref["tabs-indicator"];e.style.transform=`translateX(${t.offsetLeft}px)`}async _preloadEditedImage(){var t;if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let e=this.$["*imgContainerEl"].offsetWidth,s=await this.proxyUrl(ye(this.$["*originalUrl"],e,this.$["*editorTransformations"]));(t=this._cancelPreload)==null||t.call(this);let{cancel:o}=Ze([s]);this._cancelPreload=()=>{o(),this._cancelPreload=void 0}}}_showLoader(t){this.$.showLoader=t}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.sub("*imageSize",t=>{t&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",t=>{var s;let e=(s=t==null?void 0:t.filter)==null?void 0:s.name;this.$["*currentFilter"]!==e&&(this.$["*currentFilter"]=e!=null?e:null)}),this.sub("*currentFilter",()=>{this._updateInfoTooltip()}),this.sub("*currentOperation",()=>{this._updateInfoTooltip()}),this.sub("*tabId",()=>{this._updateInfoTooltip()}),this.sub("*originalUrl",()=>{this.$["*faderEl"]&&this.$["*faderEl"].deactivate()}),this.sub("*editorTransformations",t=>{this._preloadEditedImage(),this.$["*faderEl"]&&this.$["*faderEl"].setTransformations(t)}),this.sub("*loadingOperations",t=>{let e=!1;for(let[,s]of t.entries()){if(e)break;for(let[,o]of s.entries())if(o){e=!0;break}}this._debouncedShowLoader(e)}),this.sub("*showSlider",t=>{this.$["presence.subToolbar"]=t,this.$["presence.mainToolbar"]=!t}),this.sub("*tabList",t=>{this.$["presence.tabToggles"]=t.length>1;for(let e of Z){this.$[`presence.tabToggle.${e}`]=t.includes(e);let s=this.ref[`tab-toggle-${e}`];s.style.gridColumn=t.indexOf(e)+1}t.includes(this.$["*tabId"])||this._activateTab(t[0],{fromViewer:!1})}),this._updateInfoTooltip()}};tr.template=b`<uc-line-loader-ui set="active: showLoader"></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div ref="tooltip-el" class="uc-info-tooltip uc-info-tooltip_hidden">{{*operationTooltip}}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" set="visible: presence.mainToolbar; styles: presence.subTopToolbarStyles" ><div class="uc-tab-content-row">${Z.map(ec).join("")}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" set="visible: presence.tabToggles; styles: presence.tabTogglesStyles" ><div ref="tabs-indicator" class="uc-tab-toggles_indicator"></div> ${Z.map(tc).join("")} </uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" set="onclick: on.cancel; title-prop:cancel"></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" set="onclick: on.apply; title-prop:apply"></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" set="visible: presence.subToolbar; styles: presence.subBottomToolbarStyles" ><div class="uc-slider"><uc-editor-slider ref="slider-el"></uc-editor-slider></div><div class="uc-controls-row"><uc-btn-ui theme="secondary" set="onclick: on.cancelSlider" l10n="@text:cancel"></uc-btn-ui><uc-btn-ui theme="primary" set="onclick: on.applySlider" l10n="@text:apply"></uc-btn-ui></div></uc-presence-toggle></div>`;var Je=class extends w{constructor(){super(),this._iconReversed=!1,this._iconSingle=!1,this._iconHidden=!1,this.init$={...this.init$,text:"",icon:"",iconCss:this._iconCss(),theme:null,"aria-role":"","aria-controls":"","title-prop":""},this.defineAccessor("active",i=>{i?this.setAttribute("active",""):this.removeAttribute("active")})}_iconCss(){return V("uc-icon",{"uc-icon_left":!this._iconReversed,"uc-icon_right":this._iconReversed,"uc-icon_hidden":this._iconHidden,"uc-icon_single":this._iconSingle})}initCallback(){super.initCallback(),this.sub("icon",i=>{this._iconSingle=!this.$.text,this._iconHidden=!i,this.$.iconCss=this._iconCss()}),this.sub("theme",i=>{i!=="custom"&&(this.className=`uc-${i}`)}),this.sub("text",()=>{this._iconSingle=!1}),this.hasAttribute("theme")||this.setAttribute("theme","default"),this.defineAccessor("aria-role",i=>{this.$["aria-role"]=i||""}),this.defineAccessor("aria-controls",i=>{this.$["aria-controls"]=i||""}),this.defineAccessor("title-prop",i=>{this.$["title-prop"]=i||""})}set reverse(i){this.hasAttribute("reverse")?(this.style.flexDirection="row-reverse",this._iconReversed=!0):(this._iconReversed=!1,this.style.flexDirection=null)}};Je.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});Je.template=b`<button type="button" set="@role:aria-role; @aria-controls: aria-controls;" l10n="@title:title-prop"><uc-icon set="className: iconCss; @name: icon; @hidden: !icon"></uc-icon><div class="uc-text">{{text}}</div></button>`;var er=class extends w{constructor(){super(),this._active=!1,this._handleTransitionEndRight=()=>{let i=this.ref["line-el"];i.style.transition="initial",i.style.opacity="0",i.style.transform="translateX(-101%)",this._active&&this._start()}}initCallback(){super.initCallback(),this.defineAccessor("active",i=>{typeof i=="boolean"&&(i?this._start():this._stop())})}_start(){this._active=!0;let{width:i}=this.getBoundingClientRect(),t=this.ref["line-el"];t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${i}px)`,t.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){this._active=!1}};er.template=b`<div class="uc-inner"><div class="uc-line" ref="line-el"></div></div>`;var ir={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},rr=class extends w{constructor(){super(),this._visible=!1,this._visibleStyle=ir.visible,this._hiddenStyle=ir.hidden,this._externalTransitions=!1,this.defineAccessor("styles",i=>{i&&(this._externalTransitions=!0,this._visibleStyle=i.visible,this._hiddenStyle=i.hidden)}),this.defineAccessor("visible",i=>{typeof i=="boolean"&&(this._visible=i,this._handleVisible())})}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",an(this,{[ir.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.setAttribute("aria-hidden",this._visible?"false":"true")}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",!0),this._externalTransitions||this.classList.add(ir.transition),this._handleVisible(),setTimeout(()=>{this.classList.toggle("uc-initial",!1)},0)}};rr.template=b`<slot></slot>`;var sr=class extends w{constructor(){super();u(this,"init$",{...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:null,"on.sliderInput":()=>{let t=parseInt(this.ref["input-el"].value,10);this._updateValue(t),this.$.onInput&&this.$.onInput(t)},"on.sliderChange":()=>{let t=parseInt(this.ref["input-el"].value,10);this.$.onChange&&this.$.onChange(t)}});this.setAttribute("with-effects","")}initCallback(){super.initCallback(),this.defineAccessor("disabled",e=>{this.$.disabled=e}),this.defineAccessor("min",e=>{this.$.min=e}),this.defineAccessor("max",e=>{this.$.max=e}),this.defineAccessor("defaultValue",e=>{this.$.defaultValue=e,this.ref["input-el"].value=e,this._updateValue(e)}),this.defineAccessor("zero",e=>{this._zero=e}),this.defineAccessor("onInput",e=>{e&&(this.$.onInput=e)}),this.defineAccessor("onChange",e=>{e&&(this.$.onChange=e)}),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps();let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)}),this._observer.observe(this),this._thumbSize=parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10),setTimeout(()=>{let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e)},0),this.sub("disabled",e=>{let s=this.ref["input-el"];e?s.setAttribute("disabled","disabled"):s.removeAttribute("disabled")});let t=this.ref["input-el"];t.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),t.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_updateValue(t){this._updateZeroDot(t);let{width:e}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(t-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this.ref["thumb-el"].style.transform=`translateX(${n}px)`})}_updateZeroDot(t){if(!this._zeroDotEl)return;t===this._zero?this._zeroDotEl.style.opacity="0":this._zeroDotEl.style.opacity="0.2";let{width:e}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(this._zero-this.$.min)*(e-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl.style.transform=`translateX(${n}px)`})}_updateSteps(){let e=this.ref["steps-el"],{width:s}=e.getBoundingClientRect(),o=Math.ceil(s/2),n=Math.ceil(o/15)-2;if(this._stepsCount===n)return;let l=document.createDocumentFragment(),a=document.createElement("div"),c=document.createElement("div");a.className="uc-minor-step",c.className="uc-border-step",l.appendChild(c);for(let h=0;h<n;h++)l.appendChild(a.cloneNode());l.appendChild(c.cloneNode());for(let h=0;h<n;h++)l.appendChild(a.cloneNode());l.appendChild(c.cloneNode());let d=document.createElement("div");d.className="uc-zero-dot",l.appendChild(d),this._zeroDotEl=d,e.innerHTML="",e.appendChild(l),this._stepsCount=n}destroyCallback(){var t;super.destroyCallback(),(t=this._observer)==null||t.disconnect()}};sr.template=b`<div class="uc-steps" ref="steps-el"></div><div ref="thumb-el" class="uc-thumb"></div><input class="uc-input" type="range" ref="input-el" set="oninput: on.sliderInput; onchange: on.sliderChange; @min: min; @max: max; @value: defaultValue;" />`;var cs=class extends S{constructor(){super(...arguments);u(this,"couldBeCtxOwner",!0);u(this,"activityType",v.activities.CLOUD_IMG_EDIT);u(this,"_entry");u(this,"_instance")}get activityParams(){let t=super.activityParams;if("internalId"in t)return t;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>this.mountEditor(),onDeactivate:()=>this.unmountEditor()}),this.subConfigValue("cropPreset",t=>{this._instance&&this._instance.getAttribute("crop-preset")!==t&&this._instance.setAttribute("crop-preset",t)}),this.subConfigValue("cloudImageEditorTabs",t=>{this._instance&&this._instance.getAttribute("tabs")!==t&&this._instance.setAttribute("tabs",t)})}handleApply(t){if(!this._entry)return;let e=t.detail;this._entry.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.historyBack()}handleCancel(){this.historyBack()}mountEditor(){let{internalId:t}=this.activityParams;if(this._entry=this.uploadCollection.read(t),!this._entry)throw new Error(`Entry with internalId "${t}" not found`);let e=this._entry.getValue("cdnUrl");if(!e)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);let s=new yt,o=this.cfg.cropPreset,n=this.cfg.cloudImageEditorTabs;s.setAttribute(Se.CTX_NAME_ATTR,this.ctxName),s.setAttribute("cdn-url",e),o&&s.setAttribute("crop-preset",o),n&&s.setAttribute("tabs",n),s.addEventListener("apply",l=>{let a=l;this.handleApply(a),this.debugPrint('editor event "apply"',a.detail)}),s.addEventListener("cancel",l=>{let a=l;this.handleCancel(),this.debugPrint('editor event "cancel"',a.detail)}),s.addEventListener("change",l=>{let a=l;this.debugPrint('editor event "change"',a.detail)}),this.innerHTML="",this.appendChild(s),this._instance=s}unmountEditor(){this._instance=void 0,this._entry=void 0,this.innerHTML=""}};var ic=function(r){return r.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},mn=function(r,i="i"){let t=r.split("*").map(ic);return new RegExp("^"+t.join(".+")+"$",i)};var rc=r=>Object.keys(r).reduce((t,e)=>{let s=r[e],o=Object.keys(s).reduce((n,l)=>{let a=s[l];return n+`${l}: ${a};`},"");return t+`${e}{${o}}`},"");function gn({textColor:r,backgroundColor:i,linkColor:t,linkColorHover:e,secondaryColor:s,secondaryHover:o,secondaryForegroundColor:n,fontFamily:l,fontSize:a,radius:c}){let d=`solid 1px ${s}`;return rc({body:{color:r,"background-color":i,"font-family":l,"font-size":a},".side-bar":{background:"inherit","border-right":d},".main-content":{background:"inherit"},".main-content-header":{background:"inherit"},".main-content-footer":{background:"inherit"},".list-table-row":{color:"inherit"},".list-table-row:hover":{background:s},".list-table-row .list-table-cell-a, .list-table-row .list-table-cell-b":{"border-top":d},".list-table-body .list-items":{"border-bottom":d},".bread-crumbs a":{color:t},".bread-crumbs a:hover":{color:e},".main-content.loading":{background:`${i} url(/static/images/loading_spinner.gif) center no-repeat`,"background-size":"25px 25px"},".list-icons-item":{"background-color":s},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a":{color:t},".source-gdrive .side-bar-menu a, .source-gphotos .side-bar-menu a:hover":{color:e},".side-bar-menu a":{color:t},".side-bar-menu a:hover":{color:e},".source-gdrive .side-bar-menu .current, .source-gdrive .side-bar-menu a:hover, .source-gphotos .side-bar-menu .current, .source-gphotos .side-bar-menu a:hover":{color:e},".source-vk .side-bar-menu a":{color:t},".source-vk .side-bar-menu a:hover":{color:e,background:"none"},"input[type=submit], .button, button":{color:n,background:s,"box-shadow":"none",border:"none","border-radius":c},"input[type=submit]:hover, .button:hover, button:hover":{background:o},".text-field, input[type=search], input[type=text], input[type=url], textarea":{color:n,"border-radius":c,background:s,border:d}})}var Vt={};window.addEventListener("message",r=>{let i;try{i=JSON.parse(r.data)}catch{return}if((i==null?void 0:i.type)in Vt){let t=Vt[i.type];for(let[e,s]of t)r.source===e&&s(i)}});var bn=function(r,i,t){r in Vt||(Vt[r]=[]),Vt[r].push([i,t])},yn=function(r,i){r in Vt&&(Vt[r]=Vt[r].filter(t=>t[0]!==i))};function _n(r){let i=[];for(let[t,e]of Object.entries(r))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}var or=class extends S{constructor(){super();u(this,"couldBeCtxOwner",!0);u(this,"activityType",v.activities.EXTERNAL);u(this,"_iframe",null);this.init$={...this.init$,activityIcon:"",activityCaption:"",selectedList:[],counter:0,multiple:!1,onDone:()=>{for(let t of this.$.selectedList){let e=this.extractUrlFromMessage(t),{filename:s}=t,{externalSourceType:o}=this.activityParams;this.api.addFileFromUrl(e,{fileName:s,source:o})}this.$["*currentActivity"]=v.activities.UPLOAD_LIST},onCancel:()=>{this.historyBack()}}}get activityParams(){let t=super.activityParams;if("externalSourceType"in t)return t;throw new Error("External Source activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:()=>{let{externalSourceType:t}=this.activityParams;if(!t){this.$["*currentActivity"]=null,this.setOrAddState("*modalActive",!1),console.error(`Param "externalSourceType" is required for activity "${this.activityType}"`);return}this.set$({activityCaption:`${t==null?void 0:t[0].toUpperCase()}${t==null?void 0:t.slice(1)}`,activityIcon:t}),this.mountIframe()}}),this.sub("*currentActivityParams",()=>{this.isActivityActive&&(this.unmountIframe(),this.mountIframe())}),this.sub("*currentActivity",t=>{t!==this.activityType&&this.unmountIframe()}),this.sub("selectedList",t=>{this.$.counter=t.length}),this.subConfigValue("multiple",t=>{this.$.multiple=t})}extractUrlFromMessage(t){if(t.alternatives){let e=G(this.cfg.externalSourcesPreferredTypes);for(let s of e){let o=mn(s);for(let[n,l]of Object.entries(t.alternatives))if(o.test(n))return l}}return t.url}sendMessage(t){var e,s;(s=(e=this._iframe)==null?void 0:e.contentWindow)==null||s.postMessage(JSON.stringify(t),"*")}async handleFileSelected(t){!this.$.multiple&&this.$.selectedList.length||(this.$.selectedList=[...this.$.selectedList,t],this.$.multiple||this.$.onDone())}handleIframeLoad(){this.applyStyles()}getCssValue(t){return window.getComputedStyle(this).getPropertyValue(t).trim()}applyStyles(){let t={radius:this.getCssValue("--uc-radius"),backgroundColor:this.getCssValue("--uc-background"),textColor:this.getCssValue("--uc-foreground"),secondaryColor:this.getCssValue("--uc-secondary"),secondaryForegroundColor:this.getCssValue("--uc-secondary-foreground"),secondaryHover:this.getCssValue("--uc-secondary-hover"),linkColor:this.getCssValue("--uc-primary"),linkColorHover:this.getCssValue("--uc-primary-hover"),fontFamily:this.getCssValue("--uc-font-family"),fontSize:this.getCssValue("--uc-font-size")};this.sendMessage({type:"embed-css",style:gn(t)})}remoteUrl(){var c,d;let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:s}=this.cfg,{externalSourceType:o}=this.activityParams,l={lang:((d=(c=this.l10n("social-source-lang"))==null?void 0:c.split("-"))==null?void 0:d[0])||"en",public_key:t,images_only:"false",pass_window_open:!1,session_key:e},a=new URL(`/window3/${o}`,s);return a.search=_n(l),a.toString()}mountIframe(){let t=Te({tag:"iframe",attributes:{src:this.remoteUrl(),marginheight:0,marginwidth:0,frameborder:0,allowTransparency:!0}});t.addEventListener("load",this.handleIframeLoad.bind(this)),this.ref.iframeWrapper.innerHTML="",this.ref.iframeWrapper.appendChild(t),bn("file-selected",t.contentWindow,this.handleFileSelected.bind(this)),this._iframe=t,this.$.selectedList=[]}unmountIframe(){this._iframe&&yn("file-selected",this._iframe.contentWindow),this.ref.iframeWrapper.innerHTML="",this._iframe=null,this.$.selectedList=[],this.$.counter=0}};or.template=b`<uc-activity-header><button type="button" class="uc-mini-btn" set="onclick: *historyBack"><uc-icon name="back"></uc-icon></button><div><uc-icon set="@name: activityIcon"></uc-icon><span>{{activityCaption}}</span></div><button type="button" class="uc-mini-btn uc-close-btn" set="onclick: *historyBack"><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ref="iframeWrapper" class="uc-iframe-wrapper"></div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" set="onclick: onCancel" l10n="cancel"></button><div></div><div set="@hidden: !multiple" class="uc-selected-counter"><span l10n="selected-count"></span>{{counter}}</div><button type="button" class="uc-done-btn uc-primary-btn" set="onclick: onDone; @disabled: !counter" l10n="done" ></button></div></div>`;var us=class extends S{constructor(){super(...arguments);u(this,"requireCtxName",!0)}_createValidationInput(){let t=document.createElement("input");return t.type="text",t.name=this.ctxName,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,Wt(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this._validationInputElement=this._createValidationInput(),this.appendChild(this._validationInputElement),this.sub("*collectionState",t=>{var e;{if(this._dynamicInputsContainer||(this._dynamicInputsContainer=document.createElement("div"),this.appendChild(this._dynamicInputsContainer)),!this._validationInputElement){let l=this._createValidationInput();this.appendChild(l),this._validationInputElement=l}if(this._dynamicInputsContainer.innerHTML="",t.status==="uploading"||t.status==="idle"){this._validationInputElement.value="",this._validationInputElement.setCustomValidity("");return}if(t.status==="failed"){let l=(e=t.errors[0])==null?void 0:e.message;this._validationInputElement.value="",this._validationInputElement.setCustomValidity(l);return}let s=t.group?t.group:null;if(s){this._validationInputElement.value=s.cdnUrl,this._validationInputElement.setCustomValidity("");return}let o=t.allEntries.map(l=>l.cdnUrl);if(!this.cfg.multiple&&o.length===1){this._validationInputElement.value=o[0],this._validationInputElement.setCustomValidity("");return}this._validationInputElement.remove(),this._validationInputElement=null;let n=new DocumentFragment;for(let l of o){let a=document.createElement("input");a.type="hidden",a.name=`${this.ctxName}[]`,a.value=l,n.appendChild(a)}this._dynamicInputsContainer.replaceChildren(n)}},!1)}};var hs=class extends v{};var nr=class extends w{constructor(){super(...arguments);u(this,"init$",{...this.init$,currentText:"",options:[],selectHtml:"",onSelect:t=>{var e;t.preventDefault(),t.stopPropagation(),this.value=this.ref.select.value,this.$.currentText=((e=this.$.options.find(s=>s.value==this.value))==null?void 0:e.text)||"",this.dispatchEvent(new Event("change"))}})}initCallback(){super.initCallback(),this.defineAccessor("options",t=>{var s;this.$.currentText=((s=t==null?void 0:t[0])==null?void 0:s.text)||"";let e="";t==null||t.forEach(o=>{e+=b`<option value="${o.value}">${o.text}</option>`}),this.$.selectHtml=e})}};nr.template=b`<select ref="select" set="innerHTML: selectHtml; onchange: onSelect"></select>`;var lr=class extends w{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i)})}};u(lr,"template",b`<a href="https://uploadcare.com/?utm_source=copyright&utm_medium=referral&utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`);var Qe=class Qe extends ft{constructor(){super(),this.init$={...this.init$,isHidden:!1}}initCallback(){super.initCallback(),this.defineAccessor("headless",i=>{this.set$({isHidden:L(i)})}),this.sub("*modalActive",i=>{this._lastModalActive!==i&&this.emit(i?I.MODAL_OPEN:I.MODAL_CLOSE,void 0,{debounce:!0}),this._lastModalActive=i},!1)}};u(Qe,"styleAttrs",[...q(Qe,Qe,"styleAttrs"),"uc-file-uploader-regular"]);var ti=Qe;ti.template=b`<uc-simple-btn set="@hidden: isHidden"></uc-simple-btn><uc-modal strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-secondary-btn" set="onclick: *historyBack"></button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-camera-source></uc-camera-source><uc-url-source></uc-url-source><uc-external-source></uc-external-source><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`;ti.bindAttributes({headless:null});var ei=class ei extends ft{initCallback(){super.initCallback();let i=this.ref.uBlock;this.sub("*currentActivity",t=>{t||(this.$["*currentActivity"]=i.initActivity||v.activities.START_FROM)}),this.sub("*uploadList",t=>{(t==null?void 0:t.length)>0?this.$["*currentActivity"]=v.activities.UPLOAD_LIST:this.$["*currentActivity"]=i.initActivity||v.activities.START_FROM}),this.subConfigValue("sourceList",t=>{t!=="local"&&(this.cfg.sourceList="local")}),this.subConfigValue("confirmUpload",t=>{t!==!1&&(this.cfg.confirmUpload=!1)})}};u(ei,"styleAttrs",[...q(ei,ei,"styleAttrs"),"uc-file-uploader-minimal"]);var ar=ei;ar.template=b`<uc-start-from><uc-drop-area tabindex="0" clickable l10n="choose-file"></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list ref="uBlock"></uc-upload-list>`;var ii=class ii extends ft{constructor(){super(),this.init$={...this.init$,couldCancel:!1,cancel:()=>{this.couldHistoryBack?this.$["*historyBack"]():this.couldShowList&&(this.$["*currentActivity"]=v.activities.UPLOAD_LIST)}}}get couldHistoryBack(){let i=this.$["*history"];return i.length>1&&i[i.length-1]!==v.activities.START_FROM}get couldShowList(){return this.cfg.showEmptyList||this.$["*uploadList"].length>0}initCallback(){super.initCallback();let i=this.ref.uBlock;this.sub("*currentActivity",t=>{t||(this.$["*currentActivity"]=i.initActivity||v.activities.START_FROM)}),this.sub("*uploadList",t=>{(t==null?void 0:t.length)>0&&this.$["*currentActivity"]===(i.initActivity||v.activities.START_FROM)&&(this.$["*currentActivity"]=v.activities.UPLOAD_LIST)}),this.sub("*history",()=>{this.$.couldCancel=this.couldHistoryBack||this.couldShowList})}};u(ii,"styleAttrs",[...q(ii,ii,"styleAttrs"),"uc-file-uploader-inline"]);var cr=ii;cr.template=b`<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list wrap></uc-source-list><button type="button" l10n="start-from-cancel" class="uc-cancel-btn uc-secondary-btn" set="onclick: cancel; @hidden: !couldCancel" ></button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list ref="uBlock"></uc-upload-list><uc-camera-source></uc-camera-source><uc-url-source></uc-url-source><uc-external-source></uc-external-source><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>`;var ri=class ri extends yt{initCallback(){var i;super.initCallback(),(i=this.a11y)==null||i.registerBlock(this)}};u(ri,"styleAttrs",[...q(ri,ri,"styleAttrs"),"uc-wgt-common"]);var ds=ri;var sc=["Symbiote","BaseComponent","UploaderBlock","ActivityBlock","Block","SolutionBlock"];function ps(r){for(let i in r){if(sc.includes(i))continue;let t=[...i].reduce((e,s)=>(s.toUpperCase()===s&&(s="-"+s.toLowerCase()),e+=s),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("uc-")||(t="uc-"+t),r[i].reg&&r[i].reg(t)}}var fs="UC";async function oc(r,i=!1){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[fs]){t(window[fs]);return}let s=document.createElement("script");s.async=!0,s.src=r,s.onerror=()=>{e()},s.onload=()=>{let o=window[fs];i&&ps(o),t(o)},document.head.appendChild(s)})}export{v as ActivityBlock,hs as ActivityHeader,xt as BaseComponent,w as Block,Je as BtnUi,Xi as CameraSource,ds as CloudImageEditor,cs as CloudImageEditorActivity,yt as CloudImageEditorBlock,da as Config,lr as Copyright,Zi as CropFrame,$ as Data,He as DropArea,We as EditorCropButtonControl,be as EditorFilterControl,Ji as EditorImageCropper,as as EditorImageFader,Ye as EditorOperationControl,Qi as EditorScroller,Yi as EditorSlider,tr as EditorToolbar,or as ExternalSource,Xe as FileItem,cr as FileUploaderInline,ar as FileUploaderMinimal,ti as FileUploaderRegular,us as FormInput,De as Icon,ts as Img,er as LineLoaderUi,Vi as Modal,he as PACKAGE_NAME,de as PACKAGE_VERSION,rr as PresenceToggle,qi as ProgressBar,Ki as ProgressBarCommon,$ as PubSub,nr as Select,ze as SimpleBtn,sr as SliderUi,ft as SolutionBlock,je as SourceBtn,rs as SourceList,Ni as StartFrom,xt as Symbiote,nt as UID,Ga as UploadCtxProvider,ji as UploadList,S as UploaderBlock,Gi as UrlSource,ps as defineComponents,so as defineLocale,b as html,oc as loadFileUploaderFrom,Re as toKebabCase};