@uploadcare/file-uploader 1.30.0-alpha.2 → 1.30.0-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.
Files changed (66) hide show
  1. package/dist/abstract/loadFileUploaderFrom.js +2 -2
  2. package/dist/env.js +3 -3
  3. package/dist/index.css +3 -3
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.js +4 -4
  6. package/dist/index.layered.css +3 -3
  7. package/dist/index.ssr.js +1 -1
  8. package/dist/locales/file-uploader/ar.js +2 -2
  9. package/dist/locales/file-uploader/az.js +2 -2
  10. package/dist/locales/file-uploader/ca.js +2 -2
  11. package/dist/locales/file-uploader/cs.js +2 -2
  12. package/dist/locales/file-uploader/da.js +2 -2
  13. package/dist/locales/file-uploader/de.js +2 -2
  14. package/dist/locales/file-uploader/el.js +2 -2
  15. package/dist/locales/file-uploader/en.js +2 -2
  16. package/dist/locales/file-uploader/es.js +2 -2
  17. package/dist/locales/file-uploader/et.js +2 -2
  18. package/dist/locales/file-uploader/fi.js +2 -2
  19. package/dist/locales/file-uploader/fr.js +2 -2
  20. package/dist/locales/file-uploader/he.js +2 -2
  21. package/dist/locales/file-uploader/hy.js +2 -2
  22. package/dist/locales/file-uploader/is.js +2 -2
  23. package/dist/locales/file-uploader/it.js +2 -2
  24. package/dist/locales/file-uploader/ja.js +2 -2
  25. package/dist/locales/file-uploader/ka.js +2 -2
  26. package/dist/locales/file-uploader/kk.js +2 -2
  27. package/dist/locales/file-uploader/ko.js +2 -2
  28. package/dist/locales/file-uploader/lv.js +2 -2
  29. package/dist/locales/file-uploader/nb.js +2 -2
  30. package/dist/locales/file-uploader/nl.js +2 -2
  31. package/dist/locales/file-uploader/pl.js +2 -2
  32. package/dist/locales/file-uploader/pt.js +2 -2
  33. package/dist/locales/file-uploader/ro.js +2 -2
  34. package/dist/locales/file-uploader/ru.js +2 -2
  35. package/dist/locales/file-uploader/sk.js +2 -2
  36. package/dist/locales/file-uploader/sr.js +2 -2
  37. package/dist/locales/file-uploader/sv.js +2 -2
  38. package/dist/locales/file-uploader/tr.js +2 -2
  39. package/dist/locales/file-uploader/uk.js +2 -2
  40. package/dist/locales/file-uploader/vi.js +2 -2
  41. package/dist/locales/file-uploader/zh-TW.js +2 -2
  42. package/dist/locales/file-uploader/zh.js +2 -2
  43. package/package.json +1 -1
  44. package/web/file-uploader.iife.min.d.ts +1 -1
  45. package/web/file-uploader.iife.min.js +4 -4
  46. package/web/file-uploader.min.d.ts +1 -1
  47. package/web/file-uploader.min.js +4 -4
  48. package/web/uc-basic.layered.min.css +3 -3
  49. package/web/uc-basic.min.css +3 -3
  50. package/web/uc-cloud-image-editor.layered.min.css +3 -3
  51. package/web/uc-cloud-image-editor.min.css +3 -3
  52. package/web/uc-cloud-image-editor.min.d.ts +1 -1
  53. package/web/uc-cloud-image-editor.min.js +3 -3
  54. package/web/uc-file-uploader-inline.layered.min.css +3 -3
  55. package/web/uc-file-uploader-inline.min.css +3 -3
  56. package/web/uc-file-uploader-inline.min.d.ts +1 -1
  57. package/web/uc-file-uploader-inline.min.js +4 -4
  58. package/web/uc-file-uploader-minimal.layered.min.css +3 -3
  59. package/web/uc-file-uploader-minimal.min.css +3 -3
  60. package/web/uc-file-uploader-minimal.min.d.ts +1 -1
  61. package/web/uc-file-uploader-minimal.min.js +4 -4
  62. package/web/uc-file-uploader-regular.layered.min.css +3 -3
  63. package/web/uc-file-uploader-regular.min.css +3 -3
  64. package/web/uc-file-uploader-regular.min.d.ts +1 -1
  65. package/web/uc-file-uploader-regular.min.js +4 -4
  66. package/web/uc-img.min.js +3 -3
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
- * Package: @uploadcare/file-uploader@1.30.0-alpha.2 (MIT)
3
+ * Package: @uploadcare/file-uploader@1.30.0-alpha.5 (MIT)
4
4
  * License: https://github.com/uploadcare/blob/main/LICENSE
5
- * Built: 2026-04-08T04:22:00.155Z
5
+ * Built: 2026-04-09T13:11:50.893Z
6
6
  */
