@uploadcare/file-uploader 1.26.2 → 1.27.0-alpha.0

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 (85) hide show
  1. package/dist/CloudImageEditorActivity-7EK7P3UP.js +1 -0
  2. package/dist/CloudImageEditorActivity-HGSS7NV2.css +8 -0
  3. package/dist/CloudImageEditorActivity-HGSS7NV2.layered.css +7 -0
  4. package/dist/abstract/loadFileUploaderFrom.js +2 -2
  5. package/dist/chunk-5OA6ZVWQ.js +7 -0
  6. package/dist/chunk-BDD5ZPFI.js +7 -0
  7. package/dist/chunk-GCTQN3DZ.js +7 -0
  8. package/dist/chunk-LNXFGGSC.js +7 -0
  9. package/dist/chunk-NJ77GRVX.js +8 -0
  10. package/dist/chunk-TVCYFFRR.js +7 -0
  11. package/dist/cloud-image-editor-PX6YZMOH.css +6 -0
  12. package/dist/cloud-image-editor-PX6YZMOH.layered.css +7 -0
  13. package/dist/cloud-image-editor-Q5333S7T.js +1 -0
  14. package/dist/cloudImageEditorPlugin-BE5HU2W4.js +8 -0
  15. package/dist/cloudImageEditorPlugin-WZCVZALK.css +6 -0
  16. package/dist/cloudImageEditorPlugin-WZCVZALK.layered.css +7 -0
  17. package/dist/core.css +6 -0
  18. package/dist/core.d.ts +3168 -0
  19. package/dist/core.js +8 -0
  20. package/dist/core.layered.css +7 -0
  21. package/dist/env.js +3 -3
  22. package/dist/index.css +3 -3
  23. package/dist/index.d.ts +433 -106
  24. package/dist/index.js +5 -5
  25. package/dist/index.layered.css +3 -3
  26. package/dist/index.ssr.js +96 -6
  27. package/dist/locales/file-uploader/ar.js +2 -2
  28. package/dist/locales/file-uploader/az.js +2 -2
  29. package/dist/locales/file-uploader/ca.js +2 -2
  30. package/dist/locales/file-uploader/cs.js +2 -2
  31. package/dist/locales/file-uploader/da.js +2 -2
  32. package/dist/locales/file-uploader/de.js +2 -2
  33. package/dist/locales/file-uploader/el.js +2 -2
  34. package/dist/locales/file-uploader/en.js +2 -2
  35. package/dist/locales/file-uploader/es.js +2 -2
  36. package/dist/locales/file-uploader/et.js +2 -2
  37. package/dist/locales/file-uploader/fi.js +2 -2
  38. package/dist/locales/file-uploader/fr.js +2 -2
  39. package/dist/locales/file-uploader/he.js +2 -2
  40. package/dist/locales/file-uploader/hy.js +2 -2
  41. package/dist/locales/file-uploader/is.js +2 -2
  42. package/dist/locales/file-uploader/it.js +2 -2
  43. package/dist/locales/file-uploader/ja.js +2 -2
  44. package/dist/locales/file-uploader/ka.js +2 -2
  45. package/dist/locales/file-uploader/kk.js +2 -2
  46. package/dist/locales/file-uploader/ko.js +2 -2
  47. package/dist/locales/file-uploader/lv.js +2 -2
  48. package/dist/locales/file-uploader/nb.js +2 -2
  49. package/dist/locales/file-uploader/nl.js +2 -2
  50. package/dist/locales/file-uploader/pl.js +2 -2
  51. package/dist/locales/file-uploader/pt.js +2 -2
  52. package/dist/locales/file-uploader/ro.js +2 -2
  53. package/dist/locales/file-uploader/ru.js +2 -2
  54. package/dist/locales/file-uploader/sk.js +2 -2
  55. package/dist/locales/file-uploader/sr.js +2 -2
  56. package/dist/locales/file-uploader/sv.js +2 -2
  57. package/dist/locales/file-uploader/tr.js +2 -2
  58. package/dist/locales/file-uploader/uk.js +2 -2
  59. package/dist/locales/file-uploader/vi.js +2 -2
  60. package/dist/locales/file-uploader/zh-TW.js +2 -2
  61. package/dist/locales/file-uploader/zh.js +2 -2
  62. package/package.json +11 -1
  63. package/web/file-uploader.iife.min.d.ts +433 -106
  64. package/web/file-uploader.iife.min.js +4 -4
  65. package/web/file-uploader.min.d.ts +433 -106
  66. package/web/file-uploader.min.js +4 -4
  67. package/web/uc-basic.layered.min.css +3 -3
  68. package/web/uc-basic.min.css +3 -3
  69. package/web/uc-cloud-image-editor.layered.min.css +3 -3
  70. package/web/uc-cloud-image-editor.min.css +3 -3
  71. package/web/uc-cloud-image-editor.min.d.ts +518 -191
  72. package/web/uc-cloud-image-editor.min.js +4 -4
  73. package/web/uc-file-uploader-inline.layered.min.css +3 -3
  74. package/web/uc-file-uploader-inline.min.css +3 -3
  75. package/web/uc-file-uploader-inline.min.d.ts +433 -106
  76. package/web/uc-file-uploader-inline.min.js +4 -4
  77. package/web/uc-file-uploader-minimal.layered.min.css +3 -3
  78. package/web/uc-file-uploader-minimal.min.css +3 -3
  79. package/web/uc-file-uploader-minimal.min.d.ts +433 -106
  80. package/web/uc-file-uploader-minimal.min.js +4 -4
  81. package/web/uc-file-uploader-regular.layered.min.css +3 -3
  82. package/web/uc-file-uploader-regular.min.css +3 -3
  83. package/web/uc-file-uploader-regular.min.d.ts +433 -106
  84. package/web/uc-file-uploader-regular.min.js +4 -4
  85. package/web/uc-img.min.js +4 -4
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
- * Package: @uploadcare/file-uploader@1.26.2 (MIT)
3
+ * Package: @uploadcare/file-uploader@1.27.0-alpha.0 (MIT)
4
4
  * License: https://github.com/uploadcare/blob/main/LICENSE
5
- * Built: 2026-02-02T18:22:00.481Z
5
+ * Built: 2026-02-17T11:57:35.150Z
6
6
  */
