@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 ir=Object.defineProperty;var rr=Object.getPrototypeOf;var sr=Reflect.get;var or=(r,i,e)=>i in r?ir(r,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[i]=e;var m=(r,i,e)=>(or(r,typeof i!="symbol"?i+"":i,e),e),wt=(r,i,e)=>{if(!i.has(r))throw TypeError("Cannot "+e)};var p=(r,i,e)=>(wt(r,i,"read from private field"),e?e.call(r):i.get(r)),v=(r,i,e)=>{if(i.has(r))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(r):i.set(r,e)},C=(r,i,e,t)=>(wt(r,i,"write to private field"),t?t.call(r,e):i.set(r,e),e);var E=(r,i,e)=>(wt(r,i,"access private method"),e),Ht=(r,i,e)=>sr(rr(r),e,i);var d={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 nr(r){let i=e=>{var t;for(let s in e)((t=e[s])==null?void 0:t.constructor)===Object&&(e[s]=i(e[s]));return{...e}};return i(r)}var _e,be,te,ie,ge,qe,Kt,k=class k{constructor(i){v(this,_e,void 0);v(this,be,void 0);v(this,te,void 0);i.constructor===Object?this.store=nr(i):(C(this,te,!0),this.store=i),this.callbackMap=Object.create(null)}read(i){var e,t;if(!p(this,te)&&!this.store.hasOwnProperty(i))return E(e=k,ie,ge).call(e,"read",i),null;if(typeof i=="string"&&i.startsWith(d.COMPUTED_PX)){let s=this.store[i];if((s==null?void 0:s.constructor)!==Function){E(t=k,ie,ge).call(t,"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 p(this,te)?this.store[i]!==void 0:this.store.hasOwnProperty(i)}add(i,e,t=!1){!t&&Object.keys(this.store).includes(i)||(this.store[i]=e,this.notify(i))}pub(i,e){var t,s;if(!p(this,te)&&!this.store.hasOwnProperty(i)){E(t=k,ie,ge).call(t,"publish",i);return}if(i!=null&&i.startsWith(d.COMPUTED_PX)&&e.constructor!==Function){E(s=k,ie,ge).call(s,"publish computed",i);return}!(this.store[i]===null||e===null)&&typeof this.store[i]!=typeof e&&console.warn(`Symbiote PubSub: type warning for "${i}" [${typeof this.store[i]} -> ${typeof e}]`),this.store[i]=e,this.notify(i)}get proxy(){if(!p(this,be)){let i=Object.create(null);C(this,be,new Proxy(i,{set:(e,t,s)=>(this.pub(t,s),!0),get:(e,t)=>{this.read(t)}}))}return p(this,be)}multiPub(i){for(let e in i)this.pub(e,i[e])}notify(i){var t;let e=i==null?void 0:i.startsWith(d.COMPUTED_PX);if(this.callbackMap[i]){let s=this.read(i);this.callbackMap[i].forEach(o=>{o(s)}),e&&(this.__computedMap[i]=s)}!e&&E(t=k,qe,Kt).call(t,this,i)}sub(i,e,t=!0){var s;return!p(this,te)&&!this.store.hasOwnProperty(i)?(E(s=k,ie,ge).call(s,"subscribe",i),null):(this.callbackMap[i]||(this.callbackMap[i]=new Set),this.callbackMap[i].add(e),t&&e(this.read(i)),{remove:()=>{this.callbackMap[i].delete(e),this.callbackMap[i].size||delete this.callbackMap[i]},callback:e})}set uid(i){!p(this,_e)&&C(this,_e,i)}get uid(){return p(this,_e)}static registerCtx(i,e=Symbol()){let t=k.globalStore.get(e);return t?console.warn('PubSub: context UID "'+e+'" is already in use'):(t=new k(i),t.uid=e,k.globalStore.set(e,t)),t}static deleteCtx(i){k.globalStore.delete(i)}static getCtx(i,e=!0){return k.globalStore.get(i)||(e&&console.warn('PubSub: wrong context UID - "'+i+'"'),null)}};_e=new WeakMap,be=new WeakMap,te=new WeakMap,ie=new WeakSet,ge=function(i,e){console.warn(`Symbiote PubSub: cannot ${i}. Prop name: `+e)},qe=new WeakSet,Kt=function(i,e){this.globalStore.forEach(t=>{t.__computedMap&&Object.keys(t.__computedMap).forEach(s=>{if(t===i&&e===s)return;let o=`__${s}_timeout`;t[o]&&window.clearTimeout(t[o]),t[o]=window.setTimeout(()=>{let n=t.read(s);n!==t.__computedMap[s]&&(t.__computedMap[s]=n,t.notify(s))})})})},v(k,ie),v(k,qe);var j=k;j.globalStore=new Map;var W=j;var Gt="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",lr=Gt.length-1,ye=class{static generate(i="XXXXXXXXX-XXX"){let e="";for(let t=0;t<i.length;t++)e+=i[t]==="-"?i[t]:Gt.charAt(Math.random()*lr);return e}};function Oe(r,i,e){let t=!0,s,o=i.split(".");return o.forEach((n,l)=>{l<o.length-1?r=r[n]:s=n}),r?r[s]=e:t=!1,t}function vt(r){let i;return r.constructor===CSSStyleSheet?i=r:r.constructor===String&&(i=new CSSStyleSheet,i.replaceSync(r)),i}function Wt(r,i){[...r.querySelectorAll(`[${d.LIST_ATTR}]`)].filter(e=>!e.matches(`[${d.LIST_ATTR}] [${d.LIST_ATTR}]`)).forEach(e=>{var n;let t=e.getAttribute(d.LIST_ITEM_TAG_ATTR),s;for(t&&(s=window.customElements.get(t)),s||(s=class extends i.Symbiote{constructor(){super(),t||(this.style.display="contents")}},s.template=((n=e.querySelector("template"))==null?void 0:n.innerHTML)||e.innerHTML,s.reg(t));e.firstChild;)e.firstChild.remove();let o=e.getAttribute(d.LIST_ATTR);i.sub(o,l=>{if(!l){for(;e.firstChild;)e.firstChild.remove();return}let a=[...e.children],c,u=h=>{h.forEach((g,b)=>{if(a[b])if(a[b].set$)a[b].set$(g);else for(let x in g)a[b][x]=g[x];else{c||(c=new DocumentFragment);let x=new s;Object.assign((x==null?void 0:x.init$)||x,g),c.appendChild(x)}}),c&&e.appendChild(c);let f=a.slice(h.length,a.length);for(let g of f)g.remove()};if(l.constructor===Array)u(l);else if(l.constructor===Object){let h=[];for(let f in l){let g=l[f];Object.defineProperty(g,"_KEY_",{value:f,enumerable:!0}),h.push(g)}u(h)}else console.warn("Symbiote list data type error:"),console.log(l)}),e.removeAttribute(d.LIST_ATTR),e.removeAttribute(d.LIST_ITEM_TAG_ATTR)})}function ar(r,i){[...r.querySelectorAll(`[${d.EL_REF_ATTR}]`)].forEach(e=>{let t=e.getAttribute(d.EL_REF_ATTR);i.ref[t]=e,e.removeAttribute(d.EL_REF_ATTR)})}function cr(r,i){[...r.querySelectorAll(`[${d.BIND_ATTR}]`)].forEach(e=>{e.getAttribute(d.BIND_ATTR).split(";").forEach(o=>{if(!o)return;let n=o.split(":").map(u=>u.trim()),l=n[0],a;l.indexOf(d.ATTR_BIND_PX)===0&&(a=!0,l=l.replace(d.ATTR_BIND_PX,""));let c=n[1].split(",").map(u=>u.trim());for(let u of c){let h;u.startsWith("!!")?(h="double",u=u.replace("!!","")):u.startsWith("!")&&(h="single",u=u.replace("!","")),!i.has(u)&&i.allowTemplateInits&&(u.startsWith(d.ATTR_BIND_PX)?i.add(u,i.getAttribute(u.replace(d.ATTR_BIND_PX,""))):i.add(u,null)),i.sub(u,f=>{h==="double"?f=!!f:h==="single"&&(f=!f),a?(f==null?void 0:f.constructor)===Boolean?f?e.setAttribute(l,""):e.removeAttribute(l):e.setAttribute(l,f):Oe(e,l,f)||(e[d.SET_LATER_KEY]||(e[d.SET_LATER_KEY]=Object.create(null)),e[d.SET_LATER_KEY][l]=f)},!(i.ssrMode&&(l==="textContent"||a)))}}),e.removeAttribute(d.BIND_ATTR)})}function hr(r){let i,e=[],t=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,{acceptNode:s=>{var o;return!((o=s.parentElement)!=null&&o.hasAttribute(d.TEXT_NODE_SKIP_ATTR))&&s.textContent.includes(d.TEXT_NODE_OPEN_TOKEN)&&s.textContent.includes(d.TEXT_NODE_CLOSE_TOKEN)&&1}});for(;i=t.nextNode();)e.push(i);return e}var ur=function(r,i){hr(r).forEach(t=>{let s=[],o;for(;t.textContent.includes(d.TEXT_NODE_CLOSE_TOKEN);)t.textContent.startsWith(d.TEXT_NODE_OPEN_TOKEN)?(o=t.textContent.indexOf(d.TEXT_NODE_CLOSE_TOKEN)+d.TEXT_NODE_CLOSE_TOKEN.length,t.splitText(o),s.push(t)):(o=t.textContent.indexOf(d.TEXT_NODE_OPEN_TOKEN),t.splitText(o)),t=t.nextSibling;s.forEach(n=>{let l=n.textContent.replace(d.TEXT_NODE_OPEN_TOKEN,"").replace(d.TEXT_NODE_CLOSE_TOKEN,"");n.textContent="",!i.has(l)&&i.allowTemplateInits&&(l.startsWith(d.ATTR_BIND_PX)?(i.add(l,i.getAttribute(l.replace(d.ATTR_BIND_PX,""))),i.initAttributeObserver()):i.add(l,null)),i.sub(l,a=>{n.textContent=a})})})},qt=[Wt,ar,cr,ur];var Ye="'",we='"',dr=/\\([0-9a-fA-F]{1,6} ?)/g;function fr(r){return(r[0]===we||r[0]===Ye)&&(r[r.length-1]===we||r[r.length-1]===Ye)}function pr(r){return(r[0]===we||r[0]===Ye)&&(r=r.slice(1)),(r[r.length-1]===we||r[r.length-1]===Ye)&&(r=r.slice(0,-1)),r}function mr(r){let i="",e="";for(var t=0;t<r.length;t++){let s=r[t+1];r[t]==="\\"&&s==='"'?(i+='\\"',t++):r[t]==='"'&&e!=="\\"?i+='\\"':i+=r[t],e=r[t]}return i}function Yt(r){let i=r;fr(r)&&(i=pr(i),i=i.replace(dr,(e,t)=>String.fromCodePoint(parseInt(t.trim(),16))),i=i.replaceAll(`\\
28
- `,"\\n"),i=mr(i),i=we+i+we);try{return JSON.parse(i)}catch{throw new Error(`Failed to parse CSS property value: ${i}. Original input: ${r}`)}}var gr=[d.LIST_ATTR,d.LIST_ITEM_TAG_ATTR,d.EL_REF_ATTR,d.USE_TPL_ATTR,d.CTX_NAME_ATTR,d.CTX_OWNER_ATTR];function w(r,...i){let e="";return r.forEach((t,s)=>{var o;if(e+=t,((o=i[s])==null?void 0:o.constructor)===Object){let n="";for(let l in i[s])gr.includes(l)?e+=` ${l}="${i[s][l]}"`:n+=`${l}:${i[s][l]};`;n&&(e+=` ${d.BIND_ATTR}="${n}"`)}else i[s]&&(e+=i[s])}),e}function F(r,...i){let e="",t=new CSSStyleSheet;return r.forEach((s,o)=>{e+=s+i[o]}),F.processors.forEach(s=>{e=s(e)}),F.clearProcessors(),t.replaceSync(e),t}F.processors=[];F.clearProcessors=function(){F.processors=[]};F.useProcessor=function(...r){return F.processors=[...F.processors,...r],F};var Zt=0,ke,he,Ie,re,ve,Le,se,B,ue,de,S,Pe,xt,q,ce,Ze,Qt,Qe,Jt,Me,Et,Je,ei,Ne,Ct,D=class D extends HTMLElement{constructor(){super();v(this,Pe);v(this,Ze);v(this,Qe);v(this,Me);v(this,Je);v(this,Ne);v(this,ke,void 0);v(this,he,void 0);v(this,Ie,void 0);v(this,re,void 0);v(this,ve,void 0);v(this,Le,void 0);v(this,se,void 0);v(this,B,void 0);v(this,ue,void 0);v(this,de,void 0);v(this,S,this.constructor);m(this,"updateCssData",()=>{var e;this.dropCssDataCache(),(e=p(this,de))==null||e.forEach(t=>{let s=this.getCssData(E(this,Ne,Ct).call(this,t),!0);s!==null&&this.$[t]!==s&&(this.$[t]=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 D}initCallback(){}renderCallback(){}render(e,t=this.renderShadow){let s;if((t||p(this,S).shadowStyleSheets)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let n=this.getAttribute(d.USE_TPL_ATTR);if(n){let l=this.getRootNode(),a=(l==null?void 0:l.querySelector(n))||document.querySelector(n);a?e=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(e||p(this,S).template){if(p(this,S).template&&!p(this,S).__tpl&&(p(this,S).__tpl=document.createElement("template"),p(this,S).__tpl.innerHTML=p(this,S).template),(e==null?void 0:e.constructor)===DocumentFragment)s=e;else if((e==null?void 0:e.constructor)===String){let n=document.createElement("template");n.innerHTML=e,s=n.content.cloneNode(!0)}else p(this,S).__tpl&&(s=p(this,S).__tpl.content.cloneNode(!0));for(let n of this.tplProcessors)n(s,this)}let o=()=>{var n;s&&this.isVirtual?this.replaceWith(s):s&&(t&&this.shadowRoot.appendChild(s)||this.appendChild(s)),E(this,Pe,xt).call(this),(n=this.renderCallback)==null||n.call(this)};p(this,S).shadowStyleSheets&&(t=!0,this.shadowRoot.adoptedStyleSheets=[...p(this,S).shadowStyleSheets]),o()}addTemplateProcessor(e){this.tplProcessors.add(e)}get autoCtxName(){return p(this,he)||(C(this,he,ye.generate()),this.style.setProperty(d.CSS_CTX_PROP,`'${p(this,he)}'`)),p(this,he)}get cssCtxName(){return this.getCssData(d.CSS_CTX_PROP,!0)}get ctxName(){var t;let e=((t=this.getAttribute(d.CTX_NAME_ATTR))==null?void 0:t.trim())||this.cssCtxName||p(this,Ie)||this.autoCtxName;return C(this,Ie,e),e}get localCtx(){return p(this,re)||C(this,re,W.registerCtx({})),p(this,re)}get sharedCtx(){return W.getCtx(this.ctxName,!1)||W.registerCtx({},this.ctxName)}sub(e,t,s=!0){var l;let o=a=>{p(this,Me,Et)||t(a)},n=E(l=D,q,ce).call(l,e,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(e){var s;let t=E(s=D,q,ce).call(s,e,this);t.ctx.notify(t.name)}has(e){var s;let t=E(s=D,q,ce).call(s,e,this);return t.ctx.has(t.name)}add(e,t,s=!1){var n;let o=E(n=D,q,ce).call(n,e,this);o.ctx.add(o.name,t,s)}add$(e,t=!1){for(let s in e)this.add(s,e[s],t)}get $(){if(!p(this,ve)){let e=Object.create(null);C(this,ve,new Proxy(e,{set:(t,s,o)=>{var l;let n=E(l=D,q,ce).call(l,s,this);return n.ctx.pub(n.name,o),!0},get:(t,s)=>{var n;let o=E(n=D,q,ce).call(n,s,this);return o.ctx.read(o.name)}}))}return p(this,ve)}set$(e,t=!1){for(let s in e){let o=e[s];t||![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(e=>{for(let t of e)if(t.type==="attributes"){let s=d.ATTR_BIND_PX+t.attributeName;this.has(s)&&(this.$[s]=this.getAttribute(t.attributeName))}}),this.attributeMutationObserver.observe(this,{attributes:!0}))}connectedCallback(){E(this,Je,ei).call(this)}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(p(this,se)&&window.clearTimeout(p(this,se)),C(this,se,window.setTimeout(()=>{this.destroyCallback(),this.attributeMutationObserver&&this.attributeMutationObserver.disconnect();for(let e of this.allSubs)e.remove(),this.allSubs.delete(e);p(this,re)&&W.deleteCtx(p(this,re).uid);for(let e of this.tplProcessors)this.tplProcessors.delete(e)},100))))}static reg(e,t=!1){e||(Zt++,e=`${d.AUTO_TAG_PX}-${Zt}`),this.__tag=e;let s=window.customElements.get(e);if(s){!t&&s!==this&&console.warn([`Element with tag name "${e}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(`
29
- `));return}window.customElements.define(e,t?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(e){this.observedAttributes=[...new Set((this.observedAttributes||[]).concat(Object.keys(e)))],this.__attrDesc=e}attributeChangedCallback(e,t,s){var n;if(t===s)return;let o=(n=p(this,S).__attrDesc)==null?void 0:n[e];o?p(this,Le)?this.$[o]=s:this.init$[o]=s:this[e]=s}getCssData(e,t=!1){if(p(this,B)||C(this,B,Object.create(null)),!Object.keys(p(this,B)).includes(e)){p(this,ue)||C(this,ue,window.getComputedStyle(this));let s=p(this,ue).getPropertyValue(e).trim();try{p(this,B)[e]=Yt(s)}catch{!t&&console.warn(`CSS Data error: ${e}`),p(this,B)[e]=null}}return p(this,B)[e]}bindCssData(e,t=""){p(this,de)||C(this,de,new Set),p(this,de).add(e);let s=this.getCssData(E(this,Ne,Ct).call(this,e),!0);s===null&&(s=t),e.startsWith(d.CSS_DATA_PX)?this.localCtx.add(e,s):this.add(e,s)}dropCssDataCache(){C(this,B,null),C(this,ue,null)}defineAccessor(e,t,s){let o="#"+e;this[o]=this[e],Object.defineProperty(this,e,{set:n=>{this[o]=n,s?window.setTimeout(()=>{t==null||t(n)}):t==null||t(n)},get:()=>this[o]}),this[e]=this[o]}static addRootStyles(e){this.rootStyleSheets||(this.rootStyleSheets=[]),this.rootStyleSheets.push(vt(e))}static addShadowStyles(e){this.shadowStyleSheets||(this.shadowStyleSheets=[]),this.shadowStyleSheets.push(vt(e))}static set rootStyles(e){this.rootStyleSheets=[],this.addRootStyles(e)}static set shadowStyles(e){this.shadowStyleSheets=[],this.addShadowStyles(e)}};ke=new WeakMap,he=new WeakMap,Ie=new WeakMap,re=new WeakMap,ve=new WeakMap,Le=new WeakMap,se=new WeakMap,B=new WeakMap,ue=new WeakMap,de=new WeakMap,S=new WeakMap,Pe=new WeakSet,xt=function(){var e;p(this,ke)||(C(this,ke,!0),(e=this.initCallback)==null||e.call(this))},q=new WeakSet,ce=function(e,t){var n;let s,o;if(e.startsWith(d.SHARED_CTX_PX))s=t.sharedCtx,o=e.replace(d.SHARED_CTX_PX,"");else if(e.startsWith(d.PARENT_CTX_PX)){o=e.replace(d.PARENT_CTX_PX,"");let l=t;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)||t.localCtx}else if(e.includes(d.NAMED_CTX_SPLTR)){let l=e.split(d.NAMED_CTX_SPLTR);s=W.getCtx(l[0]),o=l[1]}else e.startsWith(d.CSS_DATA_PX)?(s=t.localCtx,o=e,s.has(o)||t.bindCssData(o)):(s=t.localCtx,o=e);return{ctx:s,name:o}},Ze=new WeakSet,Qt=function(){return this.ctxOwner||this.hasAttribute(d.CTX_OWNER_ATTR)&&this.getAttribute(d.CTX_OWNER_ATTR)!=="false"},Qe=new WeakSet,Jt=function(){let e=p(this,S).__attrDesc;if(e)for(let t of Object.values(e))Object.keys(this.init$).includes(t)||(this.init$[t]="");for(let t in this.init$)if(t.startsWith(d.SHARED_CTX_PX))this.sharedCtx.add(t.replace(d.SHARED_CTX_PX,""),this.init$[t],p(this,Ze,Qt));else if(t.startsWith(d.ATTR_BIND_PX))this.localCtx.add(t,this.getAttribute(t.replace(d.ATTR_BIND_PX,""))||this.init$[t]),this.initAttributeObserver();else if(t.includes(d.NAMED_CTX_SPLTR)){let s=t.split(d.NAMED_CTX_SPLTR),o=s[0].trim(),n=s[1].trim();if(o&&n){let l=W.getCtx(o,!1);l||(l=W.registerCtx({},o)),l.add(n,this.init$[t])}}else this.localCtx.add(t,this.init$[t]);for(let t in this.cssInit$)this.bindCssData(t,this.cssInit$[t]);C(this,Le,!0)},Me=new WeakSet,Et=function(){return!this.isVirtual&&!this.isConnected},Je=new WeakSet,ei=function(){var e;if(!p(this,Me,Et)){if(p(this,se)&&window.clearTimeout(p(this,se)),!this.connectedOnce){let t=(e=this.getAttribute(d.CTX_NAME_ATTR))==null?void 0:e.trim();if(t&&this.style.setProperty(d.CSS_CTX_PROP,`'${t}'`),E(this,Qe,Jt).call(this),this[d.SET_LATER_KEY]){for(let s in this[d.SET_LATER_KEY])Oe(this,s,this[d.SET_LATER_KEY][s]);delete this[d.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let s of qt)this.addTemplateProcessor(s);if(this.pauseRender)E(this,Pe,xt).call(this);else{if(p(this,S).rootStyleSheets){let s=this.getRootNode();if(!s)return;let o=new Set([...s.adoptedStyleSheets,...p(this,S).rootStyleSheets]);s.adoptedStyleSheets=[...o]}this.render()}}this.connectedOnce=!0}},Ne=new WeakSet,Ct=function(e){return e.split("--").map((t,s)=>s===0?"":t).join("--")},v(D,q),m(D,"__tpl"),m(D,"template");var Tt=D,Re=Tt;function St(r){Object.assign(d,r)}function At(r,i){if(i.shadowRoot)return;let e=[...r.querySelectorAll("slot")];if(!e.length)return;let t={};e.forEach(s=>{let o=s.getAttribute("name")||d.DEFAULT_SLOT_KEY;t[o]={slot:s,fr:document.createDocumentFragment()}}),i.initChildren.forEach(s=>{var n;let o=d.DEFAULT_SLOT_KEY;s instanceof Element&&s.hasAttribute("slot")&&(o=s.getAttribute("slot"),s.removeAttribute("slot")),(n=t[o])==null||n.fr.appendChild(s)}),Object.values(t).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()})}St({BIND_ATTR:"set",CTX_NAME_ATTR:"ctx-name",CSS_CTX_PROP:"--ctx-name"});var ti=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},et=(...r)=>r.filter(i=>typeof i=="string"&&i).map(i=>ti(i)).join("/-/"),Y=(...r)=>{let i=et(...r);return i?`-/${i}/`:""};function tt(r){let i=new URL(r),e=i.pathname+i.search+i.hash,t=e.lastIndexOf("http"),s=e.lastIndexOf("/"),o="";return t>=0?o=e.slice(t):s>=0&&(o=e.slice(s+1)),o}function it(r){let i=new URL(r),{pathname:e}=i,t=e.indexOf("/"),s=e.indexOf("/",t+1);return e.substring(t+1,s)}function $t(r){let i=ri(r),e=new URL(i),t=e.pathname.indexOf("/-/");return t===-1?"":e.pathname.substring(t).slice(1)}function ii(r){return $t(r).split("/-/").filter(Boolean).map(e=>ti(e))}function ri(r){let i=new URL(r),e=tt(r),t=si(e)?oi(e).pathname:e;return i.pathname=i.pathname.replace(t,""),i.search="",i.hash="",i.toString()}function si(r){return r.startsWith("http")}function oi(r){let i=new URL(r);return{pathname:i.origin+i.pathname||"",search:i.search||"",hash:i.hash||""}}var Z=(r,i,e)=>{let t=new URL(ri(r));if(e=e||tt(r),t.pathname.startsWith("//")&&(t.pathname=t.pathname.replace("//","/")),si(e)){let s=oi(e);t.pathname=t.pathname+(i||"")+(s.pathname||""),t.search=s.search,t.hash=s.hash}else t.pathname=t.pathname+(i||"")+(e||"");return t.toString()},Ot=(r,i)=>{let e=new URL(r);return e.pathname=i+"/",e.toString()};var kt=(r,i=",")=>r.trim().split(i).map(e=>e.trim()).filter(e=>e.length>0);var N=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}),li=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function yr(r,i){if(typeof i=="number"){let e=i;return N[r]!==e?`${r}/${e}`:""}if(typeof i=="boolean"){let e=i;return N[r]!==e?`${r}`:""}if(r==="filter"&&i){let{name:e,amount:t}=i;return N.filter===t?"":`${r}/${e}/${t}`}if(r==="crop"&&i){let{dimensions:e,coords:t}=i;return`${r}/${e.join("x")}/${t.join(",")}`}return""}function oe(r){return et(...li.filter(i=>typeof r[i]!="undefined"&&r[i]!==null).map(i=>{let e=r[i];return yr(i,e)}).filter(i=>!!i))}var rt=et("format/auto","progressive/yes"),Q=([r])=>typeof r!="undefined"?Number(r):void 0,ni=()=>!0,wr=([r,i])=>({name:r,amount:typeof i!="undefined"?Number(i):100}),vr=([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:kt(r,"x").map(Number),coords:kt(i).map(Number)}},Tr=Object.freeze({enhance:Q,brightness:Q,exposure:Q,gamma:Q,contrast:Q,saturation:Q,vibrance:Q,warmth:Q,filter:wr,mirror:ni,flip:ni,rotate:Q,crop:vr});function ai(r){let i={};for(let e of r){let[t,...s]=e.split("/");if(!li.includes(t))continue;let o=t,n=Tr[o];try{let l=n(s);i[o]=l}catch(l){console.warn([`Failed to parse URL operation "${e}". 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 T=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),L=[T.CROP,T.TUNING,T.FILTERS],ci=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],hi=["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"],ui=["rotate","mirror","flip"],V=Object.freeze({brightness:{zero:N.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:N.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:N.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:N.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:N.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:N.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:N.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:N.enhance,range:[0,100],keypointsNumber:1},filter:{zero:N.filter,range:[0,100],keypointsNumber:1}});var di=r=>r?r.split(",").map(i=>i.trim()):[],st=r=>r?r.join(","):"";var xr="https://ucarecdn.com",Er="https://upload.uploadcare.com",Cr="https://social.uploadcare.com",z={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:st(L),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",imageShrink:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:xr,baseUrl:Er,socialBaseUrl:Cr,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 Oo=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"}),ot=class{constructor(i){m(this,"_timeoutStore",new Map);m(this,"_targets",new Set);m(this,"_debugPrint",null);this._debugPrint=i}bindTarget(i){this._targets.add(i)}unbindTarget(i){this._targets.delete(i)}_dispatch(i,e){var t;for(let s of this._targets)s.dispatchEvent(new CustomEvent(i,{detail:e}));(t=this._debugPrint)==null||t.call(this,()=>{let s=e&&typeof e=="object"?{...e}:e;return[`event "${i}"`,s]})}emit(i,e,{debounce:t}={}){if(typeof t!="number"&&!t){this._dispatch(i,typeof e=="function"?e():e);return}this._timeoutStore.has(i)&&window.clearTimeout(this._timeoutStore.get(i));let s=typeof t=="number"?t:20,o=window.setTimeout(()=>{this._dispatch(i,typeof e=="function"?e():e),this._timeoutStore.delete(i)},s);this._timeoutStore.set(i,o)}};function R(r,i){let e,t=(...s)=>{clearTimeout(e),e=setTimeout(()=>r(...s),i)};return t.cancel=()=>{clearTimeout(e)},t}var fi="--uploadcare-blocks-window-height",fe=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(fi)}};m(fe,"clientsRegistry",new Set),m(fe,"flush",R(()=>{document.documentElement.style.setProperty(fi,`${window.innerHeight}px`)},100));var pi=r=>{var t;let i=new Intl.Locale(r),e="ltr";return typeof i.getTextInfo=="function"&&i.getTextInfo().direction?e=i.getTextInfo().direction:"textInfo"in i&&((t=i.textInfo)!=null&&t.direction)&&(e=i.textInfo.direction),e};var mi=(r,i)=>new Intl.PluralRules(r).select(i);var Sr=r=>r,It="{{",_i="}}",gi="plural:";function Lt(r,i,e={}){var n;let{openToken:t=It,closeToken:s=_i,transform:o=Sr}=e;for(let l in i){let a=(n=i[l])==null?void 0:n.toString();r=r.replaceAll(t+l+s,typeof a=="string"?o(a):a)}return r}function bi(r){let i=[],e=r.indexOf(It);for(;e!==-1;){let t=r.indexOf(_i,e),s=r.substring(e+2,t);if(s.startsWith(gi)){let o=r.substring(e+2,t).replace(gi,""),n=o.substring(0,o.indexOf("(")),l=o.substring(o.indexOf("(")+1,o.indexOf(")"));i.push({variable:s,pluralKey:n,countVariable:l})}e=r.indexOf(It,t)}return i}function yi(){let r,i,e=new Promise((t,s)=>{r=t,i=s});return{resolve:r,reject:i,promise:e}}var wi=async({element:r,attribute:i,timeout:e=300})=>{let{promise:t,resolve:s}=yi(),o=r.getAttribute(i);if(o!==null)return s({success:!0,value:o,attribute:i}),t;let n=new MutationObserver(c=>{let u=c[c.length-1];a(u)});n.observe(r,{attributes:!0,attributeFilter:[i]});let l=setTimeout(()=>{n.disconnect(),s({success:!1,attribute:i})},e),a=c=>{let u=r.getAttribute(i);c.type==="attributes"&&c.attributeName===i&&u!==null&&(clearTimeout(l),n.disconnect(),s({success:!0,value:u,attribute:i}))};return t};var vi=()=>({});var De={"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 nt=new Map,Pt=new Map,Ti=(r,i)=>{nt.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`),nt.set(r,{...De,...i})},Ar=(r,i)=>{Pt.set(r,i)},$r=(r,i)=>{typeof i=="function"?Ar(r,i):Ti(r,i)},xi=async r=>{if(!nt.has(r)){if(!Pt.has(r))throw new Error(`Locale ${r} is not defined`);let e=await Pt.get(r)();Ti(r,e)}return nt.get(r)};$r("en",De);var J=r=>`*l10n/${r}`,Or="en",lt=class{constructor(i){m(this,"_blockInstance",null);m(this,"_localeName","");m(this,"_callbacks",new Set);m(this,"_boundBlocks",new Map);this._blockInstance=i;for(let[e,t]of Object.entries(De))this._blockInstance.add(J(e),t,!1);setTimeout(()=>{i.subConfigValue("localeName",async e=>{var o;if(!this._blockInstance||!e)return;this._localeName=e;let t=await xi(e);if(e!==Or&&this._localeName!==e)return;let s=(o=this._blockInstance.cfg.localeDefinitionOverride)==null?void 0:o[e];for(let[n,l]of Object.entries(t)){let a=s==null?void 0:s[n];this._blockInstance.add(J(n),a!=null?a:l,!0);for(let c of this._callbacks)c()}}),i.subConfigValue("localeDefinitionOverride",e=>{var s;if(!e)return;let t=e[this._localeName];if(t)for(let[o,n]of Object.entries(t)){(s=this._blockInstance)==null||s.add(J(o),n,!0);for(let l of this._callbacks)l()}})})}onLocaleChange(i){let e=R(i,0);return this._callbacks.add(e),()=>{this._callbacks.delete(e)}}bindL10n(i,e,t){var o,n,l;i.$[e]=t(),this._boundBlocks.has(i)||this._boundBlocks.set(i,new Map),(n=(o=this._boundBlocks.get(i))==null?void 0:o.get(e))==null||n();let s=this.onLocaleChange(()=>{i.$[e]=t()});(l=this._boundBlocks.get(i))==null||l.set(e,s)}destroyL10nBindings(i){let e=this._boundBlocks.get(i);if(e){for(let t of e.values())t();this._boundBlocks.delete(i)}}destroy(){this._callbacks.clear()}};var kr={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function Ue(r,i){i.tabIndex=0,i.focus(),r.tabIndex=-1}function Mt(r){let i=r.role||r.type||r.tagName;if(!i)return null;let e=kr[i.toLowerCase()];if(!e)return null;for(let t of e){let s=r.closest(`[role=${t}]`);if(s)return s}}function Nt(r,i){return i.role==="toolbar"?Ir(i):i.querySelectorAll(`[role=${r.role}]`)}function Ir(r){return[...r.querySelectorAll("*")].filter(e=>e.role==="button"||e.type==="button"||e.role==="checkbox"||e.type==="checkbox")}function Lr(r){let i=r.getAttribute("aria-orientation");if(i==="vertical")return!1;if(i==="horizontal")return!0;let e=r.role;return e==="menubar"||e==="tablist"||e==="toolbar"}function Ei(r){return i=>{let e=!1,t=(r==null?void 0:r.searchDelayMs)||300,s=0,o="";function n(h){let f=Mt(h.target);if(!f){l();return}let g=Nt(h.target,f),b=Array.from(g).indexOf(h.target),x="ArrowDown",I="ArrowUp";if(Lr(f)&&(i.document.dir==="rtl"?(x="ArrowLeft",I="ArrowRight"):(x="ArrowRight",I="ArrowLeft")),h.key===x)h.preventDefault(),Ue(h.target,g[b+1]||g[0]);else if(h.key===I)h.preventDefault(),Ue(h.target,g[b-1]||g[g.length-1]);else if(h.key==="Home")h.preventDefault(),Ue(h.target,g[0]);else if(h.key==="End")h.preventDefault(),Ue(h.target,g[g.length-1]);else if(h.key.length===1&&f.role!=="tablist"){let M=Date.now();M-s<=t?o+=h.key.toLowerCase():o=h.key.toLowerCase(),s=M;let ae=Array.from(g).find(tr=>{var jt,Bt,Vt;return(Vt=(Bt=(jt=tr.textContent)==null?void 0:jt.trim())==null?void 0:Bt.toLowerCase())==null?void 0:Vt.startsWith(o)});ae&&(h.preventDefault(),Ue(h.target,ae))}}function l(){e=!1,i.removeEventListener("keydown",n)}function a(h){let f=Mt(h.target);if(f){e||(e=!0,i.addEventListener("keydown",n));let g=Nt(h.target,f);for(let b of g)b!==h.target&&b.setAttribute("tabindex",-1)}else e&&l()}function c(h){(!h.relatedTarget||h.relatedTarget===i.document)&&l()}function u(h){let f=Mt(h.target);if(f){let g=Nt(h.target,f);for(let b of g)b!==h.target&&b.setAttribute("tabindex",-1);h.target.setAttribute("tabindex",0)}}return i.addEventListener("click",u),i.addEventListener("focusin",a),i.addEventListener("focusout",c),()=>{l(),i.removeEventListener("click",u),i.removeEventListener("focusin",a),i.removeEventListener("focusout",c)}}}function Ci(){return r=>{let i,e;function t(o){if(o.target.getAttribute("aria-hidden")==="true"){i=o.target,i.setAttribute("aria-hidden","false"),e=i.hidden,e&&(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"),e&&(i.hidden=!0),i=null)}return r.addEventListener("keyuxJump",t),r.addEventListener("focusout",s),()=>{r.removeEventListener("keyuxJump",t),r.removeEventListener("focusout",s)}}}function Si(){return r=>{let i=[];function e(c){let u=r.document.activeElement;u&&u!==r.document.body&&i.push(new WeakRef(u)),c.focus({focusVisible:!0})}function t(){let c=i.pop();if(!c){r.document.activeElement.blur();return}let u=c.deref();u&&u.isConnected?u.focus():t()}let s=0,o;function n(c){clearInterval(o);let u=c.getAttribute("aria-controls");u&&(o=setInterval(()=>{if(s++>50){clearInterval(o);return}let h=r.document.getElementById(u);if(h){let f=h.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');f&&(clearInterval(o),h.dispatchEvent(new r.CustomEvent("keyuxJump",{bubbles:!0})),e(f))}},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"&&t()}return r.addEventListener("click",l),r.addEventListener("keydown",a),()=>{r.removeEventListener("click",l),r.removeEventListener("keydown",a)}}}function Ai(r){let i,e=r.split(" ");function t(){i&&i.classList.remove(...e)}function s(o){o.clientX===0&&o.clientY===0&&(t(),o.target.classList.add(...e),i=o.target)}return o=>(o.addEventListener("keyup",t),o.addEventListener("click",s),()=>{o.removeEventListener("keyup",t),o.removeEventListener("click",s)})}function $i(r,i){let e=i.map(t=>t(r));return()=>{e.forEach(t=>t())}}var Rt=class{constructor(){m(this,"_listeners",new Map);m(this,"_scope",[])}addEventListener(i,e){let t=s=>{let o=s.target;o&&this._scope.some(n=>n===s.target||n.contains(o))&&e(s)};this._listeners.set(e,t),window.addEventListener(i,t)}removeEventListener(i,e){let t=this._listeners.get(e);t&&window.removeEventListener(i,t),this._listeners.delete(e)}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,e)=>{window.removeEventListener("keydown",i),window.removeEventListener("keyup",i),this._listeners.delete(e)})}},at=class{constructor(){m(this,"_destroyKeyUX");m(this,"_scopedWindow");this._scopedWindow=new Rt,this._destroyKeyUX=$i(this._scopedWindow,[Ei(),Ai("is-pressed"),Si(),Ci()])}registerBlock(i){this._scopedWindow.registerScope(i)}destroy(){var i;(i=this._destroyKeyUX)==null||i.call(this),this._scopedWindow.destroy()}};function Oi(r,i){[...r.querySelectorAll("[l10n]")].forEach(e=>{let t=e.getAttribute("l10n");if(!t)return;let s="textContent",o=!1;if(t.includes(":")){let a=t.split(":");s=a[0],t=a[1],s.startsWith("@")&&(s=s.slice(1),o=!0)}let n=t;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(f=>{f.remove(),c.delete(f),i.allSubs.delete(f)});let u=J(a).replace("*","");i.sharedCtx.has(u)||i.sharedCtx.add(u,a);let h=i.sharedCtx.sub(u,()=>{e[s]=i.l10n(a)});c==null||c.add(h),i.allSubs.add(h),e.removeAttribute("l10n")});let l=J(t);i.has(l)||i.add(l,""),i.sub(l,()=>{t=t,o?e.setAttribute(s,i.l10n(t)):e[s]=i.l10n(t)}),e.removeAttribute("l10n")})}var P=r=>`*cfg/${r}`;var Pr="uc-",y=class extends Re{constructor(){super();m(this,"requireCtxName",!1);m(this,"activityType",null);m(this,"init$",vi());this.l10nProcessorSubs=new Map,this.addTemplateProcessor(Oi),this.addTemplateProcessor(At)}l10n(e,t={}){if(!e)return"";let s=this.$[J(e)]||e,o=bi(s);for(let l of o)t[l.variable]=this.pluralize(l.pluralKey,Number(t[l.countVariable]));return Lt(s,t)}pluralize(e,t){let s=this.l10n("locale-id")||"en",o=mi(s,t);return this.l10n(`${e}__${o}`)}bindL10n(e,t){var s;(s=this.localeManager)==null||s.bindL10n(this,e,t)}emit(e,t,s){let o=this.has("*eventEmitter")&&this.$["*eventEmitter"];o&&o.emit(e,t,s)}hasBlockInCtx(e){for(let t of this.blocksRegistry)if(e(t))return!0;return!1}setOrAddState(e,t){this.add$({[e]:t},!0)}connectedCallback(){this.constructor.styleAttrs.forEach(t=>{this.setAttribute(t,"")}),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?wi({element:this,attribute:d.CTX_NAME_ATTR}).then(t=>{t.success?super.connectedCallback():console.error(`Attribute "${d.CTX_NAME_ATTR}" is required and it is not set.`)}):super.connectedCallback(),fe.registerClient(this)}disconnectedCallback(){super.disconnectedCallback(),fe.unregisterClient(this)}initCallback(){this.has("*blocksRegistry")||this.add("*blocksRegistry",new Set),this.$["*blocksRegistry"].add(this),this.has("*eventEmitter")||this.add("*eventEmitter",new ot(this.debugPrint.bind(this))),this.has("*localeManager")||this.add("*localeManager",new lt(this)),this.has("*a11y")||this.add("*a11y",new at),this.sub(J("locale-id"),t=>{let s=pi(t);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 t;super.destroyCallback();let e=this.blocksRegistry;e==null||e.delete(this),(t=this.localeManager)==null||t.destroyL10nBindings(this),this.l10nProcessorSubs=new Map,j.deleteCtx(this.localCtx.uid),(e==null?void 0:e.size)===0&&setTimeout(()=>{this.destroyCtxCallback()},0)}destroyCtxCallback(){var e;j.deleteCtx(this.ctxName),(e=this.localeManager)==null||e.destroy()}async proxyUrl(e){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(e,{uuid:it(e),cdnUrlModifiers:$t(e),fileName:tt(e)})}catch(t){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",t),e}return this.cfg.secureDeliveryProxy?Lt(this.cfg.secureDeliveryProxy,{previewUrl:e},{transform:t=>window.encodeURIComponent(t)}):e}get cfg(){if(!this.__cfgProxy){let e=Object.create(null);this.__cfgProxy=new Proxy(e,{set:(t,s,o)=>{if(typeof s!="string")return!1;let n=P(s);return this.has(n)||this.add(n,z[s]),this.$[n]=o,!0},get:(t,s)=>{let o=P(s);return this.has(o)||this.add(o,z[s]),this.$[P(s)]}})}return this.__cfgProxy}subConfigValue(e,t){let s=P(e);this.has(s)||this.add(s,z[e]),this.sub(s,t)}debugPrint(...e){if(!this.cfg.debug)return;let t=e;if(typeof(e==null?void 0:e[0])=="function"){let s=e[0];t=s()}console.log(`[${this.ctxName}]`,...t)}static reg(e){if(!e){super.reg();return}e.startsWith(Pr)&&super.reg(e)}};m(y,"StateConsumerScope",null),m(y,"styleAttrs",[]);var H="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function ki(...r){return r.reduce((i,e)=>{if(typeof e=="string")return i[e]=!0,i;for(let t of Object.keys(e))i[t]=e[t];return i},{})}function A(...r){let i=ki(...r);return Object.keys(i).reduce((e,t)=>(i[t]&&e.push(t),e),[]).join(" ")}function Ii(r,...i){let e=ki(...i);for(let t of Object.keys(e))r.classList.toggle(t,e[t])}var Li=r=>{if(!r)return[];let[i,e]=r.split(":").map(Number);if(!Number.isFinite(i)||!Number.isFinite(e)){console.error(`Invalid crop preset: ${r}`);return}return[{type:"aspect-ratio",width:i,height:e}]};var Pi=r=>{if(!r)return L;let i=di(r).filter(e=>L.includes(e));return i.length===0?L:i};function Mi(r){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*tabList":L,"*tabId":T.CROP,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:H,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:st(L),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":()=>{let i=r.querySelectorAll("img");for(let e of i){let t=e.src;e.src=H,e.src=t}r.$["*networkProblems"]=!1},"*on.apply":i=>{if(!i)return;let e=r.$["*originalUrl"],t=Y(oe(i),"preview"),s=Z(e,t),o={originalUrl:e,cdnUrlModifiers:t,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 Ni="<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 Ri=w`${Ni} <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="${H}" 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 ne=class extends y{constructor(){super();m(this,"ctxOwner",!0);m(this,"_debouncedShowLoader",R(this._showLoader.bind(this),300));this.init$={...this.init$,...Mi(this)}}_showLoader(e){this.$.showLoader=e}_waitForSize(){return new Promise((t,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&&(t(),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 e=it(this.$.cdnUrl),t=Ot(this.$.cdnUrl,e);if(t===this.$["*originalUrl"])return;this.$["*originalUrl"]=t;let s=ii(this.$.cdnUrl),o=ai(s);this.$["*editorTransformations"]=o}else if(this.$.uuid){let e=Ot(this.cfg.cdnCname,this.$.uuid);if(e===this.$["*originalUrl"])return;this.$["*originalUrl"]=e,this.$["*editorTransformations"]={}}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===T.CROP?this.$["*cropperEl"].deactivate({reset:!0}):this.$["*faderEl"].deactivate();try{let e=await this.proxyUrl(Z(this.$["*originalUrl"],Y("json"))),t=await fetch(e).then(n=>n.json()),{width:s,height:o}=t;this.$["*imageSize"]={width:s,height:o},this.$["*tabId"]===T.CROP?this.$["*cropperEl"].activate(this.$["*imageSize"]):this.$["*faderEl"].activate({url:this.$["*originalUrl"]})}catch(e){e&&console.error("Failed to load image info",e)}}}async initEditor(){try{await this._waitForSize()}catch(e){this.isConnected&&console.error(e.message);return}this.ref["img-el"].addEventListener("load",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$.src!==H&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",e=>{let t=this.ref["img-el"];t.src!==e&&(this._imgLoading=!0,t.src=e||H)}),this.sub("cropPreset",e=>{this.$["*cropPresetList"]=Li(e)}),this.sub("tabs",e=>{this.$["*tabList"]=Pi(e)}),this.sub("*tabId",e=>{this.ref["img-el"].className=A("uc-image",{"uc-image_hidden_to_cropper":e===T.CROP,"uc-image_hidden_effects":e!==T.CROP})}),this.classList.add("uc-editor_ON"),this.sub("*networkProblems",e=>{this.$["presence.networkProblems"]=e,this.$["presence.modalCaption"]=!e}),this.sub("*editorTransformations",e=>{if(Object.keys(e).length===0)return;let t=this.$["*originalUrl"],s=Y(oe(e),"preview"),o=Z(t,s),n={originalUrl:t,cdnUrlModifiers:s,cdnUrl:o,transformations:e};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0}))},!1),this.sub("uuid",e=>e&&this.updateImage()),this.sub("cdnUrl",e=>e&&this.updateImage())}};m(ne,"styleAttrs",["uc-cloud-image-editor"]);ne.template=Ri;ne.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var Fe=33.333333333333336,_=1,Dt=24,Di=6;function pe(r,i){for(let e in i)r.setAttributeNS(null,e,i[e].toString())}function U(r,i={}){let e=document.createElementNS("http://www.w3.org/2000/svg",r);return pe(e,i),e}function Ui(r,i,e){let{x:t,y:s,width:o,height:n}=r,l=i.includes("w")?0:1,a=i.includes("n")?0:1,c=[-1,1][l],u=[-1,1][a],h=[t+l*o+1.5*c,s+a*n+1.5*u-24*e*u],f=[t+l*o+1.5*c,s+a*n+1.5*u],g=[t+l*o-24*e*c+1.5*c,s+a*n+1.5*u];return{d:`M ${h[0]} ${h[1]} L ${f[0]} ${f[1]} L ${g[0]} ${g[1]}`,center:f}}function Fi(r,i,e){let{x:t,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],u=[-1,1][a],h,f;["n","s"].includes(i)?(h=[t+l*o-34*e/2,s+a*n+1.5*u],f=[t+l*o+34*e/2,s+a*n+1.5*u]):(h=[t+l*o+1.5*c,s+a*n-34*e/2],f=[t+l*o+1.5*c,s+a*n+34*e/2]);let g=`M ${h[0]} ${h[1]} L ${f[0]} ${f[1]}`,b=[f[0]-(f[0]-h[0])/2,f[1]-(f[1]-h[1])/2];return{d:g,center:b}}function zi(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 Xi({rect:r,delta:[i,e],imageBox:t}){return xe({...r,x:r.x+i,y:r.y+e},t)}function xe(r,i){let{x:e}=r,{y:t}=r;return r.x<i.x?e=i.x:r.x+r.width>i.x+i.width&&(e=i.x+i.width-r.width),r.y<i.y?t=i.y:r.y+r.height>i.y+i.height&&(t=i.y+i.height-r.height),{...r,x:e,y:t}}function Mr({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[,s]=i,{y:o,width:n,height:l}=r;o+=s,l-=s,e&&(n=l*e);let a=r.x+r.width/2-n/2;return o<=t.y&&(o=t.y,l=r.y+r.height-o,e&&(n=l*e,a=r.x+r.width/2-n/2)),a<=t.x&&(a=t.x,o=r.y+r.height-l),a+n>=t.x+t.width&&(a=Math.max(t.x,t.x+t.width-n),n=t.x+t.width-a,e&&(l=n/e),o=r.y+r.height-l),l<_&&(l=_,e&&(n=l*e,a=r.x+r.width/2-n/2),o=r.y+r.height-l),n<_&&(n=_,e&&(l=n/e,a=r.x+r.width/2-n/2),o=r.y+r.height-l),{x:a,y:o,width:n,height:l}}function Nr({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[s]=i,{x:o,width:n,height:l}=r;o+=s,n-=s,e&&(l=n/e);let a=r.y+r.height/2-l/2;return o<=t.x&&(o=t.x,n=r.x+r.width-o,e&&(l=n/e,a=r.y+r.height/2-l/2)),a<=t.y&&(a=t.y,o=r.x+r.width-n),a+l>=t.y+t.height&&(a=Math.max(t.y,t.y+t.height-l),l=t.y+t.height-a,e&&(n=l*e),o=r.x+r.width-n),l<_&&(l=_,e&&(n=l*e),a=r.y+r.height/2-l/2,o=r.x+r.width-n),n<_&&(n=_,e&&(l=n/e),a=r.y+r.height/2-l/2,o=r.x+r.width-n),{x:o,y:a,width:n,height:l}}function Rr({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[,s]=i,{y:o,width:n,height:l}=r;l+=s,e&&(n=l*e);let a=r.x+r.width/2-n/2;return o+l>=t.y+t.height&&(l=t.y+t.height-o,e&&(n=l*e),a=r.x+r.width/2-n/2),a<=t.x&&(a=t.x,o=r.y),a+n>=t.x+t.width&&(a=Math.max(t.x,t.x+t.width-n),n=t.x+t.width-a,e&&(l=n/e),o=r.y),l<_&&(l=_,e&&(n=l*e),a=r.x+r.width/2-n/2),n<_&&(n=_,e&&(l=n/e),a=r.x+r.width/2-n/2),{x:a,y:o,width:n,height:l}}function Dr({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[s]=i,{x:o,width:n,height:l}=r;n+=s,e&&(l=n/e);let a=r.y+r.height/2-l/2;return o+n>=t.x+t.width&&(n=t.x+t.width-o,e&&(l=n/e),a=r.y+r.height/2-l/2),a<=t.y&&(a=t.y,o=r.x),a+l>=t.y+t.height&&(a=Math.max(t.y,t.y+t.height-l),l=t.y+t.height-a,e&&(n=l*e),o=r.x),l<_&&(l=_,e&&(n=l*e),a=r.y+r.height/2-l/2),n<_&&(n=_,e&&(l=n/e),a=r.y+r.height/2-l/2),{x:o,y:a,width:n,height:l}}function Ur({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[s,o]=i,{x:n,y:l,width:a,height:c}=r;return n+s<t.x&&(s=t.x-n),l+o<t.y&&(o=t.y-l),n+=s,a-=s,l+=o,c-=o,e&&Math.abs(a/c)>e?(o=a/e-c,c+=o,l-=o,l<=t.y&&(c=c-(t.y-l),a=c*e,n=r.x+r.width-a,l=t.y)):e&&(s=c*e-a,a=a+s,n-=s,n<=t.x&&(a=a-(t.x-n),c=a/e,n=t.x,l=r.y+r.height-c)),c<_&&(c=_,e&&(a=c*e),n=r.x+r.width-a,l=r.y+r.height-c),a<_&&(a=_,e&&(c=a/e),n=r.x+r.width-a,l=r.y+r.height-c),{x:n,y:l,width:a,height:c}}function Fr({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[s,o]=i,{x:n,y:l,width:a,height:c}=r;return n+a+s>t.x+t.width&&(s=t.x+t.width-n-a),l+o<t.y&&(o=t.y-l),a+=s,l+=o,c-=o,e&&Math.abs(a/c)>e?(o=a/e-c,c+=o,l-=o,l<=t.y&&(c=c-(t.y-l),a=c*e,n=r.x,l=t.y)):e&&(s=c*e-a,a+=s,n+a>=t.x+t.width&&(a=t.x+t.width-n,c=a/e,n=t.x+t.width-a,l=r.y+r.height-c)),c<_&&(c=_,e&&(a=c*e),l=r.y+r.height-c),a<_&&(a=_,e&&(c=a/e),l=r.y+r.height-c),{x:n,y:l,width:a,height:c}}function zr({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[s,o]=i,{x:n,y:l,width:a,height:c}=r;return n+s<t.x&&(s=t.x-n),l+c+o>t.y+t.height&&(o=t.y+t.height-l-c),n+=s,a-=s,c+=o,e&&Math.abs(a/c)>e?(o=a/e-c,c+=o,l+c>=t.y+t.height&&(c=t.y+t.height-l,a=c*e,n=r.x+r.width-a,l=t.y+t.height-c)):e&&(s=c*e-a,a+=s,n-=s,n<=t.x&&(a=a-(t.x-n),c=a/e,n=t.x,l=r.y)),c<_&&(c=_,e&&(a=c*e),n=r.x+r.width-a),a<_&&(a=_,e&&(c=a/e),n=r.x+r.width-a),{x:n,y:l,width:a,height:c}}function Xr({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[s,o]=i,{x:n,y:l,width:a,height:c}=r;return n+a+s>t.x+t.width&&(s=t.x+t.width-n-a),l+c+o>t.y+t.height&&(o=t.y+t.height-l-c),a+=s,c+=o,e&&Math.abs(a/c)>e?(o=a/e-c,c+=o,l+c>=t.y+t.height&&(c=t.y+t.height-l,a=c*e,n=r.x,l=t.y+t.height-c)):e&&(s=c*e-a,a+=s,n+a>=t.x+t.width&&(a=t.x+t.width-n,c=a/e,n=t.x+t.width-a,l=r.y)),c<_&&(c=_,e&&(a=c*e)),a<_&&(a=_,e&&(c=a/e)),{x:n,y:l,width:a,height:c}}function ji({direction:r,...i}){switch(r){case"n":return Mr(i);case"w":return Nr(i);case"s":return Rr(i);case"e":return Dr(i);case"nw":return Ur(i);case"ne":return Fr(i);case"sw":return zr(i);case"se":return Xr(i);default:return i.rect}}function Bi(r,[i,e]){return r.x<=i&&i<=r.x+r.width&&r.y<=e&&e<=r.y+r.height}function Vi(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 Hi(r,i){return Math.abs(r.width/r.height-i)<.1}function Ee({width:r,height:i},e){let t=e/90%2!==0;return{width:t?i:r,height:t?r:i}}function Ce(r){return{x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)}}function le(r,i,e){return Math.min(Math.max(r,i),e)}var ht=class extends y{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 e=this.$["*imageBox"];if(!e)return;if(i===""&&e.height<=_&&e.width<=_)return!0;let t=e.height<=_&&(i.includes("n")||i.includes("s")),s=e.width<=_&&(i.includes("e")||i.includes("w"));return t||s}_createBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:e,y:t,width:s,height:o}=i,n=this.ref["svg-el"],l=U("mask",{id:"backdrop-mask"}),a=U("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),c=U("rect",{x:e,y:t,width:s,height:o,fill:"black"});l.appendChild(a),l.appendChild(c);let u=U("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});n.appendChild(u),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:e,y:t,width:s,height:o}=i;this._backdropMaskInner&&pe(this._backdropMaskInner,{x:e,y:t,width:s,height:o})}_updateFrame(){let i=this.$["*cropBox"];if(!(!i||!this._frameGuides||!this._frameThumbs)){for(let e of Object.values(this._frameThumbs)){let{direction:t,pathNode:s,interactionNode:o,groupNode:n}=e,l=t==="",a=t.length===2,{x:c,y:u,width:h,height:f}=i;if(l){let b={x:c+h/3,y:u+f/3,width:h/3,height:f/3};pe(o,b)}else{let b=le(Math.min(h,f)/(24*2+34)/2,0,1),{d:x,center:I}=a?Ui(i,t,b):Fi(i,t,b),M=Math.max(Dt*le(Math.min(h,f)/Dt/3,0,1),Di);pe(o,{x:I[0]-M,y:I[1]-M,width:M*2,height:M*2}),pe(s,{d:x})}let g=this._shouldThumbBeDisabled(t);n.setAttribute("class",A("uc-thumb",{"uc-thumb--hidden":g,"uc-thumb--visible":!g}))}pe(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 e=0;e<3;e++)for(let t=0;t<3;t++){let s=`${["n","","s"][e]}${["w","","e"][t]}`,o=U("g");o.classList.add("uc-thumb"),o.setAttribute("with-effects","");let n=U("rect",{fill:"transparent"}),l=U("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=U("svg"),e=U("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});i.appendChild(e);for(let t=1;t<=2;t++){let s=U("line",{x1:`${Fe*t}%`,y1:"0%",x2:`${Fe*t}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});i.appendChild(s)}for(let t=1;t<=2;t++){let s=U("line",{x1:"0%",y1:`${Fe*t}%`,x2:"100%",y2:`${Fe*t}%`,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"],e=document.createDocumentFragment(),t=this._createGuides();e.appendChild(t);let s=this._createThumbs();for(let{groupNode:o}of Object.values(s))e.appendChild(o);i.appendChild(e),this._frameThumbs=s,this._frameGuides=t}_handlePointerDown(i,e){if(!this._frameThumbs)return;let t=this._frameThumbs[i];if(this._shouldThumbBeDisabled(i))return;let s=this.$["*cropBox"],{x:o,y:n}=this.ref["svg-el"].getBoundingClientRect(),l=e.x-o,a=e.y-n;this.$.dragging=!0,this._draggingThumb=t,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 e=this.ref["svg-el"],{x:t,y:s}=e.getBoundingClientRect(),o=i.x-t,n=i.y-s,l=o-this._dragStartPoint[0],a=n-this._dragStartPoint[1],{direction:c}=this._draggingThumb,u=this._calcCropBox(c,[l,a]);u&&(this.$["*cropBox"]=u)}_calcCropBox(i,e){var c,u;let[t,s]=e,o=this.$["*imageBox"],n=(c=this._dragStartCrop)!=null?c:this.$["*cropBox"],l=(u=this.$["*cropPresetList"])==null?void 0:u[0],a=l?l.width/l.height:void 0;if(i===""?n=Xi({rect:n,delta:[t,s],imageBox:o}):n=ji({rect:n,delta:[t,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 xe(Ce(n),this.$["*imageBox"])}_handleSvgPointerMove_(i){if(!this._frameThumbs)return;let e=Object.values(this._frameThumbs).find(t=>{if(this._shouldThumbBeDisabled(t.direction))return!1;let o=t.interactionNode.getBoundingClientRect(),n={x:o.x,y:o.y,width:o.width,height:o.height};return Bi(n,[i.x,i.y])});this._hoverThumb=e,this._updateCursor()}_updateCursor(){let i=this._hoverThumb;this.ref["svg-el"].style.cursor=i?zi(i.direction):"initial"}_render(){this._updateBackdrop(),this._updateFrame()}toggleThumbs(i){this._frameThumbs&&Object.values(this._frameThumbs).map(({groupNode:e})=>e).forEach(e=>{e.setAttribute("class",A("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<=_||i.width<=_,window.requestAnimationFrame(()=>{this._render()}))}),this.sub("dragging",i=>{this._frameGuides&&this._frameGuides.setAttribute("class",A({"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)}};ht.template=w`<svg class="uc-svg" ref="svg-el" xmlns="http://www.w3.org/2000/svg"></svg>`;var ee=class extends y{constructor(){super(...arguments);m(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",e=>{this._titleEl&&(this._titleEl.style.display=e?"block":"none")}),this.sub("active",e=>{this.className=A({"uc-active":e,"uc-not_active":!e})}),this.sub("on.click",e=>{this.onclick=e})}};ee.template=w`<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 Br(r){let i=r+90;return i=i>=360?0:i,i}function Vr(r,i){return r==="rotate"?Br(i):["mirror","flip"].includes(r)?!i:null}var ze=class extends ee{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),e=Vr(this._operation,i);this.$["*cropperEl"].setValue(this._operation,e)}}};var Xe={FILTER:"filter",COLOR_OPERATION:"color_operation"},G="original",ut=class extends y{constructor(){super(...arguments);m(this,"init$",{...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":e=>{this.$["*faderEl"].set(e),this.$.value=e}})}setOperation(e,t){this._controlType=e==="filter"?Xe.FILTER:Xe.COLOR_OPERATION,this._operation=e,this._iconName=e,this._title=e.toUpperCase(),this._filter=t,this._initializeValues(),this.$["*faderEl"].activate({url:this.$["*originalUrl"],operation:this._operation,value:this._filter===G?void 0:this.$.value,filter:this._filter===G?void 0:this._filter,fromViewer:!1})}_initializeValues(){let{range:e,zero:t}=V[this._operation],[s,o]=e;this.$.min=s,this.$.max=o,this.$.zero=t;let n=this.$["*editorTransformations"][this._operation];if(this._controlType===Xe.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===Xe.COLOR_OPERATION){let l=typeof n!="undefined"?n:t;this.$.value=l,this.$.defaultValue=l}}apply(){let e;this._controlType===Xe.FILTER?this._filter===G?e=null:e={name:this._filter,amount:this.$.value}:e=this.$.value;let t={...this.$["*editorTransformations"],[this._operation]:e};this.$["*editorTransformations"]=t}cancel(){this.$["*faderEl"].deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",e=>{this._originalUrl=e}),this.sub("value",e=>{let t=`${this._filter||this._operation} ${e}`;this.$["*operationTooltip"]=t})}};ut.template=w`<uc-slider-ui ref="slider-el" set="disabled: disabled; min: min; max: max; defaultValue: defaultValue; zero: zero; onInput: on.input;" ></uc-slider-ui>`;function je(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=H)}}}function Be(r){let i=[];for(let o of r){let n=je(o);i.push(n)}let e=i.map(o=>o.image);return{promise:Promise.allSettled(i.map(o=>o.promise)),images:e,cancel:()=>{i.forEach(o=>{o.cancel()})}}}var Se=class extends ee{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),e=window.devicePixelRatio,t=Math.ceil(e*i),s=e>=2?"lightest":"normal",o=100,n={...this.$["*editorTransformations"]};return n[this._operation]=this._filter!==G?{name:this._filter,amount:o}:void 0,Z(this._originalUrl,Y(rt,oe(n),`quality/${s}`,`scale_crop/${t}x${t}/center`))}async _observerCallback(i,e){var s;if(i[0].isIntersecting){let o=await this.proxyUrl(this._previewSrc()),n=this.ref["preview-el"],{promise:l,cancel:a}=je(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",""),e.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",e=>{this._operation="filter",this._filter=e,this.$.isOriginal=e===G,this.$.icon=this.$.isOriginal?"original":"slider",this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-filter",{name:e.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",e=>{this.$.active=e&&e===this._filter}),this.sub("active",e=>{if(this.$.isOriginal)return;let t=this.ref["icon-el"];t.style.opacity=e?"1":"0";let s=this.ref["preview-el"];e?s.style.opacity="0":s.style.backgroundImage&&(s.style.opacity="1")}),this.sub("*networkProblems",async e=>{if(!e){let t=await this.proxyUrl(this._previewSrc()),s=this.ref["preview-el"];s.style.backgroundImage&&(s.style.backgroundImage="none",s.style.backgroundImage=`url(${t})`)}})}destroyCallback(){var i,e;super.destroyCallback(),(i=this._observer)==null||i.disconnect(),(e=this._cancelPreload)==null||e.call(this)}};Se.template=w`<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 Ve=class extends ee{constructor(){super(...arguments);m(this,"_operation","")}initCallback(){super.initCallback(),this.$["on.click"]=()=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation},this.defineAccessor("operation",e=>{e&&(this._operation=e,this.$.icon=e,this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(e).toLowerCase()})),this.bindL10n("title",()=>this.l10n(e)))}),this.sub("*editorTransformations",e=>{if(!this._operation)return;let{zero:t}=V[this._operation],s=e[this._operation],o=typeof s!="undefined"?s!==t:!1;this.$.active=o})}};var Ki=(r,i)=>{let e,t,s,o=(...n)=>{e?(clearTimeout(t),t=setTimeout(()=>{Date.now()-s>=i&&(r(...n),s=Date.now())},Math.max(i-(Date.now()-s),0))):(r(...n),s=Date.now(),e=!0)};return Object.defineProperty(o,"cancel",{configurable:!1,writable:!1,enumerable:!1,value:()=>{clearTimeout(t)}}),o};function Gi(r,i){let e={};for(let t of i){let s=r[t];(r.hasOwnProperty(t)||s!==void 0)&&(e[t]=s)}return e}var Wi="blocks",qi="1.5.2";function Ae(r,i,e){let s=window.devicePixelRatio,o=Math.min(Math.ceil(i*s),3e3),n=s>=2?"lightest":"normal";return Z(r,Y(rt,oe(e),`quality/${n}`,`stretch/off/-/resize/${o}x`,`@clib/${Wi}/${qi}/uc-cloud-image-editor/`))}function Hr(r){return r?[({dimensions:e,coords:t})=>[...e,...t].every(s=>Number.isInteger(s)&&Number.isFinite(s)),({dimensions:e,coords:t})=>e.every(s=>s>0)&&t.every(s=>s>=0)].every(e=>e(r)):!0}var dt=class extends y{constructor(){super();m(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=R(this._commit.bind(this),300),this._handleResizeThrottled=Ki(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 e=this.$["*editorTransformations"],t=Gi(e,Object.keys(this.$["*operations"])),s={...this.$["*operations"],...t};this.$["*operations"]=s}_initCanvas(){let e=this.ref["canvas-el"],t=e.getContext("2d"),s=this.offsetWidth,o=this.offsetHeight,n=window.devicePixelRatio;e.style.width=`${s}px`,e.style.height=`${o}px`,e.width=s*n,e.height=o*n,t==null||t.scale(n,n),this._canvas=e,this._ctx=t}_alignImage(){if(!this._isActive||!this.$.image)return;let e=this.$.image,t=this.$["*padding"],s=this.$["*operations"],{rotate:o}=s,n={width:this.offsetWidth,height:this.offsetHeight},l=Ee({width:e.naturalWidth,height:e.naturalHeight},o),a;if(l.width>n.width-t*2||l.height>n.height-t*2){let c=l.width/l.height,u=n.width/n.height;if(c>u){let h=n.width-t*2,f=h/c,g=0+t,b=t+(n.height-t*2)/2-f/2;a={x:g,y:b,width:h,height:f}}else{let h=n.height-t*2,f=h*c,g=t+(n.width-t*2)/2-f/2,b=0+t;a={x:g,y:b,width:f,height:h}}}else{let{width:c,height:u}=l,h=t+(n.width-t*2)/2-c/2,f=t+(n.height-t*2)/2-u/2;a={x:h,y:f,width:c,height:u}}this.$["*imageBox"]=Ce(a)}_alignCrop(){var f;let e=this.$["*cropBox"],t=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,n=this.$["*editorTransformations"].crop,{width:l,x:a,y:c}=this.$["*imageBox"];if(n){let{dimensions:[g,b],coords:[x,I]}=n,{width:M}=Ee(this._imageSize,o),ae=l/M;e=xe(Ce({x:a+x*ae,y:c+I*ae,width:g*ae,height:b*ae}),this.$["*imageBox"])}let u=(f=this.$["*cropPresetList"])==null?void 0:f[0],h=u?u.width/u.height:void 0;if(!Vi(e,t)||h&&!Hi(e,h)){let g=t.width/t.height,b=t.width,x=t.height;h&&(g>h?b=Math.min(t.height*h,t.width):x=Math.min(t.width/h,t.height)),e={x:t.x+t.width/2-b/2,y:t.y+t.height/2-x/2,width:b,height:x}}this.$["*cropBox"]=xe(Ce(e),this.$["*imageBox"])}_drawImage(){let e=this._ctx;if(!e)return;let t=this.$.image,s=this.$["*imageBox"],o=this.$["*operations"],{mirror:n,flip:l,rotate:a}=o,c=Ee({width:s.width,height:s.height},a);e.save(),e.translate(s.x+s.width/2,s.y+s.height/2),e.rotate(a*Math.PI*-1/180),e.scale(n?-1:1,l?-1:1),e.drawImage(t,-c.width/2,-c.height/2,c.width,c.height),e.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let e=this._canvas;this._ctx.clearRect(0,0,e.width,e.height),this._drawImage()}_animateIn({fromViewer:e}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=A({"uc-active_from_viewer":e,"uc-active_from_editor":!e,"uc-inactive_to_editor":!1})}))}_getCropDimensions(){let e=this.$["*cropBox"],t=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,{width:n,height:l}=t,{width:a,height:c}=Ee(this._imageSize,o),{width:u,height:h}=e,f=n/a,g=l/c;return[le(Math.round(u/f),1,a),le(Math.round(h/g),1,c)]}_getCropTransformation(){let e=this.$["*cropBox"],t=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,{width:n,height:l,x:a,y:c}=t,{width:u,height:h}=Ee(this._imageSize,o),{x:f,y:g}=e,b=n/u,x=l/h,I=this._getCropDimensions(),M={dimensions:I,coords:[le(Math.round((f-a)/b),0,u-I[0]),le(Math.round((g-c)/x),0,h-I[1])]};if(!Hr(M)){console.error("Cropper is trying to create invalid crop object",{payload:M});return}if(!(I[0]===u&&I[1]===h))return M}_commit(){if(!this.isConnected||!this._imageSize)return;let e=this.$["*operations"],{rotate:t,mirror:s,flip:o}=e,n=this._getCropTransformation(),a={...this.$["*editorTransformations"],crop:n,rotate:t,mirror:s,flip:o};this.$["*editorTransformations"]=a}setValue(e,t){this.$["*operations"]={...this.$["*operations"],[e]:t},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(e){return this.$["*operations"][e]}async activate(e,{fromViewer:t}={}){if(!this._isActive){this._isActive=!0,this._imageSize=e,this.removeEventListener("transitionend",this._reset);try{this.$.image=await this._waitForImage(this.$["*originalUrl"],this.$["*editorTransformations"]),this._syncTransformations(),this._animateIn({fromViewer:t})}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:e=!1}={}){var t;this._isActive&&(!e&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=A({"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}),(t=this._observer)==null||t.disconnect())}_transitionToCrop(){let e=this._getCropDimensions(),t=Math.min(this.offsetWidth,e[0])/this.$["*cropBox"].width,s=Math.min(this.offsetHeight,e[1])/this.$["*cropBox"].height,o=Math.min(t,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 e=this.$["*cropBox"].x+this.$["*cropBox"].width/2,t=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${t}px`}_reset(){this._isActive||(this.$.image=null)}async _waitForImage(e,t){var u;let s=this.offsetWidth;t={...t,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let o=await this.proxyUrl(Ae(e,s,t)),{promise:n,cancel:l,image:a}=je(o),c=this._handleImageLoading(o);return a.addEventListener("load",c,{once:!0}),a.addEventListener("error",c,{once:!0}),(u=this._cancelPreload)==null||u.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(e){let t="crop",s=this.$["*loadingOperations"];return s.get(t)||s.set(t,new Map),s.get(t).get(e)||(s.set(t,s.get(t).set(e,!0)),this.$["*loadingOperations"]=s),()=>{var o;(o=s==null?void 0:s.get(t))!=null&&o.has(e)&&(s.get(t).delete(e),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",e=>{e||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){var e;super.destroyCallback(),(e=this._observer)==null||e.disconnect()}};dt.template=w`<canvas class="uc-canvas" ref="canvas-el"></canvas><uc-crop-frame ref="frame-el"></uc-crop-frame>`;function Ut(r,i,e){let t=Array(e);e--;for(let s=e;s>=0;s--)t[s]=Math.ceil((s*i+(e-s)*r)/e);return t}function Kr(r){return r.reduce((i,e,t)=>t<r.length-1?[...i,[e,r[t+1]]]:i,[])}function Gr(r,i,e){let t=Kr(r).find(([s,o])=>s<=i&&i<=o);return r.map(s=>{let o=Math.abs(t[0]-t[1]),n=Math.abs(i-t[0])/o;return t[0]===s?i>e?1:1-n:t[1]===s?i>=e?n:1:0})}function Wr(r,i){return r.map((e,t)=>e<i?r.length-t:t)}function Yi(r,i){let e=V[r].keypointsNumber,{range:t,zero:s}=V[r];return[...new Set([...Ut(t[0],s,e+1),...Ut(s,t[1],e+1),s,i])].sort((o,n)=>o-n)}var Ft=class extends y{constructor(){super(),this._isActive=!1,this._hidden=!0,this._addKeypointDebounced=R(this._addKeypoint.bind(this),600),this.classList.add("uc-inactive_to_cropper")}_handleImageLoading(i){let e=this._operation,t=this.$["*loadingOperations"];return t.get(e)||t.set(e,new Map),t.get(e).get(i)||(t.set(e,t.get(e).set(i,!0)),this.$["*loadingOperations"]=t),()=>{var s;(s=t==null?void 0:t.get(e))!=null&&s.has(i)&&(t.get(e).delete(i),this.$["*loadingOperations"]=t)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let i of this._keypoints){let{image:e}=i;e&&(e.style.opacity=i.opacity.toString(),e.style.zIndex=i.zIndex.toString())}})}async _imageSrc({url:i=this._url,filter:e=this._filter,operation:t,value:s}={}){let o={...this._transformations};t&&(o[t]=e?{name:e,amount:s}:s);let n=this.offsetWidth;return await this.proxyUrl(Ae(i,n,o))}async _constructKeypoint(i,e){return{src:await this._imageSrc({operation:i,value:e}),image:null,opacity:0,zIndex:0,value:e}}_isSame(i,e){return this._operation===i&&this._filter===e}async _addKeypoint(i,e,t){let s=()=>!this._isSame(i,e)||this._value!==t||!!this._keypoints.find(a=>a.value===t);if(s())return;let o=await this._constructKeypoint(i,t),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>t),u=c<a.length?a[c].image:null;!this._container||u&&!this._container.contains(u)||(a.splice(c,0,o),this._container.insertBefore(n,u),this._update(i,t))},{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,e){this._operation=i,this._value=e;let{zero:t}=V[i],s=this._keypoints.map(l=>l.value),o=Gr(s,e,t),n=Wr(s,t);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 e=document.createElement("div");i.appendChild(e);let t=this._keypoints.map(c=>c.src),{images:s,promise:o,cancel:n}=Be(t);s.forEach(c=>{let u=this._handleImageLoading(c.src);c.addEventListener("load",u),c.addEventListener("error",u)}),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=e,this._keypoints.forEach((c,u)=>{let h=s[u];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 e=await this._imageSrc(),t=this._handleImageLoading(e);this._previewImage.src=e,this._previewImage.addEventListener("load",t,{once:!0}),this._previewImage.addEventListener("error",t,{once:!0}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}}async preload({url:i,filter:e,operation:t,value:s}){this._cancelBatchPreload&&this._cancelBatchPreload();let o=Yi(t,s),n=await Promise.all(o.map(a=>this._imageSrc({url:i,filter:e,operation:t,value:a}))),{cancel:l}=Be(n);this._cancelBatchPreload=l}_setOriginalSrc(i){let e=this._previewImage||this._createPreviewImage();if(!this.contains(e)&&this.appendChild(e),this._previewImage=e,e.src===i){e.style.opacity="1",e.style.transform="scale(1)",this.className=A({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1});return}e.style.opacity="0";let t=this._handleImageLoading(i);e.addEventListener("error",t,{once:!0}),e.src=i,e.addEventListener("load",()=>{t(),e&&(e.style.opacity="1",e.style.transform="scale(1)",this.className=A({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1}))},{once:!0}),e.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}async activate({url:i,operation:e,value:t,filter:s,fromViewer:o}){if(this._isActive=!0,this._hidden=!1,this._url=i,this._operation=e||"initial",this._value=t,this._filter=s,this._fromViewer=o,typeof t!="number"&&!s){let l=await this._imageSrc({operation:e,value:t});this._setOriginalSrc(l),this._container&&this._container.remove();return}this._keypoints=await Promise.all(Yi(e,t).map(l=>this._constructKeypoint(e,l))),this._update(e,t),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=A({"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 qr=1,ft=class extends y{initCallback(){super.initCallback(),this.addEventListener("wheel",i=>{i.preventDefault();let{deltaY:e,deltaX:t}=i;Math.abs(t)>qr?this.scrollLeft+=t:this.scrollLeft+=e},{passive:!1}),this.addEventListener("scroll",()=>{},{passive:!0})}};ft.template=w`<slot></slot>`;function Yr(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 Zr(r){return w`<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 pt=class extends y{constructor(){super();m(this,"_updateInfoTooltip",R(()=>{var n,l;let e=this.$["*editorTransformations"],t=this.$["*currentOperation"],s="",o=!1;if(this.$["*tabId"]===T.FILTERS)if(o=!0,this.$["*currentFilter"]&&((n=e==null?void 0:e.filter)==null?void 0:n.name)===this.$["*currentFilter"]){let a=((l=e==null?void 0:e.filter)==null?void 0:l.amount)||100;s=this.$["*currentFilter"]+" "+a}else s=this.l10n(G);else if(this.$["*tabId"]===T.TUNING&&t){o=!0;let a=(e==null?void 0:e[t])||V[t].zero;s=this.l10n(t)+" "+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":G,"*currentOperation":null,showLoader:!1,filters:hi,colorOperations:ci,cropOperations:ui,"*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 e;(e=this._cancelPreload)==null||e.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":e=>{let t=e.currentTarget.getAttribute("data-id");t&&this._activateTab(t,{fromViewer:!1})},tab_role:"tab",[`tab_${T.TUNING}`]:`tab_${T.TUNING}`,[`tab_${T.CROP}`]:`tab_${T.CROP}`,[`tab_${T.FILTERS}`]:`tab_${T.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=R(this._showLoader.bind(this),500)}_onSliderClose(){this.$["*showSlider"]=!1,this.$["*tabId"]===T.TUNING&&this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible",!1)}_createOperationControl(e){let t=new Ve;return t.operation=e,t}_createFilterControl(e){let t=new Se;return t.filter=e,t}_createToggleControl(e){let t=new ze;return t.operation=e,t}_renderControlsList(e){let t=this.ref[`controls-list-${e}`],s=document.createDocumentFragment();e===T.CROP?this.$.cropOperations.forEach(o=>{let n=this._createToggleControl(o);s.appendChild(n)}):e===T.FILTERS?[G,...this.$.filters].forEach(o=>{let n=this._createFilterControl(o);s.appendChild(n)}):e===T.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")}),t.innerHTML="",t.appendChild(s)}_activateTab(e,{fromViewer:t}){this.$["*tabId"]=e,e===T.CROP?(this.$["*faderEl"].deactivate(),this.$["*cropperEl"].activate(this.$["*imageSize"],{fromViewer:t})):(this.$["*faderEl"].activate({url:this.$["*originalUrl"],fromViewer:t}),this.$["*cropperEl"].deactivate());for(let s of L){let o=s===e,n=this.ref[`tab-toggle-${s}`];n.active=o,o?(this._renderControlsList(e),this._syncTabIndicator()):this._unmountTabControls(s),this.$[`presence.tabContent.${s}`]=o}}_unmountTabControls(e){let t=this.ref[`controls-list-${e}`];t&&(t.innerHTML="")}_syncTabIndicator(){let e=this.ref[`tab-toggle-${this.$["*tabId"]}`],t=this.ref["tabs-indicator"];t.style.transform=`translateX(${e.offsetLeft}px)`}async _preloadEditedImage(){var e;if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,s=await this.proxyUrl(Ae(this.$["*originalUrl"],t,this.$["*editorTransformations"]));(e=this._cancelPreload)==null||e.call(this);let{cancel:o}=Be([s]);this._cancelPreload=()=>{o(),this._cancelPreload=void 0}}}_showLoader(e){this.$.showLoader=e}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.sub("*imageSize",e=>{e&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",e=>{var s;let t=(s=e==null?void 0:e.filter)==null?void 0:s.name;this.$["*currentFilter"]!==t&&(this.$["*currentFilter"]=t!=null?t: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",e=>{this._preloadEditedImage(),this.$["*faderEl"]&&this.$["*faderEl"].setTransformations(e)}),this.sub("*loadingOperations",e=>{let t=!1;for(let[,s]of e.entries()){if(t)break;for(let[,o]of s.entries())if(o){t=!0;break}}this._debouncedShowLoader(t)}),this.sub("*showSlider",e=>{this.$["presence.subToolbar"]=e,this.$["presence.mainToolbar"]=!e}),this.sub("*tabList",e=>{this.$["presence.tabToggles"]=e.length>1;for(let t of L){this.$[`presence.tabToggle.${t}`]=e.includes(t);let s=this.ref[`tab-toggle-${t}`];s.style.gridColumn=e.indexOf(t)+1}e.includes(this.$["*tabId"])||this._activateTab(e[0],{fromViewer:!1})}),this._updateInfoTooltip()}};pt.template=w`<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">${L.map(Zr).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> ${L.map(Yr).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 He=class extends y{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 A("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)}};He.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});He.template=w`<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 mt=class extends y{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(),e=this.ref["line-el"];e.style.transition="transform 1s",e.style.opacity="1",e.style.transform=`translateX(${i}px)`,e.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){this._active=!1}};mt.template=w`<div class="uc-inner"><div class="uc-line" ref="line-el"></div></div>`;var gt={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},_t=class extends y{constructor(){super(),this._visible=!1,this._visibleStyle=gt.visible,this._hiddenStyle=gt.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",Ii(this,{[gt.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(gt.transition),this._handleVisible(),setTimeout(()=>{this.classList.toggle("uc-initial",!1)},0)}};_t.template=w`<slot></slot>`;var bt=class extends y{constructor(){super();m(this,"init$",{...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:null,"on.sliderInput":()=>{let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e),this.$.onInput&&this.$.onInput(e)},"on.sliderChange":()=>{let e=parseInt(this.ref["input-el"].value,10);this.$.onChange&&this.$.onChange(e)}});this.setAttribute("with-effects","")}initCallback(){super.initCallback(),this.defineAccessor("disabled",t=>{this.$.disabled=t}),this.defineAccessor("min",t=>{this.$.min=t}),this.defineAccessor("max",t=>{this.$.max=t}),this.defineAccessor("defaultValue",t=>{this.$.defaultValue=t,this.ref["input-el"].value=t,this._updateValue(t)}),this.defineAccessor("zero",t=>{this._zero=t}),this.defineAccessor("onInput",t=>{t&&(this.$.onInput=t)}),this.defineAccessor("onChange",t=>{t&&(this.$.onChange=t)}),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps();let t=parseInt(this.ref["input-el"].value,10);this._updateValue(t)}),this._observer.observe(this),this._thumbSize=parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10),setTimeout(()=>{let t=parseInt(this.ref["input-el"].value,10);this._updateValue(t)},0),this.sub("disabled",t=>{let s=this.ref["input-el"];t?s.setAttribute("disabled","disabled"):s.removeAttribute("disabled")});let e=this.ref["input-el"];e.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),e.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_updateValue(e){this._updateZeroDot(e);let{width:t}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(e-this.$.min)*(t-this._thumbSize)/100;window.requestAnimationFrame(()=>{this.ref["thumb-el"].style.transform=`translateX(${n}px)`})}_updateZeroDot(e){if(!this._zeroDotEl)return;e===this._zero?this._zeroDotEl.style.opacity="0":this._zeroDotEl.style.opacity="0.2";let{width:t}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(this._zero-this.$.min)*(t-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl.style.transform=`translateX(${n}px)`})}_updateSteps(){let t=this.ref["steps-el"],{width:s}=t.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 u=document.createElement("div");u.className="uc-zero-dot",l.appendChild(u),this._zeroDotEl=u,t.innerHTML="",t.appendChild(l),this._stepsCount=n}destroyCallback(){var e;super.destroyCallback(),(e=this._observer)==null||e.disconnect()}};bt.template=w`<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 Ke=class Ke extends ne{initCallback(){var i;super.initCallback(),(i=this.a11y)==null||i.registerBlock(this)}};m(Ke,"styleAttrs",[...Ht(Ke,Ke,"styleAttrs"),"uc-wgt-common"]);var Zi=Ke;var Ge=class extends y{constructor(){super(),this.init$={...this.init$,name:"",href:""}}initCallback(){super.initCallback(),this.sub("name",i=>{if(!i)return;let e=`#uc-icon-${i}`;this.subConfigValue("iconHrefResolver",t=>{if(t){let s=t(i);e=s!=null?s:e}this.$.href=e})})}};Ge.template=w`<svg ref="svg" xmlns="http://www.w3.org/2000/svg"><use set="@href: href;"></use></svg>`;Ge.bindAttributes({name:"name"});var Qr=["Symbiote","BaseComponent","UploaderBlock","ActivityBlock","Block","SolutionBlock"];function Jr(r){for(let i in r){if(Qr.includes(i))continue;let e=[...i].reduce((t,s)=>(s.toUpperCase()===s&&(s="-"+s.toLowerCase()),t+=s),"");e.startsWith("-")&&(e=e.replace("-","")),e.startsWith("uc-")||(e="uc-"+e),r[i].reg&&r[i].reg(e)}}var yt=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(e=>e.toLowerCase()).join("-")};var $=r=>String(r),X=r=>{let i=Number(r);if(Number.isNaN(i))throw new Error(`Invalid number: "${r}"`);return i},O=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}"`)},es=r=>r==="auto"?r:O(r),ts=r=>{let i=$(r);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid "cameraCapture" value: "${i}"`);return i},is=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.")},rs=r=>{if(typeof r=="object")return r;throw new Error("Invalid value. Must be an object.")},zt=r=>{if(typeof r=="function")return r;throw new Error("Invalid value. Must be a function.")},Qi=r=>{if(Array.isArray(r))return r;throw new Error("Must be an array.")},ss={pubkey:$,multiple:O,multipleMin:X,multipleMax:X,confirmUpload:O,imgOnly:O,accept:$,externalSourcesPreferredTypes:$,store:es,cameraMirror:O,cameraCapture:ts,sourceList:$,maxLocalFileSizeBytes:X,thumbSize:X,showEmptyList:O,useLocalImageEditor:O,useCloudImageEditor:O,cloudImageEditorTabs:$,removeCopyright:O,cropPreset:$,imageShrink:$,modalScrollLock:O,modalBackdropStrokes:O,sourceListWrap:O,remoteTabSessionKey:$,cdnCname:$,baseUrl:$,socialBaseUrl:$,secureSignature:$,secureExpire:$,secureDeliveryProxy:$,retryThrottledRequestMaxTimes:X,multipartMinFileSize:X,multipartChunkSize:X,maxConcurrentRequests:X,multipartMaxConcurrentRequests:X,multipartMaxAttempts:X,checkForUrlDuplicates:O,saveUrlForRecurrentUploads:O,groupOutput:O,userAgentIntegration:$,debug:O,localeName:$,metadata:is,secureUploadsExpireThreshold:X,localeDefinitionOverride:rs,secureUploadsSignatureResolver:zt,secureDeliveryProxyUrlResolver:zt,iconHrefResolver:zt,fileValidators:Qi,collectionValidators:Qi},Ji=(r,i)=>{if(!(typeof i=="undefined"||i===null))try{return ss[r](i)}catch(e){return console.error(`Invalid value for config key "${r}".`,e),z[r]}};var Xt=[...new Set(["debug",...Object.keys(z)])],os=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators"],ns=r=>os.includes(r),$e=Xt.filter(r=>!ns(r)),ls={...Object.fromEntries($e.map(r=>[yt(r),r])),...Object.fromEntries($e.map(r=>[r.toLowerCase(),r]))},as={...Object.fromEntries($e.map(r=>[yt(r),P(r)])),...Object.fromEntries($e.map(r=>[r.toLowerCase(),P(r)]))},er=r=>"__"+r,We=class extends y{constructor(){super();m(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(z).map(([e,t])=>[P(e),t]))}}_flushValueToAttribute(e,t){if($e.includes(e)){let s=[...new Set([yt(e),e.toLowerCase()])];for(let o of s)typeof t=="undefined"||t===null?this.removeAttribute(o):this.getAttribute(o)!==t.toString()&&this.setAttribute(o,t.toString())}}_flushValueToState(e,t){this.$[P(e)]!==t&&(typeof t=="undefined"||t===null?this.$[P(e)]=z[e]:this.$[P(e)]=t)}_setValue(e,t){let s=this,o=Ji(e,t),n=er(e);s[n]!==o&&(this._assertSameValueDifferentReference(e,s[n],o),s[n]=o,this._flushValueToAttribute(e,o),this._flushValueToState(e,o),this.debugPrint(`[uc-config] "${e}"`,o))}_getValue(e){let t=this,s=er(e);return t[s]}_assertSameValueDifferentReference(e,t,s){this.cfg.debug&&s!==t&&typeof s=="object"&&typeof t=="object"&&JSON.stringify(s)===JSON.stringify(t)&&(console.warn(`[uc-config] Option "${e}" 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] "${e}" previous value:`,t),console.warn(`[uc-config] "${e}" new value:`,s))}initCallback(){var t;super.initCallback();let e=this;for(let s of $e)this.sub(P(s),o=>{this._setValue(s,o)},!1);for(let s of Xt){let o=(t=e[s])!=null?t:this.$[P(s)];o!==z[s]&&this._setValue(s,o),Object.defineProperty(this,s,{set:n=>{this._setValue(s,n)},get:()=>this._getValue(s)})}}attributeChangedCallback(e,t,s){if(t===s)return;let o=this,n=ls[e];o[n]=s}};We.bindAttributes(as);for(let r of Xt)We.prototype[r]=void 0;var cs=We;export{He as BtnUi,Zi as CloudImageEditor,ne as CloudImageEditorBlock,cs as Config,ht as CropFrame,ze as EditorCropButtonControl,Se as EditorFilterControl,dt as EditorImageCropper,Ft as EditorImageFader,Ve as EditorOperationControl,ft as EditorScroller,ut as EditorSlider,pt as EditorToolbar,Ge as Icon,mt as LineLoaderUi,_t as PresenceToggle,bt as SliderUi,Jr as defineComponents};
27
+ var rr=Object.defineProperty;var sr=Object.getPrototypeOf;var or=Reflect.get;var nr=(r,i,e)=>i in r?rr(r,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[i]=e;var m=(r,i,e)=>(nr(r,typeof i!="symbol"?i+"":i,e),e),wt=(r,i,e)=>{if(!i.has(r))throw TypeError("Cannot "+e)};var p=(r,i,e)=>(wt(r,i,"read from private field"),e?e.call(r):i.get(r)),v=(r,i,e)=>{if(i.has(r))throw TypeError("Cannot add the same private member more than once");i instanceof WeakSet?i.add(r):i.set(r,e)},C=(r,i,e,t)=>(wt(r,i,"write to private field"),t?t.call(r,e):i.set(r,e),e);var E=(r,i,e)=>(wt(r,i,"access private method"),e),Kt=(r,i,e)=>or(sr(r),e,i);var d={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 lr(r){let i=e=>{var t;for(let s in e)((t=e[s])==null?void 0:t.constructor)===Object&&(e[s]=i(e[s]));return{...e}};return i(r)}var _e,be,te,ie,ge,qe,Gt,k=class k{constructor(i){v(this,_e,void 0);v(this,be,void 0);v(this,te,void 0);i.constructor===Object?this.store=lr(i):(C(this,te,!0),this.store=i),this.callbackMap=Object.create(null)}read(i){var e,t;if(!p(this,te)&&!this.store.hasOwnProperty(i))return E(e=k,ie,ge).call(e,"read",i),null;if(typeof i=="string"&&i.startsWith(d.COMPUTED_PX)){let s=this.store[i];if((s==null?void 0:s.constructor)!==Function){E(t=k,ie,ge).call(t,"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 p(this,te)?this.store[i]!==void 0:this.store.hasOwnProperty(i)}add(i,e,t=!1){!t&&Object.keys(this.store).includes(i)||(this.store[i]=e,this.notify(i))}pub(i,e){var t,s;if(!p(this,te)&&!this.store.hasOwnProperty(i)){E(t=k,ie,ge).call(t,"publish",i);return}if(i!=null&&i.startsWith(d.COMPUTED_PX)&&e.constructor!==Function){E(s=k,ie,ge).call(s,"publish computed",i);return}!(this.store[i]===null||e===null)&&typeof this.store[i]!=typeof e&&console.warn(`Symbiote PubSub: type warning for "${i}" [${typeof this.store[i]} -> ${typeof e}]`),this.store[i]=e,this.notify(i)}get proxy(){if(!p(this,be)){let i=Object.create(null);C(this,be,new Proxy(i,{set:(e,t,s)=>(this.pub(t,s),!0),get:(e,t)=>{this.read(t)}}))}return p(this,be)}multiPub(i){for(let e in i)this.pub(e,i[e])}notify(i){var t;let e=i==null?void 0:i.startsWith(d.COMPUTED_PX);if(this.callbackMap[i]){let s=this.read(i);this.callbackMap[i].forEach(o=>{o(s)}),e&&(this.__computedMap[i]=s)}!e&&E(t=k,qe,Gt).call(t,this,i)}sub(i,e,t=!0){var s;return!p(this,te)&&!this.store.hasOwnProperty(i)?(E(s=k,ie,ge).call(s,"subscribe",i),null):(this.callbackMap[i]||(this.callbackMap[i]=new Set),this.callbackMap[i].add(e),t&&e(this.read(i)),{remove:()=>{this.callbackMap[i].delete(e),this.callbackMap[i].size||delete this.callbackMap[i]},callback:e})}set uid(i){!p(this,_e)&&C(this,_e,i)}get uid(){return p(this,_e)}static registerCtx(i,e=Symbol()){let t=k.globalStore.get(e);return t?console.warn('PubSub: context UID "'+e+'" is already in use'):(t=new k(i),t.uid=e,k.globalStore.set(e,t)),t}static deleteCtx(i){k.globalStore.delete(i)}static getCtx(i,e=!0){return k.globalStore.get(i)||(e&&console.warn('PubSub: wrong context UID - "'+i+'"'),null)}};_e=new WeakMap,be=new WeakMap,te=new WeakMap,ie=new WeakSet,ge=function(i,e){console.warn(`Symbiote PubSub: cannot ${i}. Prop name: `+e)},qe=new WeakSet,Gt=function(i,e){this.globalStore.forEach(t=>{t.__computedMap&&Object.keys(t.__computedMap).forEach(s=>{if(t===i&&e===s)return;let o=`__${s}_timeout`;t[o]&&window.clearTimeout(t[o]),t[o]=window.setTimeout(()=>{let n=t.read(s);n!==t.__computedMap[s]&&(t.__computedMap[s]=n,t.notify(s))})})})},v(k,ie),v(k,qe);var j=k;j.globalStore=new Map;var W=j;var Wt="1234567890QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm",ar=Wt.length-1,ye=class{static generate(i="XXXXXXXXX-XXX"){let e="";for(let t=0;t<i.length;t++)e+=i[t]==="-"?i[t]:Wt.charAt(Math.random()*ar);return e}};function Oe(r,i,e){let t=!0,s,o=i.split(".");return o.forEach((n,l)=>{l<o.length-1?r=r[n]:s=n}),r?r[s]=e:t=!1,t}function vt(r){let i;return r.constructor===CSSStyleSheet?i=r:r.constructor===String&&(i=new CSSStyleSheet,i.replaceSync(r)),i}function qt(r,i){[...r.querySelectorAll(`[${d.LIST_ATTR}]`)].filter(e=>!e.matches(`[${d.LIST_ATTR}] [${d.LIST_ATTR}]`)).forEach(e=>{var n;let t=e.getAttribute(d.LIST_ITEM_TAG_ATTR),s;for(t&&(s=window.customElements.get(t)),s||(s=class extends i.Symbiote{constructor(){super(),t||(this.style.display="contents")}},s.template=((n=e.querySelector("template"))==null?void 0:n.innerHTML)||e.innerHTML,s.reg(t));e.firstChild;)e.firstChild.remove();let o=e.getAttribute(d.LIST_ATTR);i.sub(o,l=>{if(!l){for(;e.firstChild;)e.firstChild.remove();return}let a=[...e.children],c,u=h=>{h.forEach((g,b)=>{if(a[b])if(a[b].set$)a[b].set$(g);else for(let x in g)a[b][x]=g[x];else{c||(c=new DocumentFragment);let x=new s;Object.assign((x==null?void 0:x.init$)||x,g),c.appendChild(x)}}),c&&e.appendChild(c);let f=a.slice(h.length,a.length);for(let g of f)g.remove()};if(l.constructor===Array)u(l);else if(l.constructor===Object){let h=[];for(let f in l){let g=l[f];Object.defineProperty(g,"_KEY_",{value:f,enumerable:!0}),h.push(g)}u(h)}else console.warn("Symbiote list data type error:"),console.log(l)}),e.removeAttribute(d.LIST_ATTR),e.removeAttribute(d.LIST_ITEM_TAG_ATTR)})}function cr(r,i){[...r.querySelectorAll(`[${d.EL_REF_ATTR}]`)].forEach(e=>{let t=e.getAttribute(d.EL_REF_ATTR);i.ref[t]=e,e.removeAttribute(d.EL_REF_ATTR)})}function hr(r,i){[...r.querySelectorAll(`[${d.BIND_ATTR}]`)].forEach(e=>{e.getAttribute(d.BIND_ATTR).split(";").forEach(o=>{if(!o)return;let n=o.split(":").map(u=>u.trim()),l=n[0],a;l.indexOf(d.ATTR_BIND_PX)===0&&(a=!0,l=l.replace(d.ATTR_BIND_PX,""));let c=n[1].split(",").map(u=>u.trim());for(let u of c){let h;u.startsWith("!!")?(h="double",u=u.replace("!!","")):u.startsWith("!")&&(h="single",u=u.replace("!","")),!i.has(u)&&i.allowTemplateInits&&(u.startsWith(d.ATTR_BIND_PX)?i.add(u,i.getAttribute(u.replace(d.ATTR_BIND_PX,""))):i.add(u,null)),i.sub(u,f=>{h==="double"?f=!!f:h==="single"&&(f=!f),a?(f==null?void 0:f.constructor)===Boolean?f?e.setAttribute(l,""):e.removeAttribute(l):e.setAttribute(l,f):Oe(e,l,f)||(e[d.SET_LATER_KEY]||(e[d.SET_LATER_KEY]=Object.create(null)),e[d.SET_LATER_KEY][l]=f)},!(i.ssrMode&&(l==="textContent"||a)))}}),e.removeAttribute(d.BIND_ATTR)})}function ur(r){let i,e=[],t=document.createTreeWalker(r,NodeFilter.SHOW_TEXT,{acceptNode:s=>{var o;return!((o=s.parentElement)!=null&&o.hasAttribute(d.TEXT_NODE_SKIP_ATTR))&&s.textContent.includes(d.TEXT_NODE_OPEN_TOKEN)&&s.textContent.includes(d.TEXT_NODE_CLOSE_TOKEN)&&1}});for(;i=t.nextNode();)e.push(i);return e}var dr=function(r,i){ur(r).forEach(t=>{let s=[],o;for(;t.textContent.includes(d.TEXT_NODE_CLOSE_TOKEN);)t.textContent.startsWith(d.TEXT_NODE_OPEN_TOKEN)?(o=t.textContent.indexOf(d.TEXT_NODE_CLOSE_TOKEN)+d.TEXT_NODE_CLOSE_TOKEN.length,t.splitText(o),s.push(t)):(o=t.textContent.indexOf(d.TEXT_NODE_OPEN_TOKEN),t.splitText(o)),t=t.nextSibling;s.forEach(n=>{let l=n.textContent.replace(d.TEXT_NODE_OPEN_TOKEN,"").replace(d.TEXT_NODE_CLOSE_TOKEN,"");n.textContent="",!i.has(l)&&i.allowTemplateInits&&(l.startsWith(d.ATTR_BIND_PX)?(i.add(l,i.getAttribute(l.replace(d.ATTR_BIND_PX,""))),i.initAttributeObserver()):i.add(l,null)),i.sub(l,a=>{n.textContent=a})})})},Yt=[qt,cr,hr,dr];var Ye="'",we='"',fr=/\\([0-9a-fA-F]{1,6} ?)/g;function pr(r){return(r[0]===we||r[0]===Ye)&&(r[r.length-1]===we||r[r.length-1]===Ye)}function mr(r){return(r[0]===we||r[0]===Ye)&&(r=r.slice(1)),(r[r.length-1]===we||r[r.length-1]===Ye)&&(r=r.slice(0,-1)),r}function gr(r){let i="",e="";for(var t=0;t<r.length;t++){let s=r[t+1];r[t]==="\\"&&s==='"'?(i+='\\"',t++):r[t]==='"'&&e!=="\\"?i+='\\"':i+=r[t],e=r[t]}return i}function Zt(r){let i=r;pr(r)&&(i=mr(i),i=i.replace(fr,(e,t)=>String.fromCodePoint(parseInt(t.trim(),16))),i=i.replaceAll(`\\
28
+ `,"\\n"),i=gr(i),i=we+i+we);try{return JSON.parse(i)}catch{throw new Error(`Failed to parse CSS property value: ${i}. Original input: ${r}`)}}var _r=[d.LIST_ATTR,d.LIST_ITEM_TAG_ATTR,d.EL_REF_ATTR,d.USE_TPL_ATTR,d.CTX_NAME_ATTR,d.CTX_OWNER_ATTR];function w(r,...i){let e="";return r.forEach((t,s)=>{var o;if(e+=t,((o=i[s])==null?void 0:o.constructor)===Object){let n="";for(let l in i[s])_r.includes(l)?e+=` ${l}="${i[s][l]}"`:n+=`${l}:${i[s][l]};`;n&&(e+=` ${d.BIND_ATTR}="${n}"`)}else i[s]&&(e+=i[s])}),e}function F(r,...i){let e="",t=new CSSStyleSheet;return r.forEach((s,o)=>{e+=s+i[o]}),F.processors.forEach(s=>{e=s(e)}),F.clearProcessors(),t.replaceSync(e),t}F.processors=[];F.clearProcessors=function(){F.processors=[]};F.useProcessor=function(...r){return F.processors=[...F.processors,...r],F};var Qt=0,ke,he,Ie,re,ve,Le,se,B,ue,de,S,Pe,xt,q,ce,Ze,Jt,Qe,ei,Me,Et,Je,ti,Ne,Ct,D=class D extends HTMLElement{constructor(){super();v(this,Pe);v(this,Ze);v(this,Qe);v(this,Me);v(this,Je);v(this,Ne);v(this,ke,void 0);v(this,he,void 0);v(this,Ie,void 0);v(this,re,void 0);v(this,ve,void 0);v(this,Le,void 0);v(this,se,void 0);v(this,B,void 0);v(this,ue,void 0);v(this,de,void 0);v(this,S,this.constructor);m(this,"updateCssData",()=>{var e;this.dropCssDataCache(),(e=p(this,de))==null||e.forEach(t=>{let s=this.getCssData(E(this,Ne,Ct).call(this,t),!0);s!==null&&this.$[t]!==s&&(this.$[t]=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 D}initCallback(){}renderCallback(){}render(e,t=this.renderShadow){let s;if((t||p(this,S).shadowStyleSheets)&&!this.shadowRoot&&this.attachShadow({mode:"open"}),this.allowCustomTemplate){let n=this.getAttribute(d.USE_TPL_ATTR);if(n){let l=this.getRootNode(),a=(l==null?void 0:l.querySelector(n))||document.querySelector(n);a?e=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(e||p(this,S).template){if(p(this,S).template&&!p(this,S).__tpl&&(p(this,S).__tpl=document.createElement("template"),p(this,S).__tpl.innerHTML=p(this,S).template),(e==null?void 0:e.constructor)===DocumentFragment)s=e;else if((e==null?void 0:e.constructor)===String){let n=document.createElement("template");n.innerHTML=e,s=n.content.cloneNode(!0)}else p(this,S).__tpl&&(s=p(this,S).__tpl.content.cloneNode(!0));for(let n of this.tplProcessors)n(s,this)}let o=()=>{var n;s&&this.isVirtual?this.replaceWith(s):s&&(t&&this.shadowRoot.appendChild(s)||this.appendChild(s)),E(this,Pe,xt).call(this),(n=this.renderCallback)==null||n.call(this)};p(this,S).shadowStyleSheets&&(t=!0,this.shadowRoot.adoptedStyleSheets=[...p(this,S).shadowStyleSheets]),o()}addTemplateProcessor(e){this.tplProcessors.add(e)}get autoCtxName(){return p(this,he)||(C(this,he,ye.generate()),this.style.setProperty(d.CSS_CTX_PROP,`'${p(this,he)}'`)),p(this,he)}get cssCtxName(){return this.getCssData(d.CSS_CTX_PROP,!0)}get ctxName(){var t;let e=((t=this.getAttribute(d.CTX_NAME_ATTR))==null?void 0:t.trim())||this.cssCtxName||p(this,Ie)||this.autoCtxName;return C(this,Ie,e),e}get localCtx(){return p(this,re)||C(this,re,W.registerCtx({})),p(this,re)}get sharedCtx(){return W.getCtx(this.ctxName,!1)||W.registerCtx({},this.ctxName)}sub(e,t,s=!0){var l;let o=a=>{p(this,Me,Et)||t(a)},n=E(l=D,q,ce).call(l,e,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(e){var s;let t=E(s=D,q,ce).call(s,e,this);t.ctx.notify(t.name)}has(e){var s;let t=E(s=D,q,ce).call(s,e,this);return t.ctx.has(t.name)}add(e,t,s=!1){var n;let o=E(n=D,q,ce).call(n,e,this);o.ctx.add(o.name,t,s)}add$(e,t=!1){for(let s in e)this.add(s,e[s],t)}get $(){if(!p(this,ve)){let e=Object.create(null);C(this,ve,new Proxy(e,{set:(t,s,o)=>{var l;let n=E(l=D,q,ce).call(l,s,this);return n.ctx.pub(n.name,o),!0},get:(t,s)=>{var n;let o=E(n=D,q,ce).call(n,s,this);return o.ctx.read(o.name)}}))}return p(this,ve)}set$(e,t=!1){for(let s in e){let o=e[s];t||![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(e=>{for(let t of e)if(t.type==="attributes"){let s=d.ATTR_BIND_PX+t.attributeName;this.has(s)&&(this.$[s]=this.getAttribute(t.attributeName))}}),this.attributeMutationObserver.observe(this,{attributes:!0}))}connectedCallback(){E(this,Je,ti).call(this)}destroyCallback(){}disconnectedCallback(){this.connectedOnce&&(this.dropCssDataCache(),this.readyToDestroy&&(p(this,se)&&window.clearTimeout(p(this,se)),C(this,se,window.setTimeout(()=>{this.destroyCallback(),this.attributeMutationObserver&&this.attributeMutationObserver.disconnect();for(let e of this.allSubs)e.remove(),this.allSubs.delete(e);p(this,re)&&W.deleteCtx(p(this,re).uid);for(let e of this.tplProcessors)this.tplProcessors.delete(e)},100))))}static reg(e,t=!1){e||(Qt++,e=`${d.AUTO_TAG_PX}-${Qt}`),this.__tag=e;let s=window.customElements.get(e);if(s){!t&&s!==this&&console.warn([`Element with tag name "${e}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(`
29
+ `));return}window.customElements.define(e,t?class extends this{}:this)}static get is(){return this.__tag||this.reg(),this.__tag}static bindAttributes(e){this.observedAttributes=[...new Set((this.observedAttributes||[]).concat(Object.keys(e)))],this.__attrDesc=e}attributeChangedCallback(e,t,s){var n;if(t===s)return;let o=(n=p(this,S).__attrDesc)==null?void 0:n[e];o?p(this,Le)?this.$[o]=s:this.init$[o]=s:this[e]=s}getCssData(e,t=!1){if(p(this,B)||C(this,B,Object.create(null)),!Object.keys(p(this,B)).includes(e)){p(this,ue)||C(this,ue,window.getComputedStyle(this));let s=p(this,ue).getPropertyValue(e).trim();try{p(this,B)[e]=Zt(s)}catch{!t&&console.warn(`CSS Data error: ${e}`),p(this,B)[e]=null}}return p(this,B)[e]}bindCssData(e,t=""){p(this,de)||C(this,de,new Set),p(this,de).add(e);let s=this.getCssData(E(this,Ne,Ct).call(this,e),!0);s===null&&(s=t),e.startsWith(d.CSS_DATA_PX)?this.localCtx.add(e,s):this.add(e,s)}dropCssDataCache(){C(this,B,null),C(this,ue,null)}defineAccessor(e,t,s){let o="#"+e;this[o]=this[e],Object.defineProperty(this,e,{set:n=>{this[o]=n,s?window.setTimeout(()=>{t==null||t(n)}):t==null||t(n)},get:()=>this[o]}),this[e]=this[o]}static addRootStyles(e){this.rootStyleSheets||(this.rootStyleSheets=[]),this.rootStyleSheets.push(vt(e))}static addShadowStyles(e){this.shadowStyleSheets||(this.shadowStyleSheets=[]),this.shadowStyleSheets.push(vt(e))}static set rootStyles(e){this.rootStyleSheets=[],this.addRootStyles(e)}static set shadowStyles(e){this.shadowStyleSheets=[],this.addShadowStyles(e)}};ke=new WeakMap,he=new WeakMap,Ie=new WeakMap,re=new WeakMap,ve=new WeakMap,Le=new WeakMap,se=new WeakMap,B=new WeakMap,ue=new WeakMap,de=new WeakMap,S=new WeakMap,Pe=new WeakSet,xt=function(){var e;p(this,ke)||(C(this,ke,!0),(e=this.initCallback)==null||e.call(this))},q=new WeakSet,ce=function(e,t){var n;let s,o;if(e.startsWith(d.SHARED_CTX_PX))s=t.sharedCtx,o=e.replace(d.SHARED_CTX_PX,"");else if(e.startsWith(d.PARENT_CTX_PX)){o=e.replace(d.PARENT_CTX_PX,"");let l=t;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)||t.localCtx}else if(e.includes(d.NAMED_CTX_SPLTR)){let l=e.split(d.NAMED_CTX_SPLTR);s=W.getCtx(l[0]),o=l[1]}else e.startsWith(d.CSS_DATA_PX)?(s=t.localCtx,o=e,s.has(o)||t.bindCssData(o)):(s=t.localCtx,o=e);return{ctx:s,name:o}},Ze=new WeakSet,Jt=function(){return this.ctxOwner||this.hasAttribute(d.CTX_OWNER_ATTR)&&this.getAttribute(d.CTX_OWNER_ATTR)!=="false"},Qe=new WeakSet,ei=function(){let e=p(this,S).__attrDesc;if(e)for(let t of Object.values(e))Object.keys(this.init$).includes(t)||(this.init$[t]="");for(let t in this.init$)if(t.startsWith(d.SHARED_CTX_PX))this.sharedCtx.add(t.replace(d.SHARED_CTX_PX,""),this.init$[t],p(this,Ze,Jt));else if(t.startsWith(d.ATTR_BIND_PX))this.localCtx.add(t,this.getAttribute(t.replace(d.ATTR_BIND_PX,""))||this.init$[t]),this.initAttributeObserver();else if(t.includes(d.NAMED_CTX_SPLTR)){let s=t.split(d.NAMED_CTX_SPLTR),o=s[0].trim(),n=s[1].trim();if(o&&n){let l=W.getCtx(o,!1);l||(l=W.registerCtx({},o)),l.add(n,this.init$[t])}}else this.localCtx.add(t,this.init$[t]);for(let t in this.cssInit$)this.bindCssData(t,this.cssInit$[t]);C(this,Le,!0)},Me=new WeakSet,Et=function(){return!this.isVirtual&&!this.isConnected},Je=new WeakSet,ti=function(){var e;if(!p(this,Me,Et)){if(p(this,se)&&window.clearTimeout(p(this,se)),!this.connectedOnce){let t=(e=this.getAttribute(d.CTX_NAME_ATTR))==null?void 0:e.trim();if(t&&this.style.setProperty(d.CSS_CTX_PROP,`'${t}'`),E(this,Qe,ei).call(this),this[d.SET_LATER_KEY]){for(let s in this[d.SET_LATER_KEY])Oe(this,s,this[d.SET_LATER_KEY][s]);delete this[d.SET_LATER_KEY]}this.initChildren=[...this.childNodes];for(let s of Yt)this.addTemplateProcessor(s);if(this.pauseRender)E(this,Pe,xt).call(this);else{if(p(this,S).rootStyleSheets){let s=this.getRootNode();if(!s)return;let o=new Set([...s.adoptedStyleSheets,...p(this,S).rootStyleSheets]);s.adoptedStyleSheets=[...o]}this.render()}}this.connectedOnce=!0}},Ne=new WeakSet,Ct=function(e){return e.split("--").map((t,s)=>s===0?"":t).join("--")},v(D,q),m(D,"__tpl"),m(D,"template");var Tt=D,Re=Tt;function St(r){return Object.assign(d,r),d}function At(r,i){if(i.shadowRoot)return;let e=[...r.querySelectorAll("slot")];if(!e.length)return;let t={};e.forEach(s=>{let o=s.getAttribute("name")||d.DEFAULT_SLOT_KEY;t[o]={slot:s,fr:document.createDocumentFragment()}}),i.initChildren.forEach(s=>{var n;let o=d.DEFAULT_SLOT_KEY;s instanceof Element&&s.hasAttribute("slot")&&(o=s.getAttribute("slot"),s.removeAttribute("slot")),(n=t[o])==null||n.fr.appendChild(s)}),Object.values(t).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 $t=St({BIND_ATTR:"set",CTX_NAME_ATTR:"ctx-name",CSS_CTX_PROP:"--ctx-name"});var ii=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},et=(...r)=>r.filter(i=>typeof i=="string"&&i).map(i=>ii(i)).join("/-/"),Y=(...r)=>{let i=et(...r);return i?`-/${i}/`:""};function tt(r){let i=new URL(r),e=i.pathname+i.search+i.hash,t=e.lastIndexOf("http"),s=e.lastIndexOf("/"),o="";return t>=0?o=e.slice(t):s>=0&&(o=e.slice(s+1)),o}function it(r){let i=new URL(r),{pathname:e}=i,t=e.indexOf("/"),s=e.indexOf("/",t+1);return e.substring(t+1,s)}function Ot(r){let i=si(r),e=new URL(i),t=e.pathname.indexOf("/-/");return t===-1?"":e.pathname.substring(t).slice(1)}function ri(r){return Ot(r).split("/-/").filter(Boolean).map(e=>ii(e))}function si(r){let i=new URL(r),e=tt(r),t=oi(e)?ni(e).pathname:e;return i.pathname=i.pathname.replace(t,""),i.search="",i.hash="",i.toString()}function oi(r){return r.startsWith("http")}function ni(r){let i=new URL(r);return{pathname:i.origin+i.pathname||"",search:i.search||"",hash:i.hash||""}}var Z=(r,i,e)=>{let t=new URL(si(r));if(e=e||tt(r),t.pathname.startsWith("//")&&(t.pathname=t.pathname.replace("//","/")),oi(e)){let s=ni(e);t.pathname=t.pathname+(i||"")+(s.pathname||""),t.search=s.search,t.hash=s.hash}else t.pathname=t.pathname+(i||"")+(e||"");return t.toString()},kt=(r,i)=>{let e=new URL(r);return e.pathname=i+"/",e.toString()};var It=(r,i=",")=>r.trim().split(i).map(e=>e.trim()).filter(e=>e.length>0);var N=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}),ai=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function wr(r,i){if(typeof i=="number"){let e=i;return N[r]!==e?`${r}/${e}`:""}if(typeof i=="boolean"){let e=i;return N[r]!==e?`${r}`:""}if(r==="filter"&&i){let{name:e,amount:t}=i;return N.filter===t?"":`${r}/${e}/${t}`}if(r==="crop"&&i){let{dimensions:e,coords:t}=i;return`${r}/${e.join("x")}/${t.join(",")}`}return""}function oe(r){return et(...ai.filter(i=>typeof r[i]!="undefined"&&r[i]!==null).map(i=>{let e=r[i];return wr(i,e)}).filter(i=>!!i))}var rt=et("format/auto","progressive/yes"),Q=([r])=>typeof r!="undefined"?Number(r):void 0,li=()=>!0,vr=([r,i])=>({name:r,amount:typeof i!="undefined"?Number(i):100}),Tr=([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:It(r,"x").map(Number),coords:It(i).map(Number)}},xr=Object.freeze({enhance:Q,brightness:Q,exposure:Q,gamma:Q,contrast:Q,saturation:Q,vibrance:Q,warmth:Q,filter:vr,mirror:li,flip:li,rotate:Q,crop:Tr});function ci(r){let i={};for(let e of r){let[t,...s]=e.split("/");if(!ai.includes(t))continue;let o=t,n=xr[o];try{let l=n(s);i[o]=l}catch(l){console.warn([`Failed to parse URL operation "${e}". 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 T=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),L=[T.CROP,T.TUNING,T.FILTERS],hi=["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"],ui=["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"],di=["rotate","mirror","flip"],V=Object.freeze({brightness:{zero:N.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:N.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:N.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:N.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:N.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:N.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:N.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:N.enhance,range:[0,100],keypointsNumber:1},filter:{zero:N.filter,range:[0,100],keypointsNumber:1}});var fi=r=>r?r.split(",").map(i=>i.trim()):[],st=r=>r?r.join(","):"";var Er="https://ucarecdn.com",Cr="https://upload.uploadcare.com",Sr="https://social.uploadcare.com",z={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:st(L),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:!1,useLocalImageEditor:!1,useCloudImageEditor:!0,removeCopyright:!1,cropPreset:"",imageShrink:"",modalScrollLock:!0,modalBackdropStrokes:!1,sourceListWrap:!0,remoteTabSessionKey:"",cdnCname:Er,baseUrl:Cr,socialBaseUrl:Sr,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 ko=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"}),ot=class{constructor(i){m(this,"_timeoutStore",new Map);m(this,"_targets",new Set);m(this,"_debugPrint",null);this._debugPrint=i}bindTarget(i){this._targets.add(i)}unbindTarget(i){this._targets.delete(i)}_dispatch(i,e){var t;for(let s of this._targets)s.dispatchEvent(new CustomEvent(i,{detail:e}));(t=this._debugPrint)==null||t.call(this,()=>{let s=e&&typeof e=="object"?{...e}:e;return[`event "${i}"`,s]})}emit(i,e,{debounce:t}={}){if(typeof t!="number"&&!t){this._dispatch(i,typeof e=="function"?e():e);return}this._timeoutStore.has(i)&&window.clearTimeout(this._timeoutStore.get(i));let s=typeof t=="number"?t:20,o=window.setTimeout(()=>{this._dispatch(i,typeof e=="function"?e():e),this._timeoutStore.delete(i)},s);this._timeoutStore.set(i,o)}};function R(r,i){let e,t=(...s)=>{clearTimeout(e),e=setTimeout(()=>r(...s),i)};return t.cancel=()=>{clearTimeout(e)},t}var pi="--uploadcare-blocks-window-height",fe=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(pi)}};m(fe,"clientsRegistry",new Set),m(fe,"flush",R(()=>{document.documentElement.style.setProperty(pi,`${window.innerHeight}px`)},100));var mi=r=>{var t;let i=new Intl.Locale(r),e="ltr";return typeof i.getTextInfo=="function"&&i.getTextInfo().direction?e=i.getTextInfo().direction:"textInfo"in i&&((t=i.textInfo)!=null&&t.direction)&&(e=i.textInfo.direction),e};var gi=(r,i)=>new Intl.PluralRules(r).select(i);var Ar=r=>r,Lt="{{",bi="}}",_i="plural:";function Pt(r,i,e={}){var n;let{openToken:t=Lt,closeToken:s=bi,transform:o=Ar}=e;for(let l in i){let a=(n=i[l])==null?void 0:n.toString();r=r.replaceAll(t+l+s,typeof a=="string"?o(a):a)}return r}function yi(r){let i=[],e=r.indexOf(Lt);for(;e!==-1;){let t=r.indexOf(bi,e),s=r.substring(e+2,t);if(s.startsWith(_i)){let o=r.substring(e+2,t).replace(_i,""),n=o.substring(0,o.indexOf("(")),l=o.substring(o.indexOf("(")+1,o.indexOf(")"));i.push({variable:s,pluralKey:n,countVariable:l})}e=r.indexOf(Lt,t)}return i}function wi(){let r,i,e=new Promise((t,s)=>{r=t,i=s});return{resolve:r,reject:i,promise:e}}var vi=async({element:r,attribute:i,timeout:e=300})=>{let{promise:t,resolve:s}=wi(),o=r.getAttribute(i);if(o!==null)return s({success:!0,value:o,attribute:i}),t;let n=new MutationObserver(c=>{let u=c[c.length-1];a(u)});n.observe(r,{attributes:!0,attributeFilter:[i]});let l=setTimeout(()=>{n.disconnect(),s({success:!1,attribute:i})},e),a=c=>{let u=r.getAttribute(i);c.type==="attributes"&&c.attributeName===i&&u!==null&&(clearTimeout(l),n.disconnect(),s({success:!0,value:u,attribute:i}))};return t};var Ti=()=>({});var De={"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 nt=new Map,Mt=new Map,xi=(r,i)=>{nt.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`),nt.set(r,{...De,...i})},$r=(r,i)=>{Mt.set(r,i)},Or=(r,i)=>{typeof i=="function"?$r(r,i):xi(r,i)},Ei=async r=>{if(!nt.has(r)){if(!Mt.has(r))throw new Error(`Locale ${r} is not defined`);let e=await Mt.get(r)();xi(r,e)}return nt.get(r)};Or("en",De);var J=r=>`*l10n/${r}`,kr="en",lt=class{constructor(i){m(this,"_blockInstance",null);m(this,"_localeName","");m(this,"_callbacks",new Set);m(this,"_boundBlocks",new Map);this._blockInstance=i;for(let[e,t]of Object.entries(De))this._blockInstance.add(J(e),t,!1);setTimeout(()=>{i.subConfigValue("localeName",async e=>{var o;if(!this._blockInstance||!e)return;this._localeName=e;let t=await Ei(e);if(e!==kr&&this._localeName!==e)return;let s=(o=this._blockInstance.cfg.localeDefinitionOverride)==null?void 0:o[e];for(let[n,l]of Object.entries(t)){let a=s==null?void 0:s[n];this._blockInstance.add(J(n),a!=null?a:l,!0);for(let c of this._callbacks)c()}}),i.subConfigValue("localeDefinitionOverride",e=>{var s;if(!e)return;let t=e[this._localeName];if(t)for(let[o,n]of Object.entries(t)){(s=this._blockInstance)==null||s.add(J(o),n,!0);for(let l of this._callbacks)l()}})})}onLocaleChange(i){let e=R(i,0);return this._callbacks.add(e),()=>{this._callbacks.delete(e)}}bindL10n(i,e,t){var o,n,l;i.$[e]=t(),this._boundBlocks.has(i)||this._boundBlocks.set(i,new Map),(n=(o=this._boundBlocks.get(i))==null?void 0:o.get(e))==null||n();let s=this.onLocaleChange(()=>{i.$[e]=t()});(l=this._boundBlocks.get(i))==null||l.set(e,s)}destroyL10nBindings(i){let e=this._boundBlocks.get(i);if(e){for(let t of e.values())t();this._boundBlocks.delete(i)}}destroy(){this._callbacks.clear()}};var Ir={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function Ue(r,i){i.tabIndex=0,i.focus(),r.tabIndex=-1}function Nt(r){let i=r.role||r.type||r.tagName;if(!i)return null;let e=Ir[i.toLowerCase()];if(!e)return null;for(let t of e){let s=r.closest(`[role=${t}]`);if(s)return s}}function Rt(r,i){return i.role==="toolbar"?Lr(i):i.querySelectorAll(`[role=${r.role}]`)}function Lr(r){return[...r.querySelectorAll("*")].filter(e=>e.role==="button"||e.type==="button"||e.role==="checkbox"||e.type==="checkbox")}function Pr(r){let i=r.getAttribute("aria-orientation");if(i==="vertical")return!1;if(i==="horizontal")return!0;let e=r.role;return e==="menubar"||e==="tablist"||e==="toolbar"}function Ci(r){return i=>{let e=!1,t=(r==null?void 0:r.searchDelayMs)||300,s=0,o="";function n(h){let f=Nt(h.target);if(!f){l();return}let g=Rt(h.target,f),b=Array.from(g).indexOf(h.target),x="ArrowDown",I="ArrowUp";if(Pr(f)&&(i.document.dir==="rtl"?(x="ArrowLeft",I="ArrowRight"):(x="ArrowRight",I="ArrowLeft")),h.key===x)h.preventDefault(),Ue(h.target,g[b+1]||g[0]);else if(h.key===I)h.preventDefault(),Ue(h.target,g[b-1]||g[g.length-1]);else if(h.key==="Home")h.preventDefault(),Ue(h.target,g[0]);else if(h.key==="End")h.preventDefault(),Ue(h.target,g[g.length-1]);else if(h.key.length===1&&f.role!=="tablist"){let M=Date.now();M-s<=t?o+=h.key.toLowerCase():o=h.key.toLowerCase(),s=M;let ae=Array.from(g).find(ir=>{var Bt,Vt,Ht;return(Ht=(Vt=(Bt=ir.textContent)==null?void 0:Bt.trim())==null?void 0:Vt.toLowerCase())==null?void 0:Ht.startsWith(o)});ae&&(h.preventDefault(),Ue(h.target,ae))}}function l(){e=!1,i.removeEventListener("keydown",n)}function a(h){let f=Nt(h.target);if(f){e||(e=!0,i.addEventListener("keydown",n));let g=Rt(h.target,f);for(let b of g)b!==h.target&&b.setAttribute("tabindex",-1)}else e&&l()}function c(h){(!h.relatedTarget||h.relatedTarget===i.document)&&l()}function u(h){let f=Nt(h.target);if(f){let g=Rt(h.target,f);for(let b of g)b!==h.target&&b.setAttribute("tabindex",-1);h.target.setAttribute("tabindex",0)}}return i.addEventListener("click",u),i.addEventListener("focusin",a),i.addEventListener("focusout",c),()=>{l(),i.removeEventListener("click",u),i.removeEventListener("focusin",a),i.removeEventListener("focusout",c)}}}function Si(){return r=>{let i,e;function t(o){if(o.target.getAttribute("aria-hidden")==="true"){i=o.target,i.setAttribute("aria-hidden","false"),e=i.hidden,e&&(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"),e&&(i.hidden=!0),i=null)}return r.addEventListener("keyuxJump",t),r.addEventListener("focusout",s),()=>{r.removeEventListener("keyuxJump",t),r.removeEventListener("focusout",s)}}}function Ai(){return r=>{let i=[];function e(c){let u=r.document.activeElement;u&&u!==r.document.body&&i.push(new WeakRef(u)),c.focus({focusVisible:!0})}function t(){let c=i.pop();if(!c){r.document.activeElement.blur();return}let u=c.deref();u&&u.isConnected?u.focus():t()}let s=0,o;function n(c){clearInterval(o);let u=c.getAttribute("aria-controls");u&&(o=setInterval(()=>{if(s++>50){clearInterval(o);return}let h=r.document.getElementById(u);if(h){let f=h.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');f&&(clearInterval(o),h.dispatchEvent(new r.CustomEvent("keyuxJump",{bubbles:!0})),e(f))}},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"&&t()}return r.addEventListener("click",l),r.addEventListener("keydown",a),()=>{r.removeEventListener("click",l),r.removeEventListener("keydown",a)}}}function $i(r){let i,e=r.split(" ");function t(){i&&i.classList.remove(...e)}function s(o){o.clientX===0&&o.clientY===0&&(t(),o.target.classList.add(...e),i=o.target)}return o=>(o.addEventListener("keyup",t),o.addEventListener("click",s),()=>{o.removeEventListener("keyup",t),o.removeEventListener("click",s)})}function Oi(r,i){let e=i.map(t=>t(r));return()=>{e.forEach(t=>t())}}var Dt=class{constructor(){m(this,"_listeners",new Map);m(this,"_scope",[])}addEventListener(i,e){let t=s=>{let o=s.target;o&&this._scope.some(n=>n===s.target||n.contains(o))&&e(s)};this._listeners.set(e,t),window.addEventListener(i,t)}removeEventListener(i,e){let t=this._listeners.get(e);t&&window.removeEventListener(i,t),this._listeners.delete(e)}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,e)=>{window.removeEventListener("keydown",i),window.removeEventListener("keyup",i),this._listeners.delete(e)})}},at=class{constructor(){m(this,"_destroyKeyUX");m(this,"_scopedWindow");this._scopedWindow=new Dt,this._destroyKeyUX=Oi(this._scopedWindow,[Ci(),$i("is-pressed"),Ai(),Si()])}registerBlock(i){this._scopedWindow.registerScope(i)}destroy(){var i;(i=this._destroyKeyUX)==null||i.call(this),this._scopedWindow.destroy()}};function ki(r,i){[...r.querySelectorAll("[l10n]")].forEach(e=>{let t=e.getAttribute("l10n");if(!t)return;let s="textContent",o=!1;if(t.includes(":")){let a=t.split(":");s=a[0],t=a[1],s.startsWith("@")&&(s=s.slice(1),o=!0)}let n=t;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(f=>{f.remove(),c.delete(f),i.allSubs.delete(f)});let u=J(a).replace("*","");i.sharedCtx.has(u)||i.sharedCtx.add(u,a);let h=i.sharedCtx.sub(u,()=>{e[s]=i.l10n(a)});c==null||c.add(h),i.allSubs.add(h),e.removeAttribute("l10n")});let l=J(t);i.has(l)||i.add(l,""),i.sub(l,()=>{t=t,o?e.setAttribute(s,i.l10n(t)):e[s]=i.l10n(t)}),e.removeAttribute("l10n")})}var P=r=>`*cfg/${r}`;var Mr="uc-",y=class extends Re{constructor(){super();m(this,"requireCtxName",!1);m(this,"activityType",null);m(this,"init$",Ti());this.l10nProcessorSubs=new Map,this.addTemplateProcessor(ki),this.addTemplateProcessor(At)}l10n(e,t={}){if(!e)return"";let s=this.$[J(e)]||e,o=yi(s);for(let l of o)t[l.variable]=this.pluralize(l.pluralKey,Number(t[l.countVariable]));return Pt(s,t)}pluralize(e,t){let s=this.l10n("locale-id")||"en",o=gi(s,t);return this.l10n(`${e}__${o}`)}bindL10n(e,t){var s;(s=this.localeManager)==null||s.bindL10n(this,e,t)}emit(e,t,s){let o=this.has("*eventEmitter")&&this.$["*eventEmitter"];o&&o.emit(e,t,s)}hasBlockInCtx(e){for(let t of this.blocksRegistry)if(e(t))return!0;return!1}setOrAddState(e,t){this.add$({[e]:t},!0)}connectedCallback(){this.constructor.styleAttrs.forEach(t=>{this.setAttribute(t,"")}),this.hasAttribute("retpl")&&(this.constructor.template=null,this.processInnerHtml=!0),this.requireCtxName?vi({element:this,attribute:$t.CTX_NAME_ATTR}).then(t=>{t.success?super.connectedCallback():console.error(`Attribute "${$t.CTX_NAME_ATTR}" is required and it is not set.`)}):super.connectedCallback(),fe.registerClient(this)}disconnectedCallback(){super.disconnectedCallback(),fe.unregisterClient(this)}initCallback(){this.has("*blocksRegistry")||this.add("*blocksRegistry",new Set),this.$["*blocksRegistry"].add(this),this.has("*eventEmitter")||this.add("*eventEmitter",new ot(this.debugPrint.bind(this))),this.has("*localeManager")||this.add("*localeManager",new lt(this)),this.has("*a11y")||this.add("*a11y",new at),this.sub(J("locale-id"),t=>{let s=mi(t);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 t;super.destroyCallback();let e=this.blocksRegistry;e==null||e.delete(this),(t=this.localeManager)==null||t.destroyL10nBindings(this),this.l10nProcessorSubs=new Map,j.deleteCtx(this.localCtx.uid),(e==null?void 0:e.size)===0&&setTimeout(()=>{this.destroyCtxCallback()},0)}destroyCtxCallback(){var e;j.deleteCtx(this.ctxName),(e=this.localeManager)==null||e.destroy()}async proxyUrl(e){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(e,{uuid:it(e),cdnUrlModifiers:Ot(e),fileName:tt(e)})}catch(t){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",t),e}return this.cfg.secureDeliveryProxy?Pt(this.cfg.secureDeliveryProxy,{previewUrl:e},{transform:t=>window.encodeURIComponent(t)}):e}get cfg(){if(!this.__cfgProxy){let e=Object.create(null);this.__cfgProxy=new Proxy(e,{set:(t,s,o)=>{if(typeof s!="string")return!1;let n=P(s);return this.has(n)||this.add(n,z[s]),this.$[n]=o,!0},get:(t,s)=>{let o=P(s);return this.has(o)||this.add(o,z[s]),this.$[P(s)]}})}return this.__cfgProxy}subConfigValue(e,t){let s=P(e);this.has(s)||this.add(s,z[e]),this.sub(s,t)}debugPrint(...e){if(!this.cfg.debug)return;let t=e;if(typeof(e==null?void 0:e[0])=="function"){let s=e[0];t=s()}console.log(`[${this.ctxName}]`,...t)}static reg(e){if(!e){super.reg();return}e.startsWith(Mr)&&super.reg(e)}};m(y,"StateConsumerScope",null),m(y,"styleAttrs",[]);var H="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Ii(...r){return r.reduce((i,e)=>{if(typeof e=="string")return i[e]=!0,i;for(let t of Object.keys(e))i[t]=e[t];return i},{})}function A(...r){let i=Ii(...r);return Object.keys(i).reduce((e,t)=>(i[t]&&e.push(t),e),[]).join(" ")}function Li(r,...i){let e=Ii(...i);for(let t of Object.keys(e))r.classList.toggle(t,e[t])}var Pi=r=>{if(!r)return[];let[i,e]=r.split(":").map(Number);if(!Number.isFinite(i)||!Number.isFinite(e)){console.error(`Invalid crop preset: ${r}`);return}return[{type:"aspect-ratio",width:i,height:e}]};var Mi=r=>{if(!r)return L;let i=fi(r).filter(e=>L.includes(e));return i.length===0?L:i};function Ni(r){return{"*originalUrl":null,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":!1,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*tabList":L,"*tabId":T.CROP,entry:null,extension:null,editorMode:!1,modalCaption:"",isImage:!1,msg:"",src:H,fileType:"",showLoader:!1,uuid:null,cdnUrl:null,cropPreset:"",tabs:st(L),"presence.networkProblems":!1,"presence.modalCaption":!0,"presence.editorToolbar":!1,"presence.viewerToolbar":!0,"*on.retryNetwork":()=>{let i=r.querySelectorAll("img");for(let e of i){let t=e.src;e.src=H,e.src=t}r.$["*networkProblems"]=!1},"*on.apply":i=>{if(!i)return;let e=r.$["*originalUrl"],t=Y(oe(i),"preview"),s=Z(e,t),o={originalUrl:e,cdnUrlModifiers:t,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 Ri="<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 Di=w`${Ri} <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="${H}" 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 ne=class extends y{constructor(){super();m(this,"ctxOwner",!0);m(this,"_debouncedShowLoader",R(this._showLoader.bind(this),300));this.init$={...this.init$,...Ni(this)}}_showLoader(e){this.$.showLoader=e}_waitForSize(){return new Promise((t,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&&(t(),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 e=it(this.$.cdnUrl),t=kt(this.$.cdnUrl,e);if(t===this.$["*originalUrl"])return;this.$["*originalUrl"]=t;let s=ri(this.$.cdnUrl),o=ci(s);this.$["*editorTransformations"]=o}else if(this.$.uuid){let e=kt(this.cfg.cdnCname,this.$.uuid);if(e===this.$["*originalUrl"])return;this.$["*originalUrl"]=e,this.$["*editorTransformations"]={}}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===T.CROP?this.$["*cropperEl"].deactivate({reset:!0}):this.$["*faderEl"].deactivate();try{let e=await this.proxyUrl(Z(this.$["*originalUrl"],Y("json"))),t=await fetch(e).then(n=>n.json()),{width:s,height:o}=t;this.$["*imageSize"]={width:s,height:o},this.$["*tabId"]===T.CROP?this.$["*cropperEl"].activate(this.$["*imageSize"]):this.$["*faderEl"].activate({url:this.$["*originalUrl"]})}catch(e){e&&console.error("Failed to load image info",e)}}}async initEditor(){try{await this._waitForSize()}catch(e){this.isConnected&&console.error(e.message);return}this.ref["img-el"].addEventListener("load",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$.src!==H&&(this.$["*networkProblems"]=!1)}),this.ref["img-el"].addEventListener("error",()=>{this._imgLoading=!1,this._debouncedShowLoader(!1),this.$["*networkProblems"]=!0}),this.sub("src",e=>{let t=this.ref["img-el"];t.src!==e&&(this._imgLoading=!0,t.src=e||H)}),this.sub("cropPreset",e=>{this.$["*cropPresetList"]=Pi(e)}),this.sub("tabs",e=>{this.$["*tabList"]=Mi(e)}),this.sub("*tabId",e=>{this.ref["img-el"].className=A("uc-image",{"uc-image_hidden_to_cropper":e===T.CROP,"uc-image_hidden_effects":e!==T.CROP})}),this.classList.add("uc-editor_ON"),this.sub("*networkProblems",e=>{this.$["presence.networkProblems"]=e,this.$["presence.modalCaption"]=!e}),this.sub("*editorTransformations",e=>{if(Object.keys(e).length===0)return;let t=this.$["*originalUrl"],s=Y(oe(e),"preview"),o=Z(t,s),n={originalUrl:t,cdnUrlModifiers:s,cdnUrl:o,transformations:e};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:!0,composed:!0}))},!1),this.sub("uuid",e=>e&&this.updateImage()),this.sub("cdnUrl",e=>e&&this.updateImage())}};m(ne,"styleAttrs",["uc-cloud-image-editor"]);ne.template=Di;ne.bindAttributes({uuid:"uuid","cdn-url":"cdnUrl","crop-preset":"cropPreset",tabs:"tabs"});var Fe=33.333333333333336,_=1,Ut=24,Ui=6;function pe(r,i){for(let e in i)r.setAttributeNS(null,e,i[e].toString())}function U(r,i={}){let e=document.createElementNS("http://www.w3.org/2000/svg",r);return pe(e,i),e}function Fi(r,i,e){let{x:t,y:s,width:o,height:n}=r,l=i.includes("w")?0:1,a=i.includes("n")?0:1,c=[-1,1][l],u=[-1,1][a],h=[t+l*o+1.5*c,s+a*n+1.5*u-24*e*u],f=[t+l*o+1.5*c,s+a*n+1.5*u],g=[t+l*o-24*e*c+1.5*c,s+a*n+1.5*u];return{d:`M ${h[0]} ${h[1]} L ${f[0]} ${f[1]} L ${g[0]} ${g[1]}`,center:f}}function zi(r,i,e){let{x:t,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],u=[-1,1][a],h,f;["n","s"].includes(i)?(h=[t+l*o-34*e/2,s+a*n+1.5*u],f=[t+l*o+34*e/2,s+a*n+1.5*u]):(h=[t+l*o+1.5*c,s+a*n-34*e/2],f=[t+l*o+1.5*c,s+a*n+34*e/2]);let g=`M ${h[0]} ${h[1]} L ${f[0]} ${f[1]}`,b=[f[0]-(f[0]-h[0])/2,f[1]-(f[1]-h[1])/2];return{d:g,center:b}}function Xi(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 ji({rect:r,delta:[i,e],imageBox:t}){return xe({...r,x:r.x+i,y:r.y+e},t)}function xe(r,i){let{x:e}=r,{y:t}=r;return r.x<i.x?e=i.x:r.x+r.width>i.x+i.width&&(e=i.x+i.width-r.width),r.y<i.y?t=i.y:r.y+r.height>i.y+i.height&&(t=i.y+i.height-r.height),{...r,x:e,y:t}}function Nr({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[,s]=i,{y:o,width:n,height:l}=r;o+=s,l-=s,e&&(n=l*e);let a=r.x+r.width/2-n/2;return o<=t.y&&(o=t.y,l=r.y+r.height-o,e&&(n=l*e,a=r.x+r.width/2-n/2)),a<=t.x&&(a=t.x,o=r.y+r.height-l),a+n>=t.x+t.width&&(a=Math.max(t.x,t.x+t.width-n),n=t.x+t.width-a,e&&(l=n/e),o=r.y+r.height-l),l<_&&(l=_,e&&(n=l*e,a=r.x+r.width/2-n/2),o=r.y+r.height-l),n<_&&(n=_,e&&(l=n/e,a=r.x+r.width/2-n/2),o=r.y+r.height-l),{x:a,y:o,width:n,height:l}}function Rr({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[s]=i,{x:o,width:n,height:l}=r;o+=s,n-=s,e&&(l=n/e);let a=r.y+r.height/2-l/2;return o<=t.x&&(o=t.x,n=r.x+r.width-o,e&&(l=n/e,a=r.y+r.height/2-l/2)),a<=t.y&&(a=t.y,o=r.x+r.width-n),a+l>=t.y+t.height&&(a=Math.max(t.y,t.y+t.height-l),l=t.y+t.height-a,e&&(n=l*e),o=r.x+r.width-n),l<_&&(l=_,e&&(n=l*e),a=r.y+r.height/2-l/2,o=r.x+r.width-n),n<_&&(n=_,e&&(l=n/e),a=r.y+r.height/2-l/2,o=r.x+r.width-n),{x:o,y:a,width:n,height:l}}function Dr({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[,s]=i,{y:o,width:n,height:l}=r;l+=s,e&&(n=l*e);let a=r.x+r.width/2-n/2;return o+l>=t.y+t.height&&(l=t.y+t.height-o,e&&(n=l*e),a=r.x+r.width/2-n/2),a<=t.x&&(a=t.x,o=r.y),a+n>=t.x+t.width&&(a=Math.max(t.x,t.x+t.width-n),n=t.x+t.width-a,e&&(l=n/e),o=r.y),l<_&&(l=_,e&&(n=l*e),a=r.x+r.width/2-n/2),n<_&&(n=_,e&&(l=n/e),a=r.x+r.width/2-n/2),{x:a,y:o,width:n,height:l}}function Ur({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[s]=i,{x:o,width:n,height:l}=r;n+=s,e&&(l=n/e);let a=r.y+r.height/2-l/2;return o+n>=t.x+t.width&&(n=t.x+t.width-o,e&&(l=n/e),a=r.y+r.height/2-l/2),a<=t.y&&(a=t.y,o=r.x),a+l>=t.y+t.height&&(a=Math.max(t.y,t.y+t.height-l),l=t.y+t.height-a,e&&(n=l*e),o=r.x),l<_&&(l=_,e&&(n=l*e),a=r.y+r.height/2-l/2),n<_&&(n=_,e&&(l=n/e),a=r.y+r.height/2-l/2),{x:o,y:a,width:n,height:l}}function Fr({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[s,o]=i,{x:n,y:l,width:a,height:c}=r;return n+s<t.x&&(s=t.x-n),l+o<t.y&&(o=t.y-l),n+=s,a-=s,l+=o,c-=o,e&&Math.abs(a/c)>e?(o=a/e-c,c+=o,l-=o,l<=t.y&&(c=c-(t.y-l),a=c*e,n=r.x+r.width-a,l=t.y)):e&&(s=c*e-a,a=a+s,n-=s,n<=t.x&&(a=a-(t.x-n),c=a/e,n=t.x,l=r.y+r.height-c)),c<_&&(c=_,e&&(a=c*e),n=r.x+r.width-a,l=r.y+r.height-c),a<_&&(a=_,e&&(c=a/e),n=r.x+r.width-a,l=r.y+r.height-c),{x:n,y:l,width:a,height:c}}function zr({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[s,o]=i,{x:n,y:l,width:a,height:c}=r;return n+a+s>t.x+t.width&&(s=t.x+t.width-n-a),l+o<t.y&&(o=t.y-l),a+=s,l+=o,c-=o,e&&Math.abs(a/c)>e?(o=a/e-c,c+=o,l-=o,l<=t.y&&(c=c-(t.y-l),a=c*e,n=r.x,l=t.y)):e&&(s=c*e-a,a+=s,n+a>=t.x+t.width&&(a=t.x+t.width-n,c=a/e,n=t.x+t.width-a,l=r.y+r.height-c)),c<_&&(c=_,e&&(a=c*e),l=r.y+r.height-c),a<_&&(a=_,e&&(c=a/e),l=r.y+r.height-c),{x:n,y:l,width:a,height:c}}function Xr({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[s,o]=i,{x:n,y:l,width:a,height:c}=r;return n+s<t.x&&(s=t.x-n),l+c+o>t.y+t.height&&(o=t.y+t.height-l-c),n+=s,a-=s,c+=o,e&&Math.abs(a/c)>e?(o=a/e-c,c+=o,l+c>=t.y+t.height&&(c=t.y+t.height-l,a=c*e,n=r.x+r.width-a,l=t.y+t.height-c)):e&&(s=c*e-a,a+=s,n-=s,n<=t.x&&(a=a-(t.x-n),c=a/e,n=t.x,l=r.y)),c<_&&(c=_,e&&(a=c*e),n=r.x+r.width-a),a<_&&(a=_,e&&(c=a/e),n=r.x+r.width-a),{x:n,y:l,width:a,height:c}}function jr({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[s,o]=i,{x:n,y:l,width:a,height:c}=r;return n+a+s>t.x+t.width&&(s=t.x+t.width-n-a),l+c+o>t.y+t.height&&(o=t.y+t.height-l-c),a+=s,c+=o,e&&Math.abs(a/c)>e?(o=a/e-c,c+=o,l+c>=t.y+t.height&&(c=t.y+t.height-l,a=c*e,n=r.x,l=t.y+t.height-c)):e&&(s=c*e-a,a+=s,n+a>=t.x+t.width&&(a=t.x+t.width-n,c=a/e,n=t.x+t.width-a,l=r.y)),c<_&&(c=_,e&&(a=c*e)),a<_&&(a=_,e&&(c=a/e)),{x:n,y:l,width:a,height:c}}function Bi({direction:r,...i}){switch(r){case"n":return Nr(i);case"w":return Rr(i);case"s":return Dr(i);case"e":return Ur(i);case"nw":return Fr(i);case"ne":return zr(i);case"sw":return Xr(i);case"se":return jr(i);default:return i.rect}}function Vi(r,[i,e]){return r.x<=i&&i<=r.x+r.width&&r.y<=e&&e<=r.y+r.height}function Hi(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 Ki(r,i){return Math.abs(r.width/r.height-i)<.1}function Ee({width:r,height:i},e){let t=e/90%2!==0;return{width:t?i:r,height:t?r:i}}function Ce(r){return{x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)}}function le(r,i,e){return Math.min(Math.max(r,i),e)}var ht=class extends y{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 e=this.$["*imageBox"];if(!e)return;if(i===""&&e.height<=_&&e.width<=_)return!0;let t=e.height<=_&&(i.includes("n")||i.includes("s")),s=e.width<=_&&(i.includes("e")||i.includes("w"));return t||s}_createBackdrop(){let i=this.$["*cropBox"];if(!i)return;let{x:e,y:t,width:s,height:o}=i,n=this.ref["svg-el"],l=U("mask",{id:"backdrop-mask"}),a=U("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),c=U("rect",{x:e,y:t,width:s,height:o,fill:"black"});l.appendChild(a),l.appendChild(c);let u=U("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:"url(#backdrop-mask)"});n.appendChild(u),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:e,y:t,width:s,height:o}=i;this._backdropMaskInner&&pe(this._backdropMaskInner,{x:e,y:t,width:s,height:o})}_updateFrame(){let i=this.$["*cropBox"];if(!(!i||!this._frameGuides||!this._frameThumbs)){for(let e of Object.values(this._frameThumbs)){let{direction:t,pathNode:s,interactionNode:o,groupNode:n}=e,l=t==="",a=t.length===2,{x:c,y:u,width:h,height:f}=i;if(l){let b={x:c+h/3,y:u+f/3,width:h/3,height:f/3};pe(o,b)}else{let b=le(Math.min(h,f)/(24*2+34)/2,0,1),{d:x,center:I}=a?Fi(i,t,b):zi(i,t,b),M=Math.max(Ut*le(Math.min(h,f)/Ut/3,0,1),Ui);pe(o,{x:I[0]-M,y:I[1]-M,width:M*2,height:M*2}),pe(s,{d:x})}let g=this._shouldThumbBeDisabled(t);n.setAttribute("class",A("uc-thumb",{"uc-thumb--hidden":g,"uc-thumb--visible":!g}))}pe(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 e=0;e<3;e++)for(let t=0;t<3;t++){let s=`${["n","","s"][e]}${["w","","e"][t]}`,o=U("g");o.classList.add("uc-thumb"),o.setAttribute("with-effects","");let n=U("rect",{fill:"transparent"}),l=U("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=U("svg"),e=U("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});i.appendChild(e);for(let t=1;t<=2;t++){let s=U("line",{x1:`${Fe*t}%`,y1:"0%",x2:`${Fe*t}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});i.appendChild(s)}for(let t=1;t<=2;t++){let s=U("line",{x1:"0%",y1:`${Fe*t}%`,x2:"100%",y2:`${Fe*t}%`,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"],e=document.createDocumentFragment(),t=this._createGuides();e.appendChild(t);let s=this._createThumbs();for(let{groupNode:o}of Object.values(s))e.appendChild(o);i.appendChild(e),this._frameThumbs=s,this._frameGuides=t}_handlePointerDown(i,e){if(!this._frameThumbs)return;let t=this._frameThumbs[i];if(this._shouldThumbBeDisabled(i))return;let s=this.$["*cropBox"],{x:o,y:n}=this.ref["svg-el"].getBoundingClientRect(),l=e.x-o,a=e.y-n;this.$.dragging=!0,this._draggingThumb=t,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 e=this.ref["svg-el"],{x:t,y:s}=e.getBoundingClientRect(),o=i.x-t,n=i.y-s,l=o-this._dragStartPoint[0],a=n-this._dragStartPoint[1],{direction:c}=this._draggingThumb,u=this._calcCropBox(c,[l,a]);u&&(this.$["*cropBox"]=u)}_calcCropBox(i,e){var c,u;let[t,s]=e,o=this.$["*imageBox"],n=(c=this._dragStartCrop)!=null?c:this.$["*cropBox"],l=(u=this.$["*cropPresetList"])==null?void 0:u[0],a=l?l.width/l.height:void 0;if(i===""?n=ji({rect:n,delta:[t,s],imageBox:o}):n=Bi({rect:n,delta:[t,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 xe(Ce(n),this.$["*imageBox"])}_handleSvgPointerMove_(i){if(!this._frameThumbs)return;let e=Object.values(this._frameThumbs).find(t=>{if(this._shouldThumbBeDisabled(t.direction))return!1;let o=t.interactionNode.getBoundingClientRect(),n={x:o.x,y:o.y,width:o.width,height:o.height};return Vi(n,[i.x,i.y])});this._hoverThumb=e,this._updateCursor()}_updateCursor(){let i=this._hoverThumb;this.ref["svg-el"].style.cursor=i?Xi(i.direction):"initial"}_render(){this._updateBackdrop(),this._updateFrame()}toggleThumbs(i){this._frameThumbs&&Object.values(this._frameThumbs).map(({groupNode:e})=>e).forEach(e=>{e.setAttribute("class",A("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<=_||i.width<=_,window.requestAnimationFrame(()=>{this._render()}))}),this.sub("dragging",i=>{this._frameGuides&&this._frameGuides.setAttribute("class",A({"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)}};ht.template=w`<svg class="uc-svg" ref="svg-el" xmlns="http://www.w3.org/2000/svg"></svg>`;var ee=class extends y{constructor(){super(...arguments);m(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",e=>{this._titleEl&&(this._titleEl.style.display=e?"block":"none")}),this.sub("active",e=>{this.className=A({"uc-active":e,"uc-not_active":!e})}),this.sub("on.click",e=>{this.onclick=e})}};ee.template=w`<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 Vr(r){let i=r+90;return i=i>=360?0:i,i}function Hr(r,i){return r==="rotate"?Vr(i):["mirror","flip"].includes(r)?!i:null}var ze=class extends ee{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),e=Hr(this._operation,i);this.$["*cropperEl"].setValue(this._operation,e)}}};var Xe={FILTER:"filter",COLOR_OPERATION:"color_operation"},G="original",ut=class extends y{constructor(){super(...arguments);m(this,"init$",{...this.init$,disabled:!1,min:0,max:100,value:0,defaultValue:0,zero:0,"on.input":e=>{this.$["*faderEl"].set(e),this.$.value=e}})}setOperation(e,t){this._controlType=e==="filter"?Xe.FILTER:Xe.COLOR_OPERATION,this._operation=e,this._iconName=e,this._title=e.toUpperCase(),this._filter=t,this._initializeValues(),this.$["*faderEl"].activate({url:this.$["*originalUrl"],operation:this._operation,value:this._filter===G?void 0:this.$.value,filter:this._filter===G?void 0:this._filter,fromViewer:!1})}_initializeValues(){let{range:e,zero:t}=V[this._operation],[s,o]=e;this.$.min=s,this.$.max=o,this.$.zero=t;let n=this.$["*editorTransformations"][this._operation];if(this._controlType===Xe.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===Xe.COLOR_OPERATION){let l=typeof n!="undefined"?n:t;this.$.value=l,this.$.defaultValue=l}}apply(){let e;this._controlType===Xe.FILTER?this._filter===G?e=null:e={name:this._filter,amount:this.$.value}:e=this.$.value;let t={...this.$["*editorTransformations"],[this._operation]:e};this.$["*editorTransformations"]=t}cancel(){this.$["*faderEl"].deactivate({hide:!1})}initCallback(){super.initCallback(),this.sub("*originalUrl",e=>{this._originalUrl=e}),this.sub("value",e=>{let t=`${this._filter||this._operation} ${e}`;this.$["*operationTooltip"]=t})}};ut.template=w`<uc-slider-ui ref="slider-el" set="disabled: disabled; min: min; max: max; defaultValue: defaultValue; zero: zero; onInput: on.input;" ></uc-slider-ui>`;function je(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=H)}}}function Be(r){let i=[];for(let o of r){let n=je(o);i.push(n)}let e=i.map(o=>o.image);return{promise:Promise.allSettled(i.map(o=>o.promise)),images:e,cancel:()=>{i.forEach(o=>{o.cancel()})}}}var Se=class extends ee{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),e=window.devicePixelRatio,t=Math.ceil(e*i),s=e>=2?"lightest":"normal",o=100,n={...this.$["*editorTransformations"]};return n[this._operation]=this._filter!==G?{name:this._filter,amount:o}:void 0,Z(this._originalUrl,Y(rt,oe(n),`quality/${s}`,`scale_crop/${t}x${t}/center`))}async _observerCallback(i,e){var s;if(i[0].isIntersecting){let o=await this.proxyUrl(this._previewSrc()),n=this.ref["preview-el"],{promise:l,cancel:a}=je(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",""),e.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",e=>{this._operation="filter",this._filter=e,this.$.isOriginal=e===G,this.$.icon=this.$.isOriginal?"original":"slider",this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-filter",{name:e.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",e=>{this.$.active=e&&e===this._filter}),this.sub("active",e=>{if(this.$.isOriginal)return;let t=this.ref["icon-el"];t.style.opacity=e?"1":"0";let s=this.ref["preview-el"];e?s.style.opacity="0":s.style.backgroundImage&&(s.style.opacity="1")}),this.sub("*networkProblems",async e=>{if(!e){let t=await this.proxyUrl(this._previewSrc()),s=this.ref["preview-el"];s.style.backgroundImage&&(s.style.backgroundImage="none",s.style.backgroundImage=`url(${t})`)}})}destroyCallback(){var i,e;super.destroyCallback(),(i=this._observer)==null||i.disconnect(),(e=this._cancelPreload)==null||e.call(this)}};Se.template=w`<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 Ve=class extends ee{constructor(){super(...arguments);m(this,"_operation","")}initCallback(){super.initCallback(),this.$["on.click"]=()=>{this.$["*sliderEl"].setOperation(this._operation),this.$["*showSlider"]=!0,this.$["*currentOperation"]=this._operation},this.defineAccessor("operation",e=>{e&&(this._operation=e,this.$.icon=e,this.bindL10n("title-prop",()=>this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(e).toLowerCase()})),this.bindL10n("title",()=>this.l10n(e)))}),this.sub("*editorTransformations",e=>{if(!this._operation)return;let{zero:t}=V[this._operation],s=e[this._operation],o=typeof s!="undefined"?s!==t:!1;this.$.active=o})}};var Gi=(r,i)=>{let e,t,s,o=(...n)=>{e?(clearTimeout(t),t=setTimeout(()=>{Date.now()-s>=i&&(r(...n),s=Date.now())},Math.max(i-(Date.now()-s),0))):(r(...n),s=Date.now(),e=!0)};return Object.defineProperty(o,"cancel",{configurable:!1,writable:!1,enumerable:!1,value:()=>{clearTimeout(t)}}),o};function Wi(r,i){let e={};for(let t of i){let s=r[t];(r.hasOwnProperty(t)||s!==void 0)&&(e[t]=s)}return e}var qi="blocks",Yi="1.5.2";function Ae(r,i,e){let s=window.devicePixelRatio,o=Math.min(Math.ceil(i*s),3e3),n=s>=2?"lightest":"normal";return Z(r,Y(rt,oe(e),`quality/${n}`,`stretch/off/-/resize/${o}x`,`@clib/${qi}/${Yi}/uc-cloud-image-editor/`))}function Kr(r){return r?[({dimensions:e,coords:t})=>[...e,...t].every(s=>Number.isInteger(s)&&Number.isFinite(s)),({dimensions:e,coords:t})=>e.every(s=>s>0)&&t.every(s=>s>=0)].every(e=>e(r)):!0}var dt=class extends y{constructor(){super();m(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=R(this._commit.bind(this),300),this._handleResizeThrottled=Gi(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 e=this.$["*editorTransformations"],t=Wi(e,Object.keys(this.$["*operations"])),s={...this.$["*operations"],...t};this.$["*operations"]=s}_initCanvas(){let e=this.ref["canvas-el"],t=e.getContext("2d"),s=this.offsetWidth,o=this.offsetHeight,n=window.devicePixelRatio;e.style.width=`${s}px`,e.style.height=`${o}px`,e.width=s*n,e.height=o*n,t==null||t.scale(n,n),this._canvas=e,this._ctx=t}_alignImage(){if(!this._isActive||!this.$.image)return;let e=this.$.image,t=this.$["*padding"],s=this.$["*operations"],{rotate:o}=s,n={width:this.offsetWidth,height:this.offsetHeight},l=Ee({width:e.naturalWidth,height:e.naturalHeight},o),a;if(l.width>n.width-t*2||l.height>n.height-t*2){let c=l.width/l.height,u=n.width/n.height;if(c>u){let h=n.width-t*2,f=h/c,g=0+t,b=t+(n.height-t*2)/2-f/2;a={x:g,y:b,width:h,height:f}}else{let h=n.height-t*2,f=h*c,g=t+(n.width-t*2)/2-f/2,b=0+t;a={x:g,y:b,width:f,height:h}}}else{let{width:c,height:u}=l,h=t+(n.width-t*2)/2-c/2,f=t+(n.height-t*2)/2-u/2;a={x:h,y:f,width:c,height:u}}this.$["*imageBox"]=Ce(a)}_alignCrop(){var f;let e=this.$["*cropBox"],t=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,n=this.$["*editorTransformations"].crop,{width:l,x:a,y:c}=this.$["*imageBox"];if(n){let{dimensions:[g,b],coords:[x,I]}=n,{width:M}=Ee(this._imageSize,o),ae=l/M;e=xe(Ce({x:a+x*ae,y:c+I*ae,width:g*ae,height:b*ae}),this.$["*imageBox"])}let u=(f=this.$["*cropPresetList"])==null?void 0:f[0],h=u?u.width/u.height:void 0;if(!Hi(e,t)||h&&!Ki(e,h)){let g=t.width/t.height,b=t.width,x=t.height;h&&(g>h?b=Math.min(t.height*h,t.width):x=Math.min(t.width/h,t.height)),e={x:t.x+t.width/2-b/2,y:t.y+t.height/2-x/2,width:b,height:x}}this.$["*cropBox"]=xe(Ce(e),this.$["*imageBox"])}_drawImage(){let e=this._ctx;if(!e)return;let t=this.$.image,s=this.$["*imageBox"],o=this.$["*operations"],{mirror:n,flip:l,rotate:a}=o,c=Ee({width:s.width,height:s.height},a);e.save(),e.translate(s.x+s.width/2,s.y+s.height/2),e.rotate(a*Math.PI*-1/180),e.scale(n?-1:1,l?-1:1),e.drawImage(t,-c.width/2,-c.height/2,c.width,c.height),e.restore()}_draw(){if(!this._isActive||!this.$.image||!this._canvas||!this._ctx)return;let e=this._canvas;this._ctx.clearRect(0,0,e.width,e.height),this._drawImage()}_animateIn({fromViewer:e}){this.$.image&&(this.ref["frame-el"].toggleThumbs(!0),this._transitionToImage(),setTimeout(()=>{this.className=A({"uc-active_from_viewer":e,"uc-active_from_editor":!e,"uc-inactive_to_editor":!1})}))}_getCropDimensions(){let e=this.$["*cropBox"],t=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,{width:n,height:l}=t,{width:a,height:c}=Ee(this._imageSize,o),{width:u,height:h}=e,f=n/a,g=l/c;return[le(Math.round(u/f),1,a),le(Math.round(h/g),1,c)]}_getCropTransformation(){let e=this.$["*cropBox"],t=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,{width:n,height:l,x:a,y:c}=t,{width:u,height:h}=Ee(this._imageSize,o),{x:f,y:g}=e,b=n/u,x=l/h,I=this._getCropDimensions(),M={dimensions:I,coords:[le(Math.round((f-a)/b),0,u-I[0]),le(Math.round((g-c)/x),0,h-I[1])]};if(!Kr(M)){console.error("Cropper is trying to create invalid crop object",{payload:M});return}if(!(I[0]===u&&I[1]===h))return M}_commit(){if(!this.isConnected||!this._imageSize)return;let e=this.$["*operations"],{rotate:t,mirror:s,flip:o}=e,n=this._getCropTransformation(),a={...this.$["*editorTransformations"],crop:n,rotate:t,mirror:s,flip:o};this.$["*editorTransformations"]=a}setValue(e,t){this.$["*operations"]={...this.$["*operations"],[e]:t},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw())}getValue(e){return this.$["*operations"][e]}async activate(e,{fromViewer:t}={}){if(!this._isActive){this._isActive=!0,this._imageSize=e,this.removeEventListener("transitionend",this._reset);try{this.$.image=await this._waitForImage(this.$["*originalUrl"],this.$["*editorTransformations"]),this._syncTransformations(),this._animateIn({fromViewer:t})}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:e=!1}={}){var t;this._isActive&&(!e&&this._commit(),this._isActive=!1,this._transitionToCrop(),this.className=A({"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}),(t=this._observer)==null||t.disconnect())}_transitionToCrop(){let e=this._getCropDimensions(),t=Math.min(this.offsetWidth,e[0])/this.$["*cropBox"].width,s=Math.min(this.offsetHeight,e[1])/this.$["*cropBox"].height,o=Math.min(t,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 e=this.$["*cropBox"].x+this.$["*cropBox"].width/2,t=this.$["*cropBox"].y+this.$["*cropBox"].height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${t}px`}_reset(){this._isActive||(this.$.image=null)}async _waitForImage(e,t){var u;let s=this.offsetWidth;t={...t,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let o=await this.proxyUrl(Ae(e,s,t)),{promise:n,cancel:l,image:a}=je(o),c=this._handleImageLoading(o);return a.addEventListener("load",c,{once:!0}),a.addEventListener("error",c,{once:!0}),(u=this._cancelPreload)==null||u.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(e){let t="crop",s=this.$["*loadingOperations"];return s.get(t)||s.set(t,new Map),s.get(t).get(e)||(s.set(t,s.get(t).set(e,!0)),this.$["*loadingOperations"]=s),()=>{var o;(o=s==null?void 0:s.get(t))!=null&&o.has(e)&&(s.get(t).delete(e),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",e=>{e||this._isActive&&this.activate(this._imageSize,{fromViewer:!1})})},0)}destroyCallback(){var e;super.destroyCallback(),(e=this._observer)==null||e.disconnect()}};dt.template=w`<canvas class="uc-canvas" ref="canvas-el"></canvas><uc-crop-frame ref="frame-el"></uc-crop-frame>`;function Ft(r,i,e){let t=Array(e);e--;for(let s=e;s>=0;s--)t[s]=Math.ceil((s*i+(e-s)*r)/e);return t}function Gr(r){return r.reduce((i,e,t)=>t<r.length-1?[...i,[e,r[t+1]]]:i,[])}function Wr(r,i,e){let t=Gr(r).find(([s,o])=>s<=i&&i<=o);return r.map(s=>{let o=Math.abs(t[0]-t[1]),n=Math.abs(i-t[0])/o;return t[0]===s?i>e?1:1-n:t[1]===s?i>=e?n:1:0})}function qr(r,i){return r.map((e,t)=>e<i?r.length-t:t)}function Zi(r,i){let e=V[r].keypointsNumber,{range:t,zero:s}=V[r];return[...new Set([...Ft(t[0],s,e+1),...Ft(s,t[1],e+1),s,i])].sort((o,n)=>o-n)}var zt=class extends y{constructor(){super(),this._isActive=!1,this._hidden=!0,this._addKeypointDebounced=R(this._addKeypoint.bind(this),600),this.classList.add("uc-inactive_to_cropper")}_handleImageLoading(i){let e=this._operation,t=this.$["*loadingOperations"];return t.get(e)||t.set(e,new Map),t.get(e).get(i)||(t.set(e,t.get(e).set(i,!0)),this.$["*loadingOperations"]=t),()=>{var s;(s=t==null?void 0:t.get(e))!=null&&s.has(i)&&(t.get(e).delete(i),this.$["*loadingOperations"]=t)}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let i of this._keypoints){let{image:e}=i;e&&(e.style.opacity=i.opacity.toString(),e.style.zIndex=i.zIndex.toString())}})}async _imageSrc({url:i=this._url,filter:e=this._filter,operation:t,value:s}={}){let o={...this._transformations};t&&(o[t]=e?{name:e,amount:s}:s);let n=this.offsetWidth;return await this.proxyUrl(Ae(i,n,o))}async _constructKeypoint(i,e){return{src:await this._imageSrc({operation:i,value:e}),image:null,opacity:0,zIndex:0,value:e}}_isSame(i,e){return this._operation===i&&this._filter===e}async _addKeypoint(i,e,t){let s=()=>!this._isSame(i,e)||this._value!==t||!!this._keypoints.find(a=>a.value===t);if(s())return;let o=await this._constructKeypoint(i,t),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>t),u=c<a.length?a[c].image:null;!this._container||u&&!this._container.contains(u)||(a.splice(c,0,o),this._container.insertBefore(n,u),this._update(i,t))},{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,e){this._operation=i,this._value=e;let{zero:t}=V[i],s=this._keypoints.map(l=>l.value),o=Wr(s,e,t),n=qr(s,t);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 e=document.createElement("div");i.appendChild(e);let t=this._keypoints.map(c=>c.src),{images:s,promise:o,cancel:n}=Be(t);s.forEach(c=>{let u=this._handleImageLoading(c.src);c.addEventListener("load",u),c.addEventListener("error",u)}),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=e,this._keypoints.forEach((c,u)=>{let h=s[u];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 e=await this._imageSrc(),t=this._handleImageLoading(e);this._previewImage.src=e,this._previewImage.addEventListener("load",t,{once:!0}),this._previewImage.addEventListener("error",t,{once:!0}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}}async preload({url:i,filter:e,operation:t,value:s}){this._cancelBatchPreload&&this._cancelBatchPreload();let o=Zi(t,s),n=await Promise.all(o.map(a=>this._imageSrc({url:i,filter:e,operation:t,value:a}))),{cancel:l}=Be(n);this._cancelBatchPreload=l}_setOriginalSrc(i){let e=this._previewImage||this._createPreviewImage();if(!this.contains(e)&&this.appendChild(e),this._previewImage=e,e.src===i){e.style.opacity="1",e.style.transform="scale(1)",this.className=A({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1});return}e.style.opacity="0";let t=this._handleImageLoading(i);e.addEventListener("error",t,{once:!0}),e.src=i,e.addEventListener("load",()=>{t(),e&&(e.style.opacity="1",e.style.transform="scale(1)",this.className=A({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":!1}))},{once:!0}),e.addEventListener("error",()=>{this.$["*networkProblems"]=!0},{once:!0})}async activate({url:i,operation:e,value:t,filter:s,fromViewer:o}){if(this._isActive=!0,this._hidden=!1,this._url=i,this._operation=e||"initial",this._value=t,this._filter=s,this._fromViewer=o,typeof t!="number"&&!s){let l=await this._imageSrc({operation:e,value:t});this._setOriginalSrc(l),this._container&&this._container.remove();return}this._keypoints=await Promise.all(Zi(e,t).map(l=>this._constructKeypoint(e,l))),this._update(e,t),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=A({"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 Yr=1,ft=class extends y{initCallback(){super.initCallback(),this.addEventListener("wheel",i=>{i.preventDefault();let{deltaY:e,deltaX:t}=i;Math.abs(t)>Yr?this.scrollLeft+=t:this.scrollLeft+=e},{passive:!1}),this.addEventListener("scroll",()=>{},{passive:!0})}};ft.template=w`<slot></slot>`;function Zr(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 Qr(r){return w`<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 pt=class extends y{constructor(){super();m(this,"_updateInfoTooltip",R(()=>{var n,l;let e=this.$["*editorTransformations"],t=this.$["*currentOperation"],s="",o=!1;if(this.$["*tabId"]===T.FILTERS)if(o=!0,this.$["*currentFilter"]&&((n=e==null?void 0:e.filter)==null?void 0:n.name)===this.$["*currentFilter"]){let a=((l=e==null?void 0:e.filter)==null?void 0:l.amount)||100;s=this.$["*currentFilter"]+" "+a}else s=this.l10n(G);else if(this.$["*tabId"]===T.TUNING&&t){o=!0;let a=(e==null?void 0:e[t])||V[t].zero;s=this.l10n(t)+" "+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":G,"*currentOperation":null,showLoader:!1,filters:ui,colorOperations:hi,cropOperations:di,"*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 e;(e=this._cancelPreload)==null||e.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":e=>{let t=e.currentTarget.getAttribute("data-id");t&&this._activateTab(t,{fromViewer:!1})},tab_role:"tab",[`tab_${T.TUNING}`]:`tab_${T.TUNING}`,[`tab_${T.CROP}`]:`tab_${T.CROP}`,[`tab_${T.FILTERS}`]:`tab_${T.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=R(this._showLoader.bind(this),500)}_onSliderClose(){this.$["*showSlider"]=!1,this.$["*tabId"]===T.TUNING&&this.ref["tooltip-el"].classList.toggle("uc-info-tooltip_visible",!1)}_createOperationControl(e){let t=new Ve;return t.operation=e,t}_createFilterControl(e){let t=new Se;return t.filter=e,t}_createToggleControl(e){let t=new ze;return t.operation=e,t}_renderControlsList(e){let t=this.ref[`controls-list-${e}`],s=document.createDocumentFragment();e===T.CROP?this.$.cropOperations.forEach(o=>{let n=this._createToggleControl(o);s.appendChild(n)}):e===T.FILTERS?[G,...this.$.filters].forEach(o=>{let n=this._createFilterControl(o);s.appendChild(n)}):e===T.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")}),t.innerHTML="",t.appendChild(s)}_activateTab(e,{fromViewer:t}){this.$["*tabId"]=e,e===T.CROP?(this.$["*faderEl"].deactivate(),this.$["*cropperEl"].activate(this.$["*imageSize"],{fromViewer:t})):(this.$["*faderEl"].activate({url:this.$["*originalUrl"],fromViewer:t}),this.$["*cropperEl"].deactivate());for(let s of L){let o=s===e,n=this.ref[`tab-toggle-${s}`];n.active=o,o?(this._renderControlsList(e),this._syncTabIndicator()):this._unmountTabControls(s),this.$[`presence.tabContent.${s}`]=o}}_unmountTabControls(e){let t=this.ref[`controls-list-${e}`];t&&(t.innerHTML="")}_syncTabIndicator(){let e=this.ref[`tab-toggle-${this.$["*tabId"]}`],t=this.ref["tabs-indicator"];t.style.transform=`translateX(${e.offsetLeft}px)`}async _preloadEditedImage(){var e;if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,s=await this.proxyUrl(Ae(this.$["*originalUrl"],t,this.$["*editorTransformations"]));(e=this._cancelPreload)==null||e.call(this);let{cancel:o}=Be([s]);this._cancelPreload=()=>{o(),this._cancelPreload=void 0}}}_showLoader(e){this.$.showLoader=e}initCallback(){super.initCallback(),this.$["*sliderEl"]=this.ref["slider-el"],this.sub("*imageSize",e=>{e&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:!0})},0)}),this.sub("*editorTransformations",e=>{var s;let t=(s=e==null?void 0:e.filter)==null?void 0:s.name;this.$["*currentFilter"]!==t&&(this.$["*currentFilter"]=t!=null?t: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",e=>{this._preloadEditedImage(),this.$["*faderEl"]&&this.$["*faderEl"].setTransformations(e)}),this.sub("*loadingOperations",e=>{let t=!1;for(let[,s]of e.entries()){if(t)break;for(let[,o]of s.entries())if(o){t=!0;break}}this._debouncedShowLoader(t)}),this.sub("*showSlider",e=>{this.$["presence.subToolbar"]=e,this.$["presence.mainToolbar"]=!e}),this.sub("*tabList",e=>{this.$["presence.tabToggles"]=e.length>1;for(let t of L){this.$[`presence.tabToggle.${t}`]=e.includes(t);let s=this.ref[`tab-toggle-${t}`];s.style.gridColumn=e.indexOf(t)+1}e.includes(this.$["*tabId"])||this._activateTab(e[0],{fromViewer:!1})}),this._updateInfoTooltip()}};pt.template=w`<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">${L.map(Qr).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> ${L.map(Zr).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 He=class extends y{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 A("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)}};He.bindAttributes({text:"text",icon:"icon",reverse:"reverse",theme:"theme"});He.template=w`<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 mt=class extends y{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(),e=this.ref["line-el"];e.style.transition="transform 1s",e.style.opacity="1",e.style.transform=`translateX(${i}px)`,e.addEventListener("transitionend",this._handleTransitionEndRight,{once:!0})}_stop(){this._active=!1}};mt.template=w`<div class="uc-inner"><div class="uc-line" ref="line-el"></div></div>`;var gt={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},_t=class extends y{constructor(){super(),this._visible=!1,this._visibleStyle=gt.visible,this._hiddenStyle=gt.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",Li(this,{[gt.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(gt.transition),this._handleVisible(),setTimeout(()=>{this.classList.toggle("uc-initial",!1)},0)}};_t.template=w`<slot></slot>`;var bt=class extends y{constructor(){super();m(this,"init$",{...this.init$,disabled:!1,min:0,max:100,onInput:null,onChange:null,defaultValue:null,"on.sliderInput":()=>{let e=parseInt(this.ref["input-el"].value,10);this._updateValue(e),this.$.onInput&&this.$.onInput(e)},"on.sliderChange":()=>{let e=parseInt(this.ref["input-el"].value,10);this.$.onChange&&this.$.onChange(e)}});this.setAttribute("with-effects","")}initCallback(){super.initCallback(),this.defineAccessor("disabled",t=>{this.$.disabled=t}),this.defineAccessor("min",t=>{this.$.min=t}),this.defineAccessor("max",t=>{this.$.max=t}),this.defineAccessor("defaultValue",t=>{this.$.defaultValue=t,this.ref["input-el"].value=t,this._updateValue(t)}),this.defineAccessor("zero",t=>{this._zero=t}),this.defineAccessor("onInput",t=>{t&&(this.$.onInput=t)}),this.defineAccessor("onChange",t=>{t&&(this.$.onChange=t)}),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps();let t=parseInt(this.ref["input-el"].value,10);this._updateValue(t)}),this._observer.observe(this),this._thumbSize=parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10),setTimeout(()=>{let t=parseInt(this.ref["input-el"].value,10);this._updateValue(t)},0),this.sub("disabled",t=>{let s=this.ref["input-el"];t?s.setAttribute("disabled","disabled"):s.removeAttribute("disabled")});let e=this.ref["input-el"];e.addEventListener("focus",()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)")}),e.addEventListener("blur",()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)")})}_updateValue(e){this._updateZeroDot(e);let{width:t}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(e-this.$.min)*(t-this._thumbSize)/100;window.requestAnimationFrame(()=>{this.ref["thumb-el"].style.transform=`translateX(${n}px)`})}_updateZeroDot(e){if(!this._zeroDotEl)return;e===this._zero?this._zeroDotEl.style.opacity="0":this._zeroDotEl.style.opacity="0.2";let{width:t}=this.getBoundingClientRect(),n=100/(this.$.max-this.$.min)*(this._zero-this.$.min)*(t-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl.style.transform=`translateX(${n}px)`})}_updateSteps(){let t=this.ref["steps-el"],{width:s}=t.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 u=document.createElement("div");u.className="uc-zero-dot",l.appendChild(u),this._zeroDotEl=u,t.innerHTML="",t.appendChild(l),this._stepsCount=n}destroyCallback(){var e;super.destroyCallback(),(e=this._observer)==null||e.disconnect()}};bt.template=w`<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 Ke=class Ke extends ne{initCallback(){var i;super.initCallback(),(i=this.a11y)==null||i.registerBlock(this)}};m(Ke,"styleAttrs",[...Kt(Ke,Ke,"styleAttrs"),"uc-wgt-common"]);var Qi=Ke;var Ge=class extends y{constructor(){super(),this.init$={...this.init$,name:"",href:""}}initCallback(){super.initCallback(),this.sub("name",i=>{if(!i)return;let e=`#uc-icon-${i}`;this.subConfigValue("iconHrefResolver",t=>{if(t){let s=t(i);e=s!=null?s:e}this.$.href=e})})}};Ge.template=w`<svg ref="svg" xmlns="http://www.w3.org/2000/svg"><use set="@href: href;"></use></svg>`;Ge.bindAttributes({name:"name"});var Jr=["Symbiote","BaseComponent","UploaderBlock","ActivityBlock","Block","SolutionBlock"];function es(r){for(let i in r){if(Jr.includes(i))continue;let e=[...i].reduce((t,s)=>(s.toUpperCase()===s&&(s="-"+s.toLowerCase()),t+=s),"");e.startsWith("-")&&(e=e.replace("-","")),e.startsWith("uc-")||(e="uc-"+e),r[i].reg&&r[i].reg(e)}}var yt=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(e=>e.toLowerCase()).join("-")};var $=r=>String(r),X=r=>{let i=Number(r);if(Number.isNaN(i))throw new Error(`Invalid number: "${r}"`);return i},O=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}"`)},ts=r=>r==="auto"?r:O(r),is=r=>{let i=$(r);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid "cameraCapture" value: "${i}"`);return i},rs=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.")},ss=r=>{if(typeof r=="object")return r;throw new Error("Invalid value. Must be an object.")},Xt=r=>{if(typeof r=="function")return r;throw new Error("Invalid value. Must be a function.")},Ji=r=>{if(Array.isArray(r))return r;throw new Error("Must be an array.")},os={pubkey:$,multiple:O,multipleMin:X,multipleMax:X,confirmUpload:O,imgOnly:O,accept:$,externalSourcesPreferredTypes:$,store:ts,cameraMirror:O,cameraCapture:is,sourceList:$,maxLocalFileSizeBytes:X,thumbSize:X,showEmptyList:O,useLocalImageEditor:O,useCloudImageEditor:O,cloudImageEditorTabs:$,removeCopyright:O,cropPreset:$,imageShrink:$,modalScrollLock:O,modalBackdropStrokes:O,sourceListWrap:O,remoteTabSessionKey:$,cdnCname:$,baseUrl:$,socialBaseUrl:$,secureSignature:$,secureExpire:$,secureDeliveryProxy:$,retryThrottledRequestMaxTimes:X,multipartMinFileSize:X,multipartChunkSize:X,maxConcurrentRequests:X,multipartMaxConcurrentRequests:X,multipartMaxAttempts:X,checkForUrlDuplicates:O,saveUrlForRecurrentUploads:O,groupOutput:O,userAgentIntegration:$,debug:O,localeName:$,metadata:rs,secureUploadsExpireThreshold:X,localeDefinitionOverride:ss,secureUploadsSignatureResolver:Xt,secureDeliveryProxyUrlResolver:Xt,iconHrefResolver:Xt,fileValidators:Ji,collectionValidators:Ji},er=(r,i)=>{if(!(typeof i=="undefined"||i===null))try{return os[r](i)}catch(e){return console.error(`Invalid value for config key "${r}".`,e),z[r]}};var jt=[...new Set(["debug",...Object.keys(z)])],ns=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators"],ls=r=>ns.includes(r),$e=jt.filter(r=>!ls(r)),as={...Object.fromEntries($e.map(r=>[yt(r),r])),...Object.fromEntries($e.map(r=>[r.toLowerCase(),r]))},cs={...Object.fromEntries($e.map(r=>[yt(r),P(r)])),...Object.fromEntries($e.map(r=>[r.toLowerCase(),P(r)]))},tr=r=>"__"+r,We=class extends y{constructor(){super();m(this,"requireCtxName",!0);this.init$={...this.init$,...Object.fromEntries(Object.entries(z).map(([e,t])=>[P(e),t]))}}_flushValueToAttribute(e,t){if($e.includes(e)){let s=[...new Set([yt(e),e.toLowerCase()])];for(let o of s)typeof t=="undefined"||t===null?this.removeAttribute(o):this.getAttribute(o)!==t.toString()&&this.setAttribute(o,t.toString())}}_flushValueToState(e,t){this.$[P(e)]!==t&&(typeof t=="undefined"||t===null?this.$[P(e)]=z[e]:this.$[P(e)]=t)}_setValue(e,t){let s=this,o=er(e,t),n=tr(e);s[n]!==o&&(this._assertSameValueDifferentReference(e,s[n],o),s[n]=o,this._flushValueToAttribute(e,o),this._flushValueToState(e,o),this.debugPrint(`[uc-config] "${e}"`,o))}_getValue(e){let t=this,s=tr(e);return t[s]}_assertSameValueDifferentReference(e,t,s){this.cfg.debug&&s!==t&&typeof s=="object"&&typeof t=="object"&&JSON.stringify(s)===JSON.stringify(t)&&(console.warn(`[uc-config] Option "${e}" 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] "${e}" previous value:`,t),console.warn(`[uc-config] "${e}" new value:`,s))}initCallback(){var t;super.initCallback();let e=this;for(let s of $e)this.sub(P(s),o=>{this._setValue(s,o)},!1);for(let s of jt){let o=(t=e[s])!=null?t:this.$[P(s)];o!==z[s]&&this._setValue(s,o),Object.defineProperty(this,s,{set:n=>{this._setValue(s,n)},get:()=>this._getValue(s)})}}attributeChangedCallback(e,t,s){if(t===s)return;let o=this,n=as[e];o[n]=s}};We.bindAttributes(cs);for(let r of jt)We.prototype[r]=void 0;var hs=We;export{He as BtnUi,Qi as CloudImageEditor,ne as CloudImageEditorBlock,hs as Config,ht as CropFrame,ze as EditorCropButtonControl,Se as EditorFilterControl,dt as EditorImageCropper,zt as EditorImageFader,Ve as EditorOperationControl,ft as EditorScroller,ut as EditorSlider,pt as EditorToolbar,Ge as Icon,mt as LineLoaderUi,_t as PresenceToggle,bt as SliderUi,es as defineComponents};