7
- var Ls=Object.defineProperty;var Ms=Object.getOwnPropertyDescriptor;var p=(r,i,t,e)=>{for(var s=e>1?void 0:e?Ms(i,t):i,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=(e?n(i,t,s):n(s))||s);return e&&s&&Ls(i,t,s),s};var ue=globalThis,pe=ue.ShadowRoot&&(ue.ShadyCSS===void 0||ue.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Di=Symbol(),_i=new WeakMap,de=class{constructor(i,t,e){if(this.ys=true,e!==Di)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=i,this.t=t;}get styleSheet(){let i=this.o,t=this.t;if(pe&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=_i.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&_i.set(t,i));}return i}toString(){return this.cssText}},Fi=r=>new de(typeof r=="string"?r:r+"",void 0,Di);var Ki=(r,i)=>{if(pe)r.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),s=ue.litNonce;s!==void 0&&e.setAttribute("nonce",s),e.textContent=t.cssText,r.appendChild(e);}},si=pe?r=>r:r=>r instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return Fi(t)})(r):r;var{is:Is,defineProperty:Ps,getOwnPropertyDescriptor:$s,getOwnPropertyNames:Us,getOwnPropertySymbols:Ns,getPrototypeOf:_s}=Object,he=globalThis,Vi=he.trustedTypes,Ds=Vi?Vi.emptyScript:"",Fs=he.reactiveElementPolyfillSupport,jt=(r,i)=>r,zt={toAttribute(r,i){switch(i){case Boolean:r=r?Ds:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r);}return r},fromAttribute(r,i){let t=r;switch(i){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r);}catch{t=null;}}return t}},fe=(r,i)=>!Is(r,i),ji={attribute:true,type:String,converter:zt,reflect:false,useDefault:false,hasChanged:fe};Symbol.metadata??=Symbol("metadata"),he.litPropertyMetadata??=new WeakMap;var Z=class extends HTMLElement{static addInitializer(i){this.Rt(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.Be&&[...this.Be.keys()]}static createProperty(i,t=ji){if(t.state&&(t.attribute=false),this.Rt(),this.prototype.hasOwnProperty(i)&&((t=Object.create(t)).wrapped=true),this.elementProperties.set(i,t),!t.noAccessor){let e=Symbol(),s=this.getPropertyDescriptor(i,e,t);s!==void 0&&Ps(this.prototype,i,s);}}static getPropertyDescriptor(i,t,e){let{get:s,set:o}=$s(this.prototype,i)??{get(){return this[t]},set(n){this[t]=n;}};return {get:s,set(n){let a=s?.call(this);o?.call(this,n),this.requestUpdate(i,a,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??ji}static Rt(){if(this.hasOwnProperty(jt("elementProperties")))return;let i=_s(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(jt("finalized")))return;if(this.finalized=true,this.Rt(),this.hasOwnProperty(jt("properties"))){let t=this.properties,e=[...Us(t),...Ns(t)];for(let s of e)this.createProperty(s,t[s]);}let i=this[Symbol.metadata];if(i!==null){let t=litPropertyMetadata.get(i);if(t!==void 0)for(let[e,s]of t)this.elementProperties.set(e,s);}this.Be=new Map;for(let[t,e]of this.elementProperties){let s=this.Lt(t,e);s!==void 0&&this.Be.set(s,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(i){let t=[];if(Array.isArray(i)){let e=new Set(i.flat(1/0).reverse());for(let s of e)t.unshift(si(s));}else i!==void 0&&t.push(si(i));return t}static Lt(i,t){let e=t.attribute;return e===false?void 0:typeof e=="string"?e:typeof i=="string"?i.toLowerCase():void 0}constructor(){super(),this.Ge=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.ge=null,this.gs();}gs(){this.Mt=new Promise(i=>this.enableUpdating=i),this.ie=new Map,this.vs(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this.Oe??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.Oe?.delete(i);}vs(){let i=new Map,t=this.constructor.elementProperties;for(let e of t.keys())this.hasOwnProperty(e)&&(i.set(e,this[e]),delete this[e]);i.size>0&&(this.Ge=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ki(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.Oe?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this.Oe?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.It(i,e);}bs(i,t){let e=this.constructor.elementProperties.get(i),s=this.constructor.Lt(i,e);if(s!==void 0&&e.reflect===true){let o=(e.converter?.toAttribute!==void 0?e.converter:zt).toAttribute(t,e.type);this.ge=i,o==null?this.removeAttribute(s):this.setAttribute(s,o),this.ge=null;}}It(i,t){let e=this.constructor,s=e.Be.get(i);if(s!==void 0&&this.ge!==s){let o=e.getPropertyOptions(s),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:zt;this.ge=s;let a=n.fromAttribute(t,o.type);this[s]=a??this.Pt?.get(s)??a,this.ge=null;}}requestUpdate(i,t,e,s=false,o){if(i!==void 0){let n=this.constructor;if(s===false&&(o=this[i]),e??=n.getPropertyOptions(i),!((e.hasChanged??fe)(o,t)||e.useDefault&&e.reflect&&o===this.Pt?.get(i)&&!this.hasAttribute(n.Lt(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.Mt=this.Ts());}C(i,t,{useDefault:e,reflect:s,wrapped:o},n){e&&!(this.Pt??=new Map).has(i)&&(this.Pt.set(i,n??t??this[i]),o!==true||n!==void 0)||(this.ie.has(i)||(this.hasUpdated||e||(t=void 0),this.ie.set(i,t)),s===true&&this.ge!==i&&(this.Li??=new Set).add(i));}async Ts(){this.isUpdatePending=true;try{await this.Mt;}catch(t){Promise.reject(t);}let i=this.scheduleUpdate();return i!=null&&await i,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this.Ge){for(let[s,o]of this.Ge)this[s]=o;this.Ge=void 0;}let e=this.constructor.elementProperties;if(e.size>0)for(let[s,o]of e){let{wrapped:n}=o,a=this[s];n!==true||this.ie.has(s)||a===void 0||this.C(s,void 0,o,a);}}let i=false,t=this.ie;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.Oe?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.$t();}catch(e){throw i=false,this.$t(),e}i&&this.xs(t);}willUpdate(i){}xs(i){this.Oe?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}$t(){this.ie=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.Mt}shouldUpdate(i){return true}update(i){this.Li&&=this.Li.forEach(t=>this.bs(t,this[t])),this.$t();}updated(i){}firstUpdated(i){}};Z.elementStyles=[],Z.shadowRootOptions={mode:"open"},Z[jt("elementProperties")]=new Map,Z[jt("finalized")]=new Map,Fs?.({ReactiveElement:Z}),(he.reactiveElementVersions??=[]).push("2.1.2");var ni=globalThis,zi=r=>r,me=ni.trustedTypes,Hi=me?me.createPolicy("lit-html",{createHTML:r=>r}):void 0,ai="$lit$",Q=`lit$${Math.random().toFixed(9).slice(2)}$`,li="?"+Q,Ks=`<${li}>`,wt=document,Bt=()=>wt.createComment(""),Gt=r=>r===null||typeof r!="object"&&typeof r!="function",ci=Array.isArray,Yi=r=>ci(r)||typeof r?.[Symbol.iterator]=="function",oi=`[ \f\r]`,Ht=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Bi=/-->/g,Gi=/>/g,bt=RegExp(`>|${oi}(?:([^\\s"'>=/]+)(${oi}*=${oi}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),qi=/'/g,Wi=/"/g,Zi=/^(?:script|style|textarea|title)$/i,ui=r=>(i,...t)=>({re:r,strings:i,values:t}),m=ui(1),D=Symbol.for("lit-noChange"),T=Symbol.for("lit-nothing"),Xi=new WeakMap,Tt=wt.createTreeWalker(wt,129);function Qi(r,i){if(!ci(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Hi!==void 0?Hi.createHTML(i):i}var Ji=(r,i)=>{let t=r.length-1,e=[],s,o=i===2?"<svg>":i===3?"<math>":"",n=Ht;for(let a=0;a<t;a++){let l=r[a],c,d,u=-1,h=0;for(;h<l.length&&(n.lastIndex=h,d=n.exec(l),d!==null);)h=n.lastIndex,n===Ht?d[1]==="!--"?n=Bi:d[1]!==void 0?n=Gi:d[2]!==void 0?(Zi.test(d[2])&&(s=RegExp("</"+d[2],"g")),n=bt):d[3]!==void 0&&(n=bt):n===bt?d[0]===">"?(n=s??Ht,u=-1):d[1]===void 0?u=-2:(u=n.lastIndex-d[2].length,c=d[1],n=d[3]===void 0?bt:d[3]==='"'?Wi:qi):n===Wi||n===qi?n=bt:n===Bi||n===Gi?n=Ht:(n=bt,s=void 0);let f=n===bt&&r[a+1].startsWith("/>")?" ":"";o+=n===Ht?l+Ks:u>=0?(e.push(c),l.slice(0,u)+ai+l.slice(u)+Q+f):l+Q+(u===-2?a:f);}return [Qi(r,o+(r[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},qt=class r{constructor({strings:i,re:t},e){let s;this.parts=[];let o=0,n=0,a=i.length-1,l=this.parts,[c,d]=Ji(i,t);if(this.el=r.createElement(c,e),Tt.currentNode=this.el.content,t===2||t===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes);}for(;(s=Tt.nextNode())!==null&&l.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(let u of s.getAttributeNames())if(u.endsWith(ai)){let h=d[n++],f=s.getAttribute(u).split(Q),v=/([.?@])?(.*)/.exec(h);l.push({type:1,index:o,name:v[2],strings:f,ctor:v[1]==="."?ge:v[1]==="?"?ve:v[1]==="@"?be:Et}),s.removeAttribute(u);}else u.startsWith(Q)&&(l.push({type:6,index:o}),s.removeAttribute(u));if(Zi.test(s.tagName)){let u=s.textContent.split(Q),h=u.length-1;if(h>0){s.textContent=me?me.emptyScript:"";for(let f=0;f<h;f++)s.append(u[f],Bt()),Tt.nextNode(),l.push({type:2,index:++o});s.append(u[h],Bt());}}}else if(s.nodeType===8)if(s.data===li)l.push({type:2,index:o});else {let u=-1;for(;(u=s.data.indexOf(Q,u+1))!==-1;)l.push({type:7,index:o}),u+=Q.length-1;}o++;}}static createElement(i,t){let e=wt.createElement("template");return e.innerHTML=i,e}};function xt(r,i,t=r,e){if(i===D)return i;let s=e!==void 0?t.Es?.[e]:t.Cs,o=Gt(i)?void 0:i.Ut;return s?.constructor!==o&&(s?.Mi?.(false),o===void 0?s=void 0:(s=new o(r),s.Nt(r,t,e)),e!==void 0?(t.Es??=[])[e]=s:t.Cs=s),s!==void 0&&(i=xt(r,s.Ss(r,i.values),s,e)),i}var ye=class{constructor(i,t){this.Ii=[],this.S=void 0,this.Pi=i,this.n=t;}get parentNode(){return this.n.parentNode}get g(){return this.n.g}u(i){let{el:{content:t},parts:e}=this.Pi,s=(i?.creationScope??wt).importNode(t,true);Tt.currentNode=s;let o=Tt.nextNode(),n=0,a=0,l=e[0];for(;l!==void 0;){if(n===l.index){let c;l.type===2?c=new Lt(o,o.nextSibling,this,i):l.type===1?c=new l.ctor(o,l.name,l.strings,this,i):l.type===6&&(c=new Te(o,this,i)),this.Ii.push(c),l=e[++a];}n!==l?.index&&(o=Tt.nextNode(),n++);}return Tt.currentNode=wt,s}p(i){let t=0;for(let e of this.Ii)e!==void 0&&(e.strings!==void 0?(e._(i,e,t),t+=e.strings.length-2):e._(i[t])),t++;}},Lt=class r{get g(){return this.n?.g??this.$i}constructor(i,t,e,s){this.type=2,this.e=T,this.S=void 0,this.q=i,this.ve=t,this.n=e,this.options=s,this.$i=s?.isConnected??true;}get parentNode(){let i=this.q.parentNode,t=this.n;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.q}get endNode(){return this.ve}_(i,t=this){i=xt(this,i,t),Gt(i)?i===T||i==null||i===""?(this.e!==T&&this.be(),this.e=T):i!==this.e&&i!==D&&this.Ui(i):i.re!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):Yi(i)?this.k(i):this.Ui(i);}O(i){return this.q.parentNode.insertBefore(i,this.ve)}T(i){this.e!==i&&(this.be(),this.e=this.O(i));}Ui(i){this.e!==T&&Gt(this.e)?this.q.nextSibling.data=i:this.T(wt.createTextNode(i)),this.e=i;}$(i){let{values:t,re:e}=i,s=typeof e=="number"?this.ks(i):(e.el===void 0&&(e.el=qt.createElement(Qi(e.h,e.h[0]),this.options)),e);if(this.e?.Pi===s)this.e.p(t);else {let o=new ye(s,this),n=o.u(this.options);o.p(t),this.T(n),this.e=o;}}ks(i){let t=Xi.get(i.strings);return t===void 0&&Xi.set(i.strings,t=new qt(i)),t}k(i){ci(this.e)||(this.e=[],this.be());let t=this.e,e,s=0;for(let o of i)s===t.length?t.push(e=new r(this.O(Bt()),this.O(Bt()),this,this.options)):e=t[s],e._(o),s++;s<t.length&&(this.be(e&&e.ve.nextSibling,s),t.length=s);}be(i=this.q.nextSibling,t){for(this.qe?.(false,true,t);i!==this.ve;){let e=zi(i).nextSibling;zi(i).remove(),i=e;}}setConnected(i){this.n===void 0&&(this.$i=i,this.qe?.(i));}},Et=class{get tagName(){return this.element.tagName}get g(){return this.n.g}constructor(i,t,e,s,o){this.type=1,this.e=T,this.S=void 0,this.element=i,this.name=t,this.n=s,this.options=o,e.length>2||e[0]!==""||e[1]!==""?(this.e=Array(e.length-1).fill(new String),this.strings=e):this.e=T;}_(i,t=this,e,s){let o=this.strings,n=false;if(o===void 0)i=xt(this,i,t,0),n=!Gt(i)||i!==this.e&&i!==D,n&&(this.e=i);else {let a=i,l,c;for(i=o[0],l=0;l<o.length-1;l++)c=xt(this,a[e+l],t,l),c===D&&(c=this.e[l]),n||=!Gt(c)||c!==this.e[l],c===T?i=T:i!==T&&(i+=(c??"")+o[l+1]),this.e[l]=c;}n&&!s&&this.j(i);}j(i){i===T?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},ge=class extends Et{constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===T?void 0:i;}},ve=class extends Et{constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==T);}},be=class extends Et{constructor(i,t,e,s,o){super(i,t,e,s,o),this.type=5;}_(i,t=this){if((i=xt(this,i,t,0)??T)===D)return;let e=this.e,s=i===T&&e!==T||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,o=i!==T&&(e===T||s);s&&this.element.removeEventListener(this.name,this,e),o&&this.element.addEventListener(this.name,this,i),this.e=i;}handleEvent(i){typeof this.e=="function"?this.e.call(this.options?.host??this.element,i):this.e.handleEvent(i);}},Te=class{constructor(i,t,e){this.element=i,this.type=6,this.S=void 0,this.n=t,this.options=e;}get g(){return this.n.g}_(i){xt(this,i);}},Vs=ni.litHtmlPolyfillSupport;Vs?.(qt,Lt),(ni.litHtmlVersions??=[]).push("3.3.2");var er=(r,i,t)=>{let e=t?.renderBefore??i,s=e.Os;if(s===void 0){let o=t?.renderBefore??null;e.Os=s=new Lt(i.insertBefore(Bt(),o),o,void 0,t??{});}return s._(r),s};var di=globalThis,at=class extends Z{constructor(){super(...arguments),this.renderOptions={host:this},this._t=void 0;}createRenderRoot(){let i=super.createRenderRoot();return this.renderOptions.renderBefore??=i.firstChild,i}update(i){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(i),this._t=er(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._t?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._t?.setConnected(false);}render(){return D}};at.ln=true,at.finalized=true,di.litElementHydrateSupport?.({LitElement:at});var js=di.litElementPolyfillSupport;js?.({LitElement:at});(di.litElementVersions??=[]).push("4.2.2");var zs={attribute:true,type:String,converter:zt,reflect:false,hasChanged:fe},Hs=(r=zs,i,t)=>{let{kind:e,metadata:s}=t,o=globalThis.litPropertyMetadata.get(s);if(o===void 0&&globalThis.litPropertyMetadata.set(s,o=new Map),e==="setter"&&((r=Object.create(r)).wrapped=true),o.set(t.name,r),e==="accessor"){let{name:n}=t;return {set(a){let l=i.get.call(this);i.set.call(this,a),this.requestUpdate(n,l,r,true,a);},init(a){return a!==void 0&&this.C(n,void 0,r,a),a}}}if(e==="setter"){let{name:n}=t;return function(a){let l=this[n];i.call(this,a),this.requestUpdate(n,l,r,true,a);}}throw Error("Unsupported decorator location: "+e)};function g(r){return (i,t)=>typeof t=="object"?Hs(r,i,t):((e,s,o)=>{let n=s.hasOwnProperty(o);return s.constructor.createProperty(o,e),n?Object.getOwnPropertyDescriptor(s,o):void 0})(r,i,t)}function y(r){return g({...r,state:true,attribute:false})}var ir=r=>r.strings===void 0;var lt={ATTRIBUTE:1,CHILD:2},z=r=>(...i)=>({Ut:r,values:i}),q=class{constructor(i){}get g(){return this.n.g}Nt(i,t,e){this.We=i,this.n=t,this.Rs=e;}Ss(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var Wt=(r,i)=>{let t=r.S;if(t===void 0)return false;for(let e of t)e.Mi?.(i,false),Wt(e,i);return true},xe=r=>{let i,t;do{if((i=r.n)===void 0)break;t=i.S,t.delete(r),r=i;}while(t?.size===0)},rr=r=>{for(let i;i=r.n;r=i){let t=i.S;if(t===void 0)i.S=t=new Set;else if(t.has(r))break;t.add(r),qs(i);}};function Bs(r){this.S!==void 0?(xe(this),this.n=r,rr(this)):this.n=r;}function Gs(r,i=false,t=0){let e=this.e,s=this.S;if(s!==void 0&&s.size!==0)if(i)if(Array.isArray(e))for(let o=t;o<e.length;o++)Wt(e[o],false),xe(e[o]);else e!=null&&(Wt(e,false),xe(e));else Wt(this,r);}var qs=r=>{r.type==lt.CHILD&&(r.qe??=Gs,r.As??=Bs);},Ee=class extends q{constructor(){super(...arguments),this.S=void 0;}Nt(i,t,e){super.Nt(i,t,e),rr(this),this.isConnected=i.g;}Mi(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(Wt(this,i),xe(this));}setValue(i){if(ir(this.We))this.We._(i,this);else {let t=[...this.We.e];t[this.Rs]=i,this.We._(t,this,0);}}disconnected(){}reconnected(){}};var C=()=>new hi,hi=class{},pi=new WeakMap,k=z(class extends Ee{render(r){return T}update(r,[i]){let t=i!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=i,this.ht=r.options?.host,this.rt(this.ct=r.element)),T}rt(r){if(this.isConnected||(r=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=pi.get(i);t===void 0&&(t=new WeakMap,pi.set(i,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,r),r!==void 0&&this.G.call(this.ht,r);}else this.G.value=r;}get lt(){return typeof this.G=="function"?pi.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0);}reconnected(){this.rt(this.ct);}});var Ct=class extends q{constructor(i){if(super(i),this.it=T,i.type!==lt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===T||i==null)return this.Ni=void 0,this.it=i;if(i===D)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.Ni;this.it=i;let t=[i];return t.raw=t,this.Ni={re:this.constructor.resultType,strings:t,values:[]}}};Ct.directiveName="unsafeHTML",Ct.resultType=1;var Xt=class extends Ct{};Xt.directiveName="unsafeSVG",Xt.resultType=2;var sr=z(Xt);function Yt(r,i,t){return r?i(r):t?.(r)}var or;(function(r){r.Token="token",r.FileInfo="file_info";})(or||(or={}));var nr;(function(r){r.Unknown="unknown",r.Waiting="waiting",r.Progress="progress",r.Error="error",r.Success="success";})(nr||(nr={}));var Ce=class{Xe=1;Dt=[];Ye=0;Ft=new Map;Kt=new Map;constructor(i){this.Xe=i;}run(){let i=this.Xe-this.Ye;for(let t=0;t<i;t++){let e=this.Dt.shift();if(!e)return;let s=this.Ft.get(e),o=this.Kt.get(e);if(!s||!o)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.Ye+=1,e().finally(()=>{this.Ft.delete(e),this.Kt.delete(e),this.Ye-=1,this.run();}).then(n=>s(n)).catch(n=>o(n));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,s)=>{this.Ft.set(i,e),this.Kt.set(i,s),this.Dt.push(i),t&&this.run();})}get pending(){return this.Dt.length}get running(){return this.Ye}set concurrency(i){this.Xe=i,this.run();}get concurrency(){return this.Xe}};var ar=()=>({});var lr=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var x=r=>`*cfg/${r}`;var St=r=>r?r.split(",").map(i=>i.trim()).filter(Boolean):[],kt=r=>r.join(",");var cr=r=>{if(typeof r!="string"||!r)return "";let i=r.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},Se=(...r)=>r.filter(i=>typeof i=="string"&&!!i).map(i=>cr(i)).join("/-/"),J=(...r)=>{let i=Se(...r);return i?`-/${i}/`:""};function ke(r){let i=new URL(r),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),s=t.lastIndexOf("/"),o="";return e>=0?o=t.slice(e):s>=0&&(o=t.slice(s+1)),o}function Oe(r){let i=new URL(r),{pathname:t}=i,e=t.indexOf("/"),s=t.indexOf("/",e+1);return t.substring(e+1,s)}function fi(r){let i=ur(r),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}function mi(r){return fi(r).split("/-/").filter(Boolean).map(t=>cr(t))}function ur(r){let i=new URL(r),t=ke(r),e=dr(t)?pr(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function dr(r){return r.startsWith("http")}function pr(r){let i=new URL(r);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}var tt=(r,i,t)=>{let e=new URL(ur(r)),s=ke(r),o=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),s&&dr(s)){let n=pr(s);e.pathname=`${e.pathname}${o}${n.pathname||""}`,e.search=n.search,e.hash=n.hash;}else e.pathname=`${e.pathname}${o}${s||""}`;return e.toString()},yi=(r,i)=>{let t=new URL(r);return t.pathname=`${i}/`,t.toString()};var Zt=(r,i=",")=>r.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var Qt=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:false,flip:false,crop:void 0}),fr=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Ws(r,i){if(typeof i=="number"){let t=i;return Qt[r]!==t?`${r}/${t}`:""}if(typeof i=="boolean"){let t=i;return Qt[r]!==t?`${r}`:""}if(r==="filter"&&i){let{name:t,amount:e}=i;return Qt.filter===e?"":`${r}/${t}/${e}`}if(r==="crop"&&i){let{dimensions:t,coords:e}=i;return `${r}/${t.join("x")}/${e.join(",")}`}return ""}function ct(r){return Se(...fr.filter(i=>typeof r[i]<"u"&&r[i]!==null).map(i=>{let t=r[i];return Ws(i,t)}).filter(i=>!!i))}var Ae=Se("format/auto","progressive/yes"),et=([r])=>typeof r<"u"?Number(r):void 0,hr=()=>true,Xs=([r,i])=>({name:r,amount:typeof i<"u"?Number(i):100}),Ys=([r,i])=>{if(!/\d+x\d+/.test(r)||!/\d+,\d+/.test(i))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return {dimensions:Zt(r,"x").map(Number),coords:Zt(i).map(Number)}},Zs=Object.freeze({enhance:et,brightness:et,exposure:et,gamma:et,contrast:et,saturation:et,vibrance:et,warmth:et,filter:Xs,mirror:hr,flip:hr,rotate:et,crop:r=>{let[i,t]=r,{dimensions:e,coords:s}=Ys([i,t]);return {dimensions:e,coords:s}}});function gi(r){let i={};for(let t of r){let[e,...s]=t.split("/");if(!e||!fr.includes(e))continue;let o=e,n=Zs[o];try{let a=n(s);i[o]=a;}catch(a){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,a instanceof Error?`Error message: "${a.message}"`:a,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return i}var O=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),$=Object.freeze([O.CROP,O.TUNING,O.FILTERS]),mr=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),yr=Object.freeze(["adaris","briaril","calarel","carris","cynarel","cyren","elmet","elonni","enzana","erydark","fenralan","ferand","galen","gavin","gethriel","iorill","iothari","iselva","jadis","lavra","misiara","namala","nerion","nethari","pamaya","sarnar","sedis","sewen","sorahel","sorlen","tarian","thellassan","varriel","varven","vevera","virkas","yedis","yllara","zatvel","zevcen"]),gr=Object.freeze(["rotate","mirror","flip"]),it=Qt,H=Object.freeze({brightness:{zero:it.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:it.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:it.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:it.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:it.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:it.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:it.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:it.enhance,range:[0,100],keypointsNumber:1},filter:{zero:it.filter,range:[0,100],keypointsNumber:1}});var vi="https://ucarecdn.com",Qs="https://upload.uploadcare.com",Js="https://social.uploadcare.com",to="https://ucarecd.net",eo={pubkey:"",multiple:true,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:false,imgOnly:false,accept:"",externalSourcesPreferredTypes:"",externalSourcesEmbedCss:"",store:"auto",cameraMirror:false,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",topLevelOrigin:"",cloudImageEditorTabs:kt($),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:false,useLocalImageEditor:false,useCloudImageEditor:true,removeCopyright:false,cropPreset:"",imageShrink:"",modalScrollLock:true,modalBackdropStrokes:false,sourceListWrap:true,remoteTabSessionKey:"",cdnCname:vi,cdnCnamePrefixed:to,baseUrl:Qs,socialBaseUrl:Js,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:3,retryNetworkErrorMaxTimes:3,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:false,saveUrlForRecurrentUploads:false,groupOutput:false,userAgentIntegration:"",debug:false,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:600*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[],validationTimeout:15*1e3,validationConcurrency:100,cameraModes:"photo, video",defaultCameraMode:null,enableAudioRecording:true,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null,filesViewMode:"list",gridShowFileNames:false,cloudImageEditorAutoOpen:false,cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true,pasteScope:"local",smartBtn:{sourceList:"local, url, camera, dropbox, gdrive",mode:"auto"}},L=Object.freeze(eo);var Re=(r,i)=>(...t)=>{let e=r();if(!e.read(x("debug")))return;let s=t;if(typeof t?.[0]=="function"){let n=t[0];s=n();}let o=[e.id,i].filter(Boolean);console.log(`[${o.join("][")}]`,...s);};var j=class{constructor(i){this.Vt=new Set;this.se=null;this.oe=Re(()=>this.b.ctx,this.constructor.name);this.b=i,this.s=i.ctx;}addSub(i){this.Vt.add(i);}get _i(){if(!this.se){let i={};this.se=new Proxy(i,{set:()=>{throw new Error("SharedInstance cfg proxy is read-only")},get:(t,e)=>{if(typeof e!="string")return;let s=x(e);return this.b.ctx.has(s)?this.b.ctx.read(s):L[e]}});}return this.se}destroy(){for(let i of this.Vt)try{i();}catch{}this.Vt.clear();}},W=(r,i,t=true)=>{let e=r.has(i),s=e?r.read(i):null;if(e&&s||!t)return s;throw new Error(`Unexpected error: shared instance for key "${String(i)}" is not available`)},vr=r=>({get ctx(){return r()},get modalManager(){return W(r(),"*modalManager",false)},get telemetryManager(){return W(r(),"*telemetryManager")},get localeManager(){return W(r(),"*localeManager")},get a11y(){return W(r(),"*a11y")},get blocksRegistry(){return W(r(),"*blocksRegistry")},get eventEmitter(){return W(r(),"*eventEmitter")},get uploadCollection(){return W(r(),"*uploadCollection")},get secureUploadsManager(){return W(r(),"*secureUploadsManager",false)},get api(){return W(r(),"*publicApi")},get validationManager(){return W(r(),"*validationManager")}});var Le=class extends j{constructor(t){super(t);this.scopes=new Set;this.listener=this.Ls.bind(this),window.addEventListener("paste",this.listener);}openUploadList(){this.b.api.setCurrentActivity(lr.UPLOAD_LIST),this.b.api.setModalState(true);}async Ls(t){if(t.clipboardData){for(let e of this.scopes)if(e.isConnected)switch(this._i.pasteScope){case "global":await this.handlePaste(t);break;case "local":if(!e.contains(t.target))continue;await this.handlePaste(t);break;default:continue}}}async handlePaste(t){let e=Array.from(t.clipboardData.items),s=e.map(n=>n.getAsFile()).filter(n=>n!==null),o=e.filter(n=>n.kind==="string"&&n.type==="text/plain").map(n=>new Promise(a=>{n.getAsString(l=>{a(l);});}));s.length>0&&(s.forEach(n=>{this.b.api.addFileFromObject(n,{source:"clipboard"});}),this.openUploadList()),o.length>0&&((await Promise.all(o)).forEach(a=>{this.b.api.addFileFromUrl(a,{source:"clipboard"});}),this.openUploadList());}registerBlock(t){return this.scopes.add(t),()=>{this.scopes.delete(t);}}destroy(){super.destroy(),window.removeEventListener("paste",this.listener),this.scopes.clear();}};var io={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function Jt(r,i){i.tabIndex=0,i.focus(),r.tabIndex=-1;}function bi(r){let i=r.role||r.type||r.tagName;if(!i)return null;let t=io[i.toLowerCase()];if(!t)return null;for(let e of t){let s=r.closest(`[role=${e}]`);if(s)return s}}function Ti(r,i){return i.role==="toolbar"?ro(i):i.querySelectorAll(`[role=${r.role}]`)}function ro(r){return [...r.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}function so(r){let i=r.getAttribute("aria-orientation");if(i==="vertical")return false;if(i==="horizontal")return true;let t=r.role;return t==="menubar"||t==="tablist"||t==="toolbar"}function br(r){return i=>{let t=false,e=300,s=0,o="";function n(u){let h=bi(u.target);if(!h){a();return}let f=Ti(u.target,h),v=Array.from(f).indexOf(u.target),I="ArrowDown",R="ArrowUp";if(so(h)&&(i.document.dir==="rtl"?(I="ArrowLeft",R="ArrowRight"):(I="ArrowRight",R="ArrowLeft")),u.key===I)u.preventDefault(),Jt(u.target,f[v+1]||f[0]);else if(u.key===R)u.preventDefault(),Jt(u.target,f[v-1]||f[f.length-1]);else if(u.key==="Home")u.preventDefault(),Jt(u.target,f[0]);else if(u.key==="End")u.preventDefault(),Jt(u.target,f[f.length-1]);else if(u.key.length===1&&h.role!=="tablist"){let P=Date.now();P-s<=e?o+=u.key.toLowerCase():o=u.key.toLowerCase(),s=P;let vt=Array.from(f).find(Rs=>Rs.textContent?.trim()?.toLowerCase()?.startsWith(o));vt&&(u.preventDefault(),Jt(u.target,vt));}}function a(){t=false,i.removeEventListener("keydown",n);}function l(u){let h=bi(u.target);if(h){t||(t=true,i.addEventListener("keydown",n));let f=Ti(u.target,h);for(let v of f)v!==u.target&&v.setAttribute("tabindex",-1);}else t&&a();}function c(u){(!u.relatedTarget||u.relatedTarget===i.document)&&a();}function d(u){let h=bi(u.target);if(h){let f=Ti(u.target,h);for(let v of f)v!==u.target&&v.setAttribute("tabindex",-1);u.target.setAttribute("tabindex",0);}}return i.addEventListener("click",d),i.addEventListener("focusin",l),i.addEventListener("focusout",c),()=>{a(),i.removeEventListener("click",d),i.removeEventListener("focusin",l),i.removeEventListener("focusout",c);}}}function Tr(){return r=>{let i,t;function e(o){if(o.target.getAttribute("aria-hidden")==="true"){i=o.target,i.setAttribute("aria-hidden","false"),t=i.hidden,t&&(i.hidden=false);let n=o.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');n&&(n.tabIndex=0);}}function s(o){i&&i.contains(o.target)&&(!o.relatedTarget||!i.contains(o.relatedTarget))&&(o.target.tabIndex=-1,i.setAttribute("aria-hidden","true"),t&&(i.hidden=true),i=null);}return r.addEventListener("keyuxJump",e),r.addEventListener("focusout",s),()=>{r.removeEventListener("keyuxJump",e),r.removeEventListener("focusout",s);}}}function wr(){return r=>{let i=[];function t(l){let c=r.document.activeElement;c&&c!==r.document.body&&i.push(new WeakRef(c)),l.focus({focusVisible:true});}function e(){let l=i.pop();if(!l){r.document.activeElement.blur();return}let c=l.deref();c&&c.isConnected?c.focus():e();}let s=0,o;function n(l){clearInterval(o);let c=l.getAttribute("aria-controls");o=setInterval(()=>{if(s++>50){clearInterval(o);return}let d=r.document.getElementById(c);if(d){let u=d.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');u&&(clearInterval(o),d.dispatchEvent(new r.CustomEvent("keyuxJump",{bubbles:true})),t(u));}},50);}function a(l){l.target.getAttribute("aria-controls")&&l.key==="Enter"&&n(l.target),l.key==="Escape"&&e();}return r.addEventListener("keydown",a),()=>{r.removeEventListener("keydown",a);}}}function xr(r){let i,t=r.split(" "),e;function s(a){a.key==="Enter"&&(a.target.tagName==="BUTTON"||a.target.tagName==="A")&&(o(),a.target.classList.add(...t),i=a.target,e=a.target);}function o(){i&&i.classList.remove(...t),e=null;}function n(a){a.clientX===0&&a.clientY===0&&e!==a.target&&(o(),a.target.classList.add(...t),i=a.target);}return a=>(a.addEventListener("click",n),a.addEventListener("keydown",s),a.addEventListener("keyup",o),()=>{a.removeEventListener("click",n),a.removeEventListener("keydown",s),a.removeEventListener("keyup",o);})}function Er(r,i){let t=i.map(e=>e(r));return ()=>{t.forEach(e=>e());}}var wi=class{constructor(){this.Ae=new Map;this.zt=[];}addEventListener(i,t){let e=s=>{let o=s.target;o instanceof Node&&this.zt.some(n=>n===o||n.contains(o))&&t(s);};this.Ae.set(t,e),window.addEventListener(i,e);}removeEventListener(i,t){let e=this.Ae.get(t);e&&window.removeEventListener(i,e),this.Ae.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this.zt.push(i);}destroy(){this.zt=[];for(let i of this.Ae.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.Ae.clear();}},Me=class{constructor(){this.Ze=new wi,this.Di=Er(this.Ze,[br(),xr("is-pressed"),wr(),Tr()]);}registerBlock(i){this.Ze.registerScope(i);}destroy(){this.Di?.(),this.Ze.destroy();}};var te={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","drop-file-here":"Drop file here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"OneDrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-draw":"Draw","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning","a11y-cloud-editor-apply-aspect-ratio":"Apply operation {{name}} {{value}}",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}","queued-uploading":"Queued for upload","queued-validation":"Queued for validation",validation:"Validating","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop"};var xi=new Map,Cr=new Map,Sr=(r,i)=>{xi.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`);let t={...te,...i};return xi.set(r,t),t},oo=(r,i)=>{Cr.set(r,i);},no=(r,i)=>{typeof i=="function"?oo(r,i):Sr(r,i);},kr=async r=>{let i=xi.get(r);if(!i){let t=Cr.get(r);if(!t)throw new Error(`Locale ${r} is not defined`);let e=await t();i=Sr(r,e);}return i};no("en",te);var rt=r=>`*l10n/${r}`,ao="en",Ie=class extends j{constructor(t){super(t);this.jt="";for(let[e,s]of Object.entries(te)){let o=this.s.has(rt(e))?!this.s.read(rt(e)):true;this.s.add(rt(e),s,o);}this.addSub(this.s.sub(x("localeName"),async e=>{if(!e)return;this.jt=e;let s=await kr(e);if(e!==ao&&this.jt!==e)return;let o=this._i.localeDefinitionOverride?.[e];for(let[n,a]of Object.entries(s)){let l=o?.[n];this.s.add(rt(n),l??a,true);}})),this.addSub(this.s.sub(x("localeDefinitionOverride"),e=>{if(!e)return;let s=e[this.jt];if(s)for(let[o,n]of Object.entries(s))this.s.add(rt(o),n,true);}));}};var Mt=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),Pe=class extends j{constructor(){super(...arguments);this.ne=new Map;this.K=new Set;this.X=new Map;}registerModal(t,e){this.ne.set(t,e),this.Te(Mt.ADD,{id:t,modal:e});}deleteModal(t){let e=this.ne.get(t);return e?(this.ne.delete(t),this.K.delete(t),this.Te(Mt.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.ne.get(t);return e?(this.K.add(t),this.Te(Mt.OPEN,{modal:e,id:t}),true):(this.oe(`Modal with ID "${t}" not found`),false)}close(t){let e=this.ne.get(t);return !e||!this.K.has(t)?(this.oe(`Modal with ID "${t}" not found or not active`),false):(this.K.delete(t),this.Te(Mt.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.ne.has(t)?this.K.has(t)?this.close(t):this.open(t):(this.oe(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.K.size>0}back(){if(this.K.size===0)return this.oe("No active modals to go back from"),false;let t=Array.from(this.K).pop();return t?this.close(t):false}closeAll(){let t=this.K.size;return this.K.clear(),this.Te(Mt.CLOSE_ALL,{}),t}subscribe(t,e){return this.X.has(t)||this.X.set(t,new Set),this.X.get(t)?.add(e),()=>this.unsubscribe(t,e)}unsubscribe(t,e){this.X.has(t)&&this.X.get(t)?.delete(e);}Te(t,e){if(this.X.has(t))for(let s of this.X.get(t)??new Set)try{s(e);}catch(o){this.b.telemetryManager.sendEventError(o,"modal subscriber"),this.oe("Error in modal subscriber:",o);}}destroy(){super.destroy(),this.closeAll(),this.ne.clear(),this.X.clear(),this.Te(Mt.DESTROY,{});}};function lo(r){return r.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}function Ci(r){return Array.isArray(r)?r.map(i=>typeof i=="object"&&i!==null?Ci(i):i):typeof r!="object"||r===null?r:Object.fromEntries(Object.entries(r).map(([i,t])=>{let e=lo(i);return typeof t=="object"&&t!==null?[e,Ci(t)]:[e,t]}))}function co(r){return {ok:true,value:r}}function Ei(r){return {ok:false,error:r}}var uo="https://tlm.uploadcare.com/api/",Si=class{constructor(i=uo){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let s=await fetch(e,t);if(!s.ok)return Ei(new Error(`Got non-200 response from "${e}". Status: ${s.status.toString()}`));try{let o=await s.json();return co(o)}catch(o){return Ei(new Error(`Error parsing JSON from "${e}". Error: ${o}`))}}catch(s){return Ei(new Error(`Error fetching data from "${e}". Error: ${s}`))}}async post(i,t,e={}){return await this.base(i,{...e,method:"POST",body:JSON.stringify(Ci(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},po=async(r,i)=>({success:true,data:i}),ho=async r=>po(void 0,r),$e=class extends Si{constructor(){super();}async sendEvent(i,t){let e=await ho(i);if(!e.success)throw console.error("TelemetryAPIService: events: body is invalid",e.error),new Error("TelemetryAPIService: events: body is invalid");return this.post("v1/events",i,t)}};var fo=20,st=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),ot=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created"}),Ue=class extends j{constructor(){super(...arguments);this.Re=new Map;this.Qe=new Set;}bindTarget(t){return this.Qe.add(t),()=>{this.Qe.delete(t);}}Fi(t,e){for(let s of this.Qe)s.dispatchEvent(new CustomEvent(t,{detail:e}));this.oe?.(()=>{let s=e&&typeof e=="object"?{...e}:e;return [`event "${t}"`,s]});}emit(t,e,s={}){let{debounce:o}=s;if(typeof o!="number"&&!o){this.Fi(t,typeof e=="function"?e():e);return}this.Re.has(t)&&window.clearTimeout(this.Re.get(t));let n=typeof o=="number"?o:fo,a=window.setTimeout(()=>{try{let l=typeof e=="function"?e():e;this.Fi(t,l),this.Re.delete(t);}catch(l){this.oe?.(()=>`Error while getting payload for event "${t}"`,l);}},n);this.Re.set(t,a);}destroy(){for(let t of this.Re.values())window.clearTimeout(t);this.Qe.clear();}};var Or="1.30.0-alpha.2";var It="blocks",Pt=Or;var ut=class r{static generateFastUid(){return `uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}static generateRandomUUID(){let i=globalThis.crypto;return i&&typeof i.randomUUID=="function"?i.randomUUID():r.generateFastUid()}};var Ne=class extends j{constructor(t){super(t);this.Ms=ut.generateRandomUUID();this.we=structuredClone(L);this.Ht=false;this.Bt=null;this.Gt=false;this.Ki=new $e,this.Vi=new Ce(10),this.addSub(this.s.sub(x("qualityInsights"),e=>{this.Gt=!!e;}));for(let e of Object.keys(this.we))this.addSub(this.s.sub(x(e),s=>{this.Gt&&(this.Ht&&this.we[e]!==s&&this.sendEvent({eventType:st.CHANGE_CONFIG}),this.Is(e,s));}));}Ps(t){t===st.INIT_SOLUTION&&!this.Ht&&(this.Ht=true);}Is(t,e){this.we[t]!==e&&(this.we[t]=e);}$s(t){let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let s={...t};return (t.eventType===st.INIT_SOLUTION||t.eventType===st.CHANGE_CONFIG)&&(s.config=this.we),{...s,appVersion:Pt,appName:It,sessionId:this.Ms,component:this.Us,activity:this.Ns,projectPubkey:this.we.pubkey,userAgent:navigator.userAgent,eventType:s.eventType??"",eventTimestamp:this._s,payload:{location:this.Ds,...e}}}Fs(t){return !!(t&&[ot.CHANGE,ot.COMMON_UPLOAD_PROGRESS,ot.FILE_ADDED,ot.FILE_REMOVED,ot.FILE_UPLOAD_START,ot.FILE_UPLOAD_PROGRESS,ot.FILE_UPLOAD_SUCCESS,ot.FILE_UPLOAD_FAILED].includes(t))}sendEvent(t){if(!this.Gt)return;let e=this.$s({eventType:t.eventType,payload:t.payload,config:t.config});this.Ps(t.eventType),!(this.Fs(t.eventType)||this.Bt&&this.zi(this.Bt,e))&&this.Vi.add(async()=>{this.Bt=e,await this.Ki.sendEvent(e);});}sendEventError(t,e="unknown"){this.sendEvent({eventType:st.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}});}sendEventCloudImageEditor(t,e,s={}){this.sendEvent({eventType:st.ACTION_EVENT,payload:{metadata:{tabId:e,node:t.currentTarget?.tagName,event:t.type,...s}}});}zi(t,e){if(JSON.stringify(t)===JSON.stringify(e))return true;if(typeof t!="object"||typeof e!="object"||t==null||e==null)return false;let s=Object.keys(t),o=Object.keys(e);if(s.length!==o.length)return false;for(let n of s)if(!Object.hasOwn(e,n)||!this.zi(t[n],e[n]))return false;return true}get _s(){return Date.now()}get Us(){if(!this.s.has("*solution"))return null;let t=this.s.read("*solution");return t?t.toLowerCase():null}get Ns(){return this.s.has("*currentActivity")?this.s.read("*currentActivity"):null}get Ds(){return location.origin}};var B=[],dt=0,_e=4,Ar=r=>{let i=[],t={get(){return t.lc||t.listen(()=>{})(),t.value},lc:0,listen(e){return t.lc=i.push(e),()=>{for(let o=dt+_e;o<B.length;)B[o]===e?B.splice(o,_e):o+=_e;let s=i.indexOf(e);~s&&(i.splice(s,1),--t.lc||t.off());}},notify(e,s){let o=!B.length;for(let n of i)B.push(n,t.value,e,s);if(o){for(dt=0;dt<B.length;dt+=_e)B[dt](B[dt+1],B[dt+2],B[dt+3]);B.length=0;}},off(){},set(e){let s=t.value;s!==e&&(t.value=e,t.notify(s));},subscribe(e){let s=t.listen(e);return e(t.value),s},value:r};return t};function De(r,i,t){let e=new Set(i).add(void 0);return r.listen((s,o,n)=>{e.has(n)&&t(s,o,n);})}function ki(r,i,t){let e=De(r,i,t);return t(r.value),e}var Oi=(r={})=>{let i=Ar(r);return i.setKey=function(t,e){let s=i.value;typeof e>"u"&&t in i.value?(i.value={...i.value},delete i.value[t],i.notify(s,t)):i.value[t]!==e&&(i.value={...i.value,[t]:e},i.notify(s,t));},i};var Ot=class r{static{this.Le=new Map;}constructor(i,t){this.ji=i,this.z=t;}get id(){return this.ji}pub(i,t){i in this.z.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.z.setKey(i,t);}sub(i,t,e=true){return (e?ki:De)(this.z,[i],o=>{t(o[i]);})}read(i){return i in this.z.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.z.get()[i]}add(i,t,e=false){(!(i in this.z.get())||e)&&this.z.setKey(i,t);}has(i){return i in this.z.get()}get store(){return this.z.get()}static registerCtx(i,t){if(r.Le.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=Oi(i);return r.Le.set(t,e),new r(t,e)}static deleteCtx(i){r.Le.delete(i);}static getCtx(i){let t=r.Le.get(i);return t?new r(i,t):null}static hasCtx(i){return r.Le.has(i)}};var Rr=r=>{let i=new Intl.Locale(r),t="ltr",e=i.getTextInfo?.().direction;return e?t=e:i.textInfo?.direction&&(t=i.textInfo.direction),t};var go=r=>r;var Lr="plural:";function Fe(r,i={},t={}){let{openToken:e="{{",closeToken:s="}}",transform:o=go}=t;for(let n in i){let a=i[n],l=a?.toString(),c=typeof l=="string"?o(l):String(l);r=r.replaceAll(e+n+s,c);}return r}function Mr(r){let i=[],t=r.indexOf("{{");for(;t!==-1;){let e=r.indexOf("}}",t);if(e===-1)break;let s=r.substring(t+2,e);if(s.startsWith(Lr)){let o=r.substring(t+2,e).replace(Lr,""),n=o.substring(0,o.indexOf("(")),a=o.substring(o.indexOf("(")+1,o.indexOf(")"));i.push({variable:s,pluralKey:n,countVariable:a});}t=r.indexOf("{{",e);}return i}function U(r,i){let t,e=((...s)=>{t&&clearTimeout(t),t=setTimeout(()=>r(...s),i);});return e.cancel=()=>{t&&clearTimeout(t);},e}var Ir="--uploadcare-blocks-window-height",ee=class r{static{this.clientsRegistry=new Set;}static{this.flush=U(()=>{document.documentElement.style.setProperty(Ir,`${window.innerHeight}px`);},100);}static registerClient(i){r.clientsRegistry.size===0&&r.attachTracker(),r.clientsRegistry.add(i);}static unregisterClient(i){r.clientsRegistry.delete(i),r.clientsRegistry.size===0&&r.detachTracker();}static attachTracker(){window.addEventListener("resize",r.flush,{passive:true,capture:true}),r.flush();}static detachTracker(){window.removeEventListener("resize",r.flush,{capture:true}),document.documentElement.style.removeProperty(Ir);}};var vo=/\\([0-9a-fA-F]{1,6} ?)/g;function bo(r){return r.length<2?false:(r[0]==='"'||r[0]==="'")&&(r[r.length-1]==='"'||r[r.length-1]==="'")}function To(r){let i=r;return (i[0]==='"'||i[0]==="'")&&(i=i.slice(1)),(i[i.length-1]==='"'||i[i.length-1]==="'")&&(i=i.slice(0,-1)),i}function wo(r){let i="",t="";for(let e=0;e<r.length;e++){let s=r[e+1];r[e]==="\\"&&s==='"'?(i+='\\"',e++):r[e]==='"'&&t!=="\\"?i+='\\"':i+=r[e],t=r[e]??"";}return i}function Pr(r){let i=r;bo(r)&&(i=To(i),i=i.replace(vo,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=wo(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}function $r(r){class i extends r{constructor(){super(...arguments);this.Hi=null;this.qt=null;}getCssData(s,o=false){let n=this.Hi??Object.create(null);if(!Object.keys(n).includes(s)||!n[s]){this.qt||(this.qt=window.getComputedStyle(this));let a=this.qt.getPropertyValue(s).trim();try{n[s]=Pr(a);}catch(l){o||console.warn(`CSS Data error: ${s}`,l),n[s]=null;}}return this.Hi=n,n[s]}}return i}function Ur(r){class i extends r{constructor(){super(...arguments);this.willYield=true;this.ae={};this.le=null;this.Je=false;}createRenderRoot(){return this}connectedCallback(){this.le||(this.le=Array.from(this.childNodes)),super.connectedCallback();}Ks(){if(this.Je)return;this.Je=true,this.ae={};let s=Array.from(this.childNodes),o=s.length?s:this.le??[];for(let n of o){let a=this.Bi(n),l=this.ae[a]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),l.push(n),this.ae[a]=l;}this.le=null;}Bi(s){return s instanceof Comment&&s.nextSibling instanceof Element?this.Bi(s.nextSibling):"contentFor"in s?s.contentFor||"":s instanceof Element&&s.hasAttribute("content-for")&&s.getAttribute("content-for")||""}Vs(s){return !s.textContent||!s.textContent.trim()}zs(s){let o=this.ae[s];return !o||o.every(n=>n instanceof Comment||n instanceof Text&&this.Vs(n))}update(s){!this.hasUpdated&&this.willYield&&this.Ks(),super.update(s);}yield(s,o){if(s===""&&!this.ae[s]&&!this.Je&&this.le?.length){let a=[];for(let l of this.le)l instanceof Element&&(l.removeAttribute("slot"),l.removeAttribute("content-for")),a.push(l);this.ae[s]=a,this.Je=true,this.le=null;}let n=this.ae[s];return m` ${n} ${this.zs(s)?o:void 0} `}}return i}var Nr=(r,i)=>new Intl.PluralRules(r).select(i);var xo=r=>(i,t)=>{let e=r(),s=e("locale-id")||"en",o=Nr(s,t);return e(`${i}__${o}`)},_r=r=>{let i=xo(()=>t),t=(e,s={})=>{if(!e)return "";let n=r().read(rt(e))||e,a=Mr(n);for(let c of a)s[c.variable]=i(c.pluralKey,Number(s[c.countVariable]));return Fe(n,s)};return t};function Dr(r){class i extends r{static reg(e){let s=this,o=window.customElements.get(e);if(o){o!==s&&console.warn([`Element with tag name "${e}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(e,s);}}return i}var pt=class extends Event{constructor(i,t,e,s){super("context-request",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t,this.callback=e,this.subscribe=s??false;}};var $t=class{constructor(i,t,e,s){if(this.subscribe=false,this.provided=false,this.value=void 0,this.t=(o,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=false,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=o,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=true,this.callback&&this.callback(o,n)),this.unsubscribe=n;},this.host=i,t.context!==void 0){let o=t;this.context=o.context,this.callback=o.callback,this.subscribe=o.subscribe??false;}else this.context=t,this.callback=e,this.subscribe=s??false;this.host.addController(this);}hostConnected(){this.dispatchRequest();}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0);}dispatchRequest(){this.host.dispatchEvent(new pt(this.context,this.host,this.t,this.subscribe));}};var Ke=class{get value(){return this.o}set value(i){this.setValue(i);}setValue(i,t=false){let e=t||!Object.is(i,this.o);this.o=i,e&&this.updateObservers();}constructor(i){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:e}]of this.subscriptions)t(this.o,e);},i!==void 0&&(this.value=i);}addCallback(i,t,e){if(!e)return void i(this.value);this.subscriptions.has(i)||this.subscriptions.set(i,{disposer:()=>{this.subscriptions.delete(i);},consumerHost:t});let{disposer:s}=this.subscriptions.get(i);i(this.value,s);}clearCallbacks(){this.subscriptions.clear();}};var Ai=class extends Event{constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},Ut=class extends Ke{constructor(i,t,e){super(t.context!==void 0?t.initialValue:e),this.onContextRequest=s=>{if(s.context!==this.context)return;let o=s.contextTarget??s.composedPath()[0];o!==this.host&&(s.stopPropagation(),this.addCallback(s.callback,o,s.subscribe));},this.onProviderRequest=s=>{if(s.context!==this.context||(s.contextTarget??s.composedPath()[0])===this.host)return;let o=new Set;for(let[n,{consumerHost:a}]of this.subscriptions)o.has(n)||(o.add(n),a.dispatchEvent(new pt(this.context,a,n,true)));s.stopPropagation();},this.host=i,t.context!==void 0?this.context=t.context:this.context=t,this.attachListeners(),this.host.addController?.(this);}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest);}hostConnected(){this.host.dispatchEvent(new Ai(this.context,this.host));}};var Fr="ctx-name-context";function Kr(){return function(r){class i extends r{constructor(...s){super(...s);this.w=null;this.Me=false;this.Wt=false;this.Xt=void 0;this.xe=new Map;this.Ie=new Set;this.init$={};this.ctxOwner=false;this.et=void 0;this.tt=false;this.ctxName=this.Y;this.Z=false;this.et=this.getAttribute("ctx-name")||void 0,this.ctxName=this.Y,this.js=new $t(this,{context:Fr,callback:o=>{if(!o){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.Wi=o,this.qi();},subscribe:true});}static set template(s){console.error("Caution: static 'template' property is deprecated and has no effect. See https://github.com/uploadcare/file-uploader/releases/tag/v1.25.0 for details.");}get Gi(){return this.et}set Gi(s){let o=s??void 0;this.et!==o&&(this.et=o,this.qi());}shouldUpdate(s){return this.Z?super.shouldUpdate(s):false}get Y(){return this.Gi||this.Wi||void 0}qi(){if(this.ctxName=this.Y,!(!this.ctxName||this.Me)){if(this.isConnected){this.Yt();return}this.tt=true;}}willUpdate(s){super.willUpdate(s),this.ctxName=this.Y,this.ctxName&&(this.Xt?this.Xt.setValue(this.ctxName):this.Xt=new Ut(this,{context:Fr,initialValue:this.ctxName}));}Xi(){if(!(!this.w||this.xe.size===0)){for(let[s,{value:o,rewrite:n}]of this.xe)this.w.add(s,o,n);this.xe.clear();}}Yi(){return !this.w&&this.Y&&this.Zt(),this.w&&this.Xi(),this.w}ot(){let s=this.Yi();if(!s)throw new Error("SymbioteMixin: Shared context is not initialized.");return s}Zt(){let s=this.init$,o=this.Y;if(!o){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.w){this.w=Ot.getCtx(o)??Ot.registerCtx(s,o);for(let[n,a]of Object.entries(this.init$))this.w.add(n,a,this.ctxOwner);this.Xi();}}get $(){return this.Y&&this.Zt(),new Proxy({},{get:(s,o)=>{if(typeof o=="string")return this.w?.read(o)},set:(s,o,n)=>(typeof o!="string"||this.w?.pub(o,n),true)})}sub(s,o,n=true){let a=this.ot().sub(s,o,n);if(!a||typeof a!="function")return ()=>{};let l=a.bind(a),c=false,d=()=>{c||(c=true,l(),this.Ie.delete(d));};return this.Ie.add(d),d}pub(s,o){this.ot().pub(s,o);}set$(s){for(let[o,n]of Object.entries(s))this.pub(o,n);}get sharedCtx(){return this.ot()}has(s){return this.w?.has(s)??false}add(s,o,n=false){let a=this.Yi();if(!a){if(!n&&this.xe.has(s))return;this.xe.set(s,{value:o,rewrite:n});return}this.xe.delete(s),a.add(s,o,n);}add$(s,o=false){for(let[n,a]of Object.entries(s))this.add(n,a,o);}connectedCallback(){super.connectedCallback(),this.Me?this.Z&&this.Wt&&(this.Wt=false,this.initCallback()):this.ctxName?(this.tt=false,this.Yt()):this.tt&&this.Y&&(this.tt=false,this.Yt());}Yt(){if(this.Me)return;this.Me=true,this.Zt();let s=this.init$;if(Object.keys(s).length>0){let o=this.ot();for(let[n,a]of Object.entries(s))o.read(n)===void 0&&o.pub(n,a),this.sub(n,U(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.Z=true,this.requestUpdate();}firstUpdated(s){super.firstUpdated(s);}disconnectedCallback(){this.Hs(),super.disconnectedCallback(),this.Me&&(this.Wt=true);}Hs(){if(this.Ie.size!==0){for(let s of [...this.Ie])s();this.Ie.clear();}}initCallback(){}}return p([g({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"Gi",1),p([y()],i.prototype,"Wi",2),p([y()],i.prototype,"ctxName",2),p([y()],i.prototype,"Z",2),i}}var Co=r=>r.tagName?.includes("-")??false,Ve=class{constructor(i){this.ce=new Set;this.at=new Map;this.Zi=false;this.ue=i,this.ue.addController(this);}hostDisconnected(){this.ut?.(),this.ut=void 0,this.ce.clear(),this.at.clear();}hostUpdated(){if(!this.ut&&this.ue.has(x("testMode"))){let i=this.ue.subConfigValue("testMode",t=>{this.Zi=!!t,this.Qi();});this.ut=i;}this.Bs(),this.Qi();}Bs(){let i=this.ue,t=i.renderRoot??i;if(!t)return;let e=this.ue,s=e.tagName?.toLowerCase(),o=Array.from(t.querySelectorAll("[data-testid]")).filter(n=>!Co(n));for(let n of o)if(!(s&&n.closest(s)!==e)&&!this.ce.has(n)){let a=n.getAttribute("data-testid");if(!a)continue;this.ce.add(n),this.at.set(n,a);}for(let n of Array.from(this.ce))(!n.isConnected||s&&n.closest(s)!==e)&&(this.ce.delete(n),this.at.delete(n));}Qi(){if(!this.ce.size)return;let i=this.ue.testId||"";for(let t of this.ce){let e=this.at.get(t);e&&(this.Zi?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var So=Dr(Kr()($r(Ur(at)))),w=class extends So{constructor(){super();this.pt=new Map;this.activityType=null;this.init$=ar();this.l10n=_r(()=>this.sharedCtx);this.debugPrint=Re(()=>this.sharedCtx,this.constructor.name);this.b=vr(()=>this.sharedCtx);new Ve(this);}static{this.styleAttrs=[];}emit(t,e,s){let o=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;if(!o)return;o.emit(t,e,s);let n=typeof e=="function"?e():e;this.telemetryManager.sendEvent({eventType:t,payload:n??void 0});}hasBlockInCtx(t){for(let e of this.blocksRegistry)if(t(e))return true;return false}connectedCallback(){this.constructor.styleAttrs.forEach(e=>{this.setAttribute(e,"");}),super.connectedCallback(),ee.registerClient(this);}initCallback(){this.pe("*blocksRegistry",()=>new Set),this.pe("*eventEmitter",t=>new Ue(t)),this.pe("*localeManager",t=>new Ie(t)),this.pe("*modalManager",t=>new Pe(t)),this.pe("*a11y",()=>new Me),this.pe("*clipboard",t=>new Le(t)),this.pe("*telemetryManager",t=>new Ne(t)),this.sub(rt("locale-id"),t=>{let e=Rr(t);this.style.direction=e==="ltr"?"":e,this.requestUpdate();}),this.subConfigValue("testMode",t=>{if(!t||!this.testId){this.removeAttribute("data-testid");return}this.setAttribute("data-testid",this.testId);}),this.blocksRegistry.add(this);}get testId(){return window.customElements.getName(this.constructor)}get modalManager(){return this.de("*modalManager",false)}get telemetryManager(){return this.de("*telemetryManager")}get localeManager(){return this.de("*localeManager")}get a11y(){return this.de("*a11y")}get clipboardLayer(){return this.de("*clipboard")}get blocksRegistry(){return this.de("*blocksRegistry")}get eventEmitter(){return this.de("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),ee.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),t?.size===0&&setTimeout(()=>{this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.Gs(),Ot.deleteCtx(this.ctxName);}pe(t,e){if(!this.pt.has(t)&&(!this.has(t)||!this.$[t])){let s=e(this.b);this.add(t,s,true),this.pt.set(t,s);return}}Gs(){for(let[t,e]of this.pt.entries())e?.destroy?.(),this.pub(t,null),this.pt.delete(t);}de(t,e=true){if(this.has(t)&&this.$[t])return this.$[t];if(!e)return this.$[t];throw new Error(`Unexpected error: context manager for key "${String(t)}" is not available`)}async proxyUrl(t){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(t,{uuid:Oe(t),cdnUrlModifiers:fi(t),fileName:ke(t)})}catch(e){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",e),this.telemetryManager.sendEventError(e,"secureDeliveryProxyUrlResolver. Failed to resolve secure delivery proxy URL. Falling back to the default URL."),t}return this.cfg.secureDeliveryProxy?Fe(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:e=>window.encodeURIComponent(e)}):t}get cfg(){if(!this.se){let t={};this.se=new Proxy(t,{set:(e,s,o)=>{if(typeof s!="string"||!(s in L))return false;let n=s,a=x(n);return this.has(a)||this.add(a,L[n]),this.$[a]=o,true},get:(e,s)=>{let o=x(s);return this.has(o)||this.add(o,L[s]),this.$[o]}});}return this.se}subConfigValue(t,e){let s=x(t);return this.has(s)||this.add(s,L[t]),this.sub(s,e)}};var ht="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Vr(...r){return r.reduce((i,t)=>{if(typeof t=="string")return i[t]=true,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}function F(...r){let i=Vr(...r);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}function jr(r,...i){let t=Vr(...i);for(let e of Object.keys(t))r.classList.toggle(e,!!t[e]);}var ie=["free"],zr=r=>{let i=Zt(r);if(!i||i.length===0)return [];let t=[];for(let e of i){let s=e.trim();if(!s)continue;let o=s.indexOf(":");if(o===-1&&!ie.includes(s)){console.warn(`Invalid crop preset: ${s}`);continue}let n=Number(s.slice(0,o)),a=Number(s.slice(o+1));if((!Number.isFinite(n)||!Number.isFinite(a)||n<=0||a<=0)&&!ie.includes(s)){console.warn(`Invalid crop preset: ${s}`);continue}t.push({id:ut.generateFastUid(),type:"aspect-ratio",width:ie.includes(s)?0:n,height:ie.includes(s)?0:a,hasFreeform:ie.includes(s)});}return t},Hr=(r,i,t,e=.1)=>{let s=r/i,o=null,n=1/0;for(let a of t){let[l,c]=[a.width,a.height],d=l/c,u=Math.abs(s-d);u<n&&(n=u,o=a);}if(o){let[a,l]=[o.width,o.height],c=a/l;if(Math.abs(s-c)/c>e)return null}return o};var ko=r=>$.includes(r),Br=r=>{if(!r)return $;let i=St(r).filter(ko);return i.length===0?$:i};function Gr(r){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":$,"*tabId":O.CROP,"*on.retryNetwork":()=>{let i=r.querySelectorAll("img");for(let t of i){let e=t.src;t.src=ht,t.src=e;}r.$["*networkProblems"]=false;},"*on.apply":i=>{if(!i)return;let t=r.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=J(ct(i),"preview"),s=tt(t,e),o={originalUrl:t,cdnUrlModifiers:e,cdnUrl:s,transformations:i};r.dispatchEvent(new CustomEvent("apply",{detail:o,bubbles:true,composed:true})),r.remove();},"*on.cancel":()=>{r.remove(),r.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));}}}var qr="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'/><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='ruc-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(#ruc-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(#uuc-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(#uuc-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(#uuc-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(#uuc-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(#uuc-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(#uuc-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(#uuc-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(#uuc-icon-id__h)'/><defs><linearGradient id='uuc-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='uuc-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='uuc-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='uuc-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='uuc-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='uuc-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='uuc-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='uuc-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 At={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},re=class extends w{constructor(){super(...arguments);this.Ee=false;this.Ji=At;this.er=At.visible;this.tr=At.hidden;this.Qt=false;this.ir=false;}set visible(t){this.Ee=t,this.rr();}get visible(){return this.Ee}set styles(t){this.Ji=t,this.Qt=true,this.er=t.visible??At.visible,this.tr=t.hidden??At.hidden;}get styles(){return this.Ji}rr(){this.style.visibility=this.Ee?"inherit":"hidden",jr(this,{[At.transition]:!this.Qt,[this.er]:this.Ee,[this.tr]:!this.Ee}),this.toggleAttribute("inert",!this.Ee);}qs(){this.ir||(this.ir=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.Qt||this.classList.add(At.transition),this.rr(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.qs();},0);}};p([g({type:Boolean})],re.prototype,"visible",1),p([g({attribute:false})],re.prototype,"styles",1);var je=class extends w{constructor(){super(...arguments);this.active=false;this.dt=C();this.Jt=false;this.ei=()=>{let t=this.dt.value;t&&(this.sr(t),this.Jt&&this.active&&this.ti());};}firstUpdated(t){super.firstUpdated(t),this.active&&this.ti();}updated(t){super.updated(t),t.has("active")&&(this.active?this.ti():this.Ws());}ti(){let t=this.dt.value;if(!t)return;this.Jt=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.ei),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.ei,{once:true});}Ws(){let t=this.dt.value;t&&(this.Jt=false,t.removeEventListener("transitionend",this.ei),this.sr(t));}sr(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return m`<div class="uc-inner"><div class="uc-line" ${k(this.dt)}></div></div>`}};p([g({type:Boolean,reflect:true})],je.prototype,"active",2);var ft=z(class extends q{constructor(r){if(super(r),r.type!==lt.ATTRIBUTE||r.name!=="class"||r.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(r){return " "+Object.keys(r).filter(i=>r[i]).join(" ")+" "}update(r,[i]){if(this.st===void 0){this.st=new Set,r.strings!==void 0&&(this.nt=new Set(r.strings.join(" ").split(/\s/).filter(e=>e!=="")));for(let e in i)i[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(i)}let t=r.element.classList;for(let e of this.st)e in i||(t.remove(e),this.st.delete(e));for(let e in i){let s=!!i[e];s===this.st.has(e)||this.nt?.has(e)||(s?(t.add(e),this.st.add(e)):(t.remove(e),this.st.delete(e)));}return D}});var A=r=>r??T;var se=class extends w{constructor(){super(...arguments);this.name="";this.ii="";this.or=null;}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",t=>{this.or=t,this.nr();});}willUpdate(t){super.willUpdate(t),t.has("name")&&this.nr();}nr(){if(!this.name){this.ii="";return}let t=`#uc-icon-${this.name}`,e=this.or?.(this.name);this.ii=e??t;}render(){return m` ${this.yield("",m`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.ii}></use></svg>`)} `}};p([g({type:String})],se.prototype,"name",2),p([y()],se.prototype,"ii",2);var G=class extends w{constructor(){super(...arguments);this.text="";this.icon="";this.reverse=false;this.theme="default";this.ariaRole=void 0;this.ariaControls="";this.titleProp="";this.active=false;}firstUpdated(t){super.firstUpdated(t),this.ar(),this.lr();}updated(t){super.updated(t),t.has("reverse")&&this.ar(),t.has("theme")&&this.lr();}ar(){this.style.flexDirection=this.reverse?"row-reverse":"";}lr(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get Xs(){let t=this.ri;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.Ys}}get ri(){return !this.icon}get Ys(){return !this.text&&!this.ri}render(){return m`<button type="button" role=${A(this.ariaRole||void 0)} aria-controls=${A(this.ariaControls||void 0)} aria-label=${A(this.l10n(this.titleProp))} title=${A(this.l10n(this.titleProp))} ><uc-icon class=${ft(this.Xs)} name=${A(this.icon||void 0)} ?hidden=${this.ri} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};p([g({type:String})],G.prototype,"text",2),p([g({type:String})],G.prototype,"icon",2),p([g({type:Boolean,reflect:true})],G.prototype,"reverse",2),p([g({type:String,reflect:true})],G.prototype,"theme",2),p([g({attribute:"aria-role"})],G.prototype,"ariaRole",2),p([g({attribute:"aria-controls"})],G.prototype,"ariaControls",2),p([g({attribute:"title-prop"})],G.prototype,"titleProp",2),p([g({type:Boolean,noAccessor:true})],G.prototype,"active",2);function oe(r){let i=new Image;return {promise:new Promise((s,o)=>{i.src=r,i.onload=()=>s(),i.onerror=n=>o(n);}),image:i,cancel:()=>{i.naturalWidth===0&&(i.src=ht);}}}function ne(r){let i=[];for(let o of r){let n=oe(o);i.push(n);}let t=i.map(o=>o.image);return {promise:Promise.allSettled(i.map(o=>o.promise)),images:t,cancel:()=>{i.forEach(o=>{o.cancel();});}}}var Wr=(r,i)=>{let t=false,e,s=0,o=((...n)=>{t?(e&&clearTimeout(e),e=setTimeout(()=>{Date.now()-s>=i&&(r(...n),s=Date.now());},Math.max(i-(Date.now()-s),0))):(r(...n),s=Date.now(),t=true);});return Object.defineProperty(o,"cancel",{configurable:false,writable:false,enumerable:false,value:()=>{e&&clearTimeout(e);}}),o};var ae=33.333333333333336,b=1,Ri=24,Xr=6;function mt(r,i){for(let[t,e]of Object.entries(i))r.setAttributeNS(null,t,e.toString());}function K(r,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",r);return mt(t,i),t}function Yr(r,i,t){let{x:e,y:s,width:o,height:n}=r,a=i.includes("w")?0:1,l=i.includes("n")?0:1,c=a===0?-1:1,d=l===0?-1:1,u=[e+a*o+1.5*c,s+l*n+1.5*d-24*t*d],h=[e+a*o+1.5*c,s+l*n+1.5*d],f=[e+a*o-24*t*c+1.5*c,s+l*n+1.5*d],v=`M ${u[0]} ${u[1]} L ${h[0]} ${h[1]} L ${f[0]} ${f[1]}`,I=[h[0],h[1]];return {d:v,center:I}}function Zr(r,i,t){let{x:e,y:s,width:o,height:n}=r,a=i==="n"||i==="s",l=i==="w"||i==="e",c=a?.5:i==="w"?0:1,d=l?.5:i==="n"?0:1,u=i==="w"?-1:i==="e"?1:0,h=i==="n"?-1:i==="s"?1:0,f,v;a?(f=[e+c*o-34*t/2,s+d*n+1.5*h],v=[e+c*o+34*t/2,s+d*n+1.5*h]):(f=[e+c*o+1.5*u,s+d*n-34*t/2],v=[e+c*o+1.5*u,s+d*n+34*t/2]);let I=`M ${f[0]} ${f[1]} L ${v[0]} ${v[1]}`,R=[(f[0]+v[0])/2,(f[1]+v[1])/2];return {d:I,center:R}}function Qr(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 Jr({rect:r,delta:[i,t],imageBox:e}){return _t({...r,x:r.x+i,y:r.y+t},e)}function _t(r,i){let{x:t}=r,{y:e}=r;return r.x<i.x?t=i.x:r.x+r.width>i.x+i.width&&(t=i.x+i.width-r.width),r.y<i.y?e=i.y:r.y+r.height>i.y+i.height&&(e=i.y+i.height-r.height),{...r,x:t,y:e}}function Oo({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,s]=i,{y:o,width:n,height:a}=r;o+=s,a-=s,t&&(n=a*t);let l=r.x+r.width/2-n/2;return o<=e.y&&(o=e.y,a=r.y+r.height-o,t&&(n=a*t,l=r.x+r.width/2-n/2)),l<=e.x&&(l=e.x,o=r.y+r.height-a),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),o=r.y+r.height-a),a<b&&(a=b,t&&(n=a*t,l=r.x+r.width/2-n/2),o=r.y+r.height-a),n<b&&(n=b,t&&(a=n/t,l=r.x+r.width/2-n/2),o=r.y+r.height-a),{x:l,y:o,width:n,height:a}}function Ao({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s]=i,{x:o,width:n,height:a}=r;o+=s,n-=s,t&&(a=n/t);let l=r.y+r.height/2-a/2;return o<=e.x&&(o=e.x,n=r.x+r.width-o,t&&(a=n/t,l=r.y+r.height/2-a/2)),l<=e.y&&(l=e.y,o=r.x+r.width-n),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),o=r.x+r.width-n),a<b&&(a=b,t&&(n=a*t),l=r.y+r.height/2-a/2,o=r.x+r.width-n),n<b&&(n=b,t&&(a=n/t),l=r.y+r.height/2-a/2,o=r.x+r.width-n),{x:o,y:l,width:n,height:a}}function Ro({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,s]=i,{y:o,width:n,height:a}=r;a+=s,t&&(n=a*t);let l=r.x+r.width/2-n/2;return o+a>=e.y+e.height&&(a=e.y+e.height-o,t&&(n=a*t),l=r.x+r.width/2-n/2),l<=e.x&&(l=e.x,o=r.y),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),o=r.y),a<b&&(a=b,t&&(n=a*t),l=r.x+r.width/2-n/2),n<b&&(n=b,t&&(a=n/t),l=r.x+r.width/2-n/2),{x:l,y:o,width:n,height:a}}function Lo({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s]=i,{x:o,width:n,height:a}=r;n+=s,t&&(a=n/t);let l=r.y+r.height/2-a/2;return o+n>=e.x+e.width&&(n=e.x+e.width-o,t&&(a=n/t),l=r.y+r.height/2-a/2),l<=e.y&&(l=e.y,o=r.x),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),o=r.x),a<b&&(a=b,t&&(n=a*t),l=r.y+r.height/2-a/2),n<b&&(n=b,t&&(a=n/t),l=r.y+r.height/2-a/2),{x:o,y:l,width:n,height:a}}function Mo({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s,o]=i,{x:n,y:a,width:l,height:c}=r;return n+s<e.x&&(s=e.x-n),a+o<e.y&&(o=e.y-a),n+=s,l-=s,a+=o,c-=o,t&&Math.abs(l/c)>t?(o=l/t-c,c+=o,a-=o,a<=e.y&&(c=c-(e.y-a),l=c*t,n=r.x+r.width-l,a=e.y)):t&&(s=c*t-l,l=l+s,n-=s,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=r.y+r.height-c)),c<b&&(c=b,t&&(l=c*t),n=r.x+r.width-l,a=r.y+r.height-c),l<b&&(l=b,t&&(c=l/t),n=r.x+r.width-l,a=r.y+r.height-c),{x:n,y:a,width:l,height:c}}function Io({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s,o]=i,{x:n,y:a,width:l,height:c}=r;return n+l+s>e.x+e.width&&(s=e.x+e.width-n-l),a+o<e.y&&(o=e.y-a),l+=s,a+=o,c-=o,t&&Math.abs(l/c)>t?(o=l/t-c,c+=o,a-=o,a<=e.y&&(c=c-(e.y-a),l=c*t,n=r.x,a=e.y)):t&&(s=c*t-l,l+=s,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=r.y+r.height-c)),c<b&&(c=b,t&&(l=c*t),a=r.y+r.height-c),l<b&&(l=b,t&&(c=l/t),a=r.y+r.height-c),{x:n,y:a,width:l,height:c}}function Po({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s,o]=i,{x:n,y:a,width:l,height:c}=r;return n+s<e.x&&(s=e.x-n),a+c+o>e.y+e.height&&(o=e.y+e.height-a-c),n+=s,l-=s,c+=o,t&&Math.abs(l/c)>t?(o=l/t-c,c+=o,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=r.x+r.width-l,a=e.y+e.height-c)):t&&(s=c*t-l,l+=s,n-=s,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=r.y)),c<b&&(c=b,t&&(l=c*t),n=r.x+r.width-l),l<b&&(l=b,t&&(c=l/t),n=r.x+r.width-l),{x:n,y:a,width:l,height:c}}function $o({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s,o]=i,{x:n,y:a,width:l,height:c}=r;return n+l+s>e.x+e.width&&(s=e.x+e.width-n-l),a+c+o>e.y+e.height&&(o=e.y+e.height-a-c),l+=s,c+=o,t&&Math.abs(l/c)>t?(o=l/t-c,c+=o,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=r.x,a=e.y+e.height-c)):t&&(s=c*t-l,l+=s,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=r.y)),c<b&&(c=b,t&&(l=c*t)),l<b&&(l=b,t&&(c=l/t)),{x:n,y:a,width:l,height:c}}function ts({direction:r,...i}){switch(r){case "n":return Oo(i);case "w":return Ao(i);case "s":return Ro(i);case "e":return Lo(i);case "nw":return Mo(i);case "ne":return Io(i);case "sw":return Po(i);case "se":return $o(i);default:return i.rect}}function es(r,[i,t]){return r.x<=i&&i<=r.x+r.width&&r.y<=t&&t<=r.y+r.height}function is(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 rs(r,i){return Math.abs(r.width/r.height-i)<.1}function Dt({width:r,height:i},t){let e=t/90%2!==0;return {width:e?i:r,height:e?r:i}}function Ft(r){return {x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)}}function yt(r,i,t){return Math.min(Math.max(r,i),t)}function ss(r,i){let t={};for(let e of i){let s=r[e];(Object.hasOwn(r,e)||s!==void 0)&&(t[e]=s);}return t}function Kt(r,i,t){let s=window.devicePixelRatio,o=Math.min(Math.ceil(i*s),3e3),n=s>=2?"lightest":"normal";return tt(r,J(Ae,ct(t),`quality/${n}`,`stretch/off/-/resize/${o}x`,`@clib/${It}/${Pt}/uc-cloud-image-editor/`))}var He=class extends w{constructor(){super(...arguments);this.cr=`uc-backdrop-mask-${ut.generateFastUid()}`;this.yt=false;this.Ne=false;this.dr=C();this._e=false;this.De=null;this.fr=t=>{this.mr(),this.Fe&&(t.stopPropagation(),t.preventDefault(),this.Fe=false);};this.yr=t=>{if(!this.Fe||!this.mt||!this.oi)return;t.stopPropagation(),t.preventDefault();let e=this.Q;if(!e)return;let{x:s,y:o}=e.getBoundingClientRect(),n=t.x-s,a=t.y-o,l=n-this.mt[0],c=a-this.mt[1],{direction:d}=this.oi,u=this.oo(d,[l,c]);u&&(this.$["*cropBox"]=u);};this.gr=t=>{if(!this.W)return;let e=Object.values(this.W).find(s=>{if(!s||this.ai(s.direction))return false;let n=s.interactionNode.getBoundingClientRect(),a={x:n.x,y:n.y,width:n.width,height:n.height};return es(a,[t.x,t.y])});this.ur=e,this.mr();};}get Q(){return this.dr.value??null}get Fe(){return this.Ne}set Fe(t){this.Ne!==t&&(this.Ne=t,this.ni());}ni(){this.$e&&this.$e.setAttribute("class",F({"uc-guides--hidden":this.yt,"uc-guides--visible":!this.yt&&this.Ne,"uc-guides--semi-hidden":!this.yt&&!this.Ne}));}ai(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=b&&e.width<=b)return true;let s=e.height<=b&&(t.includes("n")||t.includes("s")),o=e.width<=b&&(t.includes("e")||t.includes("w"));return s||o}Zs(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:s,width:o,height:n}=t,a=this.Q;if(!a)return;let l=K("mask",{id:this.cr}),c=K("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),d=K("rect",{x:e,y:s,width:o,height:n,fill:"black"});l.appendChild(c),l.appendChild(d);let u=K("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.cr})`});a.appendChild(u),a.appendChild(l),this.Pe=l,this.si=d;}Qs(){this.Pe&&(this.Pe.style.display="none",window.requestAnimationFrame(()=>{this.Pe&&(this.Pe.style.display="block");}));}Js(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:s,width:o,height:n}=t;this.si&&mt(this.si,{x:e,y:s,width:o,height:n});}eo(){let t=this.$["*cropBox"];if(!(!t||!this.$e||!this.W)){for(let e of Object.values(this.W)){if(!e)continue;let{direction:s,pathNode:o,interactionNode:n,groupNode:a}=e,l=s==="",c=s.length===2,{x:d,y:u,width:h,height:f}=t;if(l)mt(n,{x:d,y:u,width:h,height:f});else {let I=yt(Math.min(h,f)/82/2,0,1),R=c?Yr(t,s,I):Zr(t,s,I),P=R.center;if(!P)continue;let vt=Math.max(Ri*yt(Math.min(h,f)/Ri/3,0,1),Xr);mt(n,{x:P[0]-vt,y:P[1]-vt,width:vt*2,height:vt*2}),mt(o,{d:R.d});}let v=this.ai(s);a.setAttribute("class",F("uc-thumb",{"uc-thumb--hidden":v,"uc-thumb--visible":!v}));}mt(this.$e,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}hr(t,e){let s=K("g");s.classList.add("uc-thumb"),s.setAttribute("with-effects","");let o=K("rect",{fill:"transparent"}),n=K("path",{stroke:"currentColor",fill:"none","stroke-width":3});s.appendChild(n),s.appendChild(o),t[e]={direction:e,pathNode:n,interactionNode:o,groupNode:s},e===""&&(s.style.cursor="move"),o.addEventListener("pointerdown",this.to.bind(this,e));}io(){let t={};for(let e=0;e<3;e++)for(let s=0;s<3;s++){let o=`${["n","","s"][e]}${["w","","e"][s]}`;o!==""&&this.hr(t,o);}return this.hr(t,""),t}ro(){let t=K("svg"),e=K("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});t.appendChild(e);for(let s=1;s<=2;s++){let o=K("line",{x1:`${ae*s}%`,y1:"0%",x2:`${ae*s}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(o);}for(let s=1;s<=2;s++){let o=K("line",{x1:"0%",y1:`${ae*s}%`,x2:"100%",y2:`${ae*s}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(o);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}so(){let t=this.Q;if(!t)return;let e=document.createDocumentFragment(),s=this.ro();e.appendChild(s);let o=this.io();for(let{groupNode:n}of Object.values(o))e.appendChild(n);t.appendChild(e),this.W=o,this.$e=s,this.ni();}to(t,e){if(!this.W)return;let s=this.W[t];if(!s||this.ai(t))return;let o=this.$["*cropBox"],n=this.Q;if(!n)return;let{x:a,y:l}=n.getBoundingClientRect(),c=e.x-a,d=e.y-l;this.Fe=true,this.oi=s,this.mt=[c,d],this.pr={...o};}oo(t,e){let[s,o]=e,n=this.$["*imageBox"],a=this.pr??this.$["*cropBox"],l=this.$["*currentAspectRatio"],c=l?l.width/l.height:void 0;if(t===""?a=Jr({rect:a,delta:[s,o],imageBox:n}):a=ts({rect:a,delta:[s,o],direction:t,aspectRatio:c,imageBox:n}),!Object.values(a).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:a});return}return _t(Ft(a),n)}mr(){let t=this.ur,e=this.Q;e&&(e.style.cursor=t?Qr(t.direction):"initial");}vr(t){if(this.Ue){this.Ue.setAttribute("href",t);return}let e=this.Q;if(!e){this.De=t;return}this.De=null;let s=document.createDocumentFragment(),o=K("image",{href:t});o.setAttribute("class","uc-cloud-mask"),s.appendChild(o),e.appendChild(s),this.Ue=o;}ao(){let t=this.$["*cropBox"];if(!t||!this.Ue)return;let{x:e,y:s,width:o,height:n}=t;mt(this.Ue,{x:e,y:s,height:n,width:o});}li(){this._e&&(this.Js(),this.eo(),this.ao());}toggleThumbs(t){if(this.W)for(let e of Object.values(this.W)){if(!e)continue;let{groupNode:s}=e;s.setAttribute("class",F("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Qs(),this._e&&window.requestAnimationFrame(()=>{this.li();});}),this.sub("*cropBox",t=>{t&&(this.yt=t.height<=b||t.width<=b,this.ni(),this._e&&window.requestAnimationFrame(()=>{this.li();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.vr(t);}),document.addEventListener("pointermove",this.yr,true),document.addEventListener("pointerup",this.fr,true);}firstUpdated(t){super.firstUpdated(t),this.lo();}lo(){let t=this.Q;if(!(!t||this._e)){if(this.Zs(),this.so(),this._e=true,t.addEventListener("pointermove",this.gr,true),this.De){let e=this.De;this.De=null,this.vr(e);}this.li();}}disconnectedCallback(){super.disconnectedCallback(),this.Q?.removeEventListener("pointermove",this.gr,true),document.removeEventListener("pointermove",this.yr,true),document.removeEventListener("pointerup",this.fr,true);}render(){return m`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${k(this.dr)}></svg>`}};p([y()],He.prototype,"Ne",2);function No(r){return r?[({dimensions:t,coords:e})=>[...t,...e].every(s=>Number.isInteger(s)&&Number.isFinite(s)),({dimensions:t,coords:e})=>t.every(s=>s>0)&&e.every(s=>s>=0)].every(t=>t(r)):true}var Be=class extends w{constructor(){super();this.ctxOwner=true;this.he={width:0,height:0};this.s=null;this.m=false;this.E=null;this.Tr=C();this.pi=C();this.init$={...this.init$,"*padding":20,"*operations":{rotate:0,mirror:false,flip:false},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this.br=U(this.wr.bind(this),300),this.ci=Wr(()=>{!this.isConnected||!this.m||(this.di(),this.xr(),this.Er(),this.hi(),this.fi());},100);}firstUpdated(t){super.firstUpdated(t),this.di();}xr(){let t=this.$["*editorTransformations"],e=ss(t,Object.keys(this.$["*operations"])),s={...this.$["*operations"],...e};this.$["*operations"]=s;}di(){let t=this.Tr.value;if(!t)return;let e=t.getContext("2d"),s=this.offsetWidth,o=this.offsetHeight,n=window.devicePixelRatio;t.style.width=`${s}px`,t.style.height=`${o}px`,t.width=s*n,t.height=o*n,e?.scale(n,n),this.ui=t,this.s=e;}Er(){if(!this.m||!this.E)return;let t=this.E,e=this.$["*padding"],s=this.$["*operations"],{rotate:o}=s,n={width:this.offsetWidth,height:this.offsetHeight},a=Dt({width:t.naturalWidth,height:t.naturalHeight},o),l;if(a.width>n.width-e*2||a.height>n.height-e*2){let c=a.width/a.height,d=n.width/n.height;if(c>d){let u=n.width-e*2,h=u/c,f=0+e,v=e+(n.height-e*2)/2-h/2;l={x:f,y:v,width:u,height:h};}else {let u=n.height-e*2,h=u*c,f=e+(n.width-e*2)/2-h/2,v=0+e;l={x:f,y:v,width:h,height:u};}}else {let{width:c,height:d}=a,u=e+(n.width-e*2)/2-c/2,h=e+(n.height-e*2)/2-d/2;l={x:u,y:h,width:c,height:d};}this.$["*imageBox"]=Ft(l);}hi(){let t=this.$["*cropBox"],e=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,n=this.$["*editorTransformations"].crop,{width:a,x:l,y:c}=e;if(n){let{dimensions:[h,f],coords:[v,I]}=n,{width:R}=Dt(this.he,o),P=a/R;t=_t(Ft({x:l+v*P,y:c+I*P,width:h*P,height:f*P}),e);}let d=this.$["*currentAspectRatio"],u=d?d.width/d.height:void 0;if(!is(t,e)||u&&!rs(t,u)){let h=e.width/e.height,f=e.width,v=e.height;u&&(h>u?f=Math.min(e.height*u,e.width):v=Math.min(e.width/u,e.height)),t={x:e.x+e.width/2-f/2,y:e.y+e.height/2-v/2,width:f,height:v};}this.$["*cropBox"]=_t(Ft(t),e);}co(){let t=this.s;if(!t)return;let e=this.E;if(!e)return;let s=this.$["*imageBox"],o=this.$["*operations"],{mirror:n,flip:a,rotate:l}=o,c=Dt({width:s.width,height:s.height},l);t.save(),t.translate(s.x+s.width/2,s.y+s.height/2),t.rotate(l*Math.PI*-1/180),t.scale(n?-1:1,a?-1:1),t.drawImage(e,-c.width/2,-c.height/2,c.width,c.height),t.restore();}fi(){if(!this.m||!this.E||!this.ui||!this.s)return;let t=this.ui;this.s.clearRect(0,0,t.width,t.height),this.co();}uo({fromViewer:t}){this.E&&(this.pi.value?.toggleThumbs(true),this.po(),setTimeout(()=>{this.className=F({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}Cr(){let t=this.$["*cropBox"],e=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,{width:n,height:a}=e,{width:l,height:c}=Dt(this.he,o),{width:d,height:u}=t,h=n/l,f=a/c;return [yt(Math.round(d/h),1,l),yt(Math.round(u/f),1,c)]}ho(){let t=this.$["*cropBox"],e=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,{width:n,height:a,x:l,y:c}=e,{width:d,height:u}=Dt(this.he,o),{x:h,y:f}=t,v=n/d,I=a/u,R=this.Cr(),P={dimensions:R,coords:[yt(Math.round((h-l)/v),0,d-R[0]),yt(Math.round((f-c)/I),0,u-R[1])]};if(!No(P)){console.error("Cropper is trying to create invalid crop object",{payload:P});return}if(!(R[0]===d&&R[1]===u))return P}wr(){if(!this.isConnected||!this.he)return;let t=this.$["*operations"],{rotate:e,mirror:s,flip:o}=t,n=this.ho(),l={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:s,flip:o};this.$["*editorTransformations"]=l;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this.m&&(this.Er(),this.hi(),this.fi());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this.m){this.m=true,await this.updateComplete,this.di(),this.he=t,this.removeEventListener("transitionend",this.Sr);try{let s=this.$["*originalUrl"],o=this.$["*editorTransformations"];this.E=await this.fo(s,o),this.xr(),this.ci(),this.uo({fromViewer:e});}catch(s){console.error("Failed to activate cropper",{error:s}),this.telemetryManager.sendEventError(s,"cloud editor image. Failed to activate cropper");}this.c=new ResizeObserver(s=>{let[o]=s;if(!o)return;o.contentRect.width>0&&o.contentRect.height>0&&this.m&&this.E&&this.ci();}),this.c.observe(this);}}deactivate({reset:t=false}={}){this.m&&(!t&&this.wr(),this.m=false,this.mo(),this.className=F({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.pi.value?.toggleThumbs(false),this.addEventListener("transitionend",this.Sr,{once:true}),this.c?.disconnect());}mo(){let t=this.Cr(),e=this.$["*cropBox"],s=Math.min(this.offsetWidth,t[0])/e.width,o=Math.min(this.offsetHeight,t[1])/e.height,n=Math.min(s,o),a=e.x+e.width/2,l=e.y+e.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-a)/n}px, ${(this.offsetHeight/2-l)/n}px)`,this.style.transformOrigin=`${a}px ${l}px`;}po(){let t=this.$["*cropBox"],e=t.x+t.width/2,s=t.y+t.height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${s}px`;}Sr(){this.m||(this.E=null);}async fo(t,e){let s=this.offsetWidth;e={...e,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let o=await this.proxyUrl(Kt(t,s,e)),{promise:n,cancel:a,image:l}=oe(o),c=this.Ce(o);return l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),this.f?.(),this.f=a,n.then(()=>l).catch(d=>(console.error("Failed to load image",{error:d}),this.$["*networkProblems"]=true,l))}Ce(t){let e="crop",s=this.$["*loadingOperations"],o=s.get(e);return o||(o=new Map,s.set(e,o)),o.get(t)||(o.set(t,true),this.$["*loadingOperations"]=s),()=>{let n=s.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=s);}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.fi();}),this.sub("*cropBox",()=>{this.E&&this.br();}),this.sub("*currentAspectRatio",()=>{this.hi();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this.m&&this.he&&this.activate(this.he,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.c?.disconnect(),this.E&&(this.E=null);}render(){return m`<canvas class="uc-canvas" ${k(this.Tr)}></canvas><uc-crop-frame ${k(this.pi)}></uc-crop-frame>`}};p([y()],Be.prototype,"E",2);function Li(r,i,t){let e=t,s=t-1,o=new Array(e);for(let n=s;n>=0;n-=1)o[n]=Math.ceil((n*i+(s-n)*r)/s);return o}function _o(r){return typeof r=="string"&&r in H}function Do(r){let i=[];for(let t=0;t<r.length-1;t+=1){let e=r[t],s=r[t+1];typeof e=="number"&&typeof s=="number"&&i.push([e,s]);}return i}function Fo(r,i,t){let e=Do(r).find(([n,a])=>n<=i&&i<=a);if(!e)return r.map(()=>0);let[s,o]=e;return r.map(n=>{let a=Math.abs(s-o)||1,l=Math.abs(i-s)/a;return s===n?i>t?1:1-l:o===n?i>=t?l:1:0})}function Ko(r,i){return r.map((t,e)=>t<i?r.length-e:e)}function os(r,i){let t=H[r].keypointsNumber,{range:e,zero:s}=H[r];return [...new Set([...Li(e[0],s,t+1),...Li(s,e[1],t+1),s,i])].sort((o,n)=>o-n)}var Mi=class extends w{constructor(){super();this.m=false;this.mi=true;this.i="initial";this.kr={};this.J=[];this.Ar=0;this.Lr=C();this.gt=C();this.classList.add("uc-inactive_to_cropper"),this.Rr=U(async(t,e,s)=>{let o=()=>!this.Mr(t,e)||this.yi!==s||!!this.J.find(c=>c.value===s);if(o())return;let n=await this.Ir(t,s),a=new Image;a.src=n.src;let l=this.Ce(n.src);a.addEventListener("load",l,{once:true}),a.addEventListener("error",l,{once:true}),n.image=a,a.classList.add("uc-fader-image"),a.addEventListener("load",()=>{if(o())return;let c=this.J,d=c.findIndex(v=>v.value>s);d===-1&&(d=c.length);let h=c[d]?.image,f=this.gt.value;!f||h&&!f.contains(h)||(c.splice(d,0,n),h?f.insertBefore(a,h):f.appendChild(a),this.bi(t,s));},{once:true}),a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}Ce(t){let e=this.i,s=this.$["*loadingOperations"];s.has(e)||s.set(e,new Map);let o=s.get(e);return o&&!o.get(t)&&(o.set(t,true),this.$["*loadingOperations"]=s),()=>{let n=s.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=s);}}Pr(){window.cancelAnimationFrame(this.Ar),this.Ar=window.requestAnimationFrame(()=>{for(let t of this.J){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}fe({url:t=this.Or,filter:e=this.a??void 0,operation:s,value:o}={}){if(!t)throw new Error("URL is not defined");let n={...this.kr};s&&(s==="filter"?e&&typeof o=="number"&&(n.filter={name:e,amount:o}):typeof o=="number"&&(n[s]=o));let a=this.offsetWidth;return this.proxyUrl(Kt(t,a,n))}async Ir(t,e){return {src:await this.fe({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}Mr(t,e){return this.i===t&&this.a===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!_o(this.i)||!Number.isFinite(e)||(this.bi(this.i,e),this.Rr(this.i,this.a,e));}bi(t,e){this.i=t,this.yi=e;let{zero:s}=H[t],o=this.J.map(l=>l.value),n=Fo(o,e,s),a=Ko(o,s);this.J.forEach((l,c)=>{let d=n[c],u=a[c];typeof d=="number"&&(l.opacity=d),typeof u=="number"&&(l.zIndex=u);}),this.Pr();}$r(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async yo(){this.r=this.r||this.$r();let t=this.r;t&&this.Ur(t);let e=this.J.map(c=>c.src),{images:s,promise:o,cancel:n}=ne(e);s.forEach(c=>{let d=this.Ce(c.src);c.addEventListener("load",d),c.addEventListener("error",d);}),this.gi=()=>{n(),this.gi=void 0;};let a=this.i,l=this.a;if(await o,this.m&&this.Mr(a,l)){let c=this.gt.value;if(!c)return;c.replaceChildren(),this.J.forEach((d,u)=>{let h=s[u];h&&(h.classList.add("uc-fader-image"),d.image=h,c.appendChild(h));}),this.Pr();}}async setTransformations(t){if(this.kr=t,this.r){let e=await this.fe(),s=this.Ce(e);this.r.src=e,this.r.addEventListener("load",s,{once:true}),this.r.addEventListener("error",s,{once:true}),this.r.style.opacity="1",this.r.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:t,filter:e,operation:s,value:o}){if(!s||typeof o!="number")return;this.vi?.();let n=os(s,o),a=await Promise.all(n.map(c=>this.fe({url:t,filter:e,operation:s,value:c}))),{cancel:l}=ne(a);this.vi=l;}go(t){let e=this.r||this.$r();if(this.Ur(e),this.r=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=F({"uc-active_from_viewer":this.Ke,"uc-active_from_cropper":!this.Ke,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let s=this.Ce(t);e.addEventListener("error",s,{once:true}),e.src=t,e.addEventListener("load",()=>{s(),e&&(e.style.opacity="1",e.style.transform="scale(1)",this.className=F({"uc-active_from_viewer":this.Ke,"uc-active_from_cropper":!this.Ke,"uc-inactive_to_cropper":false}));},{once:true}),e.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}async activate({url:t,operation:e,value:s,filter:o,fromViewer:n}){if(this.m=true,this.mi=false,await this.updateComplete,this.Or=t,this.i=e??"initial",this.yi=s,this.a=o,this.Ke=n,typeof s!="number"&&!o){let l=await this.fe({operation:e,value:s});this.go(l),this.Ti();return}!e||typeof s!="number"||(this.J=await Promise.all(os(e,s).map(l=>this.Ir(e,l))),this.bi(e,s),this.yo());}deactivate({hide:t=true}={}){this.m=false,this.gi?.(),this.vi?.(),t&&!this.mi?(this.mi=true,this.r&&(this.r.style.transform="scale(1)"),this.className=F({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.Ti();},{once:true})):this.Ti();}Ur(t){let e=this.Lr.value;e&&(e.contains(t)||e.appendChild(t));}Ti(){this.gt.value?.replaceChildren();}render(){return m`<div class="uc-fader-preview-host" ${k(this.Lr)}></div><div class="uc-fader-layers-host" ${k(this.gt)}></div>`}};var ns="important",Vo=" !"+ns,le=z(class extends q{constructor(r){if(super(r),r.type!==lt.ATTRIBUTE||r.name!=="style"||r.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(r){return Object.keys(r).reduce((i,t)=>{let e=r[t];return e==null?i:i+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${e};`},"")}update(r,[i]){let{style:t}=r.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(i)),this.render(i);for(let e of this.ft)i[e]==null&&(this.ft.delete(e),e.includes("-")?t.removeProperty(e):t[e]=null);for(let e in i){let s=i[e];if(s!=null){this.ft.add(e);let o=typeof s=="string"&&s.endsWith(Vo);e.includes("-")||o?t.setProperty(e,o?s.slice(0,-11):s,o?ns:""):t[e]=s;}}return D}});var nt=class extends w{constructor(){super();this.wi=0;this.vt=C();this._r=C();this.Dr=C();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.ee=0;this.bo=t=>{t.stopPropagation();let e=this.Fr(t);e!==null&&(this.xi(e),this.vo("slider-input",e));};this.To=t=>{t.stopPropagation();let e=this.Fr(t);e!==null&&this.xi(e);};this.Kr=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.Vr=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}vo(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.wi=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.zr(this.ee),this.Ei(),this.c=new ResizeObserver(()=>{this.Ei(),this.bt(this.ee);}),this.c.observe(this);let e=this.vt.value;e?.addEventListener("focus",this.Kr),e?.addEventListener("blur",this.Vr),window.setTimeout(()=>{this.bt(this.ee);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.ee&&this.xi(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.Ei(),this.bt(this.ee)),t.has("zero")&&this.hasUpdated&&this.jr(this.ee);}bt(t){this.jr(t);let e=this.max-this.min;if(e===0)return;let{width:s}=this.getBoundingClientRect(),a=100/e*(t-this.min)*(s-this.wi)/100;window.requestAnimationFrame(()=>{let l=this._r.value;l&&(l.style.transform=`translateX(${a}px)`);});}jr(t){if(!this.Ve)return;let e=this.max-this.min;if(e===0)return;this.Ve.style.opacity=t===this.zero?"0":"1";let{width:s}=this.getBoundingClientRect(),a=100/e*(this.zero-this.min)*(s-this.wi)/100;window.requestAnimationFrame(()=>{this.Ve&&(this.Ve.style.transform=`translateX(${a}px)`);});}Ei(){let e=this.Dr.value;if(!e)return;let{width:s}=e.getBoundingClientRect(),o=Math.ceil(s/2),n=Math.ceil(o/15)-2;if(this.Nr===n)return;let a=document.createDocumentFragment(),l=document.createElement("div"),c=document.createElement("div");l.className="uc-minor-step",c.className="uc-border-step",a.appendChild(c);for(let u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());for(let u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());let d=document.createElement("div");d.className="uc-zero-dot",a.appendChild(d),this.Ve=d,e.innerHTML="",e.appendChild(a),this.Nr=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.vt.value;t?.removeEventListener("focus",this.Kr),t?.removeEventListener("blur",this.Vr),this.c?.disconnect(),this.c=void 0;}xi(t){Number.isFinite(t)&&(this.ee=t,this.hasUpdated&&(this.zr(t),this.bt(t)));}zr(t){let e=this.vt.value;e&&(e.value=String(t));}Fr(t){let e=t.currentTarget;if(!e)return null;let s=Number.parseInt(e.value,10);return Number.isFinite(s)?s:null}render(){return m`<div class="uc-steps" ${k(this.Dr)}></div><div class="uc-thumb" ${k(this._r)}></div><input class="uc-input" type="range" ${k(this.vt)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.ee)} ?disabled=${this.disabled} @input=${this.bo} @change=${this.To} />`}};p([g({type:Boolean,reflect:true})],nt.prototype,"disabled",2),p([g({type:Number})],nt.prototype,"min",2),p([g({type:Number})],nt.prototype,"max",2),p([g({type:Number,attribute:false})],nt.prototype,"defaultValue",2),p([g({type:Number})],nt.prototype,"zero",2),p([y()],nt.prototype,"ee",2);var Y="original",Ge=class extends w{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.wo=t=>{let{value:e}=t.detail;this.$["*faderEl"]?.set(e),this.state={...this.state,value:e};};}setOperation(t,e){this.state={...this.state,operation:t,filter:e},this.xo();let s=this.$["*faderEl"],o=this.state.originalUrl||this.$["*originalUrl"];s&&o&&s.activate({url:o,operation:this.state.operation,value:this.state.filter===Y?void 0:this.state.value,filter:this.state.filter===Y?void 0:this.state.filter,fromViewer:false});}xo(){let t=this.state.operation,{range:e,zero:s}=H[t],[o,n]=e;this.state={...this.state,min:o,max:n,zero:s};let l=this.$["*editorTransformations"][t];if(t==="filter"){let d=Number(n),u=l;if(u){let{name:h,amount:f}=u;d=h===this.state.filter?f:n;}this.state={...this.state,value:d,defaultValue:d};return}let c=typeof l<"u"?l:s;this.state={...this.state,value:c,defaultValue:c};}apply(){let e={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===Y?delete e.filter:e.filter={name:this.state.filter,amount:this.state.value}:e[this.state.operation]=this.state.value,this.$["*editorTransformations"]=e;}cancel(){this.$["*faderEl"]?.deactivate({hide:false});}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{t&&(this.state={...this.state,originalUrl:t});});}updated(t){if(super.updated(t),t.has("state")){let e=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$["*operationTooltip"]=e;}}render(){return m`<uc-slider-ui .disabled=${this.state.disabled} .min=${this.state.min} .max=${this.state.max} .defaultValue=${this.state.defaultValue} .zero=${this.state.zero} @slider-input=${this.wo} ></uc-slider-ui>`}};p([y()],Ge.prototype,"state",2);function Vt(r){if(!r)return null;let i=r.match(/^([A-Za-z]+)\s+(\d+)$/);if(!i)return null;let[,t,e]=i;return !t||typeof e>"u"?null:{filter:t,value:Number(e)}}var N=class extends w{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}get buttonClasses(){let t=this.active;return {"uc-active":t,"uc-not_active":!t}}Hr(){let t=this.buttonClasses;for(let[e,s]of Object.entries(t))this.classList.toggle(e,s);}onClick(t){}connectedCallback(){super.connectedCallback(),this.Hr();}updated(t){super.updated(t),t.has("active")&&this.Hr();}render(){let t=this.onClick,e=this.title;return m`<button role="option" type="button" aria-label=${A(this.titleProp)} title=${A(this.titleProp)} @click=${t} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};p([y()],N.prototype,"active",2),p([y()],N.prototype,"title",2),p([y()],N.prototype,"icon",2),p([y()],N.prototype,"titleProp",2);var qe=12,We=16,jo=r=>{let i=12,t=12;return r.width/r.height>=1?(i=qe,t=Math.round(qe*r.height/r.width)):(t=qe,i=Math.round(qe*r.width/r.height)),{width:i,height:t}},Ii=class extends N{initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this.Eo(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}Eo(i){return i?i.hasFreeform?this.l10n("freeform-crop"):this.l10n("crop-to-shape",{value:`${i.width}:${i.height}`}):""}render(){let i=this.onClick,t=this.title;return m`<button role="option" type="button" class=${ft(this.buttonClasses)} aria-label=${A(this.titleProp)} title=${A(this.titleProp)} @click=${i} ><div class="uc-title" ?hidden=${!t}>${t}</div><uc-icon name=${this.icon}></uc-icon></button>`}},Xe=class extends N{constructor(){super(...arguments);this.v=null;}get aspectRatio(){return this.v}set aspectRatio(t){if(this.v===t)return;let e=this.v;this.v=t,this.requestUpdate("aspectRatio",e),t?this.Br(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.v&&this.Br(this.v),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.v?.id||t?.width===this.v?.width&&t?.height===this.v?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.v?.id&&(this.$["*currentAspectRatio"]=this.v);}Br(t){if(!this.isConnected)return;let e=!!t.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",e);let s=()=>{let n=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=n,n},o=()=>{let n=this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:e?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${t.width}:${t.height}`}).toLowerCase(),value:""});return this.titleProp=n,n};s(),o(),e||this.requestUpdate();}Co(){let t=this.v;if(!t||t.hasFreeform)return m`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:s}=jo(t),o=(We-e)/2,n=(We-s)/2;return m`<uc-icon><svg viewBox="0 0 ${We} ${We}" aria-hidden="true" focusable="false" ><rect x=${o} y=${n} width=${e} height=${s} rx="2" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" ></rect></svg></uc-icon>`}render(){let t=this.onClick,e=this.title;return m`<button role="option" type="button" class=${ft(this.buttonClasses)} aria-label=${A(this.titleProp)} title=${A(this.titleProp)} @click=${t} >${this.Co()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};p([g({attribute:false})],Xe.prototype,"aspectRatio",1);function zo(r){let i=r+90;return i=i>=360?0:i,i}function Ho(r,i){if(r==="rotate")return zo(typeof i=="number"?i:0);if(r==="mirror"||r==="flip")return !i;throw new Error(`Unsupported operation: ${r}`)}var Ye=class extends N{constructor(){super(...arguments);this.operation=void 0;}willUpdate(t){super.willUpdate(t),this.operation?(this.titleProp=this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(this.operation).toLowerCase()}),this.icon=this.operation):(this.icon="",this.titleProp="");}onClick(t){if(!this.operation)return;let e=this.$["*cropperEl"],s=e.getValue(this.operation),o=Ho(this.operation,s);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:o,prev:s}),e.setValue(this.operation,o);}};p([g({type:String})],Ye.prototype,"operation",2);var gt=class extends N{constructor(){super(...arguments);this.i="";this.a="";this.ze="";this.Tt=0;this.r=null;this.ke=false;this.isOriginal=false;this.Gr=20;}get filter(){return this.a}set filter(t){let e=t??"";if(this.a===e)return;let s=this.a;this.a=e,this.i="filter",this.isOriginal=e===Y,this.icon=this.isOriginal?"original":"slider",this.Gr=this.isOriginal?40:20,this.requestUpdate("filter",s),this.isConnected&&this.qr(e);}onClick(t){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this.i,this.a),this.$["*showSlider"]=true);else {let e=this.$["*sliderEl"];e.setOperation(this.i,this.a),e.apply();}this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:Vt(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.a;}So(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.Gr||32,s=window.devicePixelRatio,o=Math.ceil(s*e),n=s>=2?"lightest":"normal",a=100,l={...this.$["*editorTransformations"]};return l[this.i]=this.a!==Y?{name:this.a,amount:a}:void 0,tt(this.ze,J(Ae,ct(l),`quality/${n}`,`scale_crop/${o}x${o}/center`,`@clib/${It}/${Pt}/uc-cloud-image-editor/`))}async ko(t,e){t[0]?.isIntersecting?await this.Ci(e):this.f?.();}initCallback(){super.initCallback(),this.c=new window.IntersectionObserver(this.ko.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this.ze=t??"",this.sub("*originalUrl",e=>{this.ze=e??"",!this.isOriginal&&this.ze&&this.isConnected&&!this.r&&(this.c?.observe(this),this.me());}),this.isOriginal||(this.c?.observe(this),this.me()),this.a&&this.qr(this.a),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.a);}),this.sub("*networkProblems",async e=>{e||(this.r?await this.Ci():this.me());});}disconnectedCallback(){super.disconnectedCallback(),this.c?.disconnect(),this.f?.(),this.wt();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.c?.unobserve(this):(this.c?.observe(this),this.me()));}qr(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async Ci(t){if(!this.isConnected){t?.unobserve(this),this.f?.(),this.f=void 0;return}if(!this.ze){!this.Se&&!this.te&&this.me();return}let e=++this.Tt,s="";try{s=await this.proxyUrl(this.So());}catch(a){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:a});return}this.ke=false,this.f?.();let{promise:o,cancel:n}=oe(s);this.f=()=>{n(),this.Tt===e&&(this.f=void 0);};try{if(await o,this.Tt!==e||!this.isConnected)return;this.r=s,this.ke=!0,this.wt(),(t??this.c)?.unobserve(this);}catch(a){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:a}),this.me();}finally{this.Tt===e&&(this.f=void 0);}}me(){if(!this.isConnected||this.r||this.ke||this.isOriginal||this.$["*networkProblems"]){this.wt();return}this.te&&cancelAnimationFrame(this.te),this.te=requestAnimationFrame(()=>{if(this.te=void 0,!this.isConnected||this.r||this.ke||this.isOriginal){this.wt();return}let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,s=window.innerWidth||document.documentElement.clientWidth,o=window.innerHeight||document.documentElement.clientHeight;if(e&&t.bottom>0&&t.right>0&&t.top<o&&t.left<s){this.Ci();return}this.Se=window.setTimeout(()=>{this.Se=void 0,this.me();},500);});}wt(){this.te&&(cancelAnimationFrame(this.te),this.te=void 0),this.Se&&(window.clearTimeout(this.Se),this.Se=void 0);}get Oo(){return !!(this.ke&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.Oo?"1":"0"};this.r&&(e.backgroundImage=`url(${this.r})`);let s={opacity:this.active||this.isOriginal?"1":"0"};return m`<button role="option" type="button" class=${ft(this.buttonClasses)} aria-label=${A(this.titleProp)} title=${A(this.titleProp)} @click=${t} ><div class="uc-preview" ?data-loaded=${this.ke} style=${le(e)}></div><uc-icon class=${ft({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${le(s)} ></uc-icon></button>`}};p([y()],gt.prototype,"r",2),p([y()],gt.prototype,"ke",2),p([y()],gt.prototype,"isOriginal",2),p([y()],gt.prototype,"Gr",2),p([g({type:String})],gt.prototype,"filter",1);var Ze=class extends N{constructor(){super(...arguments);this.i="";}get operation(){return this.i}set operation(t){let e=t??"";if(this.i===e)return;let s=this.i;this.i=e,this.requestUpdate("operation",s),this.isConnected&&e&&this.Wr(e);}Wr(t){this.icon=t;let e=()=>{let o=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=o,o},s=()=>{let o=this.l10n(t);return this.title=o,o};e(),s();}initCallback(){super.initCallback(),this.i&&this.Wr(this.i),this.sub("*editorTransformations",t=>{if(!this.i)return;let{zero:e}=H[this.i],s=t[this.i],o=typeof s<"u"?s!==e:false;this.active=o;});}onClick(t){this.$["*sliderEl"]?.setOperation(this.i),this.$["*showSlider"]=true,this.$["*currentOperation"]=this.i,this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:Vt(this.$["*operationTooltip"])});}};p([g({type:String})],Ze.prototype,"operation",1);var Bo=1,as=()=>{},Qe=class extends w{constructor(){super(...arguments);this.hiddenScrollbar=false;this.Xr=t=>{t.preventDefault();let{deltaY:e,deltaX:s}=t;if(Math.abs(s)>Bo){this.scrollLeft+=s;return}this.scrollLeft+=e;};}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.Xr,{passive:false}),this.addEventListener("scroll",as,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.Xr),this.removeEventListener("scroll",as),super.disconnectedCallback();}};p([g({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],Qe.prototype,"hiddenScrollbar",2);var V=class extends w{constructor(){super(...arguments);this.je=false;this.showMainToolbar=true;this.showSubToolbar=false;this.Yr=true;this.tabList=[...$];this.activeTab=O.CROP;this.xt=true;this.Si=false;this.Zr=null;this.Qr=0;this.Jr=0;this.Et=C();this.es=C();this.tabToggleRefs={[O.CROP]:C(),[O.TUNING]:C(),[O.FILTERS]:C()};this.ts=()=>{this.ye();};this.He=[];this.Ct=U(t=>{this.je=t;},500);this.St=U(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],s="",o=false;if(this.$["*tabId"]===O.FILTERS)if(o=true,this.$["*currentFilter"]&&t?.filter?.name===this.$["*currentFilter"]){let n=t?.filter?.amount||100;s=`${this.$["*currentFilter"]} ${n}`;}else s=this.l10n(Y);else if(this.showSubToolbar&&this.$["*tabId"]===O.TUNING&&e){o=true;let n=t?.[e]||H[e].zero;s=`${this.l10n(e)} ${n}`;}o&&(this.$["*operationTooltip"]=s),this.Si=o;},0);this.Ao={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.Ro={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.Lo={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.Mo={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":Y,"*currentOperation":null,"*operationTooltip":null};this.zo=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.f?.();let e=this.$["*on.cancel"];e?.();};this.jo=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.Ho=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:Vt(this.$["*operationTooltip"])}),this.Et.value?.apply(),this.rs();};this.Bo=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.Et.value?.cancel(),this.rs();};this.Go=t=>{let s=t.currentTarget?.getAttribute("data-id");s&&(this.telemetryManager.sendEventCloudImageEditor(t,s),this.ki(s,{fromViewer:false}));};}rs(){this.$["*showSlider"]=false,this.$["*tabId"]===O.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===O.TUNING&&(this.Si=false);}ki(t,{fromViewer:e=false,force:s=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.ss(t,{fromViewer:e,force:s});}ss(t,{fromViewer:e,force:s=false}){if(!s&&this.activeTab===t){this.ye();return}this.activeTab=t;let o=this.$["*faderEl"],n=this.$["*cropperEl"];t===O.CROP?(o?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:e})):(o?.activate({url:this.$["*originalUrl"],fromViewer:e}),n?.deactivate());for(let a of $){let l=a===t,d=this.tabToggleRefs[a]?.value;d&&(d.active=l),l&&this.ye();}}ye(){let e=this.tabToggleRefs[this.activeTab]?.value,s=this.es.value;if(!e||!s)return;let o=e.offsetLeft,n=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.Qr!==o||this.Jr!==n)&&(this.Qr=o,this.Jr=n,s.style.transform=`translateX(${o}px)`,s.style.width=`${n}px`);}get Oi(){return this.He.length>=3}Io(t){switch(t){case O.CROP:return this.Po();case O.FILTERS:return this.$o();case O.TUNING:return this.Uo();default:return []}}Po(){let t=[];if(this.Oi)t.push(()=>this.No());else for(let e of this.He)t.push(()=>this.os(e));for(let e of gr)t.push(()=>this._o(e));return this.Ai(t)}$o(){let e=[Y,...yr].map(s=>()=>this.Do(s));return this.Ai(e)}Uo(){let t=mr.map(e=>()=>this.Fo(e));return this.Ai(t)}Ai(t){return t.length?t.map(s=>s()):[]}No(){return m`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}os(t){return m`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}_o(t){return m`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}Do(t){return m`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}Fo(t){return m`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}Ko(){return this.Oi?this.He.map(t=>this.os(t)):[]}async Vo(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(Kt(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.f?.();let{cancel:s}=ne([e]);this.f=()=>{s(),this.f=void 0;};}}initCallback(){super.initCallback();let t=this.$["*cropPresetList"]??[];this.He=[...t],this.sub("*cropPresetList",e=>{this.He=[...e??[]];}),this.sub("*imageSize",e=>{e&&setTimeout(()=>{this.ki(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let s=e?.filter?.name;this.$["*currentFilter"]!==s&&(this.$["*currentFilter"]=s??"");}),this.sub("*currentFilter",()=>{this.St();}),this.sub("*currentOperation",()=>{this.St();}),this.sub("*tabId",e=>{this.ss(e,{fromViewer:false,force:true}),this.St();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.Vo(),this.$["*faderEl"]?.setTransformations(e);}),this.sub("*loadingOperations",e=>{let s=false;for(let[,o]of e.entries()){if(s)break;for(let[,n]of o.entries())if(n){s=true;break}}this.Ct(s);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.xt=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.xt=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.Yr=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[s]=e;s&&this.ki(s,{fromViewer:false});return}this.ye();}),this.sub("*operationTooltip",e=>{this.Zr=e;}),this.St();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.ts);}firstUpdated(t){super.firstUpdated(t),this.kt(),this.ye();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.ye()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.kt();}disconnectedCallback(){window.removeEventListener("resize",this.ts),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}kt(){let t=this.Et.value;t&&(this.$["*sliderEl"]=t);}qo(t){let e=this.tabList.includes(t),s=this.activeTab===t,o=this.tabList.indexOf(t),n=o>=0?le({gridColumn:`${o+1}`}):T;return m`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.Lo}><uc-btn-ui theme="tab" data-id=${t} icon=${t} role="tab" aria-controls=${`tab_${t}`} aria-selected=${s?"true":"false"} title-prop=${`a11y-editor-tab-${t}`} .active=${s} style=${n} @click=${this.Go} ${k(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Wo(t){let e=this.Io(t);return m`<div id=${`tab_${t}`} class="uc-tab-content" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner">${e.length?e:T}</div></div></uc-editor-scroller></div>`}render(){let t=["uc-info-tooltip",this.Si?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.Oi;return m`<uc-line-loader-ui .active=${this.je}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.Zr??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.Ao} ><div class="uc-tab-content-row">${$.map(s=>Yt(this.activeTab===s,()=>this.Wo(s)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.Yr} .styles=${this.Mo} @initial-render=${()=>this.ye()} ><div class="uc-tab-toggles_indicator" ${k(this.es)} ></div>${$.map(s=>this.qo(s))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.zo} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.jo}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.Ro}><div class="uc-slider" ?hidden=${!this.xt}><uc-editor-slider ${k(this.Et)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.xt||!e}>${e?m`<div class="uc-list-aspect-ratio">${this.Ko()}</div>`:T}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.Bo} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.Ho} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};p([y()],V.prototype,"je",2),p([y()],V.prototype,"showMainToolbar",2),p([y()],V.prototype,"showSubToolbar",2),p([y()],V.prototype,"Yr",2),p([y()],V.prototype,"tabList",2),p([y()],V.prototype,"activeTab",2),p([y()],V.prototype,"xt",2),p([y()],V.prototype,"Si",2),p([y()],V.prototype,"Zr",2),p([y()],V.prototype,"He",2);var ls=kt([...$]),_=class extends w{constructor(){super(...arguments);this.ctxOwner=true;this.Xo="";this.fe=ht;this.Yo="";this.je=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=ls;this.ns=false;this.Z=false;this.Ri=null;this.Ct=U(t=>{this.je=t;},300);this.Ot=C();this.as=C();this.ls=C();this.cs=C();this.us=()=>{this.Ct(false),this.fe!==ht&&(this.$["*networkProblems"]=false);};this.ps=()=>{this.Ct(false),this.$["*networkProblems"]=true;};this.Zo=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...Gr(this)};}static{this.styleAttrs=["uc-cloud-image-editor"];}Qo(){this.Z||this.Ri||(this.Ri=this.updateComplete.then(()=>{this.Ri=null,this.Z=true;}));}initCallback(){super.initCallback(),this.ds(),this.hs();}kt(){let t=this.ls.value;t&&(this.$["*faderEl"]=t);let e=this.as.value;e&&(this.$["*cropperEl"]=e);let s=this.cs.value;s&&(this.$["*imgContainerEl"]=s);let o=this.Ot.value;o&&(this.$["*imgEl"]=o);}Jo(){let t=this.Ot.value;t&&(t.addEventListener("load",this.us),t.addEventListener("error",this.ps));}en(){let t=this.Ot.value;t&&(t.removeEventListener("load",this.us),t.removeEventListener("error",this.ps));}get tn(){let t=this.$["*tabId"];return F("uc-image",{"uc-image_hidden_to_cropper":t===O.CROP,"uc-image_hidden_effects":t!==O.CROP})}fs(){return new Promise((e,s)=>{let o=window.setTimeout(()=>{s(new Error("[cloud-image-editor] timeout waiting for non-zero container size"));},3e3),n=new ResizeObserver(a=>{let[l]=a;l&&l.contentRect.width>0&&l.contentRect.height>0&&(window.clearTimeout(o),n.disconnect(),window.setTimeout(()=>e(),0));});n.observe(this);})}firstUpdated(t){super.firstUpdated(t),this.kt(),this.Jo(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),s=t.has("uuid")||t.has("cdnUrl");e&&!s&&this.updateImage();}disconnectedCallback(){this.en(),super.disconnectedCallback();}render(){let t=this.Yo??"",e=this.Xo??"",s=this.fe||ht,o=this.je,n=this.ns;return m` ${sr(qr)}<div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" .visible=${n}><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" @click=${this.Zo}></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">${t}</div></div><div class="uc-image_container" ${k(this.cs)}><img src=${s} class=${this.tn} ${k(this.Ot)} />${Yt(this.Z,()=>m`<uc-editor-image-cropper ${k(this.as)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${k(this.ls)}></uc-editor-image-fader></div><div class="uc-info_pan">${e}</div></div><div class="uc-toolbar"><uc-line-loader-ui .active=${o}></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor">${Yt(this.Z,()=>m`<uc-editor-toolbar></uc-editor-toolbar>`)}</div></div></div>`}updated(t){super.updated(t),t.has("uuid")&&this.uuid&&this.updateImage(),t.has("cdnUrl")&&this.cdnUrl&&this.updateImage(),t.has("tabs")&&this.ds(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.hs();}ds(){let t=this.tabs||ls;this.$["*tabList"]=Br(t);}hs(){let t=zr(this.cropPreset??""),e=null;if(this.cdnUrl){let s=mi(this.cdnUrl),o=gi(s);if(Array.isArray(o?.crop?.dimensions)){let[n,a]=o.crop.dimensions;e=Hr(n,a,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){if(await this.fs(),this.cdnUrl){let t=this.cdnUrl,e=Oe(t),s=yi(t,e);if(s===this.$["*originalUrl"])return;this.$["*originalUrl"]=s;let o=mi(t),n=gi(o);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=yi(this.cfg.cdnCname,this.uuid);if(t===this.$["*originalUrl"])return;this.$["*originalUrl"]=t,Object.keys(this.$["*editorTransformations"]).length>0&&(this.$["*editorTransformations"]={});}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===O.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(tt(t,J("json"))),s=await fetch(e).then(a=>a.json()),{width:o,height:n}=s;this.$["*imageSize"]={width:o,height:n},this.$["*tabId"]===O.CROP?this.$["*cropperEl"]?.activate(this.$["*imageSize"]):this.$["*faderEl"]?.activate({url:t});}catch(t){t&&(this.telemetryManager.sendEventError(t,"cloud editor image. Failed to load image info"),console.error("Failed to load image info",t));}this.Qo();}}async initEditor(){try{await this.fs();}catch(t){this.isConnected&&console.error(t.message);return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.ns=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],s=J(ct(t),"preview"),o=tt(e,s),n={originalUrl:e,cdnUrlModifiers:s,cdnUrl:o,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};p([y()],_.prototype,"Xo",2),p([y()],_.prototype,"fe",2),p([y()],_.prototype,"Yo",2),p([y()],_.prototype,"je",2),p([g({type:String,reflect:true})],_.prototype,"uuid",2),p([g({type:String,attribute:"cdn-url",reflect:true})],_.prototype,"cdnUrl",2),p([g({type:String,attribute:"crop-preset",reflect:true})],_.prototype,"cropPreset",2),p([g({type:String,reflect:true})],_.prototype,"tabs",2),p([y()],_.prototype,"ns",2),p([y()],_.prototype,"Z",2);var cs=class extends _{static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:st.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var Go=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function qo(r){for(let i in r){if(Go.includes(i))continue;let t=[...i].reduce((e,s)=>(s.toUpperCase()===s&&(s=`-${s.toLowerCase()}`),e+=s,e),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("uc-")||(t=`uc-${t}`),r[i].reg&&r[i].reg(t);}}var Je=r=>r.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(i=>i.toLowerCase()).join("-");var us=new Set;function ds(r){us.has(r)||(us.add(r),console.warn(r));}var Wo=[{test:r=>!!r.accept&&!!r.imgOnly,message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:r=>r.enableVideoRecording!==null,message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:r=>r.defaultCameraMode!==null,message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],ps=U(r=>{for(let{test:i,message:t}of Wo)i(r)&&ds(t);},0);var hs=(r,i)=>{let t=new URL(i);return t.hostname=`${r}.${t.hostname}`,t.toString().replace(/\/$/,"")},Xo="0123456789abcdefghijklmnopqrstuvwxyz",fs=r=>{if(r<=0n)return "0";let i="";for(;r>0n;){let t=r%36n;i=Xo[Number(t)]+i,r=r/36n;}return i},Pi=(r,i)=>{try{let t=new URL(r),e=new URL(i);return t.hostname.endsWith(e.hostname)}catch{return false}};var Yo=async r=>{let i=new TextEncoder().encode(r),t=await window.crypto.subtle.digest("SHA-256",i),e=Array.from(new Uint8Array(t)).map(s=>s.toString(16).padStart(2,"0")).join("");return BigInt(`0x${e}`)},Zo=10,Qo=async r=>{let i=await Yo(r);return fs(i).slice(0,Zo)},ms=async(r,i)=>{let t=await Qo(r);return hs(t,i)};var ys=r=>r instanceof Promise||!!(r&&typeof r=="object"&&"then"in r&&typeof r.then=="function");var $i=r=>r,Jo=[$i({key:"cameraModes",deps:["enableVideoRecording"],fn:({cameraModes:r,enableVideoRecording:i})=>{if(i===null)return r;let t=St(r);return i&&!t.includes("video")?t=t.concat("video"):i||(t=t.filter(e=>e!=="video")),kt(t)}}),$i({key:"cameraModes",deps:["defaultCameraMode"],fn:({cameraModes:r,defaultCameraMode:i})=>{if(i===null)return r;let t=St(r);return t=t.sort((e,s)=>e===i?-1:s===i?1:0),kt(t)}}),$i({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:({pubkey:r,cdnCname:i,cdnCnamePrefixed:t})=>r&&(i===vi||Pi(i,t))?ms(r,t):i})],gs=({key:r,setValue:i,getValue:t,computationControllers:e})=>{for(let s of Jo)if(s.deps.includes(r)){let o={[s.key]:t(s.key)};for(let l of s.deps)o[l]=t(l);let n=new AbortController;e.get(s.key)?.abort(),e.set(s.key,n);let a;try{a=s.fn(o,{signal:n.signal});}catch(l){e.get(s.key)===n&&e.delete(s.key),console.error(`Failed to compute value for "${s.key}"`,l);return}ys(a)?a.then(l=>{n.signal.aborted||i(s.key,l);}).catch(l=>{n.signal.aborted||console.error(`Failed to compute value for "${s.key}"`,l);}).finally(()=>{e.get(s.key)===n&&e.delete(s.key);}):i(s.key,a);}};var Ui=Object.freeze({PHOTO:"photo",VIDEO:"video"});var E=r=>String(r),M=r=>{let i=Number(r);if(Number.isNaN(i))throw new Error(`Invalid number: "${r}"`);return i},S=r=>{if(typeof r>"u"||r===null)return false;if(typeof r=="boolean")return r;if(r==="true"||r==="")return true;if(r==="false")return false;throw new Error(`Invalid boolean: "${r}"`)},vs=r=>r==="auto"?r:S(r),bs=r=>{let i=E(r);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},Ts=r=>{let i=E(r);if(!Object.values(Ui).includes(i))throw new Error(`Invalid value: "${i}"`);return i},ws=r=>{let i=E(r),t=St(i);if(t.some(e=>!Object.values(Ui).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},xs=r=>{let i=E(r);if(i==="local"||i==="global")return i;if(S(r)===false)return false;throw new Error(`Invalid value: "${i}"`)},Es=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.")},ti=r=>{if(typeof r=="object")return r;throw new Error("Invalid value. Must be an object.")},ei=r=>{if(typeof r=="function")return r;throw new Error("Invalid value. Must be a function.")},Ni=r=>{if(Array.isArray(r))return r;throw new Error("Must be an array.")},Cs=r=>{let i=E(r);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)};var tn={pubkey:E,multiple:S,multipleMin:M,multipleMax:M,confirmUpload:S,imgOnly:S,accept:E,externalSourcesPreferredTypes:E,externalSourcesEmbedCss:E,store:vs,cameraMirror:S,cameraCapture:bs,sourceList:E,topLevelOrigin:E,maxLocalFileSizeBytes:M,thumbSize:M,showEmptyList:S,useLocalImageEditor:S,useCloudImageEditor:S,cloudImageEditorTabs:E,removeCopyright:S,cropPreset:E,imageShrink:E,modalScrollLock:S,modalBackdropStrokes:S,sourceListWrap:S,remoteTabSessionKey:E,cdnCname:E,cdnCnamePrefixed:E,baseUrl:E,socialBaseUrl:E,secureSignature:E,secureExpire:E,secureDeliveryProxy:E,retryThrottledRequestMaxTimes:M,retryNetworkErrorMaxTimes:M,multipartMinFileSize:M,multipartChunkSize:M,maxConcurrentRequests:M,multipartMaxConcurrentRequests:M,multipartMaxAttempts:M,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:S,groupOutput:S,userAgentIntegration:E,debug:S,localeName:E,metadata:Es,secureUploadsExpireThreshold:M,localeDefinitionOverride:r=>ti(r),secureUploadsSignatureResolver:r=>ei(r),secureDeliveryProxyUrlResolver:r=>ei(r),iconHrefResolver:r=>ei(r),fileValidators:Ni,collectionValidators:Ni,validationTimeout:M,validationConcurrency:M,cameraModes:ws,defaultCameraMode:Ts,enableAudioRecording:S,enableVideoRecording:S,mediaRecorderOptions:ti,maxVideoRecordingDuration:M,filesViewMode:Cs,gridShowFileNames:S,cloudImageEditorAutoOpen:S,cloudImageEditorMaskHref:E,testMode:S,qualityInsights:S,pasteScope:xs,smartBtn:ti},Ss=(r,i)=>{if(!(typeof i>"u"||i===null))try{return tn[r](i)}catch(t){return console.error(`Invalid value for config key "${r}".`,t),L[r]}};var ii=[...new Set(["debug",...Object.keys(L)])],en=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions","smartBtn"],As=r=>en.includes(r),ce=ii.filter(r=>!As(r)),ks={...Object.fromEntries(ce.map(r=>[Je(r),r])),...Object.fromEntries(ce.map(r=>[r.toLowerCase(),r]))},rn={...Object.fromEntries(ce.map(r=>[Je(r),x(r)])),...Object.fromEntries(ce.map(r=>[r.toLowerCase(),x(r)]))},Os=r=>`__${r}`,ri=class extends w{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(L).map(([t,e])=>[x(t),e]))};this.rn=new Map;}sn(t,e){if(!As(t)){let s=[...new Set([Je(t),t.toLowerCase()])];for(let o of s)typeof e>"u"||e===null?this.removeAttribute(o):this.getAttribute(o)!==e.toString()&&this.setAttribute(o,e.toString());}}nn(t,e){this.$[x(t)]!==e&&(typeof e>"u"||e===null?this.$[x(t)]=L[t]:this.$[x(t)]=e);}At(t,e){let s=this,o=Ss(t,e),n=Os(t);s[n]!==o&&(this.an(t,s[n],o),s[n]=o,this.sn(t,o),this.nn(t,o),this.debugPrint(`"${t}"`,o),ps(this.cfg));}ms(t){let e=this,s=Os(t);return e[s]??this.$[x(t)]}an(t,e,s){this.cfg.debug&&s!==e&&typeof s=="object"&&typeof e=="object"&&JSON.stringify(s)===JSON.stringify(e)&&(console.warn(`[uc-config] Option "${t}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${t}" previous value:`,e),console.warn(`[uc-config] "${t}" new value:`,s));}initCallback(){super.initCallback();let t=this;for(let e of ce)this.sub(x(e),s=>{this.At(e,s);},false);for(let e of ii){let s=t[e]??this.$[x(e)];s!==L[e]&&this.At(e,s);let o=Object.getOwnPropertyDescriptor(this,e);(!o||!o.set||!o.get)&&Object.defineProperty(this,e,{set:n=>{this.At(e,n);},get:()=>this.ms(e)});}for(let e of ii)this.sub(x(e),()=>{gs({key:e,setValue:this.At.bind(this),getValue:this.ms.bind(this),computationControllers:this.rn});});}attributeChangedCallback(t,e,s){if(super.attributeChangedCallback(t,e,s),e===s)return;let o=this,n=ks[t];n&&(o[n]=s),rn[t]&&(this[t]=s);}static get observedAttributes(){return [...super.observedAttributes,...Object.keys(ks)]}};for(let r of ii)ri.prototype[r]=void 0;/*! For license information please see uc-cloud-image-editor.min.js.LEGAL.txt */
7
+ var Ls=Object.defineProperty;var Ms=Object.getOwnPropertyDescriptor;var p=(r,i,t,e)=>{for(var s=e>1?void 0:e?Ms(i,t):i,o=r.length-1,n;o>=0;o--)(n=r[o])&&(s=(e?n(i,t,s):n(s))||s);return e&&s&&Ls(i,t,s),s};var ue=globalThis,pe=ue.ShadowRoot&&(ue.ShadyCSS===void 0||ue.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Di=Symbol(),_i=new WeakMap,de=class{constructor(i,t,e){if(this.ys=true,e!==Di)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=i,this.t=t;}get styleSheet(){let i=this.o,t=this.t;if(pe&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=_i.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&_i.set(t,i));}return i}toString(){return this.cssText}},Fi=r=>new de(typeof r=="string"?r:r+"",void 0,Di);var Ki=(r,i)=>{if(pe)r.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),s=ue.litNonce;s!==void 0&&e.setAttribute("nonce",s),e.textContent=t.cssText,r.appendChild(e);}},si=pe?r=>r:r=>r instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return Fi(t)})(r):r;var{is:Is,defineProperty:Ps,getOwnPropertyDescriptor:$s,getOwnPropertyNames:Us,getOwnPropertySymbols:Ns,getPrototypeOf:_s}=Object,he=globalThis,Vi=he.trustedTypes,Ds=Vi?Vi.emptyScript:"",Fs=he.reactiveElementPolyfillSupport,jt=(r,i)=>r,zt={toAttribute(r,i){switch(i){case Boolean:r=r?Ds:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r);}return r},fromAttribute(r,i){let t=r;switch(i){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r);}catch{t=null;}}return t}},fe=(r,i)=>!Is(r,i),ji={attribute:true,type:String,converter:zt,reflect:false,useDefault:false,hasChanged:fe};Symbol.metadata??=Symbol("metadata"),he.litPropertyMetadata??=new WeakMap;var Z=class extends HTMLElement{static addInitializer(i){this.Rt(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.Be&&[...this.Be.keys()]}static createProperty(i,t=ji){if(t.state&&(t.attribute=false),this.Rt(),this.prototype.hasOwnProperty(i)&&((t=Object.create(t)).wrapped=true),this.elementProperties.set(i,t),!t.noAccessor){let e=Symbol(),s=this.getPropertyDescriptor(i,e,t);s!==void 0&&Ps(this.prototype,i,s);}}static getPropertyDescriptor(i,t,e){let{get:s,set:o}=$s(this.prototype,i)??{get(){return this[t]},set(n){this[t]=n;}};return {get:s,set(n){let a=s?.call(this);o?.call(this,n),this.requestUpdate(i,a,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??ji}static Rt(){if(this.hasOwnProperty(jt("elementProperties")))return;let i=_s(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(jt("finalized")))return;if(this.finalized=true,this.Rt(),this.hasOwnProperty(jt("properties"))){let t=this.properties,e=[...Us(t),...Ns(t)];for(let s of e)this.createProperty(s,t[s]);}let i=this[Symbol.metadata];if(i!==null){let t=litPropertyMetadata.get(i);if(t!==void 0)for(let[e,s]of t)this.elementProperties.set(e,s);}this.Be=new Map;for(let[t,e]of this.elementProperties){let s=this.Lt(t,e);s!==void 0&&this.Be.set(s,t);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(i){let t=[];if(Array.isArray(i)){let e=new Set(i.flat(1/0).reverse());for(let s of e)t.unshift(si(s));}else i!==void 0&&t.push(si(i));return t}static Lt(i,t){let e=t.attribute;return e===false?void 0:typeof e=="string"?e:typeof i=="string"?i.toLowerCase():void 0}constructor(){super(),this.Ge=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.ge=null,this.gs();}gs(){this.Mt=new Promise(i=>this.enableUpdating=i),this.ie=new Map,this.vs(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this.Oe??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.Oe?.delete(i);}vs(){let i=new Map,t=this.constructor.elementProperties;for(let e of t.keys())this.hasOwnProperty(e)&&(i.set(e,this[e]),delete this[e]);i.size>0&&(this.Ge=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ki(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.Oe?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this.Oe?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.It(i,e);}bs(i,t){let e=this.constructor.elementProperties.get(i),s=this.constructor.Lt(i,e);if(s!==void 0&&e.reflect===true){let o=(e.converter?.toAttribute!==void 0?e.converter:zt).toAttribute(t,e.type);this.ge=i,o==null?this.removeAttribute(s):this.setAttribute(s,o),this.ge=null;}}It(i,t){let e=this.constructor,s=e.Be.get(i);if(s!==void 0&&this.ge!==s){let o=e.getPropertyOptions(s),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:zt;this.ge=s;let a=n.fromAttribute(t,o.type);this[s]=a??this.Pt?.get(s)??a,this.ge=null;}}requestUpdate(i,t,e,s=false,o){if(i!==void 0){let n=this.constructor;if(s===false&&(o=this[i]),e??=n.getPropertyOptions(i),!((e.hasChanged??fe)(o,t)||e.useDefault&&e.reflect&&o===this.Pt?.get(i)&&!this.hasAttribute(n.Lt(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.Mt=this.Ts());}C(i,t,{useDefault:e,reflect:s,wrapped:o},n){e&&!(this.Pt??=new Map).has(i)&&(this.Pt.set(i,n??t??this[i]),o!==true||n!==void 0)||(this.ie.has(i)||(this.hasUpdated||e||(t=void 0),this.ie.set(i,t)),s===true&&this.ge!==i&&(this.Li??=new Set).add(i));}async Ts(){this.isUpdatePending=true;try{await this.Mt;}catch(t){Promise.reject(t);}let i=this.scheduleUpdate();return i!=null&&await i,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this.Ge){for(let[s,o]of this.Ge)this[s]=o;this.Ge=void 0;}let e=this.constructor.elementProperties;if(e.size>0)for(let[s,o]of e){let{wrapped:n}=o,a=this[s];n!==true||this.ie.has(s)||a===void 0||this.C(s,void 0,o,a);}}let i=false,t=this.ie;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.Oe?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.$t();}catch(e){throw i=false,this.$t(),e}i&&this.xs(t);}willUpdate(i){}xs(i){this.Oe?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}$t(){this.ie=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.Mt}shouldUpdate(i){return true}update(i){this.Li&&=this.Li.forEach(t=>this.bs(t,this[t])),this.$t();}updated(i){}firstUpdated(i){}};Z.elementStyles=[],Z.shadowRootOptions={mode:"open"},Z[jt("elementProperties")]=new Map,Z[jt("finalized")]=new Map,Fs?.({ReactiveElement:Z}),(he.reactiveElementVersions??=[]).push("2.1.2");var ni=globalThis,zi=r=>r,me=ni.trustedTypes,Hi=me?me.createPolicy("lit-html",{createHTML:r=>r}):void 0,ai="$lit$",Q=`lit$${Math.random().toFixed(9).slice(2)}$`,li="?"+Q,Ks=`<${li}>`,wt=document,Bt=()=>wt.createComment(""),Gt=r=>r===null||typeof r!="object"&&typeof r!="function",ci=Array.isArray,Yi=r=>ci(r)||typeof r?.[Symbol.iterator]=="function",oi=`[ \f\r]`,Ht=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Bi=/-->/g,Gi=/>/g,bt=RegExp(`>|${oi}(?:([^\\s"'>=/]+)(${oi}*=${oi}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),qi=/'/g,Wi=/"/g,Zi=/^(?:script|style|textarea|title)$/i,ui=r=>(i,...t)=>({re:r,strings:i,values:t}),m=ui(1),D=Symbol.for("lit-noChange"),T=Symbol.for("lit-nothing"),Xi=new WeakMap,Tt=wt.createTreeWalker(wt,129);function Qi(r,i){if(!ci(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Hi!==void 0?Hi.createHTML(i):i}var Ji=(r,i)=>{let t=r.length-1,e=[],s,o=i===2?"<svg>":i===3?"<math>":"",n=Ht;for(let a=0;a<t;a++){let l=r[a],c,d,u=-1,h=0;for(;h<l.length&&(n.lastIndex=h,d=n.exec(l),d!==null);)h=n.lastIndex,n===Ht?d[1]==="!--"?n=Bi:d[1]!==void 0?n=Gi:d[2]!==void 0?(Zi.test(d[2])&&(s=RegExp("</"+d[2],"g")),n=bt):d[3]!==void 0&&(n=bt):n===bt?d[0]===">"?(n=s??Ht,u=-1):d[1]===void 0?u=-2:(u=n.lastIndex-d[2].length,c=d[1],n=d[3]===void 0?bt:d[3]==='"'?Wi:qi):n===Wi||n===qi?n=bt:n===Bi||n===Gi?n=Ht:(n=bt,s=void 0);let f=n===bt&&r[a+1].startsWith("/>")?" ":"";o+=n===Ht?l+Ks:u>=0?(e.push(c),l.slice(0,u)+ai+l.slice(u)+Q+f):l+Q+(u===-2?a:f);}return [Qi(r,o+(r[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},qt=class r{constructor({strings:i,re:t},e){let s;this.parts=[];let o=0,n=0,a=i.length-1,l=this.parts,[c,d]=Ji(i,t);if(this.el=r.createElement(c,e),Tt.currentNode=this.el.content,t===2||t===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes);}for(;(s=Tt.nextNode())!==null&&l.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(let u of s.getAttributeNames())if(u.endsWith(ai)){let h=d[n++],f=s.getAttribute(u).split(Q),v=/([.?@])?(.*)/.exec(h);l.push({type:1,index:o,name:v[2],strings:f,ctor:v[1]==="."?ge:v[1]==="?"?ve:v[1]==="@"?be:Et}),s.removeAttribute(u);}else u.startsWith(Q)&&(l.push({type:6,index:o}),s.removeAttribute(u));if(Zi.test(s.tagName)){let u=s.textContent.split(Q),h=u.length-1;if(h>0){s.textContent=me?me.emptyScript:"";for(let f=0;f<h;f++)s.append(u[f],Bt()),Tt.nextNode(),l.push({type:2,index:++o});s.append(u[h],Bt());}}}else if(s.nodeType===8)if(s.data===li)l.push({type:2,index:o});else {let u=-1;for(;(u=s.data.indexOf(Q,u+1))!==-1;)l.push({type:7,index:o}),u+=Q.length-1;}o++;}}static createElement(i,t){let e=wt.createElement("template");return e.innerHTML=i,e}};function xt(r,i,t=r,e){if(i===D)return i;let s=e!==void 0?t.Es?.[e]:t.Cs,o=Gt(i)?void 0:i.Ut;return s?.constructor!==o&&(s?.Mi?.(false),o===void 0?s=void 0:(s=new o(r),s.Nt(r,t,e)),e!==void 0?(t.Es??=[])[e]=s:t.Cs=s),s!==void 0&&(i=xt(r,s.Ss(r,i.values),s,e)),i}var ye=class{constructor(i,t){this.Ii=[],this.S=void 0,this.Pi=i,this.n=t;}get parentNode(){return this.n.parentNode}get g(){return this.n.g}u(i){let{el:{content:t},parts:e}=this.Pi,s=(i?.creationScope??wt).importNode(t,true);Tt.currentNode=s;let o=Tt.nextNode(),n=0,a=0,l=e[0];for(;l!==void 0;){if(n===l.index){let c;l.type===2?c=new Lt(o,o.nextSibling,this,i):l.type===1?c=new l.ctor(o,l.name,l.strings,this,i):l.type===6&&(c=new Te(o,this,i)),this.Ii.push(c),l=e[++a];}n!==l?.index&&(o=Tt.nextNode(),n++);}return Tt.currentNode=wt,s}p(i){let t=0;for(let e of this.Ii)e!==void 0&&(e.strings!==void 0?(e._(i,e,t),t+=e.strings.length-2):e._(i[t])),t++;}},Lt=class r{get g(){return this.n?.g??this.$i}constructor(i,t,e,s){this.type=2,this.e=T,this.S=void 0,this.q=i,this.ve=t,this.n=e,this.options=s,this.$i=s?.isConnected??true;}get parentNode(){let i=this.q.parentNode,t=this.n;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.q}get endNode(){return this.ve}_(i,t=this){i=xt(this,i,t),Gt(i)?i===T||i==null||i===""?(this.e!==T&&this.be(),this.e=T):i!==this.e&&i!==D&&this.Ui(i):i.re!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):Yi(i)?this.k(i):this.Ui(i);}O(i){return this.q.parentNode.insertBefore(i,this.ve)}T(i){this.e!==i&&(this.be(),this.e=this.O(i));}Ui(i){this.e!==T&&Gt(this.e)?this.q.nextSibling.data=i:this.T(wt.createTextNode(i)),this.e=i;}$(i){let{values:t,re:e}=i,s=typeof e=="number"?this.ks(i):(e.el===void 0&&(e.el=qt.createElement(Qi(e.h,e.h[0]),this.options)),e);if(this.e?.Pi===s)this.e.p(t);else {let o=new ye(s,this),n=o.u(this.options);o.p(t),this.T(n),this.e=o;}}ks(i){let t=Xi.get(i.strings);return t===void 0&&Xi.set(i.strings,t=new qt(i)),t}k(i){ci(this.e)||(this.e=[],this.be());let t=this.e,e,s=0;for(let o of i)s===t.length?t.push(e=new r(this.O(Bt()),this.O(Bt()),this,this.options)):e=t[s],e._(o),s++;s<t.length&&(this.be(e&&e.ve.nextSibling,s),t.length=s);}be(i=this.q.nextSibling,t){for(this.qe?.(false,true,t);i!==this.ve;){let e=zi(i).nextSibling;zi(i).remove(),i=e;}}setConnected(i){this.n===void 0&&(this.$i=i,this.qe?.(i));}},Et=class{get tagName(){return this.element.tagName}get g(){return this.n.g}constructor(i,t,e,s,o){this.type=1,this.e=T,this.S=void 0,this.element=i,this.name=t,this.n=s,this.options=o,e.length>2||e[0]!==""||e[1]!==""?(this.e=Array(e.length-1).fill(new String),this.strings=e):this.e=T;}_(i,t=this,e,s){let o=this.strings,n=false;if(o===void 0)i=xt(this,i,t,0),n=!Gt(i)||i!==this.e&&i!==D,n&&(this.e=i);else {let a=i,l,c;for(i=o[0],l=0;l<o.length-1;l++)c=xt(this,a[e+l],t,l),c===D&&(c=this.e[l]),n||=!Gt(c)||c!==this.e[l],c===T?i=T:i!==T&&(i+=(c??"")+o[l+1]),this.e[l]=c;}n&&!s&&this.j(i);}j(i){i===T?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},ge=class extends Et{constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===T?void 0:i;}},ve=class extends Et{constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==T);}},be=class extends Et{constructor(i,t,e,s,o){super(i,t,e,s,o),this.type=5;}_(i,t=this){if((i=xt(this,i,t,0)??T)===D)return;let e=this.e,s=i===T&&e!==T||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,o=i!==T&&(e===T||s);s&&this.element.removeEventListener(this.name,this,e),o&&this.element.addEventListener(this.name,this,i),this.e=i;}handleEvent(i){typeof this.e=="function"?this.e.call(this.options?.host??this.element,i):this.e.handleEvent(i);}},Te=class{constructor(i,t,e){this.element=i,this.type=6,this.S=void 0,this.n=t,this.options=e;}get g(){return this.n.g}_(i){xt(this,i);}},Vs=ni.litHtmlPolyfillSupport;Vs?.(qt,Lt),(ni.litHtmlVersions??=[]).push("3.3.2");var er=(r,i,t)=>{let e=t?.renderBefore??i,s=e.Os;if(s===void 0){let o=t?.renderBefore??null;e.Os=s=new Lt(i.insertBefore(Bt(),o),o,void 0,t??{});}return s._(r),s};var di=globalThis,at=class extends Z{constructor(){super(...arguments),this.renderOptions={host:this},this._t=void 0;}createRenderRoot(){let i=super.createRenderRoot();return this.renderOptions.renderBefore??=i.firstChild,i}update(i){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(i),this._t=er(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._t?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._t?.setConnected(false);}render(){return D}};at.ln=true,at.finalized=true,di.litElementHydrateSupport?.({LitElement:at});var js=di.litElementPolyfillSupport;js?.({LitElement:at});(di.litElementVersions??=[]).push("4.2.2");var zs={attribute:true,type:String,converter:zt,reflect:false,hasChanged:fe},Hs=(r=zs,i,t)=>{let{kind:e,metadata:s}=t,o=globalThis.litPropertyMetadata.get(s);if(o===void 0&&globalThis.litPropertyMetadata.set(s,o=new Map),e==="setter"&&((r=Object.create(r)).wrapped=true),o.set(t.name,r),e==="accessor"){let{name:n}=t;return {set(a){let l=i.get.call(this);i.set.call(this,a),this.requestUpdate(n,l,r,true,a);},init(a){return a!==void 0&&this.C(n,void 0,r,a),a}}}if(e==="setter"){let{name:n}=t;return function(a){let l=this[n];i.call(this,a),this.requestUpdate(n,l,r,true,a);}}throw Error("Unsupported decorator location: "+e)};function g(r){return (i,t)=>typeof t=="object"?Hs(r,i,t):((e,s,o)=>{let n=s.hasOwnProperty(o);return s.constructor.createProperty(o,e),n?Object.getOwnPropertyDescriptor(s,o):void 0})(r,i,t)}function y(r){return g({...r,state:true,attribute:false})}var ir=r=>r.strings===void 0;var lt={ATTRIBUTE:1,CHILD:2},z=r=>(...i)=>({Ut:r,values:i}),q=class{constructor(i){}get g(){return this.n.g}Nt(i,t,e){this.We=i,this.n=t,this.Rs=e;}Ss(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var Wt=(r,i)=>{let t=r.S;if(t===void 0)return false;for(let e of t)e.Mi?.(i,false),Wt(e,i);return true},xe=r=>{let i,t;do{if((i=r.n)===void 0)break;t=i.S,t.delete(r),r=i;}while(t?.size===0)},rr=r=>{for(let i;i=r.n;r=i){let t=i.S;if(t===void 0)i.S=t=new Set;else if(t.has(r))break;t.add(r),qs(i);}};function Bs(r){this.S!==void 0?(xe(this),this.n=r,rr(this)):this.n=r;}function Gs(r,i=false,t=0){let e=this.e,s=this.S;if(s!==void 0&&s.size!==0)if(i)if(Array.isArray(e))for(let o=t;o<e.length;o++)Wt(e[o],false),xe(e[o]);else e!=null&&(Wt(e,false),xe(e));else Wt(this,r);}var qs=r=>{r.type==lt.CHILD&&(r.qe??=Gs,r.As??=Bs);},Ee=class extends q{constructor(){super(...arguments),this.S=void 0;}Nt(i,t,e){super.Nt(i,t,e),rr(this),this.isConnected=i.g;}Mi(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(Wt(this,i),xe(this));}setValue(i){if(ir(this.We))this.We._(i,this);else {let t=[...this.We.e];t[this.Rs]=i,this.We._(t,this,0);}}disconnected(){}reconnected(){}};var C=()=>new hi,hi=class{},pi=new WeakMap,k=z(class extends Ee{render(r){return T}update(r,[i]){let t=i!==this.G;return t&&this.G!==void 0&&this.rt(void 0),(t||this.lt!==this.ct)&&(this.G=i,this.ht=r.options?.host,this.rt(this.ct=r.element)),T}rt(r){if(this.isConnected||(r=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=pi.get(i);t===void 0&&(t=new WeakMap,pi.set(i,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,r),r!==void 0&&this.G.call(this.ht,r);}else this.G.value=r;}get lt(){return typeof this.G=="function"?pi.get(this.ht??globalThis)?.get(this.G):this.G?.value}disconnected(){this.lt===this.ct&&this.rt(void 0);}reconnected(){this.rt(this.ct);}});var Ct=class extends q{constructor(i){if(super(i),this.it=T,i.type!==lt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===T||i==null)return this.Ni=void 0,this.it=i;if(i===D)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.Ni;this.it=i;let t=[i];return t.raw=t,this.Ni={re:this.constructor.resultType,strings:t,values:[]}}};Ct.directiveName="unsafeHTML",Ct.resultType=1;var Xt=class extends Ct{};Xt.directiveName="unsafeSVG",Xt.resultType=2;var sr=z(Xt);function Yt(r,i,t){return r?i(r):t?.(r)}var or;(function(r){r.Token="token",r.FileInfo="file_info";})(or||(or={}));var nr;(function(r){r.Unknown="unknown",r.Waiting="waiting",r.Progress="progress",r.Error="error",r.Success="success";})(nr||(nr={}));var Ce=class{Xe=1;Dt=[];Ye=0;Ft=new Map;Kt=new Map;constructor(i){this.Xe=i;}run(){let i=this.Xe-this.Ye;for(let t=0;t<i;t++){let e=this.Dt.shift();if(!e)return;let s=this.Ft.get(e),o=this.Kt.get(e);if(!s||!o)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.Ye+=1,e().finally(()=>{this.Ft.delete(e),this.Kt.delete(e),this.Ye-=1,this.run();}).then(n=>s(n)).catch(n=>o(n));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,s)=>{this.Ft.set(i,e),this.Kt.set(i,s),this.Dt.push(i),t&&this.run();})}get pending(){return this.Dt.length}get running(){return this.Ye}set concurrency(i){this.Xe=i,this.run();}get concurrency(){return this.Xe}};var ar=()=>({});var lr=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var x=r=>`*cfg/${r}`;var St=r=>r?r.split(",").map(i=>i.trim()).filter(Boolean):[],kt=r=>r.join(",");var cr=r=>{if(typeof r!="string"||!r)return "";let i=r.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},Se=(...r)=>r.filter(i=>typeof i=="string"&&!!i).map(i=>cr(i)).join("/-/"),J=(...r)=>{let i=Se(...r);return i?`-/${i}/`:""};function ke(r){let i=new URL(r),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),s=t.lastIndexOf("/"),o="";return e>=0?o=t.slice(e):s>=0&&(o=t.slice(s+1)),o}function Oe(r){let i=new URL(r),{pathname:t}=i,e=t.indexOf("/"),s=t.indexOf("/",e+1);return t.substring(e+1,s)}function fi(r){let i=ur(r),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}function mi(r){return fi(r).split("/-/").filter(Boolean).map(t=>cr(t))}function ur(r){let i=new URL(r),t=ke(r),e=dr(t)?pr(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function dr(r){return r.startsWith("http")}function pr(r){let i=new URL(r);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}var tt=(r,i,t)=>{let e=new URL(ur(r)),s=ke(r),o=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),s&&dr(s)){let n=pr(s);e.pathname=`${e.pathname}${o}${n.pathname||""}`,e.search=n.search,e.hash=n.hash;}else e.pathname=`${e.pathname}${o}${s||""}`;return e.toString()},yi=(r,i)=>{let t=new URL(r);return t.pathname=`${i}/`,t.toString()};var Zt=(r,i=",")=>r.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var Qt=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:false,flip:false,crop:void 0}),fr=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Ws(r,i){if(typeof i=="number"){let t=i;return Qt[r]!==t?`${r}/${t}`:""}if(typeof i=="boolean"){let t=i;return Qt[r]!==t?`${r}`:""}if(r==="filter"&&i){let{name:t,amount:e}=i;return Qt.filter===e?"":`${r}/${t}/${e}`}if(r==="crop"&&i){let{dimensions:t,coords:e}=i;return `${r}/${t.join("x")}/${e.join(",")}`}return ""}function ct(r){return Se(...fr.filter(i=>typeof r[i]<"u"&&r[i]!==null).map(i=>{let t=r[i];return Ws(i,t)}).filter(i=>!!i))}var Ae=Se("format/auto","progressive/yes"),et=([r])=>typeof r<"u"?Number(r):void 0,hr=()=>true,Xs=([r,i])=>({name:r,amount:typeof i<"u"?Number(i):100}),Ys=([r,i])=>{if(!/\d+x\d+/.test(r)||!/\d+,\d+/.test(i))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return {dimensions:Zt(r,"x").map(Number),coords:Zt(i).map(Number)}},Zs=Object.freeze({enhance:et,brightness:et,exposure:et,gamma:et,contrast:et,saturation:et,vibrance:et,warmth:et,filter:Xs,mirror:hr,flip:hr,rotate:et,crop:r=>{let[i,t]=r,{dimensions:e,coords:s}=Ys([i,t]);return {dimensions:e,coords:s}}});function gi(r){let i={};for(let t of r){let[e,...s]=t.split("/");if(!e||!fr.includes(e))continue;let o=e,n=Zs[o];try{let a=n(s);i[o]=a;}catch(a){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,a instanceof Error?`Error message: "${a.message}"`:a,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return i}var O=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),$=Object.freeze([O.CROP,O.TUNING,O.FILTERS]),mr=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),yr=Object.freeze(["adaris","briaril","calarel","carris","cynarel","cyren","elmet","elonni","enzana","erydark","fenralan","ferand","galen","gavin","gethriel","iorill","iothari","iselva","jadis","lavra","misiara","namala","nerion","nethari","pamaya","sarnar","sedis","sewen","sorahel","sorlen","tarian","thellassan","varriel","varven","vevera","virkas","yedis","yllara","zatvel","zevcen"]),gr=Object.freeze(["rotate","mirror","flip"]),it=Qt,H=Object.freeze({brightness:{zero:it.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:it.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:it.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:it.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:it.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:it.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:it.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:it.enhance,range:[0,100],keypointsNumber:1},filter:{zero:it.filter,range:[0,100],keypointsNumber:1}});var vi="https://ucarecdn.com",Qs="https://upload.uploadcare.com",Js="https://social.uploadcare.com",to="https://ucarecd.net",eo={pubkey:"",multiple:true,multipleMin:0,multipleMax:Number.MAX_SAFE_INTEGER,confirmUpload:false,imgOnly:false,accept:"",externalSourcesPreferredTypes:"",externalSourcesEmbedCss:"",store:"auto",cameraMirror:false,cameraCapture:"",sourceList:"local, url, camera, dropbox, gdrive",topLevelOrigin:"",cloudImageEditorTabs:kt($),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:false,useLocalImageEditor:false,useCloudImageEditor:true,removeCopyright:false,cropPreset:"",imageShrink:"",modalScrollLock:true,modalBackdropStrokes:false,sourceListWrap:true,remoteTabSessionKey:"",cdnCname:vi,cdnCnamePrefixed:to,baseUrl:Qs,socialBaseUrl:Js,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:3,retryNetworkErrorMaxTimes:3,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:false,saveUrlForRecurrentUploads:false,groupOutput:false,userAgentIntegration:"",debug:false,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:600*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[],validationTimeout:15*1e3,validationConcurrency:100,cameraModes:"photo, video",defaultCameraMode:null,enableAudioRecording:true,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null,filesViewMode:"list",gridShowFileNames:false,cloudImageEditorAutoOpen:false,cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true,pasteScope:"local",smartBtn:{sourceList:"local, url, camera, dropbox, gdrive",mode:"auto"}},L=Object.freeze(eo);var Re=(r,i)=>(...t)=>{let e=r();if(!e.read(x("debug")))return;let s=t;if(typeof t?.[0]=="function"){let n=t[0];s=n();}let o=[e.id,i].filter(Boolean);console.log(`[${o.join("][")}]`,...s);};var j=class{constructor(i){this.Vt=new Set;this.se=null;this.oe=Re(()=>this.b.ctx,this.constructor.name);this.b=i,this.s=i.ctx;}addSub(i){this.Vt.add(i);}get _i(){if(!this.se){let i={};this.se=new Proxy(i,{set:()=>{throw new Error("SharedInstance cfg proxy is read-only")},get:(t,e)=>{if(typeof e!="string")return;let s=x(e);return this.b.ctx.has(s)?this.b.ctx.read(s):L[e]}});}return this.se}destroy(){for(let i of this.Vt)try{i();}catch{}this.Vt.clear();}},W=(r,i,t=true)=>{let e=r.has(i),s=e?r.read(i):null;if(e&&s||!t)return s;throw new Error(`Unexpected error: shared instance for key "${String(i)}" is not available`)},vr=r=>({get ctx(){return r()},get modalManager(){return W(r(),"*modalManager",false)},get telemetryManager(){return W(r(),"*telemetryManager")},get localeManager(){return W(r(),"*localeManager")},get a11y(){return W(r(),"*a11y")},get blocksRegistry(){return W(r(),"*blocksRegistry")},get eventEmitter(){return W(r(),"*eventEmitter")},get uploadCollection(){return W(r(),"*uploadCollection")},get secureUploadsManager(){return W(r(),"*secureUploadsManager",false)},get api(){return W(r(),"*publicApi")},get validationManager(){return W(r(),"*validationManager")}});var Le=class extends j{constructor(t){super(t);this.scopes=new Set;this.listener=this.Ls.bind(this),window.addEventListener("paste",this.listener);}openUploadList(){this.b.api.setCurrentActivity(lr.UPLOAD_LIST),this.b.api.setModalState(true);}async Ls(t){if(t.clipboardData){for(let e of this.scopes)if(e.isConnected)switch(this._i.pasteScope){case "global":await this.handlePaste(t);break;case "local":if(!e.contains(t.target))continue;await this.handlePaste(t);break;default:continue}}}async handlePaste(t){let e=Array.from(t.clipboardData.items),s=e.map(n=>n.getAsFile()).filter(n=>n!==null),o=e.filter(n=>n.kind==="string"&&n.type==="text/plain").map(n=>new Promise(a=>{n.getAsString(l=>{a(l);});}));s.length>0&&(s.forEach(n=>{this.b.api.addFileFromObject(n,{source:"clipboard"});}),this.openUploadList()),o.length>0&&((await Promise.all(o)).forEach(a=>{this.b.api.addFileFromUrl(a,{source:"clipboard"});}),this.openUploadList());}registerBlock(t){return this.scopes.add(t),()=>{this.scopes.delete(t);}}destroy(){super.destroy(),window.removeEventListener("paste",this.listener),this.scopes.clear();}};var io={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function Jt(r,i){i.tabIndex=0,i.focus(),r.tabIndex=-1;}function bi(r){let i=r.role||r.type||r.tagName;if(!i)return null;let t=io[i.toLowerCase()];if(!t)return null;for(let e of t){let s=r.closest(`[role=${e}]`);if(s)return s}}function Ti(r,i){return i.role==="toolbar"?ro(i):i.querySelectorAll(`[role=${r.role}]`)}function ro(r){return [...r.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}function so(r){let i=r.getAttribute("aria-orientation");if(i==="vertical")return false;if(i==="horizontal")return true;let t=r.role;return t==="menubar"||t==="tablist"||t==="toolbar"}function br(r){return i=>{let t=false,e=300,s=0,o="";function n(u){let h=bi(u.target);if(!h){a();return}let f=Ti(u.target,h),v=Array.from(f).indexOf(u.target),I="ArrowDown",R="ArrowUp";if(so(h)&&(i.document.dir==="rtl"?(I="ArrowLeft",R="ArrowRight"):(I="ArrowRight",R="ArrowLeft")),u.key===I)u.preventDefault(),Jt(u.target,f[v+1]||f[0]);else if(u.key===R)u.preventDefault(),Jt(u.target,f[v-1]||f[f.length-1]);else if(u.key==="Home")u.preventDefault(),Jt(u.target,f[0]);else if(u.key==="End")u.preventDefault(),Jt(u.target,f[f.length-1]);else if(u.key.length===1&&h.role!=="tablist"){let P=Date.now();P-s<=e?o+=u.key.toLowerCase():o=u.key.toLowerCase(),s=P;let vt=Array.from(f).find(Rs=>Rs.textContent?.trim()?.toLowerCase()?.startsWith(o));vt&&(u.preventDefault(),Jt(u.target,vt));}}function a(){t=false,i.removeEventListener("keydown",n);}function l(u){let h=bi(u.target);if(h){t||(t=true,i.addEventListener("keydown",n));let f=Ti(u.target,h);for(let v of f)v!==u.target&&v.setAttribute("tabindex",-1);}else t&&a();}function c(u){(!u.relatedTarget||u.relatedTarget===i.document)&&a();}function d(u){let h=bi(u.target);if(h){let f=Ti(u.target,h);for(let v of f)v!==u.target&&v.setAttribute("tabindex",-1);u.target.setAttribute("tabindex",0);}}return i.addEventListener("click",d),i.addEventListener("focusin",l),i.addEventListener("focusout",c),()=>{a(),i.removeEventListener("click",d),i.removeEventListener("focusin",l),i.removeEventListener("focusout",c);}}}function Tr(){return r=>{let i,t;function e(o){if(o.target.getAttribute("aria-hidden")==="true"){i=o.target,i.setAttribute("aria-hidden","false"),t=i.hidden,t&&(i.hidden=false);let n=o.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');n&&(n.tabIndex=0);}}function s(o){i&&i.contains(o.target)&&(!o.relatedTarget||!i.contains(o.relatedTarget))&&(o.target.tabIndex=-1,i.setAttribute("aria-hidden","true"),t&&(i.hidden=true),i=null);}return r.addEventListener("keyuxJump",e),r.addEventListener("focusout",s),()=>{r.removeEventListener("keyuxJump",e),r.removeEventListener("focusout",s);}}}function wr(){return r=>{let i=[];function t(l){let c=r.document.activeElement;c&&c!==r.document.body&&i.push(new WeakRef(c)),l.focus({focusVisible:true});}function e(){let l=i.pop();if(!l){r.document.activeElement.blur();return}let c=l.deref();c&&c.isConnected?c.focus():e();}let s=0,o;function n(l){clearInterval(o);let c=l.getAttribute("aria-controls");o=setInterval(()=>{if(s++>50){clearInterval(o);return}let d=r.document.getElementById(c);if(d){let u=d.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');u&&(clearInterval(o),d.dispatchEvent(new r.CustomEvent("keyuxJump",{bubbles:true})),t(u));}},50);}function a(l){l.target.getAttribute("aria-controls")&&l.key==="Enter"&&n(l.target),l.key==="Escape"&&e();}return r.addEventListener("keydown",a),()=>{r.removeEventListener("keydown",a);}}}function xr(r){let i,t=r.split(" "),e;function s(a){a.key==="Enter"&&(a.target.tagName==="BUTTON"||a.target.tagName==="A")&&(o(),a.target.classList.add(...t),i=a.target,e=a.target);}function o(){i&&i.classList.remove(...t),e=null;}function n(a){a.clientX===0&&a.clientY===0&&e!==a.target&&(o(),a.target.classList.add(...t),i=a.target);}return a=>(a.addEventListener("click",n),a.addEventListener("keydown",s),a.addEventListener("keyup",o),()=>{a.removeEventListener("click",n),a.removeEventListener("keydown",s),a.removeEventListener("keyup",o);})}function Er(r,i){let t=i.map(e=>e(r));return ()=>{t.forEach(e=>e());}}var wi=class{constructor(){this.Ae=new Map;this.zt=[];}addEventListener(i,t){let e=s=>{let o=s.target;o instanceof Node&&this.zt.some(n=>n===o||n.contains(o))&&t(s);};this.Ae.set(t,e),window.addEventListener(i,e);}removeEventListener(i,t){let e=this.Ae.get(t);e&&window.removeEventListener(i,e),this.Ae.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this.zt.push(i);}destroy(){this.zt=[];for(let i of this.Ae.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.Ae.clear();}},Me=class{constructor(){this.Ze=new wi,this.Di=Er(this.Ze,[br(),xr("is-pressed"),wr(),Tr()]);}registerBlock(i){this.Ze.registerScope(i);}destroy(){this.Di?.(),this.Ze.destroy();}};var te={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","drop-file-here":"Drop file here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"OneDrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-draw":"Draw","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning","a11y-cloud-editor-apply-aspect-ratio":"Apply operation {{name}} {{value}}",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}","queued-uploading":"Queued for upload","queued-validation":"Queued for validation",validation:"Validating","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop"};var xi=new Map,Cr=new Map,Sr=(r,i)=>{xi.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`);let t={...te,...i};return xi.set(r,t),t},oo=(r,i)=>{Cr.set(r,i);},no=(r,i)=>{typeof i=="function"?oo(r,i):Sr(r,i);},kr=async r=>{let i=xi.get(r);if(!i){let t=Cr.get(r);if(!t)throw new Error(`Locale ${r} is not defined`);let e=await t();i=Sr(r,e);}return i};no("en",te);var rt=r=>`*l10n/${r}`,ao="en",Ie=class extends j{constructor(t){super(t);this.jt="";for(let[e,s]of Object.entries(te)){let o=this.s.has(rt(e))?!this.s.read(rt(e)):true;this.s.add(rt(e),s,o);}this.addSub(this.s.sub(x("localeName"),async e=>{if(!e)return;this.jt=e;let s=await kr(e);if(e!==ao&&this.jt!==e)return;let o=this._i.localeDefinitionOverride?.[e];for(let[n,a]of Object.entries(s)){let l=o?.[n];this.s.add(rt(n),l??a,true);}})),this.addSub(this.s.sub(x("localeDefinitionOverride"),e=>{if(!e)return;let s=e[this.jt];if(s)for(let[o,n]of Object.entries(s))this.s.add(rt(o),n,true);}));}};var Mt=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),Pe=class extends j{constructor(){super(...arguments);this.ne=new Map;this.K=new Set;this.X=new Map;}registerModal(t,e){this.ne.set(t,e),this.Te(Mt.ADD,{id:t,modal:e});}deleteModal(t){let e=this.ne.get(t);return e?(this.ne.delete(t),this.K.delete(t),this.Te(Mt.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.ne.get(t);return e?(this.K.add(t),this.Te(Mt.OPEN,{modal:e,id:t}),true):(this.oe(`Modal with ID "${t}" not found`),false)}close(t){let e=this.ne.get(t);return !e||!this.K.has(t)?(this.oe(`Modal with ID "${t}" not found or not active`),false):(this.K.delete(t),this.Te(Mt.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.ne.has(t)?this.K.has(t)?this.close(t):this.open(t):(this.oe(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.K.size>0}back(){if(this.K.size===0)return this.oe("No active modals to go back from"),false;let t=Array.from(this.K).pop();return t?this.close(t):false}closeAll(){let t=this.K.size;return this.K.clear(),this.Te(Mt.CLOSE_ALL,{}),t}subscribe(t,e){return this.X.has(t)||this.X.set(t,new Set),this.X.get(t)?.add(e),()=>this.unsubscribe(t,e)}unsubscribe(t,e){this.X.has(t)&&this.X.get(t)?.delete(e);}Te(t,e){if(this.X.has(t))for(let s of this.X.get(t)??new Set)try{s(e);}catch(o){this.b.telemetryManager.sendEventError(o,"modal subscriber"),this.oe("Error in modal subscriber:",o);}}destroy(){super.destroy(),this.closeAll(),this.ne.clear(),this.X.clear(),this.Te(Mt.DESTROY,{});}};function lo(r){return r.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}function Ci(r){return Array.isArray(r)?r.map(i=>typeof i=="object"&&i!==null?Ci(i):i):typeof r!="object"||r===null?r:Object.fromEntries(Object.entries(r).map(([i,t])=>{let e=lo(i);return typeof t=="object"&&t!==null?[e,Ci(t)]:[e,t]}))}function co(r){return {ok:true,value:r}}function Ei(r){return {ok:false,error:r}}var uo="https://tlm.uploadcare.com/api/",Si=class{constructor(i=uo){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let s=await fetch(e,t);if(!s.ok)return Ei(new Error(`Got non-200 response from "${e}". Status: ${s.status.toString()}`));try{let o=await s.json();return co(o)}catch(o){return Ei(new Error(`Error parsing JSON from "${e}". Error: ${o}`))}}catch(s){return Ei(new Error(`Error fetching data from "${e}". Error: ${s}`))}}async post(i,t,e={}){return await this.base(i,{...e,method:"POST",body:JSON.stringify(Ci(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},po=async(r,i)=>({success:true,data:i}),ho=async r=>po(void 0,r),$e=class extends Si{constructor(){super();}async sendEvent(i,t){let e=await ho(i);if(!e.success)throw console.error("TelemetryAPIService: events: body is invalid",e.error),new Error("TelemetryAPIService: events: body is invalid");return this.post("v1/events",i,t)}};var fo=20,st=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),ot=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created"}),Ue=class extends j{constructor(){super(...arguments);this.Re=new Map;this.Qe=new Set;}bindTarget(t){return this.Qe.add(t),()=>{this.Qe.delete(t);}}Fi(t,e){for(let s of this.Qe)s.dispatchEvent(new CustomEvent(t,{detail:e}));this.oe?.(()=>{let s=e&&typeof e=="object"?{...e}:e;return [`event "${t}"`,s]});}emit(t,e,s={}){let{debounce:o}=s;if(typeof o!="number"&&!o){this.Fi(t,typeof e=="function"?e():e);return}this.Re.has(t)&&window.clearTimeout(this.Re.get(t));let n=typeof o=="number"?o:fo,a=window.setTimeout(()=>{try{let l=typeof e=="function"?e():e;this.Fi(t,l),this.Re.delete(t);}catch(l){this.oe?.(()=>`Error while getting payload for event "${t}"`,l);}},n);this.Re.set(t,a);}destroy(){for(let t of this.Re.values())window.clearTimeout(t);this.Qe.clear();}};var Or="1.30.0-alpha.5";var It="blocks",Pt=Or;var ut=class r{static generateFastUid(){return `uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}static generateRandomUUID(){let i=globalThis.crypto;return i&&typeof i.randomUUID=="function"?i.randomUUID():r.generateFastUid()}};var Ne=class extends j{constructor(t){super(t);this.Ms=ut.generateRandomUUID();this.we=structuredClone(L);this.Ht=false;this.Bt=null;this.Gt=false;this.Ki=new $e,this.Vi=new Ce(10),this.addSub(this.s.sub(x("qualityInsights"),e=>{this.Gt=!!e;}));for(let e of Object.keys(this.we))this.addSub(this.s.sub(x(e),s=>{this.Gt&&(this.Ht&&this.we[e]!==s&&this.sendEvent({eventType:st.CHANGE_CONFIG}),this.Is(e,s));}));}Ps(t){t===st.INIT_SOLUTION&&!this.Ht&&(this.Ht=true);}Is(t,e){this.we[t]!==e&&(this.we[t]=e);}$s(t){let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let s={...t};return (t.eventType===st.INIT_SOLUTION||t.eventType===st.CHANGE_CONFIG)&&(s.config=this.we),{...s,appVersion:Pt,appName:It,sessionId:this.Ms,component:this.Us,activity:this.Ns,projectPubkey:this.we.pubkey,userAgent:navigator.userAgent,eventType:s.eventType??"",eventTimestamp:this._s,payload:{location:this.Ds,...e}}}Fs(t){return !!(t&&[ot.CHANGE,ot.COMMON_UPLOAD_PROGRESS,ot.FILE_ADDED,ot.FILE_REMOVED,ot.FILE_UPLOAD_START,ot.FILE_UPLOAD_PROGRESS,ot.FILE_UPLOAD_SUCCESS,ot.FILE_UPLOAD_FAILED].includes(t))}sendEvent(t){if(!this.Gt)return;let e=this.$s({eventType:t.eventType,payload:t.payload,config:t.config});this.Ps(t.eventType),!(this.Fs(t.eventType)||this.Bt&&this.zi(this.Bt,e))&&this.Vi.add(async()=>{this.Bt=e,await this.Ki.sendEvent(e);});}sendEventError(t,e="unknown"){this.sendEvent({eventType:st.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}});}sendEventCloudImageEditor(t,e,s={}){this.sendEvent({eventType:st.ACTION_EVENT,payload:{metadata:{tabId:e,node:t.currentTarget?.tagName,event:t.type,...s}}});}zi(t,e){if(JSON.stringify(t)===JSON.stringify(e))return true;if(typeof t!="object"||typeof e!="object"||t==null||e==null)return false;let s=Object.keys(t),o=Object.keys(e);if(s.length!==o.length)return false;for(let n of s)if(!Object.hasOwn(e,n)||!this.zi(t[n],e[n]))return false;return true}get _s(){return Date.now()}get Us(){if(!this.s.has("*solution"))return null;let t=this.s.read("*solution");return t?t.toLowerCase():null}get Ns(){return this.s.has("*currentActivity")?this.s.read("*currentActivity"):null}get Ds(){return location.origin}};var B=[],dt=0,_e=4,Ar=r=>{let i=[],t={get(){return t.lc||t.listen(()=>{})(),t.value},lc:0,listen(e){return t.lc=i.push(e),()=>{for(let o=dt+_e;o<B.length;)B[o]===e?B.splice(o,_e):o+=_e;let s=i.indexOf(e);~s&&(i.splice(s,1),--t.lc||t.off());}},notify(e,s){let o=!B.length;for(let n of i)B.push(n,t.value,e,s);if(o){for(dt=0;dt<B.length;dt+=_e)B[dt](B[dt+1],B[dt+2],B[dt+3]);B.length=0;}},off(){},set(e){let s=t.value;s!==e&&(t.value=e,t.notify(s));},subscribe(e){let s=t.listen(e);return e(t.value),s},value:r};return t};function De(r,i,t){let e=new Set(i).add(void 0);return r.listen((s,o,n)=>{e.has(n)&&t(s,o,n);})}function ki(r,i,t){let e=De(r,i,t);return t(r.value),e}var Oi=(r={})=>{let i=Ar(r);return i.setKey=function(t,e){let s=i.value;typeof e>"u"&&t in i.value?(i.value={...i.value},delete i.value[t],i.notify(s,t)):i.value[t]!==e&&(i.value={...i.value,[t]:e},i.notify(s,t));},i};var Ot=class r{static{this.Le=new Map;}constructor(i,t){this.ji=i,this.z=t;}get id(){return this.ji}pub(i,t){i in this.z.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.z.setKey(i,t);}sub(i,t,e=true){return (e?ki:De)(this.z,[i],o=>{t(o[i]);})}read(i){return i in this.z.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.z.get()[i]}add(i,t,e=false){(!(i in this.z.get())||e)&&this.z.setKey(i,t);}has(i){return i in this.z.get()}get store(){return this.z.get()}static registerCtx(i,t){if(r.Le.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=Oi(i);return r.Le.set(t,e),new r(t,e)}static deleteCtx(i){r.Le.delete(i);}static getCtx(i){let t=r.Le.get(i);return t?new r(i,t):null}static hasCtx(i){return r.Le.has(i)}};var Rr=r=>{let i=new Intl.Locale(r),t="ltr",e=i.getTextInfo?.().direction;return e?t=e:i.textInfo?.direction&&(t=i.textInfo.direction),t};var go=r=>r;var Lr="plural:";function Fe(r,i={},t={}){let{openToken:e="{{",closeToken:s="}}",transform:o=go}=t;for(let n in i){let a=i[n],l=a?.toString(),c=typeof l=="string"?o(l):String(l);r=r.replaceAll(e+n+s,c);}return r}function Mr(r){let i=[],t=r.indexOf("{{");for(;t!==-1;){let e=r.indexOf("}}",t);if(e===-1)break;let s=r.substring(t+2,e);if(s.startsWith(Lr)){let o=r.substring(t+2,e).replace(Lr,""),n=o.substring(0,o.indexOf("(")),a=o.substring(o.indexOf("(")+1,o.indexOf(")"));i.push({variable:s,pluralKey:n,countVariable:a});}t=r.indexOf("{{",e);}return i}function U(r,i){let t,e=((...s)=>{t&&clearTimeout(t),t=setTimeout(()=>r(...s),i);});return e.cancel=()=>{t&&clearTimeout(t);},e}var Ir="--uploadcare-blocks-window-height",ee=class r{static{this.clientsRegistry=new Set;}static{this.flush=U(()=>{document.documentElement.style.setProperty(Ir,`${window.innerHeight}px`);},100);}static registerClient(i){r.clientsRegistry.size===0&&r.attachTracker(),r.clientsRegistry.add(i);}static unregisterClient(i){r.clientsRegistry.delete(i),r.clientsRegistry.size===0&&r.detachTracker();}static attachTracker(){window.addEventListener("resize",r.flush,{passive:true,capture:true}),r.flush();}static detachTracker(){window.removeEventListener("resize",r.flush,{capture:true}),document.documentElement.style.removeProperty(Ir);}};var vo=/\\([0-9a-fA-F]{1,6} ?)/g;function bo(r){return r.length<2?false:(r[0]==='"'||r[0]==="'")&&(r[r.length-1]==='"'||r[r.length-1]==="'")}function To(r){let i=r;return (i[0]==='"'||i[0]==="'")&&(i=i.slice(1)),(i[i.length-1]==='"'||i[i.length-1]==="'")&&(i=i.slice(0,-1)),i}function wo(r){let i="",t="";for(let e=0;e<r.length;e++){let s=r[e+1];r[e]==="\\"&&s==='"'?(i+='\\"',e++):r[e]==='"'&&t!=="\\"?i+='\\"':i+=r[e],t=r[e]??"";}return i}function Pr(r){let i=r;bo(r)&&(i=To(i),i=i.replace(vo,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=wo(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}function $r(r){class i extends r{constructor(){super(...arguments);this.Hi=null;this.qt=null;}getCssData(s,o=false){let n=this.Hi??Object.create(null);if(!Object.keys(n).includes(s)||!n[s]){this.qt||(this.qt=window.getComputedStyle(this));let a=this.qt.getPropertyValue(s).trim();try{n[s]=Pr(a);}catch(l){o||console.warn(`CSS Data error: ${s}`,l),n[s]=null;}}return this.Hi=n,n[s]}}return i}function Ur(r){class i extends r{constructor(){super(...arguments);this.willYield=true;this.ae={};this.le=null;this.Je=false;}createRenderRoot(){return this}connectedCallback(){this.le||(this.le=Array.from(this.childNodes)),super.connectedCallback();}Ks(){if(this.Je)return;this.Je=true,this.ae={};let s=Array.from(this.childNodes),o=s.length?s:this.le??[];for(let n of o){let a=this.Bi(n),l=this.ae[a]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),l.push(n),this.ae[a]=l;}this.le=null;}Bi(s){return s instanceof Comment&&s.nextSibling instanceof Element?this.Bi(s.nextSibling):"contentFor"in s?s.contentFor||"":s instanceof Element&&s.hasAttribute("content-for")&&s.getAttribute("content-for")||""}Vs(s){return !s.textContent||!s.textContent.trim()}zs(s){let o=this.ae[s];return !o||o.every(n=>n instanceof Comment||n instanceof Text&&this.Vs(n))}update(s){!this.hasUpdated&&this.willYield&&this.Ks(),super.update(s);}yield(s,o){if(s===""&&!this.ae[s]&&!this.Je&&this.le?.length){let a=[];for(let l of this.le)l instanceof Element&&(l.removeAttribute("slot"),l.removeAttribute("content-for")),a.push(l);this.ae[s]=a,this.Je=true,this.le=null;}let n=this.ae[s];return m` ${n} ${this.zs(s)?o:void 0} `}}return i}var Nr=(r,i)=>new Intl.PluralRules(r).select(i);var xo=r=>(i,t)=>{let e=r(),s=e("locale-id")||"en",o=Nr(s,t);return e(`${i}__${o}`)},_r=r=>{let i=xo(()=>t),t=(e,s={})=>{if(!e)return "";let n=r().read(rt(e))||e,a=Mr(n);for(let c of a)s[c.variable]=i(c.pluralKey,Number(s[c.countVariable]));return Fe(n,s)};return t};function Dr(r){class i extends r{static reg(e){let s=this,o=window.customElements.get(e);if(o){o!==s&&console.warn([`Element with tag name "${e}" already registered.`,`You're trying to override it with another class "${this.name}".`,"This is most likely a mistake.","New element will not be registered."].join(` `));return}window.customElements.define(e,s);}}return i}var pt=class extends Event{constructor(i,t,e,s){super("context-request",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t,this.callback=e,this.subscribe=s??false;}};var $t=class{constructor(i,t,e,s){if(this.subscribe=false,this.provided=false,this.value=void 0,this.t=(o,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=false,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=o,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=true,this.callback&&this.callback(o,n)),this.unsubscribe=n;},this.host=i,t.context!==void 0){let o=t;this.context=o.context,this.callback=o.callback,this.subscribe=o.subscribe??false;}else this.context=t,this.callback=e,this.subscribe=s??false;this.host.addController(this);}hostConnected(){this.dispatchRequest();}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0);}dispatchRequest(){this.host.dispatchEvent(new pt(this.context,this.host,this.t,this.subscribe));}};var Ke=class{get value(){return this.o}set value(i){this.setValue(i);}setValue(i,t=false){let e=t||!Object.is(i,this.o);this.o=i,e&&this.updateObservers();}constructor(i){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:e}]of this.subscriptions)t(this.o,e);},i!==void 0&&(this.value=i);}addCallback(i,t,e){if(!e)return void i(this.value);this.subscriptions.has(i)||this.subscriptions.set(i,{disposer:()=>{this.subscriptions.delete(i);},consumerHost:t});let{disposer:s}=this.subscriptions.get(i);i(this.value,s);}clearCallbacks(){this.subscriptions.clear();}};var Ai=class extends Event{constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},Ut=class extends Ke{constructor(i,t,e){super(t.context!==void 0?t.initialValue:e),this.onContextRequest=s=>{if(s.context!==this.context)return;let o=s.contextTarget??s.composedPath()[0];o!==this.host&&(s.stopPropagation(),this.addCallback(s.callback,o,s.subscribe));},this.onProviderRequest=s=>{if(s.context!==this.context||(s.contextTarget??s.composedPath()[0])===this.host)return;let o=new Set;for(let[n,{consumerHost:a}]of this.subscriptions)o.has(n)||(o.add(n),a.dispatchEvent(new pt(this.context,a,n,true)));s.stopPropagation();},this.host=i,t.context!==void 0?this.context=t.context:this.context=t,this.attachListeners(),this.host.addController?.(this);}attachListeners(){this.host.addEventListener("context-request",this.onContextRequest),this.host.addEventListener("context-provider",this.onProviderRequest);}hostConnected(){this.host.dispatchEvent(new Ai(this.context,this.host));}};var Fr="ctx-name-context";function Kr(){return function(r){class i extends r{constructor(...s){super(...s);this.w=null;this.Me=false;this.Wt=false;this.Xt=void 0;this.xe=new Map;this.Ie=new Set;this.init$={};this.ctxOwner=false;this.et=void 0;this.tt=false;this.ctxName=this.Y;this.Z=false;this.et=this.getAttribute("ctx-name")||void 0,this.ctxName=this.Y,this.js=new $t(this,{context:Fr,callback:o=>{if(!o){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.Wi=o,this.qi();},subscribe:true});}static set template(s){console.error("Caution: static 'template' property is deprecated and has no effect. See https://github.com/uploadcare/file-uploader/releases/tag/v1.25.0 for details.");}get Gi(){return this.et}set Gi(s){let o=s??void 0;this.et!==o&&(this.et=o,this.qi());}shouldUpdate(s){return this.Z?super.shouldUpdate(s):false}get Y(){return this.Gi||this.Wi||void 0}qi(){if(this.ctxName=this.Y,!(!this.ctxName||this.Me)){if(this.isConnected){this.Yt();return}this.tt=true;}}willUpdate(s){super.willUpdate(s),this.ctxName=this.Y,this.ctxName&&(this.Xt?this.Xt.setValue(this.ctxName):this.Xt=new Ut(this,{context:Fr,initialValue:this.ctxName}));}Xi(){if(!(!this.w||this.xe.size===0)){for(let[s,{value:o,rewrite:n}]of this.xe)this.w.add(s,o,n);this.xe.clear();}}Yi(){return !this.w&&this.Y&&this.Zt(),this.w&&this.Xi(),this.w}ot(){let s=this.Yi();if(!s)throw new Error("SymbioteMixin: Shared context is not initialized.");return s}Zt(){let s=this.init$,o=this.Y;if(!o){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.w){this.w=Ot.getCtx(o)??Ot.registerCtx(s,o);for(let[n,a]of Object.entries(this.init$))this.w.add(n,a,this.ctxOwner);this.Xi();}}get $(){return this.Y&&this.Zt(),new Proxy({},{get:(s,o)=>{if(typeof o=="string")return this.w?.read(o)},set:(s,o,n)=>(typeof o!="string"||this.w?.pub(o,n),true)})}sub(s,o,n=true){let a=this.ot().sub(s,o,n);if(!a||typeof a!="function")return ()=>{};let l=a.bind(a),c=false,d=()=>{c||(c=true,l(),this.Ie.delete(d));};return this.Ie.add(d),d}pub(s,o){this.ot().pub(s,o);}set$(s){for(let[o,n]of Object.entries(s))this.pub(o,n);}get sharedCtx(){return this.ot()}has(s){return this.w?.has(s)??false}add(s,o,n=false){let a=this.Yi();if(!a){if(!n&&this.xe.has(s))return;this.xe.set(s,{value:o,rewrite:n});return}this.xe.delete(s),a.add(s,o,n);}add$(s,o=false){for(let[n,a]of Object.entries(s))this.add(n,a,o);}connectedCallback(){super.connectedCallback(),this.Me?this.Z&&this.Wt&&(this.Wt=false,this.initCallback()):this.ctxName?(this.tt=false,this.Yt()):this.tt&&this.Y&&(this.tt=false,this.Yt());}Yt(){if(this.Me)return;this.Me=true,this.Zt();let s=this.init$;if(Object.keys(s).length>0){let o=this.ot();for(let[n,a]of Object.entries(s))o.read(n)===void 0&&o.pub(n,a),this.sub(n,U(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.Z=true,this.requestUpdate();}firstUpdated(s){super.firstUpdated(s);}disconnectedCallback(){this.Hs(),super.disconnectedCallback(),this.Me&&(this.Wt=true);}Hs(){if(this.Ie.size!==0){for(let s of [...this.Ie])s();this.Ie.clear();}}initCallback(){}}return p([g({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"Gi",1),p([y()],i.prototype,"Wi",2),p([y()],i.prototype,"ctxName",2),p([y()],i.prototype,"Z",2),i}}var Co=r=>r.tagName?.includes("-")??false,Ve=class{constructor(i){this.ce=new Set;this.at=new Map;this.Zi=false;this.ue=i,this.ue.addController(this);}hostDisconnected(){this.ut?.(),this.ut=void 0,this.ce.clear(),this.at.clear();}hostUpdated(){if(!this.ut&&this.ue.has(x("testMode"))){let i=this.ue.subConfigValue("testMode",t=>{this.Zi=!!t,this.Qi();});this.ut=i;}this.Bs(),this.Qi();}Bs(){let i=this.ue,t=i.renderRoot??i;if(!t)return;let e=this.ue,s=e.tagName?.toLowerCase(),o=Array.from(t.querySelectorAll("[data-testid]")).filter(n=>!Co(n));for(let n of o)if(!(s&&n.closest(s)!==e)&&!this.ce.has(n)){let a=n.getAttribute("data-testid");if(!a)continue;this.ce.add(n),this.at.set(n,a);}for(let n of Array.from(this.ce))(!n.isConnected||s&&n.closest(s)!==e)&&(this.ce.delete(n),this.at.delete(n));}Qi(){if(!this.ce.size)return;let i=this.ue.testId||"";for(let t of this.ce){let e=this.at.get(t);e&&(this.Zi?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var So=Dr(Kr()($r(Ur(at)))),w=class extends So{constructor(){super();this.pt=new Map;this.activityType=null;this.init$=ar();this.l10n=_r(()=>this.sharedCtx);this.debugPrint=Re(()=>this.sharedCtx,this.constructor.name);this.b=vr(()=>this.sharedCtx);new Ve(this);}static{this.styleAttrs=[];}emit(t,e,s){let o=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;if(!o)return;o.emit(t,e,s);let n=typeof e=="function"?e():e;this.telemetryManager.sendEvent({eventType:t,payload:n??void 0});}hasBlockInCtx(t){for(let e of this.blocksRegistry)if(t(e))return true;return false}connectedCallback(){this.constructor.styleAttrs.forEach(e=>{this.setAttribute(e,"");}),super.connectedCallback(),ee.registerClient(this);}initCallback(){this.pe("*blocksRegistry",()=>new Set),this.pe("*eventEmitter",t=>new Ue(t)),this.pe("*localeManager",t=>new Ie(t)),this.pe("*modalManager",t=>new Pe(t)),this.pe("*a11y",()=>new Me),this.pe("*clipboard",t=>new Le(t)),this.pe("*telemetryManager",t=>new Ne(t)),this.sub(rt("locale-id"),t=>{let e=Rr(t);this.style.direction=e==="ltr"?"":e,this.requestUpdate();}),this.subConfigValue("testMode",t=>{if(!t||!this.testId){this.removeAttribute("data-testid");return}this.setAttribute("data-testid",this.testId);}),this.blocksRegistry.add(this);}get testId(){return window.customElements.getName(this.constructor)}get modalManager(){return this.de("*modalManager",false)}get telemetryManager(){return this.de("*telemetryManager")}get localeManager(){return this.de("*localeManager")}get a11y(){return this.de("*a11y")}get clipboardLayer(){return this.de("*clipboard")}get blocksRegistry(){return this.de("*blocksRegistry")}get eventEmitter(){return this.de("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),ee.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),t?.size===0&&setTimeout(()=>{this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.Gs(),Ot.deleteCtx(this.ctxName);}pe(t,e){if(!this.pt.has(t)&&(!this.has(t)||!this.$[t])){let s=e(this.b);this.add(t,s,true),this.pt.set(t,s);return}}Gs(){for(let[t,e]of this.pt.entries())e?.destroy?.(),this.pub(t,null),this.pt.delete(t);}de(t,e=true){if(this.has(t)&&this.$[t])return this.$[t];if(!e)return this.$[t];throw new Error(`Unexpected error: context manager for key "${String(t)}" is not available`)}async proxyUrl(t){if(this.cfg.secureDeliveryProxy&&this.cfg.secureDeliveryProxyUrlResolver&&console.warn("Both secureDeliveryProxy and secureDeliveryProxyUrlResolver are set. The secureDeliveryProxyUrlResolver will be used."),this.cfg.secureDeliveryProxyUrlResolver)try{return await this.cfg.secureDeliveryProxyUrlResolver(t,{uuid:Oe(t),cdnUrlModifiers:fi(t),fileName:ke(t)})}catch(e){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",e),this.telemetryManager.sendEventError(e,"secureDeliveryProxyUrlResolver. Failed to resolve secure delivery proxy URL. Falling back to the default URL."),t}return this.cfg.secureDeliveryProxy?Fe(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:e=>window.encodeURIComponent(e)}):t}get cfg(){if(!this.se){let t={};this.se=new Proxy(t,{set:(e,s,o)=>{if(typeof s!="string"||!(s in L))return false;let n=s,a=x(n);return this.has(a)||this.add(a,L[n]),this.$[a]=o,true},get:(e,s)=>{let o=x(s);return this.has(o)||this.add(o,L[s]),this.$[o]}});}return this.se}subConfigValue(t,e){let s=x(t);return this.has(s)||this.add(s,L[t]),this.sub(s,e)}};var ht="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Vr(...r){return r.reduce((i,t)=>{if(typeof t=="string")return i[t]=true,i;for(let e of Object.keys(t))i[e]=t[e];return i},{})}function F(...r){let i=Vr(...r);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}function jr(r,...i){let t=Vr(...i);for(let e of Object.keys(t))r.classList.toggle(e,!!t[e]);}var ie=["free"],zr=r=>{let i=Zt(r);if(!i||i.length===0)return [];let t=[];for(let e of i){let s=e.trim();if(!s)continue;let o=s.indexOf(":");if(o===-1&&!ie.includes(s)){console.warn(`Invalid crop preset: ${s}`);continue}let n=Number(s.slice(0,o)),a=Number(s.slice(o+1));if((!Number.isFinite(n)||!Number.isFinite(a)||n<=0||a<=0)&&!ie.includes(s)){console.warn(`Invalid crop preset: ${s}`);continue}t.push({id:ut.generateFastUid(),type:"aspect-ratio",width:ie.includes(s)?0:n,height:ie.includes(s)?0:a,hasFreeform:ie.includes(s)});}return t},Hr=(r,i,t,e=.1)=>{let s=r/i,o=null,n=1/0;for(let a of t){let[l,c]=[a.width,a.height],d=l/c,u=Math.abs(s-d);u<n&&(n=u,o=a);}if(o){let[a,l]=[o.width,o.height],c=a/l;if(Math.abs(s-c)/c>e)return null}return o};var ko=r=>$.includes(r),Br=r=>{if(!r)return $;let i=St(r).filter(ko);return i.length===0?$:i};function Gr(r){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":$,"*tabId":O.CROP,"*on.retryNetwork":()=>{let i=r.querySelectorAll("img");for(let t of i){let e=t.src;t.src=ht,t.src=e;}r.$["*networkProblems"]=false;},"*on.apply":i=>{if(!i)return;let t=r.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=J(ct(i),"preview"),s=tt(t,e),o={originalUrl:t,cdnUrlModifiers:e,cdnUrl:s,transformations:i};r.dispatchEvent(new CustomEvent("apply",{detail:o,bubbles:true,composed:true})),r.remove();},"*on.cancel":()=>{r.remove(),r.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));}}}var qr="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'/><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='ruc-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(#ruc-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(#uuc-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(#uuc-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(#uuc-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(#uuc-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(#uuc-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(#uuc-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(#uuc-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(#uuc-icon-id__h)'/><defs><linearGradient id='uuc-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='uuc-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='uuc-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='uuc-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='uuc-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='uuc-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='uuc-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='uuc-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 At={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},re=class extends w{constructor(){super(...arguments);this.Ee=false;this.Ji=At;this.er=At.visible;this.tr=At.hidden;this.Qt=false;this.ir=false;}set visible(t){this.Ee=t,this.rr();}get visible(){return this.Ee}set styles(t){this.Ji=t,this.Qt=true,this.er=t.visible??At.visible,this.tr=t.hidden??At.hidden;}get styles(){return this.Ji}rr(){this.style.visibility=this.Ee?"inherit":"hidden",jr(this,{[At.transition]:!this.Qt,[this.er]:this.Ee,[this.tr]:!this.Ee}),this.toggleAttribute("inert",!this.Ee);}qs(){this.ir||(this.ir=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.Qt||this.classList.add(At.transition),this.rr(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.qs();},0);}};p([g({type:Boolean})],re.prototype,"visible",1),p([g({attribute:false})],re.prototype,"styles",1);var je=class extends w{constructor(){super(...arguments);this.active=false;this.dt=C();this.Jt=false;this.ei=()=>{let t=this.dt.value;t&&(this.sr(t),this.Jt&&this.active&&this.ti());};}firstUpdated(t){super.firstUpdated(t),this.active&&this.ti();}updated(t){super.updated(t),t.has("active")&&(this.active?this.ti():this.Ws());}ti(){let t=this.dt.value;if(!t)return;this.Jt=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.ei),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.ei,{once:true});}Ws(){let t=this.dt.value;t&&(this.Jt=false,t.removeEventListener("transitionend",this.ei),this.sr(t));}sr(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return m`<div class="uc-inner"><div class="uc-line" ${k(this.dt)}></div></div>`}};p([g({type:Boolean,reflect:true})],je.prototype,"active",2);var ft=z(class extends q{constructor(r){if(super(r),r.type!==lt.ATTRIBUTE||r.name!=="class"||r.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(r){return " "+Object.keys(r).filter(i=>r[i]).join(" ")+" "}update(r,[i]){if(this.st===void 0){this.st=new Set,r.strings!==void 0&&(this.nt=new Set(r.strings.join(" ").split(/\s/).filter(e=>e!=="")));for(let e in i)i[e]&&!this.nt?.has(e)&&this.st.add(e);return this.render(i)}let t=r.element.classList;for(let e of this.st)e in i||(t.remove(e),this.st.delete(e));for(let e in i){let s=!!i[e];s===this.st.has(e)||this.nt?.has(e)||(s?(t.add(e),this.st.add(e)):(t.remove(e),this.st.delete(e)));}return D}});var A=r=>r??T;var se=class extends w{constructor(){super(...arguments);this.name="";this.ii="";this.or=null;}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",t=>{this.or=t,this.nr();});}willUpdate(t){super.willUpdate(t),t.has("name")&&this.nr();}nr(){if(!this.name){this.ii="";return}let t=`#uc-icon-${this.name}`,e=this.or?.(this.name);this.ii=e??t;}render(){return m` ${this.yield("",m`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.ii}></use></svg>`)} `}};p([g({type:String})],se.prototype,"name",2),p([y()],se.prototype,"ii",2);var G=class extends w{constructor(){super(...arguments);this.text="";this.icon="";this.reverse=false;this.theme="default";this.ariaRole=void 0;this.ariaControls="";this.titleProp="";this.active=false;}firstUpdated(t){super.firstUpdated(t),this.ar(),this.lr();}updated(t){super.updated(t),t.has("reverse")&&this.ar(),t.has("theme")&&this.lr();}ar(){this.style.flexDirection=this.reverse?"row-reverse":"";}lr(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get Xs(){let t=this.ri;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.Ys}}get ri(){return !this.icon}get Ys(){return !this.text&&!this.ri}render(){return m`<button type="button" role=${A(this.ariaRole||void 0)} aria-controls=${A(this.ariaControls||void 0)} aria-label=${A(this.l10n(this.titleProp))} title=${A(this.l10n(this.titleProp))} ><uc-icon class=${ft(this.Xs)} name=${A(this.icon||void 0)} ?hidden=${this.ri} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};p([g({type:String})],G.prototype,"text",2),p([g({type:String})],G.prototype,"icon",2),p([g({type:Boolean,reflect:true})],G.prototype,"reverse",2),p([g({type:String,reflect:true})],G.prototype,"theme",2),p([g({attribute:"aria-role"})],G.prototype,"ariaRole",2),p([g({attribute:"aria-controls"})],G.prototype,"ariaControls",2),p([g({attribute:"title-prop"})],G.prototype,"titleProp",2),p([g({type:Boolean,noAccessor:true})],G.prototype,"active",2);function oe(r){let i=new Image;return {promise:new Promise((s,o)=>{i.src=r,i.onload=()=>s(),i.onerror=n=>o(n);}),image:i,cancel:()=>{i.naturalWidth===0&&(i.src=ht);}}}function ne(r){let i=[];for(let o of r){let n=oe(o);i.push(n);}let t=i.map(o=>o.image);return {promise:Promise.allSettled(i.map(o=>o.promise)),images:t,cancel:()=>{i.forEach(o=>{o.cancel();});}}}var Wr=(r,i)=>{let t=false,e,s=0,o=((...n)=>{t?(e&&clearTimeout(e),e=setTimeout(()=>{Date.now()-s>=i&&(r(...n),s=Date.now());},Math.max(i-(Date.now()-s),0))):(r(...n),s=Date.now(),t=true);});return Object.defineProperty(o,"cancel",{configurable:false,writable:false,enumerable:false,value:()=>{e&&clearTimeout(e);}}),o};var ae=33.333333333333336,b=1,Ri=24,Xr=6;function mt(r,i){for(let[t,e]of Object.entries(i))r.setAttributeNS(null,t,e.toString());}function K(r,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",r);return mt(t,i),t}function Yr(r,i,t){let{x:e,y:s,width:o,height:n}=r,a=i.includes("w")?0:1,l=i.includes("n")?0:1,c=a===0?-1:1,d=l===0?-1:1,u=[e+a*o+1.5*c,s+l*n+1.5*d-24*t*d],h=[e+a*o+1.5*c,s+l*n+1.5*d],f=[e+a*o-24*t*c+1.5*c,s+l*n+1.5*d],v=`M ${u[0]} ${u[1]} L ${h[0]} ${h[1]} L ${f[0]} ${f[1]}`,I=[h[0],h[1]];return {d:v,center:I}}function Zr(r,i,t){let{x:e,y:s,width:o,height:n}=r,a=i==="n"||i==="s",l=i==="w"||i==="e",c=a?.5:i==="w"?0:1,d=l?.5:i==="n"?0:1,u=i==="w"?-1:i==="e"?1:0,h=i==="n"?-1:i==="s"?1:0,f,v;a?(f=[e+c*o-34*t/2,s+d*n+1.5*h],v=[e+c*o+34*t/2,s+d*n+1.5*h]):(f=[e+c*o+1.5*u,s+d*n-34*t/2],v=[e+c*o+1.5*u,s+d*n+34*t/2]);let I=`M ${f[0]} ${f[1]} L ${v[0]} ${v[1]}`,R=[(f[0]+v[0])/2,(f[1]+v[1])/2];return {d:I,center:R}}function Qr(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 Jr({rect:r,delta:[i,t],imageBox:e}){return _t({...r,x:r.x+i,y:r.y+t},e)}function _t(r,i){let{x:t}=r,{y:e}=r;return r.x<i.x?t=i.x:r.x+r.width>i.x+i.width&&(t=i.x+i.width-r.width),r.y<i.y?e=i.y:r.y+r.height>i.y+i.height&&(e=i.y+i.height-r.height),{...r,x:t,y:e}}function Oo({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,s]=i,{y:o,width:n,height:a}=r;o+=s,a-=s,t&&(n=a*t);let l=r.x+r.width/2-n/2;return o<=e.y&&(o=e.y,a=r.y+r.height-o,t&&(n=a*t,l=r.x+r.width/2-n/2)),l<=e.x&&(l=e.x,o=r.y+r.height-a),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),o=r.y+r.height-a),a<b&&(a=b,t&&(n=a*t,l=r.x+r.width/2-n/2),o=r.y+r.height-a),n<b&&(n=b,t&&(a=n/t,l=r.x+r.width/2-n/2),o=r.y+r.height-a),{x:l,y:o,width:n,height:a}}function Ao({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s]=i,{x:o,width:n,height:a}=r;o+=s,n-=s,t&&(a=n/t);let l=r.y+r.height/2-a/2;return o<=e.x&&(o=e.x,n=r.x+r.width-o,t&&(a=n/t,l=r.y+r.height/2-a/2)),l<=e.y&&(l=e.y,o=r.x+r.width-n),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),o=r.x+r.width-n),a<b&&(a=b,t&&(n=a*t),l=r.y+r.height/2-a/2,o=r.x+r.width-n),n<b&&(n=b,t&&(a=n/t),l=r.y+r.height/2-a/2,o=r.x+r.width-n),{x:o,y:l,width:n,height:a}}function Ro({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,s]=i,{y:o,width:n,height:a}=r;a+=s,t&&(n=a*t);let l=r.x+r.width/2-n/2;return o+a>=e.y+e.height&&(a=e.y+e.height-o,t&&(n=a*t),l=r.x+r.width/2-n/2),l<=e.x&&(l=e.x,o=r.y),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),o=r.y),a<b&&(a=b,t&&(n=a*t),l=r.x+r.width/2-n/2),n<b&&(n=b,t&&(a=n/t),l=r.x+r.width/2-n/2),{x:l,y:o,width:n,height:a}}function Lo({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s]=i,{x:o,width:n,height:a}=r;n+=s,t&&(a=n/t);let l=r.y+r.height/2-a/2;return o+n>=e.x+e.width&&(n=e.x+e.width-o,t&&(a=n/t),l=r.y+r.height/2-a/2),l<=e.y&&(l=e.y,o=r.x),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),o=r.x),a<b&&(a=b,t&&(n=a*t),l=r.y+r.height/2-a/2),n<b&&(n=b,t&&(a=n/t),l=r.y+r.height/2-a/2),{x:o,y:l,width:n,height:a}}function Mo({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s,o]=i,{x:n,y:a,width:l,height:c}=r;return n+s<e.x&&(s=e.x-n),a+o<e.y&&(o=e.y-a),n+=s,l-=s,a+=o,c-=o,t&&Math.abs(l/c)>t?(o=l/t-c,c+=o,a-=o,a<=e.y&&(c=c-(e.y-a),l=c*t,n=r.x+r.width-l,a=e.y)):t&&(s=c*t-l,l=l+s,n-=s,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=r.y+r.height-c)),c<b&&(c=b,t&&(l=c*t),n=r.x+r.width-l,a=r.y+r.height-c),l<b&&(l=b,t&&(c=l/t),n=r.x+r.width-l,a=r.y+r.height-c),{x:n,y:a,width:l,height:c}}function Io({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s,o]=i,{x:n,y:a,width:l,height:c}=r;return n+l+s>e.x+e.width&&(s=e.x+e.width-n-l),a+o<e.y&&(o=e.y-a),l+=s,a+=o,c-=o,t&&Math.abs(l/c)>t?(o=l/t-c,c+=o,a-=o,a<=e.y&&(c=c-(e.y-a),l=c*t,n=r.x,a=e.y)):t&&(s=c*t-l,l+=s,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=r.y+r.height-c)),c<b&&(c=b,t&&(l=c*t),a=r.y+r.height-c),l<b&&(l=b,t&&(c=l/t),a=r.y+r.height-c),{x:n,y:a,width:l,height:c}}function Po({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s,o]=i,{x:n,y:a,width:l,height:c}=r;return n+s<e.x&&(s=e.x-n),a+c+o>e.y+e.height&&(o=e.y+e.height-a-c),n+=s,l-=s,c+=o,t&&Math.abs(l/c)>t?(o=l/t-c,c+=o,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=r.x+r.width-l,a=e.y+e.height-c)):t&&(s=c*t-l,l+=s,n-=s,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=r.y)),c<b&&(c=b,t&&(l=c*t),n=r.x+r.width-l),l<b&&(l=b,t&&(c=l/t),n=r.x+r.width-l),{x:n,y:a,width:l,height:c}}function $o({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[s,o]=i,{x:n,y:a,width:l,height:c}=r;return n+l+s>e.x+e.width&&(s=e.x+e.width-n-l),a+c+o>e.y+e.height&&(o=e.y+e.height-a-c),l+=s,c+=o,t&&Math.abs(l/c)>t?(o=l/t-c,c+=o,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=r.x,a=e.y+e.height-c)):t&&(s=c*t-l,l+=s,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=r.y)),c<b&&(c=b,t&&(l=c*t)),l<b&&(l=b,t&&(c=l/t)),{x:n,y:a,width:l,height:c}}function ts({direction:r,...i}){switch(r){case "n":return Oo(i);case "w":return Ao(i);case "s":return Ro(i);case "e":return Lo(i);case "nw":return Mo(i);case "ne":return Io(i);case "sw":return Po(i);case "se":return $o(i);default:return i.rect}}function es(r,[i,t]){return r.x<=i&&i<=r.x+r.width&&r.y<=t&&t<=r.y+r.height}function is(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 rs(r,i){return Math.abs(r.width/r.height-i)<.1}function Dt({width:r,height:i},t){let e=t/90%2!==0;return {width:e?i:r,height:e?r:i}}function Ft(r){return {x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)}}function yt(r,i,t){return Math.min(Math.max(r,i),t)}function ss(r,i){let t={};for(let e of i){let s=r[e];(Object.hasOwn(r,e)||s!==void 0)&&(t[e]=s);}return t}function Kt(r,i,t){let s=window.devicePixelRatio,o=Math.min(Math.ceil(i*s),3e3),n=s>=2?"lightest":"normal";return tt(r,J(Ae,ct(t),`quality/${n}`,`stretch/off/-/resize/${o}x`,`@clib/${It}/${Pt}/uc-cloud-image-editor/`))}var He=class extends w{constructor(){super(...arguments);this.cr=`uc-backdrop-mask-${ut.generateFastUid()}`;this.yt=false;this.Ne=false;this.dr=C();this._e=false;this.De=null;this.fr=t=>{this.mr(),this.Fe&&(t.stopPropagation(),t.preventDefault(),this.Fe=false);};this.yr=t=>{if(!this.Fe||!this.mt||!this.oi)return;t.stopPropagation(),t.preventDefault();let e=this.Q;if(!e)return;let{x:s,y:o}=e.getBoundingClientRect(),n=t.x-s,a=t.y-o,l=n-this.mt[0],c=a-this.mt[1],{direction:d}=this.oi,u=this.oo(d,[l,c]);u&&(this.$["*cropBox"]=u);};this.gr=t=>{if(!this.W)return;let e=Object.values(this.W).find(s=>{if(!s||this.ai(s.direction))return false;let n=s.interactionNode.getBoundingClientRect(),a={x:n.x,y:n.y,width:n.width,height:n.height};return es(a,[t.x,t.y])});this.ur=e,this.mr();};}get Q(){return this.dr.value??null}get Fe(){return this.Ne}set Fe(t){this.Ne!==t&&(this.Ne=t,this.ni());}ni(){this.$e&&this.$e.setAttribute("class",F({"uc-guides--hidden":this.yt,"uc-guides--visible":!this.yt&&this.Ne,"uc-guides--semi-hidden":!this.yt&&!this.Ne}));}ai(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=b&&e.width<=b)return true;let s=e.height<=b&&(t.includes("n")||t.includes("s")),o=e.width<=b&&(t.includes("e")||t.includes("w"));return s||o}Zs(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:s,width:o,height:n}=t,a=this.Q;if(!a)return;let l=K("mask",{id:this.cr}),c=K("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),d=K("rect",{x:e,y:s,width:o,height:n,fill:"black"});l.appendChild(c),l.appendChild(d);let u=K("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.cr})`});a.appendChild(u),a.appendChild(l),this.Pe=l,this.si=d;}Qs(){this.Pe&&(this.Pe.style.display="none",window.requestAnimationFrame(()=>{this.Pe&&(this.Pe.style.display="block");}));}Js(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:s,width:o,height:n}=t;this.si&&mt(this.si,{x:e,y:s,width:o,height:n});}eo(){let t=this.$["*cropBox"];if(!(!t||!this.$e||!this.W)){for(let e of Object.values(this.W)){if(!e)continue;let{direction:s,pathNode:o,interactionNode:n,groupNode:a}=e,l=s==="",c=s.length===2,{x:d,y:u,width:h,height:f}=t;if(l)mt(n,{x:d,y:u,width:h,height:f});else {let I=yt(Math.min(h,f)/82/2,0,1),R=c?Yr(t,s,I):Zr(t,s,I),P=R.center;if(!P)continue;let vt=Math.max(Ri*yt(Math.min(h,f)/Ri/3,0,1),Xr);mt(n,{x:P[0]-vt,y:P[1]-vt,width:vt*2,height:vt*2}),mt(o,{d:R.d});}let v=this.ai(s);a.setAttribute("class",F("uc-thumb",{"uc-thumb--hidden":v,"uc-thumb--visible":!v}));}mt(this.$e,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}hr(t,e){let s=K("g");s.classList.add("uc-thumb"),s.setAttribute("with-effects","");let o=K("rect",{fill:"transparent"}),n=K("path",{stroke:"currentColor",fill:"none","stroke-width":3});s.appendChild(n),s.appendChild(o),t[e]={direction:e,pathNode:n,interactionNode:o,groupNode:s},e===""&&(s.style.cursor="move"),o.addEventListener("pointerdown",this.to.bind(this,e));}io(){let t={};for(let e=0;e<3;e++)for(let s=0;s<3;s++){let o=`${["n","","s"][e]}${["w","","e"][s]}`;o!==""&&this.hr(t,o);}return this.hr(t,""),t}ro(){let t=K("svg"),e=K("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});t.appendChild(e);for(let s=1;s<=2;s++){let o=K("line",{x1:`${ae*s}%`,y1:"0%",x2:`${ae*s}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(o);}for(let s=1;s<=2;s++){let o=K("line",{x1:"0%",y1:`${ae*s}%`,x2:"100%",y2:`${ae*s}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(o);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}so(){let t=this.Q;if(!t)return;let e=document.createDocumentFragment(),s=this.ro();e.appendChild(s);let o=this.io();for(let{groupNode:n}of Object.values(o))e.appendChild(n);t.appendChild(e),this.W=o,this.$e=s,this.ni();}to(t,e){if(!this.W)return;let s=this.W[t];if(!s||this.ai(t))return;let o=this.$["*cropBox"],n=this.Q;if(!n)return;let{x:a,y:l}=n.getBoundingClientRect(),c=e.x-a,d=e.y-l;this.Fe=true,this.oi=s,this.mt=[c,d],this.pr={...o};}oo(t,e){let[s,o]=e,n=this.$["*imageBox"],a=this.pr??this.$["*cropBox"],l=this.$["*currentAspectRatio"],c=l?l.width/l.height:void 0;if(t===""?a=Jr({rect:a,delta:[s,o],imageBox:n}):a=ts({rect:a,delta:[s,o],direction:t,aspectRatio:c,imageBox:n}),!Object.values(a).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:a});return}return _t(Ft(a),n)}mr(){let t=this.ur,e=this.Q;e&&(e.style.cursor=t?Qr(t.direction):"initial");}vr(t){if(this.Ue){this.Ue.setAttribute("href",t);return}let e=this.Q;if(!e){this.De=t;return}this.De=null;let s=document.createDocumentFragment(),o=K("image",{href:t});o.setAttribute("class","uc-cloud-mask"),s.appendChild(o),e.appendChild(s),this.Ue=o;}ao(){let t=this.$["*cropBox"];if(!t||!this.Ue)return;let{x:e,y:s,width:o,height:n}=t;mt(this.Ue,{x:e,y:s,height:n,width:o});}li(){this._e&&(this.Js(),this.eo(),this.ao());}toggleThumbs(t){if(this.W)for(let e of Object.values(this.W)){if(!e)continue;let{groupNode:s}=e;s.setAttribute("class",F("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Qs(),this._e&&window.requestAnimationFrame(()=>{this.li();});}),this.sub("*cropBox",t=>{t&&(this.yt=t.height<=b||t.width<=b,this.ni(),this._e&&window.requestAnimationFrame(()=>{this.li();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.vr(t);}),document.addEventListener("pointermove",this.yr,true),document.addEventListener("pointerup",this.fr,true);}firstUpdated(t){super.firstUpdated(t),this.lo();}lo(){let t=this.Q;if(!(!t||this._e)){if(this.Zs(),this.so(),this._e=true,t.addEventListener("pointermove",this.gr,true),this.De){let e=this.De;this.De=null,this.vr(e);}this.li();}}disconnectedCallback(){super.disconnectedCallback(),this.Q?.removeEventListener("pointermove",this.gr,true),document.removeEventListener("pointermove",this.yr,true),document.removeEventListener("pointerup",this.fr,true);}render(){return m`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${k(this.dr)}></svg>`}};p([y()],He.prototype,"Ne",2);function No(r){return r?[({dimensions:t,coords:e})=>[...t,...e].every(s=>Number.isInteger(s)&&Number.isFinite(s)),({dimensions:t,coords:e})=>t.every(s=>s>0)&&e.every(s=>s>=0)].every(t=>t(r)):true}var Be=class extends w{constructor(){super();this.ctxOwner=true;this.he={width:0,height:0};this.s=null;this.m=false;this.E=null;this.Tr=C();this.pi=C();this.init$={...this.init$,"*padding":20,"*operations":{rotate:0,mirror:false,flip:false},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this.br=U(this.wr.bind(this),300),this.ci=Wr(()=>{!this.isConnected||!this.m||(this.di(),this.xr(),this.Er(),this.hi(),this.fi());},100);}firstUpdated(t){super.firstUpdated(t),this.di();}xr(){let t=this.$["*editorTransformations"],e=ss(t,Object.keys(this.$["*operations"])),s={...this.$["*operations"],...e};this.$["*operations"]=s;}di(){let t=this.Tr.value;if(!t)return;let e=t.getContext("2d"),s=this.offsetWidth,o=this.offsetHeight,n=window.devicePixelRatio;t.style.width=`${s}px`,t.style.height=`${o}px`,t.width=s*n,t.height=o*n,e?.scale(n,n),this.ui=t,this.s=e;}Er(){if(!this.m||!this.E)return;let t=this.E,e=this.$["*padding"],s=this.$["*operations"],{rotate:o}=s,n={width:this.offsetWidth,height:this.offsetHeight},a=Dt({width:t.naturalWidth,height:t.naturalHeight},o),l;if(a.width>n.width-e*2||a.height>n.height-e*2){let c=a.width/a.height,d=n.width/n.height;if(c>d){let u=n.width-e*2,h=u/c,f=0+e,v=e+(n.height-e*2)/2-h/2;l={x:f,y:v,width:u,height:h};}else {let u=n.height-e*2,h=u*c,f=e+(n.width-e*2)/2-h/2,v=0+e;l={x:f,y:v,width:h,height:u};}}else {let{width:c,height:d}=a,u=e+(n.width-e*2)/2-c/2,h=e+(n.height-e*2)/2-d/2;l={x:u,y:h,width:c,height:d};}this.$["*imageBox"]=Ft(l);}hi(){let t=this.$["*cropBox"],e=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,n=this.$["*editorTransformations"].crop,{width:a,x:l,y:c}=e;if(n){let{dimensions:[h,f],coords:[v,I]}=n,{width:R}=Dt(this.he,o),P=a/R;t=_t(Ft({x:l+v*P,y:c+I*P,width:h*P,height:f*P}),e);}let d=this.$["*currentAspectRatio"],u=d?d.width/d.height:void 0;if(!is(t,e)||u&&!rs(t,u)){let h=e.width/e.height,f=e.width,v=e.height;u&&(h>u?f=Math.min(e.height*u,e.width):v=Math.min(e.width/u,e.height)),t={x:e.x+e.width/2-f/2,y:e.y+e.height/2-v/2,width:f,height:v};}this.$["*cropBox"]=_t(Ft(t),e);}co(){let t=this.s;if(!t)return;let e=this.E;if(!e)return;let s=this.$["*imageBox"],o=this.$["*operations"],{mirror:n,flip:a,rotate:l}=o,c=Dt({width:s.width,height:s.height},l);t.save(),t.translate(s.x+s.width/2,s.y+s.height/2),t.rotate(l*Math.PI*-1/180),t.scale(n?-1:1,a?-1:1),t.drawImage(e,-c.width/2,-c.height/2,c.width,c.height),t.restore();}fi(){if(!this.m||!this.E||!this.ui||!this.s)return;let t=this.ui;this.s.clearRect(0,0,t.width,t.height),this.co();}uo({fromViewer:t}){this.E&&(this.pi.value?.toggleThumbs(true),this.po(),setTimeout(()=>{this.className=F({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}Cr(){let t=this.$["*cropBox"],e=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,{width:n,height:a}=e,{width:l,height:c}=Dt(this.he,o),{width:d,height:u}=t,h=n/l,f=a/c;return [yt(Math.round(d/h),1,l),yt(Math.round(u/f),1,c)]}ho(){let t=this.$["*cropBox"],e=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,{width:n,height:a,x:l,y:c}=e,{width:d,height:u}=Dt(this.he,o),{x:h,y:f}=t,v=n/d,I=a/u,R=this.Cr(),P={dimensions:R,coords:[yt(Math.round((h-l)/v),0,d-R[0]),yt(Math.round((f-c)/I),0,u-R[1])]};if(!No(P)){console.error("Cropper is trying to create invalid crop object",{payload:P});return}if(!(R[0]===d&&R[1]===u))return P}wr(){if(!this.isConnected||!this.he)return;let t=this.$["*operations"],{rotate:e,mirror:s,flip:o}=t,n=this.ho(),l={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:s,flip:o};this.$["*editorTransformations"]=l;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this.m&&(this.Er(),this.hi(),this.fi());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this.m){this.m=true,await this.updateComplete,this.di(),this.he=t,this.removeEventListener("transitionend",this.Sr);try{let s=this.$["*originalUrl"],o=this.$["*editorTransformations"];this.E=await this.fo(s,o),this.xr(),this.ci(),this.uo({fromViewer:e});}catch(s){console.error("Failed to activate cropper",{error:s}),this.telemetryManager.sendEventError(s,"cloud editor image. Failed to activate cropper");}this.c=new ResizeObserver(s=>{let[o]=s;if(!o)return;o.contentRect.width>0&&o.contentRect.height>0&&this.m&&this.E&&this.ci();}),this.c.observe(this);}}deactivate({reset:t=false}={}){this.m&&(!t&&this.wr(),this.m=false,this.mo(),this.className=F({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.pi.value?.toggleThumbs(false),this.addEventListener("transitionend",this.Sr,{once:true}),this.c?.disconnect());}mo(){let t=this.Cr(),e=this.$["*cropBox"],s=Math.min(this.offsetWidth,t[0])/e.width,o=Math.min(this.offsetHeight,t[1])/e.height,n=Math.min(s,o),a=e.x+e.width/2,l=e.y+e.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-a)/n}px, ${(this.offsetHeight/2-l)/n}px)`,this.style.transformOrigin=`${a}px ${l}px`;}po(){let t=this.$["*cropBox"],e=t.x+t.width/2,s=t.y+t.height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${s}px`;}Sr(){this.m||(this.E=null);}async fo(t,e){let s=this.offsetWidth;e={...e,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let o=await this.proxyUrl(Kt(t,s,e)),{promise:n,cancel:a,image:l}=oe(o),c=this.Ce(o);return l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),this.f?.(),this.f=a,n.then(()=>l).catch(d=>(console.error("Failed to load image",{error:d}),this.$["*networkProblems"]=true,l))}Ce(t){let e="crop",s=this.$["*loadingOperations"],o=s.get(e);return o||(o=new Map,s.set(e,o)),o.get(t)||(o.set(t,true),this.$["*loadingOperations"]=s),()=>{let n=s.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=s);}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.fi();}),this.sub("*cropBox",()=>{this.E&&this.br();}),this.sub("*currentAspectRatio",()=>{this.hi();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this.m&&this.he&&this.activate(this.he,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.c?.disconnect(),this.E&&(this.E=null);}render(){return m`<canvas class="uc-canvas" ${k(this.Tr)}></canvas><uc-crop-frame ${k(this.pi)}></uc-crop-frame>`}};p([y()],Be.prototype,"E",2);function Li(r,i,t){let e=t,s=t-1,o=new Array(e);for(let n=s;n>=0;n-=1)o[n]=Math.ceil((n*i+(s-n)*r)/s);return o}function _o(r){return typeof r=="string"&&r in H}function Do(r){let i=[];for(let t=0;t<r.length-1;t+=1){let e=r[t],s=r[t+1];typeof e=="number"&&typeof s=="number"&&i.push([e,s]);}return i}function Fo(r,i,t){let e=Do(r).find(([n,a])=>n<=i&&i<=a);if(!e)return r.map(()=>0);let[s,o]=e;return r.map(n=>{let a=Math.abs(s-o)||1,l=Math.abs(i-s)/a;return s===n?i>t?1:1-l:o===n?i>=t?l:1:0})}function Ko(r,i){return r.map((t,e)=>t<i?r.length-e:e)}function os(r,i){let t=H[r].keypointsNumber,{range:e,zero:s}=H[r];return [...new Set([...Li(e[0],s,t+1),...Li(s,e[1],t+1),s,i])].sort((o,n)=>o-n)}var Mi=class extends w{constructor(){super();this.m=false;this.mi=true;this.i="initial";this.kr={};this.J=[];this.Ar=0;this.Lr=C();this.gt=C();this.classList.add("uc-inactive_to_cropper"),this.Rr=U(async(t,e,s)=>{let o=()=>!this.Mr(t,e)||this.yi!==s||!!this.J.find(c=>c.value===s);if(o())return;let n=await this.Ir(t,s),a=new Image;a.src=n.src;let l=this.Ce(n.src);a.addEventListener("load",l,{once:true}),a.addEventListener("error",l,{once:true}),n.image=a,a.classList.add("uc-fader-image"),a.addEventListener("load",()=>{if(o())return;let c=this.J,d=c.findIndex(v=>v.value>s);d===-1&&(d=c.length);let h=c[d]?.image,f=this.gt.value;!f||h&&!f.contains(h)||(c.splice(d,0,n),h?f.insertBefore(a,h):f.appendChild(a),this.bi(t,s));},{once:true}),a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}Ce(t){let e=this.i,s=this.$["*loadingOperations"];s.has(e)||s.set(e,new Map);let o=s.get(e);return o&&!o.get(t)&&(o.set(t,true),this.$["*loadingOperations"]=s),()=>{let n=s.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=s);}}Pr(){window.cancelAnimationFrame(this.Ar),this.Ar=window.requestAnimationFrame(()=>{for(let t of this.J){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}fe({url:t=this.Or,filter:e=this.a??void 0,operation:s,value:o}={}){if(!t)throw new Error("URL is not defined");let n={...this.kr};s&&(s==="filter"?e&&typeof o=="number"&&(n.filter={name:e,amount:o}):typeof o=="number"&&(n[s]=o));let a=this.offsetWidth;return this.proxyUrl(Kt(t,a,n))}async Ir(t,e){return {src:await this.fe({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}Mr(t,e){return this.i===t&&this.a===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!_o(this.i)||!Number.isFinite(e)||(this.bi(this.i,e),this.Rr(this.i,this.a,e));}bi(t,e){this.i=t,this.yi=e;let{zero:s}=H[t],o=this.J.map(l=>l.value),n=Fo(o,e,s),a=Ko(o,s);this.J.forEach((l,c)=>{let d=n[c],u=a[c];typeof d=="number"&&(l.opacity=d),typeof u=="number"&&(l.zIndex=u);}),this.Pr();}$r(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async yo(){this.r=this.r||this.$r();let t=this.r;t&&this.Ur(t);let e=this.J.map(c=>c.src),{images:s,promise:o,cancel:n}=ne(e);s.forEach(c=>{let d=this.Ce(c.src);c.addEventListener("load",d),c.addEventListener("error",d);}),this.gi=()=>{n(),this.gi=void 0;};let a=this.i,l=this.a;if(await o,this.m&&this.Mr(a,l)){let c=this.gt.value;if(!c)return;c.replaceChildren(),this.J.forEach((d,u)=>{let h=s[u];h&&(h.classList.add("uc-fader-image"),d.image=h,c.appendChild(h));}),this.Pr();}}async setTransformations(t){if(this.kr=t,this.r){let e=await this.fe(),s=this.Ce(e);this.r.src=e,this.r.addEventListener("load",s,{once:true}),this.r.addEventListener("error",s,{once:true}),this.r.style.opacity="1",this.r.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:t,filter:e,operation:s,value:o}){if(!s||typeof o!="number")return;this.vi?.();let n=os(s,o),a=await Promise.all(n.map(c=>this.fe({url:t,filter:e,operation:s,value:c}))),{cancel:l}=ne(a);this.vi=l;}go(t){let e=this.r||this.$r();if(this.Ur(e),this.r=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=F({"uc-active_from_viewer":this.Ke,"uc-active_from_cropper":!this.Ke,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let s=this.Ce(t);e.addEventListener("error",s,{once:true}),e.src=t,e.addEventListener("load",()=>{s(),e&&(e.style.opacity="1",e.style.transform="scale(1)",this.className=F({"uc-active_from_viewer":this.Ke,"uc-active_from_cropper":!this.Ke,"uc-inactive_to_cropper":false}));},{once:true}),e.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}async activate({url:t,operation:e,value:s,filter:o,fromViewer:n}){if(this.m=true,this.mi=false,await this.updateComplete,this.Or=t,this.i=e??"initial",this.yi=s,this.a=o,this.Ke=n,typeof s!="number"&&!o){let l=await this.fe({operation:e,value:s});this.go(l),this.Ti();return}!e||typeof s!="number"||(this.J=await Promise.all(os(e,s).map(l=>this.Ir(e,l))),this.bi(e,s),this.yo());}deactivate({hide:t=true}={}){this.m=false,this.gi?.(),this.vi?.(),t&&!this.mi?(this.mi=true,this.r&&(this.r.style.transform="scale(1)"),this.className=F({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.Ti();},{once:true})):this.Ti();}Ur(t){let e=this.Lr.value;e&&(e.contains(t)||e.appendChild(t));}Ti(){this.gt.value?.replaceChildren();}render(){return m`<div class="uc-fader-preview-host" ${k(this.Lr)}></div><div class="uc-fader-layers-host" ${k(this.gt)}></div>`}};var ns="important",Vo=" !"+ns,le=z(class extends q{constructor(r){if(super(r),r.type!==lt.ATTRIBUTE||r.name!=="style"||r.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(r){return Object.keys(r).reduce((i,t)=>{let e=r[t];return e==null?i:i+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${e};`},"")}update(r,[i]){let{style:t}=r.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(i)),this.render(i);for(let e of this.ft)i[e]==null&&(this.ft.delete(e),e.includes("-")?t.removeProperty(e):t[e]=null);for(let e in i){let s=i[e];if(s!=null){this.ft.add(e);let o=typeof s=="string"&&s.endsWith(Vo);e.includes("-")||o?t.setProperty(e,o?s.slice(0,-11):s,o?ns:""):t[e]=s;}}return D}});var nt=class extends w{constructor(){super();this.wi=0;this.vt=C();this._r=C();this.Dr=C();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.ee=0;this.bo=t=>{t.stopPropagation();let e=this.Fr(t);e!==null&&(this.xi(e),this.vo("slider-input",e));};this.To=t=>{t.stopPropagation();let e=this.Fr(t);e!==null&&this.xi(e);};this.Kr=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.Vr=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}vo(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.wi=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.zr(this.ee),this.Ei(),this.c=new ResizeObserver(()=>{this.Ei(),this.bt(this.ee);}),this.c.observe(this);let e=this.vt.value;e?.addEventListener("focus",this.Kr),e?.addEventListener("blur",this.Vr),window.setTimeout(()=>{this.bt(this.ee);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.ee&&this.xi(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.Ei(),this.bt(this.ee)),t.has("zero")&&this.hasUpdated&&this.jr(this.ee);}bt(t){this.jr(t);let e=this.max-this.min;if(e===0)return;let{width:s}=this.getBoundingClientRect(),a=100/e*(t-this.min)*(s-this.wi)/100;window.requestAnimationFrame(()=>{let l=this._r.value;l&&(l.style.transform=`translateX(${a}px)`);});}jr(t){if(!this.Ve)return;let e=this.max-this.min;if(e===0)return;this.Ve.style.opacity=t===this.zero?"0":"1";let{width:s}=this.getBoundingClientRect(),a=100/e*(this.zero-this.min)*(s-this.wi)/100;window.requestAnimationFrame(()=>{this.Ve&&(this.Ve.style.transform=`translateX(${a}px)`);});}Ei(){let e=this.Dr.value;if(!e)return;let{width:s}=e.getBoundingClientRect(),o=Math.ceil(s/2),n=Math.ceil(o/15)-2;if(this.Nr===n)return;let a=document.createDocumentFragment(),l=document.createElement("div"),c=document.createElement("div");l.className="uc-minor-step",c.className="uc-border-step",a.appendChild(c);for(let u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());for(let u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());let d=document.createElement("div");d.className="uc-zero-dot",a.appendChild(d),this.Ve=d,e.innerHTML="",e.appendChild(a),this.Nr=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.vt.value;t?.removeEventListener("focus",this.Kr),t?.removeEventListener("blur",this.Vr),this.c?.disconnect(),this.c=void 0;}xi(t){Number.isFinite(t)&&(this.ee=t,this.hasUpdated&&(this.zr(t),this.bt(t)));}zr(t){let e=this.vt.value;e&&(e.value=String(t));}Fr(t){let e=t.currentTarget;if(!e)return null;let s=Number.parseInt(e.value,10);return Number.isFinite(s)?s:null}render(){return m`<div class="uc-steps" ${k(this.Dr)}></div><div class="uc-thumb" ${k(this._r)}></div><input class="uc-input" type="range" ${k(this.vt)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.ee)} ?disabled=${this.disabled} @input=${this.bo} @change=${this.To} />`}};p([g({type:Boolean,reflect:true})],nt.prototype,"disabled",2),p([g({type:Number})],nt.prototype,"min",2),p([g({type:Number})],nt.prototype,"max",2),p([g({type:Number,attribute:false})],nt.prototype,"defaultValue",2),p([g({type:Number})],nt.prototype,"zero",2),p([y()],nt.prototype,"ee",2);var Y="original",Ge=class extends w{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.wo=t=>{let{value:e}=t.detail;this.$["*faderEl"]?.set(e),this.state={...this.state,value:e};};}setOperation(t,e){this.state={...this.state,operation:t,filter:e},this.xo();let s=this.$["*faderEl"],o=this.state.originalUrl||this.$["*originalUrl"];s&&o&&s.activate({url:o,operation:this.state.operation,value:this.state.filter===Y?void 0:this.state.value,filter:this.state.filter===Y?void 0:this.state.filter,fromViewer:false});}xo(){let t=this.state.operation,{range:e,zero:s}=H[t],[o,n]=e;this.state={...this.state,min:o,max:n,zero:s};let l=this.$["*editorTransformations"][t];if(t==="filter"){let d=Number(n),u=l;if(u){let{name:h,amount:f}=u;d=h===this.state.filter?f:n;}this.state={...this.state,value:d,defaultValue:d};return}let c=typeof l<"u"?l:s;this.state={...this.state,value:c,defaultValue:c};}apply(){let e={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===Y?delete e.filter:e.filter={name:this.state.filter,amount:this.state.value}:e[this.state.operation]=this.state.value,this.$["*editorTransformations"]=e;}cancel(){this.$["*faderEl"]?.deactivate({hide:false});}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{t&&(this.state={...this.state,originalUrl:t});});}updated(t){if(super.updated(t),t.has("state")){let e=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$["*operationTooltip"]=e;}}render(){return m`<uc-slider-ui .disabled=${this.state.disabled} .min=${this.state.min} .max=${this.state.max} .defaultValue=${this.state.defaultValue} .zero=${this.state.zero} @slider-input=${this.wo} ></uc-slider-ui>`}};p([y()],Ge.prototype,"state",2);function Vt(r){if(!r)return null;let i=r.match(/^([A-Za-z]+)\s+(\d+)$/);if(!i)return null;let[,t,e]=i;return !t||typeof e>"u"?null:{filter:t,value:Number(e)}}var N=class extends w{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}get buttonClasses(){let t=this.active;return {"uc-active":t,"uc-not_active":!t}}Hr(){let t=this.buttonClasses;for(let[e,s]of Object.entries(t))this.classList.toggle(e,s);}onClick(t){}connectedCallback(){super.connectedCallback(),this.Hr();}updated(t){super.updated(t),t.has("active")&&this.Hr();}render(){let t=this.onClick,e=this.title;return m`<button role="option" type="button" aria-label=${A(this.titleProp)} title=${A(this.titleProp)} @click=${t} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};p([y()],N.prototype,"active",2),p([y()],N.prototype,"title",2),p([y()],N.prototype,"icon",2),p([y()],N.prototype,"titleProp",2);var qe=12,We=16,jo=r=>{let i=12,t=12;return r.width/r.height>=1?(i=qe,t=Math.round(qe*r.height/r.width)):(t=qe,i=Math.round(qe*r.width/r.height)),{width:i,height:t}},Ii=class extends N{initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this.Eo(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}Eo(i){return i?i.hasFreeform?this.l10n("freeform-crop"):this.l10n("crop-to-shape",{value:`${i.width}:${i.height}`}):""}render(){let i=this.onClick,t=this.title;return m`<button role="option" type="button" class=${ft(this.buttonClasses)} aria-label=${A(this.titleProp)} title=${A(this.titleProp)} @click=${i} ><div class="uc-title" ?hidden=${!t}>${t}</div><uc-icon name=${this.icon}></uc-icon></button>`}},Xe=class extends N{constructor(){super(...arguments);this.v=null;}get aspectRatio(){return this.v}set aspectRatio(t){if(this.v===t)return;let e=this.v;this.v=t,this.requestUpdate("aspectRatio",e),t?this.Br(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.v&&this.Br(this.v),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.v?.id||t?.width===this.v?.width&&t?.height===this.v?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.v?.id&&(this.$["*currentAspectRatio"]=this.v);}Br(t){if(!this.isConnected)return;let e=!!t.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",e);let s=()=>{let n=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=n,n},o=()=>{let n=this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:e?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${t.width}:${t.height}`}).toLowerCase(),value:""});return this.titleProp=n,n};s(),o(),e||this.requestUpdate();}Co(){let t=this.v;if(!t||t.hasFreeform)return m`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:s}=jo(t),o=(We-e)/2,n=(We-s)/2;return m`<uc-icon><svg viewBox="0 0 ${We} ${We}" aria-hidden="true" focusable="false" ><rect x=${o} y=${n} width=${e} height=${s} rx="2" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" ></rect></svg></uc-icon>`}render(){let t=this.onClick,e=this.title;return m`<button role="option" type="button" class=${ft(this.buttonClasses)} aria-label=${A(this.titleProp)} title=${A(this.titleProp)} @click=${t} >${this.Co()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};p([g({attribute:false})],Xe.prototype,"aspectRatio",1);function zo(r){let i=r+90;return i=i>=360?0:i,i}function Ho(r,i){if(r==="rotate")return zo(typeof i=="number"?i:0);if(r==="mirror"||r==="flip")return !i;throw new Error(`Unsupported operation: ${r}`)}var Ye=class extends N{constructor(){super(...arguments);this.operation=void 0;}willUpdate(t){super.willUpdate(t),this.operation?(this.titleProp=this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(this.operation).toLowerCase()}),this.icon=this.operation):(this.icon="",this.titleProp="");}onClick(t){if(!this.operation)return;let e=this.$["*cropperEl"],s=e.getValue(this.operation),o=Ho(this.operation,s);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:o,prev:s}),e.setValue(this.operation,o);}};p([g({type:String})],Ye.prototype,"operation",2);var gt=class extends N{constructor(){super(...arguments);this.i="";this.a="";this.ze="";this.Tt=0;this.r=null;this.ke=false;this.isOriginal=false;this.Gr=20;}get filter(){return this.a}set filter(t){let e=t??"";if(this.a===e)return;let s=this.a;this.a=e,this.i="filter",this.isOriginal=e===Y,this.icon=this.isOriginal?"original":"slider",this.Gr=this.isOriginal?40:20,this.requestUpdate("filter",s),this.isConnected&&this.qr(e);}onClick(t){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this.i,this.a),this.$["*showSlider"]=true);else {let e=this.$["*sliderEl"];e.setOperation(this.i,this.a),e.apply();}this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:Vt(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.a;}So(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.Gr||32,s=window.devicePixelRatio,o=Math.ceil(s*e),n=s>=2?"lightest":"normal",a=100,l={...this.$["*editorTransformations"]};return l[this.i]=this.a!==Y?{name:this.a,amount:a}:void 0,tt(this.ze,J(Ae,ct(l),`quality/${n}`,`scale_crop/${o}x${o}/center`,`@clib/${It}/${Pt}/uc-cloud-image-editor/`))}async ko(t,e){t[0]?.isIntersecting?await this.Ci(e):this.f?.();}initCallback(){super.initCallback(),this.c=new window.IntersectionObserver(this.ko.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this.ze=t??"",this.sub("*originalUrl",e=>{this.ze=e??"",!this.isOriginal&&this.ze&&this.isConnected&&!this.r&&(this.c?.observe(this),this.me());}),this.isOriginal||(this.c?.observe(this),this.me()),this.a&&this.qr(this.a),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.a);}),this.sub("*networkProblems",async e=>{e||(this.r?await this.Ci():this.me());});}disconnectedCallback(){super.disconnectedCallback(),this.c?.disconnect(),this.f?.(),this.wt();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.c?.unobserve(this):(this.c?.observe(this),this.me()));}qr(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async Ci(t){if(!this.isConnected){t?.unobserve(this),this.f?.(),this.f=void 0;return}if(!this.ze){!this.Se&&!this.te&&this.me();return}let e=++this.Tt,s="";try{s=await this.proxyUrl(this.So());}catch(a){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:a});return}this.ke=false,this.f?.();let{promise:o,cancel:n}=oe(s);this.f=()=>{n(),this.Tt===e&&(this.f=void 0);};try{if(await o,this.Tt!==e||!this.isConnected)return;this.r=s,this.ke=!0,this.wt(),(t??this.c)?.unobserve(this);}catch(a){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:a}),this.me();}finally{this.Tt===e&&(this.f=void 0);}}me(){if(!this.isConnected||this.r||this.ke||this.isOriginal||this.$["*networkProblems"]){this.wt();return}this.te&&cancelAnimationFrame(this.te),this.te=requestAnimationFrame(()=>{if(this.te=void 0,!this.isConnected||this.r||this.ke||this.isOriginal){this.wt();return}let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,s=window.innerWidth||document.documentElement.clientWidth,o=window.innerHeight||document.documentElement.clientHeight;if(e&&t.bottom>0&&t.right>0&&t.top<o&&t.left<s){this.Ci();return}this.Se=window.setTimeout(()=>{this.Se=void 0,this.me();},500);});}wt(){this.te&&(cancelAnimationFrame(this.te),this.te=void 0),this.Se&&(window.clearTimeout(this.Se),this.Se=void 0);}get Oo(){return !!(this.ke&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.Oo?"1":"0"};this.r&&(e.backgroundImage=`url(${this.r})`);let s={opacity:this.active||this.isOriginal?"1":"0"};return m`<button role="option" type="button" class=${ft(this.buttonClasses)} aria-label=${A(this.titleProp)} title=${A(this.titleProp)} @click=${t} ><div class="uc-preview" ?data-loaded=${this.ke} style=${le(e)}></div><uc-icon class=${ft({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${le(s)} ></uc-icon></button>`}};p([y()],gt.prototype,"r",2),p([y()],gt.prototype,"ke",2),p([y()],gt.prototype,"isOriginal",2),p([y()],gt.prototype,"Gr",2),p([g({type:String})],gt.prototype,"filter",1);var Ze=class extends N{constructor(){super(...arguments);this.i="";}get operation(){return this.i}set operation(t){let e=t??"";if(this.i===e)return;let s=this.i;this.i=e,this.requestUpdate("operation",s),this.isConnected&&e&&this.Wr(e);}Wr(t){this.icon=t;let e=()=>{let o=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=o,o},s=()=>{let o=this.l10n(t);return this.title=o,o};e(),s();}initCallback(){super.initCallback(),this.i&&this.Wr(this.i),this.sub("*editorTransformations",t=>{if(!this.i)return;let{zero:e}=H[this.i],s=t[this.i],o=typeof s<"u"?s!==e:false;this.active=o;});}onClick(t){this.$["*sliderEl"]?.setOperation(this.i),this.$["*showSlider"]=true,this.$["*currentOperation"]=this.i,this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:Vt(this.$["*operationTooltip"])});}};p([g({type:String})],Ze.prototype,"operation",1);var Bo=1,as=()=>{},Qe=class extends w{constructor(){super(...arguments);this.hiddenScrollbar=false;this.Xr=t=>{t.preventDefault();let{deltaY:e,deltaX:s}=t;if(Math.abs(s)>Bo){this.scrollLeft+=s;return}this.scrollLeft+=e;};}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.Xr,{passive:false}),this.addEventListener("scroll",as,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.Xr),this.removeEventListener("scroll",as),super.disconnectedCallback();}};p([g({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],Qe.prototype,"hiddenScrollbar",2);var V=class extends w{constructor(){super(...arguments);this.je=false;this.showMainToolbar=true;this.showSubToolbar=false;this.Yr=true;this.tabList=[...$];this.activeTab=O.CROP;this.xt=true;this.Si=false;this.Zr=null;this.Qr=0;this.Jr=0;this.Et=C();this.es=C();this.tabToggleRefs={[O.CROP]:C(),[O.TUNING]:C(),[O.FILTERS]:C()};this.ts=()=>{this.ye();};this.He=[];this.Ct=U(t=>{this.je=t;},500);this.St=U(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],s="",o=false;if(this.$["*tabId"]===O.FILTERS)if(o=true,this.$["*currentFilter"]&&t?.filter?.name===this.$["*currentFilter"]){let n=t?.filter?.amount||100;s=`${this.$["*currentFilter"]} ${n}`;}else s=this.l10n(Y);else if(this.showSubToolbar&&this.$["*tabId"]===O.TUNING&&e){o=true;let n=t?.[e]||H[e].zero;s=`${this.l10n(e)} ${n}`;}o&&(this.$["*operationTooltip"]=s),this.Si=o;},0);this.Ao={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.Ro={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.Lo={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.Mo={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":Y,"*currentOperation":null,"*operationTooltip":null};this.zo=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.f?.();let e=this.$["*on.cancel"];e?.();};this.jo=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.Ho=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:Vt(this.$["*operationTooltip"])}),this.Et.value?.apply(),this.rs();};this.Bo=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.Et.value?.cancel(),this.rs();};this.Go=t=>{let s=t.currentTarget?.getAttribute("data-id");s&&(this.telemetryManager.sendEventCloudImageEditor(t,s),this.ki(s,{fromViewer:false}));};}rs(){this.$["*showSlider"]=false,this.$["*tabId"]===O.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===O.TUNING&&(this.Si=false);}ki(t,{fromViewer:e=false,force:s=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.ss(t,{fromViewer:e,force:s});}ss(t,{fromViewer:e,force:s=false}){if(!s&&this.activeTab===t){this.ye();return}this.activeTab=t;let o=this.$["*faderEl"],n=this.$["*cropperEl"];t===O.CROP?(o?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:e})):(o?.activate({url:this.$["*originalUrl"],fromViewer:e}),n?.deactivate());for(let a of $){let l=a===t,d=this.tabToggleRefs[a]?.value;d&&(d.active=l),l&&this.ye();}}ye(){let e=this.tabToggleRefs[this.activeTab]?.value,s=this.es.value;if(!e||!s)return;let o=e.offsetLeft,n=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.Qr!==o||this.Jr!==n)&&(this.Qr=o,this.Jr=n,s.style.transform=`translateX(${o}px)`,s.style.width=`${n}px`);}get Oi(){return this.He.length>=3}Io(t){switch(t){case O.CROP:return this.Po();case O.FILTERS:return this.$o();case O.TUNING:return this.Uo();default:return []}}Po(){let t=[];if(this.Oi)t.push(()=>this.No());else for(let e of this.He)t.push(()=>this.os(e));for(let e of gr)t.push(()=>this._o(e));return this.Ai(t)}$o(){let e=[Y,...yr].map(s=>()=>this.Do(s));return this.Ai(e)}Uo(){let t=mr.map(e=>()=>this.Fo(e));return this.Ai(t)}Ai(t){return t.length?t.map(s=>s()):[]}No(){return m`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}os(t){return m`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}_o(t){return m`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}Do(t){return m`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}Fo(t){return m`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}Ko(){return this.Oi?this.He.map(t=>this.os(t)):[]}async Vo(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(Kt(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.f?.();let{cancel:s}=ne([e]);this.f=()=>{s(),this.f=void 0;};}}initCallback(){super.initCallback();let t=this.$["*cropPresetList"]??[];this.He=[...t],this.sub("*cropPresetList",e=>{this.He=[...e??[]];}),this.sub("*imageSize",e=>{e&&setTimeout(()=>{this.ki(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let s=e?.filter?.name;this.$["*currentFilter"]!==s&&(this.$["*currentFilter"]=s??"");}),this.sub("*currentFilter",()=>{this.St();}),this.sub("*currentOperation",()=>{this.St();}),this.sub("*tabId",e=>{this.ss(e,{fromViewer:false,force:true}),this.St();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.Vo(),this.$["*faderEl"]?.setTransformations(e);}),this.sub("*loadingOperations",e=>{let s=false;for(let[,o]of e.entries()){if(s)break;for(let[,n]of o.entries())if(n){s=true;break}}this.Ct(s);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.xt=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.xt=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.Yr=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[s]=e;s&&this.ki(s,{fromViewer:false});return}this.ye();}),this.sub("*operationTooltip",e=>{this.Zr=e;}),this.St();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.ts);}firstUpdated(t){super.firstUpdated(t),this.kt(),this.ye();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.ye()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.kt();}disconnectedCallback(){window.removeEventListener("resize",this.ts),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}kt(){let t=this.Et.value;t&&(this.$["*sliderEl"]=t);}qo(t){let e=this.tabList.includes(t),s=this.activeTab===t,o=this.tabList.indexOf(t),n=o>=0?le({gridColumn:`${o+1}`}):T;return m`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.Lo}><uc-btn-ui theme="tab" data-id=${t} icon=${t} role="tab" aria-controls=${`tab_${t}`} aria-selected=${s?"true":"false"} title-prop=${`a11y-editor-tab-${t}`} .active=${s} style=${n} @click=${this.Go} ${k(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Wo(t){let e=this.Io(t);return m`<div id=${`tab_${t}`} class="uc-tab-content" ><uc-editor-scroller hidden-scrollbar><div class="uc-controls-list_align"><div role="listbox" aria-orientation="horizontal" class="uc-controls-list_inner">${e.length?e:T}</div></div></uc-editor-scroller></div>`}render(){let t=["uc-info-tooltip",this.Si?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.Oi;return m`<uc-line-loader-ui .active=${this.je}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.Zr??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.Ao} ><div class="uc-tab-content-row">${$.map(s=>Yt(this.activeTab===s,()=>this.Wo(s)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.Yr} .styles=${this.Mo} @initial-render=${()=>this.ye()} ><div class="uc-tab-toggles_indicator" ${k(this.es)} ></div>${$.map(s=>this.qo(s))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.zo} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.jo}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.Ro}><div class="uc-slider" ?hidden=${!this.xt}><uc-editor-slider ${k(this.Et)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.xt||!e}>${e?m`<div class="uc-list-aspect-ratio">${this.Ko()}</div>`:T}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.Bo} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.Ho} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};p([y()],V.prototype,"je",2),p([y()],V.prototype,"showMainToolbar",2),p([y()],V.prototype,"showSubToolbar",2),p([y()],V.prototype,"Yr",2),p([y()],V.prototype,"tabList",2),p([y()],V.prototype,"activeTab",2),p([y()],V.prototype,"xt",2),p([y()],V.prototype,"Si",2),p([y()],V.prototype,"Zr",2),p([y()],V.prototype,"He",2);var ls=kt([...$]),_=class extends w{constructor(){super(...arguments);this.ctxOwner=true;this.Xo="";this.fe=ht;this.Yo="";this.je=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=ls;this.ns=false;this.Z=false;this.Ri=null;this.Ct=U(t=>{this.je=t;},300);this.Ot=C();this.as=C();this.ls=C();this.cs=C();this.us=()=>{this.Ct(false),this.fe!==ht&&(this.$["*networkProblems"]=false);};this.ps=()=>{this.Ct(false),this.$["*networkProblems"]=true;};this.Zo=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...Gr(this)};}static{this.styleAttrs=["uc-cloud-image-editor"];}Qo(){this.Z||this.Ri||(this.Ri=this.updateComplete.then(()=>{this.Ri=null,this.Z=true;}));}initCallback(){super.initCallback(),this.ds(),this.hs();}kt(){let t=this.ls.value;t&&(this.$["*faderEl"]=t);let e=this.as.value;e&&(this.$["*cropperEl"]=e);let s=this.cs.value;s&&(this.$["*imgContainerEl"]=s);let o=this.Ot.value;o&&(this.$["*imgEl"]=o);}Jo(){let t=this.Ot.value;t&&(t.addEventListener("load",this.us),t.addEventListener("error",this.ps));}en(){let t=this.Ot.value;t&&(t.removeEventListener("load",this.us),t.removeEventListener("error",this.ps));}get tn(){let t=this.$["*tabId"];return F("uc-image",{"uc-image_hidden_to_cropper":t===O.CROP,"uc-image_hidden_effects":t!==O.CROP})}fs(){return new Promise((e,s)=>{let o=window.setTimeout(()=>{s(new Error("[cloud-image-editor] timeout waiting for non-zero container size"));},3e3),n=new ResizeObserver(a=>{let[l]=a;l&&l.contentRect.width>0&&l.contentRect.height>0&&(window.clearTimeout(o),n.disconnect(),window.setTimeout(()=>e(),0));});n.observe(this);})}firstUpdated(t){super.firstUpdated(t),this.kt(),this.Jo(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),s=t.has("uuid")||t.has("cdnUrl");e&&!s&&this.updateImage();}disconnectedCallback(){this.en(),super.disconnectedCallback();}render(){let t=this.Yo??"",e=this.Xo??"",s=this.fe||ht,o=this.je,n=this.ns;return m` ${sr(qr)}<div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" .visible=${n}><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" @click=${this.Zo}></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">${t}</div></div><div class="uc-image_container" ${k(this.cs)}><img src=${s} class=${this.tn} ${k(this.Ot)} />${Yt(this.Z,()=>m`<uc-editor-image-cropper ${k(this.as)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${k(this.ls)}></uc-editor-image-fader></div><div class="uc-info_pan">${e}</div></div><div class="uc-toolbar"><uc-line-loader-ui .active=${o}></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor">${Yt(this.Z,()=>m`<uc-editor-toolbar></uc-editor-toolbar>`)}</div></div></div>`}updated(t){super.updated(t),t.has("uuid")&&this.uuid&&this.updateImage(),t.has("cdnUrl")&&this.cdnUrl&&this.updateImage(),t.has("tabs")&&this.ds(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.hs();}ds(){let t=this.tabs||ls;this.$["*tabList"]=Br(t);}hs(){let t=zr(this.cropPreset??""),e=null;if(this.cdnUrl){let s=mi(this.cdnUrl),o=gi(s);if(Array.isArray(o?.crop?.dimensions)){let[n,a]=o.crop.dimensions;e=Hr(n,a,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){if(await this.fs(),this.cdnUrl){let t=this.cdnUrl,e=Oe(t),s=yi(t,e);if(s===this.$["*originalUrl"])return;this.$["*originalUrl"]=s;let o=mi(t),n=gi(o);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=yi(this.cfg.cdnCname,this.uuid);if(t===this.$["*originalUrl"])return;this.$["*originalUrl"]=t,Object.keys(this.$["*editorTransformations"]).length>0&&(this.$["*editorTransformations"]={});}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===O.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(tt(t,J("json"))),s=await fetch(e).then(a=>a.json()),{width:o,height:n}=s;this.$["*imageSize"]={width:o,height:n},this.$["*tabId"]===O.CROP?this.$["*cropperEl"]?.activate(this.$["*imageSize"]):this.$["*faderEl"]?.activate({url:t});}catch(t){t&&(this.telemetryManager.sendEventError(t,"cloud editor image. Failed to load image info"),console.error("Failed to load image info",t));}this.Qo();}}async initEditor(){try{await this.fs();}catch(t){this.isConnected&&console.error(t.message);return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.ns=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],s=J(ct(t),"preview"),o=tt(e,s),n={originalUrl:e,cdnUrlModifiers:s,cdnUrl:o,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};p([y()],_.prototype,"Xo",2),p([y()],_.prototype,"fe",2),p([y()],_.prototype,"Yo",2),p([y()],_.prototype,"je",2),p([g({type:String,reflect:true})],_.prototype,"uuid",2),p([g({type:String,attribute:"cdn-url",reflect:true})],_.prototype,"cdnUrl",2),p([g({type:String,attribute:"crop-preset",reflect:true})],_.prototype,"cropPreset",2),p([g({type:String,reflect:true})],_.prototype,"tabs",2),p([y()],_.prototype,"ns",2),p([y()],_.prototype,"Z",2);var cs=class extends _{static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:st.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var Go=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function qo(r){for(let i in r){if(Go.includes(i))continue;let t=[...i].reduce((e,s)=>(s.toUpperCase()===s&&(s=`-${s.toLowerCase()}`),e+=s,e),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("uc-")||(t=`uc-${t}`),r[i].reg&&r[i].reg(t);}}var Je=r=>r.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(i=>i.toLowerCase()).join("-");var us=new Set;function ds(r){us.has(r)||(us.add(r),console.warn(r));}var Wo=[{test:r=>!!r.accept&&!!r.imgOnly,message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:r=>r.enableVideoRecording!==null,message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:r=>r.defaultCameraMode!==null,message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],ps=U(r=>{for(let{test:i,message:t}of Wo)i(r)&&ds(t);},0);var hs=(r,i)=>{let t=new URL(i);return t.hostname=`${r}.${t.hostname}`,t.toString().replace(/\/$/,"")},Xo="0123456789abcdefghijklmnopqrstuvwxyz",fs=r=>{if(r<=0n)return "0";let i="";for(;r>0n;){let t=r%36n;i=Xo[Number(t)]+i,r=r/36n;}return i},Pi=(r,i)=>{try{let t=new URL(r),e=new URL(i);return t.hostname.endsWith(e.hostname)}catch{return false}};var Yo=async r=>{let i=new TextEncoder().encode(r),t=await window.crypto.subtle.digest("SHA-256",i),e=Array.from(new Uint8Array(t)).map(s=>s.toString(16).padStart(2,"0")).join("");return BigInt(`0x${e}`)},Zo=10,Qo=async r=>{let i=await Yo(r);return fs(i).slice(0,Zo)},ms=async(r,i)=>{let t=await Qo(r);return hs(t,i)};var ys=r=>r instanceof Promise||!!(r&&typeof r=="object"&&"then"in r&&typeof r.then=="function");var $i=r=>r,Jo=[$i({key:"cameraModes",deps:["enableVideoRecording"],fn:({cameraModes:r,enableVideoRecording:i})=>{if(i===null)return r;let t=St(r);return i&&!t.includes("video")?t=t.concat("video"):i||(t=t.filter(e=>e!=="video")),kt(t)}}),$i({key:"cameraModes",deps:["defaultCameraMode"],fn:({cameraModes:r,defaultCameraMode:i})=>{if(i===null)return r;let t=St(r);return t=t.sort((e,s)=>e===i?-1:s===i?1:0),kt(t)}}),$i({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:({pubkey:r,cdnCname:i,cdnCnamePrefixed:t})=>r&&(i===vi||Pi(i,t))?ms(r,t):i})],gs=({key:r,setValue:i,getValue:t,computationControllers:e})=>{for(let s of Jo)if(s.deps.includes(r)){let o={[s.key]:t(s.key)};for(let l of s.deps)o[l]=t(l);let n=new AbortController;e.get(s.key)?.abort(),e.set(s.key,n);let a;try{a=s.fn(o,{signal:n.signal});}catch(l){e.get(s.key)===n&&e.delete(s.key),console.error(`Failed to compute value for "${s.key}"`,l);return}ys(a)?a.then(l=>{n.signal.aborted||i(s.key,l);}).catch(l=>{n.signal.aborted||console.error(`Failed to compute value for "${s.key}"`,l);}).finally(()=>{e.get(s.key)===n&&e.delete(s.key);}):i(s.key,a);}};var Ui=Object.freeze({PHOTO:"photo",VIDEO:"video"});var E=r=>String(r),M=r=>{let i=Number(r);if(Number.isNaN(i))throw new Error(`Invalid number: "${r}"`);return i},S=r=>{if(typeof r>"u"||r===null)return false;if(typeof r=="boolean")return r;if(r==="true"||r==="")return true;if(r==="false")return false;throw new Error(`Invalid boolean: "${r}"`)},vs=r=>r==="auto"?r:S(r),bs=r=>{let i=E(r);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},Ts=r=>{let i=E(r);if(!Object.values(Ui).includes(i))throw new Error(`Invalid value: "${i}"`);return i},ws=r=>{let i=E(r),t=St(i);if(t.some(e=>!Object.values(Ui).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},xs=r=>{let i=E(r);if(i==="local"||i==="global")return i;if(S(r)===false)return false;throw new Error(`Invalid value: "${i}"`)},Es=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.")},ti=r=>{if(typeof r=="object")return r;throw new Error("Invalid value. Must be an object.")},ei=r=>{if(typeof r=="function")return r;throw new Error("Invalid value. Must be a function.")},Ni=r=>{if(Array.isArray(r))return r;throw new Error("Must be an array.")},Cs=r=>{let i=E(r);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)};var tn={pubkey:E,multiple:S,multipleMin:M,multipleMax:M,confirmUpload:S,imgOnly:S,accept:E,externalSourcesPreferredTypes:E,externalSourcesEmbedCss:E,store:vs,cameraMirror:S,cameraCapture:bs,sourceList:E,topLevelOrigin:E,maxLocalFileSizeBytes:M,thumbSize:M,showEmptyList:S,useLocalImageEditor:S,useCloudImageEditor:S,cloudImageEditorTabs:E,removeCopyright:S,cropPreset:E,imageShrink:E,modalScrollLock:S,modalBackdropStrokes:S,sourceListWrap:S,remoteTabSessionKey:E,cdnCname:E,cdnCnamePrefixed:E,baseUrl:E,socialBaseUrl:E,secureSignature:E,secureExpire:E,secureDeliveryProxy:E,retryThrottledRequestMaxTimes:M,retryNetworkErrorMaxTimes:M,multipartMinFileSize:M,multipartChunkSize:M,maxConcurrentRequests:M,multipartMaxConcurrentRequests:M,multipartMaxAttempts:M,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:S,groupOutput:S,userAgentIntegration:E,debug:S,localeName:E,metadata:Es,secureUploadsExpireThreshold:M,localeDefinitionOverride:r=>ti(r),secureUploadsSignatureResolver:r=>ei(r),secureDeliveryProxyUrlResolver:r=>ei(r),iconHrefResolver:r=>ei(r),fileValidators:Ni,collectionValidators:Ni,validationTimeout:M,validationConcurrency:M,cameraModes:ws,defaultCameraMode:Ts,enableAudioRecording:S,enableVideoRecording:S,mediaRecorderOptions:ti,maxVideoRecordingDuration:M,filesViewMode:Cs,gridShowFileNames:S,cloudImageEditorAutoOpen:S,cloudImageEditorMaskHref:E,testMode:S,qualityInsights:S,pasteScope:xs,smartBtn:ti},Ss=(r,i)=>{if(!(typeof i>"u"||i===null))try{return tn[r](i)}catch(t){return console.error(`Invalid value for config key "${r}".`,t),L[r]}};var ii=[...new Set(["debug",...Object.keys(L)])],en=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions","smartBtn"],As=r=>en.includes(r),ce=ii.filter(r=>!As(r)),ks={...Object.fromEntries(ce.map(r=>[Je(r),r])),...Object.fromEntries(ce.map(r=>[r.toLowerCase(),r]))},rn={...Object.fromEntries(ce.map(r=>[Je(r),x(r)])),...Object.fromEntries(ce.map(r=>[r.toLowerCase(),x(r)]))},Os=r=>`__${r}`,ri=class extends w{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(L).map(([t,e])=>[x(t),e]))};this.rn=new Map;}sn(t,e){if(!As(t)){let s=[...new Set([Je(t),t.toLowerCase()])];for(let o of s)typeof e>"u"||e===null?this.removeAttribute(o):this.getAttribute(o)!==e.toString()&&this.setAttribute(o,e.toString());}}nn(t,e){this.$[x(t)]!==e&&(typeof e>"u"||e===null?this.$[x(t)]=L[t]:this.$[x(t)]=e);}At(t,e){let s=this,o=Ss(t,e),n=Os(t);s[n]!==o&&(this.an(t,s[n],o),s[n]=o,this.sn(t,o),this.nn(t,o),this.debugPrint(`"${t}"`,o),ps(this.cfg));}ms(t){let e=this,s=Os(t);return e[s]??this.$[x(t)]}an(t,e,s){this.cfg.debug&&s!==e&&typeof s=="object"&&typeof e=="object"&&JSON.stringify(s)===JSON.stringify(e)&&(console.warn(`[uc-config] Option "${t}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${t}" previous value:`,e),console.warn(`[uc-config] "${t}" new value:`,s));}initCallback(){super.initCallback();let t=this;for(let e of ce)this.sub(x(e),s=>{this.At(e,s);},false);for(let e of ii){let s=t[e]??this.$[x(e)];s!==L[e]&&this.At(e,s);let o=Object.getOwnPropertyDescriptor(this,e);(!o||!o.set||!o.get)&&Object.defineProperty(this,e,{set:n=>{this.At(e,n);},get:()=>this.ms(e)});}for(let e of ii)this.sub(x(e),()=>{gs({key:e,setValue:this.At.bind(this),getValue:this.ms.bind(this),computationControllers:this.rn});});}attributeChangedCallback(t,e,s){if(super.attributeChangedCallback(t,e,s),e===s)return;let o=this,n=ks[t];n&&(o[n]=s),rn[t]&&(this[t]=s);}static get observedAttributes(){return [...super.observedAttributes,...Object.keys(ks)]}};for(let r of ii)ri.prototype[r]=void 0;/*! For license information please see uc-cloud-image-editor.min.js.LEGAL.txt */
8
8
  export{G as BtnUi,cs as CloudImageEditor,_ as CloudImageEditorBlock,ri as Config,He as CropFrame,Xe as EditorAspectRatioButtonControl,Ye as EditorCropButtonControl,gt as EditorFilterControl,Ii as EditorFreeformButtonControl,Be as EditorImageCropper,Mi as EditorImageFader,Ze as EditorOperationControl,Qe as EditorScroller,Ge as EditorSlider,V as EditorToolbar,se as Icon,je as LineLoaderUi,re as PresenceToggle,nt as SliderUi,qo as defineComponents};