7
- var Os=Object.defineProperty;var As=Object.getOwnPropertyDescriptor;var p=(r,i,t,e)=>{for(var s=e>1?void 0:e?As(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&&Os(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,_i=Symbol(),Ni=new WeakMap,de=class{constructor(i,t,e){if(this.ms=true,e!==_i)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=Ni.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&Ni.set(t,i));}return i}toString(){return this.cssText}},Di=r=>new de(typeof r=="string"?r:r+"",void 0,_i);var Fi=(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);}},ii=pe?r=>r:r=>r instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return Di(t)})(r):r;var{is:Rs,defineProperty:Ls,getOwnPropertyDescriptor:Ms,getOwnPropertyNames:Is,getOwnPropertySymbols:Ps,getPrototypeOf:$s}=Object,he=globalThis,Ki=he.trustedTypes,Us=Ki?Ki.emptyScript:"",Ns=he.reactiveElementPolyfillSupport,jt=(r,i)=>r,zt={toAttribute(r,i){switch(i){case Boolean:r=r?Us: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)=>!Rs(r,i),Vi={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.Re(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.Jt&&[...this.Jt.keys()]}static createProperty(i,t=Vi){if(t.state&&(t.attribute=false),this.Re(),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&&Ls(this.prototype,i,s);}}static getPropertyDescriptor(i,t,e){let{get:s,set:o}=Ms(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)??Vi}static Re(){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.Re(),this.hasOwnProperty(jt("properties"))){let t=this.properties,e=[...Is(t),...Ps(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.Jt=new Map;for(let[t,e]of this.elementProperties){let s=this.Me(t,e);s!==void 0&&this.Jt.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(ii(s));}else i!==void 0&&t.push(ii(i));return t}static Me(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.te=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.Et=null,this.ys();}ys(){this.Le=new Promise(i=>this.enableUpdating=i),this.et=new Map,this.gs(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this.Ut??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.Ut?.delete(i);}gs(){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.te=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Fi(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.Ut?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this.Ut?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.Ie(i,e);}vs(i,t){let e=this.constructor.elementProperties.get(i),s=this.constructor.Me(i,e);if(s!==void 0&&e.reflect===true){let o=(e.converter?.toAttribute!==void 0?e.converter:zt).toAttribute(t,e.type);this.Et=i,o==null?this.removeAttribute(s):this.setAttribute(s,o),this.Et=null;}}Ie(i,t){let e=this.constructor,s=e.Jt.get(i);if(s!==void 0&&this.Et!==s){let o=e.getPropertyOptions(s),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:zt;this.Et=s;let a=n.fromAttribute(t,o.type);this[s]=a??this.Pe?.get(s)??a,this.Et=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.Pe?.get(i)&&!this.hasAttribute(n.Me(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.Le=this.bs());}C(i,t,{useDefault:e,reflect:s,wrapped:o},n){e&&!(this.Pe??=new Map).has(i)&&(this.Pe.set(i,n??t??this[i]),o!==true||n!==void 0)||(this.et.has(i)||(this.hasUpdated||e||(t=void 0),this.et.set(i,t)),s===true&&this.Et!==i&&(this.Mi??=new Set).add(i));}async bs(){this.isUpdatePending=true;try{await this.Le;}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.te){for(let[s,o]of this.te)this[s]=o;this.te=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.et.has(s)||a===void 0||this.C(s,void 0,o,a);}}let i=false,t=this.et;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.Ut?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.$e();}catch(e){throw i=false,this.$e(),e}i&&this.Ts(t);}willUpdate(i){}Ts(i){this.Ut?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}$e(){this.et=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.Le}shouldUpdate(i){return true}update(i){this.Mi&&=this.Mi.forEach(t=>this.vs(t,this[t])),this.$e();}updated(i){}firstUpdated(i){}};Z.elementStyles=[],Z.shadowRootOptions={mode:"open"},Z[jt("elementProperties")]=new Map,Z[jt("finalized")]=new Map,Ns?.({ReactiveElement:Z}),(he.reactiveElementVersions??=[]).push("2.1.2");var si=globalThis,ji=r=>r,me=si.trustedTypes,zi=me?me.createPolicy("lit-html",{createHTML:r=>r}):void 0,oi="$lit$",Q=`lit$${Math.random().toFixed(9).slice(2)}$`,ni="?"+Q,_s=`<${ni}>`,wt=document,Bt=()=>wt.createComment(""),Gt=r=>r===null||typeof r!="object"&&typeof r!="function",ai=Array.isArray,Xi=r=>ai(r)||typeof r?.[Symbol.iterator]=="function",ri=`[ \f\r]`,Ht=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Hi=/-->/g,Bi=/>/g,bt=RegExp(`>|${ri}(?:([^\\s"'>=/]+)(${ri}*=${ri}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),Gi=/'/g,qi=/"/g,Yi=/^(?:script|style|textarea|title)$/i,li=r=>(i,...t)=>({ot:r,strings:i,values:t}),m=li(1),D=Symbol.for("lit-noChange"),T=Symbol.for("lit-nothing"),Wi=new WeakMap,Tt=wt.createTreeWalker(wt,129);function Zi(r,i){if(!ai(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return zi!==void 0?zi.createHTML(i):i}var Qi=(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=Hi:d[1]!==void 0?n=Bi:d[2]!==void 0?(Yi.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]==='"'?qi:Gi):n===qi||n===Gi?n=bt:n===Hi||n===Bi?n=Ht:(n=bt,s=void 0);let f=n===bt&&r[a+1].startsWith("/>")?" ":"";o+=n===Ht?l+_s:u>=0?(e.push(c),l.slice(0,u)+oi+l.slice(u)+Q+f):l+Q+(u===-2?a:f);}return [Zi(r,o+(r[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},qt=class r{constructor({strings:i,ot:t},e){let s;this.parts=[];let o=0,n=0,a=i.length-1,l=this.parts,[c,d]=Qi(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(oi)){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(Yi.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===ni)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.xs?.[e]:t.Es,o=Gt(i)?void 0:i.Ue;return s?.constructor!==o&&(s?.Li?.(false),o===void 0?s=void 0:(s=new o(r),s.Ne(r,t,e)),e!==void 0?(t.xs??=[])[e]=s:t.Es=s),s!==void 0&&(i=xt(r,s.Cs(r,i.values),s,e)),i}var ye=class{constructor(i,t){this.Ii=[],this.E=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.S(i,e,t),t+=e.strings.length-2):e.S(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.E=void 0,this.z=i,this.Ct=t,this.n=e,this.options=s,this.$i=s?.isConnected??true;}get parentNode(){let i=this.z.parentNode,t=this.n;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.z}get endNode(){return this.Ct}S(i,t=this){i=xt(this,i,t),Gt(i)?i===T||i==null||i===""?(this.e!==T&&this.St(),this.e=T):i!==this.e&&i!==D&&this.Ui(i):i.ot!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):Xi(i)?this.k(i):this.Ui(i);}O(i){return this.z.parentNode.insertBefore(i,this.Ct)}T(i){this.e!==i&&(this.St(),this.e=this.O(i));}Ui(i){this.e!==T&&Gt(this.e)?this.z.nextSibling.data=i:this.T(wt.createTextNode(i)),this.e=i;}$(i){let{values:t,ot:e}=i,s=typeof e=="number"?this.Ss(i):(e.el===void 0&&(e.el=qt.createElement(Zi(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;}}Ss(i){let t=Wi.get(i.strings);return t===void 0&&Wi.set(i.strings,t=new qt(i)),t}k(i){ai(this.e)||(this.e=[],this.St());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.S(o),s++;s<t.length&&(this.St(e&&e.Ct.nextSibling,s),t.length=s);}St(i=this.z.nextSibling,t){for(this.ee?.(false,true,t);i!==this.Ct;){let e=ji(i).nextSibling;ji(i).remove(),i=e;}}setConnected(i){this.n===void 0&&(this.$i=i,this.ee?.(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.E=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;}S(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;}S(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.E=void 0,this.n=t,this.options=e;}get g(){return this.n.g}S(i){xt(this,i);}},Ds=si.litHtmlPolyfillSupport;Ds?.(qt,Lt),(si.litHtmlVersions??=[]).push("3.3.2");var tr=(r,i,t)=>{let e=t?.renderBefore??i,s=e.ks;if(s===void 0){let o=t?.renderBefore??null;e.ks=s=new Lt(i.insertBefore(Bt(),o),o,void 0,t??{});}return s.S(r),s};var ci=globalThis,at=class extends Z{constructor(){super(...arguments),this.renderOptions={host:this},this._e=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._e=tr(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._e?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._e?.setConnected(false);}render(){return D}};at.an=true,at.finalized=true,ci.litElementHydrateSupport?.({LitElement:at});var Fs=ci.litElementPolyfillSupport;Fs?.({LitElement:at});(ci.litElementVersions??=[]).push("4.2.2");var Ks={attribute:true,type:String,converter:zt,reflect:false,hasChanged:fe},Vs=(r=Ks,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"?Vs(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 er=r=>r.strings===void 0;var lt={ATTRIBUTE:1,CHILD:2},j=r=>(...i)=>({Ue:r,values:i}),G=class{constructor(i){}get g(){return this.n.g}Ne(i,t,e){this.ie=i,this.n=t,this.As=e;}Cs(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var Wt=(r,i)=>{let t=r.E;if(t===void 0)return false;for(let e of t)e.Li?.(i,false),Wt(e,i);return true},xe=r=>{let i,t;do{if((i=r.n)===void 0)break;t=i.E,t.delete(r),r=i;}while(t?.size===0)},ir=r=>{for(let i;i=r.n;r=i){let t=i.E;if(t===void 0)i.E=t=new Set;else if(t.has(r))break;t.add(r),Hs(i);}};function js(r){this.E!==void 0?(xe(this),this.n=r,ir(this)):this.n=r;}function zs(r,i=false,t=0){let e=this.e,s=this.E;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 Hs=r=>{r.type==lt.CHILD&&(r.ee??=zs,r.Os??=js);},Ee=class extends G{constructor(){super(...arguments),this.E=void 0;}Ne(i,t,e){super.Ne(i,t,e),ir(this),this.isConnected=i.g;}Li(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(Wt(this,i),xe(this));}setValue(i){if(er(this.ie))this.ie.S(i,this);else {let t=[...this.ie.e];t[this.As]=i,this.ie.S(t,this,0);}}disconnected(){}reconnected(){}};var E=()=>new di,di=class{},ui=new WeakMap,S=j(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=ui.get(i);t===void 0&&(t=new WeakMap,ui.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"?ui.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 G{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={ot:this.constructor.resultType,strings:t,values:[]}}};Ct.directiveName="unsafeHTML",Ct.resultType=1;var Xt=class extends Ct{};Xt.directiveName="unsafeSVG",Xt.resultType=2;var rr=j(Xt);function Yt(r,i,t){return r?i(r):t?.(r)}var sr;(function(r){r.Token="token",r.FileInfo="file_info";})(sr||(sr={}));var or;(function(r){r.Unknown="unknown",r.Waiting="waiting",r.Progress="progress",r.Error="error",r.Success="success";})(or||(or={}));var Ce=class{re=1;De=[];se=0;Fe=new Map;Ke=new Map;constructor(i){this.re=i;}run(){let i=this.re-this.se;for(let t=0;t<i;t++){let e=this.De.shift();if(!e)return;let s=this.Fe.get(e),o=this.Ke.get(e);if(!s||!o)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.se+=1,e().finally(()=>{this.Fe.delete(e),this.Ke.delete(e),this.se-=1,this.run();}).then(n=>s(n)).catch(n=>o(n));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,s)=>{this.Fe.set(i,e),this.Ke.set(i,s),this.De.push(i),t&&this.run();})}get pending(){return this.De.length}get running(){return this.se}set concurrency(i){this.re=i,this.run();}get concurrency(){return this.re}};var nr=()=>({});var Bs={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function Zt(r,i){i.tabIndex=0,i.focus(),r.tabIndex=-1;}function pi(r){let i=r.role||r.type||r.tagName;if(!i)return null;let t=Bs[i.toLowerCase()];if(!t)return null;for(let e of t){let s=r.closest(`[role=${e}]`);if(s)return s}}function hi(r,i){return i.role==="toolbar"?Gs(i):i.querySelectorAll(`[role=${r.role}]`)}function Gs(r){return [...r.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}function qs(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 ar(r){return i=>{let t=false,e=300,s=0,o="";function n(u){let h=pi(u.target);if(!h){a();return}let f=hi(u.target,h),v=Array.from(f).indexOf(u.target),I="ArrowDown",R="ArrowUp";if(qs(h)&&(i.document.dir==="rtl"?(I="ArrowLeft",R="ArrowRight"):(I="ArrowRight",R="ArrowLeft")),u.key===I)u.preventDefault(),Zt(u.target,f[v+1]||f[0]);else if(u.key===R)u.preventDefault(),Zt(u.target,f[v-1]||f[f.length-1]);else if(u.key==="Home")u.preventDefault(),Zt(u.target,f[0]);else if(u.key==="End")u.preventDefault(),Zt(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(ks=>ks.textContent?.trim()?.toLowerCase()?.startsWith(o));vt&&(u.preventDefault(),Zt(u.target,vt));}}function a(){t=false,i.removeEventListener("keydown",n);}function l(u){let h=pi(u.target);if(h){t||(t=true,i.addEventListener("keydown",n));let f=hi(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=pi(u.target);if(h){let f=hi(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 lr(){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 cr(){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 ur(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 dr(r,i){let t=i.map(e=>e(r));return ()=>{t.forEach(e=>e());}}var fi=class{constructor(){this.Nt=new Map;this.Ve=[];}addEventListener(i,t){let e=s=>{let o=s.target;o instanceof Node&&this.Ve.some(n=>n===o||n.contains(o))&&t(s);};this.Nt.set(t,e),window.addEventListener(i,e);}removeEventListener(i,t){let e=this.Nt.get(t);e&&window.removeEventListener(i,e),this.Nt.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this.Ve.push(i);}destroy(){this.Ve=[];for(let i of this.Nt.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.Nt.clear();}},Se=class{constructor(){this.oe=new fi,this._i=dr(this.oe,[ar(),ur("is-pressed"),cr(),lr()]);}registerBlock(i){this.oe.registerScope(i);}destroy(){this._i?.(),this.oe.destroy();}};var x=r=>`*cfg/${r}`;var St=r=>r?r.split(",").map(i=>i.trim()).filter(Boolean):[],kt=r=>r.join(",");var pr=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},ke=(...r)=>r.filter(i=>typeof i=="string"&&!!i).map(i=>pr(i)).join("/-/"),J=(...r)=>{let i=ke(...r);return i?`-/${i}/`:""};function Oe(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 Ae(r){let i=new URL(r),{pathname:t}=i,e=t.indexOf("/"),s=t.indexOf("/",e+1);return t.substring(e+1,s)}function mi(r){let i=hr(r),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}function yi(r){return mi(r).split("/-/").filter(Boolean).map(t=>pr(t))}function hr(r){let i=new URL(r),t=Oe(r),e=fr(t)?mr(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function fr(r){return r.startsWith("http")}function mr(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(hr(r)),s=Oe(r),o=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),s&&fr(s)){let n=mr(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()},gi=(r,i)=>{let t=new URL(r);return t.pathname=`${i}/`,t.toString()};var Qt=(r,i=",")=>r.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var Jt=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}),gr=["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 Jt[r]!==t?`${r}/${t}`:""}if(typeof i=="boolean"){let t=i;return Jt[r]!==t?`${r}`:""}if(r==="filter"&&i){let{name:t,amount:e}=i;return Jt.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 ke(...gr.filter(i=>typeof r[i]<"u"&&r[i]!==null).map(i=>{let t=r[i];return Ws(i,t)}).filter(i=>!!i))}var Re=ke("format/auto","progressive/yes"),et=([r])=>typeof r<"u"?Number(r):void 0,yr=()=>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:Qt(r,"x").map(Number),coords:Qt(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:yr,flip:yr,rotate:et,crop:r=>{let[i,t]=r,{dimensions:e,coords:s}=Ys([i,t]);return {dimensions:e,coords:s}}});function vi(r){let i={};for(let t of r){let[e,...s]=t.split("/");if(!e||!gr.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 k=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),$=Object.freeze([k.CROP,k.TUNING,k.FILTERS]),vr=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),br=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"]),Tr=Object.freeze(["rotate","mirror","flip"]),it=Jt,z=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 bi="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:bi,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},L=Object.freeze(eo);var Le=(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 W=class{constructor(i){this.ze=new Set;this.ut=null;this.dt=Le(()=>this.at.ctx,this.constructor.name);this.at=i,this.s=i.ctx;}addSub(i){this.ze.add(i);}get Rs(){if(!this.ut){let i={};this.ut=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.at.ctx.has(s)?this.at.ctx.read(s):L[e]}});}return this.ut}destroy(){for(let i of this.ze)try{i();}catch{}this.ze.clear();}},q=(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`)},wr=r=>({get ctx(){return r()},get modalManager(){return q(r(),"*modalManager",false)},get telemetryManager(){return q(r(),"*telemetryManager")},get localeManager(){return q(r(),"*localeManager")},get a11y(){return q(r(),"*a11y")},get blocksRegistry(){return q(r(),"*blocksRegistry")},get eventEmitter(){return q(r(),"*eventEmitter")},get uploadCollection(){return q(r(),"*uploadCollection")},get secureUploadsManager(){return q(r(),"*secureUploadsManager",false)},get api(){return q(r(),"*publicApi")},get validationManager(){return q(r(),"*validationManager")}});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","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 Ti=new Map,xr=new Map,Er=(r,i)=>{Ti.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`);let t={...te,...i};return Ti.set(r,t),t},io=(r,i)=>{xr.set(r,i);},ro=(r,i)=>{typeof i=="function"?io(r,i):Er(r,i);},Cr=async r=>{let i=Ti.get(r);if(!i){let t=xr.get(r);if(!t)throw new Error(`Locale ${r} is not defined`);let e=await t();i=Er(r,e);}return i};ro("en",te);var rt=r=>`*l10n/${r}`,so="en",Me=class extends W{constructor(t){super(t);this.je="";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.je=e;let s=await Cr(e);if(e!==so&&this.je!==e)return;let o=this.Rs.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.je];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"}),Ie=class extends W{constructor(){super(...arguments);this.pt=new Map;this._=new Set;this.W=new Map;}registerModal(t,e){this.pt.set(t,e),this.kt(Mt.ADD,{id:t,modal:e});}deleteModal(t){let e=this.pt.get(t);return e?(this.pt.delete(t),this._.delete(t),this.kt(Mt.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.pt.get(t);return e?(this._.add(t),this.kt(Mt.OPEN,{modal:e,id:t}),true):(this.dt(`Modal with ID "${t}" not found`),false)}close(t){let e=this.pt.get(t);return !e||!this._.has(t)?(this.dt(`Modal with ID "${t}" not found or not active`),false):(this._.delete(t),this.kt(Mt.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.pt.has(t)?this._.has(t)?this.close(t):this.open(t):(this.dt(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this._.size>0}back(){if(this._.size===0)return this.dt("No active modals to go back from"),false;let t=Array.from(this._).pop();return t?this.close(t):false}closeAll(){let t=this._.size;return this._.clear(),this.kt(Mt.CLOSE_ALL,{}),t}subscribe(t,e){return this.W.has(t)||this.W.set(t,new Set),this.W.get(t)?.add(e),()=>this.unsubscribe(t,e)}unsubscribe(t,e){this.W.has(t)&&this.W.get(t)?.delete(e);}kt(t,e){if(this.W.has(t))for(let s of this.W.get(t)??new Set)try{s(e);}catch(o){this.at.telemetryManager.sendEventError(o,"modal subscriber"),this.dt("Error in modal subscriber:",o);}}destroy(){super.destroy(),this.closeAll(),this.pt.clear(),this.W.clear(),this.kt(Mt.DESTROY,{});}};function oo(r){return r.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}function xi(r){return Array.isArray(r)?r.map(i=>typeof i=="object"&&i!==null?xi(i):i):typeof r!="object"||r===null?r:Object.fromEntries(Object.entries(r).map(([i,t])=>{let e=oo(i);return typeof t=="object"&&t!==null?[e,xi(t)]:[e,t]}))}function no(r){return {ok:true,value:r}}function wi(r){return {ok:false,error:r}}var ao="https://tlm.uploadcare.com/api/",Ei=class{constructor(i=ao){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let s=await fetch(e,t);if(!s.ok)return wi(new Error(`Got non-200 response from "${e}". Status: ${s.status.toString()}`));try{let o=await s.json();return no(o)}catch(o){return wi(new Error(`Error parsing JSON from "${e}". Error: ${o}`))}}catch(s){return wi(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(xi(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},lo=async(r,i)=>({success:true,data:i}),co=async r=>lo(void 0,r),Pe=class extends Ei{constructor(){super();}async sendEvent(i,t){let e=await co(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 uo=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"}),$e=class extends W{constructor(){super(...arguments);this._t=new Map;this.ne=new Set;}bindTarget(t){return this.ne.add(t),()=>{this.ne.delete(t);}}Di(t,e){for(let s of this.ne)s.dispatchEvent(new CustomEvent(t,{detail:e}));this.dt?.(()=>{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.Di(t,typeof e=="function"?e():e);return}this._t.has(t)&&window.clearTimeout(this._t.get(t));let n=typeof o=="number"?o:uo,a=window.setTimeout(()=>{try{let l=typeof e=="function"?e():e;this.Di(t,l),this._t.delete(t);}catch(l){this.dt?.(()=>`Error while getting payload for event "${t}"`,l);}},n);this._t.set(t,a);}destroy(){for(let t of this._t.values())window.clearTimeout(t);this.ne.clear();}};var Sr="1.26.2";var It="blocks",Pt=Sr;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 Ue=class extends W{constructor(t){super(t);this.Ms=ut.generateRandomUUID();this.Ot=structuredClone(L);this.He=false;this.Be=null;this.Ge=false;this.Fi=new Pe,this.Ki=new Ce(10),this.addSub(this.s.sub(x("qualityInsights"),e=>{this.Ge=!!e;}));for(let e of Object.keys(this.Ot))this.addSub(this.s.sub(x(e),s=>{this.Ge&&(this.He&&this.Ot[e]!==s&&this.sendEvent({eventType:st.CHANGE_CONFIG}),this.Ls(e,s));}));}Is(t){t===st.INIT_SOLUTION&&!this.He&&(this.He=true);}Ls(t,e){this.Ot[t]!==e&&(this.Ot[t]=e);}Ps(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.Ot),{...s,appVersion:Pt,appName:It,sessionId:this.Ms,component:this.$s,activity:this.Us,projectPubkey:this.Ot.pubkey,userAgent:navigator.userAgent,eventType:s.eventType??"",eventTimestamp:this.Ns,payload:{location:this._s,...e}}}Ds(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.Ge)return;let e=this.Ps({eventType:t.eventType,payload:t.payload,config:t.config});this.Is(t.eventType),!(this.Ds(t.eventType)||this.Be&&this.Vi(this.Be,e))&&this.Ki.add(async()=>{this.Be=e,await this.Fi.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}}});}Vi(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.Vi(t[n],e[n]))return false;return true}get Ns(){return Date.now()}get $s(){if(!this.s.has("*solution"))return null;let t=this.s.read("*solution");return t?t.toLowerCase():null}get Us(){return this.s.has("*currentActivity")?this.s.read("*currentActivity"):null}get _s(){return location.origin}};var H=[],dt=0,Ne=4,kr=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+Ne;o<H.length;)H[o]===e?H.splice(o,Ne):o+=Ne;let s=i.indexOf(e);~s&&(i.splice(s,1),--t.lc||t.off());}},notify(e,s){let o=!H.length;for(let n of i)H.push(n,t.value,e,s);if(o){for(dt=0;dt<H.length;dt+=Ne)H[dt](H[dt+1],H[dt+2],H[dt+3]);H.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 _e(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 Ci(r,i,t){let e=_e(r,i,t);return t(r.value),e}var Si=(r={})=>{let i=kr(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.Dt=new Map;}constructor(i,t){this.zi=i,this.K=t;}get id(){return this.zi}pub(i,t){i in this.K.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.K.setKey(i,t);}sub(i,t,e=true){return (e?Ci:_e)(this.K,[i],o=>{t(o[i]);})}read(i){return i in this.K.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.K.get()[i]}add(i,t,e=false){(!(i in this.K.get())||e)&&this.K.setKey(i,t);}has(i){return i in this.K.get()}get store(){return this.K.get()}static registerCtx(i,t){if(r.Dt.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=Si(i);return r.Dt.set(t,e),new r(t,e)}static deleteCtx(i){r.Dt.delete(i);}static getCtx(i){let t=r.Dt.get(i);return t?new r(i,t):null}static hasCtx(i){return r.Dt.has(i)}};var Or=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 fo=r=>r;var Ar="plural:";function De(r,i={},t={}){let{openToken:e="{{",closeToken:s="}}",transform:o=fo}=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 Rr(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(Ar)){let o=r.substring(t+2,e).replace(Ar,""),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 Lr="--uploadcare-blocks-window-height",ee=class r{static{this.clientsRegistry=new Set;}static{this.flush=U(()=>{document.documentElement.style.setProperty(Lr,`${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(Lr);}};var mo=/\\([0-9a-fA-F]{1,6} ?)/g;function yo(r){return r.length<2?false:(r[0]==='"'||r[0]==="'")&&(r[r.length-1]==='"'||r[r.length-1]==="'")}function go(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 vo(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 Mr(r){let i=r;yo(r)&&(i=go(i),i=i.replace(mo,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=vo(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}function Ir(r){class i extends r{constructor(){super(...arguments);this.ji=null;this.qe=null;}getCssData(s,o=false){let n=this.ji??Object.create(null);if(!Object.keys(n).includes(s)||!n[s]){this.qe||(this.qe=window.getComputedStyle(this));let a=this.qe.getPropertyValue(s).trim();try{n[s]=Mr(a);}catch(l){o||console.warn(`CSS Data error: ${s}`,l),n[s]=null;}}return this.ji=n,n[s]}}return i}function Pr(r){class i extends r{constructor(){super(...arguments);this.willYield=true;this.mt={};this.yt=null;this.ae=false;}createRenderRoot(){return this}connectedCallback(){this.yt||(this.yt=Array.from(this.childNodes)),super.connectedCallback();}Fs(){if(this.ae)return;this.ae=true,this.mt={};let s=Array.from(this.childNodes),o=s.length?s:this.yt??[];for(let n of o){let a=this.Hi(n),l=this.mt[a]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),l.push(n),this.mt[a]=l;}this.yt=null;}Hi(s){return s instanceof Comment&&s.nextSibling instanceof Element?this.Hi(s.nextSibling):"contentFor"in s?s.contentFor||"":s instanceof Element&&s.hasAttribute("content-for")&&s.getAttribute("content-for")||""}Ks(s){return !s.textContent||!s.textContent.trim()}Vs(s){let o=this.mt[s];return !o||o.every(n=>n instanceof Comment||n instanceof Text&&this.Ks(n))}update(s){!this.hasUpdated&&this.willYield&&this.Fs(),super.update(s);}yield(s,o){if(s===""&&!this.mt[s]&&!this.ae&&this.yt?.length){let a=[];for(let l of this.yt)l instanceof Element&&(l.removeAttribute("slot"),l.removeAttribute("content-for")),a.push(l);this.mt[s]=a,this.ae=true,this.yt=null;}let n=this.mt[s];return m` ${n} ${this.Vs(s)?o:void 0} `}}return i}var $r=(r,i)=>new Intl.PluralRules(r).select(i);var bo=r=>(i,t)=>{let e=r(),s=e("locale-id")||"en",o=$r(s,t);return e(`${i}__${o}`)},Ur=r=>{let i=bo(()=>t),t=(e,s={})=>{if(!e)return "";let n=r().read(rt(e))||e,a=Rr(n);for(let c of a)s[c.variable]=i(c.pluralKey,Number(s[c.countVariable]));return De(n,s)};return t};function Nr(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 Fe=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 ki=class extends Event{constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},Ut=class extends Fe{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 ki(this.context,this.host));}};var _r="ctx-name-context";function Dr(){return function(r){class i extends r{constructor(...s){super(...s);this.b=null;this.Ft=false;this.We=false;this.Xe=void 0;this.At=new Map;this.Kt=new Set;this.init$={};this.ctxOwner=false;this.le=void 0;this.ce=false;this.ctxName=this.X;this.Y=false;this.le=this.getAttribute("ctx-name")||void 0,this.ctxName=this.X,this.zs=new $t(this,{context:_r,callback:o=>{if(!o){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.qi=o,this.Gi();},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 Bi(){return this.le}set Bi(s){let o=s??void 0;this.le!==o&&(this.le=o,this.Gi());}shouldUpdate(s){return this.Y?super.shouldUpdate(s):false}get X(){return this.Bi||this.qi||void 0}Gi(){if(this.ctxName=this.X,!(!this.ctxName||this.Ft)){if(this.isConnected){this.Ye();return}this.ce=true;}}willUpdate(s){super.willUpdate(s),this.ctxName=this.X,this.ctxName&&(this.Xe?this.Xe.setValue(this.ctxName):this.Xe=new Ut(this,{context:_r,initialValue:this.ctxName}));}Wi(){if(!(!this.b||this.At.size===0)){for(let[s,{value:o,rewrite:n}]of this.At)this.b.add(s,o,n);this.At.clear();}}Xi(){return !this.b&&this.X&&this.Ze(),this.b&&this.Wi(),this.b}ue(){let s=this.Xi();if(!s)throw new Error("SymbioteMixin: Shared context is not initialized.");return s}Ze(){let s=this.init$,o=this.X;if(!o){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.b){this.b=Ot.getCtx(o)??Ot.registerCtx(s,o);for(let[n,a]of Object.entries(this.init$))this.b.add(n,a,this.ctxOwner);this.Wi();}}get $(){return this.X&&this.Ze(),new Proxy({},{get:(s,o)=>{if(typeof o=="string")return this.b?.read(o)},set:(s,o,n)=>(typeof o!="string"||this.b?.pub(o,n),true)})}sub(s,o,n=true){let a=this.ue().sub(s,o,n);if(!a||typeof a!="function")return ()=>{};let l=a.bind(a),c=false,d=()=>{c||(c=true,l(),this.Kt.delete(d));};return this.Kt.add(d),d}pub(s,o){this.ue().pub(s,o);}set$(s){for(let[o,n]of Object.entries(s))this.pub(o,n);}get sharedCtx(){return this.ue()}has(s){return this.b?.has(s)??false}add(s,o,n=false){let a=this.Xi();if(!a){if(!n&&this.At.has(s))return;this.At.set(s,{value:o,rewrite:n});return}this.At.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.Ft?this.Y&&this.We&&(this.We=false,this.initCallback()):this.ctxName?(this.ce=false,this.Ye()):this.ce&&this.X&&(this.ce=false,this.Ye());}Ye(){if(this.Ft)return;this.Ft=true,this.Ze();let s=this.init$;if(Object.keys(s).length>0){let o=this.ue();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.Y=true,this.requestUpdate();}firstUpdated(s){super.firstUpdated(s);}disconnectedCallback(){this.js(),super.disconnectedCallback(),this.Ft&&(this.We=true);}js(){if(this.Kt.size!==0){for(let s of [...this.Kt])s();this.Kt.clear();}}initCallback(){}}return p([g({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"Bi",1),p([y()],i.prototype,"qi",2),p([y()],i.prototype,"ctxName",2),p([y()],i.prototype,"Y",2),i}}var wo=r=>r.tagName?.includes("-")??false,Ke=class{constructor(i){this.gt=new Set;this.de=new Map;this.Yi=false;this.vt=i,this.vt.addController(this);}hostDisconnected(){this.pe?.(),this.pe=void 0,this.gt.clear(),this.de.clear();}hostUpdated(){if(!this.pe&&this.vt.has(x("testMode"))){let i=this.vt.subConfigValue("testMode",t=>{this.Yi=!!t,this.Zi();});this.pe=i;}this.Hs(),this.Zi();}Hs(){let i=this.vt,t=i.renderRoot??i;if(!t)return;let e=this.vt,s=e.tagName?.toLowerCase(),o=Array.from(t.querySelectorAll("[data-testid]")).filter(n=>!wo(n));for(let n of o)if(!(s&&n.closest(s)!==e)&&!this.gt.has(n)){let a=n.getAttribute("data-testid");if(!a)continue;this.gt.add(n),this.de.set(n,a);}for(let n of Array.from(this.gt))(!n.isConnected||s&&n.closest(s)!==e)&&(this.gt.delete(n),this.de.delete(n));}Zi(){if(!this.gt.size)return;let i=this.vt.testId||"";for(let t of this.gt){let e=this.de.get(t);e&&(this.Yi?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var xo=Nr(Dr()(Ir(Pr(at)))),w=class extends xo{constructor(){super();this.he=new Map;this.activityType=null;this.init$=nr();this.l10n=Ur(()=>this.sharedCtx);this.debugPrint=Le(()=>this.sharedCtx,this.constructor.name);this.at=wr(()=>this.sharedCtx);new Ke(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.Rt("*blocksRegistry",()=>new Set),this.Rt("*eventEmitter",t=>new $e(t)),this.Rt("*localeManager",t=>new Me(t)),this.Rt("*modalManager",t=>new Ie(t)),this.Rt("*a11y",()=>new Se),this.Rt("*telemetryManager",t=>new Ue(t)),this.sub(rt("locale-id"),t=>{let e=Or(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.Mt("*modalManager",false)}get telemetryManager(){return this.Mt("*telemetryManager")}get localeManager(){return this.Mt("*localeManager")}get a11y(){return this.Mt("*a11y")}get blocksRegistry(){return this.Mt("*blocksRegistry")}get eventEmitter(){return this.Mt("*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.Bs(),Ot.deleteCtx(this.ctxName);}Rt(t,e){if(!this.he.has(t)&&(!this.has(t)||!this.$[t])){let s=e(this.at);this.add(t,s,true),this.he.set(t,s);return}}Bs(){for(let[t,e]of this.he.entries())e?.destroy?.(),this.pub(t,null),this.he.delete(t);}Mt(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:Ae(t),cdnUrlModifiers:mi(t),fileName:Oe(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?De(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:e=>window.encodeURIComponent(e)}):t}get cfg(){if(!this.ut){let t={};this.ut=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.ut}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 Fr(...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=Fr(...r);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}function Kr(r,...i){let t=Fr(...i);for(let e of Object.keys(t))r.classList.toggle(e,!!t[e]);}var ie=["free"],Vr=r=>{let i=Qt(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},jr=(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 Eo=r=>$.includes(r),zr=r=>{if(!r)return $;let i=St(r).filter(Eo);return i.length===0?$:i};function Hr(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":k.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 Br="<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.Lt=false;this.Qi=At;this.Ji=At.visible;this.tr=At.hidden;this.Qe=false;this.er=false;}set visible(t){this.Lt=t,this.ir();}get visible(){return this.Lt}set styles(t){this.Qi=t,this.Qe=true,this.Ji=t.visible??At.visible,this.tr=t.hidden??At.hidden;}get styles(){return this.Qi}ir(){this.style.visibility=this.Lt?"inherit":"hidden",Kr(this,{[At.transition]:!this.Qe,[this.Ji]:this.Lt,[this.tr]:!this.Lt}),this.toggleAttribute("inert",!this.Lt);}Gs(){this.er||(this.er=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.Qe||this.classList.add(At.transition),this.ir(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.Gs();},0);}};p([g({type:Boolean})],re.prototype,"visible",1),p([g({attribute:false})],re.prototype,"styles",1);var Ve=class extends w{constructor(){super(...arguments);this.active=false;this.fe=E();this.Je=false;this.ti=()=>{let t=this.fe.value;t&&(this.rr(t),this.Je&&this.active&&this.ei());};}firstUpdated(t){super.firstUpdated(t),this.active&&this.ei();}updated(t){super.updated(t),t.has("active")&&(this.active?this.ei():this.qs());}ei(){let t=this.fe.value;if(!t)return;this.Je=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.ti),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.ti,{once:true});}qs(){let t=this.fe.value;t&&(this.Je=false,t.removeEventListener("transitionend",this.ti),this.rr(t));}rr(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" ${S(this.fe)}></div></div>`}};p([g({type:Boolean,reflect:true})],Ve.prototype,"active",2);var ft=j(class extends G{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.sr=null;}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",t=>{this.sr=t,this.or();});}willUpdate(t){super.willUpdate(t),t.has("name")&&this.or();}or(){if(!this.name){this.ii="";return}let t=`#uc-icon-${this.name}`,e=this.sr?.(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 B=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.nr(),this.ar();}updated(t){super.updated(t),t.has("reverse")&&this.nr(),t.has("theme")&&this.ar();}nr(){this.style.flexDirection=this.reverse?"row-reverse":"";}ar(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get Ws(){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.Xs}}get ri(){return !this.icon}get Xs(){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.Ws)} name=${A(this.icon||void 0)} ?hidden=${this.ri} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};p([g({type:String})],B.prototype,"text",2),p([g({type:String})],B.prototype,"icon",2),p([g({type:Boolean,reflect:true})],B.prototype,"reverse",2),p([g({type:String,reflect:true})],B.prototype,"theme",2),p([g({attribute:"aria-role"})],B.prototype,"ariaRole",2),p([g({attribute:"aria-controls"})],B.prototype,"ariaControls",2),p([g({attribute:"title-prop"})],B.prototype,"titleProp",2),p([g({type:Boolean,noAccessor:true})],B.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 Gr=(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,Oi=24,qr=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 Wr(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 Xr(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 Yr(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 Zr({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 Co({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 So({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 ko({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 Oo({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 Ao({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 Ro({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 Lo({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 Mo({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 Qr({direction:r,...i}){switch(r){case "n":return Co(i);case "w":return So(i);case "s":return ko(i);case "e":return Oo(i);case "nw":return Ao(i);case "ne":return Ro(i);case "sw":return Lo(i);case "se":return Mo(i);default:return i.rect}}function Jr(r,[i,t]){return r.x<=i&&i<=r.x+r.width&&r.y<=t&&t<=r.y+r.height}function ts(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 es(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 is(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(Re,ct(t),`quality/${n}`,`stretch/off/-/resize/${o}x`,`@clib/${It}/${Pt}/uc-cloud-image-editor/`))}var ze=class extends w{constructor(){super(...arguments);this.lr=`uc-backdrop-mask-${ut.generateFastUid()}`;this.ye=false;this.Ht=false;this.dr=E();this.Bt=false;this.Gt=null;this.hr=t=>{this.fr(),this.qt&&(t.stopPropagation(),t.preventDefault(),this.qt=false);};this.mr=t=>{if(!this.qt||!this.me||!this.oi)return;t.stopPropagation(),t.preventDefault();let e=this.Z;if(!e)return;let{x:s,y:o}=e.getBoundingClientRect(),n=t.x-s,a=t.y-o,l=n-this.me[0],c=a-this.me[1],{direction:d}=this.oi,u=this.so(d,[l,c]);u&&(this.$["*cropBox"]=u);};this.yr=t=>{if(!this.q)return;let e=Object.values(this.q).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 Jr(a,[t.x,t.y])});this.cr=e,this.fr();};}get Z(){return this.dr.value??null}get qt(){return this.Ht}set qt(t){this.Ht!==t&&(this.Ht=t,this.ni());}ni(){this.zt&&this.zt.setAttribute("class",F({"uc-guides--hidden":this.ye,"uc-guides--visible":!this.ye&&this.Ht,"uc-guides--semi-hidden":!this.ye&&!this.Ht}));}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}Ys(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:s,width:o,height:n}=t,a=this.Z;if(!a)return;let l=K("mask",{id:this.lr}),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.lr})`});a.appendChild(u),a.appendChild(l),this.Vt=l,this.si=d;}Zs(){this.Vt&&(this.Vt.style.display="none",window.requestAnimationFrame(()=>{this.Vt&&(this.Vt.style.display="block");}));}Qs(){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});}Js(){let t=this.$["*cropBox"];if(!(!t||!this.zt||!this.q)){for(let e of Object.values(this.q)){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?Wr(t,s,I):Xr(t,s,I),P=R.center;if(!P)continue;let vt=Math.max(Oi*yt(Math.min(h,f)/Oi/3,0,1),qr);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.zt,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}pr(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));}eo(){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.pr(t,o);}return this.pr(t,""),t}io(){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}ro(){let t=this.Z;if(!t)return;let e=document.createDocumentFragment(),s=this.io();e.appendChild(s);let o=this.eo();for(let{groupNode:n}of Object.values(o))e.appendChild(n);t.appendChild(e),this.q=o,this.zt=s,this.ni();}to(t,e){if(!this.q)return;let s=this.q[t];if(!s||this.ai(t))return;let o=this.$["*cropBox"],n=this.Z;if(!n)return;let{x:a,y:l}=n.getBoundingClientRect(),c=e.x-a,d=e.y-l;this.qt=true,this.oi=s,this.me=[c,d],this.ur={...o};}so(t,e){let[s,o]=e,n=this.$["*imageBox"],a=this.ur??this.$["*cropBox"],l=this.$["*currentAspectRatio"],c=l?l.width/l.height:void 0;if(t===""?a=Zr({rect:a,delta:[s,o],imageBox:n}):a=Qr({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)}fr(){let t=this.cr,e=this.Z;e&&(e.style.cursor=t?Yr(t.direction):"initial");}gr(t){if(this.jt){this.jt.setAttribute("href",t);return}let e=this.Z;if(!e){this.Gt=t;return}this.Gt=null;let s=document.createDocumentFragment(),o=K("image",{href:t});o.setAttribute("class","uc-cloud-mask"),s.appendChild(o),e.appendChild(s),this.jt=o;}oo(){let t=this.$["*cropBox"];if(!t||!this.jt)return;let{x:e,y:s,width:o,height:n}=t;mt(this.jt,{x:e,y:s,height:n,width:o});}li(){this.Bt&&(this.Qs(),this.Js(),this.oo());}toggleThumbs(t){if(this.q)for(let e of Object.values(this.q)){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.Zs(),this.Bt&&window.requestAnimationFrame(()=>{this.li();});}),this.sub("*cropBox",t=>{t&&(this.ye=t.height<=b||t.width<=b,this.ni(),this.Bt&&window.requestAnimationFrame(()=>{this.li();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.gr(t);}),document.addEventListener("pointermove",this.mr,true),document.addEventListener("pointerup",this.hr,true);}firstUpdated(t){super.firstUpdated(t),this.ao();}ao(){let t=this.Z;if(!(!t||this.Bt)){if(this.Ys(),this.ro(),this.Bt=true,t.addEventListener("pointermove",this.yr,true),this.Gt){let e=this.Gt;this.Gt=null,this.gr(e);}this.li();}}disconnectedCallback(){super.disconnectedCallback(),this.Z?.removeEventListener("pointermove",this.yr,true),document.removeEventListener("pointermove",this.mr,true),document.removeEventListener("pointerup",this.hr,true);}render(){return m`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${S(this.dr)}></svg>`}};p([y()],ze.prototype,"Ht",2);function Po(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 He=class extends w{constructor(){super();this.ctxOwner=true;this.bt={width:0,height:0};this.s=null;this.m=false;this.w=null;this.br=E();this.di=E();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.vr=U(this.Tr.bind(this),300),this.ci=Gr(()=>{!this.isConnected||!this.m||(this.pi(),this.wr(),this.xr(),this.hi(),this.fi());},100);}firstUpdated(t){super.firstUpdated(t),this.pi();}wr(){let t=this.$["*editorTransformations"],e=is(t,Object.keys(this.$["*operations"])),s={...this.$["*operations"],...e};this.$["*operations"]=s;}pi(){let t=this.br.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;}xr(){if(!this.m||!this.w)return;let t=this.w,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.bt,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(!ts(t,e)||u&&!es(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);}lo(){let t=this.s;if(!t)return;let e=this.w;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.w||!this.ui||!this.s)return;let t=this.ui;this.s.clearRect(0,0,t.width,t.height),this.lo();}co({fromViewer:t}){this.w&&(this.di.value?.toggleThumbs(true),this.uo(),setTimeout(()=>{this.className=F({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}Er(){let t=this.$["*cropBox"],e=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,{width:n,height:a}=e,{width:l,height:c}=Dt(this.bt,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)]}po(){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.bt,o),{x:h,y:f}=t,v=n/d,I=a/u,R=this.Er(),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(!Po(P)){console.error("Cropper is trying to create invalid crop object",{payload:P});return}if(!(R[0]===d&&R[1]===u))return P}Tr(){if(!this.isConnected||!this.bt)return;let t=this.$["*operations"],{rotate:e,mirror:s,flip:o}=t,n=this.po(),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.xr(),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.pi(),this.bt=t,this.removeEventListener("transitionend",this.Cr);try{let s=this.$["*originalUrl"],o=this.$["*editorTransformations"];this.w=await this.ho(s,o),this.wr(),this.ci(),this.co({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.w&&this.ci();}),this.c.observe(this);}}deactivate({reset:t=false}={}){this.m&&(!t&&this.Tr(),this.m=false,this.fo(),this.className=F({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.di.value?.toggleThumbs(false),this.addEventListener("transitionend",this.Cr,{once:true}),this.c?.disconnect());}fo(){let t=this.Er(),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`;}uo(){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`;}Cr(){this.m||(this.w=null);}async ho(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.It(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))}It(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.w&&this.vr();}),this.sub("*currentAspectRatio",()=>{this.hi();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this.m&&this.bt&&this.activate(this.bt,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.c?.disconnect(),this.w&&(this.w=null);}render(){return m`<canvas class="uc-canvas" ${S(this.br)}></canvas><uc-crop-frame ${S(this.di)}></uc-crop-frame>`}};p([y()],He.prototype,"w",2);function Ai(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 z}function Uo(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 No(r,i,t){let e=Uo(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 _o(r,i){return r.map((t,e)=>t<i?r.length-e:e)}function rs(r,i){let t=z[r].keypointsNumber,{range:e,zero:s}=z[r];return [...new Set([...Ai(e[0],s,t+1),...Ai(s,e[1],t+1),s,i])].sort((o,n)=>o-n)}var Ri=class extends w{constructor(){super();this.m=false;this.mi=true;this.i="initial";this.Sr={};this.Q=[];this.Or=0;this.Rr=E();this.ge=E();this.classList.add("uc-inactive_to_cropper"),this.Ar=U(async(t,e,s)=>{let o=()=>!this.Mr(t,e)||this.yi!==s||!!this.Q.find(c=>c.value===s);if(o())return;let n=await this.Lr(t,s),a=new Image;a.src=n.src;let l=this.It(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.Q,d=c.findIndex(v=>v.value>s);d===-1&&(d=c.length);let h=c[d]?.image,f=this.ge.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);}It(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);}}Ir(){window.cancelAnimationFrame(this.Or),this.Or=window.requestAnimationFrame(()=>{for(let t of this.Q){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}Tt({url:t=this.kr,filter:e=this.a??void 0,operation:s,value:o}={}){if(!t)throw new Error("URL is not defined");let n={...this.Sr};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 Lr(t,e){return {src:await this.Tt({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.Ar(this.i,this.a,e));}bi(t,e){this.i=t,this.yi=e;let{zero:s}=z[t],o=this.Q.map(l=>l.value),n=No(o,e,s),a=_o(o,s);this.Q.forEach((l,c)=>{let d=n[c],u=a[c];typeof d=="number"&&(l.opacity=d),typeof u=="number"&&(l.zIndex=u);}),this.Ir();}Pr(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async mo(){this.r=this.r||this.Pr();let t=this.r;t&&this.$r(t);let e=this.Q.map(c=>c.src),{images:s,promise:o,cancel:n}=ne(e);s.forEach(c=>{let d=this.It(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.ge.value;if(!c)return;c.replaceChildren(),this.Q.forEach((d,u)=>{let h=s[u];h&&(h.classList.add("uc-fader-image"),d.image=h,c.appendChild(h));}),this.Ir();}}async setTransformations(t){if(this.Sr=t,this.r){let e=await this.Tt(),s=this.It(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=rs(s,o),a=await Promise.all(n.map(c=>this.Tt({url:t,filter:e,operation:s,value:c}))),{cancel:l}=ne(a);this.vi=l;}yo(t){let e=this.r||this.Pr();if(this.$r(e),this.r=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=F({"uc-active_from_viewer":this.Wt,"uc-active_from_cropper":!this.Wt,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let s=this.It(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.Wt,"uc-active_from_cropper":!this.Wt,"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.kr=t,this.i=e??"initial",this.yi=s,this.a=o,this.Wt=n,typeof s!="number"&&!o){let l=await this.Tt({operation:e,value:s});this.yo(l),this.Ti();return}!e||typeof s!="number"||(this.Q=await Promise.all(rs(e,s).map(l=>this.Lr(e,l))),this.bi(e,s),this.mo());}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();}$r(t){let e=this.Rr.value;e&&(e.contains(t)||e.appendChild(t));}Ti(){this.ge.value?.replaceChildren();}render(){return m`<div class="uc-fader-preview-host" ${S(this.Rr)}></div><div class="uc-fader-layers-host" ${S(this.ge)}></div>`}};var ss="important",Do=" !"+ss,le=j(class extends G{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(Do);e.includes("-")||o?t.setProperty(e,o?s.slice(0,-11):s,o?ss:""):t[e]=s;}}return D}});var nt=class extends w{constructor(){super();this.wi=0;this.ve=E();this.Nr=E();this._r=E();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.J=0;this.vo=t=>{t.stopPropagation();let e=this.Dr(t);e!==null&&(this.xi(e),this.go("slider-input",e));};this.bo=t=>{t.stopPropagation();let e=this.Dr(t);e!==null&&this.xi(e);};this.Fr=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.Kr=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}go(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.Vr(this.J),this.Ei(),this.c=new ResizeObserver(()=>{this.Ei(),this.be(this.J);}),this.c.observe(this);let e=this.ve.value;e?.addEventListener("focus",this.Fr),e?.addEventListener("blur",this.Kr),window.setTimeout(()=>{this.be(this.J);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.J&&this.xi(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.Ei(),this.be(this.J)),t.has("zero")&&this.hasUpdated&&this.zr(this.J);}be(t){this.zr(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.Nr.value;l&&(l.style.transform=`translateX(${a}px)`);});}zr(t){if(!this.Xt)return;let e=this.max-this.min;if(e===0)return;this.Xt.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.Xt&&(this.Xt.style.transform=`translateX(${a}px)`);});}Ei(){let e=this._r.value;if(!e)return;let{width:s}=e.getBoundingClientRect(),o=Math.ceil(s/2),n=Math.ceil(o/15)-2;if(this.Ur===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.Xt=d,e.innerHTML="",e.appendChild(a),this.Ur=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.ve.value;t?.removeEventListener("focus",this.Fr),t?.removeEventListener("blur",this.Kr),this.c?.disconnect(),this.c=void 0;}xi(t){Number.isFinite(t)&&(this.J=t,this.hasUpdated&&(this.Vr(t),this.be(t)));}Vr(t){let e=this.ve.value;e&&(e.value=String(t));}Dr(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" ${S(this._r)}></div><div class="uc-thumb" ${S(this.Nr)}></div><input class="uc-input" type="range" ${S(this.ve)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.J)} ?disabled=${this.disabled} @input=${this.vo} @change=${this.bo} />`}};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,"J",2);var Y="original",Be=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.To=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.wo();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});}wo(){let t=this.state.operation,{range:e,zero:s}=z[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.To} ></uc-slider-ui>`}};p([y()],Be.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}}jr(){let t=this.buttonClasses;for(let[e,s]of Object.entries(t))this.classList.toggle(e,s);}onClick(t){}connectedCallback(){super.connectedCallback(),this.jr();}updated(t){super.updated(t),t.has("active")&&this.jr();}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 Ge=12,qe=16,Fo=r=>{let i=12,t=12;return r.width/r.height>=1?(i=Ge,t=Math.round(Ge*r.height/r.width)):(t=Ge,i=Math.round(Ge*r.width/r.height)),{width:i,height:t}},Li=class extends N{initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this.xo(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}xo(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>`}},We=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.Hr(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.v&&this.Hr(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);}Hr(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();}Eo(){let t=this.v;if(!t||t.hasFreeform)return m`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:s}=Fo(t),o=(qe-e)/2,n=(qe-s)/2;return m`<uc-icon><svg viewBox="0 0 ${qe} ${qe}" 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.Eo()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};p([g({attribute:false})],We.prototype,"aspectRatio",1);function Ko(r){let i=r+90;return i=i>=360?0:i,i}function Vo(r,i){if(r==="rotate")return Ko(typeof i=="number"?i:0);if(r==="mirror"||r==="flip")return !i;throw new Error(`Unsupported operation: ${r}`)}var Xe=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=Vo(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})],Xe.prototype,"operation",2);var gt=class extends N{constructor(){super(...arguments);this.i="";this.a="";this.Yt="";this.Te=0;this.r=null;this.$t=false;this.isOriginal=false;this.Br=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.Br=this.isOriginal?40:20,this.requestUpdate("filter",s),this.isConnected&&this.Gr(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;}Co(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.Br||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.Yt,J(Re,ct(l),`quality/${n}`,`scale_crop/${o}x${o}/center`,`@clib/${It}/${Pt}/uc-cloud-image-editor/`))}async So(t,e){t[0]?.isIntersecting?await this.Ci(e):this.f?.();}initCallback(){super.initCallback(),this.c=new window.IntersectionObserver(this.So.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this.Yt=t??"",this.sub("*originalUrl",e=>{this.Yt=e??"",!this.isOriginal&&this.Yt&&this.isConnected&&!this.r&&(this.c?.observe(this),this.wt());}),this.isOriginal||(this.c?.observe(this),this.wt()),this.a&&this.Gr(this.a),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.a);}),this.sub("*networkProblems",async e=>{e||(this.r?await this.Ci():this.wt());});}disconnectedCallback(){super.disconnectedCallback(),this.c?.disconnect(),this.f?.(),this.we();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.c?.unobserve(this):(this.c?.observe(this),this.wt()));}Gr(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.Yt){!this.Pt&&!this.tt&&this.wt();return}let e=++this.Te,s="";try{s=await this.proxyUrl(this.Co());}catch(a){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:a});return}this.$t=false,this.f?.();let{promise:o,cancel:n}=oe(s);this.f=()=>{n(),this.Te===e&&(this.f=void 0);};try{if(await o,this.Te!==e||!this.isConnected)return;this.r=s,this.$t=!0,this.we(),(t??this.c)?.unobserve(this);}catch(a){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:a}),this.wt();}finally{this.Te===e&&(this.f=void 0);}}wt(){if(!this.isConnected||this.r||this.$t||this.isOriginal||this.$["*networkProblems"]){this.we();return}this.tt&&cancelAnimationFrame(this.tt),this.tt=requestAnimationFrame(()=>{if(this.tt=void 0,!this.isConnected||this.r||this.$t||this.isOriginal){this.we();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.Pt=window.setTimeout(()=>{this.Pt=void 0,this.wt();},500);});}we(){this.tt&&(cancelAnimationFrame(this.tt),this.tt=void 0),this.Pt&&(window.clearTimeout(this.Pt),this.Pt=void 0);}get ko(){return !!(this.$t&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.ko?"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.$t} 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,"$t",2),p([y()],gt.prototype,"isOriginal",2),p([y()],gt.prototype,"Br",2),p([g({type:String})],gt.prototype,"filter",1);var Ye=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.qr(e);}qr(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.qr(this.i),this.sub("*editorTransformations",t=>{if(!this.i)return;let{zero:e}=z[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})],Ye.prototype,"operation",1);var jo=1,os=()=>{},Ze=class extends w{constructor(){super(...arguments);this.hiddenScrollbar=false;this.Wr=t=>{t.preventDefault();let{deltaY:e,deltaX:s}=t;if(Math.abs(s)>jo){this.scrollLeft+=s;return}this.scrollLeft+=e;};}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.Wr,{passive:false}),this.addEventListener("scroll",os,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.Wr),this.removeEventListener("scroll",os),super.disconnectedCallback();}};p([g({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],Ze.prototype,"hiddenScrollbar",2);var V=class extends w{constructor(){super(...arguments);this.Zt=false;this.showMainToolbar=true;this.showSubToolbar=false;this.Xr=true;this.tabList=[...$];this.activeTab=k.CROP;this.xe=true;this.Si=false;this.Yr=null;this.Zr=0;this.Qr=0;this.Ee=E();this.Jr=E();this.tabToggleRefs={[k.CROP]:E(),[k.TUNING]:E(),[k.FILTERS]:E()};this.ts=()=>{this.xt();};this.Qt=[];this.Ce=U(t=>{this.Zt=t;},500);this.Se=U(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],s="",o=false;if(this.$["*tabId"]===k.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"]===k.TUNING&&e){o=true;let n=t?.[e]||z[e].zero;s=`${this.l10n(e)} ${n}`;}o&&(this.$["*operationTooltip"]=s),this.Si=o;},0);this.Oo={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.Ao={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.Ro={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.Vo=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.f?.();let e=this.$["*on.cancel"];e?.();};this.zo=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.jo=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:Vt(this.$["*operationTooltip"])}),this.Ee.value?.apply(),this.es();};this.Ho=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.Ee.value?.cancel(),this.es();};this.Bo=t=>{let s=t.currentTarget?.getAttribute("data-id");s&&(this.telemetryManager.sendEventCloudImageEditor(t,s),this.ki(s,{fromViewer:false}));};}es(){this.$["*showSlider"]=false,this.$["*tabId"]===k.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===k.TUNING&&(this.Si=false);}ki(t,{fromViewer:e=false,force:s=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.rs(t,{fromViewer:e,force:s});}rs(t,{fromViewer:e,force:s=false}){if(!s&&this.activeTab===t){this.xt();return}this.activeTab=t;let o=this.$["*faderEl"],n=this.$["*cropperEl"];t===k.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.xt();}}xt(){let e=this.tabToggleRefs[this.activeTab]?.value,s=this.Jr.value;if(!e||!s)return;let o=e.offsetLeft,n=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.Zr!==o||this.Qr!==n)&&(this.Zr=o,this.Qr=n,s.style.transform=`translateX(${o}px)`,s.style.width=`${n}px`);}get Oi(){return this.Qt.length>=3}Lo(t){switch(t){case k.CROP:return this.Io();case k.FILTERS:return this.Po();case k.TUNING:return this.$o();default:return []}}Io(){let t=[];if(this.Oi)t.push(()=>this.Uo());else for(let e of this.Qt)t.push(()=>this.ss(e));for(let e of Tr)t.push(()=>this.No(e));return this.Ai(t)}Po(){let e=[Y,...br].map(s=>()=>this._o(s));return this.Ai(e)}$o(){let t=vr.map(e=>()=>this.Do(e));return this.Ai(t)}Ai(t){return t.length?t.map(s=>s()):[]}Uo(){return m`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}ss(t){return m`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}No(t){return m`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}_o(t){return m`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}Do(t){return m`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}Fo(){return this.Oi?this.Qt.map(t=>this.ss(t)):[]}async Ko(){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.Qt=[...t],this.sub("*cropPresetList",e=>{this.Qt=[...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.Se();}),this.sub("*currentOperation",()=>{this.Se();}),this.sub("*tabId",e=>{this.rs(e,{fromViewer:false,force:true}),this.Se();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.Ko(),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.Ce(s);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.xe=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.xe=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.Xr=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[s]=e;s&&this.ki(s,{fromViewer:false});return}this.xt();}),this.sub("*operationTooltip",e=>{this.Yr=e;}),this.Se();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.ts);}firstUpdated(t){super.firstUpdated(t),this.ke(),this.xt();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.xt()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.ke();}disconnectedCallback(){window.removeEventListener("resize",this.ts),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}ke(){let t=this.Ee.value;t&&(this.$["*sliderEl"]=t);}Go(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.Ro}><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.Bo} ${S(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}qo(t){let e=this.Lo(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.Zt}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.Yr??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.Oo} ><div class="uc-tab-content-row">${$.map(s=>Yt(this.activeTab===s,()=>this.qo(s)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.Xr} .styles=${this.Mo} @initial-render=${()=>this.xt()} ><div class="uc-tab-toggles_indicator" ${S(this.Jr)} ></div>${$.map(s=>this.Go(s))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.Vo} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.zo}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.Ao}><div class="uc-slider" ?hidden=${!this.xe}><uc-editor-slider ${S(this.Ee)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.xe||!e}>${e?m`<div class="uc-list-aspect-ratio">${this.Fo()}</div>`:T}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.Ho} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.jo} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};p([y()],V.prototype,"Zt",2),p([y()],V.prototype,"showMainToolbar",2),p([y()],V.prototype,"showSubToolbar",2),p([y()],V.prototype,"Xr",2),p([y()],V.prototype,"tabList",2),p([y()],V.prototype,"activeTab",2),p([y()],V.prototype,"xe",2),p([y()],V.prototype,"Si",2),p([y()],V.prototype,"Yr",2),p([y()],V.prototype,"Qt",2);var ns=kt([...$]),_=class extends w{constructor(){super(...arguments);this.ctxOwner=true;this.Wo="";this.Tt=ht;this.Xo="";this.Zt=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=ns;this.os=false;this.Y=false;this.Ri=null;this.Ce=U(t=>{this.Zt=t;},300);this.Oe=E();this.ns=E();this.as=E();this.ls=E();this.cs=()=>{this.Ce(false),this.Tt!==ht&&(this.$["*networkProblems"]=false);};this.us=()=>{this.Ce(false),this.$["*networkProblems"]=true;};this.Yo=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...Hr(this)};}static{this.styleAttrs=["uc-cloud-image-editor"];}Zo(){this.Y||this.Ri||(this.Ri=this.updateComplete.then(()=>{this.Ri=null,this.Y=true;}));}initCallback(){super.initCallback(),this.ds(),this.ps();}ke(){let t=this.as.value;t&&(this.$["*faderEl"]=t);let e=this.ns.value;e&&(this.$["*cropperEl"]=e);let s=this.ls.value;s&&(this.$["*imgContainerEl"]=s);let o=this.Oe.value;o&&(this.$["*imgEl"]=o);}Qo(){let t=this.Oe.value;t&&(t.addEventListener("load",this.cs),t.addEventListener("error",this.us));}Jo(){let t=this.Oe.value;t&&(t.removeEventListener("load",this.cs),t.removeEventListener("error",this.us));}get tn(){let t=this.$["*tabId"];return F("uc-image",{"uc-image_hidden_to_cropper":t===k.CROP,"uc-image_hidden_effects":t!==k.CROP})}hs(){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.ke(),this.Qo(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),s=t.has("uuid")||t.has("cdnUrl");e&&!s&&this.updateImage();}disconnectedCallback(){this.Jo(),super.disconnectedCallback();}render(){let t=this.Xo??"",e=this.Wo??"",s=this.Tt||ht,o=this.Zt,n=this.os;return m` ${rr(Br)}<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.Yo}></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" ${S(this.ls)}><img src=${s} class=${this.tn} ${S(this.Oe)} />${Yt(this.Y,()=>m`<uc-editor-image-cropper ${S(this.ns)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${S(this.as)}></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.Y,()=>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.ps();}ds(){let t=this.tabs||ns;this.$["*tabList"]=zr(t);}ps(){let t=Vr(this.cropPreset??""),e=null;if(this.cdnUrl){let s=yi(this.cdnUrl),o=vi(s);if(Array.isArray(o?.crop?.dimensions)){let[n,a]=o.crop.dimensions;e=jr(n,a,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){if(await this.hs(),this.cdnUrl){let t=this.cdnUrl,e=Ae(t),s=gi(t,e);if(s===this.$["*originalUrl"])return;this.$["*originalUrl"]=s;let o=yi(t),n=vi(o);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=gi(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"]===k.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"]===k.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.Zo();}}async initEditor(){try{await this.hs();}catch(t){this.isConnected&&console.error(t.message);return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.os=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,"Wo",2),p([y()],_.prototype,"Tt",2),p([y()],_.prototype,"Xo",2),p([y()],_.prototype,"Zt",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,"os",2),p([y()],_.prototype,"Y",2);var as=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 zo=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function Ho(r){for(let i in r){if(zo.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 Qe=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 ls=new Set;function cs(r){ls.has(r)||(ls.add(r),console.warn(r));}var Bo=[{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."}],us=U(r=>{for(let{test:i,message:t}of Bo)i(r)&&cs(t);},0);var ds=(r,i)=>{let t=new URL(i);return t.hostname=`${r}.${t.hostname}`,t.toString().replace(/\/$/,"")},Go="0123456789abcdefghijklmnopqrstuvwxyz",ps=r=>{if(r<=0n)return "0";let i="";for(;r>0n;){let t=r%36n;i=Go[Number(t)]+i,r=r/36n;}return i},Mi=(r,i)=>{try{let t=new URL(r),e=new URL(i);return t.hostname.endsWith(e.hostname)}catch{return false}};var qo=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}`)},Wo=10,Xo=async r=>{let i=await qo(r);return ps(i).slice(0,Wo)},hs=async(r,i)=>{let t=await Xo(r);return ds(t,i)};var fs=r=>r instanceof Promise||!!(r&&typeof r=="object"&&"then"in r&&typeof r.then=="function");var Ii=r=>r,Yo=[Ii({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)}}),Ii({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)}}),Ii({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:({pubkey:r,cdnCname:i,cdnCnamePrefixed:t})=>r&&(i===bi||Mi(i,t))?hs(r,t):i})],ms=({key:r,setValue:i,getValue:t,computationControllers:e})=>{for(let s of Yo)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}fs(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 Pi=Object.freeze({PHOTO:"photo",VIDEO:"video"});var C=r=>String(r),M=r=>{let i=Number(r);if(Number.isNaN(i))throw new Error(`Invalid number: "${r}"`);return i},O=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}"`)},ys=r=>r==="auto"?r:O(r),gs=r=>{let i=C(r);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},vs=r=>{let i=C(r);if(!Object.values(Pi).includes(i))throw new Error(`Invalid value: "${i}"`);return i},bs=r=>{let i=C(r),t=St(i);if(t.some(e=>!Object.values(Pi).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},Ts=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.")},$i=r=>{if(typeof r=="object")return r;throw new Error("Invalid value. Must be an object.")},Je=r=>{if(typeof r=="function")return r;throw new Error("Invalid value. Must be a function.")},Ui=r=>{if(Array.isArray(r))return r;throw new Error("Must be an array.")},ws=r=>{let i=C(r);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)};var Zo={pubkey:C,multiple:O,multipleMin:M,multipleMax:M,confirmUpload:O,imgOnly:O,accept:C,externalSourcesPreferredTypes:C,externalSourcesEmbedCss:C,store:ys,cameraMirror:O,cameraCapture:gs,sourceList:C,topLevelOrigin:C,maxLocalFileSizeBytes:M,thumbSize:M,showEmptyList:O,useLocalImageEditor:O,useCloudImageEditor:O,cloudImageEditorTabs:C,removeCopyright:O,cropPreset:C,imageShrink:C,modalScrollLock:O,modalBackdropStrokes:O,sourceListWrap:O,remoteTabSessionKey:C,cdnCname:C,cdnCnamePrefixed:C,baseUrl:C,socialBaseUrl:C,secureSignature:C,secureExpire:C,secureDeliveryProxy:C,retryThrottledRequestMaxTimes:M,retryNetworkErrorMaxTimes:M,multipartMinFileSize:M,multipartChunkSize:M,maxConcurrentRequests:M,multipartMaxConcurrentRequests:M,multipartMaxAttempts:M,checkForUrlDuplicates:O,saveUrlForRecurrentUploads:O,groupOutput:O,userAgentIntegration:C,debug:O,localeName:C,metadata:Ts,secureUploadsExpireThreshold:M,localeDefinitionOverride:r=>$i(r),secureUploadsSignatureResolver:r=>Je(r),secureDeliveryProxyUrlResolver:r=>Je(r),iconHrefResolver:r=>Je(r),fileValidators:Ui,collectionValidators:Ui,validationTimeout:M,validationConcurrency:M,cameraModes:bs,defaultCameraMode:vs,enableAudioRecording:O,enableVideoRecording:O,mediaRecorderOptions:$i,maxVideoRecordingDuration:M,filesViewMode:ws,gridShowFileNames:O,cloudImageEditorAutoOpen:O,cloudImageEditorMaskHref:C,testMode:O,qualityInsights:O},xs=(r,i)=>{if(!(typeof i>"u"||i===null))try{return Zo[r](i)}catch(t){return console.error(`Invalid value for config key "${r}".`,t),L[r]}};var ti=[...new Set(["debug",...Object.keys(L)])],Qo=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],Ss=r=>Qo.includes(r),ce=ti.filter(r=>!Ss(r)),Es={...Object.fromEntries(ce.map(r=>[Qe(r),r])),...Object.fromEntries(ce.map(r=>[r.toLowerCase(),r]))},Jo={...Object.fromEntries(ce.map(r=>[Qe(r),x(r)])),...Object.fromEntries(ce.map(r=>[r.toLowerCase(),x(r)]))},Cs=r=>`__${r}`,ei=class extends w{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(L).map(([t,e])=>[x(t),e]))};this.en=new Map;}rn(t,e){if(!Ss(t)){let s=[...new Set([Qe(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());}}sn(t,e){this.$[x(t)]!==e&&(typeof e>"u"||e===null?this.$[x(t)]=L[t]:this.$[x(t)]=e);}Ae(t,e){let s=this,o=xs(t,e),n=Cs(t);s[n]!==o&&(this.nn(t,s[n],o),s[n]=o,this.rn(t,o),this.sn(t,o),this.debugPrint(`"${t}"`,o),us(this.cfg));}fs(t){let e=this,s=Cs(t);return e[s]??this.$[x(t)]}nn(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.Ae(e,s);},false);for(let e of ti){let s=t[e]??this.$[x(e)];s!==L[e]&&this.Ae(e,s);let o=Object.getOwnPropertyDescriptor(this,e);(!o||!o.set||!o.get)&&Object.defineProperty(this,e,{set:n=>{this.Ae(e,n);},get:()=>this.fs(e)});}for(let e of ti)this.sub(x(e),()=>{ms({key:e,setValue:this.Ae.bind(this),getValue:this.fs.bind(this),computationControllers:this.en});});}attributeChangedCallback(t,e,s){if(super.attributeChangedCallback(t,e,s),e===s)return;let o=this,n=Es[t];n&&(o[n]=s),Jo[t]&&(this[t]=s);}static get observedAttributes(){return [...super.observedAttributes,...Object.keys(Es)]}};for(let r of ti)ei.prototype[r]=void 0;/*! For license information please see uc-cloud-image-editor.min.js.LEGAL.txt */
8
- export{B as BtnUi,as as CloudImageEditor,_ as CloudImageEditorBlock,ei as Config,ze as CropFrame,We as EditorAspectRatioButtonControl,Xe as EditorCropButtonControl,gt as EditorFilterControl,Li as EditorFreeformButtonControl,He as EditorImageCropper,Ri as EditorImageFader,Ye as EditorOperationControl,Ze as EditorScroller,Be as EditorSlider,V as EditorToolbar,se as Icon,Ve as LineLoaderUi,re as PresenceToggle,nt as SliderUi,Ho as defineComponents};
7
+ var bo=Object.defineProperty;var Xc=Object.getOwnPropertyDescriptor;var d=(r,i)=>()=>(r&&(i=r(r=0)),i);var Hr=(r,i)=>{for(var t in i)bo(r,t,{get:i[t],enumerable:true});};var m=(r,i,t,e)=>{for(var s=e>1?void 0:e?Xc(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&&bo(i,t,s),s};var To=d(()=>{});var Co=d(()=>{});var ki,Ri,wo,Eo,Ii,xo,So,Gr,qr=d(()=>{ki=globalThis,Ri=ki.ShadowRoot&&(ki.ShadyCSS===void 0||ki.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,wo=Symbol(),Eo=new WeakMap,Ii=class{constructor(i,t,e){if(this.As=true,e!==wo)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(Ri&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=Eo.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&Eo.set(t,i));}return i}toString(){return this.cssText}},xo=r=>new Ii(typeof r=="string"?r:r+"",void 0,wo),So=(r,i)=>{if(Ri)r.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),s=ki.litNonce;s!==void 0&&e.setAttribute("nonce",s),e.textContent=t.cssText,r.appendChild(e);}},Gr=Ri?r=>r:r=>r instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return xo(t)})(r):r;});var Yc,Qc,Zc,Jc,tu,eu,Pi,Oo,iu,ru,je,He,Mi,Ao,kt,Ge=d(()=>{qr();qr();(({is:Yc,defineProperty:Qc,getOwnPropertyDescriptor:Zc,getOwnPropertyNames:Jc,getOwnPropertySymbols:tu,getPrototypeOf:eu}=Object)),Pi=globalThis,Oo=Pi.trustedTypes,iu=Oo?Oo.emptyScript:"",ru=Pi.reactiveElementPolyfillSupport,je=(r,i)=>r,He={toAttribute(r,i){switch(i){case Boolean:r=r?iu: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}},Mi=(r,i)=>!Yc(r,i),Ao={attribute:true,type:String,converter:He,reflect:false,useDefault:false,hasChanged:Mi};Symbol.metadata??=Symbol("metadata"),Pi.litPropertyMetadata??=new WeakMap;kt=class extends HTMLElement{static addInitializer(i){this.ui(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.xe&&[...this.xe.keys()]}static createProperty(i,t=Ao){if(t.state&&(t.attribute=false),this.ui(),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&&Qc(this.prototype,i,s);}}static getPropertyDescriptor(i,t,e){let{get:s,set:o}=Zc(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)??Ao}static ui(){if(this.hasOwnProperty(je("elementProperties")))return;let i=eu(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(je("finalized")))return;if(this.finalized=true,this.ui(),this.hasOwnProperty(je("properties"))){let t=this.properties,e=[...Jc(t),...tu(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.xe=new Map;for(let[t,e]of this.elementProperties){let s=this.di(t,e);s!==void 0&&this.xe.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(Gr(s));}else i!==void 0&&t.push(Gr(i));return t}static di(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.Se=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._t=null,this.ks();}ks(){this.pi=new Promise(i=>this.enableUpdating=i),this.Ct=new Map,this.Is(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this.Zt??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.Zt?.delete(i);}Is(){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.Se=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return So(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.Zt?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this.Zt?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.hi(i,e);}Rs(i,t){let e=this.constructor.elementProperties.get(i),s=this.constructor.di(i,e);if(s!==void 0&&e.reflect===true){let o=(e.converter?.toAttribute!==void 0?e.converter:He).toAttribute(t,e.type);this._t=i,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._t=null;}}hi(i,t){let e=this.constructor,s=e.xe.get(i);if(s!==void 0&&this._t!==s){let o=e.getPropertyOptions(s),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:He;this._t=s;let a=n.fromAttribute(t,o.type);this[s]=a??this.fi?.get(s)??a,this._t=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??Mi)(o,t)||e.useDefault&&e.reflect&&o===this.fi?.get(i)&&!this.hasAttribute(n.di(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.pi=this.Ps());}C(i,t,{useDefault:e,reflect:s,wrapped:o},n){e&&!(this.fi??=new Map).has(i)&&(this.fi.set(i,n??t??this[i]),o!==true||n!==void 0)||(this.Ct.has(i)||(this.hasUpdated||e||(t=void 0),this.Ct.set(i,t)),s===true&&this._t!==i&&(this.Cr??=new Set).add(i));}async Ps(){this.isUpdatePending=true;try{await this.pi;}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.Se){for(let[s,o]of this.Se)this[s]=o;this.Se=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.Ct.has(s)||a===void 0||this.C(s,void 0,o,a);}}let i=false,t=this.Ct;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.Zt?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.mi();}catch(e){throw i=false,this.mi(),e}i&&this.Ms(t);}willUpdate(i){}Ms(i){this.Zt?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}mi(){this.Ct=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.pi}shouldUpdate(i){return true}update(i){this.Cr&&=this.Cr.forEach(t=>this.Rs(t,this[t])),this.mi();}updated(i){}firstUpdated(i){}};kt.elementStyles=[],kt.shadowRootOptions={mode:"open"},kt[je("elementProperties")]=new Map,kt[je("finalized")]=new Map,ru?.({ReactiveElement:kt}),(Pi.reactiveElementVersions??=[]).push("2.1.2");});function Fo(r,i){if(!Zr(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Io!==void 0?Io.createHTML(i):i}function de(r,i,t=r,e){if(i===et)return i;let s=e!==void 0?t.Us?.[e]:t.Ls,o=Xe(i)?void 0:i.gi;return s?.constructor!==o&&(s?.Er?.(false),o===void 0?s=void 0:(s=new o(r),s.yi(r,t,e)),e!==void 0?(t.Us??=[])[e]=s:t.Ls=s),s!==void 0&&(i=de(r,s.Ds(r,i.values),s,e)),i}var Xr,ko,Ui,Io,Yr,It,Qr,su,ue,We,Xe,Zr,$o,Wr,qe,Ro,Po,le,Mo,Uo,Do,Jr,T,et,k,Lo,ce,_o,Ye,Li,Ee,pe,$i,Di,Fi,_i,No,ou,Vo,yt=d(()=>{Xr=globalThis,ko=r=>r,Ui=Xr.trustedTypes,Io=Ui?Ui.createPolicy("lit-html",{createHTML:r=>r}):void 0,Yr="$lit$",It=`lit$${Math.random().toFixed(9).slice(2)}$`,Qr="?"+It,su=`<${Qr}>`,ue=document,We=()=>ue.createComment(""),Xe=r=>r===null||typeof r!="object"&&typeof r!="function",Zr=Array.isArray,$o=r=>Zr(r)||typeof r?.[Symbol.iterator]=="function",Wr=`[ \f\r]`,qe=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ro=/-->/g,Po=/>/g,le=RegExp(`>|${Wr}(?:([^\\s"'>=/]+)(${Wr}*=${Wr}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),Mo=/'/g,Uo=/"/g,Do=/^(?:script|style|textarea|title)$/i,Jr=r=>(i,...t)=>({Et:r,strings:i,values:t}),T=Jr(1),Jr(2),Jr(3),et=Symbol.for("lit-noChange"),k=Symbol.for("lit-nothing"),Lo=new WeakMap,ce=ue.createTreeWalker(ue,129);_o=(r,i)=>{let t=r.length-1,e=[],s,o=i===2?"<svg>":i===3?"<math>":"",n=qe;for(let a=0;a<t;a++){let l=r[a],c,p,u=-1,h=0;for(;h<l.length&&(n.lastIndex=h,p=n.exec(l),p!==null);)h=n.lastIndex,n===qe?p[1]==="!--"?n=Ro:p[1]!==void 0?n=Po:p[2]!==void 0?(Do.test(p[2])&&(s=RegExp("</"+p[2],"g")),n=le):p[3]!==void 0&&(n=le):n===le?p[0]===">"?(n=s??qe,u=-1):p[1]===void 0?u=-2:(u=n.lastIndex-p[2].length,c=p[1],n=p[3]===void 0?le:p[3]==='"'?Uo:Mo):n===Uo||n===Mo?n=le:n===Ro||n===Po?n=qe:(n=le,s=void 0);let f=n===le&&r[a+1].startsWith("/>")?" ":"";o+=n===qe?l+su:u>=0?(e.push(c),l.slice(0,u)+Yr+l.slice(u)+It+f):l+It+(u===-2?a:f);}return [Fo(r,o+(r[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},Ye=class r{constructor({strings:i,Et:t},e){let s;this.parts=[];let o=0,n=0,a=i.length-1,l=this.parts,[c,p]=_o(i,t);if(this.el=r.createElement(c,e),ce.currentNode=this.el.content,t===2||t===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes);}for(;(s=ce.nextNode())!==null&&l.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(let u of s.getAttributeNames())if(u.endsWith(Yr)){let h=p[n++],f=s.getAttribute(u).split(It),g=/([.?@])?(.*)/.exec(h);l.push({type:1,index:o,name:g[2],strings:f,ctor:g[1]==="."?$i:g[1]==="?"?Di:g[1]==="@"?Fi:pe}),s.removeAttribute(u);}else u.startsWith(It)&&(l.push({type:6,index:o}),s.removeAttribute(u));if(Do.test(s.tagName)){let u=s.textContent.split(It),h=u.length-1;if(h>0){s.textContent=Ui?Ui.emptyScript:"";for(let f=0;f<h;f++)s.append(u[f],We()),ce.nextNode(),l.push({type:2,index:++o});s.append(u[h],We());}}}else if(s.nodeType===8)if(s.data===Qr)l.push({type:2,index:o});else {let u=-1;for(;(u=s.data.indexOf(It,u+1))!==-1;)l.push({type:7,index:o}),u+=It.length-1;}o++;}}static createElement(i,t){let e=ue.createElement("template");return e.innerHTML=i,e}};Li=class{constructor(i,t){this.wr=[],this.Y=void 0,this.xr=i,this.a=t;}get parentNode(){return this.a.parentNode}get E(){return this.a.E}u(i){let{el:{content:t},parts:e}=this.xr,s=(i?.creationScope??ue).importNode(t,true);ce.currentNode=s;let o=ce.nextNode(),n=0,a=0,l=e[0];for(;l!==void 0;){if(n===l.index){let c;l.type===2?c=new Ee(o,o.nextSibling,this,i):l.type===1?c=new l.ctor(o,l.name,l.strings,this,i):l.type===6&&(c=new _i(o,this,i)),this.wr.push(c),l=e[++a];}n!==l?.index&&(o=ce.nextNode(),n++);}return ce.currentNode=ue,s}p(i){let t=0;for(let e of this.wr)e!==void 0&&(e.strings!==void 0?(e.Q(i,e,t),t+=e.strings.length-2):e.Q(i[t])),t++;}},Ee=class r{get E(){return this.a?.E??this.Sr}constructor(i,t,e,s){this.type=2,this.r=k,this.Y=void 0,this.ot=i,this.$t=t,this.a=e,this.options=s,this.Sr=s?.isConnected??true;}get parentNode(){let i=this.ot.parentNode,t=this.a;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.ot}get endNode(){return this.$t}Q(i,t=this){i=de(this,i,t),Xe(i)?i===k||i==null||i===""?(this.r!==k&&this.Nt(),this.r=k):i!==this.r&&i!==et&&this.Or(i):i.Et!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):$o(i)?this.k(i):this.Or(i);}O(i){return this.ot.parentNode.insertBefore(i,this.$t)}T(i){this.r!==i&&(this.Nt(),this.r=this.O(i));}Or(i){this.r!==k&&Xe(this.r)?this.ot.nextSibling.data=i:this.T(ue.createTextNode(i)),this.r=i;}$(i){let{values:t,Et:e}=i,s=typeof e=="number"?this.Fs(i):(e.el===void 0&&(e.el=Ye.createElement(Fo(e.h,e.h[0]),this.options)),e);if(this.r?.xr===s)this.r.p(t);else {let o=new Li(s,this),n=o.u(this.options);o.p(t),this.T(n),this.r=o;}}Fs(i){let t=Lo.get(i.strings);return t===void 0&&Lo.set(i.strings,t=new Ye(i)),t}k(i){Zr(this.r)||(this.r=[],this.Nt());let t=this.r,e,s=0;for(let o of i)s===t.length?t.push(e=new r(this.O(We()),this.O(We()),this,this.options)):e=t[s],e.Q(o),s++;s<t.length&&(this.Nt(e&&e.$t.nextSibling,s),t.length=s);}Nt(i=this.ot.nextSibling,t){for(this.Oe?.(false,true,t);i!==this.$t;){let e=ko(i).nextSibling;ko(i).remove(),i=e;}}setConnected(i){this.a===void 0&&(this.Sr=i,this.Oe?.(i));}},pe=class{get tagName(){return this.element.tagName}get E(){return this.a.E}constructor(i,t,e,s,o){this.type=1,this.r=k,this.Y=void 0,this.element=i,this.name=t,this.a=s,this.options=o,e.length>2||e[0]!==""||e[1]!==""?(this.r=Array(e.length-1).fill(new String),this.strings=e):this.r=k;}Q(i,t=this,e,s){let o=this.strings,n=false;if(o===void 0)i=de(this,i,t,0),n=!Xe(i)||i!==this.r&&i!==et,n&&(this.r=i);else {let a=i,l,c;for(i=o[0],l=0;l<o.length-1;l++)c=de(this,a[e+l],t,l),c===et&&(c=this.r[l]),n||=!Xe(c)||c!==this.r[l],c===k?i=k:i!==k&&(i+=(c??"")+o[l+1]),this.r[l]=c;}n&&!s&&this.j(i);}j(i){i===k?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},$i=class extends pe{constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===k?void 0:i;}},Di=class extends pe{constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==k);}},Fi=class extends pe{constructor(i,t,e,s,o){super(i,t,e,s,o),this.type=5;}Q(i,t=this){if((i=de(this,i,t,0)??k)===et)return;let e=this.r,s=i===k&&e!==k||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,o=i!==k&&(e===k||s);s&&this.element.removeEventListener(this.name,this,e),o&&this.element.addEventListener(this.name,this,i),this.r=i;}handleEvent(i){typeof this.r=="function"?this.r.call(this.options?.host??this.element,i):this.r.handleEvent(i);}},_i=class{constructor(i,t,e){this.element=i,this.type=6,this.Y=void 0,this.a=t,this.options=e;}get E(){return this.a.E}Q(i){de(this,i);}},No={M:Yr,P:It,A:Qr,C:1,L:_o,R:Li,D:$o,V:de,I:Ee,H:pe,N:Di,U:Fi,B:$i,F:_i},ou=Xr.litHtmlPolyfillSupport;ou?.(Ye,Ee),(Xr.litHtmlVersions??=[]).push("3.3.2");Vo=(r,i,t)=>{let e=t?.renderBefore??i,s=e._s;if(s===void 0){let o=t?.renderBefore??null;e._s=s=new Ee(i.insertBefore(We(),o),o,void 0,t??{});}return s.Q(r),s};});var ts,Kt,nu,Ko=d(()=>{Ge();Ge();yt();yt();ts=globalThis,Kt=class extends kt{constructor(){super(...arguments),this.renderOptions={host:this},this.vi=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.vi=Vo(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.vi?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.vi?.setConnected(false);}render(){return et}};Kt.Va=true,Kt.finalized=true,ts.litElementHydrateSupport?.({LitElement:Kt});nu=ts.litElementPolyfillSupport;nu?.({LitElement:Kt});(ts.litElementVersions??=[]).push("4.2.2");});var zo=d(()=>{});var z=d(()=>{Ge();yt();Ko();zo();});var Bo=d(()=>{});function w(r){return (i,t)=>typeof t=="object"?lu(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)}var au,lu,es=d(()=>{Ge();au={attribute:true,type:String,converter:He,reflect:false,hasChanged:Mi},lu=(r=au,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 C(r){return w({...r,state:true,attribute:false})}var jo=d(()=>{es();});var Ho=d(()=>{});var we=d(()=>{});var Go=d(()=>{we();});var qo=d(()=>{we();});var Wo=d(()=>{we();});var Xo=d(()=>{we();});var Yo=d(()=>{we();});var N=d(()=>{Bo();es();jo();Ho();Go();qo();Wo();Xo();Yo();});var Rh,Qo,Zo=d(()=>{yt();(({I:Rh}=No)),Qo=r=>r.strings===void 0;});var zt,ct,vt,Bt=d(()=>{zt={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},ct=r=>(...i)=>({gi:r,values:i}),vt=class{constructor(i){}get E(){return this.a.E}yi(i,t,e){this.Ae=i,this.a=t,this.Ns=e;}Ds(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};});function cu(r){this.Y!==void 0?(Vi(this),this.a=r,Jo(this)):this.a=r;}function uu(r,i=false,t=0){let e=this.r,s=this.Y;if(s!==void 0&&s.size!==0)if(i)if(Array.isArray(e))for(let o=t;o<e.length;o++)Qe(e[o],false),Vi(e[o]);else e!=null&&(Qe(e,false),Vi(e));else Qe(this,r);}var Qe,Vi,Jo,du,Ki,tn=d(()=>{Zo();Bt();Bt();Qe=(r,i)=>{let t=r.Y;if(t===void 0)return false;for(let e of t)e.Er?.(i,false),Qe(e,i);return true},Vi=r=>{let i,t;do{if((i=r.a)===void 0)break;t=i.Y,t.delete(r),r=i;}while(t?.size===0)},Jo=r=>{for(let i;i=r.a;r=i){let t=i.Y;if(t===void 0)i.Y=t=new Set;else if(t.has(r))break;t.add(r),du(i);}};du=r=>{r.type==zt.CHILD&&(r.Oe??=uu,r.$s??=cu);},Ki=class extends vt{constructor(){super(...arguments),this.Y=void 0;}yi(i,t,e){super.yi(i,t,e),Jo(this),this.isConnected=i.E;}Er(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(Qe(this,i),Vi(this));}setValue(i){if(Qo(this.Ae))this.Ae.Q(i,this);else {let t=[...this.Ae.r];t[this.Ns]=i,this.Ae.Q(t,this,0);}}disconnected(){}reconnected(){}};});var P,rs,is,U,en=d(()=>{yt();tn();Bt();P=()=>new rs,rs=class{},is=new WeakMap,U=ct(class extends Ki{render(r){return k}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)),k}rt(r){if(this.isConnected||(r=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=is.get(i);t===void 0&&(t=new WeakMap,is.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"?is.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 jt=d(()=>{en();});var he,rn=d(()=>{yt();Bt();he=class extends vt{constructor(i){if(super(i),this.it=k,i.type!==zt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===k||i==null)return this.Ar=void 0,this.it=i;if(i===et)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.Ar;this.it=i;let t=[i];return t.raw=t,this.Ar={Et:this.constructor.resultType,strings:t,values:[]}}};he.directiveName="unsafeHTML",he.resultType=1;ct(he);});var Ze,zi,sn=d(()=>{Bt();rn();Ze=class extends he{};Ze.directiveName="unsafeSVG",Ze.resultType=2;zi=ct(Ze);});var ss=d(()=>{sn();});function Je(r,i,t){return r?i(r):t?.(r)}var on=d(()=>{});var os=d(()=>{on();});function nn(r){return Object.prototype.toString.call(r)==="[object Object]"}function hu(r){return r.split(pu).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}function an(r,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(r)?r.map(t=>Pt(t,{ignoreKeys:i})):r}function Pt(r,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(r))return an(r,{ignoreKeys:i});if(!nn(r))return r;let t={};for(let e of Object.keys(r)){let s=r[e];if(i.includes(e)){t[e]=s;continue}nn(s)?s=Pt(s,{ignoreKeys:i}):Array.isArray(s)&&(s=an(s,{ignoreKeys:i})),t[hu(e)]=s;}return t}function ps({libraryName:r,libraryVersion:i,userAgent:t,publicKey:e="",integration:s=""}){let o="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:r,libraryVersion:i,languageName:o,integration:s});let n=[r,i,e].filter(Boolean).join("/"),a=[o,s].filter(Boolean).join("; ");return `${n} (${a})`}function gu(r,i=mu){let t=0;function e(s){let o=Math.round(i.time*i.factor**t);return s({attempt:t,retry:a=>fu(a??o).then(()=>(t+=1,e(s)))})}return e(r)}function vu(r,...i){return r}function pn(r,i,t){if(Array.isArray(t))for(let e of t)pn(r,`${i}[]`,e);else if(xu(t)){let{name:e,contentType:s}=t,o=Tu(t.data,e,s??ji),n=bu({name:e,contentType:s});r.push([i,o,...n]);}else if(wu(t))for(let[e,s]of Object.entries(t))typeof s<"u"&&r.push([`${i}[${e}]`,String(s)]);else Eu(t)&&t&&r.push([i,t.toString()]);}function Su(r){let i=[];for(let[t,e]of Object.entries(r))pn(i,t,e);return i}function Wi(r){let i=Cu(),t=Su(r);for(let e of t){let[s,o,...n]=e;i.append(s,o,...n);}return i}function me(r){return ps({libraryName:ku,libraryVersion:Iu,...r})}function Mu(r){let{headers:i}=r||{};if(!i||typeof i["retry-after"]!="string")return ln;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:ln}function qt(r,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return gu(({attempt:s,retry:o})=>r().catch(n=>{if("response"in n&&n?.code===Ru&&s<t)return o(Mu(n));if(n instanceof xe&&s<e)return o((s+1)*Pu);throw n}))}function hs(r){return typeof r>"u"||r==="auto"?"auto":r?"1":"0"}function Uu(r,{publicKey:i,fileName:t,contentType:e,baseURL:s=A.baseURL,secureSignature:o,secureExpire:n,store:a,signal:l,onProgress:c,source:p="local",integration:u,userAgent:h,retryThrottledRequestMaxTimes:f=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=A.retryNetworkErrorMaxTimes,metadata:b}){return qt(()=>Gt({method:"POST",url:Rt(s,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":me({publicKey:i,integration:u,userAgent:h})},data:Wi({file:{data:r,name:t||fn(r),contentType:e||hn(r)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:hs(a),signature:o,expire:n,source:p,metadata:b}),signal:l,onProgress:c}).then(({data:y,headers:E,request:v})=>{let S=Pt(JSON.parse(y));if("error"in S)throw new q(S.error.content,S.error.errorCode,v,S,E);return S}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:f})}function Lu(r,{publicKey:i,baseURL:t=A.baseURL,store:e,fileName:s,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,source:c="url",signal:p,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=A.retryNetworkErrorMaxTimes,metadata:b}){return qt(()=>Gt({method:"POST",headers:{"X-UC-User-Agent":me({publicKey:i,integration:u,userAgent:h})},url:Rt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:r,store:hs(e),filename:s,check_URL_duplicates:o?1:void 0,save_URL_duplicates:n?1:void 0,signature:a,expire:l,source:c,metadata:b}),signal:p}).then(({data:y,headers:E,request:v})=>{let S=Pt(JSON.parse(y));if("error"in S)throw new q(S.error.content,S.error.errorCode,v,S,E);return S}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:f})}function Du(r,{publicKey:i,baseURL:t=A.baseURL,signal:e,integration:s,userAgent:o,retryThrottledRequestMaxTimes:n=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=A.retryNetworkErrorMaxTimes}={}){return qt(()=>Gt({method:"GET",headers:i?{"X-UC-User-Agent":me({publicKey:i,integration:s,userAgent:o})}:void 0,url:Rt(t,"/from_url/status/",{jsonerrors:1,token:r}),signal:e}).then(({data:l,headers:c,request:p})=>{let u=Pt(JSON.parse(l));if("error"in u&&!$u(u))throw new q(u.error.content,u.error.errorCode,p,u,c);return u}),{retryNetworkErrorMaxTimes:a,retryThrottledRequestMaxTimes:n})}function Fu(r,{publicKey:i,baseURL:t=A.baseURL,jsonpCallback:e,secureSignature:s,secureExpire:o,signal:n,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:p=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:u=A.retryNetworkErrorMaxTimes}){return qt(()=>Gt({method:"POST",headers:{"X-UC-User-Agent":me({publicKey:i,integration:l,userAgent:c})},url:Rt(t,"/group/",{jsonerrors:1}),data:Wi({files:r,callback:e,pub_key:i,signature:s,expire:o,source:a}),signal:n}).then(({data:h,headers:f,request:g})=>{let b=Pt(JSON.parse(h));if("error"in b)throw new q(b.error.content,b.error.errorCode,g,b,f);return b}),{retryNetworkErrorMaxTimes:u,retryThrottledRequestMaxTimes:p})}function mn(r,{publicKey:i,baseURL:t=A.baseURL,signal:e,source:s,integration:o,userAgent:n,retryThrottledRequestMaxTimes:a=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=A.retryNetworkErrorMaxTimes}){return qt(()=>Gt({method:"GET",headers:{"X-UC-User-Agent":me({publicKey:i,integration:o,userAgent:n})},url:Rt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:r,source:s}),signal:e}).then(({data:c,headers:p,request:u})=>{let h=Pt(JSON.parse(c));if("error"in h)throw new q(h.error.content,h.error.errorCode,u,h,p);return h}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})}function _u(r,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:s=A.multipartChunkSize,baseURL:o="",secureSignature:n,secureExpire:a,store:l,signal:c,source:p="local",integration:u,userAgent:h,retryThrottledRequestMaxTimes:f=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=A.retryNetworkErrorMaxTimes,metadata:b}){return qt(()=>Gt({method:"POST",url:Rt(o,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":me({publicKey:i,integration:u,userAgent:h})},data:Wi({filename:e||un,size:r,content_type:t||ji,part_size:s,UPLOADCARE_STORE:hs(l),UPLOADCARE_PUB_KEY:i,signature:n,expire:a,source:p,metadata:b}),signal:c}).then(({data:y,headers:E,request:v})=>{let S=Pt(JSON.parse(y));if("error"in S)throw new q(S.error.content,S.error.errorCode,v,S,E);return S.parts=Object.keys(S.parts).map(at=>S.parts[Number(at)]),S}),{retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g})}function Nu(r,i,{contentType:t,signal:e,onProgress:s,retryThrottledRequestMaxTimes:o=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=A.retryNetworkErrorMaxTimes}){return qt(()=>Gt({method:"PUT",url:i,data:r,onProgress:s,signal:e,headers:{"Content-Type":t||ji}}).then(a=>(s&&s({isComputable:true,value:1}),a)).then(({status:a})=>({code:a})),{retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n})}function Vu(r,{publicKey:i,baseURL:t=A.baseURL,source:e="local",signal:s,integration:o,userAgent:n,retryThrottledRequestMaxTimes:a=A.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=A.retryNetworkErrorMaxTimes}){return qt(()=>Gt({method:"POST",url:Rt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":me({publicKey:i,integration:o,userAgent:n})},data:Wi({uuid:r,UPLOADCARE_PUB_KEY:i,source:e}),signal:s}).then(({data:c,headers:p,request:u})=>{let h=Pt(JSON.parse(c));if("error"in h)throw new q(h.error.content,h.error.errorCode,u,h,p);return h}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})}function fs(r,{publicKey:i,baseURL:t,source:e,integration:s,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a,signal:l,onProgress:c}){return cn({check:p=>mn(r,{publicKey:i,baseURL:t,signal:p,source:e,integration:s,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a}).then(u=>u.isReady?u:(c&&c({isComputable:true,value:1}),false)),signal:l})}function Ku(r){return "defaultEffects"in r}function Wu({token:r,publicKey:i,baseURL:t,integration:e,userAgent:s,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n,onProgress:a,signal:l}){return cn({check:c=>Du(r,{publicKey:i,baseURL:t,integration:e,userAgent:s,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n,signal:c}).then(p=>{switch(p.status){case Q.Error:return new q(p.error,p.errorCode);case Q.Waiting:return false;case Q.Unknown:return new q(`Token "${r}" was not found.`);case Q.Progress:return a&&(p.total==="unknown"?a({isComputable:false}):a({isComputable:true,value:p.done/p.total})),false;case Q.Success:return a&&a({isComputable:true,value:p.done/p.total}),p;default:throw new Error("Unknown status")}}),signal:l})}async function sd(r,{publicKey:i,fileName:t,baseURL:e=A.baseURL,secureSignature:s,secureExpire:o,store:n,signal:a,onProgress:l,source:c,integration:p,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,contentType:g,multipartMinFileSize:b,multipartChunkSize:y,maxConcurrentRequests:E,baseCDN:v=A.baseCDN,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:at,pusherKey:Ot,metadata:ae}){if(Oe(r)){let K=await gn(r);return Zu(K,b)?rd(r,{publicKey:i,contentType:g,multipartChunkSize:y,fileSize:K,fileName:t,baseURL:e,secureSignature:s,secureExpire:o,store:n,signal:a,onProgress:l,source:c,integration:p,userAgent:u,maxConcurrentRequests:E,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,baseCDN:v,metadata:ae}):zu(r,{publicKey:i,fileName:t,contentType:g,baseURL:e,secureSignature:s,secureExpire:o,store:n,signal:a,onProgress:l,source:c,integration:p,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,baseCDN:v,metadata:ae})}if(gs(r))return Yu(r,{publicKey:i,fileName:t,baseURL:e,baseCDN:v,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:at,secureSignature:s,secureExpire:o,store:n,signal:a,onProgress:l,source:c,integration:p,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,pusherKey:Ot,metadata:ae});if(yn(r))return Bu(r,{publicKey:i,fileName:t,baseURL:e,signal:a,onProgress:l,source:c,integration:p,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,baseCDN:v});throw new TypeError(`File uploading from "${r}" is not supported`)}function vn(r,{publicKey:i,fileName:t,baseURL:e=A.baseURL,secureSignature:s,secureExpire:o,store:n,signal:a,onProgress:l,source:c,integration:p,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,contentType:g,multipartChunkSize:b=A.multipartChunkSize,baseCDN:y=A.baseCDN,checkForUrlDuplicates:E,saveUrlForRecurrentUploads:v,jsonpCallback:S}){if(!nd(r)&&!ld(r)&&!ad(r))throw new TypeError(`Group uploading from "${r}" is not supported`);let at,Ot=true,ae=r.length,K=(Y,lt)=>{if(!l)return;at||(at=Array(Y).fill(0));let gt=At=>At.reduce((jr,Wc)=>jr+Wc)/Y;return At=>{if(!At.isComputable||!Ot){Ot=false,l({isComputable:false});return}at[lt]=At.value,l({isComputable:true,value:gt(at)});}};return Promise.all(r.map((Y,lt)=>Oe(Y)||gs(Y)?sd(Y,{publicKey:i,fileName:t,baseURL:e,secureSignature:s,secureExpire:o,store:n,signal:a,onProgress:K(ae,lt),source:c,integration:p,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f,contentType:g,multipartChunkSize:b,baseCDN:y,checkForUrlDuplicates:E,saveUrlForRecurrentUploads:v}).then(gt=>gt.uuid):Y)).then(Y=>Fu(Y,{publicKey:i,baseURL:e,jsonpCallback:S,secureSignature:s,secureExpire:o,signal:a,source:c,integration:p,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:f}).then(lt=>new ds(lt,{baseCDN:y})).then(lt=>(l&&l({isComputable:true,value:1}),lt)))}var pu,fu,mu,ti,xe,Bi,Se,yu,cn,A,ji,un,Gt,bu,Tu,Cu,dn,Hi,Gi,qi,Oe,Eu,wu,xu,q,Ou,Rt,Au,ku,Iu,Ru,ln,Pu,hn,fn,ls,Q,$u,fe,zu,Bu,ju,Hu,cs,Gu,us,ns,ms,qu,Xu,Yu,as,Qu,gn,Zu,yn,gs,Ju,td,ed,id,rd,od,ds,nd,ad,ld,Ht,ge=d(()=>{pu=/\W|_/g;fu=r=>new Promise(i=>setTimeout(i,r));mu={factor:2,time:100};ti=class extends Error{},xe=class r extends ti{originalProgressEvent;constructor(i){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,r.prototype),this.originalProgressEvent=i;}},Bi=(r,i)=>{r&&(r.aborted?Promise.resolve().then(i):r.addEventListener("abort",()=>i(),{once:true}));},Se=class r extends ti{isCancel=true;constructor(i="Request canceled"){super(i),this.name="CancelError",Object.setPrototypeOf(this,r.prototype);}},yu=500,cn=({check:r,interval:i=yu,timeout:t,signal:e})=>new Promise((s,o)=>{let n,a;Bi(e,()=>{n&&clearTimeout(n),o(new Se("Poll cancelled"));}),t&&(a=setTimeout(()=>{n&&clearTimeout(n),o(new Se("Timed out"));},t));let l=()=>{try{Promise.resolve(r(e)).then(c=>{c?(a&&clearTimeout(a),s(c)):n=setTimeout(l,i);}).catch(c=>{a&&clearTimeout(a),o(c);});}catch(c){a&&clearTimeout(a),o(c);}};n=setTimeout(l,0);}),A={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",maxContentLength:50*1024*1024,retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,multipartMinLastPartSize:1024*1024,maxConcurrentRequests:4,pollingTimeoutMilliseconds:1e4,pusherKey:"79ae88bd931ea68464d9"},ji="application/octet-stream",un="original",Gt=({method:r,url:i,data:t,headers:e={},signal:s,onProgress:o})=>new Promise((n,a)=>{let l=new XMLHttpRequest,c=r?.toUpperCase()||"GET",p=false;l.open(c,i,true),e&&Object.entries(e).forEach(u=>{let[h,f]=u;typeof f<"u"&&!Array.isArray(f)&&l.setRequestHeader(h,f);}),l.responseType="text",Bi(s,()=>{p=true,l.abort(),a(new Se);}),l.onload=()=>{if(l.status!=200)a(new Error(`Error ${l.status}: ${l.statusText}`));else {let u={method:c,url:i,data:t,headers:e||void 0,signal:s,onProgress:o},h=l.getAllResponseHeaders().trim().split(/[\r\n]+/),f={};h.forEach(function(y){let E=y.split(": "),v=E.shift(),S=E.join(": ");v&&typeof v<"u"&&(f[v]=S);});let g=l.response,b=l.status;n({request:u,data:g,headers:f,status:b});}},l.onerror=u=>{p||a(new xe(u));},o&&typeof o=="function"&&(l.upload.onprogress=u=>{u.lengthComputable?o({isComputable:true,value:u.loaded/u.total}):o({isComputable:false});}),t?l.send(t):l.send();});bu=({name:r})=>r?[r]:[],Tu=vu,Cu=()=>new FormData,dn=r=>false,Hi=r=>typeof Blob<"u"&&r instanceof Blob,Gi=r=>typeof File<"u"&&r instanceof File,qi=r=>!!r&&typeof r=="object"&&!Array.isArray(r)&&"uri"in r&&typeof r.uri=="string",Oe=r=>Hi(r)||Gi(r)||dn()||qi(r),Eu=r=>typeof r=="string"||typeof r=="number"||typeof r>"u",wu=r=>!!r&&typeof r=="object"&&!Array.isArray(r),xu=r=>!!r&&typeof r=="object"&&"data"in r&&Oe(r.data);q=class r extends ti{code;request;response;headers;constructor(i,t,e,s,o){super(),this.name="UploadError",this.message=i,this.code=t,this.request=e,this.response=s,this.headers=o,Object.setPrototypeOf(this,r.prototype);}},Ou=r=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(r))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(s=>s[1]??false).forEach(s=>i.set(`${t}[${s[0]}]`,String(s[1]))):Array.isArray(e)?e.forEach(s=>{i.append(`${t}[]`,s);}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},Rt=(r,i,t)=>{let e=new URL(r);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=Ou(t)),e.toString()},Au="6.18.4",ku="UploadcareUploadClient",Iu=Au;Ru="RequestThrottledError",ln=15e3,Pu=1e3;hn=r=>{let i="";return (Hi(r)||Gi(r)||qi(r))&&(i=r.type),i||ji},fn=r=>{let i="";return Gi(r)&&r.name?i=r.name:Hi(r)||dn()?i="":qi(r)&&r.name&&(i=r.name),i||un};(function(r){r.Token="token",r.FileInfo="file_info";})(ls||(ls={}));(function(r){r.Unknown="unknown",r.Waiting="waiting",r.Progress="progress",r.Error="error",r.Success="success";})(Q||(Q={}));$u=r=>"status"in r&&r.status===Q.Error;fe=class{uuid;name;size;isStored;isImage;mimeType;cdnUrl;s3Url;originalFilename;imageInfo;videoInfo;contentInfo;metadata;s3Bucket;defaultEffects=null;constructor(i,{baseCDN:t=A.baseCDN,fileName:e}={}){let{uuid:s,s3Bucket:o}=i,n=Rt(t,`${s}/`),a=o?Rt(`https://${o}.s3.amazonaws.com/`,`${s}/${i.filename}`):null;this.uuid=s,this.name=e||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=n,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=o||null,this.s3Url=a,Ku(i)&&(this.defaultEffects=i.defaultEffects);}},zu=(r,{publicKey:i,fileName:t,baseURL:e,secureSignature:s,secureExpire:o,store:n,contentType:a,signal:l,onProgress:c,source:p,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,baseCDN:b,metadata:y})=>Uu(r,{publicKey:i,fileName:t,contentType:a,baseURL:e,secureSignature:s,secureExpire:o,store:n,signal:l,onProgress:c,source:p,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,metadata:y}).then(({file:E})=>fs(E,{publicKey:i,baseURL:e,source:p,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,onProgress:c,signal:l})).then(E=>new fe(E,{baseCDN:b})),Bu=(r,{publicKey:i,fileName:t,baseURL:e,signal:s,onProgress:o,source:n,integration:a,userAgent:l,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:p,baseCDN:u})=>mn(r,{publicKey:i,baseURL:e,signal:s,source:n,integration:a,userAgent:l,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:p}).then(h=>new fe(h,{baseCDN:u,fileName:t})).then(h=>(o&&o({isComputable:true,value:1}),h)),ju=(r,{signal:i}={})=>{let t=null,e=null,s=r.map(()=>new AbortController),o=n=>()=>{e=n,s.forEach((a,l)=>l!==n&&a.abort());};return Bi(i,()=>{s.forEach(n=>n.abort());}),Promise.all(r.map((n,a)=>{let l=o(a);return Promise.resolve().then(()=>n({stopRace:l,signal:s[a].signal})).then(c=>(l(),c)).catch(c=>(t=c,null))})).then(n=>{if(e===null)throw t;return n[e]})},Hu=window.WebSocket,cs=class{events=Object.create({});emit(i,t){this.events[i]?.forEach(e=>e(t));}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t);}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[];}},Gu=(r,i)=>r==="success"?{status:Q.Success,...i}:r==="progress"?{status:Q.Progress,...i}:{status:Q.Error,...i},us=class{key;disconnectTime;ws=void 0;queue=[];isConnected=false;subscribers=0;emmitter=new cs;disconnectTimeoutId=null;constructor(i,t=3e4){this.key=i,this.disconnectTime=t;}connect(){if(this.disconnectTimeoutId&&clearTimeout(this.disconnectTimeoutId),!this.isConnected&&!this.ws){let i=`wss://ws.pusherapp.com/app/${this.key}?protocol=5&client=js&version=1.12.2`;this.ws=new Hu(i),this.ws.addEventListener("error",t=>{this.emmitter.emit("error",new Error(t.message));}),this.emmitter.on("connected",()=>{this.isConnected=true,this.queue.forEach(t=>this.send(t.event,t.data)),this.queue=[];}),this.ws.addEventListener("message",t=>{let e=JSON.parse(t.data.toString());switch(e.event){case "pusher:connection_established":{this.emmitter.emit("connected",void 0);break}case "pusher:ping":{this.send("pusher:pong",{});break}case "progress":case "success":case "fail":this.emmitter.emit(e.channel,Gu(e.event,JSON.parse(e.data)));}});}}disconnect(){let i=()=>{this.ws?.close(),this.ws=void 0,this.isConnected=false;};this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i();},this.disconnectTime):i();}send(i,t){let e=JSON.stringify({event:i,data:t});this.ws?.send(e);}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,s={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(s.event,s.data):this.queue.push(s);}unsubscribe(i){this.subscribers-=1;let t=`task-status-${i}`,e={event:"pusher:unsubscribe",data:{channel:t}};this.emmitter.off(t),this.isConnected?this.send(e.event,e.data):this.queue=this.queue.filter(s=>s.data.channel!==t),this.subscribers===0&&this.disconnect();}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},ns=null,ms=r=>{if(!ns){let i=typeof window>"u"?0:3e4;ns=new us(r,i);}return ns},qu=r=>{ms(r).connect();};Xu=({token:r,pusherKey:i,signal:t,onProgress:e})=>new Promise((s,o)=>{let n=ms(i),a=n.onError(o),l=()=>{a(),n.unsubscribe(r);};Bi(t,()=>{l(),o(new Se("pusher cancelled"));}),n.subscribe(r,c=>{switch(c.status){case Q.Progress:{e&&(c.total==="unknown"?e({isComputable:false}):e({isComputable:true,value:c.done/c.total}));break}case Q.Success:{l(),e&&e({isComputable:true,value:c.done/c.total}),s(c);break}case Q.Error:l(),o(new q(c.msg,c.error_code));}});}),Yu=(r,{publicKey:i,fileName:t,baseURL:e,baseCDN:s,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,store:c,signal:p,onProgress:u,source:h,integration:f,userAgent:g,retryThrottledRequestMaxTimes:b,pusherKey:y=A.pusherKey,metadata:E})=>Promise.resolve(qu(y)).then(()=>Lu(r,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,store:c,signal:p,source:h,integration:f,userAgent:g,retryThrottledRequestMaxTimes:b,metadata:E})).catch(v=>(ms(y)?.disconnect(),Promise.reject(v))).then(v=>v.type===ls.FileInfo?v:ju([({signal:S})=>Wu({token:v.token,publicKey:i,baseURL:e,integration:f,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:u,signal:S}),({signal:S})=>Xu({token:v.token,pusherKey:y,signal:S,onProgress:u})],{signal:p})).then(v=>{if(v instanceof q)throw v;return v}).then(v=>fs(v.uuid,{publicKey:i,baseURL:e,integration:f,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:u,signal:p})).then(v=>new fe(v,{baseCDN:s})),as=new WeakMap,Qu=async r=>{if(as.has(r))return as.get(r);let i=await fetch(r.uri).then(t=>t.blob());return as.set(r,i),i},gn=async r=>{if(Gi(r)||Hi(r))return r.size;if(qi(r))return (await Qu(r)).size;throw new Error("Unknown file type. Cannot determine file size.")},Zu=(r,i=A.multipartMinFileSize)=>r>=i,yn=r=>{let i="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",t=new RegExp(i);return !Oe(r)&&t.test(r)},gs=r=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return !Oe(r)&&t.test(r)},Ju=(r,i)=>new Promise((t,e)=>{let s=[],o=false,n=i.length,a=[...i],l=()=>{let c=i.length-a.length,p=a.shift();p&&p().then(u=>{o||(s[c]=u,n-=1,n?l():t(s));}).catch(u=>{o=true,e(u);});};for(let c=0;c<r;c++)l();}),td=(r,i,t,e)=>{let s=e*i,o=Math.min(s+e,t);return r.slice(s,o)},ed=async(r,i,t)=>e=>td(r,e,i,t),id=(r,i,{publicKey:t,contentType:e,onProgress:s,signal:o,integration:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})=>Nu(r,i,{contentType:e,onProgress:s,signal:o,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l}),rd=async(r,{publicKey:i,fileName:t,fileSize:e,baseURL:s,secureSignature:o,secureExpire:n,store:a,signal:l,onProgress:c,source:p,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,contentType:b,multipartChunkSize:y=A.multipartChunkSize,maxConcurrentRequests:E=A.maxConcurrentRequests,baseCDN:v,metadata:S})=>{let at=e??await gn(r),Ot,ae=(K,Y)=>{if(!c)return;Ot||(Ot=Array(K).fill(0));let lt=gt=>gt.reduce((At,jr)=>At+jr,0);return gt=>{gt.isComputable&&(Ot[Y]=gt.value,c({isComputable:true,value:lt(Ot)/K}));}};return b||=hn(r),_u(at,{publicKey:i,contentType:b,fileName:t||fn(r),baseURL:s,secureSignature:o,secureExpire:n,store:a,signal:l,source:p,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,metadata:S,multipartChunkSize:y}).then(async({uuid:K,parts:Y})=>{let lt=await ed(r,at,y);return Promise.all([K,Ju(E,Y.map((gt,At)=>()=>id(lt(At),gt,{publicKey:i,contentType:b,onProgress:ae(Y.length,At),signal:l,integration:u,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g})))])}).then(([K])=>Vu(K,{publicKey:i,baseURL:s,source:p,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g})).then(K=>K.isReady?K:fs(K.uuid,{publicKey:i,baseURL:s,source:p,integration:u,userAgent:h,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:g,onProgress:c,signal:l})).then(K=>new fe(K,{baseCDN:v}))};od=(r,i)=>{try{let t=new URL(r),e=new URL(i);return t.protocol=e.protocol,t.hostname=e.hostname,t.port=e.port,t.toString()}catch{return r}},ds=class{uuid;filesCount;totalSize;isStored;isImage;cdnUrl;files;createdAt;storedAt=null;constructor(i,{baseCDN:t=A.baseCDN}={}){this.uuid=i.id,this.filesCount=i.filesCount;let e=i.files.filter(Boolean);this.totalSize=Object.values(e).reduce((s,o)=>s+o.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(e).filter(s=>s.isImage).length,this.cdnUrl=od(i.cdnUrl,t),this.files=e.map(s=>new fe(s,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored;}},nd=r=>{for(let i of r)if(!Oe(i))return false;return true},ad=r=>{for(let i of r)if(!yn(i))return false;return true},ld=r=>{for(let i of r)if(!gs(i))return false;return true};Ht=class{ke=1;bi=[];Ie=0;Ti=new Map;Ci=new Map;constructor(i){this.ke=i;}run(){let i=this.ke-this.Ie;for(let t=0;t<i;t++){let e=this.bi.shift();if(!e)return;let s=this.Ti.get(e),o=this.Ci.get(e);if(!s||!o)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.Ie+=1,e().finally(()=>{this.Ti.delete(e),this.Ci.delete(e),this.Ie-=1,this.run();}).then(n=>s(n)).catch(n=>o(n));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,s)=>{this.Ti.set(i,e),this.Ci.set(i,s),this.bi.push(i),t&&this.run();})}get pending(){return this.bi.length}get running(){return this.Ie}set concurrency(i){this.ke=i,this.run();}get concurrency(){return this.ke}};});var ys,vs,bn,Xi=d(()=>{ge();ys=()=>({}),vs=r=>({...ys(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{r.modalManager?.close(r.$["*currentActivity"]),r.pub("*currentActivity",null);}}),bn=r=>({...vs(r),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new Ht(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set});});var Tn=d(()=>{});function ei(r,i){i.tabIndex=0,i.focus(),r.tabIndex=-1;}function bs(r){let i=r.role||r.type||r.tagName;if(!i)return null;let t=cd[i.toLowerCase()];if(!t)return null;for(let e of t){let s=r.closest(`[role=${e}]`);if(s)return s}}function Ts(r,i){return i.role==="toolbar"?ud(i):i.querySelectorAll(`[role=${r.role}]`)}function ud(r){return [...r.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}function dd(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 Cn(r){return i=>{let t=false,e=300,s=0,o="";function n(u){let h=bs(u.target);if(!h){a();return}let f=Ts(u.target,h),g=Array.from(f).indexOf(u.target),b="ArrowDown",y="ArrowUp";if(dd(h)&&(i.document.dir==="rtl"?(b="ArrowLeft",y="ArrowRight"):(b="ArrowRight",y="ArrowLeft")),u.key===b)u.preventDefault(),ei(u.target,f[g+1]||f[0]);else if(u.key===y)u.preventDefault(),ei(u.target,f[g-1]||f[f.length-1]);else if(u.key==="Home")u.preventDefault(),ei(u.target,f[0]);else if(u.key==="End")u.preventDefault(),ei(u.target,f[f.length-1]);else if(u.key.length===1&&h.role!=="tablist"){let E=Date.now();E-s<=e?o+=u.key.toLowerCase():o=u.key.toLowerCase(),s=E;let v=Array.from(f).find(S=>S.textContent?.trim()?.toLowerCase()?.startsWith(o));v&&(u.preventDefault(),ei(u.target,v));}}function a(){t=false,i.removeEventListener("keydown",n);}function l(u){let h=bs(u.target);if(h){t||(t=true,i.addEventListener("keydown",n));let f=Ts(u.target,h);for(let g of f)g!==u.target&&g.setAttribute("tabindex",-1);}else t&&a();}function c(u){(!u.relatedTarget||u.relatedTarget===i.document)&&a();}function p(u){let h=bs(u.target);if(h){let f=Ts(u.target,h);for(let g of f)g!==u.target&&g.setAttribute("tabindex",-1);u.target.setAttribute("tabindex",0);}}return i.addEventListener("click",p),i.addEventListener("focusin",l),i.addEventListener("focusout",c),()=>{a(),i.removeEventListener("click",p),i.removeEventListener("focusin",l),i.removeEventListener("focusout",c);}}}var cd,En=d(()=>{cd={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};});function wn(){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);}}}var xn=d(()=>{});var Sn=d(()=>{});function On(){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 p=r.document.getElementById(c);if(p){let u=p.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');u&&(clearInterval(o),p.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);}}}var An=d(()=>{});var kn=d(()=>{});function In(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);})}var Rn=d(()=>{});function Pn(r,i){let t=i.map(e=>e(r));return ()=>{t.forEach(e=>e());}}var Mn=d(()=>{Tn();En();xn();Sn();An();kn();Rn();});var Cs,Yi,Un=d(()=>{Mn();Cs=class{constructor(){this.Jt=new Map;this.Ei=[];}addEventListener(i,t){let e=s=>{let o=s.target;o instanceof Node&&this.Ei.some(n=>n===o||n.contains(o))&&t(s);};this.Jt.set(t,e),window.addEventListener(i,e);}removeEventListener(i,t){let e=this.Jt.get(t);e&&window.removeEventListener(i,e),this.Jt.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this.Ei.push(i);}destroy(){this.Ei=[];for(let i of this.Jt.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.Jt.clear();}},Yi=class{constructor(){this.Re=new Cs,this.kr=Pn(this.Re,[Cn(),In("is-pressed"),On(),wn()]);}registerBlock(i){this.Re.registerScope(i);}destroy(){this.kr?.(),this.Re.destroy();}};});var O,bt=d(()=>{O=r=>`*cfg/${r}`;});var Tt,Mt,Wt=d(()=>{Tt=r=>r?r.split(",").map(i=>i.trim()).filter(Boolean):[],Mt=r=>r.join(",");});function Zi(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 Ji(r){let i=new URL(r),{pathname:t}=i,e=t.indexOf("/"),s=t.indexOf("/",e+1);return t.substring(e+1,s)}function Es(r){let i=$n(r),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}function ws(r){return Es(r).split("/-/").filter(Boolean).map(t=>Ln(t))}function $n(r){let i=new URL(r),t=Zi(r),e=Dn(t)?Fn(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function Dn(r){return r.startsWith("http")}function Fn(r){let i=new URL(r);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}var Ln,Qi,ut,dt,xs,Xt=d(()=>{Ln=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},Qi=(...r)=>r.filter(i=>typeof i=="string"&&!!i).map(i=>Ln(i)).join("/-/"),ut=(...r)=>{let i=Qi(...r);return i?`-/${i}/`:""};dt=(r,i,t)=>{let e=new URL($n(r)),s=t??Zi(r),o=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),s&&Dn(s)){let n=Fn(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()},xs=(r,i)=>{let t=new URL(r);return t.pathname=`${i}/`,t.toString()};});var Ut,ii=d(()=>{Ut=(r,i=",")=>r.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);});function pd(r,i){if(typeof i=="number"){let t=i;return ri[r]!==t?`${r}/${t}`:""}if(typeof i=="boolean"){let t=i;return ri[r]!==t?`${r}`:""}if(r==="filter"&&i){let{name:t,amount:e}=i;return ri.filter===e?"":`${r}/${t}/${e}`}if(r==="crop"&&i){let{dimensions:t,coords:e}=i;return `${r}/${t.join("x")}/${e.join(",")}`}return ""}function Yt(r){return Qi(...Nn.filter(i=>typeof r[i]<"u"&&r[i]!==null).map(i=>{let t=r[i];return pd(i,t)}).filter(i=>!!i))}function Ss(r){let i={};for(let t of r){let[e,...s]=t.split("/");if(!e||!Nn.includes(e))continue;let o=e,n=md[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 ri,Nn,tr,Lt,_n,hd,fd,md,Ae=d(()=>{Xt();ii();ri=Object.freeze({brightness:0,exposure:0,gamma:100,contrast:0,saturation:0,vibrance:0,warmth:0,enhance:0,filter:0,rotate:0,mirror:false,flip:false,crop:void 0}),Nn=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];tr=Qi("format/auto","progressive/yes"),Lt=([r])=>typeof r<"u"?Number(r):void 0,_n=()=>true,hd=([r,i])=>({name:r,amount:typeof i<"u"?Number(i):100}),fd=([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:Ut(r,"x").map(Number),coords:Ut(i).map(Number)}},md=Object.freeze({enhance:Lt,brightness:Lt,exposure:Lt,gamma:Lt,contrast:Lt,saturation:Lt,vibrance:Lt,warmth:Lt,filter:hd,mirror:_n,flip:_n,rotate:Lt,crop:r=>{let[i,t]=r,{dimensions:e,coords:s}=fd([i,t]);return {dimensions:e,coords:s}}});});var L,W,Vn,Kn,zn,$t,pt,Dt=d(()=>{Ae();L=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),W=Object.freeze([L.CROP,L.TUNING,L.FILTERS]),Vn=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),Kn=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"]),zn=Object.freeze(["rotate","mirror","flip"]),$t=ri,pt=Object.freeze({brightness:{zero:$t.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:$t.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:$t.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:$t.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:$t.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:$t.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:$t.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:$t.enhance,range:[0,100],keypointsNumber:1},filter:{zero:$t.filter,range:[0,100],keypointsNumber:1}});});var si,gd,yd,vd,bd,B,Qt=d(()=>{Wt();Dt();si="https://ucarecdn.com",gd="https://upload.uploadcare.com",yd="https://social.uploadcare.com",vd="https://ucarecd.net",bd={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:"",maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:false,useLocalImageEditor:false,removeCopyright:false,cropPreset:"",imageShrink:"",modalScrollLock:true,modalBackdropStrokes:false,sourceListWrap:true,remoteTabSessionKey:"",cdnCname:si,cdnCnamePrefixed:vd,baseUrl:gd,socialBaseUrl:yd,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,useCloudImageEditor:true,cloudImageEditorAutoOpen:false,cloudImageEditorTabs:Mt(W),cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true,plugins:[]},B=Object.freeze(bd);});var er,Os=d(()=>{bt();er=(r,i)=>(...t)=>{let e=r();if(!e.read(O("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 V,Td,ht,Bn,Ct=d(()=>{bt();Qt();Os();V=class{constructor(i){this.wi=new Set;this.wt=null;this.m=er(()=>this.i.ctx,this.constructor.name);this.i=i,this.e=i.ctx;}addSub(i){this.wi.add(i);}get Vt(){if(!this.wt){let i={};this.wt=new Proxy(i,{set:()=>{throw new Error("SharedInstance cfg proxy is read-only")},get:(t,e)=>{if(typeof e!="string")return;let s=O(e);return this.i.ctx.has(s)?this.i.ctx.read(s):B[e]}});}return this.wt}destroy(){for(let i of this.wi)try{i();}catch{}this.wi.clear();}},Td={modalManager:"*modalManager",pluginManager:"*pluginManager",telemetryManager:"*telemetryManager",localeManager:"*localeManager",a11y:"*a11y",blocksRegistry:"*blocksRegistry",eventEmitter:"*eventEmitter",uploadCollection:"*uploadCollection",secureUploadsManager:"*secureUploadsManager",api:"*publicApi",validationManager:"*validationManager"},ht=(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`)},Bn=r=>({get ctx(){return r()},get modalManager(){return ht(r(),"*modalManager",false)},get pluginManager(){return ht(r(),"*pluginManager")},get telemetryManager(){return ht(r(),"*telemetryManager")},get localeManager(){return ht(r(),"*localeManager")},get a11y(){return ht(r(),"*a11y")},get blocksRegistry(){return ht(r(),"*blocksRegistry")},get eventEmitter(){return ht(r(),"*eventEmitter")},get uploadCollection(){return ht(r(),"*uploadCollection")},get secureUploadsManager(){return ht(r(),"*secureUploadsManager",false)},get api(){return ht(r(),"*publicApi")},get validationManager(){return ht(r(),"*validationManager")},when(i,t){let e=Td[i],s=r(),o=s.has(e)?s.read(e):void 0;if(o)return t(o),()=>{};let n=s.sub(e,a=>{a&&(t(a),n());});return n}});});var oi,As=d(()=>{oi={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{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 ks,jn,Hn,Cd,Ed,Gn,qn=d(()=>{As();ks=new Map,jn=new Map,Hn=(r,i)=>{ks.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`);let t={...oi,...i};return ks.set(r,t),t},Cd=(r,i)=>{jn.set(r,i);},Ed=(r,i)=>{typeof i=="function"?Cd(r,i):Hn(r,i);},Gn=async r=>{let i=ks.get(r);if(!i){let t=jn.get(r);if(!t)throw new Error(`Locale ${r} is not defined`);let e=await t();i=Hn(r,e);}return i};Ed("en",oi);});var Ft,wd,ir,Is=d(()=>{Ct();As();qn();bt();Ft=r=>`*l10n/${r}`,wd="en",ir=class extends V{constructor(t){super(t);this.Kt="";for(let[s,o]of Object.entries(oi)){let n=this.e.has(Ft(s))?!this.e.read(Ft(s)):true;this.e.add(Ft(s),o,n);}let e=t.pluginManager;e?.onPluginsChange&&this.addSub(e.onPluginsChange(()=>{this.Kt&&this.Ir(this.Kt);})),this.addSub(this.e.sub(O("localeName"),async s=>{if(!s)return;this.Kt=s;let o=await Gn(s);s!==wd&&this.Kt!==s||(this.Ir(s),this.Rr(s,o));})),this.addSub(this.e.sub(O("localeDefinitionOverride"),s=>{if(!s)return;let o=s[this.Kt];o&&this.Rr(this.Kt,o);}));}Rr(t,e){let s=this.Vt.localeDefinitionOverride?.[t];for(let[o,n]of Object.entries(e)){let a=s?.[o];this.e.add(Ft(o),a??n,true);}}Ir(t){let e=this.i.pluginManager;if(!e)return;let s=e.snapshot();for(let o of s.i18n){let{pluginId:n,...a}=o,l=a[t];if(l)for(let[c,p]of Object.entries(l))p!==void 0&&this.e.add(Ft(c),p,true);}}};});var ke,rr,Wn=d(()=>{Ct();ke=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),rr=class extends V{constructor(){super(...arguments);this.xt=new Map;this.Z=new Set;this.w=new Map;}registerModal(t,e){this.xt.set(t,e),this.J(ke.ADD,{id:t,modal:e});}deleteModal(t){let e=this.xt.get(t);return e?(this.xt.delete(t),this.Z.delete(t),this.J(ke.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.xt.get(t);return e?(this.Z.add(t),this.J(ke.OPEN,{modal:e,id:t}),true):(this.m(`Modal with ID "${t}" not found`),false)}close(t){let e=this.xt.get(t);return !e||!this.Z.has(t)?(this.m(`Modal with ID "${t}" not found or not active`),false):(this.Z.delete(t),this.J(ke.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.xt.has(t)?this.Z.has(t)?this.close(t):this.open(t):(this.m(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.Z.size>0}back(){if(this.Z.size===0)return this.m("No active modals to go back from"),false;let t=Array.from(this.Z).pop();return t?this.close(t):false}closeAll(){let t=this.Z.size;return this.Z.clear(),this.J(ke.CLOSE_ALL,{}),t}subscribe(t,e){return this.w.has(t)||this.w.set(t,new Set),this.w.get(t)?.add(e),()=>this.unsubscribe(t,e)}unsubscribe(t,e){this.w.has(t)&&this.w.get(t)?.delete(e);}J(t,e){if(this.w.has(t))for(let s of this.w.get(t)??new Set)try{s(e);}catch(o){this.i.telemetryManager.sendEventError(o,"modal subscriber"),this.m("Error in modal subscriber:",o);}}destroy(){super.destroy(),this.closeAll(),this.xt.clear(),this.w.clear(),this.J(ke.DESTROY,{});}};});var sr,Xn=d(()=>{sr=class{constructor(){this.St=new Map;}register(i,t){if(this.St.has(t.name)){console.warn(`[CustomConfig] Config option "${t.name}" is already registered`);return}let e={attribute:true,...t,pluginId:i};this.St.set(t.name,e);}unregister(i){this.St.delete(i);}unregisterByPlugin(i){for(let[t,e]of this.St)e.pluginId===i&&this.St.delete(t);}get(i){return this.St.get(i)}getAll(){return new Map(this.St)}};});var or,Yn=d(()=>{Ct();Xn();bt();or=class extends V{constructor(t){super(t);this.Ot=new Map;this.Pe=[];this.Me=[];this.Ue=[];this.Le=[];this.De=[];this.w=new Set;this.Pr=Promise.resolve();this.configRegistry=new sr;this.addSub(this.e.sub(O("plugins"),e=>{this.Pr=this.Pr.then(()=>this.Vs(e));}));}onPluginsChange(t){return this.w.add(t),()=>{this.w.delete(t);}}async Vs(t){let e=new Set(this.Ot.keys()),s=new Set;for(let o of t){if(s.has(o.id)){this.m(`Plugin "${o.id}" is already in the list, skipping duplicate`);continue}s.add(o.id);let n=this.Ot.get(o.id);if(!n||n.plugin!==o)try{await this.Ks(o);}catch(a){this.Mr(o.id),this.xi(),this.m(`Plugin "${o.id}" setup failed`,a);}e.delete(o.id);}for(let o of e)this.Si(o);}async Ks(t){this.Ot.has(t.id)&&this.Si(t.id);let e={sources:[],activities:[],fileActions:[],icons:[],i18n:[]},s=[],l={registry:{registerSource:u=>this.te(this.Pe,e.sources,t.id,u),registerActivity:u=>this.te(this.Me,e.activities,t.id,u),registerFileAction:u=>this.te(this.Ue,e.fileActions,t.id,u),registerIcon:u=>this.te(this.Le,e.icons,t.id,u),registerI18n:u=>this.te(this.De,e.i18n,t.id,u),registerConfig:u=>{this.configRegistry.register(t.id,u);}},config:{get:u=>{let h=O(u);return this.e.read(h)},subscribe:(u,h)=>{let f=O(u),g=this.e.sub(f,b=>{h(b);});return s.push(g),g}},activity:{getParams:()=>this.e.read("*currentActivityParams"),subscribeToParams:u=>{let h=this.e.sub("*currentActivityParams",f=>{u(f);});return s.push(h),h}}},c=this.i.api,p=await t.setup({pluginApi:l,uploaderApi:c})??void 0;this.Ot.set(t.id,{plugin:t,exports:p,registrations:e,configSubscriptions:s}),this.xi();}Si(t){let e=this.Ot.get(t);if(e){this.Mr(t);for(let s of e.configSubscriptions)try{s();}catch(o){this.m("Failed to unsubscribe config listener",o);}e.exports?.dispose?.(),this.Ot.delete(t),this.xi();}}snapshot(){return {sources:[...this.Pe],activities:[...this.Me],fileActions:[...this.Ue],icons:[...this.Le],i18n:[...this.De]}}destroy(){for(let t of Array.from(this.Ot.keys()))this.Si(t);super.destroy();}te(t,e,s,o){let n={...o,pluginId:s};return t.push(n),e.push(n),o}Mr(t){this.Pe=this.Pe.filter(e=>e.pluginId!==t),this.Me=this.Me.filter(e=>e.pluginId!==t),this.Ue=this.Ue.filter(e=>e.pluginId!==t),this.Le=this.Le.filter(e=>e.pluginId!==t),this.De=this.De.filter(e=>e.pluginId!==t),this.configRegistry.unregisterByPlugin(t);}xi(){for(let t of this.w)try{t();}catch{}}};});var Qn=d(()=>{});var Zn=d(()=>{Yn();Qn();});function xd(r){return r.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}function Ps(r){return Array.isArray(r)?r.map(i=>typeof i=="object"&&i!==null?Ps(i):i):typeof r!="object"||r===null?r:Object.fromEntries(Object.entries(r).map(([i,t])=>{let e=xd(i);return typeof t=="object"&&t!==null?[e,Ps(t)]:[e,t]}))}function Sd(r){return {ok:true,value:r}}function Rs(r){return {ok:false,error:r}}var Od,Ms,Ad,kd,nr,Jn=d(()=>{Od="https://tlm.uploadcare.com/api/",Ms=class{constructor(i=Od){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let s=await fetch(e,t);if(!s.ok)return Rs(new Error(`Got non-200 response from "${e}". Status: ${s.status.toString()}`));try{let o=await s.json();return Sd(o)}catch(o){return Rs(new Error(`Error parsing JSON from "${e}". Error: ${o}`))}}catch(s){return Rs(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(Ps(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},Ad=async(r,i)=>({success:true,data:i}),kd=async r=>Ad(void 0,r),nr=class extends Ms{constructor(){super();}async sendEvent(i,t){let e=await kd(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 Id,_t,R,ar,Zt=d(()=>{Ct();Id=20,_t=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),R=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"}),ar=class extends V{constructor(){super(...arguments);this.ee=new Map;this.Fe=new Set;}bindTarget(t){return this.Fe.add(t),()=>{this.Fe.delete(t);}}Ur(t,e){for(let s of this.Fe)s.dispatchEvent(new CustomEvent(t,{detail:e}));this.m?.(()=>{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.Ur(t,typeof e=="function"?e():e);return}this.ee.has(t)&&window.clearTimeout(this.ee.get(t));let n=typeof o=="number"?o:Id,a=window.setTimeout(()=>{try{let l=typeof e=="function"?e():e;this.Ur(t,l),this.ee.delete(t);}catch(l){this.m?.(()=>`Error while getting payload for event "${t}"`,l);}},n);this.ee.set(t,a);}destroy(){for(let t of this.ee.values())window.clearTimeout(t);this.Fe.clear();}};});var ea,ta=d(()=>{ea="1.27.0-alpha.0";});var Jt,te,ni=d(()=>{ta();Jt="blocks",te=ea;});var st,Ie=d(()=>{st=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 lr,ia=d(()=>{Jn();ge();Qt();Zt();ni();Ct();Ie();bt();lr=class extends V{constructor(t){super(t);this.zs=st.generateRandomUUID();this.zt=structuredClone(B);this.Oi=false;this.Ai=null;this.ki=false;this.Lr=new nr,this.Bt=new Ht(10),this.addSub(this.e.sub(O("qualityInsights"),e=>{this.ki=!!e;}));for(let e of Object.keys(this.zt))this.addSub(this.e.sub(O(e),s=>{this.ki&&(this.Oi&&this.zt[e]!==s&&this.sendEvent({eventType:_t.CHANGE_CONFIG}),this.Bs(e,s));}));}js(t){t===_t.INIT_SOLUTION&&!this.Oi&&(this.Oi=true);}Bs(t,e){this.zt[t]!==e&&(this.zt[t]=e);}Hs(t){let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let s={...t};return (t.eventType===_t.INIT_SOLUTION||t.eventType===_t.CHANGE_CONFIG)&&(s.config=this.zt),{...s,appVersion:te,appName:Jt,sessionId:this.zs,component:this.Gs,activity:this.qs,projectPubkey:this.zt.pubkey,userAgent:navigator.userAgent,eventType:s.eventType??"",eventTimestamp:this.Ws,payload:{location:this.Xs,...e}}}Ys(t){return !!(t&&[R.CHANGE,R.COMMON_UPLOAD_PROGRESS,R.FILE_ADDED,R.FILE_REMOVED,R.FILE_UPLOAD_START,R.FILE_UPLOAD_PROGRESS,R.FILE_UPLOAD_SUCCESS,R.FILE_UPLOAD_FAILED].includes(t))}sendEvent(t){if(!this.ki)return;let e=this.Hs({eventType:t.eventType,payload:t.payload,config:t.config});this.js(t.eventType),!(this.Ys(t.eventType)||this.Ai&&this.Dr(this.Ai,e))&&this.Bt.add(async()=>{this.Ai=e,await this.Lr.sendEvent(e);});}sendEventError(t,e="unknown"){this.sendEvent({eventType:_t.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}});}sendEventCloudImageEditor(t,e,s={}){this.sendEvent({eventType:_t.ACTION_EVENT,payload:{metadata:{tabId:e,node:t.currentTarget?.tagName,event:t.type,...s}}});}Dr(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.Dr(t[n],e[n]))return false;return true}get Ws(){return Date.now()}get Gs(){if(!this.e.has("*solution"))return null;let t=this.e.read("*solution");return t?t.toLowerCase():null}get qs(){return this.e.has("*currentActivity")?this.e.read("*currentActivity"):null}get Xs(){return location.origin}};});var ft,ee,cr,ra,sa=d(()=>{ft=[],ee=0,cr=4,ra=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=ee+cr;o<ft.length;)ft[o]===e?ft.splice(o,cr):o+=cr;let s=i.indexOf(e);~s&&(i.splice(s,1),--t.lc||t.off());}},notify(e,s){let o=!ft.length;for(let n of i)ft.push(n,t.value,e,s);if(o){for(ee=0;ee<ft.length;ee+=cr)ft[ee](ft[ee+1],ft[ee+2],ft[ee+3]);ft.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 ur(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 Us(r,i,t){let e=ur(r,i,t);return t(r.value),e}var oa=d(()=>{});var Ls,na=d(()=>{sa();Ls=(r={})=>{let i=ra(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 aa=d(()=>{oa();na();});var F,ye=d(()=>{aa();F=class r{static{this.ie=new Map;}constructor(i,t){this.z=i,this.tt=t;}get id(){return this.z}pub(i,t){i in this.tt.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.tt.setKey(i,t);}sub(i,t,e=true){return (e?Us:ur)(this.tt,[i],o=>{t(o[i]);})}read(i){return i in this.tt.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.tt.get()[i]}add(i,t,e=false){(!(i in this.tt.get())||e)&&this.tt.setKey(i,t);}has(i){return i in this.tt.get()}get store(){return this.tt.get()}static registerCtx(i,t){if(r.ie.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=Ls(i);return r.ie.set(t,e),new r(t,e)}static deleteCtx(i){r.ie.delete(i);}static getCtx(i){let t=r.ie.get(i);return t?new r(i,t):null}static hasCtx(i){return r.ie.has(i)}};});var la,ca=d(()=>{la=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};});function dr(r,i={},t={}){let{openToken:e="{{",closeToken:s="}}",transform:o=Md}=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 da(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(ua)){let o=r.substring(t+2,e).replace(ua,""),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}var Md,ua,$s=d(()=>{Md=r=>r,ua="plural:";});function D(r,i){let t,e=((...s)=>{t&&clearTimeout(t),t=setTimeout(()=>r(...s),i);});return e.cancel=()=>{t&&clearTimeout(t);},e}var mt=d(()=>{});var pa,ai,ha=d(()=>{mt();pa="--uploadcare-blocks-window-height",ai=class r{static{this.clientsRegistry=new Set;}static{this.flush=D(()=>{document.documentElement.style.setProperty(pa,`${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(pa);}};});function Ld(r){return r.length<2?false:(r[0]==='"'||r[0]==="'")&&(r[r.length-1]==='"'||r[r.length-1]==="'")}function $d(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 Dd(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 fa(r){let i=r;Ld(r)&&(i=$d(i),i=i.replace(Ud,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=Dd(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}var Ud,ma=d(()=>{Ud=/\\([0-9a-fA-F]{1,6} ?)/g;});function ga(r){class i extends r{constructor(){super(...arguments);this.Fr=null;this.Ii=null;}getCssData(s,o=false){let n=this.Fr??Object.create(null);if(!Object.keys(n).includes(s)||!n[s]){this.Ii||(this.Ii=window.getComputedStyle(this));let a=this.Ii.getPropertyValue(s).trim();try{n[s]=fa(a);}catch(l){o||console.warn(`CSS Data error: ${s}`,l),n[s]=null;}}return this.Fr=n,n[s]}}return i}var ya=d(()=>{ma();});function va(r){class i extends r{constructor(){super(...arguments);this.willYield=true;this.At={};this.kt=null;this._e=false;}createRenderRoot(){return this}connectedCallback(){this.kt||(this.kt=Array.from(this.childNodes)),super.connectedCallback();}Qs(){if(this._e)return;this._e=true,this.At={};let s=Array.from(this.childNodes),o=s.length?s:this.kt??[];for(let n of o){let a=this._r(n),l=this.At[a]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),l.push(n),this.At[a]=l;}this.kt=null;}_r(s){return s instanceof Comment&&s.nextSibling instanceof Element?this._r(s.nextSibling):"contentFor"in s?s.contentFor||"":s instanceof Element&&s.hasAttribute("content-for")&&s.getAttribute("content-for")||""}Zs(s){return !s.textContent||!s.textContent.trim()}Js(s){let o=this.At[s];return !o||o.every(n=>n instanceof Comment||n instanceof Text&&this.Zs(n))}update(s){!this.hasUpdated&&this.willYield&&this.Qs(),super.update(s);}yield(s,o){if(s===""&&!this.At[s]&&!this._e&&this.kt?.length){let a=[];for(let l of this.kt)l instanceof Element&&(l.removeAttribute("slot"),l.removeAttribute("content-for")),a.push(l);this.At[s]=a,this._e=true,this.kt=null;}let n=this.At[s];return T` ${n} ${this.Js(s)?o:void 0} `}}return i}var ba=d(()=>{z();});var pr,Ds=d(()=>{pr=(r,i)=>new Intl.PluralRules(r).select(i);});var Fd,hr,Fs=d(()=>{Is();Ds();$s();Fd=r=>(i,t)=>{let e=r(),s=e("locale-id")||"en",o=pr(s,t);return e(`${i}__${o}`)},hr=r=>{let i=Fd(()=>t),t=(e,s={})=>{if(!e)return "";let n=r().read(Ft(e))||e,a=da(n);for(let c of a)s[c.variable]=i(c.pluralKey,Number(s[c.countVariable]));return dr(n,s)};return t};});function Ta(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 Ca=d(()=>{});var ie,li=d(()=>{ie=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 Ea=d(()=>{});var Re,_s=d(()=>{li();Re=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 ie(this.context,this.host,this.t,this.subscribe));}};});var fr,wa=d(()=>{fr=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 Ns,Pe,Vs=d(()=>{li();wa();Ns=class extends Event{constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},Pe=class extends fr{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 ie(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 Ns(this.context,this.host));}};});var xa=d(()=>{li();});var Sa=d(()=>{Vs();});var Oa=d(()=>{_s();});var Aa=d(()=>{li();Ea();_s();Vs();xa();Sa();Oa();});function Ia(){return function(r){class i extends r{constructor(...s){super(...s);this.q=null;this.re=false;this.Ri=false;this.Pi=void 0;this.jt=new Map;this.oe=new Set;this.init$={};this.ctxOwner=false;this.$e=void 0;this.Ne=false;this.ctxName=this.dt;this.pt=false;this.$e=this.getAttribute("ctx-name")||void 0,this.ctxName=this.dt,this.tn=new Re(this,{context:ka,callback:o=>{if(!o){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.Vr=o,this.Nr();},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 $r(){return this.$e}set $r(s){let o=s??void 0;this.$e!==o&&(this.$e=o,this.Nr());}shouldUpdate(s){return this.pt?super.shouldUpdate(s):false}get dt(){return this.$r||this.Vr||void 0}Nr(){if(this.ctxName=this.dt,!(!this.ctxName||this.re)){if(this.isConnected){this.Mi();return}this.Ne=true;}}willUpdate(s){super.willUpdate(s),this.ctxName=this.dt,this.ctxName&&(this.Pi?this.Pi.setValue(this.ctxName):this.Pi=new Pe(this,{context:ka,initialValue:this.ctxName}));}Kr(){if(!(!this.q||this.jt.size===0)){for(let[s,{value:o,rewrite:n}]of this.jt)this.q.add(s,o,n);this.jt.clear();}}zr(){return !this.q&&this.dt&&this.Ui(),this.q&&this.Kr(),this.q}Ve(){let s=this.zr();if(!s)throw new Error("SymbioteMixin: Shared context is not initialized.");return s}Ui(){let s=this.init$,o=this.dt;if(!o){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.q){this.q=F.getCtx(o)??F.registerCtx(s,o);for(let[n,a]of Object.entries(this.init$))this.q.add(n,a,this.ctxOwner);this.Kr();}}get $(){return this.dt&&this.Ui(),new Proxy({},{get:(s,o)=>{if(typeof o=="string")return this.q?.read(o)},set:(s,o,n)=>(typeof o!="string"||this.q?.pub(o,n),true)})}sub(s,o,n=true){let a=this.Ve().sub(s,o,n);if(!a||typeof a!="function")return ()=>{};let l=a.bind(a),c=false,p=()=>{c||(c=true,l(),this.oe.delete(p));};return this.oe.add(p),p}pub(s,o){this.Ve().pub(s,o);}set$(s){for(let[o,n]of Object.entries(s))this.pub(o,n);}get sharedCtx(){return this.Ve()}has(s){return this.q?.has(s)??false}add(s,o,n=false){let a=this.zr();if(!a){if(!n&&this.jt.has(s))return;this.jt.set(s,{value:o,rewrite:n});return}this.jt.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.re?this.pt&&this.Ri&&(this.Ri=false,this.initCallback()):this.ctxName?(this.Ne=false,this.Mi()):this.Ne&&this.dt&&(this.Ne=false,this.Mi());}Mi(){if(this.re)return;this.re=true,this.Ui();let s=this.init$;if(Object.keys(s).length>0){let o=this.Ve();for(let[n,a]of Object.entries(s))o.read(n)===void 0&&o.pub(n,a),this.sub(n,D(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.pt=true,this.requestUpdate();}firstUpdated(s){super.firstUpdated(s);}disconnectedCallback(){this.rn(),super.disconnectedCallback(),this.re&&(this.Ri=true);}rn(){if(this.oe.size!==0){for(let s of [...this.oe])s();this.oe.clear();}}initCallback(){}}return m([w({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"$r",1),m([C()],i.prototype,"Vr",2),m([C()],i.prototype,"ctxName",2),m([C()],i.prototype,"pt",2),i}}var ka,Ra=d(()=>{Aa();N();mt();ye();ka="ctx-name-context";});var Nd,mr,Pa=d(()=>{bt();Nd=r=>r.tagName?.includes("-")??false,mr=class{constructor(i){this.It=new Set;this.Ke=new Map;this.Br=false;this.Rt=i,this.Rt.addController(this);}hostDisconnected(){this.ze?.(),this.ze=void 0,this.It.clear(),this.Ke.clear();}hostUpdated(){if(!this.ze&&this.Rt.has(O("testMode"))){let i=this.Rt.subConfigValue("testMode",t=>{this.Br=!!t,this.jr();});this.ze=i;}this.sn(),this.jr();}sn(){let i=this.Rt,t=i.renderRoot??i;if(!t)return;let e=this.Rt,s=e.tagName?.toLowerCase(),o=Array.from(t.querySelectorAll("[data-testid]")).filter(n=>!Nd(n));for(let n of o)if(!(s&&n.closest(s)!==e)&&!this.It.has(n)){let a=n.getAttribute("data-testid");if(!a)continue;this.It.add(n),this.Ke.set(n,a);}for(let n of Array.from(this.It))(!n.isConnected||s&&n.closest(s)!==e)&&(this.It.delete(n),this.Ke.delete(n));}jr(){if(!this.It.size)return;let i=this.Rt.testId||"";for(let t of this.It){let e=this.Ke.get(t);e&&(this.Br?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};});var Vd,I,j=d(()=>{z();Xi();Un();Is();Wn();Zn();ia();bt();Qt();Zt();ye();Xt();ca();$s();ha();ya();Os();ba();Fs();Ca();Ra();Ct();Pa();Vd=Ta(Ia()(ga(va(Kt)))),I=class extends Vd{constructor(){super();this.activityType=null;this.init$=ys();this.l10n=hr(()=>this.sharedCtx);this.debugPrint=er(()=>this.sharedCtx,this.constructor.name);this.i=Bn(()=>this.sharedCtx);new mr(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(),ai.registerClient(this);}initCallback(){this.W("*blocksRegistry",()=>new Set),this.W("*pluginManager",t=>new or(t)),this.W("*eventEmitter",t=>new ar(t)),this.W("*localeManager",t=>new ir(t)),this.W("*modalManager",t=>new rr(t)),this.W("*a11y",()=>new Yi),this.W("*telemetryManager",t=>new lr(t)),this.sub(Ft("locale-id"),t=>{let e=la(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.et("*modalManager",false)}get telemetryManager(){return this.et("*telemetryManager")}get localeManager(){return this.et("*localeManager")}get a11y(){return this.et("*a11y")}get blocksRegistry(){return this.et("*blocksRegistry")}get eventEmitter(){return this.et("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),ai.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),t?.size===0&&setTimeout(()=>{this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.nn(),F.deleteCtx(this.ctxName);}Hr(){let t="*sharedContextInstances";if(!this.has(t)||!this.$[t]){let e=new Map;this.add(t,e,true);}return this.$[t]}W(t,e){let s=this.Hr();if(!s.has(t)&&(!this.has(t)||!this.$[t])){let o=e(this.i);this.add(t,o,true),s.set(t,o);return}}nn(){let t=this.Hr();for(let[e,s]of t.entries())s?.destroy?.(),this.pub(e,null);t.clear();}et(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:Ji(t),cdnUrlModifiers:Es(t),fileName:Zi(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?dr(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:e=>window.encodeURIComponent(e)}):t}get cfg(){if(!this.wt){let t={};this.wt=new Proxy(t,{set:(e,s,o)=>{if(typeof s!="string"||!(s in B))return false;let n=s,a=O(n);return this.has(a)||this.add(a,B[n]),this.$[a]=o,true},get:(e,s)=>{let o=O(s);return this.has(o)||this.add(o,B[s]),this.$[o]}});}return this.wt}subConfigValue(t,e){let s=O(t);return this.has(s)||this.add(s,B[t]),this.sub(s,e)}};});var re,gr=d(()=>{re="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";});function Ma(...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 it(...r){let i=Ma(...r);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}function Ua(r,...i){let t=Ma(...i);for(let e of Object.keys(t))r.classList.toggle(e,!!t[e]);}var Me=d(()=>{});var ci,yr,La,Ks=d(()=>{ii();Ie();ci=["free"],yr=r=>{let i=Ut(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&&!ci.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)&&!ci.includes(s)){console.warn(`Invalid crop preset: ${s}`);continue}t.push({id:st.generateFastUid(),type:"aspect-ratio",width:ci.includes(s)?0:n,height:ci.includes(s)?0:a,hasFreeform:ci.includes(s)});}return t},La=(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],p=l/c,u=Math.abs(s-p);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 Kd,$a,Da=d(()=>{Wt();Dt();Kd=r=>W.includes(r),$a=r=>{if(!r)return W;let i=Tt(r).filter(Kd);return i.length===0?W:i};});function Fa(r){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":W,"*tabId":L.CROP,"*on.retryNetwork":()=>{let i=r.querySelectorAll("img");for(let t of i){let e=t.src;t.src=re,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=ut(Yt(i),"preview"),s=dt(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 _a=d(()=>{Xt();gr();Ae();Dt();});var Na,Va=d(()=>{Na="<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 ve,Ue,Ka=d(()=>{N();j();Me();ve={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},Ue=class extends I{constructor(){super(...arguments);this.Ht=false;this.Gr=ve;this.qr=ve.visible;this.Wr=ve.hidden;this.Li=false;this.Xr=false;}set visible(t){this.Ht=t,this.Yr();}get visible(){return this.Ht}set styles(t){this.Gr=t,this.Li=true,this.qr=t.visible??ve.visible,this.Wr=t.hidden??ve.hidden;}get styles(){return this.Gr}Yr(){this.style.visibility=this.Ht?"inherit":"hidden",Ua(this,{[ve.transition]:!this.Li,[this.qr]:this.Ht,[this.Wr]:!this.Ht}),this.toggleAttribute("inert",!this.Ht);}an(){this.Xr||(this.Xr=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.Li||this.classList.add(ve.transition),this.Yr(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.an();},0);}};m([w({type:Boolean})],Ue.prototype,"visible",1),m([w({attribute:false})],Ue.prototype,"styles",1);});var ui,za=d(()=>{z();N();jt();j();ui=class extends I{constructor(){super(...arguments);this.active=false;this.Be=P();this.Di=false;this.Fi=()=>{let t=this.Be.value;t&&(this.Qr(t),this.Di&&this.active&&this._i());};}firstUpdated(t){super.firstUpdated(t),this.active&&this._i();}updated(t){super.updated(t),t.has("active")&&(this.active?this._i():this.ln());}_i(){let t=this.Be.value;if(!t)return;this.Di=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.Fi),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.Fi,{once:true});}ln(){let t=this.Be.value;t&&(this.Di=false,t.removeEventListener("transitionend",this.Fi),this.Qr(t));}Qr(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return T`<div class="uc-inner"><div class="uc-line" ${U(this.Be)}></div></div>`}};m([w({type:Boolean,reflect:true})],ui.prototype,"active",2);});var se,Ba=d(()=>{yt();Bt();se=ct(class extends vt{constructor(r){if(super(r),r.type!==zt.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 et}});});var vr=d(()=>{Ba();});var _,ja=d(()=>{yt();_=r=>r??k;});var Le=d(()=>{ja();});var Ha=d(()=>{});var be,Ga=d(()=>{z();N();ss();j();Ha();be=class extends I{constructor(){super(...arguments);this.name="";this.je="";this.se=null;this.Zr=null;}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",e=>{this.Zr=e,this.Ni();});let t=this.i.pluginManager;t?.onPluginsChange&&(this.$i=t.onPluginsChange(()=>this.Ni()));}willUpdate(t){super.willUpdate(t),t.has("name")&&this.Ni();}Ni(){if(!this.name){this.je="",this.se=null;return}let e=this.i.pluginManager?.snapshot().icons.find(n=>n.name===this.name);if(e){this.se=e.svg,this.je="";return}this.se=null;let s=`#uc-icon-${this.name}`,o=this.Zr?.(this.name);this.je=o??s;}render(){return this.se?T`${this.yield("",T`${zi(this.se)}`)}`:T` ${this.yield("",T`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.je}></use></svg>`)} `}disconnectedCallback(){this.$i?.(),this.$i=void 0,super.disconnectedCallback();}};m([w({type:String})],be.prototype,"name",2),m([C()],be.prototype,"je",2),m([C()],be.prototype,"se",2);});var ot,qa=d(()=>{z();N();vr();Le();j();ot=class extends I{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.Jr(),this.to();}updated(t){super.updated(t),t.has("reverse")&&this.Jr(),t.has("theme")&&this.to();}Jr(){this.style.flexDirection=this.reverse?"row-reverse":"";}to(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get cn(){let t=this.Vi;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.un}}get Vi(){return !this.icon}get un(){return !this.text&&!this.Vi}render(){return T`<button type="button" role=${_(this.ariaRole||void 0)} aria-controls=${_(this.ariaControls||void 0)} aria-label=${_(this.l10n(this.titleProp))} title=${_(this.l10n(this.titleProp))} ><uc-icon class=${se(this.cn)} name=${_(this.icon||void 0)} ?hidden=${this.Vi} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};m([w({type:String})],ot.prototype,"text",2),m([w({type:String})],ot.prototype,"icon",2),m([w({type:Boolean,reflect:true})],ot.prototype,"reverse",2),m([w({type:String,reflect:true})],ot.prototype,"theme",2),m([w({attribute:"aria-role"})],ot.prototype,"ariaRole",2),m([w({attribute:"aria-controls"})],ot.prototype,"ariaControls",2),m([w({attribute:"title-prop"})],ot.prototype,"titleProp",2),m([w({type:Boolean,noAccessor:true})],ot.prototype,"active",2);});function di(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=re);}}}function pi(r){let i=[];for(let o of r){let n=di(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 hi=d(()=>{gr();});var Wa,Xa=d(()=>{Wa=(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 fi,x,zs,Ya,Bs=d(()=>{fi=33.333333333333336,x=1,zs=24,Ya=6;});function oe(r,i){for(let[t,e]of Object.entries(i))r.setAttributeNS(null,t,e.toString());}function rt(r,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",r);return oe(t,i),t}function Qa(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,p=l===0?-1:1,u=[e+a*o+1.5*c,s+l*n+1.5*p-24*t*p],h=[e+a*o+1.5*c,s+l*n+1.5*p],f=[e+a*o-24*t*c+1.5*c,s+l*n+1.5*p],g=`M ${u[0]} ${u[1]} L ${h[0]} ${h[1]} L ${f[0]} ${f[1]}`,b=[h[0],h[1]];return {d:g,center:b}}function Za(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,p=l?.5:i==="n"?0:1,u=i==="w"?-1:i==="e"?1:0,h=i==="n"?-1:i==="s"?1:0,f,g;a?(f=[e+c*o-34*t/2,s+p*n+1.5*h],g=[e+c*o+34*t/2,s+p*n+1.5*h]):(f=[e+c*o+1.5*u,s+p*n-34*t/2],g=[e+c*o+1.5*u,s+p*n+34*t/2]);let b=`M ${f[0]} ${f[1]} L ${g[0]} ${g[1]}`,y=[(f[0]+g[0])/2,(f[1]+g[1])/2];return {d:b,center:y}}function Ja(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 tl({rect:r,delta:[i,t],imageBox:e}){return De({...r,x:r.x+i,y:r.y+t},e)}function De(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 zd({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<x&&(a=x,t&&(n=a*t,l=r.x+r.width/2-n/2),o=r.y+r.height-a),n<x&&(n=x,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 Bd({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<x&&(a=x,t&&(n=a*t),l=r.y+r.height/2-a/2,o=r.x+r.width-n),n<x&&(n=x,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 jd({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<x&&(a=x,t&&(n=a*t),l=r.x+r.width/2-n/2),n<x&&(n=x,t&&(a=n/t),l=r.x+r.width/2-n/2),{x:l,y:o,width:n,height:a}}function Hd({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<x&&(a=x,t&&(n=a*t),l=r.y+r.height/2-a/2),n<x&&(n=x,t&&(a=n/t),l=r.y+r.height/2-a/2),{x:o,y:l,width:n,height:a}}function Gd({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<x&&(c=x,t&&(l=c*t),n=r.x+r.width-l,a=r.y+r.height-c),l<x&&(l=x,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 qd({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<x&&(c=x,t&&(l=c*t),a=r.y+r.height-c),l<x&&(l=x,t&&(c=l/t),a=r.y+r.height-c),{x:n,y:a,width:l,height:c}}function Wd({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<x&&(c=x,t&&(l=c*t),n=r.x+r.width-l),l<x&&(l=x,t&&(c=l/t),n=r.x+r.width-l),{x:n,y:a,width:l,height:c}}function Xd({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<x&&(c=x,t&&(l=c*t)),l<x&&(l=x,t&&(c=l/t)),{x:n,y:a,width:l,height:c}}function el({direction:r,...i}){switch(r){case "n":return zd(i);case "w":return Bd(i);case "s":return jd(i);case "e":return Hd(i);case "nw":return Gd(i);case "ne":return qd(i);case "sw":return Wd(i);case "se":return Xd(i);default:return i.rect}}function il(r,[i,t]){return r.x<=i&&i<=r.x+r.width&&r.y<=t&&t<=r.y+r.height}function rl(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 sl(r,i){return Math.abs(r.width/r.height-i)<.1}function Fe({width:r,height:i},t){let e=t/90%2!==0;return {width:e?i:r,height:e?r:i}}function ol(r,i,t){let e=r/i,s,o;e>t?(s=Math.round(i*t),o=i):(s=r,o=Math.round(r/t));let n=Math.round((r-s)/2),a=Math.round((i-o)/2);return n+s>r&&(s=r-n),a+o>i&&(o=i-a),{x:n,y:a,width:s,height:o}}function _e(r){return {x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)}}function ne(r,i,t){return Math.min(Math.max(r,i),t)}var Tr=d(()=>{Bs();});function nl(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}var al=d(()=>{});function Ne(r,i,t){let s=window.devicePixelRatio,o=Math.min(Math.ceil(i*s),3e3),n=s>=2?"lightest":"normal";return dt(r,ut(tr,Yt(t),`quality/${n}`,`stretch/off/-/resize/${o}x`,`@clib/${Jt}/${te}/uc-cloud-image-editor/`))}var Cr=d(()=>{ni();Xt();Ae();});var mi,ll=d(()=>{z();N();jt();j();Ie();Tr();Bs();Me();mi=class extends I{constructor(){super(...arguments);this.eo=`uc-backdrop-mask-${st.generateFastUid()}`;this.Ge=false;this.ce=false;this.oo=P();this.ue=false;this.de=null;this.ao=t=>{this.lo(),this.pe&&(t.stopPropagation(),t.preventDefault(),this.pe=false);};this.co=t=>{if(!this.pe||!this.He||!this.zi)return;t.stopPropagation(),t.preventDefault();let e=this.mt;if(!e)return;let{x:s,y:o}=e.getBoundingClientRect(),n=t.x-s,a=t.y-o,l=n-this.He[0],c=a-this.He[1],{direction:p}=this.zi,u=this.Tn(p,[l,c]);u&&(this.$["*cropBox"]=u);};this.uo=t=>{if(!this.at)return;let e=Object.values(this.at).find(s=>{if(!s||this.ji(s.direction))return false;let n=s.interactionNode.getBoundingClientRect(),a={x:n.x,y:n.y,width:n.width,height:n.height};return il(a,[t.x,t.y])});this.io=e,this.lo();};}get mt(){return this.oo.value??null}get pe(){return this.ce}set pe(t){this.ce!==t&&(this.ce=t,this.Bi());}Bi(){this.ae&&this.ae.setAttribute("class",it({"uc-guides--hidden":this.Ge,"uc-guides--visible":!this.Ge&&this.ce,"uc-guides--semi-hidden":!this.Ge&&!this.ce}));}ji(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=x&&e.width<=x)return true;let s=e.height<=x&&(t.includes("n")||t.includes("s")),o=e.width<=x&&(t.includes("e")||t.includes("w"));return s||o}dn(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:s,width:o,height:n}=t,a=this.mt;if(!a)return;let l=rt("mask",{id:this.eo}),c=rt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),p=rt("rect",{x:e,y:s,width:o,height:n,fill:"black"});l.appendChild(c),l.appendChild(p);let u=rt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.eo})`});a.appendChild(u),a.appendChild(l),this.ne=l,this.Ki=p;}pn(){this.ne&&(this.ne.style.display="none",window.requestAnimationFrame(()=>{this.ne&&(this.ne.style.display="block");}));}hn(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:s,width:o,height:n}=t;this.Ki&&oe(this.Ki,{x:e,y:s,width:o,height:n});}mn(){let t=this.$["*cropBox"];if(!(!t||!this.ae||!this.at)){for(let e of Object.values(this.at)){if(!e)continue;let{direction:s,pathNode:o,interactionNode:n,groupNode:a}=e,l=s==="",c=s.length===2,{x:p,y:u,width:h,height:f}=t;if(l)oe(n,{x:p,y:u,width:h,height:f});else {let b=ne(Math.min(h,f)/82/2,0,1),y=c?Qa(t,s,b):Za(t,s,b),E=y.center;if(!E)continue;let v=Math.max(zs*ne(Math.min(h,f)/zs/3,0,1),Ya);oe(n,{x:E[0]-v,y:E[1]-v,width:v*2,height:v*2}),oe(o,{d:y.d});}let g=this.ji(s);a.setAttribute("class",it("uc-thumb",{"uc-thumb--hidden":g,"uc-thumb--visible":!g}));}oe(this.ae,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}so(t,e){let s=rt("g");s.classList.add("uc-thumb"),s.setAttribute("with-effects","");let o=rt("rect",{fill:"transparent"}),n=rt("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.gn.bind(this,e));}yn(){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.so(t,o);}return this.so(t,""),t}vn(){let t=rt("svg"),e=rt("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=rt("line",{x1:`${fi*s}%`,y1:"0%",x2:`${fi*s}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(o);}for(let s=1;s<=2;s++){let o=rt("line",{x1:"0%",y1:`${fi*s}%`,x2:"100%",y2:`${fi*s}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(o);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}bn(){let t=this.mt;if(!t)return;let e=document.createDocumentFragment(),s=this.vn();e.appendChild(s);let o=this.yn();for(let{groupNode:n}of Object.values(o))e.appendChild(n);t.appendChild(e),this.at=o,this.ae=s,this.Bi();}gn(t,e){if(!this.at)return;let s=this.at[t];if(!s||this.ji(t))return;let o=this.$["*cropBox"],n=this.mt;if(!n)return;let{x:a,y:l}=n.getBoundingClientRect(),c=e.x-a,p=e.y-l;this.pe=true,this.zi=s,this.He=[c,p],this.ro={...o};}Tn(t,e){let[s,o]=e,n=this.$["*imageBox"],a=this.ro??this.$["*cropBox"],l=this.$["*currentAspectRatio"],c=l?l.width/l.height:void 0;if(t===""?a=tl({rect:a,delta:[s,o],imageBox:n}):a=el({rect:a,delta:[s,o],direction:t,aspectRatio:c,imageBox:n}),!Object.values(a).every(p=>Number.isFinite(p)&&p>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:a});return}return De(_e(a),n)}lo(){let t=this.io,e=this.mt;e&&(e.style.cursor=t?Ja(t.direction):"initial");}po(t){if(this.le){this.le.setAttribute("href",t);return}let e=this.mt;if(!e){this.de=t;return}this.de=null;let s=document.createDocumentFragment(),o=rt("image",{href:t});o.setAttribute("class","uc-cloud-mask"),s.appendChild(o),e.appendChild(s),this.le=o;}Cn(){let t=this.$["*cropBox"];if(!t||!this.le)return;let{x:e,y:s,width:o,height:n}=t;oe(this.le,{x:e,y:s,height:n,width:o});}Hi(){this.ue&&(this.hn(),this.mn(),this.Cn());}toggleThumbs(t){if(this.at)for(let e of Object.values(this.at)){if(!e)continue;let{groupNode:s}=e;s.setAttribute("class",it("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.pn(),this.ue&&window.requestAnimationFrame(()=>{this.Hi();});}),this.sub("*cropBox",t=>{t&&(this.Ge=t.height<=x||t.width<=x,this.Bi(),this.ue&&window.requestAnimationFrame(()=>{this.Hi();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.po(t);}),document.addEventListener("pointermove",this.co,true),document.addEventListener("pointerup",this.ao,true);}firstUpdated(t){super.firstUpdated(t),this.En();}En(){let t=this.mt;if(!(!t||this.ue)){if(this.dn(),this.bn(),this.ue=true,t.addEventListener("pointermove",this.uo,true),this.de){let e=this.de;this.de=null,this.po(e);}this.Hi();}}disconnectedCallback(){super.disconnectedCallback(),this.mt?.removeEventListener("pointermove",this.uo,true),document.removeEventListener("pointermove",this.co,true),document.removeEventListener("pointerup",this.ao,true);}render(){return T`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${U(this.oo)}></svg>`}};m([C()],mi.prototype,"ce",2);});function Qd(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 gi,cl=d(()=>{z();N();jt();j();mt();hi();Xa();Tr();Me();al();Cr();gi=class extends I{constructor(){super();this.ctxOwner=true;this.Pt={width:0,height:0};this.e=null;this.b=false;this.X=null;this.fo=P();this.Wi=P();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.ho=D(this.mo.bind(this),300),this.Gi=Wa(()=>{!this.isConnected||!this.b||(this.Xi(),this.go(),this.yo(),this.Yi(),this.Qi());},100);}firstUpdated(t){super.firstUpdated(t),this.Xi();}go(){let t=this.$["*editorTransformations"],e=nl(t,Object.keys(this.$["*operations"])),s={...this.$["*operations"],...e};this.$["*operations"]=s;}Xi(){let t=this.fo.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.qi=t,this.e=e;}yo(){if(!this.b||!this.X)return;let t=this.X,e=this.$["*padding"],s=this.$["*operations"],{rotate:o}=s,n={width:this.offsetWidth,height:this.offsetHeight},a=Fe({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,p=n.width/n.height;if(c>p){let u=n.width-e*2,h=u/c,f=0+e,g=e+(n.height-e*2)/2-h/2;l={x:f,y:g,width:u,height:h};}else {let u=n.height-e*2,h=u*c,f=e+(n.width-e*2)/2-h/2,g=0+e;l={x:f,y:g,width:h,height:u};}}else {let{width:c,height:p}=a,u=e+(n.width-e*2)/2-c/2,h=e+(n.height-e*2)/2-p/2;l={x:u,y:h,width:c,height:p};}this.$["*imageBox"]=_e(l);}Yi(){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:[g,b]}=n,{width:y}=Fe(this.Pt,o),E=a/y;t=De(_e({x:l+g*E,y:c+b*E,width:h*E,height:f*E}),e);}let p=this.$["*currentAspectRatio"],u=p?p.width/p.height:void 0;if(!rl(t,e)||u&&!sl(t,u)){let h=e.width/e.height,f=e.width,g=e.height;u&&(h>u?f=Math.min(e.height*u,e.width):g=Math.min(e.width/u,e.height)),t={x:e.x+e.width/2-f/2,y:e.y+e.height/2-g/2,width:f,height:g};}this.$["*cropBox"]=De(_e(t),e);}wn(){let t=this.e;if(!t)return;let e=this.X;if(!e)return;let s=this.$["*imageBox"],o=this.$["*operations"],{mirror:n,flip:a,rotate:l}=o,c=Fe({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();}Qi(){if(!this.b||!this.X||!this.qi||!this.e)return;let t=this.qi;this.e.clearRect(0,0,t.width,t.height),this.wn();}xn({fromViewer:t}){this.X&&(this.Wi.value?.toggleThumbs(true),this.Sn(),setTimeout(()=>{this.className=it({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}vo(){let t=this.$["*cropBox"],e=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,{width:n,height:a}=e,{width:l,height:c}=Fe(this.Pt,o),{width:p,height:u}=t,h=n/l,f=a/c;return [ne(Math.round(p/h),1,l),ne(Math.round(u/f),1,c)]}On(){let t=this.$["*cropBox"],e=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,{width:n,height:a,x:l,y:c}=e,{width:p,height:u}=Fe(this.Pt,o),{x:h,y:f}=t,g=n/p,b=a/u,y=this.vo(),E={dimensions:y,coords:[ne(Math.round((h-l)/g),0,p-y[0]),ne(Math.round((f-c)/b),0,u-y[1])]};if(!Qd(E)){console.error("Cropper is trying to create invalid crop object",{payload:E});return}if(!(y[0]===p&&y[1]===u))return E}mo(){if(!this.isConnected||!this.Pt)return;let t=this.$["*operations"],{rotate:e,mirror:s,flip:o}=t,n=this.On(),l={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:s,flip:o};this.$["*editorTransformations"]=l;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this.b&&(this.yo(),this.Yi(),this.Qi());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this.b){this.b=true,await this.updateComplete,this.Xi(),this.Pt=t,this.removeEventListener("transitionend",this.bo);try{let s=this.$["*originalUrl"],o=this.$["*editorTransformations"];this.X=await this.An(s,o),this.go(),this.Gi(),this.xn({fromViewer:e});}catch(s){console.error("Failed to activate cropper",{error:s}),this.telemetryManager.sendEventError(s,"cloud editor image. Failed to activate cropper");}this.f=new ResizeObserver(s=>{let[o]=s;if(!o)return;o.contentRect.width>0&&o.contentRect.height>0&&this.b&&this.X&&this.Gi();}),this.f.observe(this);}}deactivate({reset:t=false}={}){this.b&&(!t&&this.mo(),this.b=false,this.kn(),this.className=it({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.Wi.value?.toggleThumbs(false),this.addEventListener("transitionend",this.bo,{once:true}),this.f?.disconnect());}kn(){let t=this.vo(),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`;}Sn(){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`;}bo(){this.b||(this.X=null);}async An(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(Ne(t,s,e)),{promise:n,cancel:a,image:l}=di(o),c=this.Gt(o);return l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),this.g?.(),this.g=a,n.then(()=>l).catch(p=>(console.error("Failed to load image",{error:p}),this.$["*networkProblems"]=true,l))}Gt(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.Qi();}),this.sub("*cropBox",()=>{this.X&&this.ho();}),this.sub("*currentAspectRatio",()=>{this.Yi();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this.b&&this.Pt&&this.activate(this.Pt,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.f?.disconnect(),this.X&&(this.X=null);}render(){return T`<canvas class="uc-canvas" ${U(this.fo)}></canvas><uc-crop-frame ${U(this.Wi)}></uc-crop-frame>`}};m([C()],gi.prototype,"X",2);});function js(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}var ul=d(()=>{});function Zd(r){return typeof r=="string"&&r in pt}function Jd(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 tp(r,i,t){let e=Jd(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 ep(r,i){return r.map((t,e)=>t<i?r.length-e:e)}function dl(r,i){let t=pt[r].keypointsNumber,{range:e,zero:s}=pt[r];return [...new Set([...js(e[0],s,t+1),...js(s,e[1],t+1),s,i])].sort((o,n)=>o-n)}var Er,pl=d(()=>{z();jt();j();mt();hi();Me();ul();Dt();Cr();Er=class extends I{constructor(){super();this.b=false;this.Zi=true;this.s="initial";this.To={};this.gt=[];this.Eo=0;this.xo=P();this.qe=P();this.classList.add("uc-inactive_to_cropper"),this.wo=D(async(t,e,s)=>{let o=()=>!this.So(t,e)||this.Ji!==s||!!this.gt.find(c=>c.value===s);if(o())return;let n=await this.Oo(t,s),a=new Image;a.src=n.src;let l=this.Gt(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.gt,p=c.findIndex(g=>g.value>s);p===-1&&(p=c.length);let h=c[p]?.image,f=this.qe.value;!f||h&&!f.contains(h)||(c.splice(p,0,n),h?f.insertBefore(a,h):f.appendChild(a),this.ir(t,s));},{once:true}),a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}Gt(t){let e=this.s,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);}}Ao(){window.cancelAnimationFrame(this.Eo),this.Eo=window.requestAnimationFrame(()=>{for(let t of this.gt){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}Mt({url:t=this.Co,filter:e=this.c??void 0,operation:s,value:o}={}){if(!t)throw new Error("URL is not defined");let n={...this.To};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(Ne(t,a,n))}async Oo(t,e){return {src:await this.Mt({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}So(t,e){return this.s===t&&this.c===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!Zd(this.s)||!Number.isFinite(e)||(this.ir(this.s,e),this.wo(this.s,this.c,e));}ir(t,e){this.s=t,this.Ji=e;let{zero:s}=pt[t],o=this.gt.map(l=>l.value),n=tp(o,e,s),a=ep(o,s);this.gt.forEach((l,c)=>{let p=n[c],u=a[c];typeof p=="number"&&(l.opacity=p),typeof u=="number"&&(l.zIndex=u);}),this.Ao();}ko(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async In(){this.n=this.n||this.ko();let t=this.n;t&&this.Io(t);let e=this.gt.map(c=>c.src),{images:s,promise:o,cancel:n}=pi(e);s.forEach(c=>{let p=this.Gt(c.src);c.addEventListener("load",p),c.addEventListener("error",p);}),this.tr=()=>{n(),this.tr=void 0;};let a=this.s,l=this.c;if(await o,this.b&&this.So(a,l)){let c=this.qe.value;if(!c)return;c.replaceChildren(),this.gt.forEach((p,u)=>{let h=s[u];h&&(h.classList.add("uc-fader-image"),p.image=h,c.appendChild(h));}),this.Ao();}}async setTransformations(t){if(this.To=t,this.n){let e=await this.Mt(),s=this.Gt(e);this.n.src=e,this.n.addEventListener("load",s,{once:true}),this.n.addEventListener("error",s,{once:true}),this.n.style.opacity="1",this.n.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:t,filter:e,operation:s,value:o}){if(!s||typeof o!="number")return;this.er?.();let n=dl(s,o),a=await Promise.all(n.map(c=>this.Mt({url:t,filter:e,operation:s,value:c}))),{cancel:l}=pi(a);this.er=l;}Rn(t){let e=this.n||this.ko();if(this.Io(e),this.n=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=it({"uc-active_from_viewer":this.he,"uc-active_from_cropper":!this.he,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let s=this.Gt(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=it({"uc-active_from_viewer":this.he,"uc-active_from_cropper":!this.he,"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.b=true,this.Zi=false,await this.updateComplete,this.Co=t,this.s=e??"initial",this.Ji=s,this.c=o,this.he=n,typeof s!="number"&&!o){let l=await this.Mt({operation:e,value:s});this.Rn(l),this.rr();return}!e||typeof s!="number"||(this.gt=await Promise.all(dl(e,s).map(l=>this.Oo(e,l))),this.ir(e,s),this.In());}deactivate({hide:t=true}={}){this.b=false,this.tr?.(),this.er?.(),t&&!this.Zi?(this.Zi=true,this.n&&(this.n.style.transform="scale(1)"),this.className=it({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.rr();},{once:true})):this.rr();}Io(t){let e=this.xo.value;e&&(e.contains(t)||e.appendChild(t));}rr(){this.qe.value?.replaceChildren();}render(){return T`<div class="uc-fader-preview-host" ${U(this.xo)}></div><div class="uc-fader-layers-host" ${U(this.qe)}></div>`}};});var hl,ip,yi,fl=d(()=>{yt();Bt();hl="important",ip=" !"+hl,yi=ct(class extends vt{constructor(r){if(super(r),r.type!==zt.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(ip);e.includes("-")||o?t.setProperty(e,o?s.slice(0,-11):s,o?hl:""):t[e]=s;}}return et}});});var Hs=d(()=>{fl();});var wt,ml=d(()=>{z();N();jt();j();wt=class extends I{constructor(){super();this.or=0;this.We=P();this.Po=P();this.Mo=P();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.yt=0;this.Mn=t=>{t.stopPropagation();let e=this.Uo(t);e!==null&&(this.sr(e),this.Pn("slider-input",e));};this.Un=t=>{t.stopPropagation();let e=this.Uo(t);e!==null&&this.sr(e);};this.Lo=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.Do=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}Pn(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.or=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.Fo(this.yt),this.nr(),this.f=new ResizeObserver(()=>{this.nr(),this.Xe(this.yt);}),this.f.observe(this);let e=this.We.value;e?.addEventListener("focus",this.Lo),e?.addEventListener("blur",this.Do),window.setTimeout(()=>{this.Xe(this.yt);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.yt&&this.sr(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.nr(),this.Xe(this.yt)),t.has("zero")&&this.hasUpdated&&this._o(this.yt);}Xe(t){this._o(t);let e=this.max-this.min;if(e===0)return;let{width:s}=this.getBoundingClientRect(),a=100/e*(t-this.min)*(s-this.or)/100;window.requestAnimationFrame(()=>{let l=this.Po.value;l&&(l.style.transform=`translateX(${a}px)`);});}_o(t){if(!this.fe)return;let e=this.max-this.min;if(e===0)return;this.fe.style.opacity=t===this.zero?"0":"1";let{width:s}=this.getBoundingClientRect(),a=100/e*(this.zero-this.min)*(s-this.or)/100;window.requestAnimationFrame(()=>{this.fe&&(this.fe.style.transform=`translateX(${a}px)`);});}nr(){let e=this.Mo.value;if(!e)return;let{width:s}=e.getBoundingClientRect(),o=Math.ceil(s/2),n=Math.ceil(o/15)-2;if(this.Ro===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 p=document.createElement("div");p.className="uc-zero-dot",a.appendChild(p),this.fe=p,e.innerHTML="",e.appendChild(a),this.Ro=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.We.value;t?.removeEventListener("focus",this.Lo),t?.removeEventListener("blur",this.Do),this.f?.disconnect(),this.f=void 0;}sr(t){Number.isFinite(t)&&(this.yt=t,this.hasUpdated&&(this.Fo(t),this.Xe(t)));}Fo(t){let e=this.We.value;e&&(e.value=String(t));}Uo(t){let e=t.currentTarget;if(!e)return null;let s=Number.parseInt(e.value,10);return Number.isFinite(s)?s:null}render(){return T`<div class="uc-steps" ${U(this.Mo)}></div><div class="uc-thumb" ${U(this.Po)}></div><input class="uc-input" type="range" ${U(this.We)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.yt)} ?disabled=${this.disabled} @input=${this.Mn} @change=${this.Un} />`}};m([w({type:Boolean,reflect:true})],wt.prototype,"disabled",2),m([w({type:Number})],wt.prototype,"min",2),m([w({type:Number})],wt.prototype,"max",2),m([w({type:Number,attribute:false})],wt.prototype,"defaultValue",2),m([w({type:Number})],wt.prototype,"zero",2),m([C()],wt.prototype,"yt",2);});var xt,vi,wr=d(()=>{z();N();j();Dt();xt="original",vi=class extends I{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.Ln=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.Dn();let s=this.$["*faderEl"],o=this.state.originalUrl||this.$["*originalUrl"];s&&o&&s.activate({url:o,operation:this.state.operation,value:this.state.filter===xt?void 0:this.state.value,filter:this.state.filter===xt?void 0:this.state.filter,fromViewer:false});}Dn(){let t=this.state.operation,{range:e,zero:s}=pt[t],[o,n]=e;this.state={...this.state,min:o,max:n,zero:s};let l=this.$["*editorTransformations"][t];if(t==="filter"){let p=Number(n),u=l;if(u){let{name:h,amount:f}=u;p=h===this.state.filter?f:n;}this.state={...this.state,value:p,defaultValue:p};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===xt?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 T`<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.Ln} ></uc-slider-ui>`}};m([C()],vi.prototype,"state",2);});function Ve(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 xr=d(()=>{});var X,bi=d(()=>{z();N();Le();j();X=class extends I{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}}$o(){let t=this.buttonClasses;for(let[e,s]of Object.entries(t))this.classList.toggle(e,s);}onClick(t){}connectedCallback(){super.connectedCallback(),this.$o();}updated(t){super.updated(t),t.has("active")&&this.$o();}render(){let t=this.onClick,e=this.title;return T`<button role="option" type="button" aria-label=${_(this.titleProp)} title=${_(this.titleProp)} @click=${t} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};m([C()],X.prototype,"active",2),m([C()],X.prototype,"title",2),m([C()],X.prototype,"icon",2),m([C()],X.prototype,"titleProp",2);});var Sr,Or,rp,Ar,Ti,gl=d(()=>{z();N();vr();Le();bi();Sr=12,Or=16,rp=r=>{let i=12,t=12;return r.width/r.height>=1?(i=Sr,t=Math.round(Sr*r.height/r.width)):(t=Sr,i=Math.round(Sr*r.width/r.height)),{width:i,height:t}},Ar=class extends X{initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this.Fn(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}Fn(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 T`<button role="option" type="button" class=${se(this.buttonClasses)} aria-label=${_(this.titleProp)} title=${_(this.titleProp)} @click=${i} ><div class="uc-title" ?hidden=${!t}>${t}</div><uc-icon name=${this.icon}></uc-icon></button>`}},Ti=class extends X{constructor(){super(...arguments);this.S=null;}get aspectRatio(){return this.S}set aspectRatio(t){if(this.S===t)return;let e=this.S;this.S=t,this.requestUpdate("aspectRatio",e),t?this.No(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.S&&this.No(this.S),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.S?.id||t?.width===this.S?.width&&t?.height===this.S?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.S?.id&&(this.$["*currentAspectRatio"]=this.S);}No(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();}_n(){let t=this.S;if(!t||t.hasFreeform)return T`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:s}=rp(t),o=(Or-e)/2,n=(Or-s)/2;return T`<uc-icon><svg viewBox="0 0 ${Or} ${Or}" 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 T`<button role="option" type="button" class=${se(this.buttonClasses)} aria-label=${_(this.titleProp)} title=${_(this.titleProp)} @click=${t} >${this._n()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};m([w({attribute:false})],Ti.prototype,"aspectRatio",1);});function sp(r){let i=r+90;return i=i>=360?0:i,i}function op(r,i){if(r==="rotate")return sp(typeof i=="number"?i:0);if(r==="mirror"||r==="flip")return !i;throw new Error(`Unsupported operation: ${r}`)}var Ci,yl=d(()=>{N();bi();Ci=class extends X{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=op(this.operation,s);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:o,prev:s}),e.setValue(this.operation,o);}};m([w({type:String})],Ci.prototype,"operation",2);});var Nt,vl=d(()=>{z();N();vr();Le();Hs();ni();Xt();hi();bi();wr();Ae();xr();Nt=class extends X{constructor(){super(...arguments);this.s="";this.c="";this.me="";this.Ye=0;this.n=null;this.Wt=false;this.isOriginal=false;this.Vo=20;}get filter(){return this.c}set filter(t){let e=t??"";if(this.c===e)return;let s=this.c;this.c=e,this.s="filter",this.isOriginal=e===xt,this.icon=this.isOriginal?"original":"slider",this.Vo=this.isOriginal?40:20,this.requestUpdate("filter",s),this.isConnected&&this.Ko(e);}onClick(t){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this.s,this.c),this.$["*showSlider"]=true);else {let e=this.$["*sliderEl"];e.setOperation(this.s,this.c),e.apply();}this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:Ve(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.c;}$n(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.Vo||32,s=window.devicePixelRatio,o=Math.ceil(s*e),n=s>=2?"lightest":"normal",a=100,l={...this.$["*editorTransformations"]};return l[this.s]=this.c!==xt?{name:this.c,amount:a}:void 0,dt(this.me,ut(tr,Yt(l),`quality/${n}`,`scale_crop/${o}x${o}/center`,`@clib/${Jt}/${te}/uc-cloud-image-editor/`))}async Nn(t,e){t[0]?.isIntersecting?await this.ar(e):this.g?.();}initCallback(){super.initCallback(),this.f=new window.IntersectionObserver(this.Nn.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this.me=t??"",this.sub("*originalUrl",e=>{this.me=e??"",!this.isOriginal&&this.me&&this.isConnected&&!this.n&&(this.f?.observe(this),this.Ut());}),this.isOriginal||(this.f?.observe(this),this.Ut()),this.c&&this.Ko(this.c),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.c);}),this.sub("*networkProblems",async e=>{e||(this.n?await this.ar():this.Ut());});}disconnectedCallback(){super.disconnectedCallback(),this.f?.disconnect(),this.g?.(),this.Qe();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.f?.unobserve(this):(this.f?.observe(this),this.Ut()));}Ko(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async ar(t){if(!this.isConnected){t?.unobserve(this),this.g?.(),this.g=void 0;return}if(!this.me){!this.qt&&!this.vt&&this.Ut();return}let e=++this.Ye,s="";try{s=await this.proxyUrl(this.$n());}catch(a){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:a});return}this.Wt=false,this.g?.();let{promise:o,cancel:n}=di(s);this.g=()=>{n(),this.Ye===e&&(this.g=void 0);};try{if(await o,this.Ye!==e||!this.isConnected)return;this.n=s,this.Wt=!0,this.Qe(),(t??this.f)?.unobserve(this);}catch(a){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:a}),this.Ut();}finally{this.Ye===e&&(this.g=void 0);}}Ut(){if(!this.isConnected||this.n||this.Wt||this.isOriginal||this.$["*networkProblems"]){this.Qe();return}this.vt&&cancelAnimationFrame(this.vt),this.vt=requestAnimationFrame(()=>{if(this.vt=void 0,!this.isConnected||this.n||this.Wt||this.isOriginal){this.Qe();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.ar();return}this.qt=window.setTimeout(()=>{this.qt=void 0,this.Ut();},500);});}Qe(){this.vt&&(cancelAnimationFrame(this.vt),this.vt=void 0),this.qt&&(window.clearTimeout(this.qt),this.qt=void 0);}get Vn(){return !!(this.Wt&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.Vn?"1":"0"};this.n&&(e.backgroundImage=`url(${this.n})`);let s={opacity:this.active||this.isOriginal?"1":"0"};return T`<button role="option" type="button" class=${se(this.buttonClasses)} aria-label=${_(this.titleProp)} title=${_(this.titleProp)} @click=${t} ><div class="uc-preview" ?data-loaded=${this.Wt} style=${yi(e)}></div><uc-icon class=${se({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${yi(s)} ></uc-icon></button>`}};m([C()],Nt.prototype,"n",2),m([C()],Nt.prototype,"Wt",2),m([C()],Nt.prototype,"isOriginal",2),m([C()],Nt.prototype,"Vo",2),m([w({type:String})],Nt.prototype,"filter",1);});var Ei,bl=d(()=>{N();bi();Dt();xr();Ei=class extends X{constructor(){super(...arguments);this.s="";}get operation(){return this.s}set operation(t){let e=t??"";if(this.s===e)return;let s=this.s;this.s=e,this.requestUpdate("operation",s),this.isConnected&&e&&this.zo(e);}zo(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.s&&this.zo(this.s),this.sub("*editorTransformations",t=>{if(!this.s)return;let{zero:e}=pt[this.s],s=t[this.s],o=typeof s<"u"?s!==e:false;this.active=o;});}onClick(t){this.$["*sliderEl"]?.setOperation(this.s),this.$["*showSlider"]=true,this.$["*currentOperation"]=this.s,this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:Ve(this.$["*operationTooltip"])});}};m([w({type:String})],Ei.prototype,"operation",1);});var np,Tl,wi,Cl=d(()=>{N();j();np=1,Tl=()=>{},wi=class extends I{constructor(){super(...arguments);this.hiddenScrollbar=false;this.Bo=t=>{t.preventDefault();let{deltaY:e,deltaX:s}=t;if(Math.abs(s)>np){this.scrollLeft+=s;return}this.scrollLeft+=e;};}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.Bo,{passive:false}),this.addEventListener("scroll",Tl,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.Bo),this.removeEventListener("scroll",Tl),super.disconnectedCallback();}};m([w({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],wi.prototype,"hiddenScrollbar",2);});var Z,El=d(()=>{z();N();jt();Hs();os();j();mt();hi();wr();Dt();Cr();xr();Z=class extends I{constructor(){super(...arguments);this.ge=false;this.showMainToolbar=true;this.showSubToolbar=false;this.jo=true;this.tabList=[...W];this.activeTab=L.CROP;this.Ze=true;this.lr=false;this.Ho=null;this.Go=0;this.qo=0;this.Je=P();this.Wo=P();this.tabToggleRefs={[L.CROP]:P(),[L.TUNING]:P(),[L.FILTERS]:P()};this.Xo=()=>{this.Lt();};this.ye=[];this.ti=D(t=>{this.ge=t;},500);this.ei=D(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],s="",o=false;if(this.$["*tabId"]===L.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(xt);else if(this.showSubToolbar&&this.$["*tabId"]===L.TUNING&&e){o=true;let n=t?.[e]||pt[e].zero;s=`${this.l10n(e)} ${n}`;}o&&(this.$["*operationTooltip"]=s),this.lr=o;},0);this.Kn={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.zn={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.Bn={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.jn={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":xt,"*currentOperation":null,"*operationTooltip":null};this.pr=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.g?.();let e=this.$["*on.cancel"];e?.();};this.hr=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.ea=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:Ve(this.$["*operationTooltip"])}),this.Je.value?.apply(),this.Yo();};this.ia=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.Je.value?.cancel(),this.Yo();};this.ra=t=>{let s=t.currentTarget?.getAttribute("data-id");s&&(this.telemetryManager.sendEventCloudImageEditor(t,s),this.cr(s,{fromViewer:false}));};}Yo(){this.$["*showSlider"]=false,this.$["*tabId"]===L.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===L.TUNING&&(this.lr=false);}cr(t,{fromViewer:e=false,force:s=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.Qo(t,{fromViewer:e,force:s});}Qo(t,{fromViewer:e,force:s=false}){if(!s&&this.activeTab===t){this.Lt();return}this.activeTab=t;let o=this.$["*faderEl"],n=this.$["*cropperEl"];t===L.CROP?(o?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:e})):(o?.activate({url:this.$["*originalUrl"],fromViewer:e}),n?.deactivate());for(let a of W){let l=a===t,p=this.tabToggleRefs[a]?.value;p&&(p.active=l),l&&this.Lt();}}Lt(){let e=this.tabToggleRefs[this.activeTab]?.value,s=this.Wo.value;if(!e||!s)return;let o=e.offsetLeft,n=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.Go!==o||this.qo!==n)&&(this.Go=o,this.qo=n,s.style.transform=`translateX(${o}px)`,s.style.width=`${n}px`);}get ur(){return this.ye.length>=3}Hn(t){switch(t){case L.CROP:return this.Gn();case L.FILTERS:return this.qn();case L.TUNING:return this.Wn();default:return []}}Gn(){let t=[];if(this.ur)t.push(()=>this.Xn());else for(let e of this.ye)t.push(()=>this.Zo(e));for(let e of zn)t.push(()=>this.Yn(e));return this.dr(t)}qn(){let e=[xt,...Kn].map(s=>()=>this.Qn(s));return this.dr(e)}Wn(){let t=Vn.map(e=>()=>this.Zn(e));return this.dr(t)}dr(t){return t.length?t.map(s=>s()):[]}Xn(){return T`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}Zo(t){return T`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}Yn(t){return T`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}Qn(t){return T`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}Zn(t){return T`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}Jn(){return this.ur?this.ye.map(t=>this.Zo(t)):[]}async ta(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(Ne(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.g?.();let{cancel:s}=pi([e]);this.g=()=>{s(),this.g=void 0;};}}initCallback(){super.initCallback();let t=this.$["*cropPresetList"]??[];this.ye=[...t],this.sub("*cropPresetList",e=>{this.ye=[...e??[]];}),this.sub("*imageSize",e=>{e&&setTimeout(()=>{this.cr(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let s=e?.filter?.name;this.$["*currentFilter"]!==s&&(this.$["*currentFilter"]=s??"");}),this.sub("*currentFilter",()=>{this.ei();}),this.sub("*currentOperation",()=>{this.ei();}),this.sub("*tabId",e=>{this.Qo(e,{fromViewer:false,force:true}),this.ei();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.ta(),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.ti(s);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Ze=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Ze=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.jo=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[s]=e;s&&this.cr(s,{fromViewer:false});return}this.Lt();}),this.sub("*operationTooltip",e=>{this.Ho=e;}),this.ei();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.Xo);}firstUpdated(t){super.firstUpdated(t),this.ii(),this.Lt();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.Lt()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.ii();}disconnectedCallback(){window.removeEventListener("resize",this.Xo),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}ii(){let t=this.Je.value;t&&(this.$["*sliderEl"]=t);}oa(t){let e=this.tabList.includes(t),s=this.activeTab===t,o=this.tabList.indexOf(t),n=o>=0?yi({gridColumn:`${o+1}`}):k;return T`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.Bn}><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.ra} ${U(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}sa(t){let e=this.Hn(t);return T`<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:k}</div></div></uc-editor-scroller></div>`}render(){let t=["uc-info-tooltip",this.lr?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.ur;return T`<uc-line-loader-ui .active=${this.ge}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.Ho??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.Kn} ><div class="uc-tab-content-row">${W.map(s=>Je(this.activeTab===s,()=>this.sa(s)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.jo} .styles=${this.jn} @initial-render=${()=>this.Lt()} ><div class="uc-tab-toggles_indicator" ${U(this.Wo)} ></div>${W.map(s=>this.oa(s))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.pr} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.hr}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.zn}><div class="uc-slider" ?hidden=${!this.Ze}><uc-editor-slider ${U(this.Je)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.Ze||!e}>${e?T`<div class="uc-list-aspect-ratio">${this.Jn()}</div>`:k}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.ia} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.ea} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};m([C()],Z.prototype,"ge",2),m([C()],Z.prototype,"showMainToolbar",2),m([C()],Z.prototype,"showSubToolbar",2),m([C()],Z.prototype,"jo",2),m([C()],Z.prototype,"tabList",2),m([C()],Z.prototype,"activeTab",2),m([C()],Z.prototype,"Ze",2),m([C()],Z.prototype,"lr",2),m([C()],Z.prototype,"Ho",2),m([C()],Z.prototype,"ye",2);});var wl,H,Gs=d(()=>{z();N();jt();ss();os();j();Xt();Wt();mt();gr();Me();Ks();Da();Ae();_a();Va();Dt();wl=Mt([...W]),H=class extends I{constructor(){super(...arguments);this.ctxOwner=true;this.na="";this.Mt=re;this.aa="";this.ge=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=wl;this.Jo=false;this.pt=false;this.fr=null;this.ti=D(t=>{this.ge=t;},300);this.ri=P();this.ts=P();this.es=P();this.rs=P();this.os=()=>{this.ti(false),this.Mt!==re&&(this.$["*networkProblems"]=false);};this.ss=()=>{this.ti(false),this.$["*networkProblems"]=true;};this.la=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...Fa(this)};}static{this.styleAttrs=["uc-cloud-image-editor"];}ca(){this.pt||this.fr||(this.fr=this.updateComplete.then(()=>{this.fr=null,this.pt=true;}));}initCallback(){super.initCallback(),this.ns(),this.as();}ii(){let t=this.es.value;t&&(this.$["*faderEl"]=t);let e=this.ts.value;e&&(this.$["*cropperEl"]=e);let s=this.rs.value;s&&(this.$["*imgContainerEl"]=s);let o=this.ri.value;o&&(this.$["*imgEl"]=o);}ua(){let t=this.ri.value;t&&(t.addEventListener("load",this.os),t.addEventListener("error",this.ss));}da(){let t=this.ri.value;t&&(t.removeEventListener("load",this.os),t.removeEventListener("error",this.ss));}get pa(){let t=this.$["*tabId"];return it("uc-image",{"uc-image_hidden_to_cropper":t===L.CROP,"uc-image_hidden_effects":t!==L.CROP})}ls(){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.ii(),this.ua(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),s=t.has("uuid")||t.has("cdnUrl");e&&!s&&this.updateImage();}disconnectedCallback(){this.da(),super.disconnectedCallback();}render(){let t=this.aa??"",e=this.na??"",s=this.Mt||re,o=this.ge,n=this.Jo;return T` ${zi(Na)}<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.la}></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" ${U(this.rs)}><img src=${s} class=${this.pa} ${U(this.ri)} />${Je(this.pt,()=>T`<uc-editor-image-cropper ${U(this.ts)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${U(this.es)}></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">${Je(this.pt,()=>T`<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.ns(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.as();}ns(){let t=this.tabs||wl;this.$["*tabList"]=$a(t);}as(){let t=yr(this.cropPreset??""),e=null;if(this.cdnUrl){let s=ws(this.cdnUrl),o=Ss(s);if(Array.isArray(o?.crop?.dimensions)){let[n,a]=o.crop.dimensions;e=La(n,a,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){if(await this.ls(),this.cdnUrl){let t=this.cdnUrl,e=Ji(t),s=xs(t,e);if(s===this.$["*originalUrl"])return;this.$["*originalUrl"]=s;let o=ws(t),n=Ss(o);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=xs(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"]===L.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(dt(t,ut("json"))),s=await fetch(e).then(a=>a.json()),{width:o,height:n}=s;this.$["*imageSize"]={width:o,height:n},this.$["*tabId"]===L.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.ca();}}async initEditor(){try{await this.ls();}catch(t){this.isConnected&&console.error(t.message);return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.Jo=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],s=ut(Yt(t),"preview"),o=dt(e,s),n={originalUrl:e,cdnUrlModifiers:s,cdnUrl:o,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};m([C()],H.prototype,"na",2),m([C()],H.prototype,"Mt",2),m([C()],H.prototype,"aa",2),m([C()],H.prototype,"ge",2),m([w({type:String,reflect:true})],H.prototype,"uuid",2),m([w({type:String,attribute:"cdn-url",reflect:true})],H.prototype,"cdnUrl",2),m([w({type:String,attribute:"crop-preset",reflect:true})],H.prototype,"cropPreset",2),m([w({type:String,reflect:true})],H.prototype,"tabs",2),m([C()],H.prototype,"Jo",2),m([C()],H.prototype,"pt",2);});var xl=d(()=>{Gs();ll();gl();yl();vl();cl();pl();bl();Cl();wr();El();qa();za();Ka();ml();});var Sl=d(()=>{Co();xl();});var qs,Ol=d(()=>{Gs();Zt();qs=class extends H{static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:_t.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};});function kr(r){for(let i in r){if(ap.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 ap,Ws=d(()=>{ap=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];});var Xs,Al=d(()=>{Xs=r=>r.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(i=>i.toLowerCase()).join("-");});function Ir(r){kl.has(r)||(kl.add(r),console.warn(r));}var kl,Ys=d(()=>{kl=new Set;});var lp,Il,Rl=d(()=>{mt();Ys();lp=[{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."}],Il=D(r=>{for(let{test:i,message:t}of lp)i(r)&&Ir(t);},0);});var Pl=d(()=>{});var Ml,cp,Ul,Qs,Zs=d(()=>{Ml=(r,i)=>{let t=new URL(i);return t.hostname=`${r}.${t.hostname}`,t.toString().replace(/\/$/,"")},cp="0123456789abcdefghijklmnopqrstuvwxyz",Ul=r=>{if(r<=0n)return "0";let i="";for(;r>0n;){let t=r%36n;i=cp[Number(t)]+i,r=r/36n;}return i},Qs=(r,i)=>{try{let t=new URL(r),e=new URL(i);return t.hostname.endsWith(e.hostname)}catch{return false}};});var up,dp,pp,Ll,$l=d(()=>{Zs();Zs();up=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}`)},dp=10,pp=async r=>{let i=await up(r);return Ul(i).slice(0,dp)},Ll=async(r,i)=>{let t=await pp(r);return Ml(t,i)};});var Dl,Fl=d(()=>{Dl=r=>r instanceof Promise||!!(r&&typeof r=="object"&&"then"in r&&typeof r.then=="function");});var J,Rr=d(()=>{J=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 _l,Ke,Nl,tt,Js=d(()=>{Xi();Zt();mt();Rr();j();_l="active",Ke="___ACTIVITY_IS_ACTIVE___",tt=class r extends(Nl=I,Nl){constructor(){super(...arguments);this.historyTracked=false;this.init$=vs(this);this.ha=D(this.fa.bind(this),10);}cs(){let t=r.ve.get(this);this[Ke]=false,this.removeAttribute(_l),t?.deactivateCallback?.();}ma(){let t=r.ve.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Ke]=true,this.setAttribute(_l,""),t?.activateCallback?.(),this.ha(),this.emit(R.ACTIVITY_CHANGE,{activity:this.activityType});}initCallback(){super.initCallback(),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{try{this.activityType!==t&&this[Ke]?this.cs():this.activityType===t&&!this[Ke]&&this.ma();}catch(e){this.telemetryManager.sendEventError(e,`activity "${this.activityType}"`),console.error(`Error in activity "${this.activityType}". `,e);let s=this.$["*history"][this.$["*history"].length-1];this.$["*currentActivity"]=s??null;}t||(this.$["*history"]=[]);}));}fa(){let t=this.$["*history"];t&&(t.length>10&&(t=t.slice(t.length-11,t.length-1)),this.historyTracked&&t[t.length-1]!==this.activityType&&t.push(this.activityType),this.$["*history"]=t);}ga(){return !!this.activityType&&r.ve.has(this)}static{this.ve=new Map;}get isActivityActive(){return !!this[Ke]}get couldOpenActivity(){return true}registerActivity(t,e={}){let{onActivate:s,onDeactivate:o}=e;r.ve.set(this,{activateCallback:s,deactivateCallback:o});}ya(){this.isActivityActive&&this.cs(),r.ve.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.ga()&&this.ya();let t=this.$["*currentActivity"];this.blocksRegistry&&([...this.blocksRegistry].find(s=>s instanceof r&&s.activityType===t)||(this.$["*currentActivity"]=null,this.modalManager?.closeAll()));}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")??null}get doneActivity(){return this.getCssData("--cfg-done-activity")??null}historyBack(){let t=this.$["*history"];if(t){let e=t.pop();for(;e===this.activityType;)e=t.pop();let s=!!e;e&&(s=[...this.blocksRegistry].find(n=>n.activityType===e)?.couldOpenActivity??false),e=s?e:void 0,this.$["*currentActivity"]=e??null,e&&this.modalManager?.open(e),this.$["*history"]=t,e||this.modalManager?.closeAll();}}};tt.activities=J;});var Vl,Kl,zl=d(()=>{Vl=r=>typeof r!="number"?0:Math.floor(r/1e3),Kl=(r,{threshold:i})=>{let{secureExpire:t}=r,e=Vl(Date.now()),s=Number(t),o=Vl(i);return e+o>=s};});var Pr,Bl=d(()=>{Ct();zl();Pr=class extends V{constructor(){super(...arguments);this.Dt=null;}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:s,secureUploadsExpireThreshold:o}=this.Vt;if((t||e)&&s&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),s){if(!this.Dt||Kl(this.Dt,{threshold:o})){this.Dt?this.m("Secure signature is expired. Resolving a new one..."):this.m("Secure signature is not set yet.");try{let n=await s();n?!n.secureSignature||!n.secureExpire?console.error("Secure signature resolver returned an invalid result:",n):(this.m("Secure signature resolved:",n),this.m("Secure signature will expire in",new Date(Number(n.secureExpire)*1e3).toISOString()),this.Dt=n):(this.m("Secure signature resolver returned nothing."),this.Dt=null);}catch(n){console.error("Secure signature resolving failed. Falling back to the previous one.",n),this.i.telemetryManager.sendEventError(n,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this.Dt}return t&&e?(this.m("Secure signature and expire are set. Using them...",{secureSignature:t,secureExpire:e}),{secureSignature:t,secureExpire:e}):null}destroy(){super.destroy(),this.Dt=null;}};});var to,jl=d(()=>{to=(r,i)=>{if(r.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}};});var eo,Hl=d(()=>{eo=(r,i)=>{let t=r.totalCount,e=i.cfg.multiple?i.cfg.multipleMin:0,s=i.cfg.multiple?i.cfg.multipleMax:1;if(e&&t<e)return {type:"TOO_FEW_FILES",message:i.l10n("files-count-limit-error-too-few",{min:e,max:s,total:t}),payload:{total:t,min:e,max:s}};if(s&&t>s)return {type:"TOO_MANY_FILES",message:i.l10n("files-count-limit-error-too-many",{min:e,max:s,total:t}),payload:{total:t,min:e,max:s}}};});var Gl=d(()=>{jl();Hl();});var hp,fp,mp,gp,ql,Wl,io=d(()=>{hp=()=>{let r=navigator.userAgent;return /Macintosh|Windows/.test(r)&&/Version\/[\d.]+.*Safari/.test(r)&&!/Chrome|Chromium|Edg|OPR/.test(r)},fp=()=>"capture"in document.createElement("input"),mp=()=>({safariDesktop:hp()}),gp=()=>({htmlMediaCapture:fp()}),ql=mp(),Wl=gp();});var xi,ro,yp,vp,Si,Mr,so,Xl,Yl,oo=d(()=>{io();ii();xi="image/*",ro="video/*",yp=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],vp=()=>ql.safariDesktop?[xi]:[xi,...yp],Si=vp(),Mr=r=>r?r.filter(i=>typeof i=="string").flatMap(i=>Ut(i)):[],so=(r,i)=>i.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return r.startsWith(e)}return r===t}),Xl=(r,i)=>i.some(t=>t.startsWith(".")?r.toLowerCase().endsWith(t.toLowerCase()):false),Yl=r=>{let i=r?.type;return i?so(i,Si):false};});var no,Ql=d(()=>{oo();no=(r,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,s=Mr([...t?Si:[],e]);if(!s.length)return;let o=r.mimeType,n=r.name;if(!o||!n)return;let a=so(o,s),l=Xl(n,s);if(!a&&!l)return {type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:r}}};});var ao,Zl=d(()=>{ao=(r,i)=>{let t=i.cfg.imgOnly,e=r.isImage;if(!(!t||e)&&!(!r.fileInfo&&r.externalUrl)&&!(!r.fileInfo&&!r.mimeType))return {type:"NOT_AN_IMAGE",message:i.l10n("images-only-accepted"),payload:{entry:r}}};});var St,Ce,Oi,Jl,tc=d(()=>{Ds();St=1e3,Ce=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Oi=r=>Math.ceil(r*100)/100,Jl=(r,i=Ce.AUTO)=>{let t=i===Ce.AUTO;if(i===Ce.BYTE||t&&r<St**1){let s=pr("en-US",r)==="one"?"byte":"bytes";return `${r} ${s}`}return i===Ce.KB||t&&r<St**2?`${Oi(r/St**1)} KB`:i===Ce.MB||t&&r<St**3?`${Oi(r/St**2)} MB`:i===Ce.GB||t&&r<St**4?`${Oi(r/St**3)} GB`:i===Ce.TB||t&&r<St**5?`${Oi(r/St**4)} TB`:`${Oi(r/St**5)} PB`};});var lo,ec=d(()=>{tc();lo=(r,i)=>{let t=i.cfg.maxLocalFileSizeBytes,e=r.size;if(t&&e&&e>t)return {type:"FILE_SIZE_EXCEEDED",message:i.l10n("files-max-size-limit-error",{maxFileSize:Jl(t)}),payload:{entry:r}}};});var co,ic=d(()=>{ge();co=(r,i)=>{let{internalId:t}=r;if(!i.v.hasItem(t))return;let s=i.v.read(t)?.getValue("uploadError");if(!s)return;if(s instanceof q)return {type:"UPLOAD_ERROR",message:s.message,payload:{entry:r,error:s}};if(s instanceof xe)return {type:"NETWORK_ERROR",message:s.message,payload:{entry:r,error:s}};let o=s instanceof Error?s:new Error("Unknown error",{cause:s});return {type:"UNKNOWN_ERROR",message:o.message,payload:{entry:r,error:o}}};});var rc=d(()=>{Ql();Zl();ec();ic();});var ze,bp,Ur,sc=d(()=>{ge();Zt();Ct();mt();Gl();rc();bt();ze={FILE_VALIDATION_FAILED:"File validator execution has failed",FILE_VALIDATION_TIMEOUT:"File validator execution has timed out",COLLECTION_VALIDATION_FAILED:"Collection validator execution has failed",MISSING_ERROR_MESSAGE:"Missing message. We recommend adding message: value."},bp=r=>typeof r=="function"?{runOn:"change",validator:r}:r,Ur=class extends V{constructor(t){super(t);this.va=[ao,no,lo,co];this.ba=[eo,to];this.Bt=new Ht(20);this.us=D(()=>{this.Bt.run();},500);this.bt=false;this.Xt=new Map;let e=D(()=>{this.runFileValidators("change"),this.runCollectionValidators();},0);this.addSub(this.e.sub(O("maxLocalFileSizeBytes"),e)),this.addSub(this.e.sub(O("multipleMin"),e)),this.addSub(this.e.sub(O("multipleMax"),e)),this.addSub(this.e.sub(O("multiple"),e)),this.addSub(this.e.sub(O("imgOnly"),e)),this.addSub(this.e.sub(O("accept"),e)),this.addSub(this.e.sub(O("validationConcurrency"),s=>{this.Bt.concurrency=s;}));}get v(){return this.i.uploadCollection}runFileValidators(t,e){if(this.bt)return;let s=e??this.v.items();for(let o of s){let n=this.v.read(o);n&&this.Ta(n,t);}}runCollectionValidators(){if(this.bt)return;let t=this.i.api,e=t.getOutputCollectionState(),s=[],o=this.Vt.collectionValidators;for(let n of [...this.ba,...o])try{let a=n(e,t);if(!a)continue;a&&(s.push(this.ds(a)),a.message||console.warn(ze.MISSING_ERROR_MESSAGE));}catch(a){console.warn(ze.COLLECTION_VALIDATION_FAILED,a);}this.e.pub("*collectionErrors",s),s.length>0&&this.i.eventEmitter.emit(R.COMMON_UPLOAD_FAILED,()=>t.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(t){let e=this.Xt.get(t.uid);e&&(e.abortController?.abort(),this.Xt.delete(t.uid));}async Ta(t,e){if(this.bt)return;let s=this.i.api,o=this.ps(t),n=o.promise??Promise.resolve(),a=(async()=>{if(this.bt||(await n,this.bt))return;let l=this.Ca(t,e);if(l.length===0||!this.v.hasItem(t.uid))return;t.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let c=s.getOutputItem(t.uid),p=new AbortController;o.abortController=p;let u=this.Vt.validationTimeout,h=this.hs(),f=new Set(l.map(y=>y.validator)),g=[];for(let y of h)if(!f.has(y.validator)){let E=o.lastErrorThrownByValidator.get(y.validator);E&&g.push(E);}let b=l.map(y=>async()=>{if(this.bt)return;let E=setTimeout(()=>{o.skippedValidators.add(y.validator),p.abort(),console.warn(ze.FILE_VALIDATION_TIMEOUT);},u);try{let v=await y.validator(c,s,{signal:p.signal});if(!v||p.signal.aborted){o.lastErrorThrownByValidator.set(y.validator,void 0);return}let S=this.ds(v);o.lastErrorThrownByValidator.set(y.validator,S),g.push(S),v.message||console.warn(ze.MISSING_ERROR_MESSAGE);}catch(v){p.signal.aborted||(o.skippedValidators.add(y.validator),console.warn(ze.FILE_VALIDATION_FAILED,v),this.i.telemetryManager.sendEventError(v,`file validator. ${ze.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(E),y.runOn!=="change"&&o.skippedValidators.add(y.validator);}});if(this.us(),await this.Bt.add(async()=>{this.bt||(t.setValue("isQueuedForValidation",false),await Promise.all(b.map(y=>y())).catch(()=>{}));},{autoRun:false}),p.signal.aborted){t.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}t.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:g});})();o.promise=a;try{await a;}finally{o.promise===a&&(o.promise=void 0);}}ds(t){return {...t,type:t.type??"CUSTOM_ERROR"}}ps(t){let e=this.Xt.get(t.uid);if(e)return e;let s={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this.Xt.set(t.uid,s),s}hs(){let t=this.Vt.fileValidators;return [...this.va,...t].map(bp)}Ca(t,e){let s=this.ps(t);return this.hs().filter(o=>!s.skippedValidators.has(o.validator)).filter(o=>o.runOn===e)}destroy(){this.bt=true,this.us.cancel();for(let t of this.Xt.values())t.abortController?.abort(),t.promise=void 0;this.Xt.clear();}};});var oc,Lr,nc=d(()=>{ye();Ie();oc="[Typed State] Wrong property name: ",Lr=class{constructor(i){this.z=st.generateFastUid(),this._=F.registerCtx(i,this.z);}get uid(){return this.z}setValue(i,t){if(!this._.has(i)){console.warn(`${oc}${String(i)}`);return}this._.read(i)!==t&&this._.pub(i,t);}setMultipleValues(i){for(let[t,e]of Object.entries(i))this.setValue(t,e);}getValue(i){return this._.has(i)||console.warn(`${oc}${String(i)}`),this._.read(i)}subscribe(i,t){return this._.sub(i,t)}destroy(){F.deleteCtx(this.z);}};});var $r,ac=d(()=>{ye();Ie();nc();$r=class r{constructor(i){this.Tt=Object.create(null);this.oi=new Set;this.si=new Set;this.ut=new Set;this.mr=new Set;this.gr=new Set;this.Yt=new Set;this.gs=i.initialValue,this.z=st.generateFastUid(),this._=F.registerCtx({},this.z),this.fs=i.watchList||[];let t=Object.create(null);this.ms=(e,s)=>{this.be&&window.clearTimeout(this.be),t[e]||(t[e]=new Set),t[e].add(s),this.be=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.oi.forEach(o=>{o({...t});}),t=Object.create(null));}),this.ys();},i.handler&&this.observeCollection(i.handler);}static{this.Ea=1e4;}J(){this.Te&&window.clearTimeout(this.Te),this.Te=window.setTimeout(()=>{let i=new Set(this.gr),t=new Set(this.mr);this.gr.clear(),this.mr.clear();for(let e of this.si)e?.([...this.ut],i,t);this.ys();});}ys(){this.Yt.size!==0&&(this.Ce&&window.clearTimeout(this.Ce),this.Ce=window.setTimeout(()=>{let i=[...this.Yt];this.Yt.clear();for(let t of i)t.destroy();},r.Ea));}observeCollection(i){return this.si.add(i),this.ut.size>0&&this.J(),()=>{this.unobserveCollection(i);}}unobserveCollection(i){this.si.delete(i);}add(i){let t=new Lr(this.gs);for(let[e,s]of Object.entries(i))t.setValue(e,s);return this.ut.add(t.uid),this.J(),this._.add(t.uid,t),this.gr.add(t),this.fs.forEach(e=>{this.Tt[t.uid]||(this.Tt[t.uid]=[]),this.Tt[t.uid]?.push(t.subscribe(e,()=>{this.ms(e,t.uid);}));}),t.uid}hasItem(i){return this.ut.has(i)}read(i){return this._.read(i)??null}readProp(i,t){let e=this.read(i);if(!e)throw new Error(`TypedCollection#readProp: Item with id ${i} not found`);return e.getValue(t)}publishProp(i,t,e){let s=this.read(i);if(!s)throw new Error(`TypedCollection#publishProp: Item with id ${i} not found`);s.setValue(t,e);}remove(i){let t=this.read(i);t&&(this.mr.add(t),this.Yt.add(t)),this.ut.delete(i),this.J(),this._.pub(i,void 0),this.Tt[i]?.forEach(e=>{e();}),delete this.Tt[i];}clearAll(){this.ut.forEach(i=>{this.remove(i);});}observeProperties(i){return this.oi.add(i),()=>{this.unobserveProperties(i);}}unobserveProperties(i){this.oi.delete(i);}findItems(i){let t=[];return this.ut.forEach(e=>{let s=this.read(e);s&&i(s)&&t.push(e);}),t}items(){return [...this.ut]}get size(){return this.ut.size}destroy(){this.be&&window.clearTimeout(this.be),this.Te&&window.clearTimeout(this.Te),this.Ce&&window.clearTimeout(this.Ce);for(let i of this.Yt)i.destroy();this.Yt.clear(),F.deleteCtx(this.z),this.oi=new Set,this.si=new Set;for(let i of Object.keys(this.Tt))this.Tt[i]?.forEach(t=>{t();}),delete this.Tt[i];}};});var nt,Dr=d(()=>{nt=Object.freeze({PHOTO:"photo",VIDEO:"video"});});var uo,lc=d(()=>{Wt();Dr();uo=r=>({isVideoRecordingEnabled:Tt(r.cameraModes).includes(nt.VIDEO),isPhotoEnabled:Tt(r.cameraModes).includes(nt.PHOTO)});});var po,cc=d(()=>{po=(r,i)=>{for(let t of r)if(i(t))return t};});var uc,dc=d(()=>{uc=(r,i)=>{for(let t of r)if(i(t))return true;return false};});function pc(r,i){for(let t in i)t.includes("-")?r.style.setProperty(t,String(i[t])):r.style[t]=String(i[t]);}var hc=d(()=>{});var Tp,Cp,fc,mc=d(()=>{Qt();Tp=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,Cp=new RegExp(`^/?(${Tp.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),fc=({url:r,cdnBase:i})=>{let t=new URL(i),e=new URL(si),s=new URL(r);if(t.host!==s.host&&e.host!==s.host)return null;let o=Cp.exec(s.pathname);if(!o)return null;let[,n,a,l]=o;return n?{uuid:n,cdnUrlModifiers:a||"",filename:l||null}:null};});var ho,Ep,Vt,fo=d(()=>{ho=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),Ep=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),Vt=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",DRAW:"draw",...Ep,...ho});});var Fr,mo=d(()=>{Fr=r=>r.uploadCollection.items().map(e=>r.api.getOutputItem(e));});function gc(r){let i=new Map;return (...e)=>{let s=JSON.stringify(e);if(i.has(s))return i.get(s);let o=r(...e);return i.set(s,o),o}}var yc=d(()=>{});function wp(r){let i=false;return setTimeout(()=>{i=true;},0),e=>((...s)=>(i&&Ir(r),e(...s)))}function vc(r){let i={},t=r.ctx,e={progress:()=>t.read("*commonProgress"),errors:()=>t.read("*collectionErrors"),group:()=>t.read("*groupInfo"),totalCount:()=>r.uploadCollection.size,failedCount:()=>i.failedEntries.length,successCount:()=>i.successEntries.length,uploadingCount:()=>i.uploadingEntries.length,status:()=>i.isFailed?"failed":i.isUploading?"uploading":i.isSuccess?"success":"idle",isSuccess:()=>i.allEntries.length>0&&i.errors.length===0&&i.successEntries.length===i.allEntries.length,isUploading:()=>i.allEntries.some(o=>o.status==="uploading"),isFailed:()=>i.errors.length>0||i.failedEntries.length>0,allEntries:()=>Fr(r),successEntries:()=>i.allEntries.filter(o=>o.status==="success"),failedEntries:()=>i.allEntries.filter(o=>o.status==="failed"),uploadingEntries:()=>i.allEntries.filter(o=>o.status==="uploading"),idleEntries:()=>i.allEntries.filter(o=>o.status==="idle")},s=wp("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[o,n]of Object.entries(e)){let a=o,c=gc(s(n));Object.defineProperty(i,a,{get:c,enumerable:true});}return i}var bc=d(()=>{mo();yc();Ys();});var _r,Tc=d(()=>{lc();Dr();Zt();Rr();cc();dc();Fs();ye();Ct();hc();io();Wt();oo();mc();ii();fo();bc();_r=class extends V{constructor(){super(...arguments);this.wa=hr(()=>this.e);this.addFileFromUrl=(t,{silent:e,fileName:s,source:o}={})=>{let n=this.v.add({externalUrl:t,fileName:s??null,silent:e??false,source:o??Vt.API});return this.getOutputItem(n)};this.addFileFromUuid=(t,{silent:e,fileName:s,source:o}={})=>{let n=this.v.add({uuid:t,fileName:s??null,silent:e??false,source:o??Vt.API});return this.getOutputItem(n)};this.addFileFromCdnUrl=(t,{silent:e,fileName:s,source:o}={})=>{let n=fc({url:t,cdnBase:this.cfg.cdnCname});if(!n)throw new Error("Invalid CDN URL");let a=this.v.add({uuid:n.uuid,cdnUrl:t,cdnUrlModifiers:n.cdnUrlModifiers,fileName:s??n.filename??null,silent:e??false,source:o??Vt.API});return this.getOutputItem(a)};this.addFileFromObject=(t,{silent:e,fileName:s,source:o,fullPath:n}={})=>{let a=this.v.add({file:t,isImage:Yl(t),mimeType:t.type,fileName:s??t.name,fileSize:t.size,silent:e??false,source:o??Vt.API,fullPath:n??null});return this.getOutputItem(a)};this.removeFileByInternalId=t=>{if(!this.v.read(t))throw new Error(`File with internalId ${t} not found`);this.v.remove(t);};this.uploadAll=()=>{let t=this.v.items().filter(e=>{let s=this.v.read(e);return s?!s.getValue("isRemoved")&&!s.getValue("isUploading")&&!s.getValue("fileInfo")&&s.getValue("errors").length===0&&!s.getValue("isValidationPending")&&!s.getValue("isQueuedForValidation"):false});t.length!==0&&(this.e.pub("*uploadTrigger",new Set(t)),this.i.eventEmitter.emit(R.COMMON_UPLOAD_START,this.getOutputCollectionState()));};this.openSystemDialog=(t={})=>{let e=Mt(Mr([this.cfg.accept??"",...this.cfg.imgOnly?Si:[]])),s="uploadcare-file-input",o=document.createElement("input");if(o.setAttribute(s,""),pc(o,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),o.type="file",o.multiple=this.cfg.multiple,t.captureCamera){o.capture=this.cfg.cameraCapture;let{isPhotoEnabled:n,isVideoRecordingEnabled:a}=uo(this.cfg);t.modeCamera===nt.PHOTO&&n?o.accept=xi:t.modeCamera===nt.VIDEO&&a?o.accept=ro:o.accept=[xi,a&&ro].filter(Boolean).join(",");}else o.accept=e;o.addEventListener("change",()=>{o.files&&([...o.files].forEach(n=>{this.addFileFromObject(n,{source:t.captureCamera?Vt.CAMERA:Vt.LOCAL});}),this.e.pub("*currentActivity",J.UPLOAD_LIST),this.i.modalManager?.open(J.UPLOAD_LIST),o.remove());},{once:true}),document.querySelectorAll(`[${s}]`).forEach(n=>{n.remove();}),document.body.appendChild(o),o.dispatchEvent(new MouseEvent("click"));};this.initFlow=(t=false)=>{if(this.v.size>0&&!t)this.e.pub("*currentActivity",J.UPLOAD_LIST),this.i.modalManager?.open(J.UPLOAD_LIST);else if(this.vs?.length===1){let e=this.vs[0];if(e==="local"){this.e.pub("*currentActivity",J.UPLOAD_LIST),this.openSystemDialog();return}if(e==="camera"&&Wl.htmlMediaCapture){let{isPhotoEnabled:a,isVideoRecordingEnabled:l}=uo(this.cfg);if(a&&l){this.e.pub("*currentActivity",J.START_FROM);return}else if(a||l){this.openSystemDialog({captureCamera:true,modeCamera:a?nt.PHOTO:nt.VIDEO});return}else this.openSystemDialog({captureCamera:true,modeCamera:nt.PHOTO});}let s=this.i.blocksRegistry;po(s,a=>"type"in a&&a.type===e)?.activate(),this.e.read("*currentActivity")&&this.i.modalManager?.open(this.e.read("*currentActivity"));}else this.e.pub("*currentActivity",J.START_FROM),this.i.modalManager?.open(J.START_FROM);};this.doneFlow=()=>{let t=po(this.i.blocksRegistry,e=>"doneActivity"in e);t&&(this.e.pub("*currentActivity",t.doneActivity),this.e.pub("*history",t.doneActivity?[t.doneActivity]:[]),this.e.read("*currentActivity")||this.i.modalManager?.closeAll());};this.setCurrentActivity=(t,...e)=>{setTimeout(()=>{if(uc(this.i.blocksRegistry,s=>s.activityType===t)){this.e.pub("*currentActivityParams",e[0]??{}),this.e.pub("*currentActivity",t);return}console.warn(`Activity type "${t}" not found in the context`);});};this.getCurrentActivity=()=>this.e.read("*currentActivity");this.setModalState=t=>{setTimeout(()=>{if(t&&!this.e.read("*currentActivity")){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}t?this.i.modalManager?.open(this.e.read("*currentActivity")):(this.i.modalManager?.close(this.e.read("*currentActivity")),this.e.pub("*currentActivity",null));});};}get v(){return this.i.uploadCollection}get cfg(){return this.Vt}get l10n(){return this.wa}removeAllFiles(){this.v.clearAll();}getOutputItem(t){let e=F.getCtx(t);if(!e)throw new Error(`UploaderPublicApi#getOutputItem: Entry with ID "${t}" not found in the upload collection`);let s=e.store,o=s.fileInfo,n=s.isRemoved?"removed":s.errors.length>0?"failed":s.fileInfo?"success":s.isUploading?"uploading":"idle";return {uuid:o?.uuid??s.uuid??null,internalId:t,name:o?.originalFilename??s.fileName,size:o?.size??s.fileSize,isImage:o?.isImage??s.isImage,mimeType:o?.mimeType??s.mimeType,file:s.file,externalUrl:s.externalUrl,cdnUrlModifiers:s.cdnUrlModifiers,cdnUrl:s.cdnUrl??o?.cdnUrl??null,fullPath:s.fullPath,uploadProgress:s.uploadProgress,fileInfo:o??null,metadata:s.metadata??o?.metadata??null,isSuccess:n==="success",isUploading:n==="uploading",isFailed:n==="failed",isRemoved:n==="removed",isValidationPending:s.isValidationPending,errors:s.errors,status:n,source:s?.source}}getOutputCollectionState(){return vc(this.i)}get vs(){let t=[];return this.cfg.sourceList&&(t=Ut(this.cfg.sourceList)),t}};});var Cc,Ec=d(()=>{Cc={file:null,externalUrl:null,fileName:null,fileSize:null,lastModified:Date.now(),uploadProgress:0,uuid:null,isImage:false,mimeType:null,ctxName:null,cdnUrl:null,cdnUrlModifiers:null,fileInfo:null,isUploading:false,abortController:null,thumbUrl:null,silent:false,source:null,fullPath:null,metadata:null,errors:[],uploadError:null,isRemoved:false,isQueuedForUploading:false,isValidationPending:false,isQueuedForValidation:false};});function wc(r){return ps({...r,libraryName:Jt,libraryVersion:te})}var xc=d(()=>{ge();ni();});var Be,Sc=d(()=>{ge();Xi();Bl();sc();ac();Tc();Ec();Tr();Ks();Zt();Xt();mt();fo();xc();mo();Js();ye();Be=class r extends tt{constructor(){super(...arguments);this.couldBeCtxOwner=false;this.ni=false;this.init$=bn(this);this.br=D(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(R.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this.ka(e);},300);this.Oa=(t,e,s)=>{if(this.isConnected){(e.size||s.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators("add",[...e].map(o=>o.uid));for(let o of e)o.getValue("silent")||this.emit(R.FILE_ADDED,this.api.getOutputItem(o.uid));this.validationManager.runCollectionValidators();for(let o of s){this.$["*uploadTrigger"].delete(o.uid),this.validationManager.cleanupValidationForEntry(o),o.getValue("abortController")?.abort(),o.setMultipleValues({isRemoved:true,abortController:null,isUploading:false,uploadProgress:0});let n=o?.getValue("thumbUrl");n&&URL.revokeObjectURL(n),this.emit(R.FILE_REMOVED,this.api.getOutputItem(o.uid));}this.$["*uploadList"]=t.map(o=>({uid:o})),this.Cs(),this.br();}};this.Aa=t=>{if(!this.isConnected)return;this.br();let e=this.uploadCollection,s=[...new Set(Object.entries(t).filter(([o])=>["uploadError","fileInfo","cdnUrl","cdnUrlModifiers"].includes(o)).flatMap(([,o])=>[...o]))];if(s.length>0&&setTimeout(()=>{if(!this.isConnected)return;let o=s.filter(n=>t.fileInfo?.has(n)&&!!F.getCtx(n)?.store.fileInfo);o.length>0&&this.validationManager.runFileValidators("upload",o),this.validationManager.runFileValidators("change",s);}),t.uploadProgress){for(let o of t.uploadProgress){let n=F.getCtx(o);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(R.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(o));}this.Cs();}if(t.isUploading)for(let o of t.isUploading){let n=F.getCtx(o);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(R.FILE_UPLOAD_START,this.api.getOutputItem(o));}if(t.fileInfo){for(let o of t.fileInfo){let n=F.getCtx(o);if(!n)continue;let{fileInfo:a,silent:l}=n.store;a&&!l&&this.emit(R.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(o));}this.cfg.cropPreset&&this.Ia(),this.cfg.cloudImageEditorAutoOpen&&this.Ra();}if(t.errors){this.validationManager.runCollectionValidators();for(let a of t.errors){let l=F.getCtx(a);if(!l)continue;let{errors:c}=l.store;c.length>0&&(this.emit(R.FILE_UPLOAD_FAILED,this.api.getOutputItem(a)),this.emit(R.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let o=e.findItems(a=>!!a.getValue("fileInfo")),n=e.findItems(a=>a.getValue("errors").length>0);e.size>0&&n.length===0&&e.size===o.length&&this.$["*collectionErrors"].length===0&&this.emit(R.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}t.cdnUrl&&([...t.cdnUrl].filter(n=>!!this.uploadCollection.read(n)?.getValue("cdnUrl")).forEach(n=>{this.emit(R.FILE_URL_CHANGED,this.api.getOutputItem(n));}),this.$["*groupInfo"]=null);};this.Cs=()=>{let t=0,s=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));s.forEach(n=>{let a=this.uploadCollection.readProp(n,"uploadProgress");typeof a=="number"&&(t+=a);});let o=s.length?Math.round(t/s.length):0;this.$["*commonProgress"]!==o&&(this.$["*commonProgress"]=o,this.emit(R.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}get xa(){return this.hasBlockInCtx(t=>t instanceof r?t.ni&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this.W("*uploadCollection",()=>new $r({initialValue:Cc,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]})),this.W("*secureUploadsManager",t=>new Pr(t)),this.W("*validationManager",t=>new Ur(t)),this.W("*publicApi",t=>new _r(t)),!this.xa&&this.couldBeCtxOwner&&this.Sa();}getAPI(){return this.api}get validationManager(){return this.et("*validationManager")}get api(){return this.et("*publicApi")}get uploadCollection(){return this.et("*uploadCollection")}get secureUploadsManager(){return this.et("*secureUploadsManager")}disconnectedCallback(){super.disconnectedCallback(),this.ni&&this.bs(),this.br.cancel();}connectedCallback(){super.connectedCallback(),this.ni&&this.Ts();}Sa(){this.ni=true,this.Ts(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}Ts(){this.bs(),this.yr=this.uploadCollection.observeCollection(this.Oa),this.vr=this.uploadCollection.observeProperties(this.Aa);}bs(){this.vr?.(),this.yr?.(),this.vr=void 0,this.yr=void 0;}async ka(t){let e=await this.getUploadClientOptions(),s=t.allEntries.map(l=>l.uuid+(l.cdnUrlModifiers?`/${l.cdnUrlModifiers}`:"")),o=new AbortController,n=await vn(s,{...e,signal:o.signal});if(this.$["*collectionState"]!==t){o.abort();return}this.$["*groupInfo"]=n;let a=this.api.getOutputCollectionState();this.emit(R.GROUP_CREATED,a),this.emit(R.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.$["*collectionState"]=a;}Ra(){let[t]=this.uploadCollection.findItems(e=>!!e.getValue("fileInfo")&&e.getValue("isImage")).map(e=>this.uploadCollection.read(e));t&&this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(e=>e.activityType===tt.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:t.uid},this.$["*currentActivity"]=tt.activities.CLOUD_IMG_EDIT,this.modalManager?.open(tt.activities.CLOUD_IMG_EDIT));}Ia(){let t=yr(this.cfg.cropPreset);if(t){let[e]=t,s=this.uploadCollection.findItems(o=>!!o.getValue("fileInfo")&&o.getValue("isImage")&&!o.getValue("cdnUrlModifiers")?.includes("/crop/")).map(o=>this.uploadCollection.read(o)).filter(Boolean);for(let o of s){let n=o.getValue("fileInfo");if(!n||!n.imageInfo){console.warn("Failed to get image info for entry",o.uid);continue}let{width:a,height:l}=n.imageInfo,c=typeof e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,p=ol(a,l,c),u=ut(`crop/${p.width}x${p.height}/${p.x},${p.y}`,"preview"),h=o.getValue("cdnUrl");if(!h){console.warn("Failed to get cdnUrl for entry",o.uid);continue}o.setMultipleValues({cdnUrlModifiers:u,cdnUrl:dt(h,u)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(f=>f.activityType===tt.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:o.uid},this.$["*currentActivity"]=tt.activities.CLOUD_IMG_EDIT,this.modalManager?.open(tt.activities.CLOUD_IMG_EDIT));}}}async getMetadataFor(t){let e=this.cfg.metadata||void 0;if(typeof e=="function"){let s=this.api.getOutputItem(t);return await e(s)}return e}async getUploadClientOptions(){let t=await this.secureUploadsManager.getSecureToken().catch(()=>null);return {store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:wc,integration:this.cfg.userAgentIntegration,secureSignature:t?.secureSignature,secureExpire:t?.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:this.cfg.retryNetworkErrorMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads}}getOutputData(){return Fr(this.i)}};Be.extSrcList=Object.freeze({...ho});Be.sourceTypes=Object.freeze({...Vt});});var Oc=d(()=>{});var Ac={};Hr(Ac,{CloudImageEditorActivity:()=>Nr});var Nr,kc=d(()=>{z();N();Le();Js();Sc();Oc();Nr=class extends Be{constructor(){super(...arguments);this.K=null;}get activityParams(){let t=super.activityParams;if("internalId"in t)return t;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.subConfigValue("cropPreset",t=>{this.K&&this.K.cropPreset!==t&&(this.K={...this.K,cropPreset:t});}),this.subConfigValue("cloudImageEditorTabs",t=>{this.K&&this.K.tabs!==t&&(this.K={...this.K,tabs:t});}),this.Pa();}disconnectedCallback(){super.disconnectedCallback(),this.Ma();}hr(t){if(!this.Ee)return;this.debugPrint('editor event "apply"',t.detail);let e=t.detail;this.Ee.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.modalManager?.close(tt.activities.CLOUD_IMG_EDIT),this.historyBack();}pr(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close(tt.activities.CLOUD_IMG_EDIT),this.historyBack();}handleChange(t){this.debugPrint('editor event "change"',t.detail);}Pa(){let{internalId:t}=this.activityParams,e=this.uploadCollection.read(t);if(!e)throw new Error(`Entry with internalId "${t}" not found`);this.Ee=e;let s=this.Ee.getValue("cdnUrl");if(!s)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);this.K=this.Ua(s);}Ma(){this.Ee=void 0,this.K=null;}render(){if(!this.K)return k;let{cdnUrl:t,cropPreset:e,tabs:s}=this.K;return T`<uc-cloud-image-editor cdn-url=${t} crop-preset=${_(e)} tabs=${_(s)} @apply=${this.hr} @cancel=${this.pr} @change=${this.handleChange} ></uc-cloud-image-editor>`}Ua(t){return {cdnUrl:t,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}};m([C()],Nr.prototype,"K",2);});var Rc={};Hr(Rc,{cloudImageEditorPlugin:()=>Ic,default:()=>kp});var xp,Sp,Op,Ap,Ic,kp,Pc=d(()=>{Ws();Rr();xp="cloud-image-editor",Sp="<svg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></svg>",Op={en:{"edit-image":"Edit image","edit-detail":"Details","file-item-edit-button":"Edit","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","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}}","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop","cancel-edit":"Cancel edit",back:"Back",apply:"Apply",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",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","tab-view":"Preview","tab-details":"Details"}},Ap=async()=>{let[r,i]=await Promise.all([Promise.resolve().then(()=>(Uc(),Mc)),Promise.resolve().then(()=>(kc(),Ac))]);kr({...r,...i});},Ic={id:xp,version:"0.1.0",setup:async({pluginApi:r,uploaderApi:i})=>{await Ap(),r.registry.registerIcon({name:"edit-file",svg:Sp}),r.registry.registerI18n(Op),r.registry.registerFileAction({id:"edit-file",icon:"edit-file",shouldRender:t=>!!(t.isSuccess&&t.isImage&&t.cdnUrl),onClick:t=>{i.setCurrentActivity?.(J.CLOUD_IMG_EDIT,{internalId:t.internalId}),i.setModalState?.(true);}}),r.registry.registerActivity({id:J.CLOUD_IMG_EDIT,render:t=>{let e=document.createElement("uc-cloud-image-editor-activity");return t.append(e),()=>{t.replaceChildren();}}});}},kp=Ic;});var Vr,Ip,Lc,$c=d(()=>{$l();Wt();Fl();Qt();Vr=r=>r,Ip=[Vr({key:"cameraModes",deps:["enableVideoRecording"],fn:({cameraModes:r,enableVideoRecording:i})=>{if(i===null)return r;let t=Tt(r);return i&&!t.includes("video")?t=t.concat("video"):i||(t=t.filter(e=>e!=="video")),Mt(t)}}),Vr({key:"cameraModes",deps:["defaultCameraMode"],fn:({cameraModes:r,defaultCameraMode:i})=>{if(i===null)return r;let t=Tt(r);return t=t.sort((e,s)=>e===i?-1:s===i?1:0),Mt(t)}}),Vr({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:({pubkey:r,cdnCname:i,cdnCnamePrefixed:t})=>r&&(i===si||Qs(i,t))?Ll(r,t):i}),Vr({key:"plugins",deps:["useCloudImageEditor"],fn:async({plugins:r,useCloudImageEditor:i},{signal:t})=>{let e="cloud-image-editor",s=Array.isArray(r)?r.filter(o=>o?.id!==e):[];if(!i)return s;try{let o=await Promise.resolve().then(()=>(Pc(),Rc));if(t.aborted)return s;let n=o.cloudImageEditorPlugin??o.default;return n?s.some(a=>a.id===n.id)?s:[...s,n]:(console.warn("[CloudImageEditorPlugin] Plugin module did not export a plugin"),s)}catch(o){return t.aborted||console.warn("[CloudImageEditorPlugin] Failed to load plugin",o),s}}})],Lc=({key:r,setValue:i,getValue:t,computationControllers:e})=>{for(let s of Ip)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}Dl(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 M,G,$,Dc,Fc,_c,Nc,Vc,go,Kr,zr,Kc,zc=d(()=>{Wt();Dr();M=r=>String(r),G=r=>{let i=Number(r);if(Number.isNaN(i))throw new Error(`Invalid number: "${r}"`);return i},$=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}"`)},Dc=r=>r==="auto"?r:$(r),Fc=r=>{let i=M(r);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},_c=r=>{let i=M(r);if(!Object.values(nt).includes(i))throw new Error(`Invalid value: "${i}"`);return i},Nc=r=>{let i=M(r),t=Tt(i);if(t.some(e=>!Object.values(nt).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},Vc=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.")},go=r=>{if(typeof r=="object")return r;throw new Error("Invalid value. Must be an object.")},Kr=r=>{if(typeof r=="function")return r;throw new Error("Invalid value. Must be a function.")},zr=r=>{if(Array.isArray(r))return r;throw new Error("Must be an array.")},Kc=r=>{let i=M(r);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)};});var Rp,Bc,jc=d(()=>{Qt();zc();Rp={pubkey:M,multiple:$,multipleMin:G,multipleMax:G,confirmUpload:$,imgOnly:$,accept:M,externalSourcesPreferredTypes:M,externalSourcesEmbedCss:M,store:Dc,cameraMirror:$,cameraCapture:Fc,sourceList:M,topLevelOrigin:M,maxLocalFileSizeBytes:G,thumbSize:G,showEmptyList:$,useLocalImageEditor:$,useCloudImageEditor:$,cloudImageEditorTabs:M,removeCopyright:$,cropPreset:M,imageShrink:M,modalScrollLock:$,modalBackdropStrokes:$,sourceListWrap:$,remoteTabSessionKey:M,cdnCname:M,cdnCnamePrefixed:M,baseUrl:M,socialBaseUrl:M,secureSignature:M,secureExpire:M,secureDeliveryProxy:M,retryThrottledRequestMaxTimes:G,retryNetworkErrorMaxTimes:G,multipartMinFileSize:G,multipartChunkSize:G,maxConcurrentRequests:G,multipartMaxConcurrentRequests:G,multipartMaxAttempts:G,checkForUrlDuplicates:$,saveUrlForRecurrentUploads:$,groupOutput:$,userAgentIntegration:M,debug:$,localeName:M,metadata:Vc,secureUploadsExpireThreshold:G,localeDefinitionOverride:r=>go(r),secureUploadsSignatureResolver:r=>Kr(r),secureDeliveryProxyUrlResolver:r=>Kr(r),iconHrefResolver:r=>Kr(r),plugins:r=>zr(r),fileValidators:zr,collectionValidators:zr,validationTimeout:G,validationConcurrency:G,cameraModes:Nc,defaultCameraMode:_c,enableAudioRecording:$,enableVideoRecording:$,mediaRecorderOptions:go,maxVideoRecordingDuration:G,filesViewMode:Kc,gridShowFileNames:$,cloudImageEditorAutoOpen:$,cloudImageEditorMaskHref:M,testMode:$,qualityInsights:$},Bc=(r,i)=>{if(!(typeof i>"u"||i===null))try{return Rp[r](i)}catch(t){return console.error(`Invalid value for config key "${r}".`,t),B[r]}};});var Br,Pp,Gc,vo,yo,Hc,Ai,qc=d(()=>{bt();Al();Rl();Pl();j();$c();Qt();jc();Br=[...new Set(["debug",...Object.keys(B)])],Pp=["metadata","plugins","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],Gc=r=>Pp.includes(r),vo=Br.filter(r=>!Gc(r)),yo={...Object.fromEntries(vo.map(r=>[Xs(r),r])),...Object.fromEntries(vo.map(r=>[r.toLowerCase(),r]))},Hc=r=>`__${r}`,Ai=class extends I{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(B).map(([t,e])=>[O(t),e]))};this.La=new Map;this.li={};this.Es=new Set;this.Qt=new Map;}Tr(t){return this.Es.has(t)}xs(t){let e=this.i.pluginManager;if(e)return e.configRegistry.get(t)}Ss(t){return [...new Set([Xs(t),t.toLowerCase()])]}Da(t,e){if(Gc(t)||this.Tr(t)&&this.xs(t)?.attribute===false)return;let s=this.Ss(t);for(let o of s)typeof e>"u"||e===null?this.removeAttribute(o):this.getAttribute(o)!==e.toString()&&this.setAttribute(o,e.toString());}Fa(t,e){let s=O(t);if(this.$[s]!==e)if(typeof e>"u"||e===null){let o=B[t];this.$[s]=o!==void 0?o:e;}else this.$[s]=e;}Ft(t,e){let s;this.Tr(t)?s=this.xs(t)?.normalize?.(e)??e:s=Bc(t,e);let o=this,n=Hc(t);o[n]!==s&&(this._a(t,o[n],s),o[n]=s,this.Da(t,s),this.Fa(t,s),this.debugPrint(`"${t}"`,s),this.Tr(t)||Il(this.cfg));}ci(t){let e=this,s=Hc(t);return e[s]??this.$[O(t)]}_a(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));}Os(t){let e=t.configRegistry.getAll();this.li={},this.Es=new Set(e.keys());for(let[s,o]of this.Qt)e.has(s)||(o(),this.Qt.delete(s));for(let[s,o]of e){let a=O(s);if(o.attribute){let c=this.Ss(s);for(let p of c)this.li[p]=s;}this.sharedCtx.has(a)||this.sharedCtx.add(a,o.defaultValue);let l=Object.getOwnPropertyDescriptor(this,s);if((!l||!l.set||!l.get)&&Object.defineProperty(this,s,{set:c=>{this.Ft(s,c);},get:()=>this.ci(s),enumerable:true,configurable:true}),!this.Qt.has(s)){let c=this.sub(a,p=>{this.Ft(s,p);},false);this.Qt.set(s,c);}}}$a(){this.i.when("pluginManager",t=>{this.Os(t),this.ai=t.onPluginsChange(()=>{this.Os(t);});});}Na(){this.we=new MutationObserver(t=>{for(let e of t)if(e.type==="attributes"&&e.attributeName){let s=e.attributeName,o=e.oldValue,n=this.getAttribute(s);if(o===n||s in yo)continue;s in this.li&&this.attributeChangedCallback(s,o??"",n??"");}}),this.we.observe(this,{attributes:true,attributeOldValue:true});}initCallback(){super.initCallback();let t=this;this.$a(),this.Na();for(let e of vo)this.sub(O(e),s=>{this.Ft(e,s);},false);for(let e of Br){let s=t[e]??this.$[O(e)];s!==B[e]&&this.Ft(e,s);let o=Object.getOwnPropertyDescriptor(this,e);(!o||!o.set||!o.get)&&Object.defineProperty(this,e,{set:n=>{this.Ft(e,n);},get:()=>this.ci(e)});}for(let e of Br)this.sub(O(e),()=>{Lc({key:e,setValue:this.Ft.bind(this),getValue:this.ci.bind(this),computationControllers:this.La});});}attributeChangedCallback(t,e,s){if(super.attributeChangedCallback(t,e,s),e===s)return;let o=this,n=yo[t];n?o[n]=s:this.i.when("pluginManager",a=>{if(this.getAttribute(t)!==s)return;let l=this.li[t],c=l?a.configRegistry.get(l):void 0;if(l&&c){let p=c.fromAttribute?c.fromAttribute(s):s;if(this.ci(l)===p)return;this.Ft(l,p);}});}disconnectedCallback(){super.disconnectedCallback(),this.ai&&(this.ai(),this.ai=void 0),this.we&&(this.we.disconnect(),this.we=void 0);for(let t of this.Qt.values())t();this.Qt.clear();}static get observedAttributes(){let t=super.observedAttributes,e=Object.keys(yo);return [...t,...e]}};for(let r of Br)Ai.prototype[r]=void 0;});var Mc={};Hr(Mc,{BtnUi:()=>ot,CloudImageEditor:()=>qs,CloudImageEditorBlock:()=>H,Config:()=>Ai,CropFrame:()=>mi,EditorAspectRatioButtonControl:()=>Ti,EditorCropButtonControl:()=>Ci,EditorFilterControl:()=>Nt,EditorFreeformButtonControl:()=>Ar,EditorImageCropper:()=>gi,EditorImageFader:()=>Er,EditorOperationControl:()=>Ei,EditorScroller:()=>wi,EditorSlider:()=>vi,EditorToolbar:()=>Z,Icon:()=>be,LineLoaderUi:()=>ui,PresenceToggle:()=>Ue,SliderUi:()=>wt,defineComponents:()=>kr});var Uc=d(()=>{To();Sl();Ol();Ws();qc();Ga();});Uc();/*! For license information please see uc-cloud-image-editor.min.js.LEGAL.txt */
8
+ export{ot as BtnUi,qs as CloudImageEditor,H as CloudImageEditorBlock,Ai as Config,mi as CropFrame,Ti as EditorAspectRatioButtonControl,Ci as EditorCropButtonControl,Nt as EditorFilterControl,Ar as EditorFreeformButtonControl,gi as EditorImageCropper,Er as EditorImageFader,Ei as EditorOperationControl,wi as EditorScroller,vi as EditorSlider,Z as EditorToolbar,be as Icon,ui as LineLoaderUi,Ue as PresenceToggle,wt as SliderUi,kr as defineComponents};