@uploadcare/file-uploader 1.30.0-alpha.3 → 1.30.0-alpha.6
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.
- package/README.md +2 -0
- package/dist/abstract/loadFileUploaderFrom.js +2 -2
- package/dist/env.js +3 -3
- package/dist/index.css +4 -4
- package/dist/index.d.ts +791 -308
- package/dist/index.js +5 -5
- package/dist/index.layered.css +3 -3
- package/dist/index.ssr.js +324 -42
- package/dist/locales/file-uploader/ar.d.ts +7 -2
- package/dist/locales/file-uploader/ar.js +3 -3
- package/dist/locales/file-uploader/az.d.ts +7 -2
- package/dist/locales/file-uploader/az.js +3 -3
- package/dist/locales/file-uploader/ca.d.ts +7 -2
- package/dist/locales/file-uploader/ca.js +3 -3
- package/dist/locales/file-uploader/cs.d.ts +7 -2
- package/dist/locales/file-uploader/cs.js +3 -3
- package/dist/locales/file-uploader/da.d.ts +7 -2
- package/dist/locales/file-uploader/da.js +3 -3
- package/dist/locales/file-uploader/de.d.ts +7 -2
- package/dist/locales/file-uploader/de.js +3 -3
- package/dist/locales/file-uploader/el.d.ts +7 -2
- package/dist/locales/file-uploader/el.js +3 -3
- package/dist/locales/file-uploader/en.d.ts +7 -2
- package/dist/locales/file-uploader/en.js +3 -3
- package/dist/locales/file-uploader/es.d.ts +7 -2
- package/dist/locales/file-uploader/es.js +3 -3
- package/dist/locales/file-uploader/et.d.ts +7 -2
- package/dist/locales/file-uploader/et.js +3 -3
- package/dist/locales/file-uploader/fi.d.ts +7 -2
- package/dist/locales/file-uploader/fi.js +3 -3
- package/dist/locales/file-uploader/fr.d.ts +7 -2
- package/dist/locales/file-uploader/fr.js +3 -3
- package/dist/locales/file-uploader/he.d.ts +7 -2
- package/dist/locales/file-uploader/he.js +3 -3
- package/dist/locales/file-uploader/hy.d.ts +7 -2
- package/dist/locales/file-uploader/hy.js +3 -3
- package/dist/locales/file-uploader/is.d.ts +7 -2
- package/dist/locales/file-uploader/is.js +3 -3
- package/dist/locales/file-uploader/it.d.ts +7 -2
- package/dist/locales/file-uploader/it.js +3 -3
- package/dist/locales/file-uploader/ja.d.ts +7 -2
- package/dist/locales/file-uploader/ja.js +3 -3
- package/dist/locales/file-uploader/ka.d.ts +7 -2
- package/dist/locales/file-uploader/ka.js +3 -3
- package/dist/locales/file-uploader/kk.d.ts +7 -2
- package/dist/locales/file-uploader/kk.js +3 -3
- package/dist/locales/file-uploader/ko.d.ts +7 -2
- package/dist/locales/file-uploader/ko.js +3 -3
- package/dist/locales/file-uploader/lv.d.ts +7 -2
- package/dist/locales/file-uploader/lv.js +3 -3
- package/dist/locales/file-uploader/nb.d.ts +7 -2
- package/dist/locales/file-uploader/nb.js +3 -3
- package/dist/locales/file-uploader/nl.d.ts +7 -2
- package/dist/locales/file-uploader/nl.js +3 -3
- package/dist/locales/file-uploader/pl.d.ts +7 -2
- package/dist/locales/file-uploader/pl.js +3 -3
- package/dist/locales/file-uploader/pt.d.ts +7 -2
- package/dist/locales/file-uploader/pt.js +3 -3
- package/dist/locales/file-uploader/ro.d.ts +7 -2
- package/dist/locales/file-uploader/ro.js +3 -3
- package/dist/locales/file-uploader/ru.d.ts +7 -2
- package/dist/locales/file-uploader/ru.js +3 -3
- package/dist/locales/file-uploader/sk.d.ts +7 -2
- package/dist/locales/file-uploader/sk.js +3 -3
- package/dist/locales/file-uploader/sr.d.ts +7 -2
- package/dist/locales/file-uploader/sr.js +3 -3
- package/dist/locales/file-uploader/sv.d.ts +7 -2
- package/dist/locales/file-uploader/sv.js +3 -3
- package/dist/locales/file-uploader/tr.d.ts +7 -2
- package/dist/locales/file-uploader/tr.js +3 -3
- package/dist/locales/file-uploader/uk.d.ts +7 -2
- package/dist/locales/file-uploader/uk.js +3 -3
- package/dist/locales/file-uploader/vi.d.ts +7 -2
- package/dist/locales/file-uploader/vi.js +3 -3
- package/dist/locales/file-uploader/zh-TW.d.ts +7 -2
- package/dist/locales/file-uploader/zh-TW.js +3 -3
- package/dist/locales/file-uploader/zh.d.ts +7 -2
- package/dist/locales/file-uploader/zh.js +3 -3
- package/package.json +29 -29
- package/web/file-uploader.iife.min.d.ts +798 -310
- package/web/file-uploader.iife.min.js +4 -4
- package/web/file-uploader.iife.min.js.LEGAL.txt +2 -1
- package/web/file-uploader.min.d.ts +798 -310
- package/web/file-uploader.min.js +4 -4
- package/web/file-uploader.min.js.LEGAL.txt +2 -1
- package/web/uc-basic.layered.min.css +3 -3
- package/web/uc-basic.min.css +4 -4
- package/web/uc-cloud-image-editor.layered.min.css +3 -3
- package/web/uc-cloud-image-editor.min.css +3 -3
- package/web/uc-cloud-image-editor.min.d.ts +756 -268
- package/web/uc-cloud-image-editor.min.js +4 -4
- package/web/uc-file-uploader-inline.layered.min.css +3 -3
- package/web/uc-file-uploader-inline.min.css +4 -4
- package/web/uc-file-uploader-inline.min.d.ts +798 -310
- package/web/uc-file-uploader-inline.min.js +4 -4
- package/web/uc-file-uploader-inline.min.js.LEGAL.txt +2 -1
- package/web/uc-file-uploader-minimal.layered.min.css +3 -3
- package/web/uc-file-uploader-minimal.min.css +4 -4
- package/web/uc-file-uploader-minimal.min.d.ts +798 -310
- package/web/uc-file-uploader-minimal.min.js +4 -4
- package/web/uc-file-uploader-minimal.min.js.LEGAL.txt +2 -1
- package/web/uc-file-uploader-regular.layered.min.css +3 -3
- package/web/uc-file-uploader-regular.min.css +4 -4
- package/web/uc-file-uploader-regular.min.d.ts +798 -310
- package/web/uc-file-uploader-regular.min.js +4 -4
- package/web/uc-file-uploader-regular.min.js.LEGAL.txt +2 -1
- package/web/uc-img.min.js +3 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var UC=(function(exports){'use strict';/**
|
|
2
2
|
* @license
|
|
3
|
-
* Package: @uploadcare/file-uploader@1.30.0-alpha.
|
|
3
|
+
* Package: @uploadcare/file-uploader@1.30.0-alpha.6 (MIT)
|
|
4
4
|
* License: https://github.com/uploadcare/blob/main/LICENSE
|
|
5
|
-
* Built: 2026-
|
|
5
|
+
* Built: 2026-05-08T00:44:42.050Z
|
|
6
6
|
*/
|
|
7
|
-
var Is=Object.defineProperty;var vl=Object.getOwnPropertyDescriptor;var a=(r,i)=>Is(r,"name",{value:i,configurable:true});var h=(r,i,t,e)=>{for(var o=e>1?void 0:e?vl(i,t):i,s=r.length-1,n;s>=0;s--)(n=r[s])&&(o=(e?n(i,t,o):n(o))||o);return e&&o&&Is(i,t,o),o};var St=[],Yt=0,Mi=4,Ls=a(r=>{let i=[],t={get(){return t.lc||t.listen(()=>{})(),t.value},lc:0,listen(e){return t.lc=i.push(e),()=>{for(let s=Yt+Mi;s<St.length;)St[s]===e?St.splice(s,Mi):s+=Mi;let o=i.indexOf(e);~o&&(i.splice(o,1),--t.lc||t.off());}},notify(e,o){let s=!St.length;for(let n of i)St.push(n,t.value,e,o);if(s){for(Yt=0;Yt<St.length;Yt+=Mi)St[Yt](St[Yt+1],St[Yt+2],St[Yt+3]);St.length=0;}},off(){},set(e){let o=t.value;o!==e&&(t.value=e,t.notify(o));},subscribe(e){let o=t.listen(e);return e(t.value),o},value:r};return t},"atom");function Oi(r,i,t){let e=new Set(i).add(void 0);return r.listen((o,s,n)=>{e.has(n)&&t(o,s,n);})}a(Oi,"listenKeys");function ro(r,i,t){let e=Oi(r,i,t);return t(r.value),e}a(ro,"subscribeKeys");var oo=a((r={})=>{let i=Ls(r);return i.setKey=function(t,e){let o=i.value;typeof e>"u"&&t in i.value?(i.value={...i.value},delete i.value[t],i.notify(o,t)):i.value[t]!==e&&(i.value={...i.value,[t]:e},i.notify(o,t));},i},"map");var z=class r{static{a(this,"PubSub");}static{this.Ve=new Map;}constructor(i,t){this.tt=i,this.yt=t;}get id(){return this.tt}pub(i,t){i in this.yt.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.yt.setKey(i,t);}sub(i,t,e=true){return (e?ro:Oi)(this.yt,[i],s=>{t(s[i]);})}read(i){return i in this.yt.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.yt.get()[i]}add(i,t,e=false){(!(i in this.yt.get())||e)&&this.yt.setKey(i,t);}has(i){return i in this.yt.get()}get store(){return this.yt.get()}static registerCtx(i,t){if(r.Ve.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=oo(i);return r.Ve.set(t,e),new r(t,e)}static deleteCtx(i){r.Ve.delete(i);}static getCtx(i){let t=r.Ve.get(i);return t?new r(i,t):null}static hasCtx(i){return r.Ve.has(i)}};var Ii=globalThis,Ui=Ii.ShadowRoot&&(Ii.ShadyCSS===void 0||Ii.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ps=Symbol(),Us=new WeakMap,Li=class{static{a(this,"n");}constructor(i,t,e){if(this.Ql=true,e!==Ps)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(Ui&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=Us.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&Us.set(t,i));}return i}toString(){return this.cssText}},Rs=a(r=>new Li(typeof r=="string"?r:r+"",void 0,Ps),"r");var $s=a((r,i)=>{if(Ui)r.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),o=Ii.litNonce;o!==void 0&&e.setAttribute("nonce",o),e.textContent=t.cssText,r.appendChild(e);}},"S"),so=Ui?r=>r:r=>r instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return Rs(t)})(r):r;var{is:bl,defineProperty:wl,getOwnPropertyDescriptor:Tl,getOwnPropertyNames:El,getOwnPropertySymbols:xl,getPrototypeOf:Cl}=Object,Pi=globalThis,Ds=Pi.trustedTypes,Sl=Ds?Ds.emptyScript:"",Al=Pi.reactiveElementPolyfillSupport,Qe=a((r,i)=>r,"d"),Je={toAttribute(r,i){switch(i){case Boolean:r=r?Sl: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}},Ri=a((r,i)=>!bl(r,i),"f"),Fs={attribute:true,type:String,converter:Je,reflect:false,useDefault:false,hasChanged:Ri};Symbol.metadata??=Symbol("metadata"),Pi.litPropertyMetadata??=new WeakMap;var Bt=class extends HTMLElement{static{a(this,"y");}static addInitializer(i){this.Sr(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.Ti&&[...this.Ti.keys()]}static createProperty(i,t=Fs){if(t.state&&(t.attribute=false),this.Sr(),this.prototype.hasOwnProperty(i)&&((t=Object.create(t)).wrapped=true),this.elementProperties.set(i,t),!t.noAccessor){let e=Symbol(),o=this.getPropertyDescriptor(i,e,t);o!==void 0&&wl(this.prototype,i,o);}}static getPropertyDescriptor(i,t,e){let{get:o,set:s}=Tl(this.prototype,i)??{get(){return this[t]},set(n){this[t]=n;}};return {get:o,set(n){let l=o?.call(this);s?.call(this,n),this.requestUpdate(i,l,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??Fs}static Sr(){if(this.hasOwnProperty(Qe("elementProperties")))return;let i=Cl(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(Qe("finalized")))return;if(this.finalized=true,this.Sr(),this.hasOwnProperty(Qe("properties"))){let t=this.properties,e=[...El(t),...xl(t)];for(let o of e)this.createProperty(o,t[o]);}let i=this[Symbol.metadata];if(i!==null){let t=litPropertyMetadata.get(i);if(t!==void 0)for(let[e,o]of t)this.elementProperties.set(e,o);}this.Ti=new Map;for(let[t,e]of this.elementProperties){let o=this.Ar(t,e);o!==void 0&&this.Ti.set(o,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 o of e)t.unshift(so(o));}else i!==void 0&&t.push(so(i));return t}static Ar(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.Ei=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.he=null,this.Jl();}Jl(){this.kr=new Promise(i=>this.enableUpdating=i),this.qt=new Map,this.tc(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this._e??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this._e?.delete(i);}tc(){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.Ei=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return $s(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._e?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this._e?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.Mr(i,e);}ec(i,t){let e=this.constructor.elementProperties.get(i),o=this.constructor.Ar(i,e);if(o!==void 0&&e.reflect===true){let s=(e.converter?.toAttribute!==void 0?e.converter:Je).toAttribute(t,e.type);this.he=i,s==null?this.removeAttribute(o):this.setAttribute(o,s),this.he=null;}}Mr(i,t){let e=this.constructor,o=e.Ti.get(i);if(o!==void 0&&this.he!==o){let s=e.getPropertyOptions(o),n=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:Je;this.he=o;let l=n.fromAttribute(t,s.type);this[o]=l??this.Or?.get(o)??l,this.he=null;}}requestUpdate(i,t,e,o=false,s){if(i!==void 0){let n=this.constructor;if(o===false&&(s=this[i]),e??=n.getPropertyOptions(i),!((e.hasChanged??Ri)(s,t)||e.useDefault&&e.reflect&&s===this.Or?.get(i)&&!this.hasAttribute(n.Ar(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.kr=this.ic());}C(i,t,{useDefault:e,reflect:o,wrapped:s},n){e&&!(this.Or??=new Map).has(i)&&(this.Or.set(i,n??t??this[i]),s!==true||n!==void 0)||(this.qt.has(i)||(this.hasUpdated||e||(t=void 0),this.qt.set(i,t)),o===true&&this.he!==i&&(this.ks??=new Set).add(i));}async ic(){this.isUpdatePending=true;try{await this.kr;}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.Ei){for(let[o,s]of this.Ei)this[o]=s;this.Ei=void 0;}let e=this.constructor.elementProperties;if(e.size>0)for(let[o,s]of e){let{wrapped:n}=s,l=this[o];n!==true||this.qt.has(o)||l===void 0||this.C(o,void 0,s,l);}}let i=false,t=this.qt;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this._e?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.Ir();}catch(e){throw i=false,this.Ir(),e}i&&this.rc(t);}willUpdate(i){}rc(i){this._e?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}Ir(){this.qt=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.kr}shouldUpdate(i){return true}update(i){this.ks&&=this.ks.forEach(t=>this.ec(t,this[t])),this.Ir();}updated(i){}firstUpdated(i){}};Bt.elementStyles=[],Bt.shadowRootOptions={mode:"open"},Bt[Qe("elementProperties")]=new Map,Bt[Qe("finalized")]=new Map,Al?.({ReactiveElement:Bt}),(Pi.reactiveElementVersions??=[]).push("2.1.2");var ao=globalThis,Vs=a(r=>r,"i"),$i=ao.trustedTypes,_s=$i?$i.createPolicy("lit-html",{createHTML:a(r=>r,"createHTML")}):void 0,lo="$lit$",zt=`lit$${Math.random().toFixed(9).slice(2)}$`,co="?"+zt,kl=`<${co}>`,fe=document,ei=a(()=>fe.createComment(""),"c"),ii=a(r=>r===null||typeof r!="object"&&typeof r!="function","a"),uo=Array.isArray,Ks=a(r=>uo(r)||typeof r?.[Symbol.iterator]=="function","d"),no=`[ \f\r]`,ti=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ns=/-->/g,Bs=/>/g,he=RegExp(`>|${no}(?:([^\\s"'>=/]+)(${no}*=${no}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),zs=/'/g,Hs=/"/g,Gs=/^(?:script|style|textarea|title)$/i,po=a(r=>(i,...t)=>({Wt:r,strings:i,values:t}),"x"),y=po(1);po(2);po(3);var tt=Symbol.for("lit-noChange"),R=Symbol.for("lit-nothing"),js=new WeakMap,me=fe.createTreeWalker(fe,129);function qs(r,i){if(!uo(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return _s!==void 0?_s.createHTML(i):i}a(qs,"V");var Ws=a((r,i)=>{let t=r.length-1,e=[],o,s=i===2?"<svg>":i===3?"<math>":"",n=ti;for(let l=0;l<t;l++){let c=r[l],u,p,d=-1,m=0;for(;m<c.length&&(n.lastIndex=m,p=n.exec(c),p!==null);)m=n.lastIndex,n===ti?p[1]==="!--"?n=Ns:p[1]!==void 0?n=Bs:p[2]!==void 0?(Gs.test(p[2])&&(o=RegExp("</"+p[2],"g")),n=he):p[3]!==void 0&&(n=he):n===he?p[0]===">"?(n=o??ti,d=-1):p[1]===void 0?d=-2:(d=n.lastIndex-p[2].length,u=p[1],n=p[3]===void 0?he:p[3]==='"'?Hs:zs):n===Hs||n===zs?n=he:n===Ns||n===Bs?n=ti:(n=he,o=void 0);let f=n===he&&r[l+1].startsWith("/>")?" ":"";s+=n===ti?c+kl:d>=0?(e.push(u),c.slice(0,d)+lo+c.slice(d)+zt+f):c+zt+(d===-2?l:f);}return [qs(r,s+(r[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},"N"),ri=class r{static{a(this,"S");}constructor({strings:i,Wt:t},e){let o;this.parts=[];let s=0,n=0,l=i.length-1,c=this.parts,[u,p]=Ws(i,t);if(this.el=r.createElement(u,e),me.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes);}for(;(o=me.nextNode())!==null&&c.length<l;){if(o.nodeType===1){if(o.hasAttributes())for(let d of o.getAttributeNames())if(d.endsWith(lo)){let m=p[n++],f=o.getAttribute(d).split(zt),v=/([.?@])?(.*)/.exec(m);c.push({type:1,index:s,name:v[2],strings:f,ctor:v[1]==="."?Fi:v[1]==="?"?Vi:v[1]==="@"?_i:ve}),o.removeAttribute(d);}else d.startsWith(zt)&&(c.push({type:6,index:s}),o.removeAttribute(d));if(Gs.test(o.tagName)){let d=o.textContent.split(zt),m=d.length-1;if(m>0){o.textContent=$i?$i.emptyScript:"";for(let f=0;f<m;f++)o.append(d[f],ei()),me.nextNode(),c.push({type:2,index:++s});o.append(d[m],ei());}}}else if(o.nodeType===8)if(o.data===co)c.push({type:2,index:s});else {let d=-1;for(;(d=o.data.indexOf(zt,d+1))!==-1;)c.push({type:7,index:s}),d+=zt.length-1;}s++;}}static createElement(i,t){let e=fe.createElement("template");return e.innerHTML=i,e}};function ge(r,i,t=r,e){if(i===tt)return i;let o=e!==void 0?t.oc?.[e]:t.sc,s=ii(i)?void 0:i.Lr;return o?.constructor!==s&&(o?.Ms?.(false),s===void 0?o=void 0:(o=new s(r),o.Ur(r,t,e)),e!==void 0?(t.oc??=[])[e]=o:t.sc=o),o!==void 0&&(i=ge(r,o.nc(r,i.values),o,e)),i}a(ge,"M");var Di=class{static{a(this,"R");}constructor(i,t){this.Os=[],this.bt=void 0,this.Is=i,this.c=t;}get parentNode(){return this.c.parentNode}get Z(){return this.c.Z}u(i){let{el:{content:t},parts:e}=this.Is,o=(i?.creationScope??fe).importNode(t,true);me.currentNode=o;let s=me.nextNode(),n=0,l=0,c=e[0];for(;c!==void 0;){if(n===c.index){let u;c.type===2?u=new Ie(s,s.nextSibling,this,i):c.type===1?u=new c.ctor(s,c.name,c.strings,this,i):c.type===6&&(u=new Ni(s,this,i)),this.Os.push(u),c=e[++l];}n!==c?.index&&(s=me.nextNode(),n++);}return me.currentNode=fe,o}p(i){let t=0;for(let e of this.Os)e!==void 0&&(e.strings!==void 0?(e.wt(i,e,t),t+=e.strings.length-2):e.wt(i[t])),t++;}},Ie=class r{static{a(this,"k");}get Z(){return this.c?.Z??this.Ls}constructor(i,t,e,o){this.type=2,this.i=R,this.bt=void 0,this.Ot=i,this.me=t,this.c=e,this.options=o,this.Ls=o?.isConnected??true;}get parentNode(){let i=this.Ot.parentNode,t=this.c;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.Ot}get endNode(){return this.me}wt(i,t=this){i=ge(this,i,t),ii(i)?i===R||i==null||i===""?(this.i!==R&&this.fe(),this.i=R):i!==this.i&&i!==tt&&this.Us(i):i.Wt!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):Ks(i)?this.k(i):this.Us(i);}O(i){return this.Ot.parentNode.insertBefore(i,this.me)}T(i){this.i!==i&&(this.fe(),this.i=this.O(i));}Us(i){this.i!==R&&ii(this.i)?this.Ot.nextSibling.data=i:this.T(fe.createTextNode(i)),this.i=i;}$(i){let{values:t,Wt:e}=i,o=typeof e=="number"?this.ac(i):(e.el===void 0&&(e.el=ri.createElement(qs(e.h,e.h[0]),this.options)),e);if(this.i?.Is===o)this.i.p(t);else {let s=new Di(o,this),n=s.u(this.options);s.p(t),this.T(n),this.i=s;}}ac(i){let t=js.get(i.strings);return t===void 0&&js.set(i.strings,t=new ri(i)),t}k(i){uo(this.i)||(this.i=[],this.fe());let t=this.i,e,o=0;for(let s of i)o===t.length?t.push(e=new r(this.O(ei()),this.O(ei()),this,this.options)):e=t[o],e.wt(s),o++;o<t.length&&(this.fe(e&&e.me.nextSibling,o),t.length=o);}fe(i=this.Ot.nextSibling,t){for(this.xi?.(false,true,t);i!==this.me;){let e=Vs(i).nextSibling;Vs(i).remove(),i=e;}}setConnected(i){this.c===void 0&&(this.Ls=i,this.xi?.(i));}},ve=class{static{a(this,"H");}get tagName(){return this.element.tagName}get Z(){return this.c.Z}constructor(i,t,e,o,s){this.type=1,this.i=R,this.bt=void 0,this.element=i,this.name=t,this.c=o,this.options=s,e.length>2||e[0]!==""||e[1]!==""?(this.i=Array(e.length-1).fill(new String),this.strings=e):this.i=R;}wt(i,t=this,e,o){let s=this.strings,n=false;if(s===void 0)i=ge(this,i,t,0),n=!ii(i)||i!==this.i&&i!==tt,n&&(this.i=i);else {let l=i,c,u;for(i=s[0],c=0;c<s.length-1;c++)u=ge(this,l[e+c],t,c),u===tt&&(u=this.i[c]),n||=!ii(u)||u!==this.i[c],u===R?i=R:i!==R&&(i+=(u??"")+s[c+1]),this.i[c]=u;}n&&!o&&this.j(i);}j(i){i===R?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},Fi=class extends ve{static{a(this,"I");}constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===R?void 0:i;}},Vi=class extends ve{static{a(this,"L");}constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==R);}},_i=class extends ve{static{a(this,"z");}constructor(i,t,e,o,s){super(i,t,e,o,s),this.type=5;}wt(i,t=this){if((i=ge(this,i,t,0)??R)===tt)return;let e=this.i,o=i===R&&e!==R||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,s=i!==R&&(e===R||o);o&&this.element.removeEventListener(this.name,this,e),s&&this.element.addEventListener(this.name,this,i),this.i=i;}handleEvent(i){typeof this.i=="function"?this.i.call(this.options?.host??this.element,i):this.i.handleEvent(i);}},Ni=class{static{a(this,"Z");}constructor(i,t,e){this.element=i,this.type=6,this.bt=void 0,this.c=t,this.options=e;}get Z(){return this.c.Z}wt(i){ge(this,i);}},Zs={I:Ie},Ml=ao.litHtmlPolyfillSupport;Ml?.(ri,Ie),(ao.litHtmlVersions??=[]).push("3.3.2");var Xs=a((r,i,t)=>{let e=t?.renderBefore??i,o=e.cc;if(o===void 0){let s=t?.renderBefore??null;e.cc=o=new Ie(i.insertBefore(ei(),s),s,void 0,t??{});}return o.wt(r),o},"D");var ho=globalThis,bt=class extends Bt{static{a(this,"i");}constructor(){super(...arguments),this.renderOptions={host:this},this.Pr=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.Pr=Xs(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.Pr?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.Pr?.setConnected(false);}render(){return tt}};bt.wp=true,bt.finalized=true,ho.litElementHydrateSupport?.({LitElement:bt});var Ol=ho.litElementPolyfillSupport;Ol?.({LitElement:bt});(ho.litElementVersions??=[]).push("4.2.2");var Il=/\\([0-9a-fA-F]{1,6} ?)/g;function Ll(r){return r.length<2?false:(r[0]==='"'||r[0]==="'")&&(r[r.length-1]==='"'||r[r.length-1]==="'")}a(Ll,"hasLeadingTrailingQuotes");function Ul(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}a(Ul,"trimQuotes");function Pl(r){let i="",t="";for(let e=0;e<r.length;e++){let o=r[e+1];r[e]==="\\"&&o==='"'?(i+='\\"',e++):r[e]==='"'&&t!=="\\"?i+='\\"':i+=r[e],t=r[e]??"";}return i}a(Pl,"escapeQuotes");function Ys(r){let i=r;Ll(r)&&(i=Ul(i),i=i.replace(Il,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=Pl(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}a(Ys,"parseCssPropertyValue");function Le(r){class i extends r{constructor(){super(...arguments);this.Ps=null;this.Rr=null;}static{a(this,"CssDataMixinClass");}getCssData(o,s=false){let n=this.Ps??Object.create(null);if(!Object.keys(n).includes(o)||!n[o]){this.Rr||(this.Rr=window.getComputedStyle(this));let l=this.Rr.getPropertyValue(o).trim();try{n[o]=Ys(l);}catch(c){s||console.warn(`CSS Data error: ${o}`,c),n[o]=null;}}return this.Ps=n,n[o]}}return i}a(Le,"CssDataMixin");function Bi(r){class i extends r{constructor(){super(...arguments);this.willYield=true;this.Zt={};this.Xt=null;this.Ci=false;}static{a(this,"LightDomMixinClass");}createRenderRoot(){return this}connectedCallback(){this.Xt||(this.Xt=Array.from(this.childNodes)),super.connectedCallback();}uc(){if(this.Ci)return;this.Ci=true,this.Zt={};let o=Array.from(this.childNodes),s=o.length?o:this.Xt??[];for(let n of s){let l=this.Rs(n),c=this.Zt[l]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),c.push(n),this.Zt[l]=c;}this.Xt=null;}Rs(o){return o instanceof Comment&&o.nextSibling instanceof Element?this.Rs(o.nextSibling):"contentFor"in o?o.contentFor||"":o instanceof Element&&o.hasAttribute("content-for")&&o.getAttribute("content-for")||""}dc(o){return !o.textContent||!o.textContent.trim()}pc(o){let s=this.Zt[o];return !s||s.every(n=>n instanceof Comment||n instanceof Text&&this.dc(n))}update(o){!this.hasUpdated&&this.willYield&&this.uc(),super.update(o);}yield(o,s){if(o===""&&!this.Zt[o]&&!this.Ci&&this.Xt?.length){let l=[];for(let c of this.Xt)c instanceof Element&&(c.removeAttribute("slot"),c.removeAttribute("content-for")),l.push(c);this.Zt[o]=l,this.Ci=true,this.Xt=null;}let n=this.Zt[o];return y` ${n} ${this.pc(o)?s:void 0} `}}return i}a(Bi,"LightDomMixin");function Ue(r){class i extends r{static{a(this,"RegisterableElementMixinClass");}static reg(e){let o=this,s=window.customElements.get(e);if(s){s!==o&&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,o);}}return i}a(Ue,"RegisterableElementMixin");var Qt=class extends Event{static{a(this,"s");}constructor(i,t,e,o){super("context-request",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t,this.callback=e,this.subscribe=o??false;}};var Pe=class{static{a(this,"s");}constructor(i,t,e,o){if(this.subscribe=false,this.provided=false,this.value=void 0,this.t=(s,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=false,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=true,this.callback&&this.callback(s,n)),this.unsubscribe=n;},this.host=i,t.context!==void 0){let s=t;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??false;}else this.context=t,this.callback=e,this.subscribe=o??false;this.host.addController(this);}hostConnected(){this.dispatchRequest();}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0);}dispatchRequest(){this.host.dispatchEvent(new Qt(this.context,this.host,this.t,this.subscribe));}};var zi=class{static{a(this,"s");}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:a(()=>{this.subscriptions.delete(i);},"disposer"),consumerHost:t});let{disposer:o}=this.subscriptions.get(i);i(this.value,o);}clearCallbacks(){this.subscriptions.clear();}};var mo=class extends Event{static{a(this,"e");}constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},Re=class extends zi{static{a(this,"i");}constructor(i,t,e){super(t.context!==void 0?t.initialValue:e),this.onContextRequest=o=>{if(o.context!==this.context)return;let s=o.contextTarget??o.composedPath()[0];s!==this.host&&(o.stopPropagation(),this.addCallback(o.callback,s,o.subscribe));},this.onProviderRequest=o=>{if(o.context!==this.context||(o.contextTarget??o.composedPath()[0])===this.host)return;let s=new Set;for(let[n,{consumerHost:l}]of this.subscriptions)s.has(n)||(s.add(n),l.dispatchEvent(new Qt(this.context,l,n,true)));o.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 mo(this.context,this.host));}};var $l={attribute:true,type:String,converter:Je,reflect:false,hasChanged:Ri},Dl=a((r=$l,i,t)=>{let{kind:e,metadata:o}=t,s=globalThis.litPropertyMetadata.get(o);if(s===void 0&&globalThis.litPropertyMetadata.set(o,s=new Map),e==="setter"&&((r=Object.create(r)).wrapped=true),s.set(t.name,r),e==="accessor"){let{name:n}=t;return {set(l){let c=i.get.call(this);i.set.call(this,l),this.requestUpdate(n,c,r,true,l);},init(l){return l!==void 0&&this.C(n,void 0,r,l),l}}}if(e==="setter"){let{name:n}=t;return function(l){let c=this[n];i.call(this,l),this.requestUpdate(n,c,r,true,l);}}throw Error("Unsupported decorator location: "+e)},"r");function b(r){return (i,t)=>typeof t=="object"?Dl(r,i,t):((e,o,s)=>{let n=o.hasOwnProperty(s);return o.constructor.createProperty(s,e),n?Object.getOwnPropertyDescriptor(o,s):void 0})(r,i,t)}a(b,"n");function g(r){return b({...r,state:true,attribute:false})}a(g,"r");function D(r,i){let t,e=a(((...o)=>{t&&clearTimeout(t),t=setTimeout(()=>r(...o),i);}),"debounced");return e.cancel=()=>{t&&clearTimeout(t);},e}a(D,"debounce");var Qs="ctx-name-context";function ji(){return function(r){class i extends r{constructor(...o){super(...o);this.et=null;this.Be=false;this.$r=false;this.Dr=void 0;this.ge=new Map;this.ze=new Set;this.init$={};this.ctxOwner=false;this.Si=void 0;this.Ai=false;this.ctxName=this.Dt;this.Ft=false;this.Si=this.getAttribute("ctx-name")||void 0,this.ctxName=this.Dt,this.hc=new Pe(this,{context:Qs,callback:a(s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.Fs=s,this.Ds();},"callback"),subscribe:true});}static{a(this,"SymbioteMixinClass");}static set template(o){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 $s(){return this.Si}set $s(o){let s=o??void 0;this.Si!==s&&(this.Si=s,this.Ds());}shouldUpdate(o){return this.Ft?super.shouldUpdate(o):false}get Dt(){return this.$s||this.Fs||void 0}Ds(){if(this.ctxName=this.Dt,!(!this.ctxName||this.Be)){if(this.isConnected){this.Fr();return}this.Ai=true;}}willUpdate(o){super.willUpdate(o),this.ctxName=this.Dt,this.ctxName&&(this.Dr?this.Dr.setValue(this.ctxName):this.Dr=new Re(this,{context:Qs,initialValue:this.ctxName}));}Ns(){if(!(!this.et||this.ge.size===0)){for(let[o,{value:s,rewrite:n}]of this.ge)this.et.add(o,s,n);this.ge.clear();}}Vs(){return !this.et&&this.Dt&&this.Nr(),this.et&&this.Ns(),this.et}ki(){let o=this.Vs();if(!o)throw new Error("SymbioteMixin: Shared context is not initialized.");return o}Nr(){let o=this.init$,s=this.Dt;if(!s){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.et){this.et=z.getCtx(s)??z.registerCtx(o,s);for(let[n,l]of Object.entries(this.init$))this.et.add(n,l,this.ctxOwner);this.Ns();}}get $(){return this.Dt&&this.Nr(),new Proxy({},{get:a((o,s)=>{if(typeof s=="string")return this.et?.read(s)},"get"),set:a((o,s,n)=>(typeof s!="string"||this.et?.pub(s,n),true),"set")})}sub(o,s,n=true){let l=this.ki().sub(o,s,n);if(!l||typeof l!="function")return ()=>{};let c=l.bind(l),u=false,p=a(()=>{u||(u=true,c(),this.ze.delete(p));},"trackedRemove");return this.ze.add(p),p}pub(o,s){this.ki().pub(o,s);}set$(o){for(let[s,n]of Object.entries(o))this.pub(s,n);}get sharedCtx(){return this.ki()}has(o){return this.et?.has(o)??false}add(o,s,n=false){let l=this.Vs();if(!l){if(!n&&this.ge.has(o))return;this.ge.set(o,{value:s,rewrite:n});return}this.ge.delete(o),l.add(o,s,n);}add$(o,s=false){for(let[n,l]of Object.entries(o))this.add(n,l,s);}connectedCallback(){super.connectedCallback(),this.Be?this.Ft&&this.$r&&(this.$r=false,this.initCallback()):this.ctxName?(this.Ai=false,this.Fr()):this.Ai&&this.Dt&&(this.Ai=false,this.Fr());}Fr(){if(this.Be)return;this.Be=true,this.Nr();let o=this.init$;if(Object.keys(o).length>0){let s=this.ki();for(let[n,l]of Object.entries(o))s.read(n)===void 0&&s.pub(n,l),this.sub(n,D(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.Ft=true,this.requestUpdate();}firstUpdated(o){super.firstUpdated(o);}disconnectedCallback(){this.mc(),super.disconnectedCallback(),this.Be&&(this.$r=true);}mc(){if(this.ze.size!==0){for(let o of [...this.ze])o();this.ze.clear();}}initCallback(){}}return h([b({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"$s",1),h([g()],i.prototype,"Fs",2),h([g()],i.prototype,"ctxName",2),h([g()],i.prototype,"Ft",2),i}}a(ji,"SymbioteMixin");var fo=class extends Ue(ji()(Le(Bi(bt)))){static{a(this,"BaseComponent");}};var et=class r{static{a(this,"UID");}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 Fl=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function go(r){for(let i in r){if(Fl.includes(i))continue;let t=[...i].reduce((e,o)=>(o.toUpperCase()===o&&(o=`-${o.toLowerCase()}`),e+=o,e),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("uc-")||(t=`uc-${t}`),r[i].reg&&r[i].reg(t);}}a(go,"defineComponents");var vo="UC";function Vl(r,i=false){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[vo]){t(window[vo]);return}let o=document.createElement("script");o.async=true,o.src=r,o.onerror=()=>{e();},o.onload=()=>{let s=window[vo];i&&go(s),t(s);},document.head.appendChild(o);})}a(Vl,"loadFileUploaderFrom");var 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","drop-file-here":"Drop file here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"OneDrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-draw":"Draw","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning","a11y-cloud-editor-apply-aspect-ratio":"Apply operation {{name}} {{value}}",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}","queued-uploading":"Queued for upload","queued-validation":"Queued for validation",validation:"Validating","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop"};var yo=new Map,Js=new Map,tn=a((r,i)=>{yo.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`);let t={...oi,...i};return yo.set(r,t),t},"defineLocaleSync"),_l=a((r,i)=>{Js.set(r,i);},"defineLocaleAsync"),en=a((r,i)=>{typeof i=="function"?_l(r,i):tn(r,i);},"defineLocale"),rn=a(async r=>{let i=yo.get(r);if(!i){let t=Js.get(r);if(!t)throw new Error(`Locale ${r} is not defined`);let e=await t();i=tn(r,e);}return i},"resolveLocaleDefinition");en("en",oi);var U=a(r=>`*cfg/${r}`,"sharedConfigKey");var ct=a(r=>r?r.split(",").map(i=>i.trim()).filter(Boolean):[],"deserializeCsv"),Ht=a(r=>r.join(","),"serializeCsv");var on=a(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},"normalizeCdnOperation"),Ki=a((...r)=>r.filter(i=>typeof i=="string"&&!!i).map(i=>on(i)).join("/-/"),"joinCdnOperations"),it=a((...r)=>{let i=Ki(...r);return i?`-/${i}/`:""},"createCdnUrlModifiers");function Gi(r){let i=new URL(r),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),o=t.lastIndexOf("/"),s="";return e>=0?s=t.slice(e):o>=0&&(s=t.slice(o+1)),s}a(Gi,"extractFilename");function qi(r){let i=new URL(r),{pathname:t}=i,e=t.indexOf("/"),o=t.indexOf("/",e+1);return t.substring(e+1,o)}a(qi,"extractUuid");function bo(r){let i=sn(r),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}a(bo,"extractCdnUrlModifiers");function wo(r){return bo(r).split("/-/").filter(Boolean).map(t=>on(t))}a(wo,"extractOperations");function sn(r){let i=new URL(r),t=Gi(r),e=nn(t)?an(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}a(sn,"trimFilename");function nn(r){return r.startsWith("http")}a(nn,"isFileUrl");function an(r){let i=new URL(r);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}a(an,"splitFileUrl");var q=a((r,i,t)=>{let e=new URL(sn(r)),o=t??Gi(r),s=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),o&&nn(o)){let n=an(o);e.pathname=`${e.pathname}${s}${n.pathname||""}`,e.search=n.search,e.hash=n.hash;}else e.pathname=`${e.pathname}${s}${o||""}`;return e.toString()},"createCdnUrl"),Jt=a((r,i)=>{let t=new URL(r);return t.pathname=`${i}/`,t.toString()},"createOriginalUrl");var j=a((r,i=",")=>r.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0),"stringToArray");var si=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}),cn=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function Nl(r,i){if(typeof i=="number"){let t=i;return si[r]!==t?`${r}/${t}`:""}if(typeof i=="boolean"){let t=i;return si[r]!==t?`${r}`:""}if(r==="filter"&&i){let{name:t,amount:e}=i;return si.filter===e?"":`${r}/${t}/${e}`}if(r==="crop"&&i){let{dimensions:t,coords:e}=i;return `${r}/${t.join("x")}/${e.join(",")}`}return ""}a(Nl,"transformationToStr");function te(r){return Ki(...cn.filter(i=>typeof r[i]<"u"&&r[i]!==null).map(i=>{let t=r[i];return Nl(i,t)}).filter(i=>!!i))}a(te,"transformationsToOperations");var Wi=Ki("format/auto","progressive/yes"),jt=a(([r])=>typeof r<"u"?Number(r):void 0,"asNumber"),ln=a(()=>true,"asBoolean"),Bl=a(([r,i])=>({name:r,amount:typeof i<"u"?Number(i):100}),"asFilter"),zl=a(([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:j(r,"x").map(Number),coords:j(i).map(Number)}},"asCrop"),Hl=Object.freeze({enhance:jt,brightness:jt,exposure:jt,gamma:jt,contrast:jt,saturation:jt,vibrance:jt,warmth:jt,filter:Bl,mirror:ln,flip:ln,rotate:jt,crop:a(r=>{let[i,t]=r,{dimensions:e,coords:o}=zl([i,t]);return {dimensions:e,coords:o}},"crop")});function To(r){let i={};for(let t of r){let[e,...o]=t.split("/");if(!e||!cn.includes(e))continue;let s=e,n=Hl[s];try{let l=n(o);i[s]=l;}catch(l){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,l instanceof Error?`Error message: "${l.message}"`:l,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return i}a(To,"operationsToTransformations");var N=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),rt=Object.freeze([N.CROP,N.TUNING,N.FILTERS]),un=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),dn=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"]),pn=Object.freeze(["rotate","mirror","flip"]),Kt=si,At=Object.freeze({brightness:{zero:Kt.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:Kt.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:Kt.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:Kt.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:Kt.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:Kt.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:Kt.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:Kt.enhance,range:[0,100],keypointsNumber:1},filter:{zero:Kt.filter,range:[0,100],keypointsNumber:1}});var ni="https://ucarecdn.com",jl="https://upload.uploadcare.com",Kl="https://social.uploadcare.com",Gl="https://ucarecd.net",ql={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:Ht(rt),maxLocalFileSizeBytes:0,thumbSize:76,showEmptyList:false,useLocalImageEditor:false,useCloudImageEditor:true,removeCopyright:false,cropPreset:"",imageShrink:"",modalScrollLock:true,modalBackdropStrokes:false,sourceListWrap:true,remoteTabSessionKey:"",cdnCname:ni,cdnCnamePrefixed:Gl,baseUrl:jl,socialBaseUrl:Kl,secureSignature:"",secureExpire:"",secureDeliveryProxy:"",retryThrottledRequestMaxTimes:3,retryNetworkErrorMaxTimes:3,multipartMinFileSize:26214400,multipartChunkSize:5242880,maxConcurrentRequests:10,multipartMaxConcurrentRequests:4,multipartMaxAttempts:3,checkForUrlDuplicates:false,saveUrlForRecurrentUploads:false,groupOutput:false,userAgentIntegration:"",debug:false,metadata:null,localeName:"en",localeDefinitionOverride:null,secureUploadsExpireThreshold:600*1e3,secureUploadsSignatureResolver:null,secureDeliveryProxyUrlResolver:null,iconHrefResolver:null,fileValidators:[],collectionValidators:[],validationTimeout:15*1e3,validationConcurrency:100,cameraModes:"photo, video",defaultCameraMode:null,enableAudioRecording:true,enableVideoRecording:null,maxVideoRecordingDuration:null,mediaRecorderOptions:null,filesViewMode:"list",gridShowFileNames:false,cloudImageEditorAutoOpen:false,cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true,pasteScope:"local",smartBtn:{sourceList:"local, url, camera, dropbox, gdrive",mode:"auto"}},Q=Object.freeze(ql);var Zi=a((r,i)=>(...t)=>{let e=r();if(!e.read(U("debug")))return;let o=t;if(typeof t?.[0]=="function"){let n=t[0];o=n();}let s=[e.id,i].filter(Boolean);console.log(`[${s.join("][")}]`,...o);},"createDebugPrinter");var Z=class{constructor(i){this.Vr=new Set;this.Yt=null;this.z=Zi(()=>this.r.ctx,this.constructor.name);this.r=i,this.e=i.ctx;}static{a(this,"SharedInstance");}addSub(i){this.Vr.add(i);}get Qt(){if(!this.Yt){let i={};this.Yt=new Proxy(i,{set:a(()=>{throw new Error("SharedInstance cfg proxy is read-only")},"set"),get:a((t,e)=>{if(typeof e!="string")return;let o=U(e);return this.r.ctx.has(o)?this.r.ctx.read(o):Q[e]},"get")});}return this.Yt}destroy(){for(let i of this.Vr)try{i();}catch{}this.Vr.clear();}},Ut=a((r,i,t=true)=>{let e=r.has(i),o=e?r.read(i):null;if(e&&o||!t)return o;throw new Error(`Unexpected error: shared instance for key "${String(i)}" is not available`)},"getSharedInstance"),hn=a(r=>({get ctx(){return r()},get modalManager(){return Ut(r(),"*modalManager",false)},get telemetryManager(){return Ut(r(),"*telemetryManager")},get localeManager(){return Ut(r(),"*localeManager")},get a11y(){return Ut(r(),"*a11y")},get blocksRegistry(){return Ut(r(),"*blocksRegistry")},get eventEmitter(){return Ut(r(),"*eventEmitter")},get uploadCollection(){return Ut(r(),"*uploadCollection")},get secureUploadsManager(){return Ut(r(),"*secureUploadsManager",false)},get api(){return Ut(r(),"*publicApi")},get validationManager(){return Ut(r(),"*validationManager")}}),"createSharedInstancesBag");var W=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),Xi=class extends Z{constructor(){super(...arguments);this.Jt=new Map;this.Tt=new Set;this.w=new Map;}static{a(this,"ModalManager");}registerModal(t,e){this.Jt.set(t,e),this.K(W.ADD,{id:t,modal:e});}deleteModal(t){let e=this.Jt.get(t);return e?(this.Jt.delete(t),this.Tt.delete(t),this.K(W.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.Jt.get(t);return e?(this.Tt.add(t),this.K(W.OPEN,{modal:e,id:t}),true):(this.z(`Modal with ID "${t}" not found`),false)}close(t){let e=this.Jt.get(t);return !e||!this.Tt.has(t)?(this.z(`Modal with ID "${t}" not found or not active`),false):(this.Tt.delete(t),this.K(W.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.Jt.has(t)?this.Tt.has(t)?this.close(t):this.open(t):(this.z(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.Tt.size>0}back(){if(this.Tt.size===0)return this.z("No active modals to go back from"),false;let t=Array.from(this.Tt).pop();return t?this.close(t):false}closeAll(){let t=this.Tt.size;return this.Tt.clear(),this.K(W.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);}K(t,e){if(this.w.has(t))for(let o of this.w.get(t)??new Set)try{o(e);}catch(s){this.r.telemetryManager.sendEventError(s,"modal subscriber"),this.z("Error in modal subscriber:",s);}}destroy(){super.destroy(),this.closeAll(),this.Jt.clear(),this.w.clear(),this.K(W.DESTROY,{});}};var ai=a(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("-"),"toKebabCase");function mn(r){return Object.prototype.toString.call(r)==="[object Object]"}a(mn,"isObject");var Wl=/\W|_/g;function Zl(r){return r.split(Wl).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}a(Zl,"camelizeString");function fn(r,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(r)?r.map(t=>qt(t,{ignoreKeys:i})):r}a(fn,"camelizeArrayItems");function qt(r,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(r))return fn(r,{ignoreKeys:i});if(!mn(r))return r;let t={};for(let e of Object.keys(r)){let o=r[e];if(i.includes(e)){t[e]=o;continue}mn(o)?o=qt(o,{ignoreKeys:i}):Array.isArray(o)&&(o=fn(o,{ignoreKeys:i})),t[Zl(e)]=o;}return t}a(qt,"camelizeKeys");var Xl=a(r=>new Promise(i=>setTimeout(i,r)),"delay");function Mo({libraryName:r,libraryVersion:i,userAgent:t,publicKey:e="",integration:o=""}){let s="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:r,libraryVersion:i,languageName:s,integration:o});let n=[r,i,e].filter(Boolean).join("/"),l=[s,o].filter(Boolean).join("; ");return `${n} (${l})`}a(Mo,"getUserAgent$1");var Yl={factor:2,time:100};function Ql(r,i=Yl){let t=0;function e(o){let s=Math.round(i.time*i.factor**t);return o({attempt:t,retry:a(l=>Xl(l??s).then(()=>(t+=1,e(o))),"retry")})}return a(e,"runAttempt"),e(r)}a(Ql,"retrier");var ye=class extends Error{static{a(this,"UploadcareError");}},$e=class r extends ye{static{a(this,"NetworkError");}originalProgressEvent;constructor(i){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,r.prototype),this.originalProgressEvent=i;}},Yi=a((r,i)=>{r&&(r.aborted?Promise.resolve().then(i):r.addEventListener("abort",()=>i(),{once:true}));},"onCancel"),ee=class r extends ye{static{a(this,"CancelError");}isCancel=true;constructor(i="Request canceled"){super(i),this.name="CancelError",Object.setPrototypeOf(this,r.prototype);}},Jl=500,vn=a(({check:r,interval:i=Jl,timeout:t,signal:e})=>new Promise((o,s)=>{let n,l;Yi(e,()=>{n&&clearTimeout(n),s(new ee("Poll cancelled"));}),t&&(l=setTimeout(()=>{n&&clearTimeout(n),s(new ee("Timed out"));},t));let c=a(()=>{try{Promise.resolve(r(e)).then(u=>{u?(l&&clearTimeout(l),o(u)):n=setTimeout(c,i);}).catch(u=>{l&&clearTimeout(l),s(u);});}catch(u){l&&clearTimeout(l),s(u);}},"tick");n=setTimeout(c,0);}),"poll"),P={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,maxConcurrentRequests:4,pusherKey:"79ae88bd931ea68464d9"},Qi="application/octet-stream",yn="original",re=a(({method:r,url:i,data:t,headers:e={},signal:o,onProgress:s})=>new Promise((n,l)=>{let c=new XMLHttpRequest,u=r?.toUpperCase()||"GET",p=false;c.open(u,i,true),e&&Object.entries(e).forEach(d=>{let[m,f]=d;typeof f<"u"&&!Array.isArray(f)&&c.setRequestHeader(m,f);}),c.responseType="text",Yi(o,()=>{p=true,c.abort(),l(new ee);}),c.onload=()=>{if(c.status!=200)l(new Error(`Error ${c.status}: ${c.statusText}`));else {let d={method:u,url:i,data:t,headers:e||void 0,signal:o,onProgress:s},m=c.getAllResponseHeaders().trim().split(/[\r\n]+/),f={};m.forEach(function(T){let S=T.split(": "),x=S.shift(),A=S.join(": ");x&&typeof x<"u"&&(f[x]=A);});let v=c.response,w=c.status;n({request:d,data:v,headers:f,status:w});}},c.onerror=d=>{p||l(new $e(d));},s&&typeof s=="function"&&(c.upload.onprogress=d=>{d.lengthComputable?s({isComputable:true,value:d.loaded/d.total}):s({isComputable:false});}),t?c.send(t):c.send();}),"request");function tc(r,...i){return r}a(tc,"identity");var ec=a(({name:r})=>r?[r]:[],"getFileOptions"),ic=tc,rc=a(()=>new FormData,"getFormData"),bn=a(r=>false,"isBuffer"),Ji=a(r=>typeof Blob<"u"&&r instanceof Blob,"isBlob"),tr=a(r=>typeof File<"u"&&r instanceof File,"isFile"),er=a(r=>!!r&&typeof r=="object"&&!Array.isArray(r)&&"uri"in r&&typeof r.uri=="string","isReactNativeAsset"),De=a(r=>Ji(r)||tr(r)||bn()||er(r),"isFileData"),oc=a(r=>typeof r=="string"||typeof r=="number"||typeof r>"u","isSimpleValue"),sc=a(r=>!!r&&typeof r=="object"&&!Array.isArray(r),"isObjectValue"),nc=a(r=>!!r&&typeof r=="object"&&"data"in r&&De(r.data),"isFileValue");function wn(r,i,t){if(Array.isArray(t))for(let e of t)wn(r,`${i}[]`,e);else if(nc(t)){let{name:e,contentType:o}=t,s=ic(t.data,e,o??Qi),n=ec({name:e,contentType:o});r.push([i,s,...n]);}else if(sc(t))for(let[e,o]of Object.entries(t))typeof o<"u"&&r.push([`${i}[${e}]`,String(o)]);else oc(t)&&t&&r.push([i,t.toString()]);}a(wn,"collectParams");function ac(r){let i=[];for(let[t,e]of Object.entries(r))wn(i,t,e);return i}a(ac,"getFormDataParams");function ir(r){let i=rc(),t=ac(r);for(let e of t){let[o,s,...n]=e;i.append(o,s,...n);}return i}a(ir,"buildFormData");var ot=class r extends ye{static{a(this,"UploadError");}code;request;response;headers;constructor(i,t,e,o,s){super(),this.name="UploadError",this.message=i,this.code=t,this.request=e,this.response=o,this.headers=s,Object.setPrototypeOf(this,r.prototype);}},lc=a(r=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(r))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(o=>o[1]??false).forEach(o=>i.set(`${t}[${o[0]}]`,String(o[1]))):Array.isArray(e)?e.forEach(o=>{i.append(`${t}[]`,o);}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},"buildSearchParams"),Gt=a((r,i,t)=>{let e=new URL(r);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=lc(t)),e.toString()},"getUrl"),cc="6.18.4",uc="UploadcareUploadClient",dc=cc;function we(r){return Mo({libraryName:uc,libraryVersion:dc,...r})}a(we,"getUserAgent");var pc="RequestThrottledError",gn=15e3,hc=1e3;function mc(r){let{headers:i}=r||{};if(!i||typeof i["retry-after"]!="string")return gn;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:gn}a(mc,"getTimeoutFromThrottledRequest");function oe(r,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return Ql(({attempt:o,retry:s})=>r().catch(n=>{if("response"in n&&n?.code===pc&&o<t)return s(mc(n));if(n instanceof $e&&o<e)return s((o+1)*hc);throw n}))}a(oe,"retryIfFailed");var Tn=a(r=>{let i="";return (Ji(r)||tr(r)||er(r))&&(i=r.type),i||Qi},"getContentType"),En=a(r=>{let i="";return tr(r)&&r.name?i=r.name:Ji(r)||bn()?i="":er(r)&&r.name&&(i=r.name),i||yn},"getFileName");function Oo(r){return typeof r>"u"||r==="auto"?"auto":r?"1":"0"}a(Oo,"getStoreValue");function fc(r,{publicKey:i,fileName:t,contentType:e,baseURL:o=P.baseURL,secureSignature:s,secureExpire:n,store:l,signal:c,onProgress:u,source:p="local",integration:d,userAgent:m,retryThrottledRequestMaxTimes:f=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=P.retryNetworkErrorMaxTimes,metadata:w}){return oe(()=>re({method:"POST",url:Gt(o,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":we({publicKey:i,integration:d,userAgent:m})},data:ir({file:{data:r,name:t||En(r),contentType:e||Tn(r)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Oo(l),signature:s,expire:n,source:p,metadata:w}),signal:c,onProgress:u}).then(({data:T,headers:S,request:x})=>{let A=qt(JSON.parse(T));if("error"in A)throw new ot(A.error.content,A.error.errorCode,x,A,S);return A}),{retryNetworkErrorMaxTimes:v,retryThrottledRequestMaxTimes:f})}a(fc,"base");var Co;(function(r){r.Token="token",r.FileInfo="file_info";})(Co||(Co={}));function gc(r,{publicKey:i,baseURL:t=P.baseURL,store:e,fileName:o,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,source:u="url",signal:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=P.retryNetworkErrorMaxTimes,metadata:w}){return oe(()=>re({method:"POST",headers:{"X-UC-User-Agent":we({publicKey:i,integration:d,userAgent:m})},url:Gt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:r,store:Oo(e),filename:o,check_URL_duplicates:s?1:void 0,save_URL_duplicates:n?1:void 0,signature:l,expire:c,source:u,metadata:w}),signal:p}).then(({data:T,headers:S,request:x})=>{let A=qt(JSON.parse(T));if("error"in A)throw new ot(A.error.content,A.error.errorCode,x,A,S);return A}),{retryNetworkErrorMaxTimes:v,retryThrottledRequestMaxTimes:f})}a(gc,"fromUrl");var ut;(function(r){r.Unknown="unknown",r.Waiting="waiting",r.Progress="progress",r.Error="error",r.Success="success";})(ut||(ut={}));var vc=a(r=>"status"in r&&r.status===ut.Error,"isErrorResponse");function yc(r,{publicKey:i,baseURL:t=P.baseURL,signal:e,integration:o,userAgent:s,retryThrottledRequestMaxTimes:n=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=P.retryNetworkErrorMaxTimes}={}){return oe(()=>re({method:"GET",headers:i?{"X-UC-User-Agent":we({publicKey:i,integration:o,userAgent:s})}:void 0,url:Gt(t,"/from_url/status/",{jsonerrors:1,token:r}),signal:e}).then(({data:c,headers:u,request:p})=>{let d=qt(JSON.parse(c));if("error"in d&&!vc(d))throw new ot(d.error.content,d.error.errorCode,p,d,u);return d}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:n})}a(yc,"fromUrlStatus");function bc(r,{publicKey:i,baseURL:t=P.baseURL,jsonpCallback:e,secureSignature:o,secureExpire:s,signal:n,source:l,integration:c,userAgent:u,retryThrottledRequestMaxTimes:p=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=P.retryNetworkErrorMaxTimes}){return oe(()=>re({method:"POST",headers:{"X-UC-User-Agent":we({publicKey:i,integration:c,userAgent:u})},url:Gt(t,"/group/",{jsonerrors:1}),data:ir({files:r,callback:e,pub_key:i,signature:o,expire:s,source:l}),signal:n}).then(({data:m,headers:f,request:v})=>{let w=qt(JSON.parse(m));if("error"in w)throw new ot(w.error.content,w.error.errorCode,v,w,f);return w}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:p})}a(bc,"group");function xn(r,{publicKey:i,baseURL:t=P.baseURL,signal:e,source:o,integration:s,userAgent:n,retryThrottledRequestMaxTimes:l=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=P.retryNetworkErrorMaxTimes}){return oe(()=>re({method:"GET",headers:{"X-UC-User-Agent":we({publicKey:i,integration:s,userAgent:n})},url:Gt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:r,source:o}),signal:e}).then(({data:u,headers:p,request:d})=>{let m=qt(JSON.parse(u));if("error"in m)throw new ot(m.error.content,m.error.errorCode,d,m,p);return m}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}a(xn,"info");function wc(r,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:o=P.multipartChunkSize,baseURL:s="",secureSignature:n,secureExpire:l,store:c,signal:u,source:p="local",integration:d,userAgent:m,retryThrottledRequestMaxTimes:f=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=P.retryNetworkErrorMaxTimes,metadata:w}){return oe(()=>re({method:"POST",url:Gt(s,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":we({publicKey:i,integration:d,userAgent:m})},data:ir({filename:e||yn,size:r,content_type:t||Qi,part_size:o,UPLOADCARE_STORE:Oo(c),UPLOADCARE_PUB_KEY:i,signature:n,expire:l,source:p,metadata:w}),signal:u}).then(({data:T,headers:S,request:x})=>{let A=qt(JSON.parse(T));if("error"in A)throw new ot(A.error.content,A.error.errorCode,x,A,S);return A.parts=Object.keys(A.parts).map(vt=>A.parts[Number(vt)]),A}),{retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v})}a(wc,"multipartStart");function Tc(r,i,{contentType:t,signal:e,onProgress:o,retryThrottledRequestMaxTimes:s=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=P.retryNetworkErrorMaxTimes}){return oe(()=>re({method:"PUT",url:i,data:r,onProgress:o,signal:e,headers:{"Content-Type":t||Qi}}).then(l=>(o&&o({isComputable:true,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n})}a(Tc,"multipartUpload");function Ec(r,{publicKey:i,baseURL:t=P.baseURL,source:e="local",signal:o,integration:s,userAgent:n,retryThrottledRequestMaxTimes:l=P.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=P.retryNetworkErrorMaxTimes}){return oe(()=>re({method:"POST",url:Gt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":we({publicKey:i,integration:s,userAgent:n})},data:ir({uuid:r,UPLOADCARE_PUB_KEY:i,source:e}),signal:o}).then(({data:u,headers:p,request:d})=>{let m=qt(JSON.parse(u));if("error"in m)throw new ot(m.error.content,m.error.errorCode,d,m,p);return m}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}a(Ec,"multipartComplete");function Io(r,{publicKey:i,baseURL:t,source:e,integration:o,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l,signal:c,onProgress:u}){return vn({check:a(p=>xn(r,{publicKey:i,baseURL:t,signal:p,source:e,integration:o,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:l}).then(d=>d.isReady?d:(u&&u({isComputable:true,value:1}),false)),"check"),signal:c})}a(Io,"isReadyPoll");function xc(r){return "defaultEffects"in r}a(xc,"isGroupFileInfo");var be=class{static{a(this,"UploadcareFile");}uuid;name;size;isStored;isImage;mimeType;cdnUrl;s3Url;originalFilename;imageInfo;videoInfo;contentInfo;metadata;s3Bucket;defaultEffects=null;constructor(i,{baseCDN:t=P.baseCDN,fileName:e}={}){let{uuid:o,s3Bucket:s}=i,n=Gt(t,`${o}/`),l=s?Gt(`https://${s}.s3.amazonaws.com/`,`${o}/${i.filename}`):null;this.uuid=o,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=s||null,this.s3Url=l,xc(i)&&(this.defaultEffects=i.defaultEffects);}},Cc=a((r,{publicKey:i,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,store:n,contentType:l,signal:c,onProgress:u,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,baseCDN:w,metadata:T})=>fc(r,{publicKey:i,fileName:t,contentType:l,baseURL:e,secureSignature:o,secureExpire:s,store:n,signal:c,onProgress:u,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,metadata:T}).then(({file:S})=>Io(S,{publicKey:i,baseURL:e,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,onProgress:u,signal:c})).then(S=>new be(S,{baseCDN:w})),"uploadDirect"),Sc=a((r,{publicKey:i,fileName:t,baseURL:e,signal:o,onProgress:s,source:n,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p,baseCDN:d})=>xn(r,{publicKey:i,baseURL:e,signal:o,source:n,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p}).then(m=>new be(m,{baseCDN:d,fileName:t})).then(m=>(s&&s({isComputable:true,value:1}),m)),"uploadFromUploaded"),Ac=a((r,{signal:i}={})=>{let t=null,e=null,o=r.map(()=>new AbortController),s=a(n=>()=>{e=n,o.forEach((l,c)=>c!==n&&l.abort());},"createStopRaceCallback");return Yi(i,()=>{o.forEach(n=>n.abort());}),Promise.all(r.map((n,l)=>{let c=s(l);return Promise.resolve().then(()=>n({stopRace:c,signal:o[l].signal})).then(u=>(c(),u)).catch(u=>(t=u,null))})).then(n=>{if(e===null)throw t;return n[e]})},"race"),kc=window.WebSocket,So=class{static{a(this,"Events");}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]=[];}},Mc=a((r,i)=>r==="success"?{status:ut.Success,...i}:r==="progress"?{status:ut.Progress,...i}:{status:ut.Error,...i},"response"),Ao=class{static{a(this,"Pusher");}key;disconnectTime;ws=void 0;queue=[];isConnected=false;subscribers=0;emmitter=new So;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 kc(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,Mc(e.event,JSON.parse(e.data)));}});}}disconnect(){let i=a(()=>{this.ws?.close(),this.ws=void 0,this.isConnected=false;},"actualDisconect");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}`,o={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(o.event,o.data):this.queue.push(o);}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(o=>o.data.channel!==t),this.subscribers===0&&this.disconnect();}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},Eo=null,Lo=a(r=>{if(!Eo){let i=typeof window>"u"?0:3e4;Eo=new Ao(r,i);}return Eo},"getPusher"),Oc=a(r=>{Lo(r).connect();},"preconnect");function Ic({token:r,publicKey:i,baseURL:t,integration:e,userAgent:o,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,onProgress:l,signal:c}){return vn({check:a(u=>yc(r,{publicKey:i,baseURL:t,integration:e,userAgent:o,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,signal:u}).then(p=>{switch(p.status){case ut.Error:return new ot(p.error,p.errorCode);case ut.Waiting:return false;case ut.Unknown:return new ot(`Token "${r}" was not found.`);case ut.Progress:return l&&(p.total==="unknown"?l({isComputable:false}):l({isComputable:true,value:p.done/p.total})),false;case ut.Success:return l&&l({isComputable:true,value:p.done/p.total}),p;default:throw new Error("Unknown status")}}),"check"),signal:c})}a(Ic,"pollStrategy");var Lc=a(({token:r,pusherKey:i,signal:t,onProgress:e})=>new Promise((o,s)=>{let n=Lo(i),l=n.onError(s),c=a(()=>{l(),n.unsubscribe(r);},"destroy");Yi(t,()=>{c(),s(new ee("pusher cancelled"));}),n.subscribe(r,u=>{switch(u.status){case ut.Progress:{e&&(u.total==="unknown"?e({isComputable:false}):e({isComputable:true,value:u.done/u.total}));break}case ut.Success:{c(),e&&e({isComputable:true,value:u.done/u.total}),o(u);break}case ut.Error:c(),s(new ot(u.msg,u.error_code));}});}),"pushStrategy"),Uc=a((r,{publicKey:i,fileName:t,baseURL:e,baseCDN:o,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,store:u,signal:p,onProgress:d,source:m,integration:f,userAgent:v,retryThrottledRequestMaxTimes:w,pusherKey:T=P.pusherKey,metadata:S})=>Promise.resolve(Oc(T)).then(()=>gc(r,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:l,secureExpire:c,store:u,signal:p,source:m,integration:f,userAgent:v,retryThrottledRequestMaxTimes:w,metadata:S})).catch(x=>(Lo(T)?.disconnect(),Promise.reject(x))).then(x=>x.type===Co.FileInfo?x:Ac([({signal:A})=>Ic({token:x.token,publicKey:i,baseURL:e,integration:f,userAgent:v,retryThrottledRequestMaxTimes:w,onProgress:d,signal:A}),({signal:A})=>Lc({token:x.token,pusherKey:T,signal:A,onProgress:d})],{signal:p})).then(x=>{if(x instanceof ot)throw x;return x}).then(x=>Io(x.uuid,{publicKey:i,baseURL:e,integration:f,userAgent:v,retryThrottledRequestMaxTimes:w,onProgress:d,signal:p})).then(x=>new be(x,{baseCDN:o})),"uploadFromUrl"),xo=new WeakMap,Pc=a(async r=>{if(xo.has(r))return xo.get(r);let i=await fetch(r.uri).then(t=>t.blob());return xo.set(r,i),i},"getBlobFromReactNativeAsset"),Cn=a(async r=>{if(tr(r)||Ji(r))return r.size;if(er(r))return (await Pc(r)).size;throw new Error("Unknown file type. Cannot determine file size.")},"getFileSize"),Rc=a((r,i=P.multipartMinFileSize)=>r>=i,"isMultipart"),Sn=a(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 !De(r)&&t.test(r)},"isUuid"),Uo=a(r=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return !De(r)&&t.test(r)},"isUrl"),$c=a((r,i)=>new Promise((t,e)=>{let o=[],s=false,n=i.length,l=[...i],c=a(()=>{let u=i.length-l.length,p=l.shift();p&&p().then(d=>{s||(o[u]=d,n-=1,n?c():t(o));}).catch(d=>{s=true,e(d);});},"run");for(let u=0;u<r;u++)c();}),"runWithConcurrency"),Dc=a((r,i,t,e)=>{let o=e*i,s=Math.min(o+e,t);return r.slice(o,s)},"sliceChunk"),Fc=a(async(r,i,t)=>e=>Dc(r,e,i,t),"prepareChunks"),Vc=a((r,i,{publicKey:t,contentType:e,onProgress:o,signal:s,integration:n,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})=>Tc(r,i,{contentType:e,onProgress:o,signal:s,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c}),"uploadPart"),_c=a(async(r,{publicKey:i,fileName:t,fileSize:e,baseURL:o,secureSignature:s,secureExpire:n,store:l,signal:c,onProgress:u,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,contentType:w,multipartChunkSize:T=P.multipartChunkSize,maxConcurrentRequests:S=P.maxConcurrentRequests,baseCDN:x,metadata:A})=>{let vt=e??await Cn(r),yt,pe=a((Y,lt)=>{if(!u)return;yt||(yt=Array(Y).fill(0));let Ct=a(Lt=>Lt.reduce((Nt,io)=>Nt+io,0),"sum");return Lt=>{Lt.isComputable&&(yt[lt]=Lt.value,u({isComputable:true,value:Ct(yt)/Y}));}},"createProgressHandler");return w||=Tn(r),wc(vt,{publicKey:i,contentType:w,fileName:t||En(r),baseURL:o,secureSignature:s,secureExpire:n,store:l,signal:c,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,metadata:A,multipartChunkSize:T}).then(async({uuid:Y,parts:lt})=>{let Ct=await Fc(r,vt,T);return Promise.all([Y,$c(S,lt.map((Lt,Nt)=>()=>Vc(Ct(Nt),Lt,{publicKey:i,contentType:w,onProgress:pe(lt.length,Nt),signal:c,integration:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v})))])}).then(([Y])=>Ec(Y,{publicKey:i,baseURL:o,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v})).then(Y=>Y.isReady?Y:Io(Y.uuid,{publicKey:i,baseURL:o,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,onProgress:u,signal:c})).then(Y=>new be(Y,{baseCDN:x}))},"uploadMultipart");async function Po(r,{publicKey:i,fileName:t,baseURL:e=P.baseURL,secureSignature:o,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:v,multipartMinFileSize:w,multipartChunkSize:T,maxConcurrentRequests:S,baseCDN:x=P.baseCDN,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:vt,pusherKey:yt,metadata:pe}){if(De(r)){let Y=await Cn(r);return Rc(Y,w)?_c(r,{publicKey:i,contentType:v,multipartChunkSize:T,fileSize:Y,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,maxConcurrentRequests:S,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:x,metadata:pe}):Cc(r,{publicKey:i,fileName:t,contentType:v,baseURL:e,secureSignature:o,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:x,metadata:pe})}if(Uo(r))return Uc(r,{publicKey:i,fileName:t,baseURL:e,baseCDN:x,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:vt,secureSignature:o,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,pusherKey:yt,metadata:pe});if(Sn(r))return Sc(r,{publicKey:i,fileName:t,baseURL:e,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:x});throw new TypeError(`File uploading from "${r}" is not supported`)}a(Po,"uploadFile");var Nc=a((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}},"replaceUrlBase"),ko=class{static{a(this,"UploadcareGroup");}uuid;filesCount;totalSize;isStored;isImage;cdnUrl;files;createdAt;storedAt=null;constructor(i,{baseCDN:t=P.baseCDN}={}){this.uuid=i.id,this.filesCount=i.filesCount;let e=i.files.filter(Boolean);this.totalSize=Object.values(e).reduce((o,s)=>o+s.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(e).filter(o=>o.isImage).length,this.cdnUrl=Nc(i.cdnUrl,t),this.files=e.map(o=>new be(o,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored;}},Bc=a(r=>{for(let i of r)if(!De(i))return false;return true},"isFileDataArray"),zc=a(r=>{for(let i of r)if(!Sn(i))return false;return true},"isUuidArray"),Hc=a(r=>{for(let i of r)if(!Uo(i))return false;return true},"isUrlArray");function An(r,{publicKey:i,fileName:t,baseURL:e=P.baseURL,secureSignature:o,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:v,multipartChunkSize:w=P.multipartChunkSize,baseCDN:T=P.baseCDN,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:x,jsonpCallback:A}){if(!Bc(r)&&!Hc(r)&&!zc(r))throw new TypeError(`Group uploading from "${r}" is not supported`);let vt,yt=true,pe=r.length,Y=a((lt,Ct)=>{if(!c)return;vt||(vt=Array(lt).fill(0));let Lt=a(Nt=>Nt.reduce((io,gl)=>io+gl)/lt,"normalize");return Nt=>{if(!Nt.isComputable||!yt){yt=false,c({isComputable:false});return}vt[Ct]=Nt.value,c({isComputable:true,value:Lt(vt)});}},"createProgressHandler");return Promise.all(r.map((lt,Ct)=>De(lt)||Uo(lt)?Po(lt,{publicKey:i,fileName:t,baseURL:e,secureSignature:o,secureExpire:s,store:n,signal:l,onProgress:Y(pe,Ct),source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:v,multipartChunkSize:w,baseCDN:T,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:x}).then(Lt=>Lt.uuid):lt)).then(lt=>bc(lt,{publicKey:i,baseURL:e,jsonpCallback:A,secureSignature:o,secureExpire:s,signal:l,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f}).then(Ct=>new ko(Ct,{baseCDN:T})).then(Ct=>(c&&c({isComputable:true,value:1}),Ct)))}a(An,"uploadFileGroup");var ie=class{static{a(this,"Queue");}Mi=1;_r=[];Oi=0;Br=new Map;zr=new Map;constructor(i){this.Mi=i;}run(){let i=this.Mi-this.Oi;for(let t=0;t<i;t++){let e=this._r.shift();if(!e)return;let o=this.Br.get(e),s=this.zr.get(e);if(!o||!s)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.Oi+=1,e().finally(()=>{this.Br.delete(e),this.zr.delete(e),this.Oi-=1,this.run();}).then(n=>o(n)).catch(n=>s(n));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,o)=>{this.Br.set(i,e),this.zr.set(i,o),this._r.push(i),t&&this.run();})}get pending(){return this._r.length}get running(){return this.Oi}set concurrency(i){this.Mi=i,this.run();}get concurrency(){return this.Mi}};var Ro=a(()=>({}),"blockCtx"),$o=a(r=>({...Ro(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":a(()=>{r.modalManager?.close(r.$["*currentActivity"]),r.pub("*currentActivity",null);},"*closeModal")}),"activityBlockCtx"),Do=a(r=>({...$o(r),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new ie(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),"uploaderBlockCtx"),kn=a(r=>({...Do(r),"*solution":null}),"solutionBlockCtx");var pt=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 rr=class extends Z{constructor(t){super(t);this.scopes=new Set;this.listener=this.fc.bind(this),window.addEventListener("paste",this.listener);}static{a(this,"ClipboardLayer");}openUploadList(){this.r.api.setCurrentActivity(pt.UPLOAD_LIST),this.r.api.setModalState(true);}async fc(t){if(t.clipboardData){for(let e of this.scopes)if(e.isConnected)switch(this.Qt.pasteScope){case "global":await this.handlePaste(t);break;case "local":if(!e.contains(t.target))continue;await this.handlePaste(t);break;default:continue}}}async handlePaste(t){let e=Array.from(t.clipboardData.items),o=e.map(n=>n.getAsFile()).filter(n=>n!==null),s=e.filter(n=>n.kind==="string"&&n.type==="text/plain").map(n=>new Promise(l=>{n.getAsString(c=>{l(c);});}));o.length>0&&(o.forEach(n=>{this.r.api.addFileFromObject(n,{source:"clipboard"});}),this.openUploadList()),s.length>0&&((await Promise.all(s)).forEach(l=>{this.r.api.addFileFromUrl(l,{source:"clipboard"});}),this.openUploadList());}registerBlock(t){return this.scopes.add(t),()=>{this.scopes.delete(t);}}destroy(){super.destroy(),window.removeEventListener("paste",this.listener),this.scopes.clear();}};var jc={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function li(r,i){i.tabIndex=0,i.focus(),r.tabIndex=-1;}a(li,"focus");function Fo(r){let i=r.role||r.type||r.tagName;if(!i)return null;let t=jc[i.toLowerCase()];if(!t)return null;for(let e of t){let o=r.closest(`[role=${e}]`);if(o)return o}}a(Fo,"findGroupNodeByEventTarget");function Vo(r,i){return i.role==="toolbar"?Kc(i):i.querySelectorAll(`[role=${r.role}]`)}a(Vo,"getItems");function Kc(r){return [...r.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}a(Kc,"getToolbarItems");function Gc(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"}a(Gc,"isHorizontalOrientation");function Mn(r){return i=>{let t=false,e=r?.searchDelayMs||300,o=0,s="";function n(d){let m=Fo(d.target);if(!m){l();return}let f=Vo(d.target,m),v=Array.from(f).indexOf(d.target),w="ArrowDown",T="ArrowUp";if(Gc(m)&&(i.document.dir==="rtl"?(w="ArrowLeft",T="ArrowRight"):(w="ArrowRight",T="ArrowLeft")),d.key===w)d.preventDefault(),li(d.target,f[v+1]||f[0]);else if(d.key===T)d.preventDefault(),li(d.target,f[v-1]||f[f.length-1]);else if(d.key==="Home")d.preventDefault(),li(d.target,f[0]);else if(d.key==="End")d.preventDefault(),li(d.target,f[f.length-1]);else if(d.key.length===1&&m.role!=="tablist"){let S=Date.now();S-o<=e?s+=d.key.toLowerCase():s=d.key.toLowerCase(),o=S;let x=Array.from(f).find(A=>A.textContent?.trim()?.toLowerCase()?.startsWith(s));x&&(d.preventDefault(),li(d.target,x));}}a(n,"keyDown");function l(){t=false,i.removeEventListener("keydown",n);}a(l,"stop");function c(d){let m=Fo(d.target);if(m){t||(t=true,i.addEventListener("keydown",n));let f=Vo(d.target,m);for(let v of f)v!==d.target&&v.setAttribute("tabindex",-1);}else t&&l();}a(c,"focusIn");function u(d){(!d.relatedTarget||d.relatedTarget===i.document)&&l();}a(u,"focusOut");function p(d){let m=Fo(d.target);if(m){let f=Vo(d.target,m);for(let v of f)v!==d.target&&v.setAttribute("tabindex",-1);d.target.setAttribute("tabindex",0);}}return a(p,"click"),i.addEventListener("click",p),i.addEventListener("focusin",c),i.addEventListener("focusout",u),()=>{l(),i.removeEventListener("click",p),i.removeEventListener("focusin",c),i.removeEventListener("focusout",u);}}}a(Mn,"focusGroupKeyUX");function On(){return r=>{let i,t;function e(s){if(s.target.getAttribute("aria-hidden")==="true"){i=s.target,i.setAttribute("aria-hidden","false"),t=i.hidden,t&&(i.hidden=false);let n=s.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');n&&(n.tabIndex=0);}}a(e,"jump");function o(s){i&&i.contains(s.target)&&(!s.relatedTarget||!i.contains(s.relatedTarget))&&(s.target.tabIndex=-1,i.setAttribute("aria-hidden","true"),t&&(i.hidden=true),i=null);}return a(o,"focusOut"),r.addEventListener("keyuxJump",e),r.addEventListener("focusout",o),()=>{r.removeEventListener("keyuxJump",e),r.removeEventListener("focusout",o);}}}a(On,"hiddenKeyUX");function In(){return r=>{let i=[];function t(c){let u=r.document.activeElement;u&&u!==r.document.body&&i.push(new WeakRef(u)),c.focus({focusVisible:true});}a(t,"focus");function e(){let c=i.pop();if(!c){r.document.activeElement.blur();return}let u=c.deref();u&&u.isConnected?u.focus():e();}a(e,"back");let o=0,s;function n(c){clearInterval(s);let u=c.getAttribute("aria-controls");s=setInterval(()=>{if(o++>50){clearInterval(s);return}let p=r.document.getElementById(u);if(p){let d=p.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');d&&(clearInterval(s),p.dispatchEvent(new r.CustomEvent("keyuxJump",{bubbles:true})),t(d));}},50);}a(n,"jump");function l(c){c.target.getAttribute("aria-controls")&&c.key==="Enter"&&n(c.target),c.key==="Escape"&&e();}return a(l,"keyDown"),r.addEventListener("keydown",l),()=>{r.removeEventListener("keydown",l);}}}a(In,"jumpKeyUX");function Ln(r){let i,t=r.split(" "),e;function o(l){l.key==="Enter"&&(l.target.tagName==="BUTTON"||l.target.tagName==="A")&&(s(),l.target.classList.add(...t),i=l.target,e=l.target);}a(o,"keyDown");function s(){i&&i.classList.remove(...t),e=null;}a(s,"keyUp");function n(l){l.clientX===0&&l.clientY===0&&e!==l.target&&(s(),l.target.classList.add(...t),i=l.target);}return a(n,"click"),l=>(l.addEventListener("click",n),l.addEventListener("keydown",o),l.addEventListener("keyup",s),()=>{l.removeEventListener("click",n),l.removeEventListener("keydown",o),l.removeEventListener("keyup",s);})}a(Ln,"pressKeyUX");function Un(r,i){let t=i.map(e=>e(r));return ()=>{t.forEach(e=>e());}}a(Un,"startKeyUX");var _o=class{constructor(){this.He=new Map;this.Hr=[];}static{a(this,"ScopedMinimalWindow");}addEventListener(i,t){let e=a(o=>{let s=o.target;s instanceof Node&&this.Hr.some(n=>n===s||n.contains(s))&&t(o);},"wrappedListener");this.He.set(t,e),window.addEventListener(i,e);}removeEventListener(i,t){let e=this.He.get(t);e&&window.removeEventListener(i,e),this.He.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this.Hr.push(i);}destroy(){this.Hr=[];for(let i of this.He.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.He.clear();}},or=class{static{a(this,"A11y");}constructor(){this.Ii=new _o,this._s=Un(this.Ii,[Mn(),Ln("is-pressed"),In(),On()]);}registerBlock(i){this.Ii.registerScope(i);}destroy(){this._s?.(),this.Ii.destroy();}};var Wt=a(r=>`*l10n/${r}`,"localeStateKey"),qc="en",sr=class extends Z{constructor(t){super(t);this.jr="";for(let[e,o]of Object.entries(oi)){let s=this.e.has(Wt(e))?!this.e.read(Wt(e)):true;this.e.add(Wt(e),o,s);}this.addSub(this.e.sub(U("localeName"),async e=>{if(!e)return;this.jr=e;let o=await rn(e);if(e!==qc&&this.jr!==e)return;let s=this.Qt.localeDefinitionOverride?.[e];for(let[n,l]of Object.entries(o)){let c=s?.[n];this.e.add(Wt(n),c??l,true);}})),this.addSub(this.e.sub(U("localeDefinitionOverride"),e=>{if(!e)return;let o=e[this.jr];if(o)for(let[s,n]of Object.entries(o))this.e.add(Wt(s),n,true);}));}static{a(this,"LocaleManager");}};function Wc(r){return r.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}a(Wc,"i");function Bo(r){return Array.isArray(r)?r.map(i=>typeof i=="object"&&i!==null?Bo(i):i):typeof r!="object"||r===null?r:Object.fromEntries(Object.entries(r).map(([i,t])=>{let e=Wc(i);return typeof t=="object"&&t!==null?[e,Bo(t)]:[e,t]}))}a(Bo,"c");function Zc(r){return {ok:true,value:r}}a(Zc,"u");function No(r){return {ok:false,error:r}}a(No,"a");var Xc="https://tlm.uploadcare.com/api/",zo=class{static{a(this,"y");}constructor(i=Xc){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let o=await fetch(e,t);if(!o.ok)return No(new Error(`Got non-200 response from "${e}". Status: ${o.status.toString()}`));try{let s=await o.json();return Zc(s)}catch(s){return No(new Error(`Error parsing JSON from "${e}". Error: ${s}`))}}catch(o){return No(new Error(`Error fetching data from "${e}". Error: ${o}`))}}async post(i,t,e={}){return await this.base(i,{...e,method:"POST",body:JSON.stringify(Bo(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},Yc=a(async(r,i)=>({success:true,data:i}),"p"),Qc=a(async r=>Yc(void 0,r),"f"),nr=class extends zo{static{a(this,"h");}constructor(){super();}async sendEvent(i,t){let e=await Qc(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 Jc=20,F=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),I=Object.freeze({FILE_ADDED:"file-added",FILE_REMOVED:"file-removed",FILE_UPLOAD_START:"file-upload-start",FILE_UPLOAD_PROGRESS:"file-upload-progress",FILE_UPLOAD_SUCCESS:"file-upload-success",FILE_UPLOAD_FAILED:"file-upload-failed",FILE_URL_CHANGED:"file-url-changed",MODAL_OPEN:"modal-open",MODAL_CLOSE:"modal-close",DONE_CLICK:"done-click",UPLOAD_CLICK:"upload-click",ACTIVITY_CHANGE:"activity-change",COMMON_UPLOAD_START:"common-upload-start",COMMON_UPLOAD_PROGRESS:"common-upload-progress",COMMON_UPLOAD_SUCCESS:"common-upload-success",COMMON_UPLOAD_FAILED:"common-upload-failed",CHANGE:"change",GROUP_CREATED:"group-created"}),ar=class extends Z{constructor(){super(...arguments);this.je=new Map;this.Li=new Set;}static{a(this,"EventEmitter");}bindTarget(t){return this.Li.add(t),()=>{this.Li.delete(t);}}Bs(t,e){for(let o of this.Li)o.dispatchEvent(new CustomEvent(t,{detail:e}));this.z?.(()=>{let o=e&&typeof e=="object"?{...e}:e;return [`event "${t}"`,o]});}emit(t,e,o={}){let{debounce:s}=o;if(typeof s!="number"&&!s){this.Bs(t,typeof e=="function"?e():e);return}this.je.has(t)&&window.clearTimeout(this.je.get(t));let n=typeof s=="number"?s:Jc,l=window.setTimeout(()=>{try{let c=typeof e=="function"?e():e;this.Bs(t,c),this.je.delete(t);}catch(c){this.z?.(()=>`Error while getting payload for event "${t}"`,c);}},n);this.je.set(t,l);}destroy(){for(let t of this.je.values())window.clearTimeout(t);this.Li.clear();}};var Pn="1.30.0-alpha.3";var Pt="blocks",Rt=Pn;var lr=class extends Z{constructor(t){super(t);this.gc=et.generateRandomUUID();this.ve=structuredClone(Q);this.Kr=false;this.Gr=null;this.Nt=false;this.zs=new nr,this.ye=new ie(10),this.addSub(this.e.sub(U("qualityInsights"),e=>{this.Nt=!!e;}));for(let e of Object.keys(this.ve))this.addSub(this.e.sub(U(e),o=>{this.Nt&&(this.Kr&&this.ve[e]!==o&&this.sendEvent({eventType:F.CHANGE_CONFIG}),this.vc(e,o));}));}static{a(this,"TelemetryManager");}yc(t){t===F.INIT_SOLUTION&&!this.Kr&&(this.Kr=true);}vc(t,e){this.ve[t]!==e&&(this.ve[t]=e);}bc(t){let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let o={...t};return (t.eventType===F.INIT_SOLUTION||t.eventType===F.CHANGE_CONFIG)&&(o.config=this.ve),{...o,appVersion:Rt,appName:Pt,sessionId:this.gc,component:this.wc,activity:this.Tc,projectPubkey:this.ve.pubkey,userAgent:navigator.userAgent,eventType:o.eventType??"",eventTimestamp:this.Ec,payload:{location:this.xc,...e}}}Cc(t){return !!(t&&[I.CHANGE,I.COMMON_UPLOAD_PROGRESS,I.FILE_ADDED,I.FILE_REMOVED,I.FILE_UPLOAD_START,I.FILE_UPLOAD_PROGRESS,I.FILE_UPLOAD_SUCCESS,I.FILE_UPLOAD_FAILED].includes(t))}sendEvent(t){if(!this.Nt)return;let e=this.bc({eventType:t.eventType,payload:t.payload,config:t.config});this.yc(t.eventType),!(this.Cc(t.eventType)||this.Gr&&this.Hs(this.Gr,e))&&this.ye.add(async()=>{this.Gr=e,await this.zs.sendEvent(e);});}sendEventError(t,e="unknown"){this.sendEvent({eventType:F.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}});}sendEventCloudImageEditor(t,e,o={}){this.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{tabId:e,node:t.currentTarget?.tagName,event:t.type,...o}}});}Hs(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 o=Object.keys(t),s=Object.keys(e);if(o.length!==s.length)return false;for(let n of o)if(!Object.hasOwn(e,n)||!this.Hs(t[n],e[n]))return false;return true}get Ec(){return Date.now()}get wc(){if(!this.e.has("*solution"))return null;let t=this.e.read("*solution");return t?t.toLowerCase():null}get Tc(){return this.e.has("*currentActivity")?this.e.read("*currentActivity"):null}get xc(){return location.origin}};var Rn=a(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},"getLocaleDirection");var eu=a(r=>r,"DEFAULT_TRANSFORMER"),Ho="{{",Dn="}}",$n="plural:";function Fe(r,i={},t={}){let{openToken:e=Ho,closeToken:o=Dn,transform:s=eu}=t;for(let n in i){let l=i[n],c=l?.toString(),u=typeof c=="string"?s(c):String(c);r=r.replaceAll(e+n+o,u);}return r}a(Fe,"applyTemplateData");function Fn(r){let i=[],t=r.indexOf(Ho);for(;t!==-1;){let e=r.indexOf(Dn,t);if(e===-1)break;let o=r.substring(t+2,e);if(o.startsWith($n)){let s=r.substring(t+2,e).replace($n,""),n=s.substring(0,s.indexOf("(")),l=s.substring(s.indexOf("(")+1,s.indexOf(")"));i.push({variable:o,pluralKey:n,countVariable:l});}t=r.indexOf(Ho,e);}return i}a(Fn,"getPluralObjects");var Vn="--uploadcare-blocks-window-height",ci=class r{static{a(this,"WindowHeightTracker");}static{this.clientsRegistry=new Set;}static{this.flush=D(()=>{document.documentElement.style.setProperty(Vn,`${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(Vn);}};var cr=a((r,i)=>new Intl.PluralRules(r).select(i),"getPluralForm");var iu=a(r=>(i,t)=>{let e=r(),o=e("locale-id")||"en",s=cr(o,t);return e(`${i}__${s}`)},"createPluralizer"),ur=a(r=>{let i=iu(()=>t),t=a((e,o={})=>{if(!e)return "";let n=r().read(Wt(e))||e,l=Fn(n);for(let u of l)o[u.variable]=i(u.pluralKey,Number(o[u.countVariable]));return Fe(n,o)},"l10n");return t},"createL10n");var ru=a(r=>r.tagName?.includes("-")??false,"isCustomElement"),dr=class{constructor(i){this.te=new Set;this.Ui=new Map;this.js=false;this.ee=i,this.ee.addController(this);}static{a(this,"TestModeController");}hostDisconnected(){this.Pi?.(),this.Pi=void 0,this.te.clear(),this.Ui.clear();}hostUpdated(){if(!this.Pi&&this.ee.has(U("testMode"))){let i=this.ee.subConfigValue("testMode",t=>{this.js=!!t,this.Ks();});this.Pi=i;}this.Sc(),this.Ks();}Sc(){let i=this.ee,t=i.renderRoot??i;if(!t)return;let e=this.ee,o=e.tagName?.toLowerCase(),s=Array.from(t.querySelectorAll("[data-testid]")).filter(n=>!ru(n));for(let n of s)if(!(o&&n.closest(o)!==e)&&!this.te.has(n)){let l=n.getAttribute("data-testid");if(!l)continue;this.te.add(n),this.Ui.set(n,l);}for(let n of Array.from(this.te))(!n.isConnected||o&&n.closest(o)!==e)&&(this.te.delete(n),this.Ui.delete(n));}Ks(){if(!this.te.size)return;let i=this.ee.testId||"";for(let t of this.te){let e=this.Ui.get(t);e&&(this.js?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var ou=Ue(ji()(Le(Bi(bt)))),C=class extends ou{constructor(){super();this.Ri=new Map;this.activityType=null;this.init$=Ro();this.l10n=ur(()=>this.sharedCtx);this.debugPrint=Zi(()=>this.sharedCtx,this.constructor.name);this.r=hn(()=>this.sharedCtx);new dr(this);}static{a(this,"LitBlock");}static{this.styleAttrs=[];}emit(t,e,o){let s=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;if(!s)return;s.emit(t,e,o);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(),ci.registerClient(this);}initCallback(){this.ot("*blocksRegistry",()=>new Set),this.ot("*eventEmitter",t=>new ar(t)),this.ot("*localeManager",t=>new sr(t)),this.ot("*modalManager",t=>new Xi(t)),this.ot("*a11y",()=>new or),this.ot("*clipboard",t=>new rr(t)),this.ot("*telemetryManager",t=>new lr(t)),this.sub(Wt("locale-id"),t=>{let e=Rn(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.at("*modalManager",false)}get telemetryManager(){return this.at("*telemetryManager")}get localeManager(){return this.at("*localeManager")}get a11y(){return this.at("*a11y")}get clipboardLayer(){return this.at("*clipboard")}get blocksRegistry(){return this.at("*blocksRegistry")}get eventEmitter(){return this.at("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),ci.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),t?.size===0&&setTimeout(()=>{this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.Ac(),z.deleteCtx(this.ctxName);}ot(t,e){if(!this.Ri.has(t)&&(!this.has(t)||!this.$[t])){let o=e(this.r);this.add(t,o,true),this.Ri.set(t,o);return}}Ac(){for(let[t,e]of this.Ri.entries())e?.destroy?.(),this.pub(t,null),this.Ri.delete(t);}at(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:qi(t),cdnUrlModifiers:bo(t),fileName:Gi(t)})}catch(e){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",e),this.telemetryManager.sendEventError(e,"secureDeliveryProxyUrlResolver. Failed to resolve secure delivery proxy URL. Falling back to the default URL."),t}return this.cfg.secureDeliveryProxy?Fe(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:a(e=>window.encodeURIComponent(e),"transform")}):t}get cfg(){if(!this.Yt){let t={};this.Yt=new Proxy(t,{set:a((e,o,s)=>{if(typeof o!="string"||!(o in Q))return false;let n=o,l=U(n);return this.has(l)||this.add(l,Q[n]),this.$[l]=s,true},"set"),get:a((e,o)=>{let s=U(o);return this.has(s)||this.add(s,Q[o]),this.$[s]},"get")});}return this.Yt}subConfigValue(t,e){let o=U(t);return this.has(o)||this.add(o,Q[t]),this.sub(o,e)}};var $t={ATTRIBUTE:1,CHILD:2},ht=a(r=>(...i)=>({Lr:r,values:i}),"e"),wt=class{static{a(this,"i");}constructor(i){}get Z(){return this.c.Z}Ur(i,t,e){this.$i=i,this.c=t,this.kc=e;}nc(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var Te=class extends wt{static{a(this,"e");}constructor(i){if(super(i),this.it=R,i.type!==$t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===R||i==null)return this.Gs=void 0,this.it=i;if(i===tt)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.Gs;this.it=i;let t=[i];return t.raw=t,this.Gs={Wt:this.constructor.resultType,strings:t,values:[]}}};Te.directiveName="unsafeHTML",Te.resultType=1;ht(Te);var ui=class extends Te{static{a(this,"t");}};ui.directiveName="unsafeSVG",ui.resultType=2;var pr=ht(ui);var _n="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol 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'><path stroke='currentColor' d='M7.395 22.5H2.454v-5.25m14.824 5.25h4.94v-5.25m0-10.5V1.5h-4.94m-9.883 0H2.454v5.25'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-photo-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-ngdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol fill='none' viewBox='0 0 20 20' id='uc-icon-square' xmlns='http://www.w3.org/2000/svg'><rect width='20' height='20' rx='4' fill='#fff'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-video-camera-full' xmlns='http://www.w3.org/2000/svg'><path d='M2 3.333a2 2 0 0 0-2 2v9.334a2 2 0 0 0 2 2h10.938a2 2 0 0 0 2-2v-2.013L20 15.646V4.354l-5.063 3.03v-2.05a2 2 0 0 0-2-2H2Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol></svg>";var Zt=class extends C{constructor(){super(...arguments);this.init$=kn(this);}static{a(this,"LitSolutionBlock");}static{this.styleAttrs=["uc-wgt-common"];}initCallback(){super.initCallback(),this.a11y?.registerBlock(this),this.clipboardLayer?.registerBlock(this),this.sharedCtx.pub("*solution",this.tagName);}render(){return y`${pr(_n)}`}};var Nn=a(r=>typeof r!="number"?0:Math.floor(r/1e3),"msToUnixTimestamp"),Bn=a((r,{threshold:i})=>{let{secureExpire:t}=r,e=Nn(Date.now()),o=Number(t),s=Nn(i);return e+s>=o},"isSecureTokenExpired");var hr=class extends Z{constructor(){super(...arguments);this.ie=null;}static{a(this,"SecureUploadsManager");}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:o,secureUploadsExpireThreshold:s}=this.Qt;if((t||e)&&o&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),o){if(!this.ie||Bn(this.ie,{threshold:s})){this.ie?this.z("Secure signature is expired. Resolving a new one..."):this.z("Secure signature is not set yet.");try{let n=await o();n?!n.secureSignature||!n.secureExpire?console.error("Secure signature resolver returned an invalid result:",n):(this.z("Secure signature resolved:",n),this.z("Secure signature will expire in",new Date(Number(n.secureExpire)*1e3).toISOString()),this.ie=n):(this.z("Secure signature resolver returned nothing."),this.ie=null);}catch(n){console.error("Secure signature resolving failed. Falling back to the previous one.",n),this.r.telemetryManager.sendEventError(n,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this.ie}return t&&e?(this.z("Secure signature and expire are set. Using them...",{secureSignature:t,secureExpire:e}),{secureSignature:t,secureExpire:e}):null}destroy(){super.destroy(),this.ie=null;}};var jo=a((r,i)=>{if(r.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}},"validateCollectionUploadError");var Ko=a((r,i)=>{let t=r.totalCount,e=i.cfg.multiple?i.cfg.multipleMin:0,o=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:o,total:t}),payload:{total:t,min:e,max:o}};if(o&&t>o)return {type:"TOO_MANY_FILES",message:i.l10n("files-count-limit-error-too-many",{min:e,max:o,total:t}),payload:{total:t,min:e,max:o}}},"validateMultiple");var su=a(()=>{let r=navigator.userAgent;return /Macintosh|Windows/.test(r)&&/Version\/[\d.]+.*Safari/.test(r)&&!/Chrome|Chromium|Edg|OPR/.test(r)},"calcIsDesktopSafari"),nu=a(()=>"capture"in document.createElement("input"),"calcHtmlMediaCaptureSupport"),au=a(()=>({safariDesktop:su()}),"calcBrowserInfo"),lu=a(()=>({htmlMediaCapture:nu()}),"calcBrowserFeatures"),zn=au(),Ee=lu();var di="image/*",Go="video/*",cu=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],uu=a(()=>zn.safariDesktop?[di]:[di,...cu],"calcImageAcceptList"),pi=uu(),mr=a(r=>r?r.filter(i=>typeof i=="string").flatMap(i=>j(i)):[],"mergeFileTypes"),qo=a((r,i)=>i.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return r.startsWith(e)}return r===t}),"matchMimeType"),Hn=a((r,i)=>i.some(t=>t.startsWith(".")?r.toLowerCase().endsWith(t.toLowerCase()):false),"matchExtension"),jn=a(r=>{let i=r?.type;return i?qo(i,pi):false},"fileIsImage");var Wo=a((r,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,o=mr([...t?pi:[],e]);if(!o.length)return;let s=r.mimeType,n=r.name;if(!s||!n)return;let l=qo(s,o),c=Hn(n,o);if(!l&&!c)return {type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:r}}},"validateFileType");var Zo=a((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}}},"validateIsImage");var Dt=1e3,xe=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),hi=a(r=>Math.ceil(r*100)/100,"round"),Kn=a((r,i=xe.AUTO)=>{let t=i===xe.AUTO;if(i===xe.BYTE||t&&r<Dt**1){let o=cr("en-US",r)==="one"?"byte":"bytes";return `${r} ${o}`}return i===xe.KB||t&&r<Dt**2?`${hi(r/Dt**1)} KB`:i===xe.MB||t&&r<Dt**3?`${hi(r/Dt**2)} MB`:i===xe.GB||t&&r<Dt**4?`${hi(r/Dt**3)} GB`:i===xe.TB||t&&r<Dt**5?`${hi(r/Dt**4)} TB`:`${hi(r/Dt**5)} PB`},"prettyBytes");var Xo=a((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:Kn(t)}),payload:{entry:r}}},"validateMaxSizeLimit");var Yo=a((r,i)=>{let{internalId:t}=r;if(!i.f.hasItem(t))return;let o=i.f.read(t)?.getValue("uploadError");if(!o)return;if(o instanceof ot)return {type:"UPLOAD_ERROR",message:o.message,payload:{entry:r,error:o}};if(o instanceof $e)return {type:"NETWORK_ERROR",message:o.message,payload:{entry:r,error:o}};let s=o instanceof Error?o:new Error("Unknown error",{cause:o});return {type:"UNKNOWN_ERROR",message:s.message,payload:{entry:r,error:s}}},"validateUploadError");var Ve={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."},du=a(r=>typeof r=="function"?{runOn:"change",validator:r}:r,"getValidatorDescriptor"),fr=class extends Z{constructor(t){super(t);this.Mc=[Zo,Wo,Xo,Yo];this.Oc=[Ko,jo];this.ye=new ie(20);this.qs=D(()=>{this.ye.run();},500);this.Vt=false;this.be=new Map;let e=D(()=>{this.runFileValidators("change"),this.runCollectionValidators();},0);this.addSub(this.e.sub(U("maxLocalFileSizeBytes"),e)),this.addSub(this.e.sub(U("multipleMin"),e)),this.addSub(this.e.sub(U("multipleMax"),e)),this.addSub(this.e.sub(U("multiple"),e)),this.addSub(this.e.sub(U("imgOnly"),e)),this.addSub(this.e.sub(U("accept"),e)),this.addSub(this.e.sub(U("validationConcurrency"),o=>{this.ye.concurrency=o;}));}static{a(this,"ValidationManager");}get f(){return this.r.uploadCollection}runFileValidators(t,e){if(this.Vt)return;let o=e??this.f.items();for(let s of o){let n=this.f.read(s);n&&this.Ic(n,t);}}runCollectionValidators(){if(this.Vt)return;let t=this.r.api,e=t.getOutputCollectionState(),o=[],s=this.Qt.collectionValidators;for(let n of [...this.Oc,...s])try{let l=n(e,t);if(!l)continue;l&&(o.push(this.Ws(l)),l.message||console.warn(Ve.MISSING_ERROR_MESSAGE));}catch(l){console.warn(Ve.COLLECTION_VALIDATION_FAILED,l);}this.e.pub("*collectionErrors",o),o.length>0&&this.r.eventEmitter.emit(I.COMMON_UPLOAD_FAILED,()=>t.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(t){let e=this.be.get(t.uid);e&&(e.abortController?.abort(),this.be.delete(t.uid));}async Ic(t,e){if(this.Vt)return;let o=this.r.api,s=this.Zs(t),n=s.promise??Promise.resolve(),l=(async()=>{if(this.Vt||(await n,this.Vt))return;let c=this.Lc(t,e);if(c.length===0||!this.f.hasItem(t.uid))return;t.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let u=o.getOutputItem(t.uid),p=new AbortController;s.abortController=p;let d=this.Qt.validationTimeout,m=this.Xs(),f=new Set(c.map(T=>T.validator)),v=[];for(let T of m)if(!f.has(T.validator)){let S=s.lastErrorThrownByValidator.get(T.validator);S&&v.push(S);}let w=c.map(T=>async()=>{if(this.Vt)return;let S=setTimeout(()=>{s.skippedValidators.add(T.validator),p.abort(),console.warn(Ve.FILE_VALIDATION_TIMEOUT);},d);try{let x=await T.validator(u,o,{signal:p.signal});if(!x||p.signal.aborted){s.lastErrorThrownByValidator.set(T.validator,void 0);return}let A=this.Ws(x);s.lastErrorThrownByValidator.set(T.validator,A),v.push(A),x.message||console.warn(Ve.MISSING_ERROR_MESSAGE);}catch(x){p.signal.aborted||(s.skippedValidators.add(T.validator),console.warn(Ve.FILE_VALIDATION_FAILED,x),this.r.telemetryManager.sendEventError(x,`file validator. ${Ve.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(S),T.runOn!=="change"&&s.skippedValidators.add(T.validator);}});if(this.qs(),await this.ye.add(async()=>{this.Vt||(t.setValue("isQueuedForValidation",false),await Promise.all(w.map(T=>T())).catch(()=>{}));},{autoRun:false}),p.signal.aborted){t.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}t.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:v});})();s.promise=l;try{await l;}finally{s.promise===l&&(s.promise=void 0);}}Ws(t){return {...t,type:t.type??"CUSTOM_ERROR"}}Zs(t){let e=this.be.get(t.uid);if(e)return e;let o={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this.be.set(t.uid,o),o}Xs(){let t=this.Qt.fileValidators;return [...this.Mc,...t].map(du)}Lc(t,e){let o=this.Zs(t);return this.Xs().filter(s=>!o.skippedValidators.has(s.validator)).filter(s=>s.runOn===e)}destroy(){this.Vt=true,this.qs.cancel();for(let t of this.be.values())t.abortController?.abort(),t.promise=void 0;this.be.clear();}};var Gn="[Typed State] Wrong property name: ",gr=class{static{a(this,"TypedData");}constructor(i){this.tt=et.generateFastUid(),this.X=z.registerCtx(i,this.tt);}get uid(){return this.tt}setValue(i,t){if(!this.X.has(i)){console.warn(`${Gn}${String(i)}`);return}this.X.read(i)!==t&&this.X.pub(i,t);}setMultipleValues(i){for(let[t,e]of Object.entries(i))this.setValue(t,e);}getValue(i){return this.X.has(i)||console.warn(`${Gn}${String(i)}`),this.X.read(i)}subscribe(i,t){return this.X.sub(i,t)}destroy(){z.deleteCtx(this.tt);}};var vr=class r{constructor(i){this._t=Object.create(null);this.Di=new Set;this.Fi=new Set;this.It=new Set;this.qr=new Set;this.Wr=new Set;this.we=new Set;this.Js=i.initialValue,this.tt=et.generateFastUid(),this.X=z.registerCtx({},this.tt),this.Ys=i.watchList||[];let t=Object.create(null);this.Qs=(e,o)=>{this.Ke&&window.clearTimeout(this.Ke),t[e]||(t[e]=new Set),t[e].add(o),this.Ke=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.Di.forEach(s=>{s({...t});}),t=Object.create(null));}),this.tn();},i.handler&&this.observeCollection(i.handler);}static{a(this,"TypedCollection");}static{this.Uc=1e4;}K(){this.Ge&&window.clearTimeout(this.Ge),this.Ge=window.setTimeout(()=>{let i=new Set(this.Wr),t=new Set(this.qr);this.Wr.clear(),this.qr.clear();for(let e of this.Fi)e?.([...this.It],i,t);this.tn();});}tn(){this.we.size!==0&&(this.qe&&window.clearTimeout(this.qe),this.qe=window.setTimeout(()=>{let i=[...this.we];this.we.clear();for(let t of i)t.destroy();},r.Uc));}observeCollection(i){return this.Fi.add(i),this.It.size>0&&this.K(),()=>{this.unobserveCollection(i);}}unobserveCollection(i){this.Fi.delete(i);}add(i){let t=new gr(this.Js);for(let[e,o]of Object.entries(i))t.setValue(e,o);return this.It.add(t.uid),this.K(),this.X.add(t.uid,t),this.Wr.add(t),this.Ys.forEach(e=>{this._t[t.uid]||(this._t[t.uid]=[]),this._t[t.uid]?.push(t.subscribe(e,()=>{this.Qs(e,t.uid);}));}),t.uid}hasItem(i){return this.It.has(i)}read(i){return this.X.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 o=this.read(i);if(!o)throw new Error(`TypedCollection#publishProp: Item with id ${i} not found`);o.setValue(t,e);}remove(i){let t=this.read(i);t&&(this.qr.add(t),this.we.add(t)),this.It.delete(i),this.K(),this.X.pub(i,void 0),this._t[i]?.forEach(e=>{e();}),delete this._t[i];}clearAll(){this.It.forEach(i=>{this.remove(i);});}observeProperties(i){return this.Di.add(i),()=>{this.unobserveProperties(i);}}unobserveProperties(i){this.Di.delete(i);}findItems(i){let t=[];return this.It.forEach(e=>{let o=this.read(e);o&&i(o)&&t.push(e);}),t}items(){return [...this.It]}get size(){return this.It.size}destroy(){this.Ke&&window.clearTimeout(this.Ke),this.Ge&&window.clearTimeout(this.Ge),this.qe&&window.clearTimeout(this.qe);for(let i of this.we)i.destroy();this.we.clear(),z.deleteCtx(this.tt),this.Di=new Set,this.Fi=new Set;for(let i of Object.keys(this._t))this._t[i]?.forEach(t=>{t();}),delete this._t[i];}};var k=Object.freeze({PHOTO:"photo",VIDEO:"video"}),Tt=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var Qo=a(r=>({isVideoRecordingEnabled:ct(r.cameraModes).includes(k.VIDEO),isPhotoEnabled:ct(r.cameraModes).includes(k.PHOTO)}),"calcCameraModes");var Jo=a((r,i)=>{for(let t of r)if(i(t))return t},"findBlockInCtx");var qn=a((r,i)=>{for(let t of r)if(i(t))return true;return false},"hasBlockInCtx");function yr(r,i){for(let t in i)t.includes("-")?r.style.setProperty(t,String(i[t])):r.style[t]=String(i[t]);}a(yr,"applyStyles");var pu=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,hu=new RegExp(`^/?(${pu.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),Wn=a(({url:r,cdnBase:i})=>{let t=new URL(i),e=new URL(ni),o=new URL(r);if(t.host!==o.host&&e.host!==o.host)return null;let s=hu.exec(o.pathname);if(!s)return null;let[,n,l,c]=s;return n?{uuid:n,cdnUrlModifiers:l||"",filename:c||null}:null},"parseCdnUrl");var Ft=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),ts=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),H=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",DRAW:"draw",...ts,...Ft});var br=a(r=>r.uploadCollection.items().map(e=>r.api.getOutputItem(e)),"getOutputData");function Zn(r){let i=new Map;return a((...e)=>{let o=JSON.stringify(e);if(i.has(o))return i.get(o);let s=r(...e);return i.set(o,s),s},"memoized")}a(Zn,"memoize");var Xn=new Set;function wr(r){Xn.has(r)||(Xn.add(r),console.warn(r));}a(wr,"warnOnce");function mu(r){let i=false;return setTimeout(()=>{i=true;},0),a(e=>((...o)=>(i&&wr(r),e(...o))),"withAssert")}a(mu,"createAsyncAssertWrapper");function Yn(r){let i={},t=r.ctx,e={progress:a(()=>t.read("*commonProgress"),"progress"),errors:a(()=>t.read("*collectionErrors"),"errors"),group:a(()=>t.read("*groupInfo"),"group"),totalCount:a(()=>r.uploadCollection.size,"totalCount"),failedCount:a(()=>i.failedEntries.length,"failedCount"),successCount:a(()=>i.successEntries.length,"successCount"),uploadingCount:a(()=>i.uploadingEntries.length,"uploadingCount"),status:a(()=>i.isFailed?"failed":i.isUploading?"uploading":i.isSuccess?"success":"idle","status"),isSuccess:a(()=>i.allEntries.length>0&&i.errors.length===0&&i.successEntries.length===i.allEntries.length,"isSuccess"),isUploading:a(()=>i.allEntries.some(s=>s.status==="uploading"),"isUploading"),isFailed:a(()=>i.errors.length>0||i.failedEntries.length>0,"isFailed"),allEntries:a(()=>br(r),"allEntries"),successEntries:a(()=>i.allEntries.filter(s=>s.status==="success"),"successEntries"),failedEntries:a(()=>i.allEntries.filter(s=>s.status==="failed"),"failedEntries"),uploadingEntries:a(()=>i.allEntries.filter(s=>s.status==="uploading"),"uploadingEntries"),idleEntries:a(()=>i.allEntries.filter(s=>s.status==="idle"),"idleEntries")},o=mu("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[s,n]of Object.entries(e)){let l=s,u=Zn(o(n));Object.defineProperty(i,l,{get:u,enumerable:true});}return i}a(Yn,"buildOutputCollectionState");var Tr=class extends Z{constructor(){super(...arguments);this.Pc=ur(()=>this.e);this.addFileFromUrl=a((t,{silent:e,fileName:o,source:s}={})=>{let n=this.f.add({externalUrl:t,fileName:o??null,silent:e??false,source:s??H.API});return this.getOutputItem(n)},"addFileFromUrl");this.addFileFromUuid=a((t,{silent:e,fileName:o,source:s}={})=>{let n=this.f.add({uuid:t,fileName:o??null,silent:e??false,source:s??H.API});return this.getOutputItem(n)},"addFileFromUuid");this.addFileFromCdnUrl=a((t,{silent:e,fileName:o,source:s}={})=>{let n=Wn({url:t,cdnBase:this.cfg.cdnCname});if(!n)throw new Error("Invalid CDN URL");let l=this.f.add({uuid:n.uuid,cdnUrl:t,cdnUrlModifiers:n.cdnUrlModifiers,fileName:o??n.filename??null,silent:e??false,source:s??H.API});return this.getOutputItem(l)},"addFileFromCdnUrl");this.addFileFromObject=a((t,{silent:e,fileName:o,source:s,fullPath:n}={})=>{let l=this.f.add({file:t,isImage:jn(t),mimeType:t.type,fileName:o??t.name,fileSize:t.size,silent:e??false,source:s??H.API,fullPath:n??null});return this.getOutputItem(l)},"addFileFromObject");this.removeFileByInternalId=a(t=>{if(!this.f.read(t))throw new Error(`File with internalId ${t} not found`);this.f.remove(t);},"removeFileByInternalId");this.uploadAll=a(()=>{let t=this.f.items().filter(e=>{let o=this.f.read(e);return o?!o.getValue("isRemoved")&&!o.getValue("isUploading")&&!o.getValue("fileInfo")&&o.getValue("errors").length===0&&!o.getValue("isValidationPending")&&!o.getValue("isQueuedForValidation"):false});t.length!==0&&(this.e.pub("*uploadTrigger",new Set(t)),this.r.eventEmitter.emit(I.COMMON_UPLOAD_START,this.getOutputCollectionState()));},"uploadAll");this.openSystemDialog=a((t={})=>{let e=Ht(mr([this.cfg.accept??"",...this.cfg.imgOnly?pi:[]])),o="uploadcare-file-input",s=document.createElement("input");if(s.setAttribute(o,""),yr(s,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),s.type="file",s.multiple=this.cfg.multiple,t.captureCamera){s.capture=this.cfg.cameraCapture;let{isPhotoEnabled:n,isVideoRecordingEnabled:l}=Qo(this.cfg);t.modeCamera===k.PHOTO&&n?s.accept=di:t.modeCamera===k.VIDEO&&l?s.accept=Go:s.accept=[di,l&&Go].filter(Boolean).join(",");}else s.accept=e;s.addEventListener("change",()=>{s.files&&([...s.files].forEach(n=>{this.addFileFromObject(n,{source:t.captureCamera?H.CAMERA:H.LOCAL});}),this.r.modalManager?.open(pt.UPLOAD_LIST),this.e.pub("*currentActivity",pt.UPLOAD_LIST),s.remove());},{once:true}),document.querySelectorAll(`[${o}]`).forEach(n=>{n.remove();}),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"));},"openSystemDialog");this.initFlow=a((t=false)=>{if(this.f.size>0&&!t)this.r.modalManager?.open(pt.UPLOAD_LIST),this.e.pub("*currentActivity",pt.UPLOAD_LIST);else if(this.Et?.length===1){let e=this.Et[0];if(e==="local"){this.e.pub("*currentActivity",pt.UPLOAD_LIST),this.openSystemDialog();return}if(e==="camera"&&Ee.htmlMediaCapture){let{isPhotoEnabled:o,isVideoRecordingEnabled:s}=Qo(this.cfg);if(o&&s){this.e.pub("*currentActivity",pt.START_FROM);return}else if(o||s){this.openSystemDialog({captureCamera:true,modeCamera:o?k.PHOTO:k.VIDEO});return}else this.openSystemDialog({captureCamera:true,modeCamera:k.PHOTO});}setTimeout(()=>{if(e!==this.Et[0])return;let o=this.r.blocksRegistry;Jo(o,a(l=>"type"in l&&l.type===e,"isSourceBtn"))?.activate();},0),this.e.read("*currentActivity")&&this.r.modalManager?.open(this.e.read("*currentActivity"));}else this.r.modalManager?.open(pt.START_FROM),this.e.pub("*currentActivity",pt.START_FROM);},"initFlow");this.doneFlow=a(()=>{let t=Jo(this.r.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.r.modalManager?.closeAll());},"doneFlow");this.setCurrentActivity=a((t,...e)=>{if(qn(this.r.blocksRegistry,o=>o.activityType===t)){this.e.pub("*currentActivityParams",e[0]??{}),this.e.pub("*currentActivity",t);return}console.warn(`Activity type "${t}" not found in the context`);},"setCurrentActivity");this.getCurrentActivity=a(()=>this.e.read("*currentActivity"),"getCurrentActivity");this.setModalState=a(t=>{if(t&&!this.e.read("*currentActivity")){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}t?this.r.modalManager?.open(this.e.read("*currentActivity")):(this.r.modalManager?.close(this.e.read("*currentActivity")),this.e.pub("*currentActivity",null));},"setModalState");}static{a(this,"UploaderPublicApi");}get f(){return this.r.uploadCollection}get cfg(){return this.Qt}get l10n(){return this.Pc}removeAllFiles(){this.f.clearAll();}getOutputItem(t){let e=z.getCtx(t);if(!e)throw new Error(`UploaderPublicApi#getOutputItem: Entry with ID "${t}" not found in the upload collection`);let o=e.store,s=o.fileInfo,n=o.isRemoved?"removed":o.errors.length>0?"failed":o.fileInfo?"success":o.isUploading?"uploading":"idle";return {uuid:s?.uuid??o.uuid??null,internalId:t,name:s?.originalFilename??o.fileName,size:s?.size??o.fileSize,isImage:s?.isImage??o.isImage,mimeType:s?.mimeType??o.mimeType,file:o.file,externalUrl:o.externalUrl,cdnUrlModifiers:o.cdnUrlModifiers,cdnUrl:o.cdnUrl??s?.cdnUrl??null,fullPath:o.fullPath,uploadProgress:o.uploadProgress,fileInfo:s??null,metadata:o.metadata??s?.metadata??null,isSuccess:n==="success",isUploading:n==="uploading",isFailed:n==="failed",isRemoved:n==="removed",isValidationPending:o.isValidationPending,errors:o.errors,status:n,source:o?.source}}getOutputCollectionState(){return Yn(this.r)}get Et(){let t=[];return this.cfg.sourceList&&(t=j(this.cfg.sourceList)),t}};var Qn={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};var mi=33.333333333333336,M=1,es=24,Jn=6;function se(r,i){for(let[t,e]of Object.entries(i))r.setAttributeNS(null,t,e.toString());}a(se,"setSvgNodeAttrs");function mt(r,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",r);return se(t,i),t}a(mt,"createSvgNode");function ta(r,i,t){let{x:e,y:o,width:s,height:n}=r,l=i.includes("w")?0:1,c=i.includes("n")?0:1,u=l===0?-1:1,p=c===0?-1:1,d=[e+l*s+1.5*u,o+c*n+1.5*p-24*t*p],m=[e+l*s+1.5*u,o+c*n+1.5*p],f=[e+l*s-24*t*u+1.5*u,o+c*n+1.5*p],v=`M ${d[0]} ${d[1]} L ${m[0]} ${m[1]} L ${f[0]} ${f[1]}`,w=[m[0],m[1]];return {d:v,center:w}}a(ta,"cornerPath");function ea(r,i,t){let{x:e,y:o,width:s,height:n}=r,l=i==="n"||i==="s",c=i==="w"||i==="e",u=l?.5:i==="w"?0:1,p=c?.5:i==="n"?0:1,d=i==="w"?-1:i==="e"?1:0,m=i==="n"?-1:i==="s"?1:0,f,v;l?(f=[e+u*s-34*t/2,o+p*n+1.5*m],v=[e+u*s+34*t/2,o+p*n+1.5*m]):(f=[e+u*s+1.5*d,o+p*n-34*t/2],v=[e+u*s+1.5*d,o+p*n+34*t/2]);let w=`M ${f[0]} ${f[1]} L ${v[0]} ${v[1]}`,T=[(f[0]+v[0])/2,(f[1]+v[1])/2];return {d:w,center:T}}a(ea,"sidePath");function ia(r){return r===""?"move":["e","w"].includes(r)?"ew-resize":["n","s"].includes(r)?"ns-resize":["nw","se"].includes(r)?"nwse-resize":"nesw-resize"}a(ia,"thumbCursor");function ra({rect:r,delta:[i,t],imageBox:e}){return Ne({...r,x:r.x+i,y:r.y+t},e)}a(ra,"moveRect");function Ne(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}}a(Ne,"constraintRect");function fu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,o]=i,{y:s,width:n,height:l}=r;s+=o,l-=o,t&&(n=l*t);let c=r.x+r.width/2-n/2;return s<=e.y&&(s=e.y,l=r.y+r.height-s,t&&(n=l*t,c=r.x+r.width/2-n/2)),c<=e.x&&(c=e.x,s=r.y+r.height-l),c+n>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-c,t&&(l=n/t),s=r.y+r.height-l),l<M&&(l=M,t&&(n=l*t,c=r.x+r.width/2-n/2),s=r.y+r.height-l),n<M&&(n=M,t&&(l=n/t,c=r.x+r.width/2-n/2),s=r.y+r.height-l),{x:c,y:s,width:n,height:l}}a(fu,"resizeNorth");function gu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o]=i,{x:s,width:n,height:l}=r;s+=o,n-=o,t&&(l=n/t);let c=r.y+r.height/2-l/2;return s<=e.x&&(s=e.x,n=r.x+r.width-s,t&&(l=n/t,c=r.y+r.height/2-l/2)),c<=e.y&&(c=e.y,s=r.x+r.width-n),c+l>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-c,t&&(n=l*t),s=r.x+r.width-n),l<M&&(l=M,t&&(n=l*t),c=r.y+r.height/2-l/2,s=r.x+r.width-n),n<M&&(n=M,t&&(l=n/t),c=r.y+r.height/2-l/2,s=r.x+r.width-n),{x:s,y:c,width:n,height:l}}a(gu,"resizeWest");function vu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[,o]=i,{y:s,width:n,height:l}=r;l+=o,t&&(n=l*t);let c=r.x+r.width/2-n/2;return s+l>=e.y+e.height&&(l=e.y+e.height-s,t&&(n=l*t),c=r.x+r.width/2-n/2),c<=e.x&&(c=e.x,s=r.y),c+n>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-c,t&&(l=n/t),s=r.y),l<M&&(l=M,t&&(n=l*t),c=r.x+r.width/2-n/2),n<M&&(n=M,t&&(l=n/t),c=r.x+r.width/2-n/2),{x:c,y:s,width:n,height:l}}a(vu,"resizeSouth");function yu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o]=i,{x:s,width:n,height:l}=r;n+=o,t&&(l=n/t);let c=r.y+r.height/2-l/2;return s+n>=e.x+e.width&&(n=e.x+e.width-s,t&&(l=n/t),c=r.y+r.height/2-l/2),c<=e.y&&(c=e.y,s=r.x),c+l>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-c,t&&(n=l*t),s=r.x),l<M&&(l=M,t&&(n=l*t),c=r.y+r.height/2-l/2),n<M&&(n=M,t&&(l=n/t),c=r.y+r.height/2-l/2),{x:s,y:c,width:n,height:l}}a(yu,"resizeEast");function bu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:l,width:c,height:u}=r;return n+o<e.x&&(o=e.x-n),l+s<e.y&&(s=e.y-l),n+=o,c-=o,l+=s,u-=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l-=s,l<=e.y&&(u=u-(e.y-l),c=u*t,n=r.x+r.width-c,l=e.y)):t&&(o=u*t-c,c=c+o,n-=o,n<=e.x&&(c=c-(e.x-n),u=c/t,n=e.x,l=r.y+r.height-u)),u<M&&(u=M,t&&(c=u*t),n=r.x+r.width-c,l=r.y+r.height-u),c<M&&(c=M,t&&(u=c/t),n=r.x+r.width-c,l=r.y+r.height-u),{x:n,y:l,width:c,height:u}}a(bu,"resizeNorthWest");function wu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:l,width:c,height:u}=r;return n+c+o>e.x+e.width&&(o=e.x+e.width-n-c),l+s<e.y&&(s=e.y-l),c+=o,l+=s,u-=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l-=s,l<=e.y&&(u=u-(e.y-l),c=u*t,n=r.x,l=e.y)):t&&(o=u*t-c,c+=o,n+c>=e.x+e.width&&(c=e.x+e.width-n,u=c/t,n=e.x+e.width-c,l=r.y+r.height-u)),u<M&&(u=M,t&&(c=u*t),l=r.y+r.height-u),c<M&&(c=M,t&&(u=c/t),l=r.y+r.height-u),{x:n,y:l,width:c,height:u}}a(wu,"resizeNorthEast");function Tu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:l,width:c,height:u}=r;return n+o<e.x&&(o=e.x-n),l+u+s>e.y+e.height&&(s=e.y+e.height-l-u),n+=o,c-=o,u+=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l+u>=e.y+e.height&&(u=e.y+e.height-l,c=u*t,n=r.x+r.width-c,l=e.y+e.height-u)):t&&(o=u*t-c,c+=o,n-=o,n<=e.x&&(c=c-(e.x-n),u=c/t,n=e.x,l=r.y)),u<M&&(u=M,t&&(c=u*t),n=r.x+r.width-c),c<M&&(c=M,t&&(u=c/t),n=r.x+r.width-c),{x:n,y:l,width:c,height:u}}a(Tu,"resizeSouthWest");function Eu({rect:r,delta:i,aspectRatio:t,imageBox:e}){let[o,s]=i,{x:n,y:l,width:c,height:u}=r;return n+c+o>e.x+e.width&&(o=e.x+e.width-n-c),l+u+s>e.y+e.height&&(s=e.y+e.height-l-u),c+=o,u+=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l+u>=e.y+e.height&&(u=e.y+e.height-l,c=u*t,n=r.x,l=e.y+e.height-u)):t&&(o=u*t-c,c+=o,n+c>=e.x+e.width&&(c=e.x+e.width-n,u=c/t,n=e.x+e.width-c,l=r.y)),u<M&&(u=M,t&&(c=u*t)),c<M&&(c=M,t&&(u=c/t)),{x:n,y:l,width:c,height:u}}a(Eu,"resizeSouthEast");function oa({direction:r,...i}){switch(r){case "n":return fu(i);case "w":return gu(i);case "s":return vu(i);case "e":return yu(i);case "nw":return bu(i);case "ne":return wu(i);case "sw":return Tu(i);case "se":return Eu(i);default:return i.rect}}a(oa,"resizeRect");function sa(r,[i,t]){return r.x<=i&&i<=r.x+r.width&&r.y<=t&&t<=r.y+r.height}a(sa,"rectContainsPoint");function na(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}a(na,"isRectInsideRect");function aa(r,i){return Math.abs(r.width/r.height-i)<.1}a(aa,"isRectMatchesAspectRatio");function Be({width:r,height:i},t){let e=t/90%2!==0;return {width:e?i:r,height:e?r:i}}a(Be,"rotateSize");function la(r,i,t){let e=r/i,o,s;e>t?(o=Math.round(i*t),s=i):(o=r,s=Math.round(r/t));let n=Math.round((r-o)/2),l=Math.round((i-s)/2);return n+o>r&&(o=r-n),l+s>i&&(s=i-l),{x:n,y:l,width:o,height:s}}a(la,"calculateMaxCenteredCropFrame");function ze(r){return {x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)}}a(ze,"roundRect");function ne(r,i,t){return Math.min(Math.max(r,i),t)}a(ne,"clamp");var fi=["free"],xr=a(r=>{let i=j(r);if(!i||i.length===0)return [];let t=[];for(let e of i){let o=e.trim();if(!o)continue;let s=o.indexOf(":");if(s===-1&&!fi.includes(o)){console.warn(`Invalid crop preset: ${o}`);continue}let n=Number(o.slice(0,s)),l=Number(o.slice(s+1));if((!Number.isFinite(n)||!Number.isFinite(l)||n<=0||l<=0)&&!fi.includes(o)){console.warn(`Invalid crop preset: ${o}`);continue}t.push({id:et.generateFastUid(),type:"aspect-ratio",width:fi.includes(o)?0:n,height:fi.includes(o)?0:l,hasFreeform:fi.includes(o)});}return t},"parseCropPreset"),ca=a((r,i,t,e=.1)=>{let o=r/i,s=null,n=1/0;for(let l of t){let[c,u]=[l.width,l.height],p=c/u,d=Math.abs(o-p);d<n&&(n=d,s=l);}if(s){let[l,c]=[s.width,s.height],u=l/c;if(Math.abs(o-u)/u>e)return null}return s},"getClosestAspectRatio");function ua(r){return Mo({...r,libraryName:Pt,libraryVersion:Rt})}a(ua,"customUserAgent");var da="active",He="___ACTIVITY_IS_ACTIVE___",pa,E=class r extends(pa=C,pa){constructor(){super(...arguments);this.historyTracked=false;this.init$=$o(this);this.Rc=D(this.$c.bind(this),10);}static{a(this,"LitActivityBlock");}en(){let t=r.We.get(this);this[He]=false,this.removeAttribute(da),t?.deactivateCallback?.();}Dc(){let t=r.We.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[He]=true,this.setAttribute(da,""),t?.activateCallback?.(),this.Rc(),this.emit(I.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[He]?this.en():this.activityType===t&&!this[He]&&this.Dc();}catch(e){this.telemetryManager.sendEventError(e,`activity "${this.activityType}"`),console.error(`Error in activity "${this.activityType}". `,e),this.$["*currentActivity"]=this.$["*history"][this.$["*history"].length-1]??null;}t||(this.$["*history"]=[]);}));}$c(){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);}Fc(){return !!this.activityType&&r.We.has(this)}static{this.We=new Map;}get isActivityActive(){return !!this[He]}get couldOpenActivity(){return true}registerActivity(t,e={}){let{onActivate:o,onDeactivate:s}=e;r.We.set(this,{activateCallback:o,deactivateCallback:s});}Nc(){this.isActivityActive&&this.en(),r.We.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.Fc()&&this.Nc();let t=this.$["*currentActivity"];this.blocksRegistry&&([...this.blocksRegistry].find(o=>o instanceof r&&o.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 o=!!e;e&&(o=[...this.blocksRegistry].find(n=>n.activityType===e)?.couldOpenActivity??false),e=o?e:void 0,e&&this.modalManager?.open(e),this.$["*currentActivity"]=e??null,this.$["*history"]=t,e||this.modalManager?.closeAll();}}};E.activities=pt;var $=class r extends E{constructor(){super(...arguments);this.couldBeCtxOwner=false;this.Ni=false;this.init$=Do(this);this.Yr=D(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(I.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this.Hc(e);},300);this.Bc=(t,e,o)=>{if(this.isConnected){(e.size||o.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators("add",[...e].map(s=>s.uid));for(let s of e)s.getValue("silent")||this.emit(I.FILE_ADDED,this.api.getOutputItem(s.uid));this.validationManager.runCollectionValidators();for(let s of o){this.$["*uploadTrigger"].delete(s.uid),this.validationManager.cleanupValidationForEntry(s),s.getValue("abortController")?.abort(),s.setMultipleValues({isRemoved:true,abortController:null,isUploading:false,uploadProgress:0});let n=s?.getValue("thumbUrl");n&&URL.revokeObjectURL(n),this.emit(I.FILE_REMOVED,this.api.getOutputItem(s.uid));}this.$["*uploadList"]=t.map(s=>({uid:s})),this.nn(),this.Yr();}};this.zc=t=>{if(!this.isConnected)return;this.Yr();let e=this.uploadCollection,o=[...new Set(Object.entries(t).filter(([s])=>["uploadError","fileInfo","cdnUrl","cdnUrlModifiers"].includes(s)).flatMap(([,s])=>[...s]))];if(o.length>0&&setTimeout(()=>{if(!this.isConnected)return;let s=o.filter(n=>t.fileInfo?.has(n)&&!!z.getCtx(n)?.store.fileInfo);s.length>0&&this.validationManager.runFileValidators("upload",s),this.validationManager.runFileValidators("change",o);}),t.uploadProgress){for(let s of t.uploadProgress){let n=z.getCtx(s);if(!n)continue;let{isUploading:l,silent:c}=n.store;l&&!c&&this.emit(I.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(s));}this.nn();}if(t.isUploading)for(let s of t.isUploading){let n=z.getCtx(s);if(!n)continue;let{isUploading:l,silent:c}=n.store;l&&!c&&this.emit(I.FILE_UPLOAD_START,this.api.getOutputItem(s));}if(t.fileInfo){for(let s of t.fileInfo){let n=z.getCtx(s);if(!n)continue;let{fileInfo:l,silent:c}=n.store;l&&!c&&this.emit(I.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(s));}this.cfg.cropPreset&&this.jc(),this.cfg.cloudImageEditorAutoOpen&&this.Kc();}if(t.errors){this.validationManager.runCollectionValidators();for(let l of t.errors){let c=z.getCtx(l);if(!c)continue;let{errors:u}=c.store;u.length>0&&(this.emit(I.FILE_UPLOAD_FAILED,this.api.getOutputItem(l)),this.emit(I.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let s=e.findItems(l=>!!l.getValue("fileInfo")),n=e.findItems(l=>l.getValue("errors").length>0);e.size>0&&n.length===0&&e.size===s.length&&this.$["*collectionErrors"].length===0&&this.emit(I.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}t.cdnUrl&&([...t.cdnUrl].filter(n=>!!this.uploadCollection.read(n)?.getValue("cdnUrl")).forEach(n=>{this.emit(I.FILE_URL_CHANGED,this.api.getOutputItem(n));}),this.$["*groupInfo"]=null);};this.nn=()=>{let t=0,o=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));o.forEach(n=>{let l=this.uploadCollection.readProp(n,"uploadProgress");typeof l=="number"&&(t+=l);});let s=o.length?Math.round(t/o.length):0;this.$["*commonProgress"]!==s&&(this.$["*commonProgress"]=s,this.emit(I.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}static{a(this,"LitUploaderBlock");}get Vc(){return this.hasBlockInCtx(t=>t instanceof r?t.Ni&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this.ot("*uploadCollection",()=>new vr({initialValue:Qn,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]})),this.ot("*secureUploadsManager",t=>new hr(t)),this.ot("*validationManager",t=>new fr(t)),this.ot("*publicApi",t=>new Tr(t)),!this.Vc&&this.couldBeCtxOwner&&this._c();}getAPI(){return this.api}get validationManager(){return this.at("*validationManager")}get api(){return this.at("*publicApi")}get uploadCollection(){return this.at("*uploadCollection")}get secureUploadsManager(){return this.at("*secureUploadsManager")}disconnectedCallback(){super.disconnectedCallback(),this.Ni&&this.rn(),this.Yr.cancel();}connectedCallback(){super.connectedCallback(),this.Ni&&this.sn();}_c(){this.Ni=true,this.sn(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}sn(){this.rn(),this.Zr=this.uploadCollection.observeCollection(this.Bc),this.Xr=this.uploadCollection.observeProperties(this.zc);}rn(){this.Xr?.(),this.Zr?.(),this.Xr=void 0,this.Zr=void 0;}async Hc(t){let e=await this.getUploadClientOptions(),o=t.allEntries.map(c=>c.uuid+(c.cdnUrlModifiers?`/${c.cdnUrlModifiers}`:"")),s=new AbortController,n=await An(o,{...e,signal:s.signal});if(this.$["*collectionState"]!==t){s.abort();return}this.$["*groupInfo"]=n;let l=this.api.getOutputCollectionState();this.emit(I.GROUP_CREATED,l),this.emit(I.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.$["*collectionState"]=l;}Kc(){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===E.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:t.uid},this.$["*currentActivity"]=E.activities.CLOUD_IMG_EDIT,this.modalManager?.open(E.activities.CLOUD_IMG_EDIT));}jc(){let t=xr(this.cfg.cropPreset);if(t){let[e]=t,o=this.uploadCollection.findItems(s=>!!s.getValue("fileInfo")&&s.getValue("isImage")&&!s.getValue("cdnUrlModifiers")?.includes("/crop/")).map(s=>this.uploadCollection.read(s)).filter(Boolean);for(let s of o){let n=s.getValue("fileInfo");if(!n||!n.imageInfo){console.warn("Failed to get image info for entry",s.uid);continue}let{width:l,height:c}=n.imageInfo,u=typeof e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,p=la(l,c,u),d=it(`crop/${p.width}x${p.height}/${p.x},${p.y}`,"preview"),m=s.getValue("cdnUrl");if(!m){console.warn("Failed to get cdnUrl for entry",s.uid);continue}s.setMultipleValues({cdnUrlModifiers:d,cdnUrl:q(m,d)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(f=>f.activityType===E.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:s.uid},this.$["*currentActivity"]=E.activities.CLOUD_IMG_EDIT,this.modalManager?.open(E.activities.CLOUD_IMG_EDIT));}}}async getMetadataFor(t){let e=this.cfg.metadata||void 0;if(typeof e=="function"){let o=this.api.getOutputItem(t);return await e(o)}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:ua,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 br(this.r)}};$.extSrcList=Object.freeze({...Ft});$.sourceTypes=Object.freeze({...H});var gi=class extends C{constructor(){super(...arguments);this.name="";this.Qr="";this.an=null;}static{a(this,"Icon");}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",t=>{this.an=t,this.ln();});}willUpdate(t){super.willUpdate(t),t.has("name")&&this.ln();}ln(){if(!this.name){this.Qr="";return}let t=`#uc-icon-${this.name}`,e=this.an?.(this.name);this.Qr=e??t;}render(){return y` ${this.yield("",y`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.Qr}></use></svg>`)} `}};h([b({type:String})],gi.prototype,"name",2),h([g()],gi.prototype,"Qr",2);var ha=a(r=>[...new Set(r)],"uniqueArray");var Ce="--uc-img-",is="unresolved";var rs=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),os=3e3,ss=5e3,ns=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var xu="https://ucarecdn.com",je=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:xu},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});var Cr=class extends Le(Ue(bt)){constructor(){super();this.Te={};this.w=new Map;this.Ee=null;this.Vi=null;for(let t in je){let e=je[t];this.Te[Ce+t]=e?.default||"";}}static{a(this,"ImgConfig");}createRenderRoot(){return this}$$(t){return this.Te[Ce+t]}set$$(t){for(let e in t){let o=Ce+e,s=t[e];this.Te[o]=s,this.K(o,s);}}sub$$(t,e){let o=Ce+t;this.w.has(o)||this.w.set(o,new Set),this.w.get(o)?.add(e);let s=this.Te[o];s!==null&&s!==""&&e(s);}K(t,e){this.w.has(t)&&this.w.get(t)?.forEach(o=>{e===null||e===""||o(e);});}analyticsParams(){return `-/@clib/${Pt}/${Rt}/uc-img/`}initAttributes(t){Array.from(this.attributes).forEach(e=>{let o=e;je[o.name]||t.setAttribute(o.name,o.value);});}initIntersection(t,e){let o={root:null,rootMargin:"0px"};this.Ee=new IntersectionObserver(s=>{s.forEach(n=>{n.isIntersecting&&(e(),this.Ee?.unobserve(t));});},o),this.Ee.observe(t),this.Vi||(this.Vi=new Set),this.Vi.add(t);}connectedCallback(){super.connectedCallback(),this.Gc();}Gc(){for(let t in je){let e=Ce+t,o=this.getCssData(e,true);o!=null&&(this.Te[e]=o);}}disconnectedCallback(){super.disconnectedCallback(),this.Ee&&(this.Vi?.forEach(t=>{this.Ee?.unobserve(t);}),this.Ee=null),this.w.clear();}static get observedAttributes(){return Object.keys(je)}attributeChangedCallback(t,e,o){window.setTimeout(()=>{let s=Ce+t;this.Te[s]=o,this.K(s,o);});}};var ma=a(r=>Object.entries(r).filter(([i,t])=>t!==void 0&&t!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`),"parseObjectToString");var kr=class extends Cr{constructor(){super(...arguments);this.Lt=new Image;this.xt=new Image;}static{a(this,"ImgBase");}cn(t){return !t.includes("//")&&!rs&&(t=new URL(t,document.baseURI).href),t}_i(t){if(!t)return;let e=t,o=e.match(/\d+/)?.[0],s=e.match(/[a-zA-Z]+/)?.[0];if(!o||!s)return;let n=parseInt(o,10);return Number(n)>ss&&this.un?ss+s:Number(n)>os&&!this.un?os+s:t}qc(t,e){let o={format:this.Jr("format"),quality:this.Jr("quality"),resize:this._i(t),blur:e,"cdn-operations":this.Jr("cdn-operations")??void 0,analytics:this.analyticsParams()};return it(...ma(o))}Jr(t){let e=this.$$(t);if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}pt(t="",e=""){let o=this.$$("src");if(o.startsWith("data:")||o.startsWith("blob:"))return o;if(rs&&o&&!o.includes("//"))return this.Ze(o);let s=this.qc(t,e),n=this.$$("cdn-cname"),l=n;if(o.startsWith(String(n)))return q(o,s);let c=this.$$("uuid");if(l&&c)return this.Ze(q(Jt(l,c),s));if(c)return this.Ze(q(Jt(l,c),s));let u=this.$$("proxy-cname");if(u)return this.Ze(q(u,s,this.cn(o)));let p=this.$$("pubkey");if(p)return this.Ze(q(`https://${p}.ucr.io/`,s,this.cn(o)))}Ze(t){let e=this.$$("secure-delivery-proxy");return e?Fe(e,{previewUrl:t},{transform:a(o=>window.encodeURIComponent(o),"transform")}):t}xe(t,e=1,o=true){let s=t.getBoundingClientRect(),n=e*Math.round(s.width),l=o?"":e*Math.round(s.height);return n||l?`${n||""}x${l||""}`:null}Wc(t){let e=a(s=>{s.stopPropagation();let n=new Event(s.type,s);this.dispatchEvent(n);},"proxifyEvent"),o=["load","error"];for(let s of o)t.addEventListener(s,e);}get img(){return this.Ut||(this.to({elNode:this.Lt}),this.appendChild(this.Lt)),this.Lt}get Bi(){return this.Ut?{type:ns.PREVIEW,img:this.xt}:{type:ns.MAIN,img:this.img}}get Ut(){return this.$$("is-preview-blur")}get dn(){return this.$$("is-background-for")}get pn(){let t=this.$$("breakpoints");if(t){let e=j(t);return ha(e.map(o=>parseInt(o,10)))}else return null}get un(){return this.$$("format").toLowerCase()==="jpeg"}hn(t){let e=new Set;e.add(`url("${this.pt(this.xe(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this.pt(this.xe(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this.pt(this.xe(t,3))}") ${3}x`);let o=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",o),t.style.setProperty("background-image",`-webkit-${o}`);}mn(){let t=new Set;return this.pn?this.pn.forEach(e=>{t.add(`${this.pt(`${e}x`)} ${this._i(`${e}w`)}`),this.$$("hi-res-support")&&t.add(`${this.pt(`${e*2}x`)} ${this._i(`${e*2}w`)}`),this.$$("ultra-res-support")&&t.add(`${this.pt(`${e*3}x`)} ${this._i(`${e*3}w`)}`);}):(t.add(`${this.pt(this.xe(this.Bi.img))} 1x`),this.$$("hi-res-support")&&t.add(`${this.pt(this.xe(this.Bi.img,2))} 2x`),this.$$("ultra-res-support")&&t.add(`${this.pt(this.xe(this.Bi.img,3))} 3x`)),[...t].join()}gn(){return this.pt()}get vn(){return this.pt("100x","100")}Zc(){let t=this.dn;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.hn(e);}):this.hn(e);});}Xc({elNode:t,src:e,srcset:o}){e&&(t.src=e),o&&(t.srcset=o);}to({elNode:t}){this.Wc(t),this.initAttributes(t);}eo({src:t,srcset:e,elNode:o}){return new Promise((s,n)=>{this.to({elNode:o}),o.setAttribute(is,""),o.addEventListener("load",()=>{o.removeAttribute(is),s(o);}),o.addEventListener("error",()=>{n(false);}),this.Xc({elNode:o,src:t,srcset:e});})}async Yc(){if(this.$$("intersection")){this.Ut&&(this.to({elNode:this.xt}),this.appendChild(this.xt)),this.initIntersection(this.Bi.img,async()=>{this.Ut&&(this.xt.src=this.vn);try{await this.eo({src:this.gn(),srcset:this.mn(),elNode:this.Lt}),this.Ut&&await this.xt.remove(),this.appendChild(this.Lt);}catch{this.Ut&&await this.xt?.remove(),this.appendChild(this.Lt);}});return}try{this.Ut&&(await this.eo({src:this.vn,elNode:this.xt}),this.appendChild(this.xt)),await this.eo({src:this.gn(),srcset:this.mn(),elNode:this.Lt}),this.Ut&&await this.xt?.remove(),this.appendChild(this.Lt);}catch{this.Ut&&await this.xt?.remove(),this.appendChild(this.Lt);}}init(){this.dn?this.Zc():this.Yc();}};var as=class extends kr{static{a(this,"Img");}connectedCallback(){super.connectedCallback(),this.sub$$("src",()=>{this.init();}),this.sub$$("uuid",()=>{this.init();}),this.sub$$("lazy",i=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=i?"lazy":"eager");});}};var{I:Cu}=Zs,fa=a(r=>r,"i");var va=a(r=>r.strings===void 0,"r"),ga=a(()=>document.createComment(""),"s"),Ke=a((r,i,t)=>{let e=r.Ot.parentNode,o=i===void 0?r.me:i.Ot;if(t===void 0){let s=e.insertBefore(ga(),o),n=e.insertBefore(ga(),o);t=new Cu(s,n,r,r.options);}else {let s=t.me.nextSibling,n=t.c,l=n!==r;if(l){let c;t.Qc?.(r),t.c=r,t.xi!==void 0&&(c=r.Z)!==n.Z&&t.xi(c);}if(s!==o||l){let c=t.Ot;for(;c!==s;){let u=fa(c).nextSibling;fa(e).insertBefore(c,o),c=u;}}}return t},"v"),ae=a((r,i,t=r)=>(r.wt(i,t),r),"u"),Su={},ya=a((r,i=Su)=>r.i=i,"p"),ba=a(r=>r.i,"M"),Mr=a(r=>{r.fe(),r.Ot.remove();},"h");var vi=a((r,i)=>{let t=r.bt;if(t===void 0)return false;for(let e of t)e.Ms?.(i,false),vi(e,i);return true},"s"),Or=a(r=>{let i,t;do{if((i=r.c)===void 0)break;t=i.bt,t.delete(r),r=i;}while(t?.size===0)},"o"),wa=a(r=>{for(let i;i=r.c;r=i){let t=i.bt;if(t===void 0)i.bt=t=new Set;else if(t.has(r))break;t.add(r),Mu(i);}},"r");function Au(r){this.bt!==void 0?(Or(this),this.c=r,wa(this)):this.c=r;}a(Au,"h");function ku(r,i=false,t=0){let e=this.i,o=this.bt;if(o!==void 0&&o.size!==0)if(i)if(Array.isArray(e))for(let s=t;s<e.length;s++)vi(e[s],false),Or(e[s]);else e!=null&&(vi(e,false),Or(e));else vi(this,r);}a(ku,"n");var Mu=a(r=>{r.type==$t.CHILD&&(r.xi??=ku,r.Qc??=Au);},"c"),Ir=class extends wt{static{a(this,"f");}constructor(){super(...arguments),this.bt=void 0;}Ur(i,t,e){super.Ur(i,t,e),wa(this),this.isConnected=i.Z;}Ms(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(vi(this,i),Or(this));}setValue(i){if(va(this.$i))this.$i.wt(i,this);else {let t=[...this.$i.i];t[this.kc]=i,this.$i.wt(t,this,0);}}disconnected(){}reconnected(){}};var O=a(()=>new cs,"e"),cs=class{static{a(this,"h");}},ls=new WeakMap,L=ht(class extends Ir{render(r){return R}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)),R}rt(r){if(this.isConnected||(r=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=ls.get(i);t===void 0&&(t=new WeakMap,ls.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"?ls.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 us=null,yi=class extends C{constructor(){super(...arguments);this.dialogEl=O();this.strokes=false;this.blockBodyScrolling=false;this.closeDialog=a(()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="");},"closeDialog");this.Jc=()=>{this.closeDialog();};this.tu=t=>{this.io=t.target;};this.eu=t=>{let e=t.target;e===this.dialogEl.value&&e===this.io&&this.closeDialog();};this.Xe=({id:t})=>{t===this.id?(us=t,this.show(),this.emit(I.MODAL_OPEN,{modalId:t},{debounce:true})):this.hide();};this.Ye=({id:t})=>{t===this.id&&(this.hide(),this.emit(I.MODAL_CLOSE,{modalId:t,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true}));};this.yn=t=>{this.hide(),us===this.id&&this.emit(I.MODAL_CLOSE,{modalId:us,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true});};}static{a(this,"Modal");}static{this.styleAttrs=[...super.styleAttrs,"uc-modal"];}show(){let t=this.dialogEl.value;typeof t.showModal=="function"?(this.setAttribute("aria-modal","true"),t.showModal()):t.setAttribute("open",""),this.cfg.modalScrollLock&&(document.body.style.overflow="hidden");}hide(){let t=this.dialogEl.value;typeof t.close=="function"?(this.setAttribute("aria-modal","false"),t.close()):t.removeAttribute("open");}initCallback(){super.initCallback(),this.modalManager?.registerModal(this.id,this),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes");}),this.modalManager?.subscribe(W.OPEN,this.Xe),this.modalManager?.subscribe(W.CLOSE,this.Ye),this.modalManager?.subscribe(W.CLOSE_ALL,this.yn);}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this.io=void 0,this.modalManager?.unsubscribe(W.OPEN,this.Xe),this.modalManager?.unsubscribe(W.CLOSE,this.Ye),this.modalManager?.unsubscribe(W.CLOSE_ALL,this.yn);}iu(t){this.dialogEl={value:t},this.dialogEl.value?.addEventListener("close",this.Jc),this.dialogEl.value?.addEventListener("mousedown",this.tu),this.dialogEl.value?.addEventListener("mouseup",this.eu);}render(){return y`<dialog ${L(this.iu)}>${this.yield("")}</dialog>`}};h([b({type:Boolean,noAccessor:true})],yi.prototype,"strokes",2),h([b({type:Boolean,attribute:"block-body-scrolling",noAccessor:true})],yi.prototype,"blockBodyScrolling",2);var Lr=class extends ${constructor(){super(...arguments);this.S=null;this.zi=null;}static{a(this,"FormInput");}get bn(){return this.nameAttrValue??this.ctxName}wn(){let t=document.createElement("input");return t.type="text",t.name=this.bn,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,yr(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.S=this.wn(),this.appendChild(this.S),this.sub("*collectionState",t=>{if(!t)return;if(!this.zi){let n=document.createElement("div");this.appendChild(n),this.zi=n;}if(!this.S){let n=this.wn();this.appendChild(n),this.S=n;}if(this.zi.innerHTML="",t.status==="uploading"||t.status==="idle"){this.S.value="",this.S.setCustomValidity("");return}if(t.status==="failed"){let n=t.errors[0]?.message;this.S.value="",this.S.setCustomValidity(n??"");return}let e=t.group?t.group:null;if(e){this.S.value=e.cdnUrl??"",this.S.setCustomValidity("");return}let o=t.allEntries.map(n=>n.cdnUrl).filter(n=>typeof n=="string");if(!this.cfg.multiple&&o.length===1&&o[0]){this.S.value=o[0],this.S.setCustomValidity("");return}this.S.remove(),this.S=null;let s=new DocumentFragment;for(let n of o){let l=document.createElement("input");l.type="hidden",l.name=`${this.bn}[]`,l.value=n,s.appendChild(l);}this.zi.replaceChildren(s);},false);}};h([b({type:String,noAccessor:true,attribute:"name"})],Lr.prototype,"nameAttrValue",2);var ds=class extends C{static{a(this,"Copyright");}initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i);});}render(){return y`<a href="https://uploadcare.com/?utm_source=copyright&utm_medium=referral&utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`}};var Ge=class extends C{constructor(){super(...arguments);this.hasFileName=false;this.value=0;this.visible=true;this.mt=0;this.Hi=O();this.Tn=()=>{let t=this.Hi.value;if(t){if(!this.visible){t.classList.add("uc-fake-progress--hidden");return}this.mt>0&&t.classList.add("uc-fake-progress--hidden");}};}static{a(this,"ProgressBar");}firstUpdated(t){super.firstUpdated(t),this.mt=this.ro(this.value),this.oo(),this.Hi.value?.addEventListener("animationiteration",this.Tn);}updated(t){if(super.updated(t),t.has("value")){let e=this.ro(this.value);if(!this.visible)this.mt=e;else {let o=Math.max(this.mt,e);o!==this.mt&&(this.mt=o,this.oo());}}t.has("visible")&&(this.classList.toggle("uc-progress-bar--hidden",!this.visible),this.visible?this.oo():this.mt=this.ro(this.value));}disconnectedCallback(){super.disconnectedCallback(),this.Hi.value?.removeEventListener("animationiteration",this.Tn);}ro(t){return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}oo(){this.visible&&this.style.setProperty("--l-progress-value",this.mt.toString());}render(){return y`<div ${L(this.Hi)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}};h([b({type:Boolean,noAccessor:true})],Ge.prototype,"hasFileName",2),h([b({type:Number})],Ge.prototype,"value",2),h([b({type:Boolean,reflect:true})],Ge.prototype,"visible",2);var bi=class extends ${constructor(){super();this.Ct=false;this.Ce=0;this.init$={...this.init$,"*commonProgress":0};}static{a(this,"ProgressBarCommon");}initCallback(){super.initCallback(),this.so=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e)?.getValue("isUploading")??false);this.Ct=t;}),this.sub("*commonProgress",t=>{this.Ce=t;});}updated(t){super.updated(t),t.has("visible")&&(this.Ct?this.setAttribute("active",""):this.removeAttribute("active"));}disconnectedCallback(){super.disconnectedCallback(),this.so?.(),this.so=void 0;}render(){return y`<uc-progress-bar .value=${this.Ce} .visible=${this.Ct}></uc-progress-bar>`}};h([g()],bi.prototype,"Ct",2),h([g()],bi.prototype,"Ce",2);var qe=class extends C{constructor(){super(...arguments);this.value="";this.disabled=false;this.options=[];this.ru=t=>{if(this.disabled){t.preventDefault(),t.stopPropagation();return}t.preventDefault(),t.stopPropagation();let e=t.currentTarget;e&&(this.value=e.value,this.dispatchEvent(new Event("change")));};}static{a(this,"Select");}render(){return y`<select @change=${this.ru} .value=${this.value} ?disabled=${this.disabled}>${this.options.map(t=>y`<option value=${t.value}>${t.text}</option>`)}</select>`}};h([b({type:String,attribute:false})],qe.prototype,"value",2),h([b({type:Boolean,reflect:true})],qe.prototype,"disabled",2),h([b({type:Array,attribute:false})],qe.prototype,"options",2);var Ou="src-type-",Se=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.ao={};this.onlyIcon=false;this.lo="default";this.co="";}static{a(this,"SourceBtn");}ou(){this.Se({type:H.LOCAL,activate:a(()=>(this.api.openSystemDialog(),false),"activate")}),this.Se({type:H.URL,activity:E.activities.URL,textKey:"from-url"}),this.Se({type:H.CAMERA,activity:E.activities.CAMERA,activate:a(()=>{let t=Ee.htmlMediaCapture;return t&&this.api.openSystemDialog({captureCamera:true}),!t},"activate")}),this.Se({type:"draw",activity:E.activities.DRAW,icon:"edit-draw"});for(let t of Object.values(ts))this.Se({type:t,activity:E.activities.CAMERA,activate:a(()=>{let e=Ee.htmlMediaCapture;return e&&this.api.openSystemDialog({captureCamera:true,modeCamera:t==="mobile-photo-camera"?k.PHOTO:k.VIDEO}),!e},"activate")});for(let t of Object.values(Ft))this.Se({type:t,activity:E.activities.EXTERNAL,activityParams:{externalSourceType:t}});}initCallback(){super.initCallback(),this.ou(),this.type&&this.En(this.type);}Se(t){this.ao[t.type]=t;}activate(){if(!this.type)return;let t=this.ao[this.type];if(!t)return;let{activity:e,activate:o,activityParams:s={}}=t;(o?o():e)&&e&&(this.modalManager?.open(e),this.set$({"*currentActivityParams":s,"*currentActivity":e}));}En(t){let e=this.ao[t];if(!e){console.warn(`Unsupported source type: ${t}`);return}let{textKey:o=t,icon:s=t}=e;this.co=`${Ou}${o}`,this.lo=s;}willUpdate(t){super.willUpdate(t),t.has("type")&&(this.type?this.En(this.type):(this.co="",this.lo="default"));}render(){return y`<button type="button" @click=${this.activate}><uc-icon name=${this.lo}></uc-icon>${this.onlyIcon?"":y`<div class="uc-txt">${this.l10n(this.co)}</div>`}</button>`}};h([b({type:String})],Se.prototype,"type",2),h([b({type:Boolean})],Se.prototype,"onlyIcon",2),h([g()],Se.prototype,"lo",2),h([g()],Se.prototype,"co",2);var wi=class extends C{constructor(){super(...arguments);this.xn=[];this.q=[];this.wrap=false;this.Sn=[];}static{a(this,"SourceList");}initCallback(){super.initCallback(),this.subConfigValue("sourceList",t=>{this.xn=j(t),this.Cn();}),this.subConfigValue("cameraModes",t=>{this.q=ct(t),this.Cn();});}updated(t){super.updated(t),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents";}Cn(){let t=[];for(let e of this.xn){if(e==="instagram"){console.error("Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here: https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US");continue}if(e==="camera"&&Ee.htmlMediaCapture){let o=this.q.length?this.q.map(s=>`mobile-${s}-camera`):["mobile-photo-camera"];t.push(...o);continue}t.push(e);}this.Sn=t;}render(){return y`${this.Sn.map(t=>y`<uc-source-btn role="listitem" type=${t}></uc-source-btn>`)}`}};h([b({type:Boolean,attribute:"wrap",noAccessor:true})],wi.prototype,"wrap",2),h([g()],wi.prototype,"Sn",2);var ps=class extends C{static{a(this,"Spinner");}render(){return y`<div class="uc-spinner"></div>`}};var kt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Ae(r){let i=new Image;return {promise:new Promise((o,s)=>{i.src=r,i.onload=()=>o(),i.onerror=n=>s(n);}),image:i,cancel:a(()=>{i.naturalWidth===0&&(i.src=kt);},"cancel")}}a(Ae,"preloadImage");function Ti(r){let i=[];for(let s of r){let n=Ae(s);i.push(n);}let t=i.map(s=>s.image);return {promise:Promise.allSettled(i.map(s=>s.promise)),images:t,cancel:a(()=>{i.forEach(s=>{s.cancel();});},"cancel")}}a(Ti,"batchPreloadImages");function hs(r,i=40){if(r.type==="image/svg+xml")return URL.createObjectURL(r);let t=document.createElement("canvas"),e=t.getContext("2d");if(!e)return Promise.reject(new Error("Canvas context not supported"));let o=new Image,s=new Promise((n,l)=>{o.onload=()=>{let c=o.height/o.width;c>1?(t.width=i,t.height=i*c):(t.height=i,t.width=i/c),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(o,0,0,t.width,t.height),t.toBlob(u=>{if(!u){l();return}let p=URL.createObjectURL(u);n(p);});},o.onerror=c=>{l(c);};});return o.src=URL.createObjectURL(r),s}a(hs,"generateThumb");var We=class extends ${constructor(){super(...arguments);this.ji=new Set;this.entry=null;}static{a(this,"FileItemConfig");}withEntry(t){return (...e)=>{let o=this.entry;if(!o){console.warn("No entry found");return}return t(o,...e)}}subEntry(t,e){this.withEntry((o,s,n)=>{let l=o.subscribe(s,c=>{this.isConnected&&n(c);});this.ji.add(l);})(t,e);}reset(){for(let t of this.ji)t();this.ji=new Set,this.entry=null;}disconnectedCallback(){super.disconnectedCallback(),this.ji=new Set;}};function Iu(r){let i=new Blob([r],{type:"image/svg+xml"});return URL.createObjectURL(i)}a(Iu,"createSvgBlobUrl");function Ur(r="hsl(209, 21%, 65%)",i=32,t=32){return Iu(`<svg width="${i}" height="${t}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${r}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`)}a(Ur,"fileCssBg");var Lu=3e3,Ze=class extends We{constructor(){super(...arguments);this.badgeIcon="";this.uid="";this.Bt="";this.An=false;this.Ki=null;this.kn=false;this.su=this.cfg.filesViewMode;this.Mn=this.withEntry(async(t,e=false)=>{let o=t.getValue("fileInfo"),s=t.getValue("isImage"),n=t.getValue("uuid"),l=t.getValue("thumbUrl"),c=this.nu(e);if(o&&s&&n){let p=await this.proxyUrl(q(Jt(this.cfg.cdnCname,n),it(t.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${c}x${c}/center`)));if(l===p)return;let{promise:d}=Ae(p);d.then(()=>{t.setValue("thumbUrl",p),l?.startsWith("blob:")&&URL.revokeObjectURL(l);}).catch(async()=>{if(!l?.startsWith("blob:"))try{let m=t.getValue("file");if(!m)return;let f=await hs(m,c);t.setValue("thumbUrl",f);}catch(m){this.telemetryManager.sendEventError(m,"thumbnail generation. Failed to generate thumb from file");let f=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Ur(f));}});return}if(t.getValue("thumbUrl"))return;let u=t.getValue("file");if(u?.type.includes("image"))try{let p=await hs(u,c);t.setValue("thumbUrl",p);}catch(p){this.telemetryManager.sendEventError(p,"thumbnail generation. Failed to generate thumb from file");let d=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Ur(d));}else {let p=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",Ur(p));}});this.Gi=D(this.Mn.bind(this),100);}static{a(this,"Thumb");}nu(t=false){t&&(this.Ki=this.getBoundingClientRect());let e=Math.max(parseInt(String(this?.Ki?.height||0),10),parseInt(String(this?.Ki?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(e*=window.devicePixelRatio),Math.min(e,Lu)}au(t,e){return new Promise((o,s)=>{let n=new Image;n.decoding="async";let l=a(()=>{n&&(n.onload=null,n.onerror=null,n.src=kt,e?.removeEventListener("abort",c),n=null);},"cleanup"),c=a(()=>{l(),s(new DOMException("Aborted","AbortError"));},"onAbort");if(e){if(e.aborted){c();return}e.addEventListener("abort",c,{once:true});}let u=a(()=>{l(),o();},"resolveSafe"),p=a(d=>{l(),s(d);},"rejectSafe");if(typeof n.decode=="function"){n.src=t,n.decode().then(u).catch(p);return}n.onload=u,n.onerror=p,n.src=t;})}po(){this.uo?.cancel(),this.uo=void 0;}lu(t){if(this.po(),!t){this.Bt&&(this.Bt="");return}if(t===this.Bt)return;let e=new AbortController,o={controller:e,cancel:a(()=>{e.abort(),o.rafId!==void 0&&window.cancelAnimationFrame(o.rafId);},"cancel")};this.uo=o,this.au(t,e.signal).then(()=>{e.signal.aborted||(o.rafId=window.requestAnimationFrame(()=>{e.signal.aborted||(this.Bt=t);}));}).catch(s=>{e.signal.aborted||s instanceof DOMException&&s.name==="AbortError"||console.warn("[Thumb] Failed to decode thumbnail image",s);});}qi(t=false){if(this.entry){if(t){this.Mn(true);return}this.kn&&this.Gi();}}firstUpdated(t){super.firstUpdated(t),this.On();}updated(t){super.updated(t),t.has("uid")&&this.On();}Qe(t){let[e]=t;e&&(this.kn=e.isIntersecting,e.isIntersecting&&(this.Ki=e.boundingClientRect,this.qi(),this.s?.disconnect()),e.intersectionRatio===0&&this.Gi.cancel());}reset(){super.reset(),this.Gi.cancel(),this.po(),this.Bt&&(this.Bt="");}On(){let t=this.uid?.trim();if(!t){this.entry&&this.reset();return}let e=this.uploadCollection?.read(t);if(!e||e===this.entry)return;this.reset(),this.entry=e;let o=a(()=>{this.qi();},"requestThumb");this.subEntry("fileInfo",s=>{s?.isImage&&o();}),this.subEntry("thumbUrl",s=>{this.lu(s??void 0);}),this.subEntry("cdnUrlModifiers",o),this.qi(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this.An&&(this.su==="list"&&this.qi(true),this.An=true);});}connectedCallback(){super.connectedCallback(),this.s?.disconnect(),this.s=new window.IntersectionObserver(this.Qe.bind(this),{threshold:.1}),this.s.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.Gi.cancel(),this.po(),this.s?.disconnect();}render(){return y`<div class="uc-thumb"><img class="uc-thumb__img" src=${this.Bt||kt} role="img" alt="Preview of uploaded image" ?hidden=${!this.Bt} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}};h([b({type:String})],Ze.prototype,"badgeIcon",2),h([b({attribute:false})],Ze.prototype,"uid",2),h([g()],Ze.prototype,"Bt",2);var ms=class extends E{static{a(this,"ActivityHeader");}};var fs=class extends E{constructor(){super(...arguments);this.historyTracked=true;this.activityType=E.activities.START_FROM;}static{a(this,"StartFrom");}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"");}render(){return y`<div class="uc-content">${this.yield("")}</div>`}};var gs=class extends ${constructor(){super(...arguments);this.In=null;}static{a(this,"UploadCtxProvider");}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=I;}initCallback(){super.initCallback(),this.In=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.In?.();}};var le=a((r,i)=>{let t=false,e,o=0,s=a(((...n)=>{t?(e&&clearTimeout(e),e=setTimeout(()=>{Date.now()-o>=i&&(r(...n),o=Date.now());},Math.max(i-(Date.now()-o),0))):(r(...n),o=Date.now(),t=true);}),"throttled");return Object.defineProperty(s,"cancel",{configurable:false,writable:false,enumerable:false,value:a(()=>{e&&clearTimeout(e);},"value")}),s},"throttle");var Ta=a((r,i,t)=>{let e=new Map;for(let o=i;o<=t;o++)e.set(r[o],o);return e},"u"),Ea=ht(class extends wt{constructor(r){if(super(r),r.type!==$t.CHILD)throw Error("repeat() can only be used in text expressions")}dt(r,i,t){let e;t===void 0?t=i:i!==void 0&&(e=i);let o=[],s=[],n=0;for(let l of r)o[n]=e?e(l,n):n,s[n]=t(l,n),n++;return {values:s,keys:o}}render(r,i,t){return this.dt(r,i,t).values}update(r,[i,t,e]){let o=ba(r),{values:s,keys:n}=this.dt(i,t,e);if(!Array.isArray(o))return this.ut=n,s;let l=this.ut??=[],c=[],u,p,d=0,m=o.length-1,f=0,v=s.length-1;for(;d<=m&&f<=v;)if(o[d]===null)d++;else if(o[m]===null)m--;else if(l[d]===n[f])c[f]=ae(o[d],s[f]),d++,f++;else if(l[m]===n[v])c[v]=ae(o[m],s[v]),m--,v--;else if(l[d]===n[v])c[v]=ae(o[d],s[v]),Ke(r,c[v+1],o[d]),d++,v--;else if(l[m]===n[f])c[f]=ae(o[m],s[f]),Ke(r,o[d],o[m]),m--,f++;else if(u===void 0&&(u=Ta(n,f,v),p=Ta(l,d,m)),u.has(l[d]))if(u.has(l[m])){let w=p.get(n[f]),T=w!==void 0?o[w]:null;if(T===null){let S=Ke(r,o[d]);ae(S,s[f]),c[f]=S;}else c[f]=ae(T,s[f]),Ke(r,o[d],T),o[w]=null;f++;}else Mr(o[m]),m--;else Mr(o[d]),d++;for(;f<=v;){let w=Ke(r,c[v+1]);ae(w,s[f]),c[f++]=w;}for(;d<=m;){let w=o[d++];w!==null&&Mr(w);}return this.ut=n,ya(r,c),tt}});var Rr=a(()=>{let r=[];return {stack:r,promiseReadJpegChunks:a(t=>new Promise((e,o)=>{let s=2,n=a((u,p)=>{let d=new FileReader;d.addEventListener("load",()=>{p(new DataView(d.result));}),d.addEventListener("error",m=>{o(`Reader error: ${m}`);}),d.readAsArrayBuffer(u);},"readToView"),l=a(()=>n(t.slice(s,s+128),u=>{let p,d,m;for(p=d=0,m=u.byteLength;m>=0?d<m:d>m;p=m>=0?++d:--d)if(u.getUint8(p)===255){s+=p;break}c();}),"readNext"),c=a(()=>{let u=s;return n(t.slice(s,s+=4),p=>{if(p.byteLength!==4||p.getUint8(0)!==255){o("Corrupted");return}let d=p.getUint8(1);if(d===218){e(true);return}let m=p.getUint16(2)-2;return n(t.slice(s,s+=m),f=>{if(f.byteLength!==m){o("Corrupted");return}r.push({startPos:u,length:m,marker:d,view:f}),l();})})},"readNextChunk");FileReader&&DataView||o("Not Support"),n(t.slice(0,2),u=>{u.getUint16(0)!==65496&&o("Not jpeg"),l();});}),"promiseReadJpegChunks")}},"readJpegChunks"),Uu=a(async r=>{let i=[],{promiseReadJpegChunks:t,stack:e}=Rr();return await t(r),e.forEach(({marker:o,view:s})=>{o===226&&s.getUint32(0)===1229144927&&s.getUint32(4)===1347571526&&s.getUint32(8)===1229735168&&i.push(s);}),i},"getIccProfile"),Ca=a(async(r,i,t)=>{{let e=[],o=[],{promiseReadJpegChunks:s,stack:n}=Rr();await s(r),n.forEach(u=>{if(u.marker===i)return e.push(u.startPos),o.push(u.length)});let l=[r.slice(0,2)];for(let u of t){let p=new DataView(new ArrayBuffer(4));p.setUint16(0,65280+i),p.setUint16(2,u.byteLength+2),l.push(p.buffer),l.push(u);}let c=2;for(let u=0;u<e.length;u++)e[u]>c&&l.push(r.slice(c,e[u])),c=e[u]+o[u]+4;return l.push(r.slice(c,r.size)),new Blob(l,{type:r.type})}},"replaceJpegChunk"),Pu=226,Sa=a((r,i)=>Ca(r,Pu,i.map(t=>t.buffer)),"replaceIccProfile"),Ru=a(async r=>{try{return await Sa(r,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},"stripIccProfile"),$u=a((r,i,t)=>new Promise((e,o)=>{let s=a(n=>{if(!n){o("Failed to convert canvas to blob");return}e(n);},"callback");r.toBlob(s,i,t),r.width=r.height=1;}),"canvasToBlob"),Ei=a(()=>{let r=document.createElement("canvas"),i=r.getContext("2d");return {canvas:r,ctx:i}},"createCanvas"),Du=a(r=>{let{ctx:t,canvas:e}=Ei();e.width=e.height=50,t.drawImage(r,0,0,50,50);let o=t.getImageData(0,0,50,50).data;e.width=e.height=1;for(let s=3;s<o.length;s+=4)if(o[s]<254)return true;return false},"hasTransparency"),Fu=a(async r=>{let i=null,{promiseReadJpegChunks:t,stack:e}=Rr();return await t(r),e.forEach(({marker:o,view:s})=>{if(!i&&o===225&&s.byteLength>=14&&s.getUint32(0)===1165519206&&s.getUint16(4)===0){i=s;return}}),i},"getExif"),Vu="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",Pr,_u=a(()=>new Promise(r=>{if(Pr!==void 0)r(Pr);else {let i=new Image;i.addEventListener("load",()=>{Pr=i.naturalWidth<i.naturalHeight,i.src="//:0",r(Pr);}),i.src=Vu;}}),"isBrowserApplyExifOrientation"),Nu=a((r,i)=>{let t,e,o,s;if(!r||r.byteLength<14||r.getUint32(0)!==1165519206||r.getUint16(4)!==0)return;if(r.getUint16(6)===18761)e=true;else if(r.getUint16(6)===19789)e=false;else return;if(r.getUint16(8,e)!==42)return;o=8+r.getUint32(10,e);let n=r.getUint16(o-2,e);for(t=0,s=n;s>=0?t<s:t>s;s>=0?++t:--t){if(r.byteLength<o+10)return;r.getUint16(o,e)===274&&i(o+8,e),o+=12;}},"findExifOrientation"),Bu=a((r,i)=>{Nu(r,(t,e)=>r.setUint16(t,i,e));},"setExifOrientation"),zu=a(async(r,i,t)=>(t&&Bu(i,1),Ca(r,225,[i.buffer])),"replaceExif"),Hu=a((r,i)=>new Promise((t,e)=>{i&&(r.src=i),r.complete?t(r):(r.addEventListener("load",()=>{t(r);}),r.addEventListener("error",()=>{e(new Error("Failed to load image. Probably not an image."));}));}),"processImage"),ju=a(r=>Hu(new Image,r),"imageLoader"),Ku=[1,3],Gu=[192,193,194,195,197,198,199,201,202,203,205,206,207],xa={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},qu=a(async r=>{let i=false,{promiseReadJpegChunks:t,stack:e}=Rr();return await t(r).then(()=>(e.forEach(({marker:o,view:s})=>{if(!i&&Gu.indexOf(o)>=0){let n=s.getUint8(5);Ku.indexOf(n)<0&&(i=true);}}),i)).catch(()=>i)},"shouldSkipShrink"),Aa=a((r,i)=>{let t={};return (...e)=>{let o=i(e,t);return o in t?t[o]:t[o]=r(...e)}},"memoize"),ka=a((r,i)=>{let[t]=r,e=Object.keys(i).map(o=>parseInt(o,10)).sort((o,s)=>o-s);for(let o=0;o<e.length;o++){let s=e[o],n=!!i[s];if(s>t&&n||s<t&&!n)return s}return t},"memoKeySerializer"),ce={R:55,G:110,B:165,A:255},Wu=`rgba(${ce.R}, ${ce.G}, ${ce.B}, ${ce.A/255})`,Ma=a((r,i)=>{try{let t=[r-1,i-1,1,1],{canvas:e,ctx:o}=Ei();e.width=1,e.height=1;let{canvas:s,ctx:n}=Ei();s.width=r,s.height=i,n&&(n.fillStyle=Wu,n.fillRect(...t),o.drawImage(s,r-1,i-1,1,1,0,0,1,1));let l=o&&o.getImageData(0,0,1,1).data,c=!1;return l&&(c=l[0]===ce.R&&l[1]===ce.G&&l[2]===ce.B&&l[3]===ce.A),s.width=s.height=1,c}catch{return console.error(`Failed to test for max canvas size of ${r}x${i}.`),false}},"canvasTest");function Oa(r){return (...i)=>new Promise(t=>{setTimeout(()=>{let e=r(...i);t(e);},0);})}a(Oa,"wrapAsync");var Zu=Oa(Aa(Ma,ka)),Xu=Oa(Aa(Ma,ka)),Ia=a(async(r,i)=>{let t=xa.squareSide.find(n=>n*n>=r*i),e=xa.dimension.find(n=>n>=r&&n>=i);if(!t||!e)throw new Error("Not supported");let[o,s]=await Promise.all([Zu(t,t),Xu(e,1)]);if(o&&s)return true;throw new Error("Not supported")},"testCanvasSize"),La=a(async(r,i,t)=>{try{let{ctx:e,canvas:o}=Ei();return o.width=i,o.height=t,e.imageSmoothingQuality="high",e.drawImage(r,0,0,i,t),r instanceof HTMLImageElement&&(r.src="//:0"),r instanceof HTMLCanvasElement&&(r.width=r.height=1),o}catch(e){throw new Error("Canvas resize error",{cause:e})}},"canvasResize"),Yu=a(({img:r,targetW:i,targetH:t})=>La(r,i,t),"native"),Qu=a(function({sourceW:r,targetW:i,targetH:t,step:e}){let o=[],s=i,n=t;do o.push([s,n]),s=Math.round(s/e),n=Math.round(n/e);while(s<r*e);return o.reverse()},"calcShrinkSteps"),Ju=a(({img:r,sourceW:i,targetW:t,targetH:e,step:o})=>{let s=Qu({sourceW:i,targetW:t,targetH:e,step:o});return s.reduce((n,[l,c],u)=>n.then(p=>Ia(l,c).then(()=>La(p,l,c)).catch(()=>{if(u===s.length-1)throw new Error("Not supported");return p})),Promise.resolve(r))},"fallback"),td=a(()=>/iPad|iPhone|iPod/.test(navigator.platform)?true:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),"isIOS"),ed=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),vs=.71,id=a((r,i)=>{if(r.width*vs*r.height*vs<i.size)throw new Error("Not required");let t=r.width,e=r.height,o=t/e,s=Math.floor(Math.sqrt(i.size*o)),n=Math.floor(i.size/Math.sqrt(i.size*o));return Ia(s,n).then(()=>{let{ctx:l}=Ei();return "imageSmoothingQuality"in l&&!td()&&!ed?Yu({img:r,targetW:s,targetH:n}):Ju({img:r,sourceW:t,targetW:s,targetH:n,step:vs})}).catch(()=>Promise.reject("Not supported"))},"shrinkImage"),Ua=a(async(r,i)=>{try{if(await qu(r))throw new Error("Should skipped");let e=await Promise.allSettled([Fu(r),_u(),Uu(r)]),s=!e.some(w=>w.status==="rejected"),[n,l,c]=e,u=await Ru(r).catch(()=>r),p=await ju(URL.createObjectURL(u));URL.revokeObjectURL(p.src);let d=await id(p,i),m="image/jpeg",f=i?.quality||.8;!s&&Du(d)&&(m="image/png",f=void 0);let v=await $u(d,m,f);if(s&&n.status==="fulfilled"&&n.value){let w=n.value,T=l.status==="fulfilled"?l.value:!1;v=await zu(v,w,T);}return s&&c.status==="fulfilled"&&c.value.length>0&&(v=await Sa(v,c.value)),v}catch(t){let e;throw t instanceof Error&&(e=t.message),typeof t=="string"&&(e=t),new Error(`Failed to shrink image. ${e?`Message: "${e}".`:""}`,{cause:t})}},"shrinkFile");var rd=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,Pa=a(r=>{if(typeof r!="string")return false;let i=rd.exec(r.toLocaleLowerCase())??[];if(i.length===0)return false;let t=Number(i[1])*Number(i[2]),e=16384*16384;return t>e?(console.warn(`Shrinked size can not be larger than ${Math.floor(e/1e3/1e3)}MP. You have set ${i[1]}x${i[2]} (${Math.ceil(t/1e3/100)/10}MP).`),false):{quality:i[3]?Number(i[3])/100:void 0,size:t}},"parseShrink");var X=Object.freeze({FINISHED:Symbol("FINISHED"),FAILED:Symbol("FAILED"),UPLOADING:Symbol("UPLOADING"),VALIDATION:Symbol("VALIDATION"),QUEUED_UPLOADING:Symbol("QUEUED-UPLOADING"),QUEUED_VALIDATION:Symbol("QUEUED-VALIDATION"),IDLE:Symbol("IDLE")}),K=class K extends We{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Ln=true;this.uid="";this.ho="";this.mo="";this.fo="";this.mt=0;this.Un=false;this.go="";this.Pn=false;this.Rn=false;this.$n=false;this.Dn=false;this.Fn=false;this.Wi=false;this.Nn="";this.Vn=false;this.cu=this.withEntry(t=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"edit-file",node:this.tagName}}}),this.$["*currentActivityParams"]={internalId:t.uid},this.modalManager?.open(E.activities.CLOUD_IMG_EDIT),this.$["*currentActivity"]=E.activities.CLOUD_IMG_EDIT;});this.uu=()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uid&&this.uploadCollection.hasItem(this.uid)&&this.uploadCollection.remove(this.uid);};this.du=()=>{this._n();};this.g=D(()=>this.Bn(),100);this.hu=this.withEntry(le((t,e)=>{let o=t.getValue("errors")?.[0]?.message??"",s=t.getValue("source"),n=t.getValue("externalUrl"),l=e===X.FINISHED,c=e===X.UPLOADING,u=e===X.QUEUED_UPLOADING,p=e===X.QUEUED_VALIDATION,d=e===X.VALIDATION,m=t.getValue("fileName"),f="";o?f="":!l&&n&&s&&Object.values(Ft).includes(s)&&(f=this.l10n("waiting-for",{source:this.l10n(`src-type-${s}`)})),this.fo=f,this.mo=o,this.Un=c||u||p||d,this.mt=p||d?0:t.getValue("uploadProgress"),this.Nn=m?this.l10n("a11y-file-item-status",{fileName:m,status:this.l10n(e?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):"";},100));this._n=this.withEntry(async t=>{if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("errors").length>0||t.getValue("isValidationPending"))return;let e=this.cfg.multiple?this.cfg.multipleMax:1;if(!(e&&this.uploadCollection.size>e)){t.setMultipleValues({isUploading:true,errors:[],isQueuedForUploading:true}),this.g();try{let o=new AbortController;t.setValue("abortController",o);let s=a(async()=>{t.setValue("isQueuedForUploading",!1);let l=t.getValue("file");if(l instanceof File&&this.cfg.imageShrink)try{let d=Pa(this.cfg.imageShrink);d?l=await Ua(l,d):console.warn("Image shrink settings are invalid, skipping shrinking");}catch{}let c=l||t.getValue("externalUrl")||t.getValue("uuid");if(!c)throw new Error("No file input");let p={...await this.getUploadClientOptions(),fileName:t.getValue("fileName")??void 0,source:t.getValue("source")??void 0,onProgress:a(d=>{if(d.isComputable){let m=d.value*100;t.setValue("uploadProgress",m);}},"onProgress"),signal:o.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",c,p),Po(c,p)},"uploadTask"),n=await this.$["*uploadQueue"].add(s);t.setMultipleValues({fileInfo:n,isQueuedForUploading:!1,isUploading:!1,fileName:n.originalFilename,fileSize:n.size,isImage:n.isImage??!1,mimeType:n.contentInfo?.mime?.mime??n.mimeType,uuid:n.uuid,cdnUrl:t.getValue("cdnUrl")??n.cdnUrl,cdnUrlModifiers:t.getValue("cdnUrlModifiers")??"",uploadProgress:100,source:t.getValue("source")??null}),t===this.entry&&this.g();}catch(o){this.telemetryManager.sendEventError(o,"file upload. Failed to upload file"),o instanceof ee&&o.isCancel?t.setMultipleValues({isUploading:false,uploadProgress:0}):o instanceof ye?t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:o}):(console.error("Unknown upload error",o),t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:new Error("Something went wrong",{cause:o})})),t===this.entry&&this.g();}}});}static{a(this,"FileItem");}Bn(){let t=this.entry;if(!t)return;let e=X.IDLE;t.getValue("errors").length>0?e=X.FAILED:t.getValue("isQueuedForUploading")?e=X.QUEUED_UPLOADING:t.getValue("isQueuedForValidation")?e=X.QUEUED_VALIDATION:t.getValue("isValidationPending")?e=X.VALIDATION:t.getValue("isUploading")?e=X.UPLOADING:t.getValue("fileInfo")&&(e=X.FINISHED),this.pu(t,e);}pu(t,e){e===X.FAILED?this.go="badge-error":e===X.FINISHED&&(this.go="badge-success"),e===X.UPLOADING&&(this.Dn=false,this.removeAttribute("focused")),this.Rn=e===X.FAILED,this.$n=e===X.UPLOADING,this.Pn=e===X.FINISHED,this.Fn=!!(this.cfg.useCloudImageEditor&&t.getValue("isImage")&&t.getValue("cdnUrl")),this.hu(e);}reset(){super.reset(),this.g.cancel();}Qe(t){let[e]=t;e&&e.isIntersecting&&!this.Vn&&(this.Ln=false,this.Vn=true);}zn(t){this.reset();let e=this.uploadCollection?.read(t);this.entry=e,e&&(this.subEntry("isQueuedForValidation",()=>{this.g();}),this.subEntry("isValidationPending",()=>{this.g();}),this.subEntry("uploadProgress",()=>{this.g();}),this.subEntry("isQueuedForUploading",()=>{this.g();}),this.subEntry("fileName",o=>{this.ho=o||e.getValue("externalUrl")||this.l10n("file-no-name"),this.g();}),this.subEntry("externalUrl",o=>{this.ho=e.getValue("fileName")||o||this.l10n("file-no-name");}),this.subEntry("fileInfo",()=>{this.g();}),this.subEntry("errors",()=>this.g()),this.subEntry("isUploading",()=>this.g()),this.subEntry("fileSize",()=>this.g()),this.subEntry("mimeType",()=>this.g()),this.subEntry("isImage",()=>this.g()),this.Bn());}Hn(t){if(this.cfg.filesViewMode==="list"){this.Wi=true;return}this.Wi=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.zn(this.uid);}initCallback(){super.initCallback(),this.zn(this.uid),this.subConfigValue("useCloudImageEditor",()=>this.g()),this.subConfigValue("filesViewMode",t=>{this.Hn(this.cfg.gridShowFileNames),this.setAttribute("mode",t);}),this.subConfigValue("gridShowFileNames",t=>{this.Hn(t);}),this.onclick=()=>{K.activeInstances.forEach(t=>{t===this?t.setAttribute("focused",""):t.removeAttribute("focused");});},this.sub("*uploadTrigger",t=>{this.entry&&!t.has(this.entry.uid)||setTimeout(()=>this.isConnected&&this._n());}),K.activeInstances.add(this);}connectedCallback(){super.connectedCallback(),this.s=new window.IntersectionObserver(this.Qe.bind(this),{threshold:[0,1]}),this.s.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),K.activeInstances.delete(this),this.reset();}static{this.activeInstances=new Set;}shouldUpdate(t){return this.Ln?false:super.shouldUpdate(t)}render(){return y`<div class="uc-inner" ?data-finished=${this.Pn} ?data-uploading=${this.$n} ?data-failed=${this.Rn} ?data-focused=${this.Dn} ><uc-thumb .uid=${this.uid} .badgeIcon=${this.go}></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this.Nn}><span class="uc-file-name" ?hidden=${!this.Wi}>${this.ho}</span><span class="uc-file-error" ?hidden=${!this.mo}>${this.mo}</span><span class="uc-file-hint" ?hidden=${!this.fo}>${this.fo}</span></div><div class="uc-file-actions"><button type="button" @click=${this.cu} ?hidden=${!this.Fn} title=${this.l10n("file-item-edit-button")} aria-label=${this.l10n("file-item-edit-button")} class="uc-edit-btn uc-mini-btn" data-testid="edit" ><uc-icon name="edit-file"></uc-icon></button><button type="button" @click=${this.uu} title=${this.l10n("file-item-remove-button")} aria-label=${this.l10n("file-item-remove-button")} class="uc-remove-btn uc-mini-btn" ><uc-icon name="remove-file"></uc-icon></button><button type="button" class="uc-upload-btn uc-mini-btn" @click=${this.du}><uc-icon name="upload"></uc-icon></button></div><uc-progress-bar class="uc-progress-bar" .value=${this.mt} .visible=${this.Un} ?hasFileName=${this.Wi}></uc-progress-bar></div>`}};h([g()],K.prototype,"Ln",2),h([b({attribute:false})],K.prototype,"uid",2),h([g()],K.prototype,"ho",2),h([g()],K.prototype,"mo",2),h([g()],K.prototype,"fo",2),h([g()],K.prototype,"mt",2),h([g()],K.prototype,"Un",2),h([g()],K.prototype,"go",2),h([g()],K.prototype,"Pn",2),h([g()],K.prototype,"Rn",2),h([g()],K.prototype,"$n",2),h([g()],K.prototype,"Dn",2),h([g()],K.prototype,"Fn",2),h([g()],K.prototype,"Wi",2),h([g()],K.prototype,"Nn",2);var ys=K;function od(r){return new Promise(i=>{typeof window.FileReader!="function"&&i(false);try{let t=new FileReader;t.onerror=()=>{i(!0);};let e=a(o=>{o.type!=="loadend"&&t.abort(),i(!1);},"onLoad");t.onloadend=e,t.onprogress=e,t.readAsDataURL(r);}catch{i(false);}})}a(od,"checkIsDirectory");function sd(r,i){return new Promise(t=>{let e=0,o=[],s=a(l=>{if(!l){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null);return}l.isFile?(e++,l.file(c=>{e--;let u=new File([c],c.name,{type:c.type||i});o.push({type:"file",file:u,fullPath:l.fullPath}),e===0&&t(o);})):l.isDirectory&&n(l.createReader());},"readEntry"),n=a(l=>{e++,l.readEntries(c=>{e--;for(let u of c)s(u);e===0&&t(o);});},"readReaderContent");s(r);})}a(sd,"readEntryContentAsync");function Ra(r){let i=[],t=[];for(let e=0;e<r.items.length;e++){let o=r.items[e];if(o)if(o.kind==="file"){let s=o.type,n=o;if(typeof n.webkitGetAsEntry=="function"||typeof n.getAsEntry=="function"){let c=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():n.getAsEntry?.();c&&t.push(sd(c,s).then(u=>{u&&i.push(...u);}));continue}let l=o.getAsFile();l&&t.push(od(l).then(c=>{c||i.push({type:"file",file:l});}));}else o.kind==="string"&&/^text\/uri-list/.test(o.type)&&t.push(new Promise(s=>{o.getAsString(n=>{i.push({type:"url",url:n}),s();});}));}return Promise.all(t).then(()=>i)}a(Ra,"getDropItems");var st=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),$a=["focus"],nd=100,bs=new Map;function ad(r,i){let t=Math.max(Math.min(r[0],i.x+i.width),i.x),e=Math.max(Math.min(r[1],i.y+i.height),i.y);return Math.sqrt((r[0]-t)*(r[0]-t)+(r[1]-e)*(r[1]-e))}a(ad,"distance");function ws(r){let i=0,t=document.body,e=new Set,o=a(v=>{e.add(v);},"handleSwitch"),s=st.INACTIVE,n=a(v=>{r.shouldIgnore()&&v!==st.INACTIVE||(s!==v&&e.forEach(w=>{w(v);}),s=v);},"setState"),l=a(()=>i>0,"isDragging");o(v=>r.onChange(v));let c=a(()=>{i=0,n(st.INACTIVE);},"onResetEvent"),u=a(()=>{i+=1,s===st.INACTIVE&&n(st.ACTIVE);},"onDragEnter"),p=a(()=>{i-=1,l()||n(st.INACTIVE);},"onDragLeave"),d=a(v=>{v.preventDefault(),i=0,n(st.INACTIVE);},"onDrop"),m=a(v=>{if(r.shouldIgnore())return;l()||(i+=1);let w=[v.x,v.y],T=r.element.getBoundingClientRect(),S=Math.floor(ad(w,T)),x=S<nd,A=v.composedPath().includes(r.element);bs.set(r.element,S);let yt=Math.min(...bs.values())===S;A&&yt?(v.preventDefault(),n(st.OVER)):n(x&&yt?st.NEAR:st.ACTIVE);},"onDragOver"),f=a(async v=>{if(r.shouldIgnore())return;v.preventDefault();let{dataTransfer:w}=v;if(!w)return;let T=await Ra(w);r.onItems(T),n(st.INACTIVE);},"onElementDrop");return t.addEventListener("drop",d),t.addEventListener("dragleave",p),t.addEventListener("dragenter",u),t.addEventListener("dragover",m),r.element.addEventListener("drop",f),$a.forEach(v=>{window.addEventListener(v,c);}),()=>{bs.delete(r.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",p),t.removeEventListener("dragenter",u),t.removeEventListener("dragover",m),r.element.removeEventListener("drop",f),$a.forEach(v=>{window.removeEventListener(v,c);});}}a(ws,"addDropzone");var Ts=new Set,dt=class extends ${constructor(){super(...arguments);this.single=false;this.ghost=false;this.disabled=false;this.clickable=false;this.withIcon=false;this.fullscreen=false;this.initflow=false;this.Nt=true;this.jn=true;this.vo="drop-files-here";this.Kn=false;this.qn=null;this.yo=null;this.Wn=O();this.Ae=t=>{if(t instanceof KeyboardEvent){if(t.code!=="Space"&&t.code!=="Enter")return}else if(!(t instanceof MouseEvent))return;if(this.initflow){this.api.initFlow();return}this.api.openSystemDialog();};this.Zn=true;this.ke=false;}static{a(this,"DropArea");}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}Gn(){let t=this.text;if(typeof t=="string"&&t.length>0){this.vo=this.l10n(t)||t;return}this.vo=this.Kn?this.l10n("drop-files-here"):this.l10n("drop-file-here");}isActive(){if(!this.Nt)return false;let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,o=t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth),s=window.getComputedStyle(this),n=s.visibility!=="hidden"&&s.display!=="none";return e&&n&&o}initCallback(){super.initCallback(),Ts.add(this),this.bo(),this.wo(),this.Xn(),this.Yn(st.INACTIVE),this.qn=ws({element:this,shouldIgnore:a(()=>this.Qn(),"shouldIgnore"),onChange:a(t=>{this.Yn(t);},"onChange"),onItems:a(t=>{t.length&&(t.forEach(e=>{e.type==="url"?this.api.addFileFromUrl(e.url,{source:H.DROP_AREA}):e.type==="file"&&this.api.addFileFromObject(e.file,{source:H.DROP_AREA,fullPath:e.fullPath});}),this.uploadCollection.size&&(this.modalManager?.open(E.activities.UPLOAD_LIST),this.set$({"*currentActivity":E.activities.UPLOAD_LIST})));},"onItems")}),this.updateComplete.then(()=>this.mu()),this.subConfigValue("sourceList",t=>{let e=j(t);this.Zn=e.includes(H.LOCAL),this.bo(),this.wo();}),this.subConfigValue("multiple",t=>{this.Kn=!!t,this.Gn();});}willUpdate(t){super.willUpdate(t),t.has("disabled")&&(this.bo(),this.wo()),(t.has("text")||t.has("localeId"))&&this.Gn();}updated(t){super.updated(t),t.has("clickable")&&this.Xn();}Qn(){if(!this.Nt||!this.fu())return true;if(!this.fullscreen)return false;let t=Ts;return t.size===0?false:[...t].filter(s=>s!==this).filter(s=>s.isActive()).length>0}fu(){let t=this.cfg.multiple,e=this.cfg.multipleMax,o=this.uploadCollection.size;return !(t&&e&&o>=e||!t&&o>0)}bo(){let t=this.Zn&&!this.disabled;this.Nt=t;}wo(){let t=this.Nt||!this.querySelector("[data-default-slot]");this.jn=t,this.hidden=!t;}Yn(t){let e=Object.entries(st).find(([,o])=>o===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}mu(){if(this.yo)return;let t=this.Wn.value;t&&(this.yo=ws({element:t,onChange:a(e=>{let o=Object.entries(st).find(([,s])=>s===e)?.[0].toLowerCase();o&&t.setAttribute("drag-state",o);},"onChange"),onItems:a(()=>{},"onItems"),shouldIgnore:a(()=>this.Qn(),"shouldIgnore")}));}Xn(){this.clickable&&!this.ke?(this.addEventListener("keydown",this.Ae),this.addEventListener("click",this.Ae),this.ke=true):!this.clickable&&this.ke&&(this.removeEventListener("keydown",this.Ae),this.removeEventListener("click",this.Ae),this.ke=false);}disconnectedCallback(){super.disconnectedCallback(),Ts.delete(this),this.qn?.(),this.yo?.(),this.ke&&(this.removeEventListener("keydown",this.Ae),this.removeEventListener("click",this.Ae),this.ke=false);}render(){return y` ${this.yield("",y`<div data-default-slot hidden></div><div ${L(this.Wn)} class="uc-content-wrapper" ?hidden=${!this.jn}><div class="uc-icon-container" ?hidden=${!this.withIcon}><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">${this.vo}</span></div>`)} `}};h([b({type:Boolean,noAccessor:true})],dt.prototype,"single",2),h([b({type:Boolean,noAccessor:true})],dt.prototype,"ghost",2),h([b({type:Boolean,reflect:true})],dt.prototype,"disabled",2),h([b({type:Boolean,reflect:true})],dt.prototype,"clickable",2),h([b({type:Boolean,attribute:"with-icon",reflect:true})],dt.prototype,"withIcon",2),h([b({type:Boolean,reflect:true})],dt.prototype,"fullscreen",2),h([b({type:Boolean,reflect:true})],dt.prototype,"initflow",2),h([b({type:String})],dt.prototype,"text",2),h([g()],dt.prototype,"Nt",2),h([g()],dt.prototype,"jn",2),h([g()],dt.prototype,"vo",2);var Mt=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=E.activities.UPLOAD_LIST;this.Jn=false;this.ta=false;this.ea=false;this.To=false;this.Eo=false;this.Zi=null;this.ia=false;this.xo=null;this.ra=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this.Co=()=>{this.emit(I.UPLOAD_CLICK),this.api.uploadAll(),this.Y();};this.So=()=>{this.emit(I.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow();};this.Pt=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll();};this.Y=le(()=>{this.isConnected&&(this.yu(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}static{a(this,"UploadList");}get gu(){return this.xo?this.vu(this.xo):""}yu(){let t=this.api.getOutputCollectionState(),e={total:t.totalCount,succeed:t.successCount,uploading:t.uploadingCount,failed:t.failedCount,validatingBeforeUploading:t.idleEntries.filter(f=>f.isValidationPending).length},o=!t.errors.some(f=>f.type==="TOO_MANY_FILES"||f.type==="TOO_FEW_FILES"),s=t.errors.some(f=>f.type==="TOO_MANY_FILES"),n=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),l=t.allEntries.some(f=>f.isValidationPending),c=e.failed===0&&t.errors.length===0&&!l,u=false,p=false,d=false;if(e.total-e.succeed-e.uploading-e.failed>0&&o&&c&&this.cfg.confirmUpload)u=true;else {p=true;let f=this.cfg.groupOutput?!!t.group:true;d=e.total===e.succeed&&o&&c&&f;}this.Jn=p,this.ta=d,this.ea=u,this.Eo=e.total===0||!s&&!n,this.To=!n||this.cfg.multiple,this.ia=e.total>0,this.xo=e;}vu(t){let e=a(o=>{let s=t[o];return o==="uploading"&&(s+=t.validatingBeforeUploading),this.l10n(`header-${o}`,{count:s})},"localizedText");return t.uploading>0||t.validatingBeforeUploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this.Y),this.subConfigValue("multipleMin",this.Y),this.subConfigValue("multipleMax",this.Y),this.sub("*groupInfo",t=>{t&&this.Y();}),this.subConfigValue("filesViewMode",t=>{this.setAttribute("mode",t);}),this.sub("*currentActivity",t=>{!this.couldOpenActivity&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity);}),this.uploadCollection.observeProperties(this.Y),this.uploadCollection.observeCollection(this.Y),this.sub("*collectionErrors",t=>{let e=t.filter(o=>o.type!=="SOME_FILES_HAS_ERRORS")[0];if(!e){this.Zi=null;return}this.Zi=e.message;});}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this.Y),this.uploadCollection.unobserveCollection(this.Y));}render(){return y`<uc-activity-header><span aria-live="polite" class="uc-header-text">${this.gu}</span><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" ?hidden=${this.ia}>${this.yield("empty",y`<span>${this.l10n("no-files")}</span>`)}</div><div class="uc-files"><div class="uc-files-wrapper">${Ea(this.$["*uploadList"]??[],({uid:t})=>t,({uid:t})=>y`<uc-file-item .uid=${t}></uc-file-item>`)}</div><button type="button" class="uc-add-more-btn uc-secondary-btn" @click=${this.ra} ?disabled=${!this.Eo} ?hidden=${!this.To} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button></div><div class="uc-common-error" ?hidden=${!this.Zi} >${this.Zi??""}</div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Pt}>${this.l10n("clear")}</button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" ?hidden=${!this.To} ?disabled=${!this.Eo} @click=${this.ra} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button><button type="button" class="uc-upload-btn uc-primary-btn" ?hidden=${!this.ea} @click=${this.Co} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.Jn} ?disabled=${!this.ta} @click=${this.So} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};h([g()],Mt.prototype,"Jn",2),h([g()],Mt.prototype,"ta",2),h([g()],Mt.prototype,"ea",2),h([g()],Mt.prototype,"To",2),h([g()],Mt.prototype,"Eo",2),h([g()],Mt.prototype,"Zi",2),h([g()],Mt.prototype,"ia",2),h([g()],Mt.prototype,"xo",2);var $r=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=E.activities.URL;this.Ao={importDisabled:true};this.zt=O();this.ko=t=>{let e=t.target?.value??"";this.Ao={importDisabled:!e};};this.Co=t=>{t.preventDefault(),this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let o=this.zt.value?.value?.trim();o&&(this.api.addFileFromUrl(o,{source:H.URL}),this.modalManager?.open(E.activities.UPLOAD_LIST),this.$["*currentActivity"]=E.activities.UPLOAD_LIST);};}static{a(this,"UrlSource");}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"",{onActivate:a(()=>{let t=this.zt.value;t&&(t.value="",t.focus()),this.Ao={importDisabled:true};},"onActivate")});}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.historyBack} title=${this.l10n("back")} aria-label=${this.l10n("back")}><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span>${this.l10n("caption-from-url")}</span></div><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content" @submit=${this.Co}><label><input ${L(this.zt)} placeholder="https://" class="uc-url-input" type="text" @input=${this.ko} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${this.Ao.importDisabled} >${this.l10n("upload-url")}</button></form>`}};h([g()],$r.prototype,"Ao",2);var Da=a(()=>typeof navigator.permissions<"u","canUsePermissionsApi");var Fa="important",ld=" !"+Fa,ke=ht(class extends wt{constructor(r){if(super(r),r.type!==$t.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 o=i[e];if(o!=null){this.ft.add(e);let s=typeof o=="string"&&o.endsWith(ld);e.includes("-")||s?t.setProperty(e,s?o.slice(0,-11):o,s?Fa:""):t[e]=o;}}return tt}});var cd={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},ud=["camera","microphone"];function Dr(r){let i=Math.floor(r/60).toString().padStart(2,"0"),t=Math.floor(r%60).toString().padStart(2,"0");return `${i}:${t}`}a(Dr,"formatTime");var Va="image/jpeg",_a="video/webm",B=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=E.activities.CAMERA;this.Xi=null;this.Mo=false;this.Je=[];this.St=null;this.At=null;this.Yi=null;this.Qi=null;this.v=null;this.ti={};this.kt=null;this.e=null;this.Me=[];this.Oe=[];this.bu={};this.Ji=[];this.tr=null;this.oa=()=>{this.sa(),this.ei="pause";};this.na=()=>{this.ei="play",this.wu();};this.ii=O();this.re=O();this._=O();this.aa=O();this.la=0;this.ca=0;this.ua=null;this.er=true;this.ir=true;this.Tu=Da();this.da=[];this.oe=true;this.Oo="";this.Ie=true;this.se=true;this.Le=true;this.pa=[];this.ne=true;this.Io=true;this.ae=true;this.Rt=true;this.le=true;this.Ue="camera-full";this.ei="play";this.ha="microphone";this.rr="uc-shot-btn uc-camera-action";this.Eu=()=>{if(this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.v}}}),this.v===k.PHOTO&&this.xu(),this.v===k.VIDEO){if(this.St?.state==="recording"){this.ma();return}this.Cu();}};this.Su=t=>{let e=t.target;e&&(this.Qi=e.value,this.Pe());};this.Au=t=>{let e=t.target;e&&(this.Yi=e.value,this.Pe());};this.ku=()=>{this.Pe();};this.Mu=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.v}}}),this.Eu();};this.Ou=()=>{this.Iu();};this.Lu=()=>{this.Uu();};this.Pu=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.v}}}),this.Ru();};this.$u=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.v}}}),this.Du();};this.fa=t=>{let o=t.currentTarget?.getAttribute("data-id");o&&this.ga(o);};this.va=()=>{let t=Math.floor((performance.now()-this.la+this.ca)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let e=this.cfg.maxVideoRecordingDuration-t;if(e<=0){let s=this.ii.value;s&&(s.textContent=Dr(e)),this.ma();return}let o=this.ii.value;o&&(o.textContent=Dr(e));}else {let e=this.ii.value;e&&(e.textContent=Dr(t));}this.Re=requestAnimationFrame(this.va);};this.Fu=()=>{this.la=performance.now(),this.ca=0,this.va();};this.ya=()=>{this.Re&&cancelAnimationFrame(this.Re);};this.sa=()=>{let t=this._.value;if(!t)return;let e=t.currentTime,o=t.duration||1,s=this.re.value;s&&(s.style.transform=`scaleX(${e/o})`);let n=this.ii.value;n&&(n.textContent=Dr(e)),this.Re=requestAnimationFrame(this.sa);};this.wu=()=>{this.Re&&cancelAnimationFrame(this.Re);};this.Re=null;this.Cu=()=>{try{this.Je=[],this.ti={...this.cfg.mediaRecorderOptions};let{mimeType:t}=this.cfg.mediaRecorderOptions||{};t&&MediaRecorder.isTypeSupported(t)?this.ti.mimeType=t:MediaRecorder.isTypeSupported(_a)?this.ti.mimeType=_a:this.ti.mimeType="video/mp4",this.At&&(this.St=new MediaRecorder(this.At,this.ti),this.St.start(),this.St.addEventListener("dataavailable",e=>{this.Je.push(e.data);}),this.Fu(),this.classList.add("uc-recording"),this.ri(Tt.PLAY));}catch(t){console.error("Failed to start recording",t),this.telemetryManager.sendEventError(t,"camera recording. Failed to start recording");}};this.ma=()=>{this.St?.addEventListener("stop",()=>{this.Nu(),this.ya(),this.ri(Tt.STOP);}),this.St?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this.v}}});};this.Iu=()=>{if(this.St?.state==="recording")return;let t=this._.value;t&&(!t.paused&&!t.ended&&t.readyState>2?t.pause():t.paused&&t.play());};this.Uu=()=>{this.At?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.ha=t.enabled?"microphone":"microphone-mute",this.Io=!t.enabled;});};this.Nu=()=>{try{let t=new Blob(this.Je,{type:this.St?.mimeType}),e=URL.createObjectURL(t),o=this._.value;if(!o)return;o.muted=!1,o.volume=1,this.oi(null),o.src=e,this.Vu(o);}catch(t){console.error("Failed to preview video",t),this.telemetryManager.sendEventError(t,"camera previewing. Failed to preview video");}};this.Ru=()=>{if(this.ri(Tt.RETAKE),this.v===k.VIDEO){this.oi(this.At);let t=this._.value;t&&(t.muted=true);}this._.value?.play?.();};this.Du=()=>{if(this.ri(Tt.ACCEPT),this.v===k.PHOTO){this.kt?.toBlob(s=>{if(!s)return;let n=this.ba("camera","jpeg",Va,s);this.wa(n);},Va);return}let t=new Blob(this.Je,{type:this.St?.mimeType}),e=this._u(this.St?.mimeType),o=this.ba("video",e,`video/${e}`,t);this.wa(o),this.Je=[];};this.Bu=t=>{t===Tt.SHOT&&(this.le=true,this.se=true,this.Rt=true,this.Le=false,this.oe=true),(t===Tt.RETAKE||t===Tt.ACCEPT)&&(this.le=!this.q.includes(k.VIDEO),this.Rt=!this.q.includes(k.PHOTO),this.se=false,this.Le=true,this.oe=this.Me.length<=1);};this.zu=t=>{t===Tt.PLAY&&(this.Ie=false,this.Rt=true,this.oe=true,this.ne=true,this.ei="pause",this.Ue="square",this.rr="uc-shot-btn uc-camera-action uc-stop-record"),t===Tt.STOP&&(this.Ie=false,this.se=true,this.ae=true,this.Le=false),(t===Tt.RETAKE||t===Tt.ACCEPT)&&(this.Ie=true,this.le=!this.q.includes(k.VIDEO),this.Rt=!this.q.includes(k.PHOTO),this.se=false,this.Le=true,this.ae=!this.cfg.enableAudioRecording,this.Ue="video-camera-full",this.rr="uc-shot-btn uc-camera-action",this.ne=!this.cfg.enableAudioRecording||this.Oe.length<=1,this.oe=this.Me.length<=1);};this.ri=t=>{this.v===k.PHOTO&&(t==="shot"||t==="retake"||t==="accept")&&this.Bu(t),this.v===k.VIDEO&&(t==="play"||t==="stop"||t==="retake"||t==="accept"||t==="pause"||t==="resume")&&this.zu(t);};this.ga=t=>{this.aa.value?.querySelectorAll("button").forEach(o=>{o.classList.toggle("uc-active",o.getAttribute("data-id")===t);}),t===k.PHOTO&&(this.Ue="camera-full",this.ne=true,this.ae=true),t===k.VIDEO&&(this.ei="play",this.Ue="video-camera-full",this.ne=!this.cfg.enableAudioRecording||this.Oe.length<=1,this.ae=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId:t}}}),this.v=t;};this.ba=(t,e,o,s)=>{let n=Date.now(),l=`${t}-${n}.${e}`;return new File([s],l,{lastModified:n,type:o})};this.wa=t=>{this.api.addFileFromObject(t,{source:H.CAMERA}),this.set$({"*currentActivity":E.activities.UPLOAD_LIST}),this.modalManager?.open(E.activities.UPLOAD_LIST);};this.si=D(t=>{this.classList.toggle("uc-initialized",t==="granted");let e=this.v===k.VIDEO&&this.cfg.enableAudioRecording,o=this.v===k.PHOTO?"camera-full":"video-camera-full";t==="granted"?(this.er=false,this.se=false,this.Rt=!this.q.includes(k.PHOTO),this.le=!this.q.includes(k.VIDEO),this.ir=true,this.Ie=true,this.Ue=o,this.ae=!e,this.ne=!e):t==="prompt"?(this.Oo="camera-permissions-prompt",this.er=true,this.se=true,this.Rt=true,this.ir=false,this.Po()):(this.Oo="camera-permissions-denied",this.er=true,this.ir=false,this.Rt=!this.q.includes(k.PHOTO),this.le=!this.q.includes(k.VIDEO),this.Le=true,this.rr="uc-shot-btn uc-camera-action",this.Po());},300);this.Hu=()=>{if(!this.At)return false;let t=this.At?.getAudioTracks(),e=this.At?.getVideoTracks();return t.forEach(o=>{o.stop();}),e.forEach(o=>{o.stop();}),true};this.Po=()=>{this.Mo&&(this._.value&&(this._.value.volume=0),this.tr?.getTracks?.()?.[0]?.stop(),this.Lo(this._.value),this.oi(null),this.Hu(),this.ya(),this.Mo=false);};this.Pe=async()=>{let t={video:{...cd},audio:this.cfg.enableAudioRecording?{}:false};this.Qi&&(t.video={deviceId:{exact:this.Qi}}),this.Yi&&this.cfg.enableAudioRecording&&(t.audio={deviceId:{exact:this.Yi}}),this._.value&&(this._.value.volume=0);try{this.si("prompt"),this.At=await navigator.mediaDevices.getUserMedia(t),this.At.addEventListener("inactive",()=>{this.si("denied");}),this.oi(this.At),this.Mo=!0,this.si("granted");}catch(e){this.si("denied"),console.log("Failed to capture camera",e),this.telemetryManager.sendEventError(e,"camera capturing. Failed to capture camera");}};this.Ta=()=>{this.Pe();};this.ju=async()=>{try{this.or();for(let t of ud){let e=await navigator.permissions.query({name:t});this.bu[t]=e,e.addEventListener("change",this.Ta),this.Ji.push(()=>{e.removeEventListener("change",this.Ta);});}this.Xi=()=>{this.or();};}catch(t){this.or(),console.log("Failed to use permissions API. Fallback to manual request mode.",t),this.telemetryManager.sendEventError(t,"camera permissions. Failed to use permissions API"),this.Pe();}};this.Ku=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this.Ro(),navigator.mediaDevices.addEventListener("devicechange",this.Ro);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.Ro=async()=>{try{let t=await navigator.mediaDevices.enumerateDevices();this.Me=t.filter(e=>e.kind==="videoinput").map((e,o)=>({text:e.label.trim()||`${this.l10n("caption-camera")} ${o+1}`,value:e.deviceId})),this.Oe=this.cfg.enableAudioRecording?t.filter(e=>e.kind==="audioinput").map(e=>({text:e.label.trim(),value:e.deviceId})):[],this.da=this.Me,this.oe=this.Me.length<=1,this.Qi=this.Me[0]?.value??null,this.pa=this.Oe,this.ne=!this.cfg.enableAudioRecording||this.Oe.length<=1,this.Yi=this.Oe[0]?.value??null;}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get devices"),console.log("Failed to get devices",t);}};this.Gu=async()=>{await this.ju(),await this.Ku(),await this.Pe(),this.Ea(this.q);};this.qu=async()=>{this.Xi&&this.Xi(),window.chrome||this.si("denied"),this.Po();};this.Ea=t=>{this.le=!t.includes(k.VIDEO),this.Rt=!t.includes(k.PHOTO);let e=t[0];e&&(!this.v||!t.includes(this.v))&&this.ga(e);};}static{a(this,"CameraSource");}Vu(t){this.Lo(t),t.addEventListener("play",this.oa),t.addEventListener("pause",this.na);}Lo(t){t?.removeEventListener("play",this.oa),t?.removeEventListener("pause",this.na);}oi(t){this.tr!==t&&(this.tr=t,this.Uo());}Uo(){let t=this._.value;if(!t)return;let e=this.tr??null;t.srcObject!==e&&(t.srcObject=e);}xu(){if(this.ri("shot"),this.kt=document.createElement("canvas"),this.e=this.kt.getContext("2d"),!this.e)throw new Error("Failed to get canvas context");let t=this._.value;if(!t)throw new Error("Video element not found");this.kt.height=t.videoHeight,this.kt.width=t.videoWidth,this.cfg.cameraMirror&&(this.e.translate(this.kt.width,0),this.e.scale(-1,1)),this.e.drawImage(t,0,0),t.pause();}_u(t){let e={mp4:"mp4",ogg:"ogg",webm:"webm",quicktime:"mov","x-matroska":"mkv"};if(t==="")return "webm";if(t){let o=t.split("/");if(o?.[0]==="video"){let n=o.slice(1).join("/")?.split(";")[0];if(n&&e[n])return e[n]}}return "avi"}get q(){return j(this.cfg.cameraModes).filter(t=>t===k.PHOTO||t===k.VIDEO)}or(){if(this.Ji.length!==0){for(let t of this.Ji)t();this.Ji=[],this.Xi=null;}}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:this.Gu,onDeactivate:this.qu}),this.subConfigValue("cameraMirror",t=>{this.ua=t?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",t=>{this.ae=!t,this.Io=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isActivityActive)return;let e=ct(t);this.Ea(e.filter(o=>o===k.PHOTO||o===k.VIDEO));});}firstUpdated(t){super.firstUpdated(t),this.Uo();}updated(t){super.updated(t),this.Uo();}Wu(){this.or(),navigator.mediaDevices?.removeEventListener("devicechange",this.Ro),this.Lo(this._.value),this.oi(null);}disconnectedCallback(){super.disconnectedCallback(),this.Wu();}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.$["*historyBack"]} title=${this.l10n("back")} ><uc-icon name="back"></uc-icon></button><div ?hidden=${!this.oe}><uc-icon name="camera"></uc-icon><span>${this.l10n("caption-camera")}</span></div><uc-select class="uc-camera-select" .options=${this.da} ?hidden=${this.oe} @change=${this.Su} ></uc-select><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><video muted autoplay playsinline style=${ke({transform:this.ua})} ?hidden=${this.er} ${L(this._)} ></video><div class="uc-message-box" ?hidden=${this.ir}><span>${this.l10n(this.Oo)}</span><button type="button" @click=${this.ku} ?hidden=${this.Tu} >${this.l10n("camera-permissions-request")}</button></div></div><div class="uc-controls"><div ${L(this.aa)} class="uc-switcher" ?hidden=${!this.Ie}><button data-id="photo" type="button" class="uc-switch uc-mini-btn" @click=${this.fa} ?hidden=${this.Rt} data-testid="tab-photo" ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class="uc-switch uc-mini-btn" @click=${this.fa} ?hidden=${this.le} data-testid="tab-video" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" @click=${this.Ou} ?hidden=${this.Ie} data-testid="recording-timer" ><uc-icon name=${this.ei}></uc-icon><span ${L(this.ii)}> 00:00 </span><span ${L(this.re)} class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" ?hidden=${this.Le} ><button type="button" class="uc-secondary-btn" @click=${this.Pu}> Retake </button><button type="button" class="uc-primary-btn" @click=${this.$u} data-testid="accept" > Accept </button></div><button type="button" data-testid="shot" @click=${this.Mu} class=${this.rr} ?hidden=${this.se} ><uc-icon name=${this.Ue}></uc-icon></button><div class="uc-select"><button type="button" class="uc-mini-btn uc-btn-microphone" @click=${this.Lu} ?hidden=${this.ae} data-testid="toggle-microphone" ><uc-icon name=${this.ha}></uc-icon></button><uc-select class="uc-audio-select" .options=${this.pa} ?hidden=${this.ne} ?disabled=${this.Io} @change=${this.Au} data-testid="audio-select" ></uc-select></div></div>`}};h([g()],B.prototype,"ua",2),h([g()],B.prototype,"er",2),h([g()],B.prototype,"ir",2),h([g()],B.prototype,"Tu",2),h([g()],B.prototype,"da",2),h([g()],B.prototype,"oe",2),h([g()],B.prototype,"Oo",2),h([g()],B.prototype,"Ie",2),h([g()],B.prototype,"se",2),h([g()],B.prototype,"Le",2),h([g()],B.prototype,"pa",2),h([g()],B.prototype,"ne",2),h([g()],B.prototype,"Io",2),h([g()],B.prototype,"ae",2),h([g()],B.prototype,"Rt",2),h([g()],B.prototype,"le",2),h([g()],B.prototype,"Ue",2),h([g()],B.prototype,"ei",2),h([g()],B.prototype,"ha",2),h([g()],B.prototype,"rr",2);function xi(r,i,t){return r?i(r):t?.(r)}a(xi,"n");function Na(...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},{})}a(Na,"normalize");function ft(...r){let i=Na(...r);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}a(ft,"classNames");function Ba(r,...i){let t=Na(...i);for(let e of Object.keys(t))r.classList.toggle(e,!!t[e]);}a(Ba,"applyClassNames");var dd=a(r=>rt.includes(r),"isTabIdValue"),za=a(r=>{if(!r)return rt;let i=ct(r).filter(dd);return i.length===0?rt:i},"parseTabs");function Ha(r){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":rt,"*tabId":N.CROP,"*on.retryNetwork":a(()=>{let i=r.querySelectorAll("img");for(let t of i){let e=t.src;t.src=kt,t.src=e;}r.$["*networkProblems"]=false;},"*on.retryNetwork"),"*on.apply":a(i=>{if(!i)return;let t=r.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=it(te(i),"preview"),o=q(t,e),s={originalUrl:t,cdnUrlModifiers:e,cdnUrl:o,transformations:i};r.dispatchEvent(new CustomEvent("apply",{detail:s,bubbles:true,composed:true})),r.remove();},"*on.apply"),"*on.cancel":a(()=>{r.remove(),r.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));},"*on.cancel")}}a(Ha,"initState");var ja="<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 Me={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},Ci=class extends C{constructor(){super(...arguments);this.Ct=false;this.xa=Me;this.Ca=Me.visible;this.Sa=Me.hidden;this.$o=false;this.Aa=false;}static{a(this,"PresenceToggle");}set visible(t){this.Ct=t,this.ka();}get visible(){return this.Ct}set styles(t){this.xa=t,this.$o=true,this.Ca=t.visible??Me.visible,this.Sa=t.hidden??Me.hidden;}get styles(){return this.xa}ka(){this.style.visibility=this.Ct?"inherit":"hidden",Ba(this,{[Me.transition]:!this.$o,[this.Ca]:this.Ct,[this.Sa]:!this.Ct}),this.toggleAttribute("inert",!this.Ct);}Zu(){this.Aa||(this.Aa=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.$o||this.classList.add(Me.transition),this.ka(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.Zu();},0);}};h([b({type:Boolean})],Ci.prototype,"visible",1),h([b({attribute:false})],Ci.prototype,"styles",1);var Fr=class extends C{constructor(){super(...arguments);this.active=false;this.re=O();this.Do=false;this.Fo=()=>{let t=this.re.value;t&&(this.Ma(t),this.Do&&this.active&&this.No());};}static{a(this,"LineLoaderUi");}firstUpdated(t){super.firstUpdated(t),this.active&&this.No();}updated(t){super.updated(t),t.has("active")&&(this.active?this.No():this.Xu());}No(){let t=this.re.value;if(!t)return;this.Do=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.Fo),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.Fo,{once:true});}Xu(){let t=this.re.value;t&&(this.Do=false,t.removeEventListener("transitionend",this.Fo),this.Ma(t));}Ma(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return y`<div class="uc-inner"><div class="uc-line" ${L(this.re)}></div></div>`}};h([b({type:Boolean,reflect:true})],Fr.prototype,"active",2);var Ot=ht(class extends wt{constructor(r){if(super(r),r.type!==$t.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 o=!!i[e];o===this.st.has(e)||this.nt?.has(e)||(o?(t.add(e),this.st.add(e)):(t.remove(e),this.st.delete(e)));}return tt}});var G=a(r=>r??R,"o");var It=class extends C{constructor(){super(...arguments);this.text="";this.icon="";this.reverse=false;this.theme="default";this.ariaRole=void 0;this.ariaControls="";this.titleProp="";this.active=false;}static{a(this,"BtnUi");}firstUpdated(t){super.firstUpdated(t),this.Oa(),this.Ia();}updated(t){super.updated(t),t.has("reverse")&&this.Oa(),t.has("theme")&&this.Ia();}Oa(){this.style.flexDirection=this.reverse?"row-reverse":"";}Ia(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get Yu(){let t=this.Vo;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.Qu}}get Vo(){return !this.icon}get Qu(){return !this.text&&!this.Vo}render(){return y`<button type="button" role=${G(this.ariaRole||void 0)} aria-controls=${G(this.ariaControls||void 0)} aria-label=${G(this.l10n(this.titleProp))} title=${G(this.l10n(this.titleProp))} ><uc-icon class=${Ot(this.Yu)} name=${G(this.icon||void 0)} ?hidden=${this.Vo} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};h([b({type:String})],It.prototype,"text",2),h([b({type:String})],It.prototype,"icon",2),h([b({type:Boolean,reflect:true})],It.prototype,"reverse",2),h([b({type:String,reflect:true})],It.prototype,"theme",2),h([b({attribute:"aria-role"})],It.prototype,"ariaRole",2),h([b({attribute:"aria-controls"})],It.prototype,"ariaControls",2),h([b({attribute:"title-prop"})],It.prototype,"titleProp",2),h([b({type:Boolean,noAccessor:true})],It.prototype,"active",2);function Ka(r,i){let t={};for(let e of i){let o=r[e];(Object.hasOwn(r,e)||o!==void 0)&&(t[e]=o);}return t}a(Ka,"pick");function Xe(r,i,t){let o=window.devicePixelRatio,s=Math.min(Math.ceil(i*o),3e3),n=o>=2?"lightest":"normal";return q(r,it(Wi,te(t),`quality/${n}`,`stretch/off/-/resize/${s}x`,`@clib/${Pt}/${Rt}/uc-cloud-image-editor/`))}a(Xe,"viewerImageSrc");var Vr=class extends C{constructor(){super(...arguments);this.La=`uc-backdrop-mask-${et.generateFastUid()}`;this.nr=false;this.ci=false;this.Ra=O();this.ui=false;this.di=null;this.Da=t=>{this.Fa(),this.pi&&(t.stopPropagation(),t.preventDefault(),this.pi=false);};this.Na=t=>{if(!this.pi||!this.sr||!this.Bo)return;t.stopPropagation(),t.preventDefault();let e=this.Ht;if(!e)return;let{x:o,y:s}=e.getBoundingClientRect(),n=t.x-o,l=t.y-s,c=n-this.sr[0],u=l-this.sr[1],{direction:p}=this.Bo,d=this.ld(p,[c,u]);d&&(this.$["*cropBox"]=d);};this.Va=t=>{if(!this.$t)return;let e=Object.values(this.$t).find(o=>{if(!o||this.Ho(o.direction))return false;let n=o.interactionNode.getBoundingClientRect(),l={x:n.x,y:n.y,width:n.width,height:n.height};return sa(l,[t.x,t.y])});this.Ua=e,this.Fa();};}static{a(this,"CropFrame");}get Ht(){return this.Ra.value??null}get pi(){return this.ci}set pi(t){this.ci!==t&&(this.ci=t,this.zo());}zo(){this.ai&&this.ai.setAttribute("class",ft({"uc-guides--hidden":this.nr,"uc-guides--visible":!this.nr&&this.ci,"uc-guides--semi-hidden":!this.nr&&!this.ci}));}Ho(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=M&&e.width<=M)return true;let o=e.height<=M&&(t.includes("n")||t.includes("s")),s=e.width<=M&&(t.includes("e")||t.includes("w"));return o||s}Ju(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:o,width:s,height:n}=t,l=this.Ht;if(!l)return;let c=mt("mask",{id:this.La}),u=mt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),p=mt("rect",{x:e,y:o,width:s,height:n,fill:"black"});c.appendChild(u),c.appendChild(p);let d=mt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.La})`});l.appendChild(d),l.appendChild(c),this.ni=c,this._o=p;}td(){this.ni&&(this.ni.style.display="none",window.requestAnimationFrame(()=>{this.ni&&(this.ni.style.display="block");}));}ed(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:o,width:s,height:n}=t;this._o&&se(this._o,{x:e,y:o,width:s,height:n});}rd(){let t=this.$["*cropBox"];if(!(!t||!this.ai||!this.$t)){for(let e of Object.values(this.$t)){if(!e)continue;let{direction:o,pathNode:s,interactionNode:n,groupNode:l}=e,c=o==="",u=o.length===2,{x:p,y:d,width:m,height:f}=t;if(c)se(n,{x:p,y:d,width:m,height:f});else {let w=ne(Math.min(m,f)/82/2,0,1),T=u?ta(t,o,w):ea(t,o,w),S=T.center;if(!S)continue;let x=Math.max(es*ne(Math.min(m,f)/es/3,0,1),Jn);se(n,{x:S[0]-x,y:S[1]-x,width:x*2,height:x*2}),se(s,{d:T.d});}let v=this.Ho(o);l.setAttribute("class",ft("uc-thumb",{"uc-thumb--hidden":v,"uc-thumb--visible":!v}));}se(this.ai,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}$a(t,e){let o=mt("g");o.classList.add("uc-thumb"),o.setAttribute("with-effects","");let s=mt("rect",{fill:"transparent"}),n=mt("path",{stroke:"currentColor",fill:"none","stroke-width":3});o.appendChild(n),o.appendChild(s),t[e]={direction:e,pathNode:n,interactionNode:s,groupNode:o},e===""&&(o.style.cursor="move"),s.addEventListener("pointerdown",this.od.bind(this,e));}sd(){let t={};for(let e=0;e<3;e++)for(let o=0;o<3;o++){let s=`${["n","","s"][e]}${["w","","e"][o]}`;s!==""&&this.$a(t,s);}return this.$a(t,""),t}nd(){let t=mt("svg"),e=mt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});t.appendChild(e);for(let o=1;o<=2;o++){let s=mt("line",{x1:`${mi*o}%`,y1:"0%",x2:`${mi*o}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}for(let o=1;o<=2;o++){let s=mt("line",{x1:"0%",y1:`${mi*o}%`,x2:"100%",y2:`${mi*o}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}ad(){let t=this.Ht;if(!t)return;let e=document.createDocumentFragment(),o=this.nd();e.appendChild(o);let s=this.sd();for(let{groupNode:n}of Object.values(s))e.appendChild(n);t.appendChild(e),this.$t=s,this.ai=o,this.zo();}od(t,e){if(!this.$t)return;let o=this.$t[t];if(!o||this.Ho(t))return;let s=this.$["*cropBox"],n=this.Ht;if(!n)return;let{x:l,y:c}=n.getBoundingClientRect(),u=e.x-l,p=e.y-c;this.pi=true,this.Bo=o,this.sr=[u,p],this.Pa={...s};}ld(t,e){let[o,s]=e,n=this.$["*imageBox"],l=this.Pa??this.$["*cropBox"],c=this.$["*currentAspectRatio"],u=c?c.width/c.height:void 0;if(t===""?l=ra({rect:l,delta:[o,s],imageBox:n}):l=oa({rect:l,delta:[o,s],direction:t,aspectRatio:u,imageBox:n}),!Object.values(l).every(p=>Number.isFinite(p)&&p>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:l});return}return Ne(ze(l),n)}Fa(){let t=this.Ua,e=this.Ht;e&&(e.style.cursor=t?ia(t.direction):"initial");}_a(t){if(this.li){this.li.setAttribute("href",t);return}let e=this.Ht;if(!e){this.di=t;return}this.di=null;let o=document.createDocumentFragment(),s=mt("image",{href:t});s.setAttribute("class","uc-cloud-mask"),o.appendChild(s),e.appendChild(o),this.li=s;}cd(){let t=this.$["*cropBox"];if(!t||!this.li)return;let{x:e,y:o,width:s,height:n}=t;se(this.li,{x:e,y:o,height:n,width:s});}jo(){this.ui&&(this.ed(),this.rd(),this.cd());}toggleThumbs(t){if(this.$t)for(let e of Object.values(this.$t)){if(!e)continue;let{groupNode:o}=e;o.setAttribute("class",ft("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.td(),this.ui&&window.requestAnimationFrame(()=>{this.jo();});}),this.sub("*cropBox",t=>{t&&(this.nr=t.height<=M||t.width<=M,this.zo(),this.ui&&window.requestAnimationFrame(()=>{this.jo();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this._a(t);}),document.addEventListener("pointermove",this.Na,true),document.addEventListener("pointerup",this.Da,true);}firstUpdated(t){super.firstUpdated(t),this.ud();}ud(){let t=this.Ht;if(!(!t||this.ui)){if(this.Ju(),this.ad(),this.ui=true,t.addEventListener("pointermove",this.Va,true),this.di){let e=this.di;this.di=null,this._a(e);}this.jo();}}disconnectedCallback(){super.disconnectedCallback(),this.Ht?.removeEventListener("pointermove",this.Va,true),document.removeEventListener("pointermove",this.Na,true),document.removeEventListener("pointerup",this.Da,true);}render(){return y`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${L(this.Ra)}></svg>`}};h([g()],Vr.prototype,"ci",2);function hd(r){return r?[({dimensions:t,coords:e})=>[...t,...e].every(o=>Number.isInteger(o)&&Number.isFinite(o)),({dimensions:t,coords:e})=>t.every(o=>o>0)&&e.every(o=>o>=0)].every(t=>t(r)):true}a(hd,"validateCrop");var _r=class extends C{constructor(){super();this.ctxOwner=true;this.ce={width:0,height:0};this.e=null;this.E=false;this.gt=null;this.za=O();this.Go=O();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.Ba=D(this.Ha.bind(this),300),this.Ko=le(()=>{!this.isConnected||!this.E||(this.qo(),this.ja(),this.Ka(),this.Wo(),this.Zo());},100);}static{a(this,"EditorImageCropper");}firstUpdated(t){super.firstUpdated(t),this.qo();}ja(){let t=this.$["*editorTransformations"],e=Ka(t,Object.keys(this.$["*operations"])),o={...this.$["*operations"],...e};this.$["*operations"]=o;}qo(){let t=this.za.value;if(!t)return;let e=t.getContext("2d"),o=this.offsetWidth,s=this.offsetHeight,n=window.devicePixelRatio;t.style.width=`${o}px`,t.style.height=`${s}px`,t.width=o*n,t.height=s*n,e?.scale(n,n),this.kt=t,this.e=e;}Ka(){if(!this.E||!this.gt)return;let t=this.gt,e=this.$["*padding"],o=this.$["*operations"],{rotate:s}=o,n={width:this.offsetWidth,height:this.offsetHeight},l=Be({width:t.naturalWidth,height:t.naturalHeight},s),c;if(l.width>n.width-e*2||l.height>n.height-e*2){let u=l.width/l.height,p=n.width/n.height;if(u>p){let d=n.width-e*2,m=d/u,f=0+e,v=e+(n.height-e*2)/2-m/2;c={x:f,y:v,width:d,height:m};}else {let d=n.height-e*2,m=d*u,f=e+(n.width-e*2)/2-m/2,v=0+e;c={x:f,y:v,width:m,height:d};}}else {let{width:u,height:p}=l,d=e+(n.width-e*2)/2-u/2,m=e+(n.height-e*2)/2-p/2;c={x:d,y:m,width:u,height:p};}this.$["*imageBox"]=ze(c);}Wo(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,n=this.$["*editorTransformations"].crop,{width:l,x:c,y:u}=e;if(n){let{dimensions:[m,f],coords:[v,w]}=n,{width:T}=Be(this.ce,s),S=l/T;t=Ne(ze({x:c+v*S,y:u+w*S,width:m*S,height:f*S}),e);}let p=this.$["*currentAspectRatio"],d=p?p.width/p.height:void 0;if(!na(t,e)||d&&!aa(t,d)){let m=e.width/e.height,f=e.width,v=e.height;d&&(m>d?f=Math.min(e.height*d,e.width):v=Math.min(e.width/d,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"]=Ne(ze(t),e);}dd(){let t=this.e;if(!t)return;let e=this.gt;if(!e)return;let o=this.$["*imageBox"],s=this.$["*operations"],{mirror:n,flip:l,rotate:c}=s,u=Be({width:o.width,height:o.height},c);t.save(),t.translate(o.x+o.width/2,o.y+o.height/2),t.rotate(c*Math.PI*-1/180),t.scale(n?-1:1,l?-1:1),t.drawImage(e,-u.width/2,-u.height/2,u.width,u.height),t.restore();}Zo(){if(!this.E||!this.gt||!this.kt||!this.e)return;let t=this.kt;this.e.clearRect(0,0,t.width,t.height),this.dd();}pd({fromViewer:t}){this.gt&&(this.Go.value?.toggleThumbs(true),this.hd(),setTimeout(()=>{this.className=ft({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}Ga(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,{width:n,height:l}=e,{width:c,height:u}=Be(this.ce,s),{width:p,height:d}=t,m=n/c,f=l/u;return [ne(Math.round(p/m),1,c),ne(Math.round(d/f),1,u)]}md(){let t=this.$["*cropBox"],e=this.$["*imageBox"],o=this.$["*operations"],{rotate:s}=o,{width:n,height:l,x:c,y:u}=e,{width:p,height:d}=Be(this.ce,s),{x:m,y:f}=t,v=n/p,w=l/d,T=this.Ga(),S={dimensions:T,coords:[ne(Math.round((m-c)/v),0,p-T[0]),ne(Math.round((f-u)/w),0,d-T[1])]};if(!hd(S)){console.error("Cropper is trying to create invalid crop object",{payload:S});return}if(!(T[0]===p&&T[1]===d))return S}Ha(){if(!this.isConnected||!this.ce)return;let t=this.$["*operations"],{rotate:e,mirror:o,flip:s}=t,n=this.md(),c={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:o,flip:s};this.$["*editorTransformations"]=c;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this.E&&(this.Ka(),this.Wo(),this.Zo());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this.E){this.E=true,await this.updateComplete,this.qo(),this.ce=t,this.removeEventListener("transitionend",this.qa);try{let o=this.$["*originalUrl"],s=this.$["*editorTransformations"];this.gt=await this.fd(o,s),this.ja(),this.Ko(),this.pd({fromViewer:e});}catch(o){console.error("Failed to activate cropper",{error:o}),this.telemetryManager.sendEventError(o,"cloud editor image. Failed to activate cropper");}this.s=new ResizeObserver(o=>{let[s]=o;if(!s)return;s.contentRect.width>0&&s.contentRect.height>0&&this.E&&this.gt&&this.Ko();}),this.s.observe(this);}}deactivate({reset:t=false}={}){this.E&&(!t&&this.Ha(),this.E=false,this.gd(),this.className=ft({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.Go.value?.toggleThumbs(false),this.addEventListener("transitionend",this.qa,{once:true}),this.s?.disconnect());}gd(){let t=this.Ga(),e=this.$["*cropBox"],o=Math.min(this.offsetWidth,t[0])/e.width,s=Math.min(this.offsetHeight,t[1])/e.height,n=Math.min(o,s),l=e.x+e.width/2,c=e.y+e.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-l)/n}px, ${(this.offsetHeight/2-c)/n}px)`,this.style.transformOrigin=`${l}px ${c}px`;}hd(){let t=this.$["*cropBox"],e=t.x+t.width/2,o=t.y+t.height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${o}px`;}qa(){this.E||(this.gt=null);}async fd(t,e){let o=this.offsetWidth;e={...e,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let s=await this.proxyUrl(Xe(t,o,e)),{promise:n,cancel:l,image:c}=Ae(s),u=this.$e(s);return c.addEventListener("load",u,{once:true}),c.addEventListener("error",u,{once:true}),this.b?.(),this.b=l,n.then(()=>c).catch(p=>(console.error("Failed to load image",{error:p}),this.$["*networkProblems"]=true,c))}$e(t){let e="crop",o=this.$["*loadingOperations"],s=o.get(e);return s||(s=new Map,o.set(e,s)),s.get(t)||(s.set(t,true),this.$["*loadingOperations"]=o),()=>{let n=o.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=o);}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Zo();}),this.sub("*cropBox",()=>{this.gt&&this.Ba();}),this.sub("*currentAspectRatio",()=>{this.Wo();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this.E&&this.ce&&this.activate(this.ce,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.gt&&(this.gt=null);}render(){return y`<canvas class="uc-canvas" ${L(this.za)}></canvas><uc-crop-frame ${L(this.Go)}></uc-crop-frame>`}};h([g()],_r.prototype,"gt",2);function Es(r,i,t){let e=t,o=t-1,s=new Array(e);for(let n=o;n>=0;n-=1)s[n]=Math.ceil((n*i+(o-n)*r)/o);return s}a(Es,"linspace");function md(r){return typeof r=="string"&&r in At}a(md,"isOperationKey");function fd(r){let i=[];for(let t=0;t<r.length-1;t+=1){let e=r[t],o=r[t+1];typeof e=="number"&&typeof o=="number"&&i.push([e,o]);}return i}a(fd,"splitBySections");function gd(r,i,t){let e=fd(r).find(([n,l])=>n<=i&&i<=l);if(!e)return r.map(()=>0);let[o,s]=e;return r.map(n=>{let l=Math.abs(o-s)||1,c=Math.abs(i-o)/l;return o===n?i>t?1:1-c:s===n?i>=t?c:1:0})}a(gd,"calculateOpacities");function vd(r,i){return r.map((t,e)=>t<i?r.length-e:e)}a(vd,"calculateZIndices");function Ga(r,i){let t=At[r].keypointsNumber,{range:e,zero:o}=At[r];return [...new Set([...Es(e[0],o,t+1),...Es(o,e[1],t+1),o,i])].sort((s,n)=>s-n)}a(Ga,"keypointsRange");var xs=class extends C{constructor(){super();this.E=false;this.Xo=true;this.n="initial";this.Wa={};this.jt=[];this.Xa=0;this.Qa=O();this.ar=O();this.classList.add("uc-inactive_to_cropper"),this.Ya=D(async(t,e,o)=>{let s=a(()=>!this.Ja(t,e)||this.Ce!==o||!!this.jt.find(u=>u.value===o),"shouldSkip");if(s())return;let n=await this.tl(t,o),l=new Image;l.src=n.src;let c=this.$e(n.src);l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),n.image=l,l.classList.add("uc-fader-image"),l.addEventListener("load",()=>{if(s())return;let u=this.jt,p=u.findIndex(v=>v.value>o);p===-1&&(p=u.length);let m=u[p]?.image,f=this.ar.value;!f||m&&!f.contains(m)||(u.splice(p,0,n),m?f.insertBefore(l,m):f.appendChild(l),this.Jo(t,o));},{once:true}),l.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}static{a(this,"EditorImageFader");}$e(t){let e=this.n,o=this.$["*loadingOperations"];o.has(e)||o.set(e,new Map);let s=o.get(e);return s&&!s.get(t)&&(s.set(t,true),this.$["*loadingOperations"]=o),()=>{let n=o.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=o);}}il(){window.cancelAnimationFrame(this.Xa),this.Xa=window.requestAnimationFrame(()=>{for(let t of this.jt){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}ue({url:t=this.Za,filter:e=this.m??void 0,operation:o,value:s}={}){if(!t)throw new Error("URL is not defined");let n={...this.Wa};o&&(o==="filter"?e&&typeof s=="number"&&(n.filter={name:e,amount:s}):typeof s=="number"&&(n[o]=s));let l=this.offsetWidth;return this.proxyUrl(Xe(t,l,n))}async tl(t,e){return {src:await this.ue({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}Ja(t,e){return this.n===t&&this.m===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!md(this.n)||!Number.isFinite(e)||(this.Jo(this.n,e),this.Ya(this.n,this.m,e));}Jo(t,e){this.n=t,this.Ce=e;let{zero:o}=At[t],s=this.jt.map(c=>c.value),n=gd(s,e,o),l=vd(s,o);this.jt.forEach((c,u)=>{let p=n[u],d=l[u];typeof p=="number"&&(c.opacity=p),typeof d=="number"&&(c.zIndex=d);}),this.il();}rl(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async vd(){this.a=this.a||this.rl();let t=this.a;t&&this.ol(t);let e=this.jt.map(u=>u.src),{images:o,promise:s,cancel:n}=Ti(e);o.forEach(u=>{let p=this.$e(u.src);u.addEventListener("load",p),u.addEventListener("error",p);}),this.Yo=()=>{n(),this.Yo=void 0;};let l=this.n,c=this.m;if(await s,this.E&&this.Ja(l,c)){let u=this.ar.value;if(!u)return;u.replaceChildren(),this.jt.forEach((p,d)=>{let m=o[d];m&&(m.classList.add("uc-fader-image"),p.image=m,u.appendChild(m));}),this.il();}}async setTransformations(t){if(this.Wa=t,this.a){let e=await this.ue(),o=this.$e(e);this.a.src=e,this.a.addEventListener("load",o,{once:true}),this.a.addEventListener("error",o,{once:true}),this.a.style.opacity="1",this.a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:t,filter:e,operation:o,value:s}){if(!o||typeof s!="number")return;this.Qo?.();let n=Ga(o,s),l=await Promise.all(n.map(u=>this.ue({url:t,filter:e,operation:o,value:u}))),{cancel:c}=Ti(l);this.Qo=c;}yd(t){let e=this.a||this.rl();if(this.ol(e),this.a=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=ft({"uc-active_from_viewer":this.hi,"uc-active_from_cropper":!this.hi,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let o=this.$e(t);e.addEventListener("error",o,{once:true}),e.src=t,e.addEventListener("load",()=>{o(),e&&(e.style.opacity="1",e.style.transform="scale(1)",this.className=ft({"uc-active_from_viewer":this.hi,"uc-active_from_cropper":!this.hi,"uc-inactive_to_cropper":false}));},{once:true}),e.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}async activate({url:t,operation:e,value:o,filter:s,fromViewer:n}){if(this.E=true,this.Xo=false,await this.updateComplete,this.Za=t,this.n=e??"initial",this.Ce=o,this.m=s,this.hi=n,typeof o!="number"&&!s){let c=await this.ue({operation:e,value:o});this.yd(c),this.ts();return}!e||typeof o!="number"||(this.jt=await Promise.all(Ga(e,o).map(c=>this.tl(e,c))),this.Jo(e,o),this.vd());}deactivate({hide:t=true}={}){this.E=false,this.Yo?.(),this.Qo?.(),t&&!this.Xo?(this.Xo=true,this.a&&(this.a.style.transform="scale(1)"),this.className=ft({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.ts();},{once:true})):this.ts();}ol(t){let e=this.Qa.value;e&&(e.contains(t)||e.appendChild(t));}ts(){this.ar.value?.replaceChildren();}render(){return y`<div class="uc-fader-preview-host" ${L(this.Qa)}></div><div class="uc-fader-layers-host" ${L(this.ar)}></div>`}};var Xt=class extends C{constructor(){super();this.es=0;this.zt=O();this.nl=O();this.al=O();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.Kt=0;this.wd=t=>{t.stopPropagation();let e=this.ll(t);e!==null&&(this.rs(e),this.bd("slider-input",e));};this.Td=t=>{t.stopPropagation();let e=this.ll(t);e!==null&&this.rs(e);};this.cl=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.ul=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}static{a(this,"SliderUi");}bd(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.es=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.dl(this.Kt),this.os(),this.s=new ResizeObserver(()=>{this.os(),this.lr(this.Kt);}),this.s.observe(this);let e=this.zt.value;e?.addEventListener("focus",this.cl),e?.addEventListener("blur",this.ul),window.setTimeout(()=>{this.lr(this.Kt);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.Kt&&this.rs(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.os(),this.lr(this.Kt)),t.has("zero")&&this.hasUpdated&&this.pl(this.Kt);}lr(t){this.pl(t);let e=this.max-this.min;if(e===0)return;let{width:o}=this.getBoundingClientRect(),l=100/e*(t-this.min)*(o-this.es)/100;window.requestAnimationFrame(()=>{let c=this.nl.value;c&&(c.style.transform=`translateX(${l}px)`);});}pl(t){if(!this.mi)return;let e=this.max-this.min;if(e===0)return;this.mi.style.opacity=t===this.zero?"0":"1";let{width:o}=this.getBoundingClientRect(),l=100/e*(this.zero-this.min)*(o-this.es)/100;window.requestAnimationFrame(()=>{this.mi&&(this.mi.style.transform=`translateX(${l}px)`);});}os(){let e=this.al.value;if(!e)return;let{width:o}=e.getBoundingClientRect(),s=Math.ceil(o/2),n=Math.ceil(s/15)-2;if(this.sl===n)return;let l=document.createDocumentFragment(),c=document.createElement("div"),u=document.createElement("div");c.className="uc-minor-step",u.className="uc-border-step",l.appendChild(u);for(let d=0;d<n;d+=1)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());for(let d=0;d<n;d+=1)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());let p=document.createElement("div");p.className="uc-zero-dot",l.appendChild(p),this.mi=p,e.innerHTML="",e.appendChild(l),this.sl=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.zt.value;t?.removeEventListener("focus",this.cl),t?.removeEventListener("blur",this.ul),this.s?.disconnect(),this.s=void 0;}rs(t){Number.isFinite(t)&&(this.Kt=t,this.hasUpdated&&(this.dl(t),this.lr(t)));}dl(t){let e=this.zt.value;e&&(e.value=String(t));}ll(t){let e=t.currentTarget;if(!e)return null;let o=Number.parseInt(e.value,10);return Number.isFinite(o)?o:null}render(){return y`<div class="uc-steps" ${L(this.al)}></div><div class="uc-thumb" ${L(this.nl)}></div><input class="uc-input" type="range" ${L(this.zt)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.Kt)} ?disabled=${this.disabled} @input=${this.wd} @change=${this.Td} />`}};h([b({type:Boolean,reflect:true})],Xt.prototype,"disabled",2),h([b({type:Number})],Xt.prototype,"min",2),h([b({type:Number})],Xt.prototype,"max",2),h([b({type:Number,attribute:false})],Xt.prototype,"defaultValue",2),h([b({type:Number})],Xt.prototype,"zero",2),h([g()],Xt.prototype,"Kt",2);var _t="original",Nr=class extends C{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.ko=t=>{let{value:e}=t.detail;this.$["*faderEl"]?.set(e),this.state={...this.state,value:e};};}static{a(this,"EditorSlider");}setOperation(t,e){this.state={...this.state,operation:t,filter:e},this.Ed();let o=this.$["*faderEl"],s=this.state.originalUrl||this.$["*originalUrl"];o&&s&&o.activate({url:s,operation:this.state.operation,value:this.state.filter===_t?void 0:this.state.value,filter:this.state.filter===_t?void 0:this.state.filter,fromViewer:false});}Ed(){let t=this.state.operation,{range:e,zero:o}=At[t],[s,n]=e;this.state={...this.state,min:s,max:n,zero:o};let c=this.$["*editorTransformations"][t];if(t==="filter"){let p=Number(n),d=c;if(d){let{name:m,amount:f}=d;p=m===this.state.filter?f:n;}this.state={...this.state,value:p,defaultValue:p};return}let u=typeof c<"u"?c:o;this.state={...this.state,value:u,defaultValue:u};}apply(){let e={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===_t?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 y`<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.ko} ></uc-slider-ui>`}};h([g()],Nr.prototype,"state",2);function Ye(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)}}a(Ye,"parseFilterValue");var nt=class extends C{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}static{a(this,"EditorButtonControl");}get buttonClasses(){let t=this.active;return {"uc-active":t,"uc-not_active":!t}}hl(){let t=this.buttonClasses;for(let[e,o]of Object.entries(t))this.classList.toggle(e,o);}onClick(t){}connectedCallback(){super.connectedCallback(),this.hl();}updated(t){super.updated(t),t.has("active")&&this.hl();}render(){let t=this.onClick,e=this.title;return y`<button role="option" type="button" aria-label=${G(this.titleProp)} title=${G(this.titleProp)} @click=${t} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};h([g()],nt.prototype,"active",2),h([g()],nt.prototype,"title",2),h([g()],nt.prototype,"icon",2),h([g()],nt.prototype,"titleProp",2);var Br=12,zr=16,yd=a(r=>{let i=12,t=12;return r.width/r.height>=1?(i=Br,t=Math.round(Br*r.height/r.width)):(t=Br,i=Math.round(Br*r.width/r.height)),{width:i,height:t}},"getAdjustResolutions"),Cs=class extends nt{static{a(this,"EditorFreeformButtonControl");}initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this.xd(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}xd(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 y`<button role="option" type="button" class=${Ot(this.buttonClasses)} aria-label=${G(this.titleProp)} title=${G(this.titleProp)} @click=${i} ><div class="uc-title" ?hidden=${!t}>${t}</div><uc-icon name=${this.icon}></uc-icon></button>`}},Hr=class extends nt{constructor(){super(...arguments);this.Q=null;}static{a(this,"EditorAspectRatioButtonControl");}get aspectRatio(){return this.Q}set aspectRatio(t){if(this.Q===t)return;let e=this.Q;this.Q=t,this.requestUpdate("aspectRatio",e),t?this.ml(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.Q&&this.ml(this.Q),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.Q?.id||t?.width===this.Q?.width&&t?.height===this.Q?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.Q?.id&&(this.$["*currentAspectRatio"]=this.Q);}ml(t){if(!this.isConnected)return;let e=!!t.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",e);let o=a(()=>{let n=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=n,n},"resolveTitle"),s=a(()=>{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},"resolveTitleProp");o(),s(),e||this.requestUpdate();}Cd(){let t=this.Q;if(!t||t.hasFreeform)return y`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:o}=yd(t),s=(zr-e)/2,n=(zr-o)/2;return y`<uc-icon><svg viewBox="0 0 ${zr} ${zr}" aria-hidden="true" focusable="false" ><rect x=${s} y=${n} width=${e} height=${o} 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 y`<button role="option" type="button" class=${Ot(this.buttonClasses)} aria-label=${G(this.titleProp)} title=${G(this.titleProp)} @click=${t} >${this.Cd()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};h([b({attribute:false})],Hr.prototype,"aspectRatio",1);function bd(r){let i=r+90;return i=i>=360?0:i,i}a(bd,"nextAngle");function wd(r,i){if(r==="rotate")return bd(typeof i=="number"?i:0);if(r==="mirror"||r==="flip")return !i;throw new Error(`Unsupported operation: ${r}`)}a(wd,"nextValue");var jr=class extends nt{constructor(){super(...arguments);this.operation=void 0;}static{a(this,"EditorCropButtonControl");}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"],o=e.getValue(this.operation),s=wd(this.operation,o);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:s,prev:o}),e.setValue(this.operation,s);}};h([b({type:String})],jr.prototype,"operation",2);var ue=class extends nt{constructor(){super(...arguments);this.n="";this.m="";this.fi="";this.cr=0;this.a=null;this.Fe=false;this.isOriginal=false;this.fl=20;}static{a(this,"EditorFilterControl");}get filter(){return this.m}set filter(t){let e=t??"";if(this.m===e)return;let o=this.m;this.m=e,this.n="filter",this.isOriginal=e===_t,this.icon=this.isOriginal?"original":"slider",this.fl=this.isOriginal?40:20,this.requestUpdate("filter",o),this.isConnected&&this.gl(e);}onClick(t){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this.n,this.m),this.$["*showSlider"]=true);else {let e=this.$["*sliderEl"];e.setOperation(this.n,this.m),e.apply();}this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:Ye(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.m;}Sd(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.fl||32,o=window.devicePixelRatio,s=Math.ceil(o*e),n=o>=2?"lightest":"normal",l=100,c={...this.$["*editorTransformations"]};return c[this.n]=this.m!==_t?{name:this.m,amount:l}:void 0,q(this.fi,it(Wi,te(c),`quality/${n}`,`scale_crop/${s}x${s}/center`,`@clib/${Pt}/${Rt}/uc-cloud-image-editor/`))}async Qe(t,e){t[0]?.isIntersecting?await this.ss(e):this.b?.();}initCallback(){super.initCallback(),this.s=new window.IntersectionObserver(this.Qe.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this.fi=t??"",this.sub("*originalUrl",e=>{this.fi=e??"",!this.isOriginal&&this.fi&&this.isConnected&&!this.a&&(this.s?.observe(this),this.de());}),this.isOriginal||(this.s?.observe(this),this.de()),this.m&&this.gl(this.m),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.m);}),this.sub("*networkProblems",async e=>{e||(this.a?await this.ss():this.de());});}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.b?.(),this.ur();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.s?.unobserve(this):(this.s?.observe(this),this.de()));}gl(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async ss(t){if(!this.isConnected){t?.unobserve(this),this.b?.(),this.b=void 0;return}if(!this.fi){!this.De&&!this.Gt&&this.de();return}let e=++this.cr,o="";try{o=await this.proxyUrl(this.Sd());}catch(l){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:l});return}this.Fe=false,this.b?.();let{promise:s,cancel:n}=Ae(o);this.b=()=>{n(),this.cr===e&&(this.b=void 0);};try{if(await s,this.cr!==e||!this.isConnected)return;this.a=o,this.Fe=!0,this.ur(),(t??this.s)?.unobserve(this);}catch(l){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:l}),this.de();}finally{this.cr===e&&(this.b=void 0);}}de(){if(!this.isConnected||this.a||this.Fe||this.isOriginal||this.$["*networkProblems"]){this.ur();return}this.Gt&&cancelAnimationFrame(this.Gt),this.Gt=requestAnimationFrame(()=>{if(this.Gt=void 0,!this.isConnected||this.a||this.Fe||this.isOriginal){this.ur();return}let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,o=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;if(e&&t.bottom>0&&t.right>0&&t.top<s&&t.left<o){this.ss();return}this.De=window.setTimeout(()=>{this.De=void 0,this.de();},500);});}ur(){this.Gt&&(cancelAnimationFrame(this.Gt),this.Gt=void 0),this.De&&(window.clearTimeout(this.De),this.De=void 0);}get Ad(){return !!(this.Fe&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.Ad?"1":"0"};this.a&&(e.backgroundImage=`url(${this.a})`);let o={opacity:this.active||this.isOriginal?"1":"0"};return y`<button role="option" type="button" class=${Ot(this.buttonClasses)} aria-label=${G(this.titleProp)} title=${G(this.titleProp)} @click=${t} ><div class="uc-preview" ?data-loaded=${this.Fe} style=${ke(e)}></div><uc-icon class=${Ot({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${ke(o)} ></uc-icon></button>`}};h([g()],ue.prototype,"a",2),h([g()],ue.prototype,"Fe",2),h([g()],ue.prototype,"isOriginal",2),h([g()],ue.prototype,"fl",2),h([b({type:String})],ue.prototype,"filter",1);var Kr=class extends nt{constructor(){super(...arguments);this.n="";}static{a(this,"EditorOperationControl");}get operation(){return this.n}set operation(t){let e=t??"";if(this.n===e)return;let o=this.n;this.n=e,this.requestUpdate("operation",o),this.isConnected&&e&&this.vl(e);}vl(t){this.icon=t;let e=a(()=>{let s=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=s,s},"resolveTitleProp"),o=a(()=>{let s=this.l10n(t);return this.title=s,s},"resolveTitle");e(),o();}initCallback(){super.initCallback(),this.n&&this.vl(this.n),this.sub("*editorTransformations",t=>{if(!this.n)return;let{zero:e}=At[this.n],o=t[this.n],s=typeof o<"u"?o!==e:false;this.active=s;});}onClick(t){this.$["*sliderEl"]?.setOperation(this.n),this.$["*showSlider"]=true,this.$["*currentOperation"]=this.n,this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:Ye(this.$["*operationTooltip"])});}};h([b({type:String})],Kr.prototype,"operation",1);var Td=1,qa=a(()=>{},"noopScrollListener"),Gr=class extends C{constructor(){super(...arguments);this.hiddenScrollbar=false;this.yl=t=>{t.preventDefault();let{deltaY:e,deltaX:o}=t;if(Math.abs(o)>Td){this.scrollLeft+=o;return}this.scrollLeft+=e;};}static{a(this,"EditorScroller");}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.yl,{passive:false}),this.addEventListener("scroll",qa,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.yl),this.removeEventListener("scroll",qa),super.disconnectedCallback();}};h([b({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],Gr.prototype,"hiddenScrollbar",2);var gt=class extends C{constructor(){super(...arguments);this.gi=false;this.showMainToolbar=true;this.showSubToolbar=false;this.bl=true;this.tabList=[...rt];this.activeTab=N.CROP;this.dr=true;this.ns=false;this.wl=null;this.Tl=0;this.El=0;this.pr=O();this.xl=O();this.tabToggleRefs={[N.CROP]:O(),[N.TUNING]:O(),[N.FILTERS]:O()};this.Cl=()=>{this.pe();};this.vi=[];this.hr=D(t=>{this.gi=t;},500);this.mr=D(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],o="",s=false;if(this.$["*tabId"]===N.FILTERS)if(s=true,this.$["*currentFilter"]&&t?.filter?.name===this.$["*currentFilter"]){let n=t?.filter?.amount||100;o=`${this.$["*currentFilter"]} ${n}`;}else o=this.l10n(_t);else if(this.showSubToolbar&&this.$["*tabId"]===N.TUNING&&e){s=true;let n=t?.[e]||At[e].zero;o=`${this.l10n(e)} ${n}`;}s&&(this.$["*operationTooltip"]=o),this.ns=s;},0);this.kd={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.Md={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.Od={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.Id={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":_t,"*currentOperation":null,"*operationTooltip":null};this.Pt=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.b?.();let e=this.$["*on.cancel"];e?.();};this.us=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.Bd=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:Ye(this.$["*operationTooltip"])}),this.pr.value?.apply(),this.Sl();};this.zd=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.pr.value?.cancel(),this.Sl();};this.Hd=t=>{let o=t.currentTarget?.getAttribute("data-id");o&&(this.telemetryManager.sendEventCloudImageEditor(t,o),this.as(o,{fromViewer:false}));};}static{a(this,"EditorToolbar");}Sl(){this.$["*showSlider"]=false,this.$["*tabId"]===N.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===N.TUNING&&(this.ns=false);}as(t,{fromViewer:e=false,force:o=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.Al(t,{fromViewer:e,force:o});}Al(t,{fromViewer:e,force:o=false}){if(!o&&this.activeTab===t){this.pe();return}this.activeTab=t;let s=this.$["*faderEl"],n=this.$["*cropperEl"];t===N.CROP?(s?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:e})):(s?.activate({url:this.$["*originalUrl"],fromViewer:e}),n?.deactivate());for(let l of rt){let c=l===t,p=this.tabToggleRefs[l]?.value;p&&(p.active=c),c&&this.pe();}}pe(){let e=this.tabToggleRefs[this.activeTab]?.value,o=this.xl.value;if(!e||!o)return;let s=e.offsetLeft,n=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.Tl!==s||this.El!==n)&&(this.Tl=s,this.El=n,o.style.transform=`translateX(${s}px)`,o.style.width=`${n}px`);}get ls(){return this.vi.length>=3}Ld(t){switch(t){case N.CROP:return this.Ud();case N.FILTERS:return this.Pd();case N.TUNING:return this.Rd();default:return []}}Ud(){let t=[];if(this.ls)t.push(()=>this.$d());else for(let e of this.vi)t.push(()=>this.kl(e));for(let e of pn)t.push(()=>this.Dd(e));return this.cs(t)}Pd(){let e=[_t,...dn].map(o=>()=>this.Fd(o));return this.cs(e)}Rd(){let t=un.map(e=>()=>this.Nd(e));return this.cs(t)}cs(t){return t.length?t.map(o=>o()):[]}$d(){return y`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}kl(t){return y`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}Dd(t){return y`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}Fd(t){return y`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}Nd(t){return y`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}Vd(){return this.ls?this.vi.map(t=>this.kl(t)):[]}async _d(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(Xe(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.b?.();let{cancel:o}=Ti([e]);this.b=()=>{o(),this.b=void 0;};}}initCallback(){super.initCallback();let t=this.$["*cropPresetList"]??[];this.vi=[...t],this.sub("*cropPresetList",e=>{this.vi=[...e??[]];}),this.sub("*imageSize",e=>{e&&setTimeout(()=>{this.as(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let o=e?.filter?.name;this.$["*currentFilter"]!==o&&(this.$["*currentFilter"]=o??"");}),this.sub("*currentFilter",()=>{this.mr();}),this.sub("*currentOperation",()=>{this.mr();}),this.sub("*tabId",e=>{this.Al(e,{fromViewer:false,force:true}),this.mr();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this._d(),this.$["*faderEl"]?.setTransformations(e);}),this.sub("*loadingOperations",e=>{let o=false;for(let[,s]of e.entries()){if(o)break;for(let[,n]of s.entries())if(n){o=true;break}}this.hr(o);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.dr=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.dr=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.bl=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[o]=e;o&&this.as(o,{fromViewer:false});return}this.pe();}),this.sub("*operationTooltip",e=>{this.wl=e;}),this.mr();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.Cl);}firstUpdated(t){super.firstUpdated(t),this.fr(),this.pe();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.pe()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.fr();}disconnectedCallback(){window.removeEventListener("resize",this.Cl),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}fr(){let t=this.pr.value;t&&(this.$["*sliderEl"]=t);}jd(t){let e=this.tabList.includes(t),o=this.activeTab===t,s=this.tabList.indexOf(t),n=s>=0?ke({gridColumn:`${s+1}`}):R;return y`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.Od}><uc-btn-ui theme="tab" data-id=${t} icon=${t} role="tab" aria-controls=${`tab_${t}`} aria-selected=${o?"true":"false"} title-prop=${`a11y-editor-tab-${t}`} .active=${o} style=${n} @click=${this.Hd} ${L(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Kd(t){let e=this.Ld(t);return y`<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:R}</div></div></uc-editor-scroller></div>`}render(){let t=["uc-info-tooltip",this.ns?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.ls;return y`<uc-line-loader-ui .active=${this.gi}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.wl??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.kd} ><div class="uc-tab-content-row">${rt.map(o=>xi(this.activeTab===o,()=>this.Kd(o)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.bl} .styles=${this.Id} @initial-render=${()=>this.pe()} ><div class="uc-tab-toggles_indicator" ${L(this.xl)} ></div>${rt.map(o=>this.jd(o))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.Pt} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.us}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.Md}><div class="uc-slider" ?hidden=${!this.dr}><uc-editor-slider ${L(this.pr)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.dr||!e}>${e?y`<div class="uc-list-aspect-ratio">${this.Vd()}</div>`:R}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.zd} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.Bd} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};h([g()],gt.prototype,"gi",2),h([g()],gt.prototype,"showMainToolbar",2),h([g()],gt.prototype,"showSubToolbar",2),h([g()],gt.prototype,"bl",2),h([g()],gt.prototype,"tabList",2),h([g()],gt.prototype,"activeTab",2),h([g()],gt.prototype,"dr",2),h([g()],gt.prototype,"ns",2),h([g()],gt.prototype,"wl",2),h([g()],gt.prototype,"vi",2);var Wa=Ht([...rt]),at=class extends C{constructor(){super(...arguments);this.ctxOwner=true;this.Gd="";this.ue=kt;this.qd="";this.gi=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=Wa;this.Ml=false;this.Ft=false;this.ds=null;this.hr=D(t=>{this.gi=t;},300);this.gr=O();this.Ol=O();this.Il=O();this.Ll=O();this.Ul=()=>{this.hr(false),this.ue!==kt&&(this.$["*networkProblems"]=false);};this.Pl=()=>{this.hr(false),this.$["*networkProblems"]=true;};this.Wd=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...Ha(this)};}static{a(this,"CloudImageEditorBlock");}static{this.styleAttrs=["uc-cloud-image-editor"];}Zd(){this.Ft||this.ds||(this.ds=this.updateComplete.then(()=>{this.ds=null,this.Ft=true;}));}initCallback(){super.initCallback(),this.Rl(),this.$l();}fr(){let t=this.Il.value;t&&(this.$["*faderEl"]=t);let e=this.Ol.value;e&&(this.$["*cropperEl"]=e);let o=this.Ll.value;o&&(this.$["*imgContainerEl"]=o);let s=this.gr.value;s&&(this.$["*imgEl"]=s);}Xd(){let t=this.gr.value;t&&(t.addEventListener("load",this.Ul),t.addEventListener("error",this.Pl));}Yd(){let t=this.gr.value;t&&(t.removeEventListener("load",this.Ul),t.removeEventListener("error",this.Pl));}get Qd(){let t=this.$["*tabId"];return ft("uc-image",{"uc-image_hidden_to_cropper":t===N.CROP,"uc-image_hidden_effects":t!==N.CROP})}Dl(){return new Promise((e,o)=>{let s=window.setTimeout(()=>{o(new Error("[cloud-image-editor] timeout waiting for non-zero container size"));},3e3),n=new ResizeObserver(l=>{let[c]=l;c&&c.contentRect.width>0&&c.contentRect.height>0&&(window.clearTimeout(s),n.disconnect(),window.setTimeout(()=>e(),0));});n.observe(this);})}firstUpdated(t){super.firstUpdated(t),this.fr(),this.Xd(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),o=t.has("uuid")||t.has("cdnUrl");e&&!o&&this.updateImage();}disconnectedCallback(){this.Yd(),super.disconnectedCallback();}render(){let t=this.qd??"",e=this.Gd??"",o=this.ue||kt,s=this.gi,n=this.Ml;return y` ${pr(ja)}<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.Wd}></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" ${L(this.Ll)}><img src=${o} class=${this.Qd} ${L(this.gr)} />${xi(this.Ft,()=>y`<uc-editor-image-cropper ${L(this.Ol)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${L(this.Il)}></uc-editor-image-fader></div><div class="uc-info_pan">${e}</div></div><div class="uc-toolbar"><uc-line-loader-ui .active=${s}></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor">${xi(this.Ft,()=>y`<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.Rl(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.$l();}Rl(){let t=this.tabs||Wa;this.$["*tabList"]=za(t);}$l(){let t=xr(this.cropPreset??""),e=null;if(this.cdnUrl){let o=wo(this.cdnUrl),s=To(o);if(Array.isArray(s?.crop?.dimensions)){let[n,l]=s.crop.dimensions;e=ca(n,l,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){if(await this.Dl(),this.cdnUrl){let t=this.cdnUrl,e=qi(t),o=Jt(t,e);if(o===this.$["*originalUrl"])return;this.$["*originalUrl"]=o;let s=wo(t),n=To(s);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=Jt(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"]===N.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(q(t,it("json"))),o=await fetch(e).then(l=>l.json()),{width:s,height:n}=o;this.$["*imageSize"]={width:s,height:n},this.$["*tabId"]===N.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.Zd();}}async initEditor(){try{await this.Dl();}catch(t){this.isConnected&&console.error(t.message);return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.Ml=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],o=it(te(t),"preview"),s=q(e,o),n={originalUrl:e,cdnUrlModifiers:o,cdnUrl:s,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};h([g()],at.prototype,"Gd",2),h([g()],at.prototype,"ue",2),h([g()],at.prototype,"qd",2),h([g()],at.prototype,"gi",2),h([b({type:String,reflect:true})],at.prototype,"uuid",2),h([b({type:String,attribute:"cdn-url",reflect:true})],at.prototype,"cdnUrl",2),h([b({type:String,attribute:"crop-preset",reflect:true})],at.prototype,"cropPreset",2),h([b({type:String,reflect:true})],at.prototype,"tabs",2),h([g()],at.prototype,"Ml",2),h([g()],at.prototype,"Ft",2);var Ss=class extends at{static{a(this,"CloudImageEditor");}static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var qr=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=E.activities.CLOUD_IMG_EDIT;this.J=null;}static{a(this,"CloudImageEditorActivity");}get activityParams(){let t=super.activityParams;if("internalId"in t)return t;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:a(()=>this.Jd(),"onActivate"),onDeactivate:a(()=>this.tp(),"onDeactivate")}),this.subConfigValue("cropPreset",t=>{this.J&&this.J.cropPreset!==t&&(this.J={...this.J,cropPreset:t});}),this.subConfigValue("cloudImageEditorTabs",t=>{this.J&&this.J.tabs!==t&&(this.J={...this.J,tabs:t});});}us(t){if(!this.Mt)return;this.debugPrint('editor event "apply"',t.detail);let e=t.detail;this.Mt.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.modalManager?.close(E.activities.CLOUD_IMG_EDIT),this.historyBack();}Pt(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close(E.activities.CLOUD_IMG_EDIT),this.historyBack();}handleChange(t){this.debugPrint('editor event "change"',t.detail);}Jd(){let{internalId:t}=this.activityParams,e=this.uploadCollection.read(t);if(!e)throw new Error(`Entry with internalId "${t}" not found`);this.Mt=e;let o=this.Mt.getValue("cdnUrl");if(!o)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);this.J=this.ep(o);}tp(){this.Mt=void 0,this.J=null;}render(){if(!this.J)return R;let{cdnUrl:t,cropPreset:e,tabs:o}=this.J;return y`<uc-cloud-image-editor cdn-url=${t} crop-preset=${G(e)} tabs=${G(o)} @apply=${this.us} @cancel=${this.Pt} @change=${this.handleChange} ></uc-cloud-image-editor>`}ep(t){return {cdnUrl:t,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}};h([g()],qr.prototype,"J",2);var Ed=[{test:a(r=>!!r.accept&&!!r.imgOnly,"test"),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:a(r=>r.enableVideoRecording!==null,"test"),message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:a(r=>r.defaultCameraMode!==null,"test"),message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],Za=D(r=>{for(let{test:i,message:t}of Ed)i(r)&&wr(t);},0);var Xa=a((r,i)=>{let t=new URL(i);return t.hostname=`${r}.${t.hostname}`,t.toString().replace(/\/$/,"")},"o"),xd="0123456789abcdefghijklmnopqrstuvwxyz",Ya=a(r=>{if(r<=0n)return "0";let i="";for(;r>0n;){let t=r%36n;i=xd[Number(t)]+i,r=r/36n;}return i},"a"),As=a((r,i)=>{try{let t=new URL(r),e=new URL(i);return t.hostname.endsWith(e.hostname)}catch{return false}},"c");var Cd=a(async r=>{let i=new TextEncoder().encode(r),t=await window.crypto.subtle.digest("SHA-256",i),e=Array.from(new Uint8Array(t)).map(o=>o.toString(16).padStart(2,"0")).join("");return BigInt(`0x${e}`)},"c"),Sd=10,Ad=a(async r=>{let i=await Cd(r);return Ya(i).slice(0,Sd)},"d"),Qa=a(async(r,i)=>{let t=await Ad(r);return Xa(t,i)},"f");var Ja=a(r=>r instanceof Promise||!!(r&&typeof r=="object"&&"then"in r&&typeof r.then=="function"),"isPromiseLike");var ks=a(r=>r,"defineComputedProperty"),kd=[ks({key:"cameraModes",deps:["enableVideoRecording"],fn:a(({cameraModes:r,enableVideoRecording:i})=>{if(i===null)return r;let t=ct(r);return i&&!t.includes("video")?t=t.concat("video"):i||(t=t.filter(e=>e!=="video")),Ht(t)},"fn")}),ks({key:"cameraModes",deps:["defaultCameraMode"],fn:a(({cameraModes:r,defaultCameraMode:i})=>{if(i===null)return r;let t=ct(r);return t=t.sort((e,o)=>e===i?-1:o===i?1:0),Ht(t)},"fn")}),ks({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:a(({pubkey:r,cdnCname:i,cdnCnamePrefixed:t})=>r&&(i===ni||As(i,t))?Qa(r,t):i,"fn")})],tl=a(({key:r,setValue:i,getValue:t,computationControllers:e})=>{for(let o of kd)if(o.deps.includes(r)){let s={[o.key]:t(o.key)};for(let c of o.deps)s[c]=t(c);let n=new AbortController;e.get(o.key)?.abort(),e.set(o.key,n);let l;try{l=o.fn(s,{signal:n.signal});}catch(c){e.get(o.key)===n&&e.delete(o.key),console.error(`Failed to compute value for "${o.key}"`,c);return}Ja(l)?l.then(c=>{n.signal.aborted||i(o.key,c);}).catch(c=>{n.signal.aborted||console.error(`Failed to compute value for "${o.key}"`,c);}).finally(()=>{e.get(o.key)===n&&e.delete(o.key);}):i(o.key,l);}},"computeProperty");var V=a(r=>String(r),"asString"),J=a(r=>{let i=Number(r);if(Number.isNaN(i))throw new Error(`Invalid number: "${r}"`);return i},"asNumber"),_=a(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}"`)},"asBoolean"),el=a(r=>r==="auto"?r:_(r),"asStore"),il=a(r=>{let i=V(r);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},"asCameraCapture"),rl=a(r=>{let i=V(r);if(!Object.values(k).includes(i))throw new Error(`Invalid value: "${i}"`);return i},"asCameraMode"),ol=a(r=>{let i=V(r),t=ct(i);if(t.some(e=>!Object.values(k).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},"asCameraModes"),sl=a(r=>{let i=V(r);if(i==="local"||i==="global")return i;if(_(r)===false)return false;throw new Error(`Invalid value: "${i}"`)},"asPasteScope"),nl=a(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.")},"asMetadata"),Wr=a(r=>{if(typeof r=="object")return r;throw new Error("Invalid value. Must be an object.")},"asObject"),Zr=a(r=>{if(typeof r=="function")return r;throw new Error("Invalid value. Must be a function.")},"asFunction"),Ms=a(r=>{if(Array.isArray(r))return r;throw new Error("Must be an array.")},"asArray"),al=a(r=>{let i=V(r);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)},"asFilesViewMode");var Md={pubkey:V,multiple:_,multipleMin:J,multipleMax:J,confirmUpload:_,imgOnly:_,accept:V,externalSourcesPreferredTypes:V,externalSourcesEmbedCss:V,store:el,cameraMirror:_,cameraCapture:il,sourceList:V,topLevelOrigin:V,maxLocalFileSizeBytes:J,thumbSize:J,showEmptyList:_,useLocalImageEditor:_,useCloudImageEditor:_,cloudImageEditorTabs:V,removeCopyright:_,cropPreset:V,imageShrink:V,modalScrollLock:_,modalBackdropStrokes:_,sourceListWrap:_,remoteTabSessionKey:V,cdnCname:V,cdnCnamePrefixed:V,baseUrl:V,socialBaseUrl:V,secureSignature:V,secureExpire:V,secureDeliveryProxy:V,retryThrottledRequestMaxTimes:J,retryNetworkErrorMaxTimes:J,multipartMinFileSize:J,multipartChunkSize:J,maxConcurrentRequests:J,multipartMaxConcurrentRequests:J,multipartMaxAttempts:J,checkForUrlDuplicates:_,saveUrlForRecurrentUploads:_,groupOutput:_,userAgentIntegration:V,debug:_,localeName:V,metadata:nl,secureUploadsExpireThreshold:J,localeDefinitionOverride:a(r=>Wr(r),"localeDefinitionOverride"),secureUploadsSignatureResolver:a(r=>Zr(r),"secureUploadsSignatureResolver"),secureDeliveryProxyUrlResolver:a(r=>Zr(r),"secureDeliveryProxyUrlResolver"),iconHrefResolver:a(r=>Zr(r),"iconHrefResolver"),fileValidators:Ms,collectionValidators:Ms,validationTimeout:J,validationConcurrency:J,cameraModes:ol,defaultCameraMode:rl,enableAudioRecording:_,enableVideoRecording:_,mediaRecorderOptions:Wr,maxVideoRecordingDuration:J,filesViewMode:al,gridShowFileNames:_,cloudImageEditorAutoOpen:_,cloudImageEditorMaskHref:V,testMode:_,qualityInsights:_,pasteScope:sl,smartBtn:Wr},ll=a((r,i)=>{if(!(typeof i>"u"||i===null))try{return Md[r](i)}catch(t){return console.error(`Invalid value for config key "${r}".`,t),Q[r]}},"normalizeConfigValue");var Xr=[...new Set(["debug",...Object.keys(Q)])],Od=["metadata","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions","smartBtn"],dl=a(r=>Od.includes(r),"isComplexKey"),Si=Xr.filter(r=>!dl(r)),cl={...Object.fromEntries(Si.map(r=>[ai(r),r])),...Object.fromEntries(Si.map(r=>[r.toLowerCase(),r]))},Id={...Object.fromEntries(Si.map(r=>[ai(r),U(r)])),...Object.fromEntries(Si.map(r=>[r.toLowerCase(),U(r)]))},ul=a(r=>`__${r}`,"getLocalPropName"),Yr=class extends C{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(Q).map(([t,e])=>[U(t),e]))};this.ip=new Map;}static{a(this,"Config");}rp(t,e){if(!dl(t)){let o=[...new Set([ai(t),t.toLowerCase()])];for(let s of o)typeof e>"u"||e===null?this.removeAttribute(s):this.getAttribute(s)!==e.toString()&&this.setAttribute(s,e.toString());}}op(t,e){this.$[U(t)]!==e&&(typeof e>"u"||e===null?this.$[U(t)]=Q[t]:this.$[U(t)]=e);}vr(t,e){let o=this,s=ll(t,e),n=ul(t);o[n]!==s&&(this.sp(t,o[n],s),o[n]=s,this.rp(t,s),this.op(t,s),this.debugPrint(`"${t}"`,s),Za(this.cfg));}Fl(t){let e=this,o=ul(t);return e[o]??this.$[U(t)]}sp(t,e,o){this.cfg.debug&&o!==e&&typeof o=="object"&&typeof e=="object"&&JSON.stringify(o)===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:`,o));}initCallback(){super.initCallback();let t=this;for(let e of Si)this.sub(U(e),o=>{this.vr(e,o);},false);for(let e of Xr){let o=t[e]??this.$[U(e)];o!==Q[e]&&this.vr(e,o);let s=Object.getOwnPropertyDescriptor(this,e);(!s||!s.set||!s.get)&&Object.defineProperty(this,e,{set:a(n=>{this.vr(e,n);},"set"),get:a(()=>this.Fl(e),"get")});}for(let e of Xr)this.sub(U(e),()=>{tl({key:e,setValue:this.vr.bind(this),getValue:this.Fl.bind(this),computationControllers:this.ip});});}attributeChangedCallback(t,e,o){if(super.attributeChangedCallback(t,e,o),e===o)return;let s=this,n=cl[t];n&&(s[n]=o),Id[t]&&(this[t]=o);}static get observedAttributes(){return [...super.observedAttributes,...Object.keys(cl)]}};for(let r of Xr)Yr.prototype[r]=void 0;var pl=a(()=>{let r=globalThis.top??globalThis.parent??globalThis.self;try{return r.location.origin}catch(i){return console.warn("Unable to access top-level window location:",i),globalThis.location.origin}},"getTopLevelOrigin");var Ld=a(r=>r.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),"escapeRegExp"),hl=a((r,i="i")=>{let t=r.split("*").map(Ld);return new RegExp(`^${t.join(".+")}$`,i)},"wildcardRegexp");var Ud=["--uc-font-family","--uc-font-size","--uc-line-height","--uc-button-size","--uc-preview-size","--uc-input-size","--uc-padding","--uc-radius","--uc-transition","--uc-background","--uc-foreground","--uc-primary","--uc-primary-hover","--uc-primary-transparent","--uc-primary-foreground","--uc-secondary","--uc-secondary-hover","--uc-secondary-foreground","--uc-muted","--uc-muted-foreground","--uc-destructive","--uc-destructive-foreground","--uc-border"],Pd=a((r,i)=>window.getComputedStyle(r).getPropertyValue(i).trim(),"getCssValue"),ml=a(r=>{let i={};for(let t of Ud){let e=Pd(r,t);e&&(i[t]=e);}return i},"buildThemeDefinition");var Rd=["selected-files-change","toolbar-state-change"],$d=a(r=>{if(!r||typeof r!="object"||!("type"in r))return false;let i=r.type;return !(typeof i!="string"||!Rd.includes(i))},"isWhitelistedMessage"),Qr=class{constructor(i,t){this.yr=new Map;this.Vl=i=>{if(i.source!==this.ps)return;let t=i.data;if(!$d(t))return;let e=this.yr.get(t.type);if(e)for(let o of e)o(t);};this.ps=i,this.Nl=t,window.addEventListener("message",this.Vl);}static{a(this,"MessageBridge");}on(i,t){let e=this.yr.get(i)??new Set;this.yr.has(i)||this.yr.set(i,e),e.add(t);}send(i){let t=this.Nl();this.ps.postMessage(i,t);}destroy(){window.removeEventListener("message",this.Vl);}};function fl(r){let i=[];for(let[t,e]of Object.entries(r))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}a(fl,"queryString");var Dd={[Ft.GDRIVE]:"ngdrive"},Et=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.activityType=E.activities.EXTERNAL;this.Ne=O();this.br=null;this.hs=[];this.ms=false;this.fs=false;this.gs=false;this.vs=false;this.wr=false;this.ys=false;this.bs="uc-hidden";this._l=true;this.So=()=>{for(let t of this.hs){let e=this.ap(t),{filename:o}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:o,source:s});}this.$["*currentActivity"]=E.activities.UPLOAD_LIST,this.modalManager?.open(E.activities.UPLOAD_LIST);};this.Pt=()=>{this.historyBack();};this.hp=()=>{this.vt?.send({type:"select-all"});};this.mp=()=>{this.vt?.send({type:"deselect-all"});};}static{a(this,"ExternalSource");}get np(){if(!this.br)return "";let{selectedCount:t,total:e}=this.br;return this.l10n("selected-count",{count:t,total:e})}get activityParams(){let t=super.activityParams;if("externalSourceType"in t)return t;throw new Error("External Source activity params not found")}initCallback(){super.initCallback(),this.registerActivity(this.activityType,{onActivate:a(()=>{let{externalSourceType:t}=this.activityParams;if(!t){this.modalManager?.close(this.$["*currentActivity"]),this.$["*currentActivity"]=null,console.error(`Param "externalSourceType" is required for activity "${this.activityType}"`);return}this.Bl();},"onActivate")}),this.sub("*currentActivityParams",()=>{setTimeout(()=>{!this.isActivityActive||!this.isConnected||(this.Ts(),this.Bl());});}),this.sub("*currentActivity",t=>{t!==this.activityType&&this.Ts();}),this.subConfigValue("multiple",t=>{this.wr=t;}),this.subConfigValue("localeName",()=>{this.zl();}),this.subConfigValue("externalSourcesEmbedCss",t=>{this.Hl(t);});}ap(t){if(t.alternatives){let e=j(this.cfg.externalSourcesPreferredTypes);for(let o of e){let s=hl(o);for(let[n,l]of Object.entries(t.alternatives))if(s.test(n))return l}}return t.url}lp(t){this._l=t.isVisible;}async cp(t){if(this.cfg.multiple!==t.isMultipleMode){console.error("Multiple mode mismatch");return}this.up(t.selectedCount,t.total),this.bs=t.isReady?"":"uc-hidden",this.ms=t.isReady,this.fs=t.isReady&&t.selectedFiles.length>0,this.wr=t.isMultipleMode&&t.total>0,this.gs=t.selectedCount<t.total,this.vs=t.selectedCount===t.total,this.hs=t.selectedFiles??[],this.ys=t.total>0;}jl(){this.Hl(this.cfg.externalSourcesEmbedCss),this.dp(),this.zl();}dp(){this.vt?.send({type:"set-theme-definition",theme:ml(this)});}Hl(t){this.vt?.send({type:"set-embed-css",css:t});}zl(){this.vt?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}pp(){let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:o,multiple:s}=this.cfg,{externalSourceType:n}=this.activityParams,l=Dd[n]??n,u={lang:this.l10n("social-source-lang")?.split("-")?.[0]||"en",public_key:t,images_only:"false",session_key:e,wait_for_theme:true,multiple:s.toString(),origin:this.cfg.topLevelOrigin||pl(),debug:this.cfg.debug},p=new URL(`/window4/${l}`,o);return p.search=fl(u),p.toString()}up(t,e){this.br={selectedCount:t,total:e};}Bl(){let t=document.createElement("iframe");t.src=this.pp(),t.marginHeight=0,t.marginWidth=0,t.frameBorder="0",t.allowTransparency=true,t.addEventListener("load",this.jl.bind(this)),t.addEventListener("load",this.jl.bind(this)),this.Ne.value&&(this.Ne.value.innerHTML="",this.Ne.value.appendChild(t)),t.contentWindow&&(this.vt?.destroy(),this.vt=new Qr(t.contentWindow,()=>this.cfg.socialBaseUrl),this.vt.on("selected-files-change",this.cp.bind(this)),this.vt.on("toolbar-state-change",this.lp.bind(this)),this.Kl());}Ts(){this.vt?.destroy(),this.vt=void 0,this.Ne.value&&(this.Ne.value.innerHTML=""),this.Kl();}Kl(){this.hs=[],this.ms=false,this.fs=false,this.gs=false,this.vs=false,this.wr=false,this.ys=false,this.bs="uc-hidden",this.br=null;}disconnectedCallback(){super.disconnectedCallback(),this.Ts();}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*historyBack"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ${L(this.Ne)} class="uc-iframe-wrapper"></div><div class="uc-toolbar" ?hidden=${!this._l}><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Pt}>${this.l10n("cancel")}</button><div class="uc-selection-status-box" ?hidden=${!this.wr}><span>${this.np}</span><button type="button" @click=${this.hp} ?hidden=${!this.gs}>${this.l10n("select-all")}</button><button type="button" @click=${this.mp} ?hidden=${!this.vs}>${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.So} ?disabled=${!this.fs} ?hidden=${!this.ys} ><uc-spinner ?hidden=${this.ms}></uc-spinner><span class=${this.bs}>${this.l10n("done")}</span></button></div></div>`}};h([g()],Et.prototype,"hs",2),h([g()],Et.prototype,"ms",2),h([g()],Et.prototype,"fs",2),h([g()],Et.prototype,"gs",2),h([g()],Et.prototype,"vs",2),h([g()],Et.prototype,"wr",2),h([g()],Et.prototype,"ys",2),h([g()],Et.prototype,"bs",2),h([g()],Et.prototype,"_l",2);var Ai=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.yi="upload-file";this.Es=()=>{this.api.initFlow();};}static{a(this,"SimpleBtn");}static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"];}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.yi=t?"upload-files":"upload-file";});}render(){return y`<uc-drop-area .disabled=${!this.dropzone}><button type="button" @click=${this.Es}><uc-icon name="upload"></uc-icon><span>${this.l10n(this.yi)}</span>${this.yield("")}<div class="uc-visual-drop-area">${this.l10n("drop-files-here")}</div></button></uc-drop-area>`}};h([b({attribute:"dropzone",type:Boolean})],Ai.prototype,"dropzone",2),h([g()],Ai.prototype,"yi",2);var Jr=class extends C{constructor(){super(...arguments);this.Gl=et.generateFastUid();this.fp=t=>{t.currentTarget.hidePopover();};}static{a(this,"Dropdown");}render(){return y`<button class="uc-mini-btn uc-dropdown-btn" popovertarget=${this.Gl} popovertargetaction="toggle">${this.yield("dd-header-button")}</button><div id=${this.Gl} class="uc-dropdown-content" popover="auto" @click=${this.fp}>${this.yield("dd-content")}</div>`}};h([g()],Jr.prototype,"Gl",2);var Fd="local",Vd=3,_d=400,Nd=a((r,i)=>r==="allwrap"||r==="auto"&&i>Vd,"shouldShowDropdown"),Bd=a(r=>({"uc-idle":r==="idle","uc-progress":r==="progress","uc-success":r==="success","uc-failed":r==="failed"}),"classesBasedOnStatus"),xt=class extends ${constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.Et=[];this.W="idle";this.ql=false;this.Mt=null;this.Tr={success:0,failed:0,progress:0};this.bi=0;this.Er=false;this.wi=null;this.xs=true;this.Y=le(()=>{this.isConnected&&this.gp();},300);this.bp=t=>{if(t.stopPropagation(),this.W==="progress"){this.uploadCollection.clearAll();return}let{failedEntries:e,successEntries:o}=this.api.getOutputCollectionState();this.yp(this.W==="failed"?e:o);};this.Es=()=>{this.api.initFlow();};}static{a(this,"SmartBtn");}static{this.styleAttrs=[...super.styleAttrs,"uc-smart-btn"];}get isIdle(){return this.W==="idle"}get buttonText(){if(this.W==="progress"){let t=this.l10n("header-uploading",{count:this.Tr.progress});return this.bi>0?`${this.bi}%`:t}return this.W==="failed"?this.l10n("header-failed",{count:this.Tr.failed}):this.W==="success"?this.l10n("header-succeed",{count:this.Tr.success}):this.l10n(this.ql?"upload-files":"upload-file")}gp(){let t=this.api.getOutputCollectionState(),e={totalCount:t.totalCount,failed:t.failedCount,progress:t.uploadingCount,success:t.successCount};this.Mt=e.totalCount===1&&e.failed===0&&e.success===1?t.successEntries[0]:null;let o=this.W;e.failed>0?this.W="failed":e.progress>0?this.W="progress":e.success>0?this.W="success":this.W="idle",this.W==="progress"?(this.Wl(),this.bi=Math.round(t.progress)):o==="progress"&&this.vp(),this.Tr=e;}Wl(){this.wi&&(clearTimeout(this.wi),this.wi=null),this.Er=false;}vp(){this.Er=true,this.wi=setTimeout(()=>{this.Er=false,this.bi=0,this.wi=null;},_d);}disconnectedCallback(){super.disconnectedCallback(),this.Wl();}yp(t){for(let e of t)e.internalId&&this.uploadCollection.hasItem(e.internalId)&&this.uploadCollection.remove(e.internalId);}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.ql=t;}),this.subConfigValue("smartBtn",t=>{t?.sourceList&&(this.Et=j(t.sourceList).filter(e=>e!==Fd)),t?.mode&&(this.xs=Nd(t.mode,this.Et.length));}),this.uploadCollection.observeProperties(this.Y),this.uploadCollection.observeCollection(this.Y);}render(){return y`<uc-drop-area class=${Ot(Bd(this.W))} style="--uc-upload-progress: ${this.bi}%" .disabled=${!this.dropzone} ><div class="uc-drop-area-inner"><div class=${Ot({"uc-progress-fill":true,"uc-progress-fading":this.Er})}></div><button class="uc-start-btn" type="button" @click=${this.Es}>${this.Mt?y`<uc-thumb .uid=${this.Mt.internalId}></uc-thumb><span>${this.Mt.fileInfo.name}</span>`:y`<span>${this.buttonText}</span>`} ${this.yield("")}<uc-icon class="uc-visual-drop-area" name="arrow-down"></uc-icon></button><button ?hidden=${this.isIdle} class="uc-mini-btn uc-close-btn uc-abort-btn" type="button" @click=${this.bp}><uc-icon name="close"></uc-icon></button><uc-dropdown ?hidden=${!this.isIdle||!this.xs||!this.Et.length}><uc-icon content-for="dd-header-button" name="arrow-dropdown"></uc-icon><div content-for="dd-content" role="menu" class="uc-dropdown-menu">${this.Et.map(t=>y`<div role="menuitem"><uc-source-btn type=${t}></uc-source-btn></div>`)}</div></uc-dropdown><div ?hidden=${!this.isIdle||this.xs||!this.Et.length} class="uc-source-list">${this.Et.map(t=>y`<uc-source-btn onlyIcon type=${t}></uc-source-btn>`)}</div></div></uc-drop-area>`}};h([b({attribute:"dropzone",type:Boolean})],xt.prototype,"dropzone",2),h([g()],xt.prototype,"Et",2),h([g()],xt.prototype,"W",2),h([g()],xt.prototype,"ql",2),h([g()],xt.prototype,"Mt",2),h([g()],xt.prototype,"Tr",2),h([g()],xt.prototype,"bi",2),h([g()],xt.prototype,"Er",2),h([g()],xt.prototype,"xs",2);var ki=class extends Zt{constructor(){super();this.headless=false;this.smart=false;this.init$={...this.init$};}static{a(this,"FileUploaderRegular");}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});}render(){return y` ${super.render()} ${this.smart?y`<uc-smart-btn></uc-smart-btn>`:y`<uc-simple-btn ?hidden=${this.headless||this.smart}></uc-simple-btn>`}<uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]}>${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from></uc-modal><uc-modal id="upload-list" strokes block-body-scrolling><uc-upload-list></uc-upload-list></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`}};h([b({type:Boolean})],ki.prototype,"headless",2),h([b({type:Boolean})],ki.prototype,"smart",2);var to=class extends Zt{constructor(){super();this.Zl=false;this.Pt=()=>{if(this.Xl){let t=this.$["*historyBack"];t?.();return}this.Yl&&(this.$["*currentActivity"]=E.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{a(this,"FileUploaderInline");}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"];}get Xl(){let t=this.$["*history"];return !t||t.length<=1?false:t[t.length-1]!==E.activities.START_FROM}get Yl(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}Cs(){return this.getCssData("--cfg-init-activity")||E.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});let t=this.Cs();this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0&&this.$["*currentActivity"]===t&&(this.$["*currentActivity"]=E.activities.UPLOAD_LIST);}),this.sub("*history",()=>{this.Zl=this.Xl||this.Yl;});}render(){return y` ${super.render()}<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Pt} ?hidden=${!this.Zl} >${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-camera-source></uc-camera-source><uc-url-source></uc-url-source><uc-external-source></uc-external-source><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity>`}};h([g()],to.prototype,"Zl",2);var Os="active",eo="",de=class extends Zt{constructor(){super();this.Ss=false;this.xr=false;this.Cr=eo;this.As=eo;this.yi="choose-file";this.Xe=t=>{t.id===E.activities.CLOUD_IMG_EDIT&&(this.Cr=Os),this.$["*currentActivity"]===E.activities.UPLOAD_LIST&&(this.Cr=Os,this.xr=true);let e=this.$["*uploadList"];(!e||e.length<=0)&&(this.As=Os);};this.Ye=t=>{t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=E.activities.UPLOAD_LIST,this.xr=false),t.id===E.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=E.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{a(this,"FileUploaderMinimal");}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];}Cs(){return this.getCssData("--cfg-init-activity")||E.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});let t=this.Cs();this.sub("*currentActivity",e=>{e===E.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0?(this.$["*currentActivity"]=E.activities.UPLOAD_LIST,this.As=eo):(this.Cr=eo,this.xr=false,this.$["*currentActivity"]=t);}),this.subConfigValue("confirmUpload",e=>{e!==false&&(this.cfg.confirmUpload=false);}),this.subConfigValue("filesViewMode",e=>{this.setAttribute("mode",e),this.subConfigValue("multiple",o=>{e==="grid"?(o?this.style.removeProperty("--uc-grid-col"):this.style.setProperty("--uc-grid-col","1"),this.Ss=!o):(this.style.removeProperty("--uc-grid-col"),this.Ss=false);});}),this.subConfigValue("multiple",e=>{this.yi=e?"choose-files":"choose-file";}),this.modalManager?.subscribe(W.OPEN,this.Xe),this.modalManager?.subscribe(W.CLOSE,this.Ye);}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(W.OPEN,this.Xe),this.modalManager?.unsubscribe(W.CLOSE,this.Ye);}render(){return y` ${super.render()}<uc-start-from ?hidden=${this.xr} class=${this.As}><uc-drop-area ?single=${this.Ss} initflow clickable tabindex="0" ><span>${this.l10n(this.yi)}</span></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list class=${this.Cr}></uc-upload-list><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]} >${this.l10n("start-from-cancel")}</button></uc-start-from></uc-modal><uc-modal id="camera" strokes block-body-scrolling><uc-camera-source></uc-camera-source></uc-modal><uc-modal id="url" strokes block-body-scrolling><uc-url-source></uc-url-source></uc-modal><uc-modal id="external" strokes block-body-scrolling><uc-external-source></uc-external-source></uc-modal><uc-modal id="cloud-image-edit" strokes block-body-scrolling><uc-cloud-image-editor-activity></uc-cloud-image-editor-activity></uc-modal>`}};h([g()],de.prototype,"Ss",2),h([g()],de.prototype,"xr",2),h([g()],de.prototype,"Cr",2),h([g()],de.prototype,"As",2),h([g()],de.prototype,"yi",2);/*! For license information please see file-uploader.iife.min.js.LEGAL.txt */
|
|
8
|
-
exports.ActivityBlock=
|
|
7
|
+
var To=Object.defineProperty;var Wl=Object.getOwnPropertyDescriptor;var n=(o,i)=>To(o,"name",{value:i,configurable:true});var Xs=(o,i)=>{for(var t in i)To(o,t,{get:i[t],enumerable:true});};var h=(o,i,t,e)=>{for(var r=e>1?void 0:e?Wl(i,t):i,s=o.length-1,a;s>=0;s--)(a=o[s])&&(r=(e?a(i,t,r):a(r))||r);return e&&r&&To(i,t,r),r};var It=[],te=0,Zi=4,Qs=n(o=>{let i=[],t={get(){return t.lc||t.listen(()=>{})(),t.value},lc:0,listen(e){return t.lc=i.push(e),()=>{for(let s=te+Zi;s<It.length;)It[s]===e?It.splice(s,Zi):s+=Zi;let r=i.indexOf(e);~r&&(i.splice(r,1),--t.lc||t.off());}},notify(e,r){let s=!It.length;for(let a of i)It.push(a,t.value,e,r);if(s){for(te=0;te<It.length;te+=Zi)It[te](It[te+1],It[te+2],It[te+3]);It.length=0;}},off(){},set(e){let r=t.value;r!==e&&(t.value=e,t.notify(r));},subscribe(e){let r=t.listen(e);return e(t.value),r},value:o};return t},"atom");function Yi(o,i,t){let e=new Set(i).add(void 0);return o.listen((r,s,a)=>{e.has(a)&&t(r,s,a);})}n(Yi,"listenKeys");function xo(o,i,t){let e=Yi(o,i,t);return t(o.value),e}n(xo,"subscribeKeys");var So=n((o={})=>{let i=Qs(o);return i.setKey=function(t,e){let r=i.value;typeof e>"u"&&t in i.value?(i.value={...i.value},delete i.value[t],i.notify(r,t)):i.value[t]!==e&&(i.value={...i.value,[t]:e},i.notify(r,t));},i},"map");var K=class o{static{n(this,"PubSub");}static{this.Xe=new Map;}constructor(i,t){this.at=i,this.bt=t;}get id(){return this.at}pub(i,t){i in this.bt.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.bt.setKey(i,t);}sub(i,t,e=true){return (e?xo:Yi)(this.bt,[i],s=>{t(s[i]);})}read(i){return i in this.bt.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.bt.get()[i]}add(i,t,e=false){(!(i in this.bt.get())||e)&&this.bt.setKey(i,t);}has(i){return i in this.bt.get()}get store(){return this.bt.get()}static registerCtx(i,t){if(o.Xe.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=So(i);return o.Xe.set(t,e),new o(t,e)}static deleteCtx(i){o.Xe.delete(i);}static getCtx(i){let t=o.Xe.get(i);return t?new o(i,t):null}static hasCtx(i){return o.Xe.has(i)}};var Xi=globalThis,Ji=Xi.ShadowRoot&&(Xi.ShadyCSS===void 0||Xi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,tn=Symbol(),Js=new WeakMap,Qi=class{static{n(this,"n");}constructor(i,t,e){if(this._c=true,e!==tn)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(Ji&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=Js.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&Js.set(t,i));}return i}toString(){return this.cssText}},en=n(o=>new Qi(typeof o=="string"?o:o+"",void 0,tn),"r");var rn=n((o,i)=>{if(Ji)o.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),r=Xi.litNonce;r!==void 0&&e.setAttribute("nonce",r),e.textContent=t.cssText,o.appendChild(e);}},"S"),Ao=Ji?o=>o:o=>o instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return en(t)})(o):o;var{is:Yl,defineProperty:Xl,getOwnPropertyDescriptor:Ql,getOwnPropertyNames:Jl,getOwnPropertySymbols:tc,getPrototypeOf:ec}=Object,tr=globalThis,on=tr.trustedTypes,ic=on?on.emptyScript:"",rc=tr.reactiveElementPolyfillSupport,ui=n((o,i)=>o,"d"),di={toAttribute(o,i){switch(i){case Boolean:o=o?ic:null;break;case Object:case Array:o=o==null?o:JSON.stringify(o);}return o},fromAttribute(o,i){let t=o;switch(i){case Boolean:t=o!==null;break;case Number:t=o===null?null:Number(o);break;case Object:case Array:try{t=JSON.parse(o);}catch{t=null;}}return t}},er=n((o,i)=>!Yl(o,i),"f"),sn={attribute:true,type:String,converter:di,reflect:false,useDefault:false,hasChanged:er};Symbol.metadata??=Symbol("metadata"),tr.litPropertyMetadata??=new WeakMap;var Ht=class extends HTMLElement{static{n(this,"y");}static addInitializer(i){this.Yr(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.Ni&&[...this.Ni.keys()]}static createProperty(i,t=sn){if(t.state&&(t.attribute=false),this.Yr(),this.prototype.hasOwnProperty(i)&&((t=Object.create(t)).wrapped=true),this.elementProperties.set(i,t),!t.noAccessor){let e=Symbol(),r=this.getPropertyDescriptor(i,e,t);r!==void 0&&Xl(this.prototype,i,r);}}static getPropertyDescriptor(i,t,e){let{get:r,set:s}=Ql(this.prototype,i)??{get(){return this[t]},set(a){this[t]=a;}};return {get:r,set(a){let l=r?.call(this);s?.call(this,a),this.requestUpdate(i,l,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??sn}static Yr(){if(this.hasOwnProperty(ui("elementProperties")))return;let i=ec(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(ui("finalized")))return;if(this.finalized=true,this.Yr(),this.hasOwnProperty(ui("properties"))){let t=this.properties,e=[...Jl(t),...tc(t)];for(let r of e)this.createProperty(r,t[r]);}let i=this[Symbol.metadata];if(i!==null){let t=litPropertyMetadata.get(i);if(t!==void 0)for(let[e,r]of t)this.elementProperties.set(e,r);}this.Ni=new Map;for(let[t,e]of this.elementProperties){let r=this.Xr(t,e);r!==void 0&&this.Ni.set(r,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 r of e)t.unshift(Ao(r));}else i!==void 0&&t.push(Ao(i));return t}static Xr(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.Vi=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.be=null,this.Bc();}Bc(){this.Qr=new Promise(i=>this.enableUpdating=i),this.Yt=new Map,this.zc(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this.Qe??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.Qe?.delete(i);}zc(){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.Vi=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return rn(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.Qe?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this.Qe?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.Jr(i,e);}Hc(i,t){let e=this.constructor.elementProperties.get(i),r=this.constructor.Xr(i,e);if(r!==void 0&&e.reflect===true){let s=(e.converter?.toAttribute!==void 0?e.converter:di).toAttribute(t,e.type);this.be=i,s==null?this.removeAttribute(r):this.setAttribute(r,s),this.be=null;}}Jr(i,t){let e=this.constructor,r=e.Ni.get(i);if(r!==void 0&&this.be!==r){let s=e.getPropertyOptions(r),a=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:di;this.be=r;let l=a.fromAttribute(t,s.type);this[r]=l??this.to?.get(r)??l,this.be=null;}}requestUpdate(i,t,e,r=false,s){if(i!==void 0){let a=this.constructor;if(r===false&&(s=this[i]),e??=a.getPropertyOptions(i),!((e.hasChanged??er)(s,t)||e.useDefault&&e.reflect&&s===this.to?.get(i)&&!this.hasAttribute(a.Xr(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.Qr=this.Kc());}C(i,t,{useDefault:e,reflect:r,wrapped:s},a){e&&!(this.to??=new Map).has(i)&&(this.to.set(i,a??t??this[i]),s!==true||a!==void 0)||(this.Yt.has(i)||(this.hasUpdated||e||(t=void 0),this.Yt.set(i,t)),r===true&&this.be!==i&&(this.un??=new Set).add(i));}async Kc(){this.isUpdatePending=true;try{await this.Qr;}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.Vi){for(let[r,s]of this.Vi)this[r]=s;this.Vi=void 0;}let e=this.constructor.elementProperties;if(e.size>0)for(let[r,s]of e){let{wrapped:a}=s,l=this[r];a!==true||this.Yt.has(r)||l===void 0||this.C(r,void 0,s,l);}}let i=false,t=this.Yt;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.Qe?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.eo();}catch(e){throw i=false,this.eo(),e}i&&this.jc(t);}willUpdate(i){}jc(i){this.Qe?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}eo(){this.Yt=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.Qr}shouldUpdate(i){return true}update(i){this.un&&=this.un.forEach(t=>this.Hc(t,this[t])),this.eo();}updated(i){}firstUpdated(i){}};Ht.elementStyles=[],Ht.shadowRootOptions={mode:"open"},Ht[ui("elementProperties")]=new Map,Ht[ui("finalized")]=new Map,rc?.({ReactiveElement:Ht}),(tr.reactiveElementVersions??=[]).push("2.1.2");var Mo=globalThis,nn=n(o=>o,"i"),ir=Mo.trustedTypes,an=ir?ir.createPolicy("lit-html",{createHTML:n(o=>o,"createHTML")}):void 0,Io="$lit$",Kt=`lit$${Math.random().toFixed(9).slice(2)}$`,Oo="?"+Kt,oc=`<${Oo}>`,be=document,hi=n(()=>be.createComment(""),"c"),mi=n(o=>o===null||typeof o!="object"&&typeof o!="function","a"),Lo=Array.isArray,hn=n(o=>Lo(o)||typeof o?.[Symbol.iterator]=="function","d"),ko=`[ \f\r]`,pi=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ln=/-->/g,cn=/>/g,ve=RegExp(`>|${ko}(?:([^\\s"'>=/]+)(${ko}*=${ko}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),un=/'/g,dn=/"/g,mn=/^(?:script|style|textarea|title)$/i,Po=n(o=>(i,...t)=>({Nt:o,strings:i,values:t}),"x"),y=Po(1);Po(2);Po(3);var rt=Symbol.for("lit-noChange"),U=Symbol.for("lit-nothing"),pn=new WeakMap,ye=be.createTreeWalker(be,129);function fn(o,i){if(!Lo(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return an!==void 0?an.createHTML(i):i}n(fn,"V");var gn=n((o,i)=>{let t=o.length-1,e=[],r,s=i===2?"<svg>":i===3?"<math>":"",a=pi;for(let l=0;l<t;l++){let c=o[l],u,p,d=-1,m=0;for(;m<c.length&&(a.lastIndex=m,p=a.exec(c),p!==null);)m=a.lastIndex,a===pi?p[1]==="!--"?a=ln:p[1]!==void 0?a=cn:p[2]!==void 0?(mn.test(p[2])&&(r=RegExp("</"+p[2],"g")),a=ve):p[3]!==void 0&&(a=ve):a===ve?p[0]===">"?(a=r??pi,d=-1):p[1]===void 0?d=-2:(d=a.lastIndex-p[2].length,u=p[1],a=p[3]===void 0?ve:p[3]==='"'?dn:un):a===dn||a===un?a=ve:a===ln||a===cn?a=pi:(a=ve,r=void 0);let f=a===ve&&o[l+1].startsWith("/>")?" ":"";s+=a===pi?c+oc:d>=0?(e.push(u),c.slice(0,d)+Io+c.slice(d)+Kt+f):c+Kt+(d===-2?l:f);}return [fn(o,s+(o[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},"N"),fi=class o{static{n(this,"S");}constructor({strings:i,Nt:t},e){let r;this.parts=[];let s=0,a=0,l=i.length-1,c=this.parts,[u,p]=gn(i,t);if(this.el=o.createElement(u,e),ye.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes);}for(;(r=ye.nextNode())!==null&&c.length<l;){if(r.nodeType===1){if(r.hasAttributes())for(let d of r.getAttributeNames())if(d.endsWith(Io)){let m=p[a++],f=r.getAttribute(d).split(Kt),v=/([.?@])?(.*)/.exec(m);c.push({type:1,index:s,name:v[2],strings:f,ctor:v[1]==="."?or:v[1]==="?"?sr:v[1]==="@"?nr:Ee}),r.removeAttribute(d);}else d.startsWith(Kt)&&(c.push({type:6,index:s}),r.removeAttribute(d));if(mn.test(r.tagName)){let d=r.textContent.split(Kt),m=d.length-1;if(m>0){r.textContent=ir?ir.emptyScript:"";for(let f=0;f<m;f++)r.append(d[f],hi()),ye.nextNode(),c.push({type:2,index:++s});r.append(d[m],hi());}}}else if(r.nodeType===8)if(r.data===Oo)c.push({type:2,index:s});else {let d=-1;for(;(d=r.data.indexOf(Kt,d+1))!==-1;)c.push({type:7,index:s}),d+=Kt.length-1;}s++;}}static createElement(i,t){let e=be.createElement("template");return e.innerHTML=i,e}};function we(o,i,t=o,e){if(i===rt)return i;let r=e!==void 0?t.Gc?.[e]:t.qc,s=mi(i)?void 0:i.io;return r?.constructor!==s&&(r?.dn?.(false),s===void 0?r=void 0:(r=new s(o),r.ro(o,t,e)),e!==void 0?(t.Gc??=[])[e]=r:t.qc=r),r!==void 0&&(i=we(o,r.Wc(o,i.values),r,e)),i}n(we,"M");var rr=class{static{n(this,"R");}constructor(i,t){this.pn=[],this.wt=void 0,this.hn=i,this.f=t;}get parentNode(){return this.f.parentNode}get X(){return this.f.X}u(i){let{el:{content:t},parts:e}=this.hn,r=(i?.creationScope??be).importNode(t,true);ye.currentNode=r;let s=ye.nextNode(),a=0,l=0,c=e[0];for(;c!==void 0;){if(a===c.index){let u;c.type===2?u=new Re(s,s.nextSibling,this,i):c.type===1?u=new c.ctor(s,c.name,c.strings,this,i):c.type===6&&(u=new ar(s,this,i)),this.pn.push(u),c=e[++l];}a!==c?.index&&(s=ye.nextNode(),a++);}return ye.currentNode=be,r}p(i){let t=0;for(let e of this.pn)e!==void 0&&(e.strings!==void 0?(e.xt(i,e,t),t+=e.strings.length-2):e.xt(i[t])),t++;}},Re=class o{static{n(this,"k");}get X(){return this.f?.X??this.mn}constructor(i,t,e,r){this.type=2,this.r=U,this.wt=void 0,this.Pt=i,this.we=t,this.f=e,this.options=r,this.mn=r?.isConnected??true;}get parentNode(){let i=this.Pt.parentNode,t=this.f;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.Pt}get endNode(){return this.we}xt(i,t=this){i=we(this,i,t),mi(i)?i===U||i==null||i===""?(this.r!==U&&this.xe(),this.r=U):i!==this.r&&i!==rt&&this.gn(i):i.Nt!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):hn(i)?this.k(i):this.gn(i);}O(i){return this.Pt.parentNode.insertBefore(i,this.we)}T(i){this.r!==i&&(this.xe(),this.r=this.O(i));}gn(i){this.r!==U&&mi(this.r)?this.Pt.nextSibling.data=i:this.T(be.createTextNode(i)),this.r=i;}$(i){let{values:t,Nt:e}=i,r=typeof e=="number"?this.Zc(i):(e.el===void 0&&(e.el=fi.createElement(fn(e.h,e.h[0]),this.options)),e);if(this.r?.hn===r)this.r.p(t);else {let s=new rr(r,this),a=s.u(this.options);s.p(t),this.T(a),this.r=s;}}Zc(i){let t=pn.get(i.strings);return t===void 0&&pn.set(i.strings,t=new fi(i)),t}k(i){Lo(this.r)||(this.r=[],this.xe());let t=this.r,e,r=0;for(let s of i)r===t.length?t.push(e=new o(this.O(hi()),this.O(hi()),this,this.options)):e=t[r],e.xt(s),r++;r<t.length&&(this.xe(e&&e.we.nextSibling,r),t.length=r);}xe(i=this.Pt.nextSibling,t){for(this._i?.(false,true,t);i!==this.we;){let e=nn(i).nextSibling;nn(i).remove(),i=e;}}setConnected(i){this.f===void 0&&(this.mn=i,this._i?.(i));}},Ee=class{static{n(this,"H");}get tagName(){return this.element.tagName}get X(){return this.f.X}constructor(i,t,e,r,s){this.type=1,this.r=U,this.wt=void 0,this.element=i,this.name=t,this.f=r,this.options=s,e.length>2||e[0]!==""||e[1]!==""?(this.r=Array(e.length-1).fill(new String),this.strings=e):this.r=U;}xt(i,t=this,e,r){let s=this.strings,a=false;if(s===void 0)i=we(this,i,t,0),a=!mi(i)||i!==this.r&&i!==rt,a&&(this.r=i);else {let l=i,c,u;for(i=s[0],c=0;c<s.length-1;c++)u=we(this,l[e+c],t,c),u===rt&&(u=this.r[c]),a||=!mi(u)||u!==this.r[c],u===U?i=U:i!==U&&(i+=(u??"")+s[c+1]),this.r[c]=u;}a&&!r&&this.j(i);}j(i){i===U?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},or=class extends Ee{static{n(this,"I");}constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===U?void 0:i;}},sr=class extends Ee{static{n(this,"L");}constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==U);}},nr=class extends Ee{static{n(this,"z");}constructor(i,t,e,r,s){super(i,t,e,r,s),this.type=5;}xt(i,t=this){if((i=we(this,i,t,0)??U)===rt)return;let e=this.r,r=i===U&&e!==U||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,s=i!==U&&(e===U||r);r&&this.element.removeEventListener(this.name,this,e),s&&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);}},ar=class{static{n(this,"Z");}constructor(i,t,e){this.element=i,this.type=6,this.wt=void 0,this.f=t,this.options=e;}get X(){return this.f.X}xt(i){we(this,i);}},vn={I:Re},sc=Mo.litHtmlPolyfillSupport;sc?.(fi,Re),(Mo.litHtmlVersions??=[]).push("3.3.2");var lr=n((o,i,t)=>{let e=t?.renderBefore??i,r=e.Yc;if(r===void 0){let s=t?.renderBefore??null;e.Yc=r=new Re(i.insertBefore(hi(),s),s,void 0,t??{});}return r.xt(o),r},"D");var Uo=globalThis,xt=class extends Ht{static{n(this,"i");}constructor(){super(...arguments),this.renderOptions={host:this},this.oo=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.oo=lr(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.oo?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.oo?.setConnected(false);}render(){return rt}};xt.Th=true,xt.finalized=true,Uo.litElementHydrateSupport?.({LitElement:xt});var nc=Uo.litElementPolyfillSupport;nc?.({LitElement:xt});(Uo.litElementVersions??=[]).push("4.2.2");var ac=/\\([0-9a-fA-F]{1,6} ?)/g;function lc(o){return o.length<2?false:(o[0]==='"'||o[0]==="'")&&(o[o.length-1]==='"'||o[o.length-1]==="'")}n(lc,"hasLeadingTrailingQuotes");function cc(o){let i=o;return (i[0]==='"'||i[0]==="'")&&(i=i.slice(1)),(i[i.length-1]==='"'||i[i.length-1]==="'")&&(i=i.slice(0,-1)),i}n(cc,"trimQuotes");function uc(o){let i="",t="";for(let e=0;e<o.length;e++){let r=o[e+1];o[e]==="\\"&&r==='"'?(i+='\\"',e++):o[e]==='"'&&t!=="\\"?i+='\\"':i+=o[e],t=o[e]??"";}return i}n(uc,"escapeQuotes");function yn(o){let i=o;lc(o)&&(i=cc(i),i=i.replace(ac,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=uc(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}n(yn,"parseCssPropertyValue");function $e(o){class i extends o{constructor(){super(...arguments);this.vn=null;this.so=null;}static{n(this,"CssDataMixinClass");}getCssData(r,s=false){let a=this.vn??Object.create(null);if(!Object.keys(a).includes(r)||!a[r]){this.so||(this.so=window.getComputedStyle(this));let l=this.so.getPropertyValue(r).trim();try{a[r]=yn(l);}catch(c){s||console.warn(`CSS Data error: ${r}`,c),a[r]=null;}}return this.vn=a,a[r]}}return i}n($e,"CssDataMixin");function cr(o){class i extends o{constructor(){super(...arguments);this.willYield=true;this.Xt={};this.Qt=null;this.Bi=false;}static{n(this,"LightDomMixinClass");}createRenderRoot(){return this}connectedCallback(){this.Qt||(this.Qt=Array.from(this.childNodes)),super.connectedCallback();}Xc(){if(this.Bi)return;this.Bi=true,this.Xt={};let r=Array.from(this.childNodes),s=r.length?r:this.Qt??[];for(let a of s){let l=this.yn(a),c=this.Xt[l]??[];a instanceof Element&&(a.removeAttribute("slot"),a.removeAttribute("content-for")),c.push(a),this.Xt[l]=c;}this.Qt=null;}yn(r){return r instanceof Comment&&r.nextSibling instanceof Element?this.yn(r.nextSibling):"contentFor"in r?r.contentFor||"":r instanceof Element&&r.hasAttribute("content-for")&&r.getAttribute("content-for")||""}Qc(r){return !r.textContent||!r.textContent.trim()}Jc(r){let s=this.Xt[r];return !s||s.every(a=>a instanceof Comment||a instanceof Text&&this.Qc(a))}update(r){!this.hasUpdated&&this.willYield&&this.Xc(),super.update(r);}yield(r,s){if(r===""&&!this.Xt[r]&&!this.Bi&&this.Qt?.length){let l=[];for(let c of this.Qt)c instanceof Element&&(c.removeAttribute("slot"),c.removeAttribute("content-for")),l.push(c);this.Xt[r]=l,this.Bi=true,this.Qt=null;}let a=this.Xt[r];return y` ${a} ${this.Jc(r)?s:void 0} `}}return i}n(cr,"LightDomMixin");function De(o){class i extends o{static{n(this,"RegisterableElementMixinClass");}static reg(e){let r=this,s=window.customElements.get(e);if(s){s!==r&&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,r);}}return i}n(De,"RegisterableElementMixin");var ee=class extends Event{static{n(this,"s");}constructor(i,t,e,r){super("context-request",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t,this.callback=e,this.subscribe=r??false;}};var Fe=class{static{n(this,"s");}constructor(i,t,e,r){if(this.subscribe=false,this.provided=false,this.value=void 0,this.t=(s,a)=>{this.unsubscribe&&(this.unsubscribe!==a&&(this.provided=false,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=true,this.callback&&this.callback(s,a)),this.unsubscribe=a;},this.host=i,t.context!==void 0){let s=t;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??false;}else this.context=t,this.callback=e,this.subscribe=r??false;this.host.addController(this);}hostConnected(){this.dispatchRequest();}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0);}dispatchRequest(){this.host.dispatchEvent(new ee(this.context,this.host,this.t,this.subscribe));}};var ur=class{static{n(this,"s");}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:n(()=>{this.subscriptions.delete(i);},"disposer"),consumerHost:t});let{disposer:r}=this.subscriptions.get(i);i(this.value,r);}clearCallbacks(){this.subscriptions.clear();}};var Ro=class extends Event{static{n(this,"e");}constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},Ve=class extends ur{static{n(this,"i");}constructor(i,t,e){super(t.context!==void 0?t.initialValue:e),this.onContextRequest=r=>{if(r.context!==this.context)return;let s=r.contextTarget??r.composedPath()[0];s!==this.host&&(r.stopPropagation(),this.addCallback(r.callback,s,r.subscribe));},this.onProviderRequest=r=>{if(r.context!==this.context||(r.contextTarget??r.composedPath()[0])===this.host)return;let s=new Set;for(let[a,{consumerHost:l}]of this.subscriptions)s.has(a)||(s.add(a),l.dispatchEvent(new ee(this.context,l,a,true)));r.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 Ro(this.context,this.host));}};var pc={attribute:true,type:String,converter:di,reflect:false,hasChanged:er},hc=n((o=pc,i,t)=>{let{kind:e,metadata:r}=t,s=globalThis.litPropertyMetadata.get(r);if(s===void 0&&globalThis.litPropertyMetadata.set(r,s=new Map),e==="setter"&&((o=Object.create(o)).wrapped=true),s.set(t.name,o),e==="accessor"){let{name:a}=t;return {set(l){let c=i.get.call(this);i.set.call(this,l),this.requestUpdate(a,c,o,true,l);},init(l){return l!==void 0&&this.C(a,void 0,o,l),l}}}if(e==="setter"){let{name:a}=t;return function(l){let c=this[a];i.call(this,l),this.requestUpdate(a,c,o,true,l);}}throw Error("Unsupported decorator location: "+e)},"r");function b(o){return (i,t)=>typeof t=="object"?hc(o,i,t):((e,r,s)=>{let a=r.hasOwnProperty(s);return r.constructor.createProperty(s,e),a?Object.getOwnPropertyDescriptor(r,s):void 0})(o,i,t)}n(b,"n");function g(o){return b({...o,state:true,attribute:false})}n(g,"r");function V(o,i){let t,e=n(((...r)=>{t&&clearTimeout(t),t=setTimeout(()=>o(...r),i);}),"debounced");return e.cancel=()=>{t&&clearTimeout(t);},e}n(V,"debounce");var bn="ctx-name-context";function pr(){return function(o){class i extends o{constructor(...r){super(...r);this.pt=null;this.Je=false;this.ao=false;this.lo=void 0;this.Ee=new Map;this.ti=new Set;this.init$={};this.ctxOwner=false;this.zi=void 0;this.Hi=false;this.ctxName=this.Vt;this._t=false;this.zi=this.getAttribute("ctx-name")||void 0,this.ctxName=this.Vt,this.tu=new Fe(this,{context:bn,callback:n(s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.xn=s,this.wn();},"callback"),subscribe:true});}static{n(this,"SymbioteMixinClass");}static set template(r){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 bn(){return this.zi}set bn(r){let s=r??void 0;this.zi!==s&&(this.zi=s,this.wn());}shouldUpdate(r){return this._t?super.shouldUpdate(r):false}get Vt(){return this.bn||this.xn||void 0}wn(){if(this.ctxName=this.Vt,!(!this.ctxName||this.Je)){if(this.isConnected){this.co();return}this.Hi=true;}}willUpdate(r){super.willUpdate(r),this.ctxName=this.Vt,this.ctxName&&(this.lo?this.lo.setValue(this.ctxName):this.lo=new Ve(this,{context:bn,initialValue:this.ctxName}));}En(){if(!(!this.pt||this.Ee.size===0)){for(let[r,{value:s,rewrite:a}]of this.Ee)this.pt.add(r,s,a);this.Ee.clear();}}Cn(){return !this.pt&&this.Vt&&this.uo(),this.pt&&this.En(),this.pt}Ki(){let r=this.Cn();if(!r)throw new Error("SymbioteMixin: Shared context is not initialized.");return r}uo(){let r=this.init$,s=this.Vt;if(!s){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.pt){this.pt=K.getCtx(s)??K.registerCtx(r,s);for(let[a,l]of Object.entries(this.init$))this.pt.add(a,l,this.ctxOwner);this.En();}}get $(){return this.Vt&&this.uo(),new Proxy({},{get:n((r,s)=>{if(typeof s=="string")return this.pt?.read(s)},"get"),set:n((r,s,a)=>(typeof s!="string"||this.pt?.pub(s,a),true),"set")})}sub(r,s,a=true){let l=this.Ki().sub(r,s,a);if(!l||typeof l!="function")return ()=>{};let c=l.bind(l),u=false,p=n(()=>{u||(u=true,c(),this.ti.delete(p));},"trackedRemove");return this.ti.add(p),p}pub(r,s){this.Ki().pub(r,s);}set$(r){for(let[s,a]of Object.entries(r))this.pub(s,a);}get sharedCtx(){return this.Ki()}has(r){return this.pt?.has(r)??false}add(r,s,a=false){let l=this.Cn();if(!l){if(!a&&this.Ee.has(r))return;this.Ee.set(r,{value:s,rewrite:a});return}this.Ee.delete(r),l.add(r,s,a);}add$(r,s=false){for(let[a,l]of Object.entries(r))this.add(a,l,s);}connectedCallback(){super.connectedCallback(),this.Je?this._t&&this.ao&&(this.ao=false,this.initCallback()):this.ctxName?(this.Hi=false,this.co()):this.Hi&&this.Vt&&(this.Hi=false,this.co());}co(){if(this.Je)return;this.Je=true,this.uo();let r=this.init$;if(Object.keys(r).length>0){let s=this.Ki();for(let[a,l]of Object.entries(r))s.read(a)===void 0&&s.pub(a,l),this.sub(a,V(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this._t=true,this.requestUpdate();}firstUpdated(r){super.firstUpdated(r);}disconnectedCallback(){this.eu(),super.disconnectedCallback(),this.Je&&(this.ao=true);}eu(){if(this.ti.size!==0){for(let r of [...this.ti])r();this.ti.clear();}}initCallback(){}}return h([b({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"bn",1),h([g()],i.prototype,"xn",2),h([g()],i.prototype,"ctxName",2),h([g()],i.prototype,"_t",2),i}}n(pr,"SymbioteMixin");var $o=class extends De(pr()($e(cr(xt)))){static{n(this,"BaseComponent");}};var ot=class o{static{n(this,"UID");}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():o.generateFastUid()}};var mc=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function yt(o){for(let i in o){if(mc.includes(i))continue;let t=[...i].reduce((e,r)=>(r.toUpperCase()===r&&(r=`-${r.toLowerCase()}`),e+=r,e),"");t.startsWith("-")&&(t=t.replace("-","")),t.startsWith("uc-")||(t=`uc-${t}`),o[i].reg&&o[i].reg(t);}}n(yt,"defineComponents");var Do="UC";function fc(o,i=false){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[Do]){t(window[Do]);return}let r=document.createElement("script");r.async=true,r.src=o,r.onerror=()=>{e();},r.onload=()=>{let s=window[Do];i&&yt(s),t(s);},document.head.appendChild(r);})}n(fc,"loadFileUploaderFrom");var gi={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","drop-file-here":"Drop file here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-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-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","upload-from":"Upload {{source}}","get-from":"Get from {{source}}","capture-with":"Capture with {{source}}",take:"Take {{source}}",record:"Record {{source}}",retake:"Retake",accept:"Accept"};var Fo=new Map,wn=new Map,En=n((o,i)=>{Fo.has(o)&&console.log(`Locale ${o} is already defined. Overwriting...`);let t={...gi,...i};return Fo.set(o,t),t},"defineLocaleSync"),gc=n((o,i)=>{wn.set(o,i);},"defineLocaleAsync"),Cn=n((o,i)=>{typeof i=="function"?gc(o,i):En(o,i);},"defineLocale"),Tn=n(async o=>{let i=Fo.get(o);if(!i){let t=wn.get(o);if(!t)throw new Error(`Locale ${o} is not defined`);let e=await t();i=En(o,e);}return i},"resolveLocaleDefinition");Cn("en",gi);var S=n(o=>`*cfg/${o}`,"sharedConfigKey");var G=n(o=>o?o.split(",").map(i=>i.trim()).filter(Boolean):[],"deserializeCsv"),jt=n(o=>o.join(","),"serializeCsv");var xn=n(o=>{if(typeof o!="string"||!o)return "";let i=o.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},"normalizeCdnOperation"),hr=n((...o)=>o.filter(i=>typeof i=="string"&&!!i).map(i=>xn(i)).join("/-/"),"joinCdnOperations"),st=n((...o)=>{let i=hr(...o);return i?`-/${i}/`:""},"createCdnUrlModifiers");function mr(o){let i=new URL(o),t=i.pathname+i.search+i.hash,e=t.lastIndexOf("http"),r=t.lastIndexOf("/"),s="";return e>=0?s=t.slice(e):r>=0&&(s=t.slice(r+1)),s}n(mr,"extractFilename");function fr(o){let i=new URL(o),{pathname:t}=i,e=t.indexOf("/"),r=t.indexOf("/",e+1);return t.substring(e+1,r)}n(fr,"extractUuid");function Vo(o){let i=Sn(o),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}n(Vo,"extractCdnUrlModifiers");function No(o){return Vo(o).split("/-/").filter(Boolean).map(t=>xn(t))}n(No,"extractOperations");function Sn(o){let i=new URL(o),t=mr(o),e=An(t)?kn(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}n(Sn,"trimFilename");function An(o){return o.startsWith("http")}n(An,"isFileUrl");function kn(o){let i=new URL(o);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}n(kn,"splitFileUrl");var Z=n((o,i,t)=>{let e=new URL(Sn(o)),r=t??mr(o),s=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),r&&An(r)){let a=kn(r);e.pathname=`${e.pathname}${s}${a.pathname||""}`,e.search=a.search,e.hash=a.hash;}else e.pathname=`${e.pathname}${s}${r||""}`;return e.toString()},"createCdnUrl"),ie=n((o,i)=>{let t=new URL(o);return t.pathname=`${i}/`,t.toString()},"createOriginalUrl");var Y=n((o,i=",")=>o.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0),"stringToArray");var vi=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}),In=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function vc(o,i){if(typeof i=="number"){let t=i;return vi[o]!==t?`${o}/${t}`:""}if(typeof i=="boolean"){let t=i;return vi[o]!==t?`${o}`:""}if(o==="filter"&&i){let{name:t,amount:e}=i;return vi.filter===e?"":`${o}/${t}/${e}`}if(o==="crop"&&i){let{dimensions:t,coords:e}=i;return `${o}/${t.join("x")}/${e.join(",")}`}return ""}n(vc,"transformationToStr");function re(o){return hr(...In.filter(i=>typeof o[i]<"u"&&o[i]!==null).map(i=>{let t=o[i];return vc(i,t)}).filter(i=>!!i))}n(re,"transformationsToOperations");var gr=hr("format/auto","progressive/yes"),Gt=n(([o])=>typeof o<"u"?Number(o):void 0,"asNumber"),Mn=n(()=>true,"asBoolean"),yc=n(([o,i])=>({name:o,amount:typeof i<"u"?Number(i):100}),"asFilter"),bc=n(([o,i])=>{if(!/\d+x\d+/.test(o)||!/\d+,\d+/.test(i))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return {dimensions:Y(o,"x").map(Number),coords:Y(i).map(Number)}},"asCrop"),wc=Object.freeze({enhance:Gt,brightness:Gt,exposure:Gt,gamma:Gt,contrast:Gt,saturation:Gt,vibrance:Gt,warmth:Gt,filter:yc,mirror:Mn,flip:Mn,rotate:Gt,crop:n(o=>{let[i,t]=o,{dimensions:e,coords:r}=bc([i,t]);return {dimensions:e,coords:r}},"crop")});function _o(o){let i={};for(let t of o){let[e,...r]=t.split("/");if(!e||!In.includes(e))continue;let s=e,a=wc[s];try{let l=a(r);i[s]=l;}catch(l){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,l instanceof Error?`Error message: "${l.message}"`:l,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return i}n(_o,"operationsToTransformations");var H=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),nt=Object.freeze([H.CROP,H.TUNING,H.FILTERS]),On=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),Ln=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"]),Pn=Object.freeze(["rotate","mirror","flip"]),qt=vi,Ot=Object.freeze({brightness:{zero:qt.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:qt.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:qt.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:qt.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:qt.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:qt.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:qt.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:qt.enhance,range:[0,100],keypointsNumber:1},filter:{zero:qt.filter,range:[0,100],keypointsNumber:1}});var yi="https://ucarecdn.com",Ec="https://upload.uploadcare.com",Cc="https://social.uploadcare.com",Tc="https://ucarecd.net",xc={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:yi,cdnCnamePrefixed:Tc,baseUrl:Ec,socialBaseUrl:Cc,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:jt(nt),cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true,pasteScope:"local",plugins:[],smartButtonViewMode:"auto",smartButtonShowFirstIcon:true},tt=Object.freeze(xc);var vr=n((o,i)=>(...t)=>{let e=o();if(!e.read(S("debug")))return;let r=t;if(typeof t?.[0]=="function"){let a=t[0];r=a();}let s=[e.id,i].filter(Boolean);console.log(`[${s.join("][")}]`,...r);},"createDebugPrinter");var j=class{constructor(i){this.po=new Set;this.Jt=null;this.w=vr(()=>this.e.ctx,this.constructor.name);this.e=i,this.i=i.ctx;}static{n(this,"SharedInstance");}addSub(i){this.po.add(i);}get te(){if(!this.Jt){let i={};this.Jt=new Proxy(i,{set:n(()=>{throw new Error("SharedInstance cfg proxy is read-only")},"set"),get:n((t,e)=>{if(typeof e!="string")return;let r=S(e);return this.e.ctx.has(r)?this.e.ctx.read(r):tt[e]},"get")});}return this.Jt}destroy(){for(let i of this.po)try{i();}catch{}this.po.clear();}},Sc={modalManager:"*modalManager",pluginManager:"*pluginManager",telemetryManager:"*telemetryManager",localeManager:"*localeManager",a11y:"*a11y",clipboard:"*clipboard",routerLayer:"*routerLayer",blocksRegistry:"*blocksRegistry",eventEmitter:"*eventEmitter",uploadCollection:"*uploadCollection",secureUploadsManager:"*secureUploadsManager",api:"*publicApi",validationManager:"*validationManager"},St=n((o,i,t=true)=>{let e=o.has(i),r=e?o.read(i):null;if(e&&r||!t)return r;throw new Error(`Unexpected error: shared instance for key "${String(i)}" is not available`)},"getSharedInstance"),Un=n(o=>({get ctx(){return o()},get modalManager(){return St(o(),"*modalManager",false)},get pluginManager(){return St(o(),"*pluginManager")},get telemetryManager(){return St(o(),"*telemetryManager")},get localeManager(){return St(o(),"*localeManager")},get a11y(){return St(o(),"*a11y")},get routerLayer(){return St(o(),"*routerLayer")},get blocksRegistry(){return St(o(),"*blocksRegistry")},get eventEmitter(){return St(o(),"*eventEmitter")},get uploadCollection(){return St(o(),"*uploadCollection")},get secureUploadsManager(){return St(o(),"*secureUploadsManager",false)},get api(){return St(o(),"*publicApi")},get validationManager(){return St(o(),"*validationManager")},when(i,t){let e=Sc[i],r=o(),s=r.has(e)?r.read(e):void 0;if(s)return t(s),()=>{};let a;return a=r.sub(e,l=>{l&&(t(l),a?.());}),a},wait(i){return new Promise(t=>{let e;e=this.when(i,r=>{t(r),e?.();});})}}),"createSharedInstancesBag");var X=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),yr=class extends j{constructor(){super(...arguments);this.ee=new Map;this.Et=new Set;this.c=new Map;}static{n(this,"ModalManager");}registerModal(t,e){this.ee.set(t,e),this.Z(X.ADD,{id:t,modal:e});}deleteModal(t){let e=this.ee.get(t);return e?(this.ee.delete(t),this.Et.delete(t),this.Z(X.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.ee.get(t);return e?(this.Et.add(t),this.Z(X.OPEN,{modal:e,id:t}),true):(this.w(`Modal with ID "${t}" not found`),false)}close(t){let e=this.ee.get(t);return !e||!this.Et.has(t)?(this.w(`Modal with ID "${t}" not found or not active`),false):(this.Et.delete(t),this.Z(X.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.ee.has(t)?this.Et.has(t)?this.close(t):this.open(t):(this.w(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.Et.size>0}back(){if(this.Et.size===0)return this.w("No active modals to go back from"),false;let t=Array.from(this.Et).pop();return t?this.close(t):false}closeAll(){let t=this.Et.size;return this.Et.clear(),this.Z(X.CLOSE_ALL,{}),t}subscribe(t,e){return this.c.has(t)||this.c.set(t,new Set),this.c.get(t)?.add(e),()=>this.unsubscribe(t,e)}unsubscribe(t,e){this.c.has(t)&&this.c.get(t)?.delete(e);}Z(t,e){if(this.c.has(t))for(let r of this.c.get(t)??new Set)try{r(e);}catch(s){this.e.telemetryManager.sendEventError(s,"modal subscriber"),this.w("Error in modal subscriber:",s);}}destroy(){super.destroy(),this.closeAll(),this.ee.clear(),this.c.clear(),this.Z(X.DESTROY,{});}};var br=n(o=>o.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("-"),"toKebabCase");function Rn(o){return Object.prototype.toString.call(o)==="[object Object]"}n(Rn,"isObject");var Ac=/\W|_/g;function kc(o){return o.split(Ac).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}n(kc,"camelizeString");function $n(o,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(o)?o.map(t=>Zt(t,{ignoreKeys:i})):o}n($n,"camelizeArrayItems");function Zt(o,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(o))return $n(o,{ignoreKeys:i});if(!Rn(o))return o;let t={};for(let e of Object.keys(o)){let r=o[e];if(i.includes(e)){t[e]=r;continue}Rn(r)?r=Zt(r,{ignoreKeys:i}):Array.isArray(r)&&(r=$n(r,{ignoreKeys:i})),t[kc(e)]=r;}return t}n(Zt,"camelizeKeys");var Mc=n(o=>new Promise(i=>setTimeout(i,o)),"delay");function qo({libraryName:o,libraryVersion:i,userAgent:t,publicKey:e="",integration:r=""}){let s="JavaScript";if(typeof t=="string")return t;if(typeof t=="function")return t({publicKey:e,libraryName:o,libraryVersion:i,languageName:s,integration:r});let a=[o,i,e].filter(Boolean).join("/"),l=[s,r].filter(Boolean).join("; ");return `${a} (${l})`}n(qo,"getUserAgent$1");var Ic={factor:2,time:100};function Oc(o,i=Ic){let t=0;function e(r){let s=Math.round(i.time*i.factor**t);return r({attempt:t,retry:n(l=>Mc(l??s).then(()=>(t+=1,e(r))),"retry")})}return n(e,"runAttempt"),e(o)}n(Oc,"retrier");var Ce=class extends Error{static{n(this,"UploadcareError");}},Ne=class o extends Ce{static{n(this,"NetworkError");}originalProgressEvent;constructor(i){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,o.prototype),this.originalProgressEvent=i;}},wr=n((o,i)=>{o&&(o.aborted?Promise.resolve().then(i):o.addEventListener("abort",()=>i(),{once:true}));},"onCancel"),oe=class o extends Ce{static{n(this,"CancelError");}isCancel=true;constructor(i="Request canceled"){super(i),this.name="CancelError",Object.setPrototypeOf(this,o.prototype);}},Lc=500,Fn=n(({check:o,interval:i=Lc,timeout:t,signal:e})=>new Promise((r,s)=>{let a,l;wr(e,()=>{a&&clearTimeout(a),s(new oe("Poll cancelled"));}),t&&(l=setTimeout(()=>{a&&clearTimeout(a),s(new oe("Timed out"));},t));let c=n(()=>{try{Promise.resolve(o(e)).then(u=>{u?(l&&clearTimeout(l),r(u)):a=setTimeout(c,i);}).catch(u=>{l&&clearTimeout(l),s(u);});}catch(u){l&&clearTimeout(l),s(u);}},"tick");a=setTimeout(c,0);}),"poll"),R={baseCDN:"https://ucarecdn.com",baseURL:"https://upload.uploadcare.com",retryThrottledRequestMaxTimes:1,retryNetworkErrorMaxTimes:3,multipartMinFileSize:25*1024*1024,multipartChunkSize:5*1024*1024,maxConcurrentRequests:4,pusherKey:"79ae88bd931ea68464d9"},Er="application/octet-stream",Vn="original",ne=n(({method:o,url:i,data:t,headers:e={},signal:r,onProgress:s})=>new Promise((a,l)=>{let c=new XMLHttpRequest,u=o?.toUpperCase()||"GET",p=false;c.open(u,i,true),e&&Object.entries(e).forEach(d=>{let[m,f]=d;typeof f<"u"&&!Array.isArray(f)&&c.setRequestHeader(m,f);}),c.responseType="text",wr(r,()=>{p=true,c.abort(),l(new oe);}),c.onload=()=>{if(c.status!=200)l(new Error(`Error ${c.status}: ${c.statusText}`));else {let d={method:u,url:i,data:t,headers:e||void 0,signal:r,onProgress:s},m=c.getAllResponseHeaders().trim().split(/[\r\n]+/),f={};m.forEach(function(E){let T=E.split(": "),C=T.shift(),A=T.join(": ");C&&typeof C<"u"&&(f[C]=A);});let v=c.response,w=c.status;a({request:d,data:v,headers:f,status:w});}},c.onerror=d=>{p||l(new Ne(d));},s&&typeof s=="function"&&(c.upload.onprogress=d=>{d.lengthComputable?s({isComputable:true,value:d.loaded/d.total}):s({isComputable:false});}),t?c.send(t):c.send();}),"request");function Pc(o,...i){return o}n(Pc,"identity");var Uc=n(({name:o})=>o?[o]:[],"getFileOptions"),Rc=Pc,$c=n(()=>new FormData,"getFormData"),Nn=n(o=>false,"isBuffer"),Cr=n(o=>typeof Blob<"u"&&o instanceof Blob,"isBlob"),Tr=n(o=>typeof File<"u"&&o instanceof File,"isFile"),xr=n(o=>!!o&&typeof o=="object"&&!Array.isArray(o)&&"uri"in o&&typeof o.uri=="string","isReactNativeAsset"),_e=n(o=>Cr(o)||Tr(o)||Nn()||xr(o),"isFileData"),Dc=n(o=>typeof o=="string"||typeof o=="number"||typeof o>"u","isSimpleValue"),Fc=n(o=>!!o&&typeof o=="object"&&!Array.isArray(o),"isObjectValue"),Vc=n(o=>!!o&&typeof o=="object"&&"data"in o&&_e(o.data),"isFileValue");function _n(o,i,t){if(Array.isArray(t))for(let e of t)_n(o,`${i}[]`,e);else if(Vc(t)){let{name:e,contentType:r}=t,s=Rc(t.data,e,r??Er),a=Uc({name:e,contentType:r});o.push([i,s,...a]);}else if(Fc(t))for(let[e,r]of Object.entries(t))typeof r<"u"&&o.push([`${i}[${e}]`,String(r)]);else Dc(t)&&t&&o.push([i,t.toString()]);}n(_n,"collectParams");function Nc(o){let i=[];for(let[t,e]of Object.entries(o))_n(i,t,e);return i}n(Nc,"getFormDataParams");function Sr(o){let i=$c(),t=Nc(o);for(let e of t){let[r,s,...a]=e;i.append(r,s,...a);}return i}n(Sr,"buildFormData");var at=class o extends Ce{static{n(this,"UploadError");}code;request;response;headers;constructor(i,t,e,r,s){super(),this.name="UploadError",this.message=i,this.code=t,this.request=e,this.response=r,this.headers=s,Object.setPrototypeOf(this,o.prototype);}},_c=n(o=>{let i=new URLSearchParams;for(let[t,e]of Object.entries(o))e&&typeof e=="object"&&!Array.isArray(e)?Object.entries(e).filter(r=>r[1]??false).forEach(r=>i.set(`${t}[${r[0]}]`,String(r[1]))):Array.isArray(e)?e.forEach(r=>{i.append(`${t}[]`,r);}):typeof e=="string"&&e?i.set(t,e):typeof e=="number"&&i.set(t,e.toString());return i.toString()},"buildSearchParams"),Wt=n((o,i,t)=>{let e=new URL(o);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=_c(t)),e.toString()},"getUrl"),Bc="6.18.4",zc="UploadcareUploadClient",Hc=Bc;function xe(o){return qo({libraryName:zc,libraryVersion:Hc,...o})}n(xe,"getUserAgent");var Kc="RequestThrottledError",Dn=15e3,jc=1e3;function Gc(o){let{headers:i}=o||{};if(!i||typeof i["retry-after"]!="string")return Dn;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:Dn}n(Gc,"getTimeoutFromThrottledRequest");function ae(o,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return Oc(({attempt:r,retry:s})=>o().catch(a=>{if("response"in a&&a?.code===Kc&&r<t)return s(Gc(a));if(a instanceof Ne&&r<e)return s((r+1)*jc);throw a}))}n(ae,"retryIfFailed");var Bn=n(o=>{let i="";return (Cr(o)||Tr(o)||xr(o))&&(i=o.type),i||Er},"getContentType"),zn=n(o=>{let i="";return Tr(o)&&o.name?i=o.name:Cr(o)||Nn()?i="":xr(o)&&o.name&&(i=o.name),i||Vn},"getFileName");function Wo(o){return typeof o>"u"||o==="auto"?"auto":o?"1":"0"}n(Wo,"getStoreValue");function qc(o,{publicKey:i,fileName:t,contentType:e,baseURL:r=R.baseURL,secureSignature:s,secureExpire:a,store:l,signal:c,onProgress:u,source:p="local",integration:d,userAgent:m,retryThrottledRequestMaxTimes:f=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=R.retryNetworkErrorMaxTimes,metadata:w}){return ae(()=>ne({method:"POST",url:Wt(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":xe({publicKey:i,integration:d,userAgent:m})},data:Sr({file:{data:o,name:t||zn(o),contentType:e||Bn(o)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Wo(l),signature:s,expire:a,source:p,metadata:w}),signal:c,onProgress:u}).then(({data:E,headers:T,request:C})=>{let A=Zt(JSON.parse(E));if("error"in A)throw new at(A.error.content,A.error.errorCode,C,A,T);return A}),{retryNetworkErrorMaxTimes:v,retryThrottledRequestMaxTimes:f})}n(qc,"base");var Ho;(function(o){o.Token="token",o.FileInfo="file_info";})(Ho||(Ho={}));function Wc(o,{publicKey:i,baseURL:t=R.baseURL,store:e,fileName:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:a,secureSignature:l,secureExpire:c,source:u="url",signal:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=R.retryNetworkErrorMaxTimes,metadata:w}){return ae(()=>ne({method:"POST",headers:{"X-UC-User-Agent":xe({publicKey:i,integration:d,userAgent:m})},url:Wt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:o,store:Wo(e),filename:r,check_URL_duplicates:s?1:void 0,save_URL_duplicates:a?1:void 0,signature:l,expire:c,source:u,metadata:w}),signal:p}).then(({data:E,headers:T,request:C})=>{let A=Zt(JSON.parse(E));if("error"in A)throw new at(A.error.content,A.error.errorCode,C,A,T);return A}),{retryNetworkErrorMaxTimes:v,retryThrottledRequestMaxTimes:f})}n(Wc,"fromUrl");var ht;(function(o){o.Unknown="unknown",o.Waiting="waiting",o.Progress="progress",o.Error="error",o.Success="success";})(ht||(ht={}));var Zc=n(o=>"status"in o&&o.status===ht.Error,"isErrorResponse");function Yc(o,{publicKey:i,baseURL:t=R.baseURL,signal:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:a=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=R.retryNetworkErrorMaxTimes}={}){return ae(()=>ne({method:"GET",headers:i?{"X-UC-User-Agent":xe({publicKey:i,integration:r,userAgent:s})}:void 0,url:Wt(t,"/from_url/status/",{jsonerrors:1,token:o}),signal:e}).then(({data:c,headers:u,request:p})=>{let d=Zt(JSON.parse(c));if("error"in d&&!Zc(d))throw new at(d.error.content,d.error.errorCode,p,d,u);return d}),{retryNetworkErrorMaxTimes:l,retryThrottledRequestMaxTimes:a})}n(Yc,"fromUrlStatus");function Xc(o,{publicKey:i,baseURL:t=R.baseURL,jsonpCallback:e,secureSignature:r,secureExpire:s,signal:a,source:l,integration:c,userAgent:u,retryThrottledRequestMaxTimes:p=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=R.retryNetworkErrorMaxTimes}){return ae(()=>ne({method:"POST",headers:{"X-UC-User-Agent":xe({publicKey:i,integration:c,userAgent:u})},url:Wt(t,"/group/",{jsonerrors:1}),data:Sr({files:o,callback:e,pub_key:i,signature:r,expire:s,source:l}),signal:a}).then(({data:m,headers:f,request:v})=>{let w=Zt(JSON.parse(m));if("error"in w)throw new at(w.error.content,w.error.errorCode,v,w,f);return w}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:p})}n(Xc,"group");function Hn(o,{publicKey:i,baseURL:t=R.baseURL,signal:e,source:r,integration:s,userAgent:a,retryThrottledRequestMaxTimes:l=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=R.retryNetworkErrorMaxTimes}){return ae(()=>ne({method:"GET",headers:{"X-UC-User-Agent":xe({publicKey:i,integration:s,userAgent:a})},url:Wt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:o,source:r}),signal:e}).then(({data:u,headers:p,request:d})=>{let m=Zt(JSON.parse(u));if("error"in m)throw new at(m.error.content,m.error.errorCode,d,m,p);return m}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}n(Hn,"info");function Qc(o,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:r=R.multipartChunkSize,baseURL:s="",secureSignature:a,secureExpire:l,store:c,signal:u,source:p="local",integration:d,userAgent:m,retryThrottledRequestMaxTimes:f=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:v=R.retryNetworkErrorMaxTimes,metadata:w}){return ae(()=>ne({method:"POST",url:Wt(s,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":xe({publicKey:i,integration:d,userAgent:m})},data:Sr({filename:e||Vn,size:o,content_type:t||Er,part_size:r,UPLOADCARE_STORE:Wo(c),UPLOADCARE_PUB_KEY:i,signature:a,expire:l,source:p,metadata:w}),signal:u}).then(({data:E,headers:T,request:C})=>{let A=Zt(JSON.parse(E));if("error"in A)throw new at(A.error.content,A.error.errorCode,C,A,T);return A.parts=Object.keys(A.parts).map(Ct=>A.parts[Number(Ct)]),A}),{retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v})}n(Qc,"multipartStart");function Jc(o,i,{contentType:t,signal:e,onProgress:r,retryThrottledRequestMaxTimes:s=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=R.retryNetworkErrorMaxTimes}){return ae(()=>ne({method:"PUT",url:i,data:o,onProgress:r,signal:e,headers:{"Content-Type":t||Er}}).then(l=>(r&&r({isComputable:true,value:1}),l)).then(({status:l})=>({code:l})),{retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:a})}n(Jc,"multipartUpload");function tu(o,{publicKey:i,baseURL:t=R.baseURL,source:e="local",signal:r,integration:s,userAgent:a,retryThrottledRequestMaxTimes:l=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:c=R.retryNetworkErrorMaxTimes}){return ae(()=>ne({method:"POST",url:Wt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":xe({publicKey:i,integration:s,userAgent:a})},data:Sr({uuid:o,UPLOADCARE_PUB_KEY:i,source:e}),signal:r}).then(({data:u,headers:p,request:d})=>{let m=Zt(JSON.parse(u));if("error"in m)throw new at(m.error.content,m.error.errorCode,d,m,p);return m}),{retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})}n(tu,"multipartComplete");function Zo(o,{publicKey:i,baseURL:t,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l,signal:c,onProgress:u}){return Fn({check:n(p=>Hn(o,{publicKey:i,baseURL:t,signal:p,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l}).then(d=>d.isReady?d:(u&&u({isComputable:true,value:1}),false)),"check"),signal:c})}n(Zo,"isReadyPoll");function eu(o){return "defaultEffects"in o}n(eu,"isGroupFileInfo");var Te=class{static{n(this,"UploadcareFile");}uuid;name;size;isStored;isImage;mimeType;cdnUrl;s3Url;originalFilename;imageInfo;videoInfo;contentInfo;metadata;s3Bucket;defaultEffects=null;constructor(i,{baseCDN:t=R.baseCDN,fileName:e}={}){let{uuid:r,s3Bucket:s}=i,a=Wt(t,`${r}/`),l=s?Wt(`https://${s}.s3.amazonaws.com/`,`${r}/${i.filename}`):null;this.uuid=r,this.name=e||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=a,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=s||null,this.s3Url=l,eu(i)&&(this.defaultEffects=i.defaultEffects);}},iu=n((o,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:a,contentType:l,signal:c,onProgress:u,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,baseCDN:w,metadata:E})=>qc(o,{publicKey:i,fileName:t,contentType:l,baseURL:e,secureSignature:r,secureExpire:s,store:a,signal:c,onProgress:u,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,metadata:E}).then(({file:T})=>Zo(T,{publicKey:i,baseURL:e,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,onProgress:u,signal:c})).then(T=>new Te(T,{baseCDN:w})),"uploadDirect"),ru=n((o,{publicKey:i,fileName:t,baseURL:e,signal:r,onProgress:s,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p,baseCDN:d})=>Hn(o,{publicKey:i,baseURL:e,signal:r,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u,retryNetworkErrorMaxTimes:p}).then(m=>new Te(m,{baseCDN:d,fileName:t})).then(m=>(s&&s({isComputable:true,value:1}),m)),"uploadFromUploaded"),ou=n((o,{signal:i}={})=>{let t=null,e=null,r=o.map(()=>new AbortController),s=n(a=>()=>{e=a,r.forEach((l,c)=>c!==a&&l.abort());},"createStopRaceCallback");return wr(i,()=>{r.forEach(a=>a.abort());}),Promise.all(o.map((a,l)=>{let c=s(l);return Promise.resolve().then(()=>a({stopRace:c,signal:r[l].signal})).then(u=>(c(),u)).catch(u=>(t=u,null))})).then(a=>{if(e===null)throw t;return a[e]})},"race"),su=window.WebSocket,Ko=class{static{n(this,"Events");}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]=[];}},nu=n((o,i)=>o==="success"?{status:ht.Success,...i}:o==="progress"?{status:ht.Progress,...i}:{status:ht.Error,...i},"response"),jo=class{static{n(this,"Pusher");}key;disconnectTime;ws=void 0;queue=[];isConnected=false;subscribers=0;emmitter=new Ko;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 su(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,nu(e.event,JSON.parse(e.data)));}});}}disconnect(){let i=n(()=>{this.ws?.close(),this.ws=void 0,this.isConnected=false;},"actualDisconect");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}`,r={event:"pusher:subscribe",data:{channel:e}};this.emmitter.on(e,t),this.isConnected?this.send(r.event,r.data):this.queue.push(r);}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(r=>r.data.channel!==t),this.subscribers===0&&this.disconnect();}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},Bo=null,Yo=n(o=>{if(!Bo){let i=typeof window>"u"?0:3e4;Bo=new jo(o,i);}return Bo},"getPusher"),au=n(o=>{Yo(o).connect();},"preconnect");function lu({token:o,publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:a,onProgress:l,signal:c}){return Fn({check:n(u=>Yc(o,{publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:a,signal:u}).then(p=>{switch(p.status){case ht.Error:return new at(p.error,p.errorCode);case ht.Waiting:return false;case ht.Unknown:return new at(`Token "${o}" was not found.`);case ht.Progress:return l&&(p.total==="unknown"?l({isComputable:false}):l({isComputable:true,value:p.done/p.total})),false;case ht.Success:return l&&l({isComputable:true,value:p.done/p.total}),p;default:throw new Error("Unknown status")}}),"check"),signal:c})}n(lu,"pollStrategy");var cu=n(({token:o,pusherKey:i,signal:t,onProgress:e})=>new Promise((r,s)=>{let a=Yo(i),l=a.onError(s),c=n(()=>{l(),a.unsubscribe(o);},"destroy");wr(t,()=>{c(),s(new oe("pusher cancelled"));}),a.subscribe(o,u=>{switch(u.status){case ht.Progress:{e&&(u.total==="unknown"?e({isComputable:false}):e({isComputable:true,value:u.done/u.total}));break}case ht.Success:{c(),e&&e({isComputable:true,value:u.done/u.total}),r(u);break}case ht.Error:c(),s(new at(u.msg,u.error_code));}});}),"pushStrategy"),uu=n((o,{publicKey:i,fileName:t,baseURL:e,baseCDN:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:a,secureSignature:l,secureExpire:c,store:u,signal:p,onProgress:d,source:m,integration:f,userAgent:v,retryThrottledRequestMaxTimes:w,pusherKey:E=R.pusherKey,metadata:T})=>Promise.resolve(au(E)).then(()=>Wc(o,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:a,secureSignature:l,secureExpire:c,store:u,signal:p,source:m,integration:f,userAgent:v,retryThrottledRequestMaxTimes:w,metadata:T})).catch(C=>(Yo(E)?.disconnect(),Promise.reject(C))).then(C=>C.type===Ho.FileInfo?C:ou([({signal:A})=>lu({token:C.token,publicKey:i,baseURL:e,integration:f,userAgent:v,retryThrottledRequestMaxTimes:w,onProgress:d,signal:A}),({signal:A})=>cu({token:C.token,pusherKey:E,signal:A,onProgress:d})],{signal:p})).then(C=>{if(C instanceof at)throw C;return C}).then(C=>Zo(C.uuid,{publicKey:i,baseURL:e,integration:f,userAgent:v,retryThrottledRequestMaxTimes:w,onProgress:d,signal:p})).then(C=>new Te(C,{baseCDN:r})),"uploadFromUrl"),zo=new WeakMap,du=n(async o=>{if(zo.has(o))return zo.get(o);let i=await fetch(o.uri).then(t=>t.blob());return zo.set(o,i),i},"getBlobFromReactNativeAsset"),Kn=n(async o=>{if(Tr(o)||Cr(o))return o.size;if(xr(o))return (await du(o)).size;throw new Error("Unknown file type. Cannot determine file size.")},"getFileSize"),pu=n((o,i=R.multipartMinFileSize)=>o>=i,"isMultipart"),jn=n(o=>{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 !_e(o)&&t.test(o)},"isUuid"),Xo=n(o=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return !_e(o)&&t.test(o)},"isUrl"),hu=n((o,i)=>new Promise((t,e)=>{let r=[],s=false,a=i.length,l=[...i],c=n(()=>{let u=i.length-l.length,p=l.shift();p&&p().then(d=>{s||(r[u]=d,a-=1,a?c():t(r));}).catch(d=>{s=true,e(d);});},"run");for(let u=0;u<o;u++)c();}),"runWithConcurrency"),mu=n((o,i,t,e)=>{let r=e*i,s=Math.min(r+e,t);return o.slice(r,s)},"sliceChunk"),fu=n(async(o,i,t)=>e=>mu(o,e,i,t),"prepareChunks"),gu=n((o,i,{publicKey:t,contentType:e,onProgress:r,signal:s,integration:a,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c})=>Jc(o,i,{contentType:e,onProgress:r,signal:s,retryThrottledRequestMaxTimes:l,retryNetworkErrorMaxTimes:c}),"uploadPart"),vu=n(async(o,{publicKey:i,fileName:t,fileSize:e,baseURL:r,secureSignature:s,secureExpire:a,store:l,signal:c,onProgress:u,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,contentType:w,multipartChunkSize:E=R.multipartChunkSize,maxConcurrentRequests:T=R.maxConcurrentRequests,baseCDN:C,metadata:A})=>{let Ct=e??await Kn(o),Tt,ge=n((J,pt)=>{if(!u)return;Tt||(Tt=Array(J).fill(0));let Mt=n(Ut=>Ut.reduce((zt,Co)=>zt+Co,0),"sum");return Ut=>{Ut.isComputable&&(Tt[pt]=Ut.value,u({isComputable:true,value:Mt(Tt)/J}));}},"createProgressHandler");return w||=Bn(o),Qc(Ct,{publicKey:i,contentType:w,fileName:t||zn(o),baseURL:r,secureSignature:s,secureExpire:a,store:l,signal:c,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,metadata:A,multipartChunkSize:E}).then(async({uuid:J,parts:pt})=>{let Mt=await fu(o,Ct,E);return Promise.all([J,hu(T,pt.map((Ut,zt)=>()=>gu(Mt(zt),Ut,{publicKey:i,contentType:w,onProgress:ge(pt.length,zt),signal:c,integration:d,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v})))])}).then(([J])=>tu(J,{publicKey:i,baseURL:r,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v})).then(J=>J.isReady?J:Zo(J.uuid,{publicKey:i,baseURL:r,source:p,integration:d,userAgent:m,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:v,onProgress:u,signal:c})).then(J=>new Te(J,{baseCDN:C}))},"uploadMultipart");async function Qo(o,{publicKey:i,fileName:t,baseURL:e=R.baseURL,secureSignature:r,secureExpire:s,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:v,multipartMinFileSize:w,multipartChunkSize:E,maxConcurrentRequests:T,baseCDN:C=R.baseCDN,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:Ct,pusherKey:Tt,metadata:ge}){if(_e(o)){let J=await Kn(o);return pu(J,w)?vu(o,{publicKey:i,contentType:v,multipartChunkSize:E,fileSize:J,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:d,maxConcurrentRequests:T,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:C,metadata:ge}):iu(o,{publicKey:i,fileName:t,contentType:v,baseURL:e,secureSignature:r,secureExpire:s,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:C,metadata:ge})}if(Xo(o))return uu(o,{publicKey:i,fileName:t,baseURL:e,baseCDN:C,checkForUrlDuplicates:A,saveUrlForRecurrentUploads:Ct,secureSignature:r,secureExpire:s,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,pusherKey:Tt,metadata:ge});if(jn(o))return ru(o,{publicKey:i,fileName:t,baseURL:e,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,baseCDN:C});throw new TypeError(`File uploading from "${o}" is not supported`)}n(Qo,"uploadFile");var yu=n((o,i)=>{try{let t=new URL(o),e=new URL(i);return t.protocol=e.protocol,t.hostname=e.hostname,t.port=e.port,t.toString()}catch{return o}},"replaceUrlBase"),Go=class{static{n(this,"UploadcareGroup");}uuid;filesCount;totalSize;isStored;isImage;cdnUrl;files;createdAt;storedAt=null;constructor(i,{baseCDN:t=R.baseCDN}={}){this.uuid=i.id,this.filesCount=i.filesCount;let e=i.files.filter(Boolean);this.totalSize=Object.values(e).reduce((r,s)=>r+s.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(e).filter(r=>r.isImage).length,this.cdnUrl=yu(i.cdnUrl,t),this.files=e.map(r=>new Te(r,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored;}},bu=n(o=>{for(let i of o)if(!_e(i))return false;return true},"isFileDataArray"),wu=n(o=>{for(let i of o)if(!jn(i))return false;return true},"isUuidArray"),Eu=n(o=>{for(let i of o)if(!Xo(i))return false;return true},"isUrlArray");function Gn(o,{publicKey:i,fileName:t,baseURL:e=R.baseURL,secureSignature:r,secureExpire:s,store:a,signal:l,onProgress:c,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:v,multipartChunkSize:w=R.multipartChunkSize,baseCDN:E=R.baseCDN,checkForUrlDuplicates:T,saveUrlForRecurrentUploads:C,jsonpCallback:A}){if(!bu(o)&&!Eu(o)&&!wu(o))throw new TypeError(`Group uploading from "${o}" is not supported`);let Ct,Tt=true,ge=o.length,J=n((pt,Mt)=>{if(!c)return;Ct||(Ct=Array(pt).fill(0));let Ut=n(zt=>zt.reduce((Co,ql)=>Co+ql)/pt,"normalize");return zt=>{if(!zt.isComputable||!Tt){Tt=false,c({isComputable:false});return}Ct[Mt]=zt.value,c({isComputable:true,value:Ut(Ct)});}},"createProgressHandler");return Promise.all(o.map((pt,Mt)=>_e(pt)||Xo(pt)?Qo(pt,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:a,signal:l,onProgress:J(ge,Mt),source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f,contentType:v,multipartChunkSize:w,baseCDN:E,checkForUrlDuplicates:T,saveUrlForRecurrentUploads:C}).then(Ut=>Ut.uuid):pt)).then(pt=>Xc(pt,{publicKey:i,baseURL:e,jsonpCallback:A,secureSignature:r,secureExpire:s,signal:l,source:u,integration:p,userAgent:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:f}).then(Mt=>new Go(Mt,{baseCDN:E})).then(Mt=>(c&&c({isComputable:true,value:1}),Mt)))}n(Gn,"uploadFileGroup");var se=class{static{n(this,"Queue");}ji=1;ho=[];Gi=0;fo=new Map;mo=new Map;constructor(i){this.ji=i;}run(){let i=this.ji-this.Gi;for(let t=0;t<i;t++){let e=this.ho.shift();if(!e)return;let r=this.fo.get(e),s=this.mo.get(e);if(!r||!s)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.Gi+=1,e().finally(()=>{this.fo.delete(e),this.mo.delete(e),this.Gi-=1,this.run();}).then(a=>r(a)).catch(a=>s(a));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,r)=>{this.fo.set(i,e),this.mo.set(i,r),this.ho.push(i),t&&this.run();})}get pending(){return this.ho.length}get running(){return this.Gi}set concurrency(i){this.ji=i,this.run();}get concurrency(){return this.ji}};var Jo=n(()=>({}),"blockCtx"),ts=n(o=>({...Jo(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":n(()=>{o.modalManager?.close(o.$["*currentActivity"]),o.pub("*currentActivity",null);},"*closeModal")}),"activityBlockCtx"),es=n(o=>({...ts(o),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new se(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),"uploaderBlockCtx"),qn=n(o=>({...es(o),"*solution":null,"*lazyPlugins":null}),"solutionBlockCtx");var Ar=class extends j{constructor(t){super(t);this.scopes=new Set;this.listener=this.iu.bind(this),window.addEventListener("paste",this.listener);}static{n(this,"ClipboardLayer");}ru(t){return !!t.closest("uc-url-source")}openUploadList(){this.e.routerLayer.navigateAfterFileAdd();}async iu(t){if(t.clipboardData){for(let e of this.scopes)if(e.isConnected){if(this.ru(t.target))return;switch(this.te.pasteScope){case "global":await this.handlePaste(t);break;case "local":if(!e.contains(t.target))continue;await this.handlePaste(t);break;default:continue}}}}async handlePaste(t){if(!t.clipboardData)return;let e=Array.from(t.clipboardData.items),r=e.map(a=>a.getAsFile()).filter(a=>a!==null),s=e.filter(a=>a.kind==="string"&&a.type==="text/plain").map(a=>new Promise(l=>{a.getAsString(c=>{l(c);});}));r.length>0&&(r.forEach(a=>{this.e.api.addFileFromObject(a,{source:"clipboard"});}),this.openUploadList()),s.length>0&&((await Promise.all(s)).forEach(l=>{this.e.api.addFileFromUrl(l,{source:"clipboard"});}),this.openUploadList());}registerBlock(t){return this.scopes.add(t),()=>{this.scopes.delete(t);}}destroy(){super.destroy(),window.removeEventListener("paste",this.listener),this.scopes.clear();}};var _=Object.freeze({START_FROM:"start-from",CAMERA:"camera",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var kr=class extends j{constructor(){super(...arguments);this.qi=[];}static{n(this,"RouterHooksLayer");}registerAfterFileAddHook(t){return this.qi.push(t),()=>{this.qi=this.qi.filter(e=>e!==t);}}navigateAfterFileAdd(){let e={historyLength:this.e.ctx.read("*history").length};this.qi.some(s=>s(e))||(this.e.ctx.pub("*currentActivity",_.UPLOAD_LIST),this.e.modalManager?.open(_.UPLOAD_LIST));}};var Cu={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function bi(o,i){i.tabIndex=0,i.focus(),o.tabIndex=-1;}n(bi,"focus");function is(o){let i=o.role||o.type||o.tagName;if(!i)return null;let t=Cu[i.toLowerCase()];if(!t)return null;for(let e of t){let r=o.closest(`[role=${e}]`);if(r)return r}}n(is,"findGroupNodeByEventTarget");function rs(o,i){return i.role==="toolbar"?xu(i):i.querySelectorAll(`[role=${o.role}]`)}n(rs,"getItems");function Tu(o,i){return Array.from(o).filter(t=>{let e=t.parentElement;for(;e&&e!==i;){if(e.getAttribute("aria-hidden")==="true")return false;e=e.parentElement;}return true})}n(Tu,"filterNested");function xu(o){return [...o.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}n(xu,"getToolbarItems");function Su(o){let i=o.getAttribute("aria-orientation");if(i==="vertical")return false;if(i==="horizontal")return true;let t=o.role;return t==="menubar"||t==="tablist"||t==="toolbar"}n(Su,"isHorizontalOrientation");function Wn(o){return i=>{let t=false,e=o?.searchDelayMs||300,r=0,s="";function a(d){let m=is(d.target);if(!m){l();return}let f=rs(d.target,m),v=Tu(f,m),w=Array.from(v).indexOf(d.target),E="ArrowDown",T="ArrowUp";if(Su(m)&&(i.document.dir==="rtl"?(E="ArrowLeft",T="ArrowRight"):(E="ArrowRight",T="ArrowLeft")),d.key===E)d.preventDefault(),bi(d.target,v[w+1]||v[0]);else if(d.key===T)d.preventDefault(),bi(d.target,v[w-1]||v[v.length-1]);else if(d.key==="Home")d.preventDefault(),bi(d.target,v[0]);else if(d.key==="End")d.preventDefault(),bi(d.target,v[v.length-1]);else if(d.key.length===1&&m.role!=="tablist"){d.timeStamp-r<=e?s+=d.key.toLowerCase():s=d.key.toLowerCase(),r=d.timeStamp;let C=Array.from(f).find(A=>A.textContent?.trim()?.toLowerCase()?.startsWith(s));C&&(d.preventDefault(),bi(d.target,C));}}n(a,"keyDown");function l(){t=false,i.removeEventListener("keydown",a);}n(l,"stop");function c(d){let m=is(d.target);if(m){t||(t=true,i.addEventListener("keydown",a));let f=rs(d.target,m);for(let v of f)v!==d.target&&v.setAttribute("tabindex",-1);}else t&&l();}n(c,"focusIn");function u(d){(!d.relatedTarget||d.relatedTarget===i.document)&&l();}n(u,"focusOut");function p(d){let m=is(d.target);if(m){let f=rs(d.target,m);for(let v of f)v!==d.target&&v.setAttribute("tabindex",-1);d.target.setAttribute("tabindex",0);}}return n(p,"click"),i.addEventListener("click",p),i.addEventListener("focusin",c),i.addEventListener("focusout",u),()=>{l(),i.removeEventListener("click",p),i.removeEventListener("focusin",c),i.removeEventListener("focusout",u);}}}n(Wn,"focusGroupKeyUX");function Zn(){return o=>{let i,t;function e(s){if(s.target.getAttribute("aria-hidden")==="true"){i=s.target,i.setAttribute("aria-hidden","false"),t=i.hidden,t&&(i.hidden=false);let a=s.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');a&&(a.tabIndex=0);}}n(e,"jump");function r(s){i&&i.contains(s.target)&&(!s.relatedTarget||!i.contains(s.relatedTarget))&&(s.target.tabIndex=-1,i.setAttribute("aria-hidden","true"),t&&(i.hidden=true),i=null);}return n(r,"focusOut"),o.addEventListener("keyuxJump",e),o.addEventListener("focusout",r),()=>{o.removeEventListener("keyuxJump",e),o.removeEventListener("focusout",r);}}}n(Zn,"hiddenKeyUX");function Yn(){return o=>{let i=[];function t(c){let u=o.document.activeElement;u&&u!==o.document.body&&i.push(new WeakRef(u)),c.focus({focusVisible:true});}n(t,"focus");function e(){let c=i.pop();if(!c){o.document.activeElement.blur();return}let u=c.deref();u&&u.isConnected?u.focus():e();}n(e,"back");let r=0,s;function a(c){clearInterval(s);let u=c.getAttribute("aria-controls");s=setInterval(()=>{if(r++>50){clearInterval(s);return}let p=o.document.getElementById(u);if(p){let d=p.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');d&&(clearInterval(s),p.dispatchEvent(new o.CustomEvent("keyuxJump",{bubbles:true})),t(d));}},50);}n(a,"jump");function l(c){c.target.getAttribute("aria-controls")&&c.key==="Enter"&&a(c.target),c.key==="Escape"&&e();}return n(l,"keyDown"),o.addEventListener("keydown",l),()=>{o.removeEventListener("keydown",l);}}}n(Yn,"jumpKeyUX");function Xn(o){let i,t=o.split(" "),e;function r(l){(l.key==="Enter"||l.key===" ")&&(l.target.tagName==="BUTTON"||l.target.tagName==="A")&&(s(),l.target.classList.add(...t),i=l.target,e=l.target);}n(r,"keyDown");function s(){i&&(i.classList.remove(...t),i=0,setTimeout(()=>{e=0;},0));}n(s,"keyUp");function a(l){l.clientX===0&&l.clientY===0&&i!==l.target&&(s(),e!==l.target&&(l.target.classList.add(...t),i=l.target));}return n(a,"click"),l=>(l.addEventListener("click",a),l.addEventListener("keydown",r),l.addEventListener("keyup",s),()=>{l.removeEventListener("click",a),l.removeEventListener("keydown",r),l.removeEventListener("keyup",s);})}n(Xn,"pressKeyUX");function Qn(o,i){let t=i.map(e=>e(o));return ()=>{t.forEach(e=>e());}}n(Qn,"startKeyUX");var os=class{constructor(){this.mt=new Map;this.go=[];}static{n(this,"ScopedMinimalWindow");}addEventListener(i,t){let e=n(r=>{let s=r.target;s instanceof Node&&this.go.some(a=>a===s||a.contains(s))&&t(r);},"wrappedListener");this.mt.set(t,e),window.addEventListener(i,e);}removeEventListener(i,t){let e=this.mt.get(t);e&&window.removeEventListener(i,e),this.mt.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this.go.push(i);}destroy(){this.go=[];for(let i of this.mt.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.mt.clear();}},Mr=class{static{n(this,"A11y");}constructor(){this.Wi=new os,this.Tn=Qn(this.Wi,[Wn(),Xn("is-pressed"),Yn(),Zn()]);}registerBlock(i){this.Wi.registerScope(i);}destroy(){this.Tn?.(),this.Wi.destroy();}};var Yt=n(o=>`*l10n/${o}`,"localeStateKey"),Au="en",Ir=class extends j{constructor(t){super(t);this.Ce="";for(let[r,s]of Object.entries(gi)){let a=this.i.has(Yt(r))?!this.i.read(Yt(r)):true;this.i.add(Yt(r),s,a);}let e=t.pluginManager;e?.onPluginsChange&&this.addSub(e.onPluginsChange(()=>{this.Ce&&this.Sn(this.Ce);})),this.addSub(this.i.sub(S("localeName"),async r=>{if(!r)return;this.Ce=r;let s=await Tn(r);r!==Au&&this.Ce!==r||(this.Sn(r),this.An(r,s));})),this.addSub(this.i.sub(S("localeDefinitionOverride"),r=>{if(!r)return;let s=r[this.Ce];s&&this.An(this.Ce,s);}));}static{n(this,"LocaleManager");}An(t,e){let r=this.te.localeDefinitionOverride?.[t];for(let[s,a]of Object.entries(e)){let l=r?.[s];this.i.add(Yt(s),l??a,true);}}Sn(t){let e=this.e.pluginManager;if(!e)return;let r=e.snapshot();for(let s of r.l10n){let{pluginId:a,...l}=s,c=l[t];if(c)for(let[u,p]of Object.entries(c))p!==void 0&&this.i.add(Yt(u),p,true);}}};var ku=n(()=>{let o=navigator.userAgent;return /Macintosh|Windows/.test(o)&&/Version\/[\d.]+.*Safari/.test(o)&&!/Chrome|Chromium|Edg|OPR/.test(o)},"calcIsDesktopSafari"),Mu=n(()=>"capture"in document.createElement("input"),"calcHtmlMediaCaptureSupport"),Iu=n(()=>({safariDesktop:ku()}),"calcBrowserInfo"),Ou=n(()=>({htmlMediaCapture:Mu()}),"calcBrowserFeatures"),Jn=Iu(),ta=Ou();var wi="image/*",ss="video/*",Lu=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Pu=n(()=>Jn.safariDesktop?[wi]:[wi,...Lu],"calcImageAcceptList"),Ei=Pu(),Or=n(o=>o?o.filter(i=>typeof i=="string").flatMap(i=>Y(i)):[],"mergeFileTypes"),ns=n((o,i)=>i.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return o.startsWith(e)}return o===t}),"matchMimeType"),ea=n((o,i)=>i.some(t=>t.startsWith(".")?o.toLowerCase().endsWith(t.toLowerCase()):false),"matchExtension"),Be=n(o=>{let i=o?.type;return i?ns(i,Ei):false},"fileIsImage");function ia(o,i,t,e,r){return {registry:{registerSource:n(u=>o.addSource(e,u),"registerSource"),registerActivity:n(u=>o.addActivity(e,u),"registerActivity"),registerFileAction:n(u=>o.addFileAction(e,u),"registerFileAction"),registerFileHook:n(u=>o.addFileHook(e,u),"registerFileHook"),registerIcon:n(u=>o.addIcon(e,u),"registerIcon"),registerL10n:n(u=>o.addL10n(e,u),"registerL10n"),registerConfig:n(u=>{o.addConfig(e,u);let p=S(u.name);i.has(p)||i.add(p,u.defaultValue);},"registerConfig")},config:{get:n(u=>{let p=S(u);return i.read(p)},"get"),subscribe:n((u,p)=>{let d=S(u),m=i.sub(d,f=>{p(f);});return r.push(m),m},"subscribe")},activity:{getParams:n(()=>i.read("*currentActivityParams"),"getParams"),subscribeToParams:n(u=>{let p=i.sub("*currentActivityParams",d=>{u(d);});return r.push(p),p},"subscribeToParams")},files:{update:n((u,p)=>{let d=t.uploadCollection?.read(u);d&&(p.file!==void 0&&(d.setValue("file",p.file),d.setValue("fileSize",p.file.size)),p.cdnUrl!==void 0&&d.setValue("cdnUrl",p.cdnUrl),p.cdnUrlModifiers!==void 0&&d.setValue("cdnUrlModifiers",p.cdnUrlModifiers),p.mimeType!==void 0&&d.setValue("mimeType",p.mimeType));},"update")}}}n(ia,"buildPluginApi");var Uu=n(async({entries:o,signal:i})=>(await Promise.all(o.map(async e=>{if(e.isEnabled())try{let r=await e.load();return i.aborted||!e.isEnabled()?void 0:r??void 0}catch(r){i.aborted||console.warn("Failed to load lazy plugin",r);return}}))).filter(e=>e!==void 0),"resolveLazyPlugins"),Lr=class{constructor(i,t){this.i=i;this.su=t;this.ei=new Set;this.kn=this.i.sub("*lazyPlugins",e=>{this.ou(e??[]);});}static{n(this,"LazyPluginLoader");}ou(i){for(let r of this.ei)r();if(this.ei.clear(),i.length===0)return;let t=new Set([S("plugins")]);for(let r of i)for(let s of r.configDeps)t.add(S(s));let e=n(()=>this.Mn(i),"recompute");for(let r of t)this.ei.add(this.i.sub(r,e,false));this.Mn(i);}Mn(i){this.vo?.abort();let t=new AbortController;this.vo=t;let e=n(a=>this.i.read(S(a)),"get"),r=e("plugins"),s=Uu({entries:i.map(a=>({isEnabled:n(()=>a.isEnabled(e),"isEnabled"),load:a.load})),signal:t.signal}).then(a=>{if(!t.signal.aborted)return [...r,...a]});this.su(s);}destroy(){this.kn();for(let i of this.ei)i();this.ei.clear(),this.vo?.abort();}};var Pr=class{constructor(){this.ie=new Map;}static{n(this,"CustomConfigRegistry");}register(i,t){if(this.ie.has(t.name)){console.warn(`[CustomConfig] Config option "${t.name}" is already registered`);return}let e={attribute:true,...t,pluginId:i};this.ie.set(t.name,e);}unregister(i){this.ie.delete(i);}unregisterByPlugin(i){for(let[t,e]of this.ie)e.pluginId===i&&this.ie.delete(t);}get(i){return this.ie.get(i)}getAll(){return new Map(this.ie)}};var Ur=class{constructor(){this.z=[];this.Ct=[];this.Zi=[];this.Yi=[];this.Xi=[];this.Te=[];this.config=new Pr;}static{n(this,"PluginRegistry");}Se(i,t){return {...t,pluginId:i}}addSource(i,t){let e=this.z.find(r=>r.id===t.id);if(e){console.warn(`[Plugin "${i}"] Source with id "${t.id}" is already registered by plugin "${e.pluginId}". Skipping.`);return}this.z.push(this.Se(i,t));}addActivity(i,t){let e=this.Ct.find(r=>r.id===t.id);if(e){console.warn(`[Plugin "${i}"] Activity with id "${t.id}" is already registered by plugin "${e.pluginId}". Skipping.`);return}this.Ct.push(this.Se(i,t));}addFileAction(i,t){this.Zi.push(this.Se(i,t));}addFileHook(i,t){this.Yi.push(this.Se(i,{timeout:3e4,...t}));}addIcon(i,t){this.Xi.push(this.Se(i,t));}addL10n(i,t){this.Te.push(this.Se(i,t));}addConfig(i,t){this.config.register(i,t);}purge(i){this.z=this.z.filter(t=>t.pluginId!==i),this.Ct=this.Ct.filter(t=>t.pluginId!==i),this.Zi=this.Zi.filter(t=>t.pluginId!==i),this.Yi=this.Yi.filter(t=>t.pluginId!==i),this.Xi=this.Xi.filter(t=>t.pluginId!==i),this.Te=this.Te.filter(t=>t.pluginId!==i),this.config.unregisterByPlugin(i);}snapshot(){return {sources:[...this.z],activities:[...this.Ct],fileActions:[...this.Zi],fileHooks:[...this.Yi],icons:[...this.Xi],l10n:[...this.Te]}}};var Rr=class extends j{constructor(t){super(t);this.re=new Map;this.c=new Set;this.yo=Promise.resolve();this.registry=new Ur;this.On=new Lr(this.i,e=>{this.yo=this.yo.then(()=>e).then(r=>{if(r)return this.nu(r)});});}static{n(this,"PluginManager");}get configRegistry(){return this.registry.config}pluginsReady(){return this.yo}onPluginsChange(t){return this.c.add(t),()=>{this.c.delete(t);}}async nu(t){let e=new Set(this.re.keys()),r=new Set;for(let s of t){if(!s.id){console.warn('[PluginManager] A plugin is missing the required "id" field, skipping');continue}if(r.has(s.id)){console.warn(`[PluginManager] Plugin "${s.id}" is already in the list, skipping duplicate`);continue}if(r.add(s.id),!this.re.has(s.id))try{await this.au(s);}catch(a){this.registry.purge(s.id),this.bo(),console.error(`[PluginManager] Plugin "${s.id}" setup() threw an error`,a);}e.delete(s.id);}for(let s of e)this.wo(s);}async au(t){this.re.has(t.id)&&this.wo(t.id);let e=[],r=ia(this.registry,this.i,this.e,t.id,e),s=this.e.api,a;try{a=await t.setup({pluginApi:r,uploaderApi:s})??void 0;}catch(l){for(let c of e)try{c();}catch(u){this.w("Failed to unsubscribe config listener",u);}throw l}this.re.set(t.id,{plugin:t,dispose:a,configSubscriptions:e}),this.bo();}wo(t){let e=this.re.get(t);if(e){this.registry.purge(t);for(let r of e.configSubscriptions)try{r();}catch(s){this.w("Failed to unsubscribe config listener",s);}e.dispose?.(),this.re.delete(t),this.bo();}}snapshot(){return this.registry.snapshot()}async runOnAddHooks(t){let e=t.getValue("file");if(!e)return;let r=this.registry.snapshot().fileHooks.filter(l=>l.type==="onAdd");if(r.length===0)return;let s=e,a=new AbortController;for(let l of r){if(a.signal.aborted)break;try{let c=l.handler({file:s,signal:a.signal}),u=new Promise((p,d)=>setTimeout(()=>d(new Error("onAdd hook timed out")),l.timeout));({file:s}=await Promise.race([c,u]));}catch(c){console.warn(`File hook "onAdd" from plugin "${l.pluginId}" failed`,c);}}s!==e&&(t.setValue("file",s),t.setValue("fileSize",s.size),t.setValue("mimeType",s.type||null),t.setValue("isImage",Be(s)),s instanceof File&&t.setValue("fileName",s.name));}destroy(){for(let t of Array.from(this.re.keys()))this.wo(t);this.On.destroy(),super.destroy();}bo(){for(let t of this.c)try{t();}catch{}}};function Ru(o){return o.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}n(Ru,"i");function ls(o){return Array.isArray(o)?o.map(i=>typeof i=="object"&&i!==null?ls(i):i):typeof o!="object"||o===null?o:Object.fromEntries(Object.entries(o).map(([i,t])=>{let e=Ru(i);return typeof t=="object"&&t!==null?[e,ls(t)]:[e,t]}))}n(ls,"c");function $u(o){return {ok:true,value:o}}n($u,"u");function as(o){return {ok:false,error:o}}n(as,"a");var Du="https://tlm.uploadcare.com/api/",cs=class{static{n(this,"y");}constructor(i=Du){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let r=await fetch(e,t);if(!r.ok)return as(new Error(`Got non-200 response from "${e}". Status: ${r.status.toString()}`));try{let s=await r.json();return $u(s)}catch(s){return as(new Error(`Error parsing JSON from "${e}". Error: ${s}`))}}catch(r){return as(new Error(`Error fetching data from "${e}". Error: ${r}`))}}async post(i,t,e={}){return await this.base(i,{...e,method:"POST",body:JSON.stringify(ls(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},Fu=n(async(o,i)=>({success:true,data:i}),"p"),Vu=n(async o=>Fu(void 0,o),"f"),$r=class extends cs{static{n(this,"h");}constructor(){super();}async sendEvent(i,t){let e=await Vu(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 Nu=20,F=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),k=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"}),Dr=class extends j{constructor(){super(...arguments);this.ii=new Map;this.Qi=new Set;this.mt=new Map;}static{n(this,"EventEmitter");}bindTarget(t){return this.Qi.add(t),()=>{this.Qi.delete(t);}}on(t,e){let r=this.mt.get(t);return r||(r=new Set,this.mt.set(t,r)),r.add(e),()=>this.mt.get(t)?.delete(e)}In(t,e){for(let s of this.Qi)s.dispatchEvent(new CustomEvent(t,{detail:e}));let r=this.mt.get(t);if(r)for(let s of r)s(e);this.w?.(()=>{let s=e&&typeof e=="object"?{...e}:e;return [`event "${t}"`,s]});}emit(t,e,r={}){let{debounce:s}=r;if(typeof s!="number"&&!s){this.In(t,typeof e=="function"?e():e);return}this.ii.has(t)&&window.clearTimeout(this.ii.get(t));let a=typeof s=="number"?s:Nu,l=window.setTimeout(()=>{try{let c=typeof e=="function"?e():e;this.In(t,c),this.ii.delete(t);}catch(c){this.w?.(()=>`Error while getting payload for event "${t}"`,c);}},a);this.ii.set(t,l);}destroy(){for(let t of this.ii.values())window.clearTimeout(t);this.Qi.clear(),this.mt.clear();}};var ra="1.30.0-alpha.6";var Rt="blocks",$t=ra;var Fr=class extends j{constructor(t){super(t);this.lu=ot.generateRandomUUID();this.Ae=structuredClone(tt);this.xo=false;this.Eo=null;this.Bt=false;this.Pn=new $r,this.ke=new se(10),this.addSub(this.i.sub(S("qualityInsights"),e=>{this.Bt=!!e;}));for(let e of Object.keys(this.Ae))this.addSub(this.i.sub(S(e),r=>{this.Bt&&(this.xo&&this.Ae[e]!==r&&this.sendEvent({eventType:F.CHANGE_CONFIG}),this.cu(e,r));}));}static{n(this,"TelemetryManager");}uu(t){t===F.INIT_SOLUTION&&!this.xo&&(this.xo=true);}cu(t,e){this.Ae[t]!==e&&(this.Ae[t]=e);}du(t){let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let r={...t};return (t.eventType===F.INIT_SOLUTION||t.eventType===F.CHANGE_CONFIG)&&(r.config=this.Ae),{...r,appVersion:$t,appName:Rt,sessionId:this.lu,component:this.pu,activity:this.hu,projectPubkey:this.Ae.pubkey,userAgent:navigator.userAgent,eventType:r.eventType??"",eventTimestamp:this.fu,payload:{location:this.mu,...e}}}gu(t){return !!(t&&[k.CHANGE,k.COMMON_UPLOAD_PROGRESS,k.FILE_ADDED,k.FILE_REMOVED,k.FILE_UPLOAD_START,k.FILE_UPLOAD_PROGRESS,k.FILE_UPLOAD_SUCCESS,k.FILE_UPLOAD_FAILED].includes(t))}sendEvent(t){if(!this.Bt)return;let e=this.du({eventType:t.eventType,payload:t.payload,config:t.config});this.uu(t.eventType),!(this.gu(t.eventType)||this.Eo&&this.Ln(this.Eo,e))&&this.ke.add(async()=>{this.Eo=e,await this.Pn.sendEvent(e);});}sendEventError(t,e="unknown"){this.sendEvent({eventType:F.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}});}sendEventCloudImageEditor(t,e,r={}){this.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{tabId:e,node:t.currentTarget?.tagName,event:t.type,...r}}});}Ln(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 r=Object.keys(t),s=Object.keys(e);if(r.length!==s.length)return false;for(let a of r)if(!Object.hasOwn(e,a)||!this.Ln(t[a],e[a]))return false;return true}get fu(){return Date.now()}get pu(){if(!this.i.has("*solution"))return null;let t=this.i.read("*solution");return t?t.toLowerCase():null}get hu(){return this.i.has("*currentActivity")?this.i.read("*currentActivity"):null}get mu(){return location.origin}};var oa=n(o=>{let i=new Intl.Locale(o),t="ltr",e=i.getTextInfo?.().direction;return e?t=e:i.textInfo?.direction&&(t=i.textInfo.direction),t},"getLocaleDirection");var Bu=n(o=>o,"DEFAULT_TRANSFORMER"),us="{{",na="}}",sa="plural:";function ze(o,i={},t={}){let{openToken:e=us,closeToken:r=na,transform:s=Bu}=t;for(let a in i){let l=i[a],c=l?.toString(),u=typeof c=="string"?s(c):String(c);o=o.replaceAll(e+a+r,u);}return o}n(ze,"applyTemplateData");function aa(o){let i=[],t=o.indexOf(us);for(;t!==-1;){let e=o.indexOf(na,t);if(e===-1)break;let r=o.substring(t+2,e);if(r.startsWith(sa)){let s=o.substring(t+2,e).replace(sa,""),a=s.substring(0,s.indexOf("(")),l=s.substring(s.indexOf("(")+1,s.indexOf(")"));i.push({variable:r,pluralKey:a,countVariable:l});}t=o.indexOf(us,e);}return i}n(aa,"getPluralObjects");var la="--uploadcare-blocks-window-height",Ci=class o{static{n(this,"WindowHeightTracker");}static{this.clientsRegistry=new Set;}static{this.flush=V(()=>{document.documentElement.style.setProperty(la,`${window.innerHeight}px`);},100);}static registerClient(i){o.clientsRegistry.size===0&&o.attachTracker(),o.clientsRegistry.add(i);}static unregisterClient(i){o.clientsRegistry.delete(i),o.clientsRegistry.size===0&&o.detachTracker();}static attachTracker(){window.addEventListener("resize",o.flush,{passive:true,capture:true}),o.flush();}static detachTracker(){window.removeEventListener("resize",o.flush,{capture:true}),document.documentElement.style.removeProperty(la);}};var Vr=n((o,i)=>new Intl.PluralRules(o).select(i),"getPluralForm");var zu=n(o=>(i,t)=>{let e=o(),r=e("locale-id")||"en",s=Vr(r,t);return e(`${i}__${s}`)},"createPluralizer"),Nr=n(o=>{let i=zu(()=>t),t=n((e,r={})=>{if(!e)return "";let a=o().read(Yt(e))||e,l=aa(a);for(let u of l)r[u.variable]=i(u.pluralKey,Number(r[u.countVariable]));return ze(a,r)},"l10n");return t},"createL10n");var Hu=n(o=>o.tagName?.includes("-")??false,"isCustomElement"),_r=class{constructor(i){this.oe=new Set;this.Ji=new Map;this.Rn=false;this.se=i,this.se.addController(this);}static{n(this,"TestModeController");}hostDisconnected(){this.tr?.(),this.tr=void 0,this.oe.clear(),this.Ji.clear();}hostUpdated(){if(!this.tr&&this.se.has(S("testMode"))){let i=this.se.subConfigValue("testMode",t=>{this.Rn=!!t,this.Un();});this.tr=i;}this.vu(),this.Un();}vu(){let i=this.se,t=i.renderRoot??i;if(!t)return;let e=this.se,r=e.tagName?.toLowerCase(),s=Array.from(t.querySelectorAll("[data-testid]")).filter(a=>!Hu(a));for(let a of s)if(!(r&&a.closest(r)!==e)&&!this.oe.has(a)){let l=a.getAttribute("data-testid");if(!l)continue;this.oe.add(a),this.Ji.set(a,l);}for(let a of Array.from(this.oe))(!a.isConnected||r&&a.closest(r)!==e)&&(this.oe.delete(a),this.Ji.delete(a));}Un(){if(!this.oe.size)return;let i=this.se.testId||"";for(let t of this.oe){let e=this.Ji.get(t);e&&(this.Rn?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var Ku=De(pr()($e(cr(xt)))),x=class extends Ku{constructor(){super();this.init$=Jo();this.l10n=Nr(()=>this.sharedCtx);this.debugPrint=vr(()=>this.sharedCtx,this.constructor.name);this.e=Un(()=>this.sharedCtx);new _r(this);}static{n(this,"LitBlock");}static{this.styleAttrs=[];}emit(t,e,r){let s=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;if(!s)return;s.emit(t,e,r);let a=typeof e=="function"?e():e;this.telemetryManager.sendEvent({eventType:t,payload:a??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(),Ci.registerClient(this);}initCallback(){this.Y("*blocksRegistry",()=>new Set),this.Y("*pluginManager",t=>new Rr(t)),this.Y("*eventEmitter",t=>new Dr(t)),this.Y("*localeManager",t=>new Ir(t)),this.Y("*modalManager",t=>new yr(t)),this.Y("*a11y",()=>new Mr),this.Y("*routerLayer",t=>new kr(t)),this.Y("*clipboard",t=>new Ar(t)),this.Y("*telemetryManager",t=>new Fr(t)),this.sub(Yt("locale-id"),t=>{let e=oa(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.Q("*modalManager",false)}get telemetryManager(){return this.Q("*telemetryManager")}get localeManager(){return this.Q("*localeManager")}get a11y(){return this.Q("*a11y")}get clipboardLayer(){return this.Q("*clipboard")}get routerLayer(){return this.Q("*routerLayer")}get blocksRegistry(){return this.Q("*blocksRegistry")}get eventEmitter(){return this.Q("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),Ci.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),t?.size===0&&setTimeout(()=>{this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.yu(),K.deleteCtx(this.ctxName);}$n(){let t="*sharedContextInstances";if(!this.has(t)||!this.$[t]){let e=new Map;this.add(t,e,true);}return this.$[t]}Y(t,e){let r=this.$n();if(!r.has(t)&&(!this.has(t)||!this.$[t])){let s=e(this.e);this.add(t,s,true),r.set(t,s);return}}yu(){let t=this.$n();for(let[e,r]of t.entries())r?.destroy?.(),this.pub(e,null);t.clear();}Q(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:fr(t),cdnUrlModifiers:Vo(t),fileName:mr(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?ze(this.cfg.secureDeliveryProxy,{previewUrl:t},{transform:n(e=>window.encodeURIComponent(e),"transform")}):t}get cfg(){if(!this.Jt){let t={};this.Jt=new Proxy(t,{set:n((e,r,s)=>{if(typeof r!="string"||!(r in tt))return false;let a=r,l=S(a);return this.has(l)||this.add(l,tt[a]),this.$[l]=s,true},"set"),get:n((e,r)=>{let s=S(r);return this.has(s)||this.add(s,tt[r]),this.$[s]},"get")});}return this.Jt}subConfigValue(t,e){let r=S(t);return this.has(r)||this.add(r,tt[t]),this.sub(r,e)}};var Dt={ATTRIBUTE:1,CHILD:2},lt=n(o=>(...i)=>({io:o,values:i}),"e"),mt=class{static{n(this,"i");}constructor(i){}get X(){return this.f.X}ro(i,t,e){this.er=i,this.f=t,this.bu=e;}Wc(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var Se=class extends mt{static{n(this,"e");}constructor(i){if(super(i),this.it=U,i.type!==Dt.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===U||i==null)return this.Dn=void 0,this.it=i;if(i===rt)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.Dn;this.it=i;let t=[i];return t.raw=t,this.Dn={Nt:this.constructor.resultType,strings:t,values:[]}}};Se.directiveName="unsafeHTML",Se.resultType=1;lt(Se);var Ti=class extends Se{static{n(this,"t");}};Ti.directiveName="unsafeSVG",Ti.resultType=2;var He=lt(Ti);var ca="<svg width='0' height='0' style='position:absolute'><symbol viewBox='0 0 24 24' id='uc-icon-about' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.152 14.12v.1h1.523v-.1c.007-.409.053-.752.138-1.028.086-.277.22-.517.405-.72.188-.202.434-.397.735-.586.32-.191.593-.412.82-.66.232-.249.41-.531.533-.847.125-.32.187-.678.187-1.076 0-.579-.137-1.085-.41-1.518a2.717 2.717 0 0 0-1.14-1.018c-.49-.245-1.062-.367-1.715-.367-.597 0-1.142.114-1.636.34-.49.228-.884.564-1.182 1.008-.299.44-.46.98-.485 1.619h1.62c.024-.377.118-.684.282-.922a1.48 1.48 0 0 1 .617-.532c.25-.114.51-.17.784-.17.301 0 .575.063.82.191.248.124.447.302.597.533.149.23.223.504.223.82 0 .263-.05.502-.149.72a1.91 1.91 0 0 1-.405.574 3.48 3.48 0 0 1-.575.453 4.22 4.22 0 0 0-.847.66c-.234.242-.415.558-.543.949-.125.39-.19.916-.197 1.577Zm.053 3.03c.21.206.46.31.75.31.196 0 .374-.049.534-.144a1.1 1.1 0 0 0 .383-.384c.1-.163.15-.343.15-.538a1 1 0 0 0-.32-.746 1.019 1.019 0 0 0-.746-.314c-.291 0-.542.105-.751.314-.21.206-.314.455-.314.746 0 .295.104.547.314.756ZM24 12c0 6.627-5.373 12-12 12S0 18.627 0 12 5.373 0 12 0s12 5.373 12 12Zm-1.5 0c0 5.799-4.701 10.5-10.5 10.5S1.5 17.799 1.5 12 6.201 1.5 12 1.5 22.5 6.201 22.5 12Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-add' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.75 21a.75.75 0 0 1-1.5 0v-8.25H3a.75.75 0 0 1 0-1.5h8.25V3a.75.75 0 0 1 1.5 0v8.25H21a.75.75 0 0 1 0 1.5h-8.25V21Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-arrow-down' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.5 23.03a.75.75 0 0 0 .999 0l9.29-8.276a.75.75 0 0 0-.998-1.12l-8.042 7.164V1.53a.75.75 0 0 0-1.5 0v19.267l-8.04-7.163a.75.75 0 0 0-.998 1.12z'/></symbol><symbol fill='none' viewBox='0 0 24 24' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path d='M19.248 9.561 12 16.003 4.752 9.561l.996-1.122L12 13.995l6.252-5.556z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='M7.395 22.5H2.454v-5.25m14.824 5.25h4.94v-5.25m0-10.5V1.5h-4.94m-9.883 0H2.454v5.25'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-back' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M20.251 12a.75.75 0 0 1-.75.75H6.067l5.72 5.85a.75.75 0 1 1-1.072 1.05L4.136 12.92a1.292 1.292 0 0 1 0-1.842l6.579-6.728a.75.75 0 1 1 1.072 1.048l-5.72 5.851H19.5a.75.75 0 0 1 .75.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.6 18.4a1.6 1.6 0 1 1-3.2 0 1.6 1.6 0 0 1 3.2 0zM12 4.5A1.5 1.5 0 0 1 13.5 6v7a1.5 1.5 0 0 1-3 0V6A1.5 1.5 0 0 1 12 4.5z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-badge-success' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m10.5 18.204 7.6-8.183a1.5 1.5 0 0 0-2.2-2.042l-5.4 5.817-2.4-2.586a1.5 1.5 0 1 0-2.2 2.041l4.6 4.953Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-box' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M1.01 4.148a.75.75 0 0 1 .75.75v4.348a4.437 4.437 0 0 1 2.988-1.153c1.734 0 3.23.992 3.978 2.438a4.478 4.478 0 0 1 3.978-2.438c2.49 0 4.488 2.044 4.488 4.543 0 2.5-1.999 4.544-4.488 4.544a4.478 4.478 0 0 1-3.978-2.438 4.478 4.478 0 0 1-3.978 2.438C2.26 17.18.26 15.135.26 12.636V4.898a.75.75 0 0 1 .75-.75Zm.75 8.488c0 1.692 1.348 3.044 2.988 3.044s2.989-1.352 2.989-3.044c0-1.691-1.349-3.043-2.989-3.043S1.76 10.945 1.76 12.636Zm10.944-3.043c-1.64 0-2.988 1.352-2.988 3.043 0 1.692 1.348 3.044 2.988 3.044s2.988-1.352 2.988-3.044c0-1.69-1.348-3.043-2.988-3.043Zm4.328-1.23a.75.75 0 0 1 1.052.128l2.333 2.983 2.333-2.983a.75.75 0 0 1 1.181.924l-2.562 3.277 2.562 3.276a.75.75 0 1 1-1.181.924l-2.333-2.983-2.333 2.983a.75.75 0 1 1-1.181-.924l2.562-3.276-2.562-3.277a.75.75 0 0 1 .129-1.052Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-camera-full' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' clip-rule='evenodd' d='M2 4.667a2 2 0 0 0-2 2V16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6.667a2 2 0 0 0-2-2h-2.667l-2-2.667H6.667l-2 2.667H2Zm8 10a3.667 3.667 0 1 0 0-7.334 3.667 3.667 0 0 0 0 7.334Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-close' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M4.604 4.604a.75.75 0 0 1 1.06 0L12 10.939l6.335-6.335a.75.75 0 1 1 1.061 1.06L13.061 12l6.335 6.335a.75.75 0 1 1-1.06 1.061L12 13.061l-6.335 6.335a.75.75 0 0 1-1.061-1.06L10.939 12 4.604 5.665a.75.75 0 0 1 0-1.061z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-collapse' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3.116 12a.75.75 0 0 1 .75-.75h16.268a.75.75 0 0 1 0 1.5H3.866a.75.75 0 0 1-.75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-default' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-dropbox' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.019 1.92a.75.75 0 0 1 .806 0L12 5.219l5.176-3.297a.75.75 0 0 1 .806 0l5.577 3.553a.75.75 0 0 1 0 1.265l-4.574 2.914 4.574 2.914a.75.75 0 0 1 0 1.265l-5.577 3.554a.75.75 0 0 1-.806 0L12 14.089l-5.175 3.297a.75.75 0 0 1-.806 0L.44 13.833a.75.75 0 0 1 0-1.266l4.575-2.914L.44 6.74a.75.75 0 0 1 0-1.265zm.403 8.616L2.24 13.2l4.182 2.664 4.181-2.664zm6.975 2.664 4.182 2.664L21.76 13.2l-4.181-2.664zm2.776-3.547L12 12.311 7.828 9.653 12 6.995zm1.406-.882 4.181-2.664-4.181-2.664-4.182 2.664zm-6.976-2.664L6.422 3.443 2.24 6.107 6.422 8.77zM5.791 18.544a.75.75 0 0 1 1.035-.23l5.175 3.297 5.175-3.297a.75.75 0 1 1 .806 1.265l-5.578 3.554a.75.75 0 0 1-.806 0L6.02 19.579a.75.75 0 0 1-.23-1.035z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-evernote' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M9.804 2.27v-.048c.055-.263.313-.562.85-.562h.44c.142 0 .325.014.526.033.066.009.124.023.267.06l.13.032h.002c.319.079.515.275.644.482a1.461 1.461 0 0 1 .16.356l.004.012a.75.75 0 0 0 .603.577l1.191.207a1988.512 1988.512 0 0 0 2.332.402c.512.083 1.1.178 1.665.442.64.3 1.19.795 1.376 1.77.548 2.931.657 5.829.621 8a39.233 39.233 0 0 1-.125 2.602 17.518 17.518 0 0 1-.092.849.735.735 0 0 0-.024.112c-.378 2.705-1.269 3.796-2.04 4.27-.746.457-1.53.451-2.217.447h-.192c-.46 0-1.073-.23-1.581-.635-.518-.412-.763-.87-.763-1.217 0-.45.188-.688.355-.786.161-.095.436-.137.796.087a.75.75 0 1 0 .792-1.274c-.766-.476-1.64-.52-2.345-.108-.7.409-1.098 1.188-1.098 2.08 0 .996.634 1.84 1.329 2.392.704.56 1.638.96 2.515.96l.185.002c.667.009 1.874.025 3.007-.67 1.283-.786 2.314-2.358 2.733-5.276a4.213 4.213 0 0 0 .056-.335c.023-.184.051-.445.079-.772.055-.655.111-1.585.13-2.704.037-2.234-.074-5.239-.647-8.301v-.002c-.294-1.544-1.233-2.391-2.215-2.85-.777-.363-1.623-.496-2.129-.576a8.872 8.872 0 0 1-.25-.041l-.006-.001-1.99-.345-.761-.132a2.93 2.93 0 0 0-.182-.338A2.532 2.532 0 0 0 12.379.329l-.091-.023a3.967 3.967 0 0 0-.493-.103L11.769.2a7.846 7.846 0 0 0-.675-.04h-.44c-.733 0-1.368.284-1.795.742L2.416 7.431c-.468.428-.751 1.071-.751 1.81 0 .02 0 .041.003.062l.003.034c.017.21.038.468.096.796.107.715.275 1.47.391 1.994.029.13.055.245.075.342l.002.008c.258 1.141.641 1.94.978 2.466.168.263.323.456.444.589a2.808 2.808 0 0 0 .192.194c1.536 1.562 3.713 2.196 5.731 2.08.13-.005.35-.032.537-.073a2.627 2.627 0 0 0 .652-.24c.425-.26.75-.661.992-1.046.184-.294.342-.61.473-.915a3.8 3.8 0 0 0 .627.493 5.022 5.022 0 0 0 1.97.709l.023.002.018.003.11.016c.088.014.205.035.325.058l.056.014c.088.022.164.04.235.061a1.736 1.736 0 0 1 .145.048l.03.014c.765.34 1.302 1.09 1.302 1.871a.75.75 0 0 0 1.5 0c0-1.456-.964-2.69-2.18-3.235a3.595 3.595 0 0 0-.679-.217l-.063-.015a10.616 10.616 0 0 0-.606-.105l-.02-.003-.03-.003h-.002a3.542 3.542 0 0 1-1.331-.485c-.471-.298-.788-.692-.828-1.234a.75.75 0 0 0-1.48-.106l-.001.003-.004.017a8.23 8.23 0 0 1-.092.352 9.963 9.963 0 0 1-.298.892c-.132.34-.29.68-.47.966-.174.276-.339.454-.478.549a1.178 1.178 0 0 1-.221.072 1.949 1.949 0 0 1-.241.036h-.013l-.032.002c-1.684.1-3.423-.437-4.604-1.65a.746.746 0 0 0-.053-.05L4.84 14.6a1.348 1.348 0 0 1-.07-.073 2.99 2.99 0 0 1-.293-.392c-.242-.379-.558-1.014-.778-1.985a54.1 54.1 0 0 0-.083-.376 27.494 27.494 0 0 1-.367-1.872l-.003-.02a6.791 6.791 0 0 1-.08-.67c.004-.277.086-.475.2-.609l.067-.067a.63.63 0 0 1 .292-.145h.05c.18 0 1.095.055 2.013.115l1.207.08.534.037a.747.747 0 0 0 .052.002c.782 0 1.349-.206 1.759-.585l.005-.005c.553-.52.622-1.225.622-1.76V6.24l-.026-.565A774.97 774.97 0 0 1 9.885 4.4c-.042-.961-.081-1.939-.081-2.13ZM4.995 6.953a251.126 251.126 0 0 1 2.102.137l.508.035c.48-.004.646-.122.715-.185.07-.068.146-.209.147-.649l-.024-.548a791.69 791.69 0 0 1-.095-2.187L4.995 6.953Zm16.122 9.996Zm-5.479-5.323a.75.75 0 0 0 1.014.31 2.04 2.04 0 0 1 .304-.089 1.84 1.84 0 0 1 .544-.039c.215.023.321.06.37.085.033.016.039.026.047.04a.75.75 0 0 0 1.289-.767c-.337-.567-.906-.783-1.552-.85a3.334 3.334 0 0 0-1.002.062c-.27.056-.531.14-.705.234a.75.75 0 0 0-.31 1.014Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-expand' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m12 8.337-8.47 8.47a.75.75 0 0 1-1.06-1.06l8.605-8.606a1.29 1.29 0 0 1 1.85 0l8.605 8.605a.75.75 0 1 1-1.06 1.06L12 8.338Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-external-source-placeholder' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-facebook' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12 1.5C6.201 1.5 1.5 6.201 1.5 12c0 4.943 3.416 9.089 8.016 10.204v-6.108H7.383a.75.75 0 0 1-.75-.75v-3.281a.75.75 0 0 1 .75-.75h2.133V9.393c0-.958.225-2.511 1.38-3.65 1.194-1.177 3.174-1.718 6.254-1.056a.75.75 0 0 1 .592.733v2.754a.75.75 0 0 1-.75.75c-.692 0-1.203.026-1.584.082-.387.057-.578.137-.675.202-.109.073-.237.205-.237 1.029v1.078h2.39a.75.75 0 0 1 .742.866l-.516 3.281a.75.75 0 0 1-.74.634h-1.876v6.106C19.09 21.082 22.5 16.939 22.5 12c0-5.799-4.701-10.5-10.5-10.5zM0 12C0 5.373 5.373 0 12 0s12 5.373 12 12c0 5.995-4.395 10.961-10.138 11.856a.75.75 0 0 1-.866-.74v-7.77a.75.75 0 0 1 .75-.75h1.984l.28-1.781h-2.264a.75.75 0 0 1-.75-.75v-1.828c0-.829.089-1.729.9-2.274.363-.244.807-.37 1.293-.441a9.623 9.623 0 0 1 1.053-.086V6.04c-2.41-.405-3.645.132-4.293.771-.737.728-.933 1.793-.933 2.582v2.672a.75.75 0 0 1-.75.75H8.133v1.78h2.133a.75.75 0 0 1 .75.75v7.772a.75.75 0 0 1-.865.741C4.4 22.968 0 18 0 12z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M2.895 1.201c0-.473.383-.857.857-.857h8.4c.227 0 .445.09.606.251l8.4 8.4c.16.16.25.379.25.606v13.2a.857.857 0 0 1-.856.857h-16.8a.857.857 0 0 1-.857-.857zm1.714.857v19.886h15.085V10.458h-7.542a.857.857 0 0 1-.858-.857V2.058zm8.4 1.213 5.473 5.473H13.01z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-flickr' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M5.959 7.926c-2.298 0-4.14 1.834-4.14 4.073 0 2.241 1.842 4.075 4.14 4.075 2.302 0 4.145-1.834 4.145-4.075 0-2.238-1.843-4.073-4.145-4.073Zm-5.64 4.073c0-3.086 2.533-5.573 5.64-5.573 3.11 0 5.645 2.486 5.645 5.573 0 3.089-2.535 5.575-5.645 5.575-3.107 0-5.64-2.487-5.64-5.575Zm18.07-4.073c-2.301 0-4.144 1.835-4.144 4.073 0 2.24 1.843 4.075 4.145 4.075 2.299 0 4.141-1.834 4.141-4.075 0-2.239-1.842-4.073-4.141-4.073Zm-5.644 4.073c0-3.087 2.535-5.573 5.645-5.573 3.108 0 5.641 2.487 5.641 5.573 0 3.088-2.533 5.575-5.641 5.575-3.11 0-5.645-2.486-5.645-5.575Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-gphotos' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M12.51 0c-.702 0-1.272.57-1.272 1.273V7.35A6.381 6.381 0 0 0 0 11.489c0 .703.57 1.273 1.273 1.273H7.35A6.381 6.381 0 0 0 11.488 24c.704 0 1.274-.57 1.274-1.273V16.65A6.381 6.381 0 0 0 24 12.51c0-.703-.57-1.273-1.273-1.273H16.65A6.381 6.381 0 0 0 12.511 0Zm.252 11.232V1.53a4.857 4.857 0 0 1 0 9.702Zm-1.53.006H1.53a4.857 4.857 0 0 1 9.702 0Zm1.536 1.524a4.857 4.857 0 0 0 9.702 0h-9.702Zm-6.136 4.857c0-2.598 2.04-4.72 4.606-4.85v9.7a4.857 4.857 0 0 1-4.606-4.85Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-huddle' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.204 2.002c-.252.23-.357.486-.357.67V21.07c0 .15.084.505.313.812.208.28.499.477.929.477.519 0 .796-.174.956-.365.178-.212.286-.535.286-.924v-.013l.117-6.58c.004-1.725 1.419-3.883 3.867-3.883 1.33 0 2.332.581 2.987 1.364.637.762.95 1.717.95 2.526v6.47c0 .392.11.751.305.995.175.22.468.41 1.008.41.52 0 .816-.198 1.002-.437.207-.266.31-.633.31-.969V14.04c0-2.81-1.943-5.108-4.136-5.422a5.971 5.971 0 0 0-3.183.41c-.912.393-1.538.96-1.81 1.489a.75.75 0 0 1-1.417-.344v-7.5c0-.587-.47-1.031-1.242-1.031-.315 0-.638.136-.885.36ZM5.194.892A2.844 2.844 0 0 1 7.09.142c1.328 0 2.742.867 2.742 2.53v5.607a6.358 6.358 0 0 1 1.133-.629 7.47 7.47 0 0 1 3.989-.516c3.056.436 5.425 3.482 5.425 6.906v6.914c0 .602-.177 1.313-.627 1.89-.47.605-1.204 1.016-2.186 1.016-.96 0-1.698-.37-2.179-.973-.46-.575-.633-1.294-.633-1.933v-6.469c0-.456-.19-1.071-.602-1.563-.394-.471-.986-.827-1.836-.827-1.447 0-2.367 1.304-2.367 2.39v.014l-.117 6.58c-.001.64-.177 1.333-.637 1.881-.48.57-1.2.9-2.105.9-.995 0-1.7-.5-2.132-1.081-.41-.552-.61-1.217-.61-1.708V2.672c0-.707.366-1.341.847-1.78Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-info' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11 9h2V7h-2m1 13c-4.41 0-8-3.59-8-8s3.59-8 8-8 8 3.59 8 8-3.59 8-8 8m0-18A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2m-1 15h2v-6h-2v6Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-local' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M3 3.75a1.5 1.5 0 0 0-1.5 1.5v13.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V9A1.5 1.5 0 0 0 21 7.5h-9a.75.75 0 0 1-.643-.364L9.325 3.75zm-3 1.5a3 3 0 0 1 3-3h6.75a.75.75 0 0 1 .643.364L12.425 6H21a3 3 0 0 1 3 3v9.75a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0v6.469a4.5 4.5 0 1 1-9 0V4.781Zm4.5-3a3 3 0 0 0-3 3v6.469a3 3 0 1 0 6 0V4.781a3 3 0 0 0-3-3Zm-8.156 8.11a.75.75 0 0 1 .75.75 7.406 7.406 0 1 0 14.812 0 .75.75 0 0 1 1.5 0 8.907 8.907 0 0 1-8.156 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.907 8.907 0 0 1-8.156-8.875.75.75 0 0 1 .75-.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-microphone-mute' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M7.5 4.781a4.5 4.5 0 0 1 9 0V6l3.524-3.524a.75.75 0 1 1 1.061 1.06L5.036 19.585a.75.75 0 0 1-1.06-1.06l1.656-1.657a8.88 8.88 0 0 1-2.538-6.227.75.75 0 0 1 1.5 0c0 2.009.8 3.83 2.1 5.166l1.771-1.772A4.483 4.483 0 0 1 7.5 11.25V4.781Zm2.037 8.182L15 7.5V4.781a3 3 0 1 0-6 0v6.469c0 .637.198 1.227.537 1.713Zm10.62-3.072a.75.75 0 0 1 .75.75 8.907 8.907 0 0 1-8.157 8.875v2.703h3.258a.75.75 0 1 1 0 1.5H7.992a.75.75 0 0 1 0-1.5h3.258v-2.703a8.855 8.855 0 0 1-3.035-.811.75.75 0 1 1 .638-1.358 7.406 7.406 0 0 0 10.553-6.707.75.75 0 0 1 .75-.75ZM15 10.81a.75.75 0 0 1 1.5 0v.439a4.5 4.5 0 0 1-5 4.473.75.75 0 1 1 .166-1.491A3 3 0 0 0 15 11.25v-.44Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-photo-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.65 2.55a.75.75 0 0 1 .6-.3h7.5a.75.75 0 0 1 .6.3l2.025 2.7H21a3 3 0 0 1 3 3v10.5a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V8.25a3 3 0 0 1 3-3h2.625zm.975 1.2L6.6 6.45a.75.75 0 0 1-.6.3H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h18a1.5 1.5 0 0 0 1.5-1.5V8.25a1.5 1.5 0 0 0-1.5-1.5h-3a.75.75 0 0 1-.6-.3l-2.025-2.7zm3.375 6a3.375 3.375 0 1 0 0 6.75 3.375 3.375 0 0 0 0-6.75zm-4.875 3.375a4.875 4.875 0 1 1 9.75 0 4.875 4.875 0 0 1-9.75 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-mobile-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-ngdrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M7.736 1.818a.75.75 0 0 1 .647-.37h7.587a.75.75 0 0 1 .655.383l7.233 12.946a.75.75 0 0 1-.003.737l-3.794 6.66a.75.75 0 0 1-.651.378H4.59a.75.75 0 0 1-.651-.378l-3.794-6.66a.75.75 0 0 1 .005-.75zm.64 1.876L1.663 15.148l2.93 5.145 6.655-11.581zm3.736 6.526-2.398 4.173H14.5zm4.116 4.173h5.697L15.53 2.947H9.677zm5.685 1.5H8.852l-2.966 5.16h13.088z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-onedrive' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13.616 4.147a7.689 7.689 0 0 0-7.642 3.285A6.299 6.299 0 0 0 1.455 17.3c.684.894 2.473 2.658 5.17 2.658h12.141c.95 0 1.882-.256 2.697-.743.815-.486 1.514-1.247 1.964-2.083a5.26 5.26 0 0 0-3.713-7.612 7.69 7.69 0 0 0-6.098-5.373ZM3.34 17.15c.674.63 1.761 1.308 3.284 1.308h12.142a3.76 3.76 0 0 0 2.915-1.383l-7.494-4.489L3.34 17.15Zm10.875-6.25 2.47-1.038a5.239 5.239 0 0 1 1.427-.389 6.19 6.19 0 0 0-10.3-1.952 6.338 6.338 0 0 1 2.118.813l4.285 2.567Zm4.55.033c-.512 0-1.019.104-1.489.307l-.006.003-1.414.594 6.521 3.906a3.76 3.76 0 0 0-3.357-4.8l-.254-.01ZM4.097 9.617A4.799 4.799 0 0 1 6.558 8.9c.9 0 1.84.25 2.587.713l3.4 2.037-10.17 4.28a4.799 4.799 0 0 1 1.721-6.312Z'/></symbol><symbol fill='none' viewBox='0 0 16 16' id='uc-icon-paperclip' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' stroke-linecap='round' stroke-linejoin='round' d='M13.264 9.743 9.03 13.977a4.217 4.217 0 0 1-5.96-.005 4.217 4.217 0 0 1-.004-5.96l6.416-6.416a2.743 2.743 0 0 1 3.88 3.88L7.637 11.2a1.232 1.232 0 1 1-1.743-1.743L9.42 5.932'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-pause' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' d='M1 0h2.5v10H1zM6.5 0H9v10H6.5z'/></symbol><symbol fill='none' viewBox='0 0 10 10' id='uc-icon-play' xmlns='http://www.w3.org/2000/svg'><path d='m1 0 9 5-9 5V0Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-remove-file' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.955 3.3A2.969 2.969 0 0 0 8.998 6h5.914a2.97 2.97 0 0 0-2.957-2.7zM16.416 6a4.47 4.47 0 0 0-8.922 0h-2.32a.755.755 0 0 0-.111.008H3.075a.75.75 0 1 0 0 1.5h1.35V19.35a2.85 2.85 0 0 0 2.85 2.85h9.45a2.85 2.85 0 0 0 2.85-2.85V7.508h1.35a.75.75 0 0 0 0-1.5h-1.989A.754.754 0 0 0 18.825 6zM5.925 7.508V19.35a1.35 1.35 0 0 0 1.35 1.35h9.45a1.35 1.35 0 0 0 1.35-1.35V7.508z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-select' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='m7 10 5 5 5-5H7Z'/></symbol><symbol fill='none' viewBox='0 0 20 20' id='uc-icon-square' xmlns='http://www.w3.org/2000/svg'><rect width='20' height='20' rx='4' fill='#fff'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M11.501.392a.75.75 0 0 1 .998 0l6.704 5.972a.75.75 0 0 1-.998 1.12l-5.455-4.86v13.439a.75.75 0 0 1-1.5 0V2.625l-5.454 4.86a.75.75 0 1 1-.998-1.12zM.857 16.73a.75.75 0 0 1 .75.75v4.914h20.786v-4.914a.75.75 0 0 1 1.5 0v5.664a.75.75 0 0 1-.75.75H.857a.75.75 0 0 1-.75-.75v-5.664a.75.75 0 0 1 .75-.75z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-upload-error' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M13 13h-2V7h2m0 10h-2v-2h2M12 2A10 10 0 0 0 2 12a10 10 0 0 0 10 10 10 10 0 0 0 10-10A10 10 0 0 0 12 2Z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-url' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M19.11 3.67c-1.71-1.709-4.578-1.682-6.408.148l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221C14.018.381 17.836.276 20.17 2.61l1.22 1.22c2.335 2.334 2.23 6.153-.147 8.529l-2.22 2.22a.75.75 0 0 1-1.062-1.06l2.222-2.221c1.83-1.83 1.856-4.698.147-6.408zm-3.36 4.58a.75.75 0 0 1 0 1.06l-6.439 6.44a.75.75 0 0 1-1.06-1.06l6.439-6.44a.75.75 0 0 1 1.06 0zM6.04 9.42a.75.75 0 0 1 0 1.061l-2.222 2.222c-1.83 1.83-1.856 4.698-.147 6.407l1.22 1.22c1.71 1.71 4.578 1.683 6.408-.147l2.221-2.221a.75.75 0 1 1 1.06 1.06l-2.22 2.222c-2.377 2.376-6.195 2.481-8.53.147l-1.22-1.22c-2.334-2.334-2.228-6.153.148-8.53l2.221-2.22a.75.75 0 0 1 1.06 0z'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-video-camera' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' clip-rule='evenodd' d='M0 6.75a3 3 0 0 1 3-3h12a3 3 0 0 1 3 3v1.078L22.873 5A.75.75 0 0 1 24 5.648v12.704a.75.75 0 0 1-1.123.65L18 16.207v1.043a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V6.75Zm18 7.728 4.5 2.58V6.95L18 9.562v4.916ZM16.5 6.75a1.5 1.5 0 0 0-1.5-1.5H3a1.5 1.5 0 0 0-1.5 1.5v10.5a1.5 1.5 0 0 0 1.5 1.5h12a1.5 1.5 0 0 0 1.5-1.5V6.75Z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-video-camera-full' xmlns='http://www.w3.org/2000/svg'><path d='M2 3.333a2 2 0 0 0-2 2v9.334a2 2 0 0 0 2 2h10.938a2 2 0 0 0 2-2v-2.013L20 15.646V4.354l-5.063 3.03v-2.05a2 2 0 0 0-2-2H2Z' fill='currentColor'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-vk' xmlns='http://www.w3.org/2000/svg'><path fill='currentColor' fill-rule='evenodd' d='M6.341 3.27a10.5 10.5 0 0 1 5.834-1.77.75.75 0 0 0 0-1.5 12 12 0 1 0 12 12 .75.75 0 0 0-1.5 0A10.5 10.5 0 1 1 6.34 3.27Zm14.145 1.48a.75.75 0 1 0-1.06-1.062L9.925 13.19V7.95a.75.75 0 1 0-1.5 0V15c0 .414.336.75.75.75h7.05a.75.75 0 0 0 0-1.5h-5.24l9.501-9.5Z'/></symbol></svg>";var Xt=class extends x{constructor(){super(...arguments);this.init$=qn(this);}static{n(this,"LitSolutionBlock");}static{this.styleAttrs=["uc-wgt-common"];}static{this.lazyPlugins=null;}initCallback(){super.initCallback(),this.a11y?.registerBlock(this),this.clipboardLayer?.registerBlock(this),this.sharedCtx.pub("*solution",this.tagName);let t=this.constructor.lazyPlugins;t&&this.sharedCtx.pub("*lazyPlugins",t);}render(){return y`${He(ca)}`}};var ua=n(o=>typeof o!="number"?0:Math.floor(o/1e3),"msToUnixTimestamp"),da=n((o,{threshold:i})=>{let{secureExpire:t}=o,e=ua(Date.now()),r=Number(t),s=ua(i);return e+s>=r},"isSecureTokenExpired");var Br=class extends j{constructor(){super(...arguments);this.ne=null;}static{n(this,"SecureUploadsManager");}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:r,secureUploadsExpireThreshold:s}=this.te;if((t||e)&&r&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),r){if(!this.ne||da(this.ne,{threshold:s})){this.ne?this.w("Secure signature is expired. Resolving a new one..."):this.w("Secure signature is not set yet.");try{let a=await r();a?!a.secureSignature||!a.secureExpire?console.error("Secure signature resolver returned an invalid result:",a):(this.w("Secure signature resolved:",a),this.w("Secure signature will expire in",new Date(Number(a.secureExpire)*1e3).toISOString()),this.ne=a):(this.w("Secure signature resolver returned nothing."),this.ne=null);}catch(a){console.error("Secure signature resolving failed. Falling back to the previous one.",a),this.e.telemetryManager.sendEventError(a,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this.ne}return t&&e?(this.w("Secure signature and expire are set. Using them...",{secureSignature:t,secureExpire:e}),{secureSignature:t,secureExpire:e}):null}destroy(){super.destroy(),this.ne=null;}};var ds=n((o,i)=>{if(o.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}},"validateCollectionUploadError");var ps=n((o,i)=>{let t=o.totalCount,e=i.cfg.multiple?i.cfg.multipleMin:0,r=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:r,total:t}),payload:{total:t,min:e,max:r}};if(r&&t>r)return {type:"TOO_MANY_FILES",message:i.l10n("files-count-limit-error-too-many",{min:e,max:r,total:t}),payload:{total:t,min:e,max:r}}},"validateMultiple");var hs=n((o,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,r=Or([...t?Ei:[],e]);if(!r.length)return;let s=o.mimeType,a=o.name;if(!s||!a)return;let l=ns(s,r),c=ea(a,r);if(!l&&!c)return {type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:o}}},"validateFileType");var ms=n((o,i)=>{let t=i.cfg.imgOnly,e=o.isImage;if(!(!t||e)&&!(!o.fileInfo&&o.externalUrl)&&!(!o.fileInfo&&!o.mimeType))return {type:"NOT_AN_IMAGE",message:i.l10n("images-only-accepted"),payload:{entry:o}}},"validateIsImage");var Ft=1e3,Ae=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),xi=n(o=>Math.ceil(o*100)/100,"round"),pa=n((o,i=Ae.AUTO)=>{let t=i===Ae.AUTO;if(i===Ae.BYTE||t&&o<Ft**1){let r=Vr("en-US",o)==="one"?"byte":"bytes";return `${o} ${r}`}return i===Ae.KB||t&&o<Ft**2?`${xi(o/Ft**1)} KB`:i===Ae.MB||t&&o<Ft**3?`${xi(o/Ft**2)} MB`:i===Ae.GB||t&&o<Ft**4?`${xi(o/Ft**3)} GB`:i===Ae.TB||t&&o<Ft**5?`${xi(o/Ft**4)} TB`:`${xi(o/Ft**5)} PB`},"prettyBytes");var fs=n((o,i)=>{let t=i.cfg.maxLocalFileSizeBytes,e=o.size;if(t&&e&&e>t)return {type:"FILE_SIZE_EXCEEDED",message:i.l10n("files-max-size-limit-error",{maxFileSize:pa(t)}),payload:{entry:o}}},"validateMaxSizeLimit");var gs=n((o,i)=>{let{internalId:t}=o;if(!i.v.hasItem(t))return;let r=i.v.read(t)?.getValue("uploadError");if(!r)return;if(r instanceof at)return {type:"UPLOAD_ERROR",message:r.message,payload:{entry:o,error:r}};if(r instanceof Ne)return {type:"NETWORK_ERROR",message:r.message,payload:{entry:o,error:r}};let s=r instanceof Error?r:new Error("Unknown error",{cause:r});return {type:"UNKNOWN_ERROR",message:s.message,payload:{entry:o,error:s}}},"validateUploadError");var Ke={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."},ju=n(o=>typeof o=="function"?{runOn:"change",validator:o}:o,"getValidatorDescriptor"),zr=class extends j{constructor(t){super(t);this.wu=[ms,hs,fs,gs];this.xu=[ps,ds];this.ke=new se(20);this.Fn=V(()=>{this.ke.run();},500);this.zt=false;this.Me=new Map;let e=V(()=>{this.runFileValidators("change"),this.runCollectionValidators();},0);this.addSub(this.i.sub(S("maxLocalFileSizeBytes"),e)),this.addSub(this.i.sub(S("multipleMin"),e)),this.addSub(this.i.sub(S("multipleMax"),e)),this.addSub(this.i.sub(S("multiple"),e)),this.addSub(this.i.sub(S("imgOnly"),e)),this.addSub(this.i.sub(S("accept"),e)),this.addSub(this.i.sub(S("validationConcurrency"),r=>{this.ke.concurrency=r;}));}static{n(this,"ValidationManager");}get v(){return this.e.uploadCollection}runFileValidators(t,e){if(this.zt)return;let r=e??this.v.items();for(let s of r){let a=this.v.read(s);a&&this.Eu(a,t);}}runCollectionValidators(){if(this.zt)return;let t=this.e.api,e=t.getOutputCollectionState(),r=[],s=this.te.collectionValidators;for(let a of [...this.xu,...s])try{let l=a(e,t);if(!l)continue;l&&(r.push(this.Nn(l)),l.message||console.warn(Ke.MISSING_ERROR_MESSAGE));}catch(l){console.warn(Ke.COLLECTION_VALIDATION_FAILED,l);}this.i.pub("*collectionErrors",r),r.length>0&&this.e.eventEmitter.emit(k.COMMON_UPLOAD_FAILED,()=>t.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(t){let e=this.Me.get(t.uid);e&&(e.abortController?.abort(),this.Me.delete(t.uid));}async Eu(t,e){if(this.zt)return;let r=this.e.api,s=this.Vn(t),a=s.promise??Promise.resolve(),l=(async()=>{if(this.zt||(await a,this.zt))return;let c=this.Cu(t,e);if(c.length===0||!this.v.hasItem(t.uid))return;t.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let u=r.getOutputItem(t.uid),p=new AbortController;s.abortController=p;let d=this.te.validationTimeout,m=this._n(),f=new Set(c.map(E=>E.validator)),v=[];for(let E of m)if(!f.has(E.validator)){let T=s.lastErrorThrownByValidator.get(E.validator);T&&v.push(T);}let w=c.map(E=>async()=>{if(this.zt)return;let T=setTimeout(()=>{s.skippedValidators.add(E.validator),p.abort(),console.warn(Ke.FILE_VALIDATION_TIMEOUT);},d);try{let C=await E.validator(u,r,{signal:p.signal});if(!C||p.signal.aborted){s.lastErrorThrownByValidator.set(E.validator,void 0);return}let A=this.Nn(C);s.lastErrorThrownByValidator.set(E.validator,A),v.push(A),C.message||console.warn(Ke.MISSING_ERROR_MESSAGE);}catch(C){p.signal.aborted||(s.skippedValidators.add(E.validator),console.warn(Ke.FILE_VALIDATION_FAILED,C),this.e.telemetryManager.sendEventError(C,`file validator. ${Ke.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(T),E.runOn!=="change"&&s.skippedValidators.add(E.validator);}});if(this.Fn(),await this.ke.add(async()=>{this.zt||(t.setValue("isQueuedForValidation",false),await Promise.all(w.map(E=>E())).catch(()=>{}));},{autoRun:false}),p.signal.aborted){t.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}t.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:v});})();s.promise=l;try{await l;}finally{s.promise===l&&(s.promise=void 0);}}Nn(t){return {...t,type:t.type??"CUSTOM_ERROR"}}Vn(t){let e=this.Me.get(t.uid);if(e)return e;let r={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this.Me.set(t.uid,r),r}_n(){let t=this.te.fileValidators;return [...this.wu,...t].map(ju)}Cu(t,e){let r=this.Vn(t);return this._n().filter(s=>!r.skippedValidators.has(s.validator)).filter(s=>s.runOn===e)}destroy(){this.zt=true,this.Fn.cancel();for(let t of this.Me.values())t.abortController?.abort(),t.promise=void 0;this.Me.clear();}};var ha="[Typed State] Wrong property name: ",Hr=class{static{n(this,"TypedData");}constructor(i){this.at=ot.generateFastUid(),this.J=K.registerCtx(i,this.at);}get uid(){return this.at}setValue(i,t){if(!this.J.has(i)){console.warn(`${ha}${String(i)}`);return}this.J.read(i)!==t&&this.J.pub(i,t);}setMultipleValues(i){for(let[t,e]of Object.entries(i))this.setValue(t,e);}getValue(i){return this.J.has(i)||console.warn(`${ha}${String(i)}`),this.J.read(i)}subscribe(i,t){return this.J.sub(i,t)}destroy(){K.deleteCtx(this.at);}};var Kr=class o{constructor(i){this.Ht=Object.create(null);this.ir=new Set;this.rr=new Set;this.Tt=new Set;this.Co=new Set;this.To=new Set;this.Oe=new Set;this.Hn=i.initialValue,this.at=ot.generateFastUid(),this.J=K.registerCtx({},this.at),this.Bn=i.watchList||[];let t=Object.create(null);this.zn=(e,r)=>{this.ri&&window.clearTimeout(this.ri),t[e]||(t[e]=new Set),t[e].add(r),this.ri=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.ir.forEach(s=>{s({...t});}),t=Object.create(null));}),this.Kn();},i.handler&&this.observeCollection(i.handler);}static{n(this,"TypedCollection");}static{this.Tu=1e4;}Z(){this.oi&&window.clearTimeout(this.oi),this.oi=window.setTimeout(()=>{let i=new Set(this.To),t=new Set(this.Co);this.To.clear(),this.Co.clear();for(let e of this.rr)e?.([...this.Tt],i,t);this.Kn();});}Kn(){this.Oe.size!==0&&(this.si&&window.clearTimeout(this.si),this.si=window.setTimeout(()=>{let i=[...this.Oe];this.Oe.clear();for(let t of i)t.destroy();},o.Tu));}observeCollection(i){return this.rr.add(i),this.Tt.size>0&&this.Z(),()=>{this.unobserveCollection(i);}}unobserveCollection(i){this.rr.delete(i);}add(i){let t=new Hr(this.Hn);for(let[e,r]of Object.entries(i))t.setValue(e,r);return this.Tt.add(t.uid),this.Z(),this.J.add(t.uid,t),this.To.add(t),this.Bn.forEach(e=>{this.Ht[t.uid]||(this.Ht[t.uid]=[]),this.Ht[t.uid]?.push(t.subscribe(e,()=>{this.zn(e,t.uid);}));}),t.uid}hasItem(i){return this.Tt.has(i)}read(i){return this.J.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 r=this.read(i);if(!r)throw new Error(`TypedCollection#publishProp: Item with id ${i} not found`);r.setValue(t,e);}remove(i){let t=this.read(i);t&&(this.Co.add(t),this.Oe.add(t)),this.Tt.delete(i),this.Z(),this.J.pub(i,void 0),this.Ht[i]?.forEach(e=>{e();}),delete this.Ht[i];}abort(i){this.read(i)?.getValue("isUploading")&&this.remove(i);}abortAll(){this.Tt.forEach(i=>{this.abort(i);});}clearAll(){this.Tt.forEach(i=>{this.remove(i);});}observeProperties(i){return this.ir.add(i),()=>{this.unobserveProperties(i);}}unobserveProperties(i){this.ir.delete(i);}findItems(i){let t=[];return this.Tt.forEach(e=>{let r=this.read(e);r&&i(r)&&t.push(e);}),t}items(){return [...this.Tt]}get size(){return this.Tt.size}destroy(){this.ri&&window.clearTimeout(this.ri),this.oi&&window.clearTimeout(this.oi),this.si&&window.clearTimeout(this.si);for(let i of this.Oe)i.destroy();this.Oe.clear(),K.deleteCtx(this.at),this.ir=new Set,this.rr=new Set;for(let i of Object.keys(this.Ht))this.Ht[i]?.forEach(t=>{t();}),delete this.Ht[i];}};var P=Object.freeze({PHOTO:"photo",VIDEO:"video"}),At=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var ma=n(o=>({isVideoRecordingEnabled:G(o.cameraModes).includes(P.VIDEO),isPhotoEnabled:G(o.cameraModes).includes(P.PHOTO)}),"calcCameraModes");var fa=n((o,i)=>{for(let t of o)if(i(t))return t},"findBlockInCtx");var vs=n((o,i,{timeout:t=1e3,onTimeout:e}={})=>new Promise(r=>{let s,a=setTimeout(()=>{cancelAnimationFrame(s),e?.();},t),l=n(()=>{for(let c of o)if(i(c)){clearTimeout(a),r(c);return}s=requestAnimationFrame(l);},"check");l();}),"waitForBlockInCtx");function jr(o,i){for(let t in i)t.includes("-")?o.style.setProperty(t,String(i[t])):o.style[t]=String(i[t]);}n(jr,"applyStyles");var Gu=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,qu=new RegExp(`^/?(${Gu.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),ga=n(({url:o,cdnBase:i})=>{let t=new URL(i),e=new URL(yi),r=new URL(o);if(t.host!==r.host&&e.host!==r.host)return null;let s=qu.exec(r.pathname);if(!s)return null;let[,a,l,c]=s;return a?{uuid:a,cdnUrlModifiers:l||"",filename:c||null}:null},"parseCdnUrl");var ft=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",DROPBOX_CHOOSER:"dropboxchooser",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),Wu=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),$=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",...Wu,...ft}),Zu={[ft.DROPBOX_CHOOSER]:ft.DROPBOX},va=n(o=>Zu[o]??o,"canonicalSourceName");var Gr=n(o=>o.uploadCollection.items().map(e=>o.api.getOutputItem(e)),"getOutputData");function ya(o){let i=new Map;return n((...e)=>{let r=JSON.stringify(e);if(i.has(r))return i.get(r);let s=o(...e);return i.set(r,s),s},"memoized")}n(ya,"memoize");var ba=new Set;function qr(o){ba.has(o)||(ba.add(o),console.warn(o));}n(qr,"warnOnce");function Yu(o){let i=false;return setTimeout(()=>{i=true;},0),n(e=>((...r)=>(i&&qr(o),e(...r))),"withAssert")}n(Yu,"createAsyncAssertWrapper");function wa(o){let i={},t=o.ctx,e={progress:n(()=>t.read("*commonProgress"),"progress"),errors:n(()=>t.read("*collectionErrors"),"errors"),group:n(()=>t.read("*groupInfo"),"group"),totalCount:n(()=>o.uploadCollection.size,"totalCount"),failedCount:n(()=>i.failedEntries.length,"failedCount"),successCount:n(()=>i.successEntries.length,"successCount"),uploadingCount:n(()=>i.uploadingEntries.length,"uploadingCount"),status:n(()=>i.isFailed?"failed":i.isUploading?"uploading":i.isSuccess?"success":"idle","status"),isSuccess:n(()=>i.allEntries.length>0&&i.errors.length===0&&i.successEntries.length===i.allEntries.length,"isSuccess"),isUploading:n(()=>i.allEntries.some(s=>s.status==="uploading"),"isUploading"),isFailed:n(()=>i.errors.length>0||i.failedEntries.length>0,"isFailed"),allEntries:n(()=>Gr(o),"allEntries"),successEntries:n(()=>i.allEntries.filter(s=>s.status==="success"),"successEntries"),failedEntries:n(()=>i.allEntries.filter(s=>s.status==="failed"),"failedEntries"),uploadingEntries:n(()=>i.allEntries.filter(s=>s.status==="uploading"),"uploadingEntries"),idleEntries:n(()=>i.allEntries.filter(s=>s.status==="idle"),"idleEntries")},r=Yu("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[s,a]of Object.entries(e)){let l=s,u=ya(r(a));Object.defineProperty(i,l,{get:u,enumerable:true});}return i}n(wa,"buildOutputCollectionState");var Wr=class extends j{constructor(){super(...arguments);this.Te=Nr(()=>this.i);this.addFileFromUrl=n((t,{silent:e,fileName:r,source:s}={})=>{let a=this.v.add({externalUrl:t,fileName:r??null,silent:e??false,source:s??$.API});return this.getOutputItem(a)},"addFileFromUrl");this.addFileFromUuid=n((t,{silent:e,fileName:r,source:s}={})=>{let a=this.v.add({uuid:t,fileName:r??null,silent:e??false,source:s??$.API});return this.getOutputItem(a)},"addFileFromUuid");this.addFileFromCdnUrl=n((t,{silent:e,fileName:r,source:s}={})=>{let a=ga({url:t,cdnBase:this.cfg.cdnCname});if(!a)throw new Error("Invalid CDN URL");let l=this.v.add({uuid:a.uuid,cdnUrl:t,cdnUrlModifiers:a.cdnUrlModifiers,fileName:r??a.filename??null,silent:e??false,source:s??$.API});return this.getOutputItem(l)},"addFileFromCdnUrl");this.addFileFromObject=n((t,{silent:e,fileName:r,source:s,fullPath:a}={})=>{let l=this.v.add({file:t,isImage:Be(t),mimeType:t.type||null,fileName:r??t.name,fileSize:t.size,silent:e??false,source:s??$.API,fullPath:a??null});return this.getOutputItem(l)},"addFileFromObject");this.removeFileByInternalId=n(t=>{if(!this.v.read(t))throw new Error(`File with internalId ${t} not found`);this.v.remove(t);},"removeFileByInternalId");this.uploadAll=n(()=>{let t=this.v.items().filter(e=>{let r=this.v.read(e);return r?!r.getValue("isRemoved")&&!r.getValue("isUploading")&&!r.getValue("fileInfo")&&r.getValue("errors").length===0&&!r.getValue("isValidationPending")&&!r.getValue("isQueuedForValidation"):false});t.length!==0&&(this.i.pub("*uploadTrigger",new Set(t)),this.e.eventEmitter.emit(k.COMMON_UPLOAD_START,this.getOutputCollectionState()));},"uploadAll");this.openSystemDialog=n((t={})=>{let e=jt(Or([this.cfg.accept??"",...this.cfg.imgOnly?Ei:[]])),r="uploadcare-file-input",s=document.createElement("input");if(s.setAttribute(r,""),jr(s,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),s.type="file",s.multiple=this.cfg.multiple,t.captureCamera){s.capture=this.cfg.cameraCapture;let{isPhotoEnabled:a,isVideoRecordingEnabled:l}=ma(this.cfg);t.modeCamera===P.PHOTO&&a?s.accept=wi:t.modeCamera===P.VIDEO&&l?s.accept=ss:s.accept=[wi,l&&ss].filter(Boolean).join(",");}else s.accept=e;s.addEventListener("change",()=>{s.files&&([...s.files].forEach(a=>{this.addFileFromObject(a,{source:t.captureCamera?$.CAMERA:$.LOCAL});}),this.e.routerLayer.navigateAfterFileAdd(),s.remove());},{once:true}),document.querySelectorAll(`[${r}]`).forEach(a=>{a.remove();}),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"));},"openSystemDialog");this.initFlow=n((t=false)=>{if(this.v.size>0&&!t)this.i.pub("*currentActivity",_.UPLOAD_LIST),this.e.modalManager?.open(_.UPLOAD_LIST);else if(this.jn?.length===1){let e=this.jn[0];this.So().then(()=>{let r=this.e.pluginManager.snapshot().sources,s=r.find(a=>a.id===e);if(s){let a=s.expand?.()??[e];a.length===1?(r.find(c=>c.id===a[0])??s).onSelect():(this.i.pub("*currentActivity",_.START_FROM),this.e.modalManager?.open(_.START_FROM));return}this.i.read("*currentActivity")&&this.e.modalManager?.open(this.i.read("*currentActivity"));});}else this.i.pub("*currentActivity",_.START_FROM),this.e.modalManager?.open(_.START_FROM);},"initFlow");this.doneFlow=n(()=>{let t=fa(this.e.blocksRegistry,e=>"doneActivity"in e);t&&(this.i.pub("*currentActivity",t.doneActivity),this.i.pub("*history",t.doneActivity?[t.doneActivity]:[]),this.i.read("*currentActivity")||this.e.modalManager?.closeAll());},"doneFlow");this.setCurrentActivity=n((t,...e)=>{this.So().then(()=>{this.i.pub("*currentActivityParams",e[0]??{}),this.i.pub("*currentActivity",t),vs(this.e.blocksRegistry,r=>r.activityType===t,{onTimeout:n(()=>console.warn(`Activity type "${t}" not found in the context`),"onTimeout"),timeout:100});});},"setCurrentActivity");this.on=n((t,e)=>this.e.eventEmitter.on(t,e),"on");this.getCurrentActivity=n(()=>this.i.read("*currentActivity"),"getCurrentActivity");this.historyBack=n(()=>{this.i.read("*historyBack")?.();},"historyBack");this.setModalState=n(t=>{this.So().then(()=>{if(!t){this.e.modalManager?.close(this.i.read("*currentActivity")),this.i.pub("*currentActivity",null);return}let e=this.i.read("*currentActivity");if(!e){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}return vs(this.e.blocksRegistry,r=>r.activityType===e,{onTimeout:n(()=>console.warn(`Activity block "${e}" not found in the context`),"onTimeout")}).then(()=>{this.e.modalManager?.open(e);})});},"setModalState");}static{n(this,"UploaderPublicApi");}get v(){return this.e.uploadCollection}get cfg(){return this.te}get l10n(){return this.Te}removeAllFiles(){this.v.clearAll();}getOutputItem(t){let e=K.getCtx(t);if(!e)throw new Error(`UploaderPublicApi#getOutputItem: Entry with ID "${t}" not found in the upload collection`);let r=e.store,s=r.fileInfo,a=r.isRemoved?"removed":r.errors.length>0?"failed":r.fileInfo?"success":r.isUploading?"uploading":"idle";return {uuid:s?.uuid??r.uuid??null,internalId:t,name:s?.originalFilename??r.fileName,size:s?.size??r.fileSize,isImage:s?.isImage??r.isImage,mimeType:s?.mimeType??r.mimeType,file:r.file,externalUrl:r.externalUrl,cdnUrlModifiers:r.cdnUrlModifiers,cdnUrl:r.cdnUrl??s?.cdnUrl??null,fullPath:r.fullPath,uploadProgress:r.uploadProgress,fileInfo:s??null,metadata:r.metadata??s?.metadata??null,isSuccess:a==="success",isUploading:a==="uploading",isFailed:a==="failed",isRemoved:a==="removed",isValidationPending:r.isValidationPending,errors:r.errors,status:a,source:r?.source}}getOutputCollectionState(){return wa(this.e)}async So(){return (await this.e.wait("pluginManager")).pluginsReady()}get jn(){let t=[];return this.cfg.sourceList&&(t=Y(this.cfg.sourceList)),t}};var Ea={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};var Si=33.333333333333336,M=1,ys=24,Ca=6;function le(o,i){for(let[t,e]of Object.entries(i))o.setAttributeNS(null,t,e.toString());}n(le,"setSvgNodeAttrs");function bt(o,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",o);return le(t,i),t}n(bt,"createSvgNode");function Ta(o,i,t){let{x:e,y:r,width:s,height:a}=o,l=i.includes("w")?0:1,c=i.includes("n")?0:1,u=l===0?-1:1,p=c===0?-1:1,d=[e+l*s+1.5*u,r+c*a+1.5*p-24*t*p],m=[e+l*s+1.5*u,r+c*a+1.5*p],f=[e+l*s-24*t*u+1.5*u,r+c*a+1.5*p],v=`M ${d[0]} ${d[1]} L ${m[0]} ${m[1]} L ${f[0]} ${f[1]}`,w=[m[0],m[1]];return {d:v,center:w}}n(Ta,"cornerPath");function xa(o,i,t){let{x:e,y:r,width:s,height:a}=o,l=i==="n"||i==="s",c=i==="w"||i==="e",u=l?.5:i==="w"?0:1,p=c?.5:i==="n"?0:1,d=i==="w"?-1:i==="e"?1:0,m=i==="n"?-1:i==="s"?1:0,f,v;l?(f=[e+u*s-34*t/2,r+p*a+1.5*m],v=[e+u*s+34*t/2,r+p*a+1.5*m]):(f=[e+u*s+1.5*d,r+p*a-34*t/2],v=[e+u*s+1.5*d,r+p*a+34*t/2]);let w=`M ${f[0]} ${f[1]} L ${v[0]} ${v[1]}`,E=[(f[0]+v[0])/2,(f[1]+v[1])/2];return {d:w,center:E}}n(xa,"sidePath");function Sa(o){return o===""?"move":["e","w"].includes(o)?"ew-resize":["n","s"].includes(o)?"ns-resize":["nw","se"].includes(o)?"nwse-resize":"nesw-resize"}n(Sa,"thumbCursor");function Aa({rect:o,delta:[i,t],imageBox:e}){return Ge({...o,x:o.x+i,y:o.y+t},e)}n(Aa,"moveRect");function Ge(o,i){let{x:t}=o,{y:e}=o;return o.x<i.x?t=i.x:o.x+o.width>i.x+i.width&&(t=i.x+i.width-o.width),o.y<i.y?e=i.y:o.y+o.height>i.y+i.height&&(e=i.y+i.height-o.height),{...o,x:t,y:e}}n(Ge,"constraintRect");function Xu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:a,height:l}=o;s+=r,l-=r,t&&(a=l*t);let c=o.x+o.width/2-a/2;return s<=e.y&&(s=e.y,l=o.y+o.height-s,t&&(a=l*t,c=o.x+o.width/2-a/2)),c<=e.x&&(c=e.x,s=o.y+o.height-l),c+a>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-a),a=e.x+e.width-c,t&&(l=a/t),s=o.y+o.height-l),l<M&&(l=M,t&&(a=l*t,c=o.x+o.width/2-a/2),s=o.y+o.height-l),a<M&&(a=M,t&&(l=a/t,c=o.x+o.width/2-a/2),s=o.y+o.height-l),{x:c,y:s,width:a,height:l}}n(Xu,"resizeNorth");function Qu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:a,height:l}=o;s+=r,a-=r,t&&(l=a/t);let c=o.y+o.height/2-l/2;return s<=e.x&&(s=e.x,a=o.x+o.width-s,t&&(l=a/t,c=o.y+o.height/2-l/2)),c<=e.y&&(c=e.y,s=o.x+o.width-a),c+l>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-c,t&&(a=l*t),s=o.x+o.width-a),l<M&&(l=M,t&&(a=l*t),c=o.y+o.height/2-l/2,s=o.x+o.width-a),a<M&&(a=M,t&&(l=a/t),c=o.y+o.height/2-l/2,s=o.x+o.width-a),{x:s,y:c,width:a,height:l}}n(Qu,"resizeWest");function Ju({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:a,height:l}=o;l+=r,t&&(a=l*t);let c=o.x+o.width/2-a/2;return s+l>=e.y+e.height&&(l=e.y+e.height-s,t&&(a=l*t),c=o.x+o.width/2-a/2),c<=e.x&&(c=e.x,s=o.y),c+a>=e.x+e.width&&(c=Math.max(e.x,e.x+e.width-a),a=e.x+e.width-c,t&&(l=a/t),s=o.y),l<M&&(l=M,t&&(a=l*t),c=o.x+o.width/2-a/2),a<M&&(a=M,t&&(l=a/t),c=o.x+o.width/2-a/2),{x:c,y:s,width:a,height:l}}n(Ju,"resizeSouth");function td({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:a,height:l}=o;a+=r,t&&(l=a/t);let c=o.y+o.height/2-l/2;return s+a>=e.x+e.width&&(a=e.x+e.width-s,t&&(l=a/t),c=o.y+o.height/2-l/2),c<=e.y&&(c=e.y,s=o.x),c+l>=e.y+e.height&&(c=Math.max(e.y,e.y+e.height-l),l=e.y+e.height-c,t&&(a=l*t),s=o.x),l<M&&(l=M,t&&(a=l*t),c=o.y+o.height/2-l/2),a<M&&(a=M,t&&(l=a/t),c=o.y+o.height/2-l/2),{x:s,y:c,width:a,height:l}}n(td,"resizeEast");function ed({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:a,y:l,width:c,height:u}=o;return a+r<e.x&&(r=e.x-a),l+s<e.y&&(s=e.y-l),a+=r,c-=r,l+=s,u-=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l-=s,l<=e.y&&(u=u-(e.y-l),c=u*t,a=o.x+o.width-c,l=e.y)):t&&(r=u*t-c,c=c+r,a-=r,a<=e.x&&(c=c-(e.x-a),u=c/t,a=e.x,l=o.y+o.height-u)),u<M&&(u=M,t&&(c=u*t),a=o.x+o.width-c,l=o.y+o.height-u),c<M&&(c=M,t&&(u=c/t),a=o.x+o.width-c,l=o.y+o.height-u),{x:a,y:l,width:c,height:u}}n(ed,"resizeNorthWest");function id({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:a,y:l,width:c,height:u}=o;return a+c+r>e.x+e.width&&(r=e.x+e.width-a-c),l+s<e.y&&(s=e.y-l),c+=r,l+=s,u-=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l-=s,l<=e.y&&(u=u-(e.y-l),c=u*t,a=o.x,l=e.y)):t&&(r=u*t-c,c+=r,a+c>=e.x+e.width&&(c=e.x+e.width-a,u=c/t,a=e.x+e.width-c,l=o.y+o.height-u)),u<M&&(u=M,t&&(c=u*t),l=o.y+o.height-u),c<M&&(c=M,t&&(u=c/t),l=o.y+o.height-u),{x:a,y:l,width:c,height:u}}n(id,"resizeNorthEast");function rd({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:a,y:l,width:c,height:u}=o;return a+r<e.x&&(r=e.x-a),l+u+s>e.y+e.height&&(s=e.y+e.height-l-u),a+=r,c-=r,u+=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l+u>=e.y+e.height&&(u=e.y+e.height-l,c=u*t,a=o.x+o.width-c,l=e.y+e.height-u)):t&&(r=u*t-c,c+=r,a-=r,a<=e.x&&(c=c-(e.x-a),u=c/t,a=e.x,l=o.y)),u<M&&(u=M,t&&(c=u*t),a=o.x+o.width-c),c<M&&(c=M,t&&(u=c/t),a=o.x+o.width-c),{x:a,y:l,width:c,height:u}}n(rd,"resizeSouthWest");function od({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:a,y:l,width:c,height:u}=o;return a+c+r>e.x+e.width&&(r=e.x+e.width-a-c),l+u+s>e.y+e.height&&(s=e.y+e.height-l-u),c+=r,u+=s,t&&Math.abs(c/u)>t?(s=c/t-u,u+=s,l+u>=e.y+e.height&&(u=e.y+e.height-l,c=u*t,a=o.x,l=e.y+e.height-u)):t&&(r=u*t-c,c+=r,a+c>=e.x+e.width&&(c=e.x+e.width-a,u=c/t,a=e.x+e.width-c,l=o.y)),u<M&&(u=M,t&&(c=u*t)),c<M&&(c=M,t&&(u=c/t)),{x:a,y:l,width:c,height:u}}n(od,"resizeSouthEast");function ka({direction:o,...i}){switch(o){case "n":return Xu(i);case "w":return Qu(i);case "s":return Ju(i);case "e":return td(i);case "nw":return ed(i);case "ne":return id(i);case "sw":return rd(i);case "se":return od(i);default:return i.rect}}n(ka,"resizeRect");function Ma(o,[i,t]){return o.x<=i&&i<=o.x+o.width&&o.y<=t&&t<=o.y+o.height}n(Ma,"rectContainsPoint");function Ia(o,i){return o.x>=i.x&&o.y>=i.y&&o.x+o.width<=i.x+i.width&&o.y+o.height<=i.y+i.height}n(Ia,"isRectInsideRect");function Oa(o,i){return Math.abs(o.width/o.height-i)<.1}n(Oa,"isRectMatchesAspectRatio");function qe({width:o,height:i},t){let e=t/90%2!==0;return {width:e?i:o,height:e?o:i}}n(qe,"rotateSize");function La(o,i,t){let e=o/i,r,s;e>t?(r=Math.round(i*t),s=i):(r=o,s=Math.round(o/t));let a=Math.round((o-r)/2),l=Math.round((i-s)/2);return a+r>o&&(r=o-a),l+s>i&&(s=i-l),{x:a,y:l,width:r,height:s}}n(La,"calculateMaxCenteredCropFrame");function We(o){return {x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)}}n(We,"roundRect");function ce(o,i,t){return Math.min(Math.max(o,i),t)}n(ce,"clamp");var Ai=["free"],Yr=n(o=>{let i=Y(o);if(!i||i.length===0)return [];let t=[];for(let e of i){let r=e.trim();if(!r)continue;let s=r.indexOf(":");if(s===-1&&!Ai.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}let a=Number(r.slice(0,s)),l=Number(r.slice(s+1));if((!Number.isFinite(a)||!Number.isFinite(l)||a<=0||l<=0)&&!Ai.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}t.push({id:ot.generateFastUid(),type:"aspect-ratio",width:Ai.includes(r)?0:a,height:Ai.includes(r)?0:l,hasFreeform:Ai.includes(r)});}return t},"parseCropPreset"),Pa=n((o,i,t,e=.1)=>{let r=o/i,s=null,a=1/0;for(let l of t){let[c,u]=[l.width,l.height],p=c/u,d=Math.abs(r-p);d<a&&(a=d,s=l);}if(s){let[l,c]=[s.width,s.height],u=l/c;if(Math.abs(r-u)/u>e)return null}return s},"getClosestAspectRatio");function Ua(o){return qo({...o,libraryName:Rt,libraryVersion:$t})}n(Ua,"customUserAgent");var Ra="active",Ze="___ACTIVITY_IS_ACTIVE___",$a,D=class o extends($a=x,$a){constructor(){super(...arguments);this.historyTracked=false;this.activityType=null;this.init$=ts(this);this.Su=V(this.Au.bind(this),10);}static{n(this,"LitActivityBlock");}Gn(){let t=o.ni.get(this);this[Ze]=false,this.removeAttribute(Ra),t?.deactivateCallback?.();}ku(){let t=o.ni.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Ze]=true,this.setAttribute(Ra,""),t?.activateCallback?.(),this.Su(),this.emit(k.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[Ze]?this.Gn():this.activityType===t&&!this[Ze]&&this.ku();}catch(e){this.telemetryManager.sendEventError(e,`activity "${this.activityType}"`),console.error(`Error in activity "${this.activityType}". `,e);let r=this.$["*history"][this.$["*history"].length-1];this.$["*currentActivity"]=r??null;}t||(this.$["*history"]=[]);}));}Au(){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);}qn(){return !!this.activityType&&o.ni.has(this)}static{this.ni=new Map;}get isActivityActive(){return !!this[Ze]}get couldOpenActivity(){return true}registerActivity(t,e={}){let{onActivate:r,onDeactivate:s}=e;o.ni.set(this,{activateCallback:r,deactivateCallback:s});}Mu(){this.isActivityActive&&this.Gn(),o.ni.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.qn()&&this.Mu();}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 r=!!e;e&&(r=[...this.blocksRegistry].find(a=>a.activityType===e)?.couldOpenActivity??false),e=r?e:null,this.$["*currentActivity"]=e??null,e&&this.modalManager?.open(e),this.$["*history"]=t,e||this.modalManager?.closeAll();}}};D.activities=_;var I=class o extends D{constructor(){super(...arguments);this.couldBeCtxOwner=false;this.or=false;this.init$=es(this);this.Mo=V(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(k.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this.Ru(e);},300);this.Pu=(t,e,r)=>{if(this.isConnected){(e.size||r.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators("add",[...e].map(s=>s.uid));for(let s of e)s.getValue("silent")||this.emit(k.FILE_ADDED,this.api.getOutputItem(s.uid)),this.e.wait("pluginManager").then(a=>a.runOnAddHooks(s));this.validationManager.runCollectionValidators();for(let s of r){this.$["*uploadTrigger"].delete(s.uid),this.validationManager.cleanupValidationForEntry(s),s.getValue("abortController")?.abort(),s.setMultipleValues({isRemoved:true,abortController:null,isUploading:false,uploadProgress:0});let a=s?.getValue("thumbUrl");a&&URL.revokeObjectURL(a),this.emit(k.FILE_REMOVED,this.api.getOutputItem(s.uid));}this.$["*uploadList"]=t.map(s=>({uid:s})),this.Yn(),this.Mo();}};this.Lu=t=>{if(!this.isConnected)return;this.Mo();let e=this.uploadCollection,r=[...new Set(Object.entries(t).filter(([s])=>["file","uploadError","fileInfo","cdnUrl","cdnUrlModifiers"].includes(s)).flatMap(([,s])=>[...s]))];if(r.length>0&&setTimeout(()=>{if(!this.isConnected)return;let s=r.filter(a=>t.fileInfo?.has(a)&&!!K.getCtx(a)?.store.fileInfo);s.length>0&&this.validationManager.runFileValidators("upload",s),this.validationManager.runFileValidators("change",r);}),t.uploadProgress){for(let s of t.uploadProgress){let a=K.getCtx(s);if(!a)continue;let{isUploading:l,silent:c}=a.store;l&&!c&&this.emit(k.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(s));}this.Yn();}if(t.isUploading)for(let s of t.isUploading){let a=K.getCtx(s);if(!a)continue;let{isUploading:l,silent:c}=a.store;l&&!c&&this.emit(k.FILE_UPLOAD_START,this.api.getOutputItem(s));}if(t.fileInfo){for(let s of t.fileInfo){let a=K.getCtx(s);if(!a)continue;let{fileInfo:l,silent:c}=a.store;l&&!c&&this.emit(k.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(s));}this.cfg.cropPreset&&this.Uu();}if(t.errors){this.validationManager.runCollectionValidators();for(let l of t.errors){let c=K.getCtx(l);if(!c)continue;let{errors:u}=c.store;u.length>0&&(this.emit(k.FILE_UPLOAD_FAILED,this.api.getOutputItem(l)),this.emit(k.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let s=e.findItems(l=>!!l.getValue("fileInfo")),a=e.findItems(l=>l.getValue("errors").length>0);e.size>0&&a.length===0&&e.size===s.length&&this.$["*collectionErrors"].length===0&&this.emit(k.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}t.cdnUrl&&([...t.cdnUrl].filter(a=>!!this.uploadCollection.read(a)?.getValue("cdnUrl")).forEach(a=>{this.emit(k.FILE_URL_CHANGED,this.api.getOutputItem(a));}),this.$["*groupInfo"]=null);};this.Yn=()=>{let t=0,r=[...this.$["*uploadTrigger"]].filter(a=>!!this.uploadCollection.read(a));r.forEach(a=>{let l=this.uploadCollection.readProp(a,"uploadProgress");typeof l=="number"&&(t+=l);});let s=r.length?Math.round(t/r.length):0;this.$["*commonProgress"]!==s&&(this.$["*commonProgress"]=s,this.emit(k.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}static{n(this,"LitUploaderBlock");}get Ou(){return this.hasBlockInCtx(t=>t instanceof o?t.or&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this.Y("*uploadCollection",()=>new Kr({initialValue:Ea,watchList:["file","uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]})),this.Y("*secureUploadsManager",t=>new Br(t)),this.Y("*validationManager",t=>new zr(t)),this.Y("*publicApi",t=>new Wr(t)),!this.Ou&&this.couldBeCtxOwner&&this.Iu();}getAPI(){return this.api}get validationManager(){return this.Q("*validationManager")}get api(){return this.Q("*publicApi")}get uploadCollection(){return this.Q("*uploadCollection")}get secureUploadsManager(){return this.Q("*secureUploadsManager")}disconnectedCallback(){super.disconnectedCallback(),this.or&&this.Wn(),this.Mo.cancel();}connectedCallback(){super.connectedCallback(),this.or&&this.Zn();}Iu(){this.or=true,this.Zn(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}Zn(){this.Wn(),this.Ao=this.uploadCollection.observeCollection(this.Pu),this.ko=this.uploadCollection.observeProperties(this.Lu);}Wn(){this.ko?.(),this.Ao?.(),this.ko=void 0,this.Ao=void 0;}async Ru(t){let e=await this.getUploadClientOptions(),r=t.allEntries.map(c=>c.uuid+(c.cdnUrlModifiers?`/${c.cdnUrlModifiers}`:"")),s=new AbortController,a=await Gn(r,{...e,signal:s.signal});if(this.$["*collectionState"]!==t){s.abort();return}this.$["*groupInfo"]=a;let l=this.api.getOutputCollectionState();this.emit(k.GROUP_CREATED,l),this.emit(k.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.$["*collectionState"]=l;}Uu(){let t=Yr(this.cfg.cropPreset);if(!t)return;let[e]=t,r=this.uploadCollection.findItems(s=>!!s.getValue("fileInfo")&&s.getValue("isImage")&&!s.getValue("cdnUrlModifiers")?.includes("/crop/")).map(s=>this.uploadCollection.read(s)).filter(Boolean);for(let s of r){let a=s.getValue("fileInfo");if(!a||!a.imageInfo){console.warn("Failed to get image info for entry",s.uid);continue}let{width:l,height:c}=a.imageInfo,u=typeof e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,p=La(l,c,u),d=st(`crop/${p.width}x${p.height}/${p.x},${p.y}`,"preview"),m=s.getValue("cdnUrl");if(!m){console.warn("Failed to get cdnUrl for entry",s.uid);continue}s.setMultipleValues({cdnUrlModifiers:d,cdnUrl:Z(m,d)});}}async getMetadataFor(t){let e=this.cfg.metadata||void 0;if(typeof e=="function"){let r=this.api.getOutputItem(t);return await e(r)}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:Ua,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 Gr(this.e)}};I.extSrcList=Object.freeze({...ft});I.sourceTypes=Object.freeze({...$});var ue=class extends x{constructor(){super(...arguments);this.name="";this.sr="";this.ai=null;this.Xn=null;}static{n(this,"Icon");}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",e=>{this.Xn=e,this.Oo();});let t=this.e.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.Oo()));}willUpdate(t){super.willUpdate(t),t.has("name")&&this.Oo();}Oo(){if(!this.name){this.sr="",this.ai=null;return}let e=this.e.pluginManager?.snapshot().icons.find(a=>a.name===this.name);if(e){this.ai=e.svg,this.sr="";return}this.ai=null;let r=`#uc-icon-${this.name}`,s=this.Xn?.(this.name);this.sr=s??r;}render(){return this.ai?y`${this.yield("",y`${He(this.ai)}`)}`:y` ${this.yield("",y`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.sr}></use></svg>`)} `}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback();}};h([b({type:String})],ue.prototype,"name",2),h([g()],ue.prototype,"sr",2),h([g()],ue.prototype,"ai",2);var Da=n(o=>[...new Set(o)],"uniqueArray");var ke="--uc-img-",bs="unresolved";var ws=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),Es=3e3,Cs=5e3,Ts=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var sd="https://ucarecdn.com",Ye=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:sd},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});var Xr=class extends $e(De(xt)){constructor(){super();this.Ie={};this.c=new Map;this.Pe=null;this.nr=null;for(let t in Ye){let e=Ye[t];this.Ie[ke+t]=e?.default||"";}}static{n(this,"ImgConfig");}createRenderRoot(){return this}$$(t){return this.Ie[ke+t]}set$$(t){for(let e in t){let r=ke+e,s=t[e];this.Ie[r]=s,this.Z(r,s);}}sub$$(t,e){let r=ke+t;this.c.has(r)||this.c.set(r,new Set),this.c.get(r)?.add(e);let s=this.Ie[r];s!==null&&s!==""&&e(s);}Z(t,e){this.c.has(t)&&this.c.get(t)?.forEach(r=>{e===null||e===""||r(e);});}analyticsParams(){return `-/@clib/${Rt}/${$t}/uc-img/`}initAttributes(t){Array.from(this.attributes).forEach(e=>{let r=e;Ye[r.name]||t.setAttribute(r.name,r.value);});}initIntersection(t,e){let r={root:null,rootMargin:"0px"};this.Pe=new IntersectionObserver(s=>{s.forEach(a=>{a.isIntersecting&&(e(),this.Pe?.unobserve(t));});},r),this.Pe.observe(t),this.nr||(this.nr=new Set),this.nr.add(t);}connectedCallback(){super.connectedCallback(),this.$u();}$u(){for(let t in Ye){let e=ke+t,r=this.getCssData(e,true);r!=null&&(this.Ie[e]=r);}}disconnectedCallback(){super.disconnectedCallback(),this.Pe&&(this.nr?.forEach(t=>{this.Pe?.unobserve(t);}),this.Pe=null),this.c.clear();}static get observedAttributes(){return Object.keys(Ye)}attributeChangedCallback(t,e,r){window.setTimeout(()=>{let s=ke+t;this.Ie[s]=r,this.Z(s,r);});}};var Fa=n(o=>Object.entries(o).filter(([i,t])=>t!==void 0&&t!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`),"parseObjectToString");var to=class extends Xr{constructor(){super(...arguments);this.Lt=new Image;this.St=new Image;}static{n(this,"ImgBase");}Qn(t){return !t.includes("//")&&!ws&&(t=new URL(t,document.baseURI).href),t}ar(t){if(!t)return;let e=t,r=e.match(/\d+/)?.[0],s=e.match(/[a-zA-Z]+/)?.[0];if(!r||!s)return;let a=parseInt(r,10);return Number(a)>Cs&&this.Jn?Cs+s:Number(a)>Es&&!this.Jn?Es+s:t}Du(t,e){let r={format:this.Io("format"),quality:this.Io("quality"),resize:this.ar(t),blur:e,"cdn-operations":this.Io("cdn-operations")??void 0,analytics:this.analyticsParams()};return st(...Fa(r))}Io(t){let e=this.$$(t);if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}gt(t="",e=""){let r=this.$$("src");if(r.startsWith("data:")||r.startsWith("blob:"))return r;if(ws&&r&&!r.includes("//"))return this.li(r);let s=this.Du(t,e),a=this.$$("cdn-cname"),l=a;if(r.startsWith(String(a)))return Z(r,s);let c=this.$$("uuid");if(l&&c)return this.li(Z(ie(l,c),s));if(c)return this.li(Z(ie(l,c),s));let u=this.$$("proxy-cname");if(u)return this.li(Z(u,s,this.Qn(r)));let p=this.$$("pubkey");if(p)return this.li(Z(`https://${p}.ucr.io/`,s,this.Qn(r)))}li(t){let e=this.$$("secure-delivery-proxy");return e?ze(e,{previewUrl:t},{transform:n(r=>window.encodeURIComponent(r),"transform")}):t}Le(t,e=1,r=true){let s=t.getBoundingClientRect(),a=e*Math.round(s.width),l=r?"":e*Math.round(s.height);return a||l?`${a||""}x${l||""}`:null}Fu(t){let e=n(s=>{s.stopPropagation();let a=new Event(s.type,s);this.dispatchEvent(a);},"proxifyEvent"),r=["load","error"];for(let s of r)t.addEventListener(s,e);}get img(){return this.Rt||(this.Po({elNode:this.Lt}),this.appendChild(this.Lt)),this.Lt}get lr(){return this.Rt?{type:Ts.PREVIEW,img:this.St}:{type:Ts.MAIN,img:this.img}}get Rt(){return this.$$("is-preview-blur")}get ta(){return this.$$("is-background-for")}get ea(){let t=this.$$("breakpoints");if(t){let e=Y(t);return Da(e.map(r=>parseInt(r,10)))}else return null}get Jn(){return this.$$("format").toLowerCase()==="jpeg"}ia(t){let e=new Set;e.add(`url("${this.gt(this.Le(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this.gt(this.Le(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this.gt(this.Le(t,3))}") ${3}x`);let r=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",r),t.style.setProperty("background-image",`-webkit-${r}`);}ra(){let t=new Set;return this.ea?this.ea.forEach(e=>{t.add(`${this.gt(`${e}x`)} ${this.ar(`${e}w`)}`),this.$$("hi-res-support")&&t.add(`${this.gt(`${e*2}x`)} ${this.ar(`${e*2}w`)}`),this.$$("ultra-res-support")&&t.add(`${this.gt(`${e*3}x`)} ${this.ar(`${e*3}w`)}`);}):(t.add(`${this.gt(this.Le(this.lr.img))} 1x`),this.$$("hi-res-support")&&t.add(`${this.gt(this.Le(this.lr.img,2))} 2x`),this.$$("ultra-res-support")&&t.add(`${this.gt(this.Le(this.lr.img,3))} 3x`)),[...t].join()}oa(){return this.gt()}get sa(){return this.gt("100x","100")}Nu(){let t=this.ta;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.ia(e);}):this.ia(e);});}Vu({elNode:t,src:e,srcset:r}){e&&(t.src=e),r&&(t.srcset=r);}Po({elNode:t}){this.Fu(t),this.initAttributes(t);}Lo({src:t,srcset:e,elNode:r}){return new Promise((s,a)=>{this.Po({elNode:r}),r.setAttribute(bs,""),r.addEventListener("load",()=>{r.removeAttribute(bs),s(r);}),r.addEventListener("error",()=>{a(false);}),this.Vu({elNode:r,src:t,srcset:e});})}async _u(){if(this.$$("intersection")){this.Rt&&(this.Po({elNode:this.St}),this.appendChild(this.St)),this.initIntersection(this.lr.img,async()=>{this.Rt&&(this.St.src=this.sa);try{await this.Lo({src:this.oa(),srcset:this.ra(),elNode:this.Lt}),this.Rt&&await this.St.remove(),this.appendChild(this.Lt);}catch{this.Rt&&await this.St?.remove(),this.appendChild(this.Lt);}});return}try{this.Rt&&(await this.Lo({src:this.sa,elNode:this.St}),this.appendChild(this.St)),await this.Lo({src:this.oa(),srcset:this.ra(),elNode:this.Lt}),this.Rt&&await this.St?.remove(),this.appendChild(this.Lt);}catch{this.Rt&&await this.St?.remove(),this.appendChild(this.Lt);}}init(){this.ta?this.Nu():this._u();}};var xs=class extends to{static{n(this,"Img");}connectedCallback(){super.connectedCallback(),this.sub$$("src",()=>{this.init();}),this.sub$$("uuid",()=>{this.init();}),this.sub$$("lazy",i=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=i?"lazy":"eager");});}};var{I:nd}=vn,Va=n(o=>o,"i");var Ss=n((o,i)=>i===void 0?o?.Nt!==void 0:o?.Nt===i,"l"),_a=n(o=>o?.Nt?.h!=null,"d");var Ba=n(o=>o.strings===void 0,"r"),Na=n(()=>document.createComment(""),"s"),Qt=n((o,i,t)=>{let e=o.Pt.parentNode,r=i===void 0?o.we:i.Pt;if(t===void 0){let s=e.insertBefore(Na(),r),a=e.insertBefore(Na(),r);t=new nd(s,a,o,o.options);}else {let s=t.we.nextSibling,a=t.f,l=a!==o;if(l){let c;t.Bu?.(o),t.f=o,t._i!==void 0&&(c=o.X)!==a.X&&t._i(c);}if(s!==r||l){let c=t.Pt;for(;c!==s;){let u=Va(c).nextSibling;Va(e).insertBefore(c,r),c=u;}}}return t},"v"),de=n((o,i,t=o)=>(o.xt(i,t),o),"u"),ad={},ki=n((o,i=ad)=>o.r=i,"p"),Mi=n(o=>o.r,"M"),eo=n(o=>{o.xe(),o.Pt.remove();},"h"),za=n(o=>{o.xe();},"j");var Ii=n((o,i)=>{let t=o.wt;if(t===void 0)return false;for(let e of t)e.dn?.(i,false),Ii(e,i);return true},"s"),io=n(o=>{let i,t;do{if((i=o.f)===void 0)break;t=i.wt,t.delete(o),o=i;}while(t?.size===0)},"o"),Ha=n(o=>{for(let i;i=o.f;o=i){let t=i.wt;if(t===void 0)i.wt=t=new Set;else if(t.has(o))break;t.add(o),ud(i);}},"r");function ld(o){this.wt!==void 0?(io(this),this.f=o,Ha(this)):this.f=o;}n(ld,"h");function cd(o,i=false,t=0){let e=this.r,r=this.wt;if(r!==void 0&&r.size!==0)if(i)if(Array.isArray(e))for(let s=t;s<e.length;s++)Ii(e[s],false),io(e[s]);else e!=null&&(Ii(e,false),io(e));else Ii(this,o);}n(cd,"n");var ud=n(o=>{o.type==Dt.CHILD&&(o._i??=cd,o.Bu??=ld);},"c"),ro=class extends mt{static{n(this,"f");}constructor(){super(...arguments),this.wt=void 0;}ro(i,t,e){super.ro(i,t,e),Ha(this),this.isConnected=i.X;}dn(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(Ii(this,i),io(this));}setValue(i){if(Ba(this.er))this.er.xt(i,this);else {let t=[...this.er.r];t[this.bu]=i,this.er.xt(t,this,0);}}disconnected(){}reconnected(){}};var O=n(()=>new ks,"e"),ks=class{static{n(this,"h");}},As=new WeakMap,L=lt(class extends ro{render(o){return U}update(o,[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=o.options?.host,this.rt(this.ct=o.element)),U}rt(o){if(this.isConnected||(o=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=As.get(i);t===void 0&&(t=new WeakMap,As.set(i,t)),t.get(this.G)!==void 0&&this.G.call(this.ht,void 0),t.set(this.G,o),o!==void 0&&this.G.call(this.ht,o);}else this.G.value=o;}get lt(){return typeof this.G=="function"?As.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 Ms=null,Oi=class extends x{constructor(){super(...arguments);this.dialogEl=O();this.strokes=false;this.blockBodyScrolling=false;this.closeDialog=n(()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="",this.$["*currentActivity"]=null);},"closeDialog");this.zu=()=>{this.closeDialog();};this.Hu=t=>{this.Ro=t.target;};this.Ku=t=>{let e=t.target;e===this.dialogEl.value&&e===this.Ro&&this.closeDialog();};this.ci=({id:t})=>{t===this.id?(Ms=t,this.show(),this.emit(k.MODAL_OPEN,{modalId:t},{debounce:true})):this.hide();};this.ui=({id:t})=>{t===this.id&&(this.hide(),this.emit(k.MODAL_CLOSE,{modalId:t,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true}));};this.na=t=>{this.hide(),Ms===this.id&&this.emit(k.MODAL_CLOSE,{modalId:Ms,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true});};}static{n(this,"Modal");}static{this.styleAttrs=[...super.styleAttrs,"uc-modal"];}async show(){await this.updateComplete;let t=this.dialogEl.value;typeof t.showModal=="function"?(this.setAttribute("aria-modal","true"),t.showModal()):t.setAttribute("open",""),this.cfg.modalScrollLock&&(document.body.style.overflow="hidden");}hide(){let t=this.dialogEl.value;t&&(typeof t.close=="function"?(this.setAttribute("aria-modal","false"),t.close()):t.removeAttribute("open"));}initCallback(){super.initCallback(),this.modalManager?.registerModal(this.id,this),this.subConfigValue("modalBackdropStrokes",t=>{t?this.setAttribute("strokes",""):this.removeAttribute("strokes");}),this.modalManager?.subscribe(X.OPEN,this.ci),this.modalManager?.subscribe(X.CLOSE,this.ui),this.modalManager?.subscribe(X.CLOSE_ALL,this.na);}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this.Ro=void 0,this.modalManager?.unsubscribe(X.OPEN,this.ci),this.modalManager?.unsubscribe(X.CLOSE,this.ui),this.modalManager?.unsubscribe(X.CLOSE_ALL,this.na);}ju(t){this.dialogEl={value:t},this.dialogEl.value?.addEventListener("close",this.zu),this.dialogEl.value?.addEventListener("mousedown",this.Hu),this.dialogEl.value?.addEventListener("mouseup",this.Ku);}render(){return y`<dialog ${L(this.ju)}>${this.yield("")}</dialog>`}};h([b({type:Boolean,noAccessor:true})],Oi.prototype,"strokes",2),h([b({type:Boolean,attribute:"block-body-scrolling",noAccessor:true})],Oi.prototype,"blockBodyScrolling",2);var oo=class extends I{constructor(){super(...arguments);this.K=null;this.cr=null;}static{n(this,"FormInput");}get aa(){return this.nameAttrValue??this.ctxName}la(){let t=document.createElement("input");return t.type="text",t.name=this.aa,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,jr(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.K=this.la(),this.appendChild(this.K),this.sub("*collectionState",t=>{if(!t)return;if(!this.cr){let a=document.createElement("div");this.appendChild(a),this.cr=a;}if(!this.K){let a=this.la();this.appendChild(a),this.K=a;}if(this.cr.innerHTML="",t.status==="uploading"||t.status==="idle"){this.K.value="",this.K.setCustomValidity("");return}if(t.status==="failed"){let a=t.errors[0]?.message;this.K.value="",this.K.setCustomValidity(a??"");return}let e=t.group?t.group:null;if(e){this.K.value=e.cdnUrl??"",this.K.setCustomValidity("");return}let r=t.allEntries.map(a=>a.cdnUrl).filter(a=>typeof a=="string");if(!this.cfg.multiple&&r.length===1&&r[0]){this.K.value=r[0],this.K.setCustomValidity("");return}this.K.remove(),this.K=null;let s=new DocumentFragment;for(let a of r){let l=document.createElement("input");l.type="hidden",l.name=`${this.aa}[]`,l.value=a,s.appendChild(l);}this.cr.replaceChildren(s);},false);}};h([b({type:String,noAccessor:true,attribute:"name"})],oo.prototype,"nameAttrValue",2);var Is=class extends x{static{n(this,"Copyright");}initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i);});}render(){return y`<a href="https://uploadcare.com/?utm_source=copyright&utm_medium=referral&utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`}};var Xe=class extends x{constructor(){super(...arguments);this.hasFileName=false;this.value=0;this.visible=true;this.At=0;this.ur=O();this.ca=()=>{let t=this.ur.value;if(t){if(!this.visible){t.classList.add("uc-fake-progress--hidden");return}this.At>0&&t.classList.add("uc-fake-progress--hidden");}};}static{n(this,"ProgressBar");}firstUpdated(t){super.firstUpdated(t),this.At=this.Uo(this.value),this.$o(),this.ur.value?.addEventListener("animationiteration",this.ca);}updated(t){if(super.updated(t),t.has("value")){let e=this.Uo(this.value);if(!this.visible)this.At=e;else {let r=Math.max(this.At,e);r!==this.At&&(this.At=r,this.$o());}}t.has("visible")&&(this.classList.toggle("uc-progress-bar--hidden",!this.visible),this.visible?this.$o():this.At=this.Uo(this.value));}disconnectedCallback(){super.disconnectedCallback(),this.ur.value?.removeEventListener("animationiteration",this.ca);}Uo(t){return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}$o(){this.visible&&this.style.setProperty("--l-progress-value",this.At.toString());}render(){return y`<div ${L(this.ur)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}};h([b({type:Boolean,noAccessor:true})],Xe.prototype,"hasFileName",2),h([b({type:Number})],Xe.prototype,"value",2),h([b({type:Boolean,reflect:true})],Xe.prototype,"visible",2);var Li=class extends I{constructor(){super();this.kt=false;this.Re=0;this.init$={...this.init$,"*commonProgress":0};}static{n(this,"ProgressBarCommon");}initCallback(){super.initCallback(),this.Do=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e)?.getValue("isUploading")??false);this.kt=t;}),this.sub("*commonProgress",t=>{this.Re=t;});}updated(t){super.updated(t),t.has("visible")&&(this.kt?this.setAttribute("active",""):this.removeAttribute("active"));}disconnectedCallback(){super.disconnectedCallback(),this.Do?.(),this.Do=void 0;}render(){return y`<uc-progress-bar .value=${this.Re} .visible=${this.kt}></uc-progress-bar>`}};h([g()],Li.prototype,"kt",2),h([g()],Li.prototype,"Re",2);var Qe=class extends x{constructor(){super(...arguments);this.value="";this.disabled=false;this.options=[];this.Gu=t=>{if(this.disabled){t.preventDefault(),t.stopPropagation();return}t.preventDefault(),t.stopPropagation();let e=t.currentTarget;e&&(this.value=e.value,this.dispatchEvent(new Event("change")));};}static{n(this,"Select");}render(){return y`<select @change=${this.Gu} .value=${this.value} ?disabled=${this.disabled}>${this.options.map(t=>y`<option value=${t.value}>${t.text}</option>`)}</select>`}};h([b({type:String,attribute:false})],Qe.prototype,"value",2),h([b({type:Boolean,reflect:true})],Qe.prototype,"disabled",2),h([b({type:Array,attribute:false})],Qe.prototype,"options",2);var pe=class extends I{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.textOnly=false;this.iconOnly=false;this.Fo="default";this.dr="";}static{n(this,"SourceBtn");}willUpdate(t){super.willUpdate(t),t.has("source")&&this.qu(this.source);}qu(t){if(!t){this.dr="",this.Fo="default";return}let{label:e,icon:r,id:s}=t;this.dr=e,this.Fo=r??s??"default";}activate(){this.source&&(this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{sourceId:this.source.id}}),this.source.onClick());}render(){return y`<button aria-label=${this.l10n(this.dr)} type="button" @click=${this.activate}>${this.textOnly?"":y`<uc-icon name=${this.Fo}></uc-icon>`} ${this.iconOnly?"":y`<div class="uc-txt">${this.l10n(this.dr)}</div>`}</button>`}};h([b({attribute:false})],pe.prototype,"source",2),h([b({type:Boolean})],pe.prototype,"textOnly",2),h([b({type:Boolean})],pe.prototype,"iconOnly",2),h([g()],pe.prototype,"Fo",2),h([g()],pe.prototype,"dr",2);var Je=class{constructor(i,t){this.ua=[];this.i=t.ctx,this.e=t.sharedInstancesBag,this.da=t.onSourcesChange,i.addController(this);}static{n(this,"SourceListController");}hostConnected(){this.No=this.i.sub(S("sourceList"),t=>{this.ua=Y(t),this.Vo();});let i=this.e.pluginManager;i?.onPluginsChange&&(this.E=i.onPluginsChange(()=>this.Vo())),this.Vo();}hostDisconnected(){this.E?.(),this.E=void 0,this.No?.(),this.No=void 0;}Vo(){let t=this.e.pluginManager?.snapshot().sources??[],e=new Map(t.map(s=>[s.id,s])),r=[];this.ua.forEach(s=>{let a=this.Wu(s,e);if(a.length!==1||a[0]!==s){for(let u of a){let p=e.get(u);p&&r.push(this.pa(p));}return}let c=e.get(s);c&&r.push(this.pa(c));}),this.da(r);}Wu(i,t){let e=t.get(i);return e?.expand?e.expand():[i]}pa(i){return {id:i.id,label:i.label,icon:i.icon,onClick:n(()=>i.onSelect(),"onClick")}}};var Pi=class extends I{constructor(){super(...arguments);this.z=[];this.wrap=false;}static{n(this,"SourceList");}initCallback(){super.initCallback(),this._o=new Je(this,{ctx:this.e.ctx,sharedInstancesBag:this.e,onSourcesChange:n(t=>{this.z=t;},"onSourcesChange")});}updated(t){super.updated(t),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents";}render(){return y`${this.z.map(t=>y`<uc-source-btn role="listitem" .source=${t} data-source-id=${t.id}></uc-source-btn>`)}`}};h([g()],Pi.prototype,"z",2),h([b({type:Boolean,attribute:"wrap",noAccessor:true})],Pi.prototype,"wrap",2);var Os=class extends x{static{n(this,"Spinner");}render(){return y`<div class="uc-spinner"></div>`}};var Lt="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Me(o){let i=new Image;return {promise:new Promise((r,s)=>{i.src=o,i.onload=()=>r(),i.onerror=a=>s(a);}),image:i,cancel:n(()=>{i.naturalWidth===0&&(i.src=Lt);},"cancel")}}n(Me,"preloadImage");function Ui(o){let i=[];for(let s of o){let a=Me(s);i.push(a);}let t=i.map(s=>s.image);return {promise:Promise.allSettled(i.map(s=>s.promise)),images:t,cancel:n(()=>{i.forEach(s=>{s.cancel();});},"cancel")}}n(Ui,"batchPreloadImages");function Ls(o,i=40){if(o.type==="image/svg+xml")return URL.createObjectURL(o);let t=document.createElement("canvas"),e=t.getContext("2d");if(!e)return Promise.reject(new Error("Canvas context not supported"));let r=new Image,s=new Promise((a,l)=>{r.onload=()=>{let c=r.height/r.width;c>1?(t.width=i,t.height=i*c):(t.height=i,t.width=i/c),e.fillStyle="rgb(240, 240, 240)",e.fillRect(0,0,t.width,t.height),e.drawImage(r,0,0,t.width,t.height),t.toBlob(u=>{if(!u){l();return}let p=URL.createObjectURL(u);a(p);});},r.onerror=c=>{l(c);};});return r.src=URL.createObjectURL(o),s}n(Ls,"generateThumb");var ti=class extends I{constructor(){super(...arguments);this.pr=new Set;this.entry=null;}static{n(this,"FileItemConfig");}withEntry(t){return (...e)=>{let r=this.entry;if(!r){console.warn("No entry found");return}return t(r,...e)}}subEntry(t,e){this.withEntry((r,s,a)=>{let l=r.subscribe(s,c=>{this.isConnected&&a(c);});this.pr.add(l);})(t,e);}reset(){for(let t of this.pr)t();this.pr=new Set,this.entry=null;}disconnectedCallback(){super.disconnectedCallback(),this.pr=new Set;}};function dd(o){let i=new Blob([o],{type:"image/svg+xml"});return URL.createObjectURL(i)}n(dd,"createSvgBlobUrl");function so(o="hsl(209, 21%, 65%)",i=32,t=32){return dd(`<svg width="${i}" height="${t}" viewBox="0 0 30 30" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" fill="${o}" d="M9.68848 8.70068C9.68848 8.42454 9.91233 8.20068 10.1885 8.20068H15.0885C15.2211 8.20068 15.3483 8.25336 15.442 8.34713L20.342 13.2471C20.4358 13.3409 20.4885 13.4681 20.4885 13.6007V21.3007C20.4885 21.5768 20.2646 21.8007 19.9885 21.8007H10.1885C9.91233 21.8007 9.68848 21.5768 9.68848 21.3007V8.70068ZM10.6885 9.20068V20.8007H19.4885V14.1007L15.0885 14.1007C14.8123 14.1007 14.5885 13.8768 14.5885 13.6007L14.5885 9.20068H10.6885ZM15.5885 9.90779L18.7814 13.1007L15.5885 13.1007L15.5885 9.90779Z"/></svg>`)}n(so,"fileCssBg");var pd=3e3,ei=class extends ti{constructor(){super(...arguments);this.badgeIcon="";this.uid="";this.Kt="";this.ha=false;this.hr=null;this.fa=false;this.Zu=this.cfg.filesViewMode;this.ma=this.withEntry(async(t,e=false)=>{let r=t.getValue("fileInfo"),s=t.getValue("isImage"),a=t.getValue("uuid"),l=t.getValue("thumbUrl"),c=this.Yu(e);if(r&&s&&a){let p=await this.proxyUrl(Z(ie(this.cfg.cdnCname,a),st(t.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${c}x${c}/center`)));if(l===p)return;let{promise:d}=Me(p);d.then(()=>{t.setValue("thumbUrl",p),l?.startsWith("blob:")&&URL.revokeObjectURL(l);}).catch(async()=>{if(!l?.startsWith("blob:"))try{let m=t.getValue("file");if(!m)return;let f=await Ls(m,c);t.setValue("thumbUrl",f);}catch(m){this.telemetryManager.sendEventError(m,"thumbnail generation. Failed to generate thumb from file");let f=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",so(f));}});return}if(t.getValue("thumbUrl"))return;let u=t.getValue("file");if(u?.type.includes("image"))try{let p=await Ls(u,c);t.setValue("thumbUrl",p);}catch(p){this.telemetryManager.sendEventError(p,"thumbnail generation. Failed to generate thumb from file");let d=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",so(d));}else {let p=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",so(p));}});this.fr=V(this.ma.bind(this),100);}static{n(this,"Thumb");}Yu(t=false){t&&(this.hr=this.getBoundingClientRect());let e=Math.max(parseInt(String(this?.hr?.height||0),10),parseInt(String(this?.hr?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(e*=window.devicePixelRatio),Math.min(e,pd)}Xu(t,e){return new Promise((r,s)=>{let a=new Image;a.decoding="async";let l=n(()=>{a&&(a.onload=null,a.onerror=null,a.src=Lt,e?.removeEventListener("abort",c),a=null);},"cleanup"),c=n(()=>{l(),s(new DOMException("Aborted","AbortError"));},"onAbort");if(e){if(e.aborted){c();return}e.addEventListener("abort",c,{once:true});}let u=n(()=>{l(),r();},"resolveSafe"),p=n(d=>{l(),s(d);},"rejectSafe");if(typeof a.decode=="function"){a.src=t,a.decode().then(u).catch(p);return}a.onload=u,a.onerror=p,a.src=t;})}zo(){this.Bo?.cancel(),this.Bo=void 0;}Qu(t){if(this.zo(),!t){this.Kt&&(this.Kt="");return}if(t===this.Kt)return;let e=new AbortController,r={controller:e,cancel:n(()=>{e.abort(),r.rafId!==void 0&&window.cancelAnimationFrame(r.rafId);},"cancel")};this.Bo=r,this.Xu(t,e.signal).then(()=>{e.signal.aborted||(r.rafId=window.requestAnimationFrame(()=>{e.signal.aborted||(this.Kt=t);}));}).catch(s=>{e.signal.aborted||s instanceof DOMException&&s.name==="AbortError"||console.warn("[Thumb] Failed to decode thumbnail image",s);});}mr(t=false){if(this.entry){if(t){this.ma(true);return}this.fa&&this.fr();}}firstUpdated(t){super.firstUpdated(t),this.ga();}updated(t){super.updated(t),t.has("uid")&&this.ga();}di(t){let[e]=t;e&&(this.fa=e.isIntersecting,e.isIntersecting&&(this.hr=e.boundingClientRect,this.mr(),this.s?.disconnect()),e.intersectionRatio===0&&this.fr.cancel());}reset(){super.reset(),this.fr.cancel(),this.zo(),this.Kt&&(this.Kt="");}ga(){let t=this.uid?.trim();if(!t){this.entry&&this.reset();return}let e=this.uploadCollection?.read(t);if(!e||e===this.entry)return;this.reset(),this.entry=e;let r=n(()=>{this.mr();},"requestThumb");this.subEntry("fileInfo",s=>{s?.isImage&&r();}),this.subEntry("thumbUrl",s=>{this.Qu(s??void 0);}),this.subEntry("cdnUrlModifiers",r),this.mr(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this.ha&&(this.Zu==="list"&&this.mr(true),this.ha=true);});}connectedCallback(){super.connectedCallback(),this.s?.disconnect(),this.s=new window.IntersectionObserver(this.di.bind(this),{threshold:.1}),this.s.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.fr.cancel(),this.zo(),this.s?.disconnect();}render(){return y`<div class="uc-thumb"><img class="uc-thumb__img" src=${this.Kt||Lt} role="img" alt="Preview of uploaded image" ?hidden=${!this.Kt} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}};h([b({type:String})],ei.prototype,"badgeIcon",2),h([b({attribute:false})],ei.prototype,"uid",2),h([g()],ei.prototype,"Kt",2);var Ps=class extends D{static{n(this,"ActivityHeader");}};var Us=class extends D{constructor(){super(...arguments);this.historyTracked=true;this.activityType=D.activities.START_FROM;}static{n(this,"StartFrom");}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"");}render(){return y`<div class="uc-content">${this.yield("")}</div>`}};var Rs=class extends I{constructor(){super(...arguments);this.va=null;}static{n(this,"UploadCtxProvider");}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=k;}initCallback(){super.initCallback(),this.va=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.va?.();}};var he=n((o,i)=>{let t=false,e,r=0,s=n(((...a)=>{t?(e&&clearTimeout(e),e=setTimeout(()=>{Date.now()-r>=i&&(o(...a),r=Date.now());},Math.max(i-(Date.now()-r),0))):(o(...a),r=Date.now(),t=true);}),"throttled");return Object.defineProperty(s,"cancel",{configurable:false,writable:false,enumerable:false,value:n(()=>{e&&clearTimeout(e);},"value")}),s},"throttle");var Ka=n((o,i,t)=>{let e=new Map;for(let r=i;r<=t;r++)e.set(o[r],r);return e},"u"),Ri=lt(class extends mt{constructor(o){if(super(o),o.type!==Dt.CHILD)throw Error("repeat() can only be used in text expressions")}dt(o,i,t){let e;t===void 0?t=i:i!==void 0&&(e=i);let r=[],s=[],a=0;for(let l of o)r[a]=e?e(l,a):a,s[a]=t(l,a),a++;return {values:s,keys:r}}render(o,i,t){return this.dt(o,i,t).values}update(o,[i,t,e]){let r=Mi(o),{values:s,keys:a}=this.dt(i,t,e);if(!Array.isArray(r))return this.ut=a,s;let l=this.ut??=[],c=[],u,p,d=0,m=r.length-1,f=0,v=s.length-1;for(;d<=m&&f<=v;)if(r[d]===null)d++;else if(r[m]===null)m--;else if(l[d]===a[f])c[f]=de(r[d],s[f]),d++,f++;else if(l[m]===a[v])c[v]=de(r[m],s[v]),m--,v--;else if(l[d]===a[v])c[v]=de(r[d],s[v]),Qt(o,c[v+1],r[d]),d++,v--;else if(l[m]===a[f])c[f]=de(r[m],s[f]),Qt(o,r[d],r[m]),m--,f++;else if(u===void 0&&(u=Ka(a,f,v),p=Ka(l,d,m)),u.has(l[d]))if(u.has(l[m])){let w=p.get(a[f]),E=w!==void 0?r[w]:null;if(E===null){let T=Qt(o,r[d]);de(T,s[f]),c[f]=T;}else c[f]=de(E,s[f]),Qt(o,r[d],E),r[w]=null;f++;}else eo(r[m]),m--;else eo(r[d]),d++;for(;f<=v;){let w=Qt(o,c[v+1]);de(w,s[f]),c[f++]=w;}for(;d<=m;){let w=r[d++];w!==null&&eo(w);}return this.ut=a,ki(o,c),rt}});var ct=lt(class extends mt{constructor(o){if(super(o),o.type!==Dt.ATTRIBUTE||o.name!=="class"||o.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(o){return " "+Object.keys(o).filter(i=>o[i]).join(" ")+" "}update(o,[i]){if(this.st===void 0){this.st=new Set,o.strings!==void 0&&(this.nt=new Set(o.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=o.element.classList;for(let e of this.st)e in i||(t.remove(e),this.st.delete(e));for(let e in i){let r=!!i[e];r===this.st.has(e)||this.nt?.has(e)||(r?(t.add(e),this.st.add(e)):(t.remove(e),this.st.delete(e)));}return rt}});var ja="file-item-remove-button",Ie=class extends I{constructor(){super(...arguments);this.uploading=false;this.failed=false;this.success=false;this.idle=false;}static{n(this,"FileActionButton");}static{this.styleAttrs=[...super.styleAttrs,"uc-file-action-button"];}pi(){this.dispatchEvent(new CustomEvent("uc:remove",{bubbles:true,composed:true}));}render(){let t=ct({"uc-remove-btn":true,"uc-mini-btn":true,"uc-idle":this.idle,"uc-uploading":this.uploading,"uc-failed":this.failed,"uc-success":this.success});return y`<button type="button" @click=${this.pi} title=${this.l10n(ja)} aria-label=${this.l10n(ja)} class=${t} ><uc-icon name="remove-file"></uc-icon><uc-icon name="close"></uc-icon></button>`}};h([b({type:Boolean})],Ie.prototype,"uploading",2),h([b({type:Boolean})],Ie.prototype,"failed",2),h([b({type:Boolean})],Ie.prototype,"success",2),h([b({type:Boolean})],Ie.prototype,"idle",2);var Q=Object.freeze({FINISHED:Symbol("FINISHED"),FAILED:Symbol("FAILED"),UPLOADING:Symbol("UPLOADING"),VALIDATION:Symbol("VALIDATION"),QUEUED_UPLOADING:Symbol("QUEUED-UPLOADING"),QUEUED_VALIDATION:Symbol("QUEUED-VALIDATION"),IDLE:Symbol("IDLE")}),q=class q extends ti{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.ya=true;this.uid="";this.Ho="";this.Ko="";this.jo="";this.At=0;this.ba=false;this.Go="";this.qo=false;this.Wo=false;this.wa=false;this.xa=false;this.Zo=false;this.Ea="";this.gr=[];this.Ca=false;this.pi=()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uid&&this.uploadCollection.hasItem(this.uid)&&this.uploadCollection.remove(this.uid);};this.Ju=()=>{this.Ta();};this.S=V(()=>this.Sa(),100);this.ed=this.withEntry(he((t,e)=>{let r=t.getValue("errors")?.[0]?.message??"",s=t.getValue("source"),a=t.getValue("externalUrl"),l=e===Q.FINISHED,c=e===Q.UPLOADING,u=e===Q.QUEUED_UPLOADING,p=e===Q.QUEUED_VALIDATION,d=e===Q.VALIDATION,m=t.getValue("fileName"),f="";r?f="":!l&&a&&s&&Object.values(ft).includes(s)&&(f=this.l10n("waiting-for",{source:this.l10n(`src-type-${va(s)}`)})),this.jo=f,this.Ko=r,this.ba=c||u||p||d,this.At=p||d?0:t.getValue("uploadProgress"),this.Ea=m?this.l10n("a11y-file-item-status",{fileName:m,status:this.l10n(e?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):"";},100));this.Ta=this.withEntry(async t=>{if(!this.uploadCollection.read(t.uid)||t.getValue("fileInfo")||t.getValue("isUploading")||t.getValue("errors").length>0||t.getValue("isValidationPending"))return;let e=this.cfg.multiple?this.cfg.multipleMax:1;if(!(e&&this.uploadCollection.size>e)){t.setMultipleValues({isUploading:true,errors:[],isQueuedForUploading:true}),this.S();try{let r=new AbortController;t.setValue("abortController",r);let s=n(async()=>{t.setValue("isQueuedForUploading",!1);let l=t.getValue("file");if(l instanceof File||l instanceof Blob){let m=(this.e.pluginManager?.snapshot().fileHooks??[]).filter(f=>f.type==="beforeUpload");for(let f of m)try{let v=f.handler({file:l,signal:r.signal}),w=new Promise((T,C)=>setTimeout(()=>C(new Error("beforeUpload hook timed out")),f.timeout)),{file:E}=await Promise.race([v,w]);E!==l&&(l=E,t.setValue("mimeType",l.type||null),t.setValue("isImage",Be(l)),t.setValue("fileSize",l.size),l instanceof File&&t.setValue("fileName",l.name));}catch(v){console.warn(`File hook "beforeUpload" from plugin "${f.pluginId}" failed`,v);}}let c=l||t.getValue("externalUrl")||t.getValue("uuid");if(!c)throw new Error("No file input");let p={...await this.getUploadClientOptions(),fileName:t.getValue("fileName")??void 0,source:t.getValue("source")??void 0,onProgress:n(d=>{if(d.isComputable){let m=d.value*100;t.setValue("uploadProgress",m);}},"onProgress"),signal:r.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",c,p),Qo(c,p)},"uploadTask"),a=await this.$["*uploadQueue"].add(s);t.setMultipleValues({fileInfo:a,isQueuedForUploading:!1,isUploading:!1,fileName:a.originalFilename,fileSize:a.size,isImage:a.isImage??!1,mimeType:a.contentInfo?.mime?.mime??a.mimeType,uuid:a.uuid,cdnUrl:t.getValue("cdnUrl")??a.cdnUrl,cdnUrlModifiers:t.getValue("cdnUrlModifiers")??"",uploadProgress:100,source:t.getValue("source")??null}),t===this.entry&&this.S();}catch(r){let s=r instanceof oe&&r.isCancel;s?t.setMultipleValues({isUploading:false,uploadProgress:0}):r instanceof Ce?t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:r}):(console.error("Unknown upload error",r),t.setMultipleValues({isUploading:false,uploadProgress:0,uploadError:new Error("Something went wrong",{cause:r})})),t===this.entry&&this.S(),this.isConnected&&!s&&this.telemetryManager.sendEventError(r,"file upload. Failed to upload file");}}});}static{n(this,"FileItem");}Sa(){let t=this.entry;if(!t)return;let e=Q.IDLE;t.getValue("errors").length>0?e=Q.FAILED:t.getValue("isQueuedForUploading")?e=Q.QUEUED_UPLOADING:t.getValue("isQueuedForValidation")?e=Q.QUEUED_VALIDATION:t.getValue("isValidationPending")?e=Q.VALIDATION:t.getValue("isUploading")?e=Q.UPLOADING:t.getValue("fileInfo")&&(e=Q.FINISHED),this.td(t,e);}td(t,e){e===Q.FAILED?this.Go="badge-error":e===Q.FINISHED&&(this.Go="badge-success"),e===Q.UPLOADING&&(this.xa=false,this.removeAttribute("focused")),this.Wo=e===Q.FAILED,this.wa=e===Q.UPLOADING,this.qo=e===Q.FINISHED,this.ed(e);}reset(){super.reset(),this.S.cancel();}di(t){let[e]=t;e&&e.isIntersecting&&!this.Ca&&(this.ya=false,this.Ca=true);}Aa(t){this.reset();let e=this.uploadCollection?.read(t);if(this.entry=e,!e){this.ae();return}this.subEntry("isQueuedForValidation",()=>{this.S();}),this.subEntry("isValidationPending",()=>{this.S();}),this.subEntry("uploadProgress",()=>{this.S();}),this.subEntry("isQueuedForUploading",()=>{this.S();}),this.subEntry("fileName",r=>{this.Ho=r||e.getValue("externalUrl")||this.l10n("file-no-name"),this.S();}),this.subEntry("externalUrl",r=>{this.Ho=e.getValue("fileName")||r||this.l10n("file-no-name");}),this.subEntry("fileInfo",()=>{this.S();}),this.subEntry("errors",()=>this.S()),this.subEntry("isUploading",()=>this.S()),this.subEntry("fileSize",()=>this.S()),this.subEntry("mimeType",()=>this.S()),this.subEntry("isImage",()=>this.S()),this.subEntry("fileInfo",()=>this.ae()),this.subEntry("isUploading",()=>this.ae()),this.subEntry("errors",()=>this.ae()),this.Sa(),this.ae();}ka(t){if(this.cfg.filesViewMode==="list"){this.Zo=true;return}this.Zo=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.Aa(this.uid);}ae(){let t=this.e.pluginManager;if(!t||!this.uid){this.gr=[];return}let e=t.snapshot().fileActions,r=this.api.getOutputItem(this.uid);if(!r){this.gr=[];return}this.gr=e.filter(s=>{try{return s.shouldRender(r)}catch(a){return console.error(`Error in plugin file action shouldRender (${s.id}):`,a),false}});}rd(t){if(!this.uid)return;let e=this.api.getOutputItem(this.uid);if(e){this.telemetryManager.sendEvent({payload:{metadata:{event:t.id,node:this.tagName,pluginId:t.pluginId}}});try{t.onClick(e);}catch(r){console.error(`Error in plugin file action onClick (${t.id}):`,r);}}}initCallback(){super.initCallback(),this.Aa(this.uid),this.subConfigValue("filesViewMode",e=>{this.ka(this.cfg.gridShowFileNames),this.setAttribute("mode",e);}),this.subConfigValue("gridShowFileNames",e=>{this.ka(e);}),this.onclick=()=>{q.activeInstances.forEach(e=>{e===this?e.setAttribute("focused",""):e.removeAttribute("focused");});},this.sub("*uploadTrigger",e=>{this.entry&&!e.has(this.entry.uid)||setTimeout(()=>this.isConnected&&this.Ta());});let t=this.e.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.ae())),this.ae(),q.activeInstances.add(this);}connectedCallback(){super.connectedCallback(),this.s=new window.IntersectionObserver(this.di.bind(this),{threshold:[0,1]}),this.s.observe(this);}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback(),this.s?.disconnect(),q.activeInstances.delete(this),this.reset();}static{this.activeInstances=new Set;}shouldUpdate(t){return this.ya?false:super.shouldUpdate(t)}render(){return y`<div class="uc-inner" ?data-finished=${this.qo} ?data-uploading=${this.wa} ?data-failed=${this.Wo} ?data-focused=${this.xa} ><uc-thumb .uid=${this.uid} .badgeIcon=${this.Go}></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this.Ea}><span class="uc-file-name" ?hidden=${!this.Zo}>${this.Ho}</span><span class="uc-file-error" ?hidden=${!this.Ko}>${this.Ko}</span><span class="uc-file-hint" ?hidden=${!this.jo}>${this.jo}</span></div><div class="uc-file-actions">${this.gr.map(t=>y`<button type="button" @click=${()=>this.rd(t)} title=${this.l10n(t.label)} aria-label=${this.l10n(t.label)} class="uc-plugin-action-btn uc-mini-btn" data-plugin-action-id=${t.id} ><uc-icon name=${t.icon}></uc-icon></button>`)}<uc-file-action-button @uc:remove=${this.pi} .uploading=${this.ba} .failed=${this.Wo} .success=${this.qo}></uc-file-action-button><button type="button" class="uc-upload-btn uc-mini-btn" @click=${this.Ju}><uc-icon name="upload"></uc-icon></button></div></div>`}};h([g()],q.prototype,"ya",2),h([b({attribute:false})],q.prototype,"uid",2),h([g()],q.prototype,"Ho",2),h([g()],q.prototype,"Ko",2),h([g()],q.prototype,"jo",2),h([g()],q.prototype,"At",2),h([g()],q.prototype,"ba",2),h([g()],q.prototype,"Go",2),h([g()],q.prototype,"qo",2),h([g()],q.prototype,"Wo",2),h([g()],q.prototype,"wa",2),h([g()],q.prototype,"xa",2),h([g()],q.prototype,"Zo",2),h([g()],q.prototype,"Ea",2),h([g()],q.prototype,"gr",2);var $s=q;function hd(o){return new Promise(i=>{typeof window.FileReader!="function"&&i(false);try{let t=new FileReader;t.onerror=()=>{i(!0);};let e=n(r=>{r.type!=="loadend"&&t.abort(),i(!1);},"onLoad");t.onloadend=e,t.onprogress=e,t.readAsDataURL(o);}catch{i(false);}})}n(hd,"checkIsDirectory");function md(o,i){return new Promise(t=>{let e=0,r=[],s=n(l=>{if(!l){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null);return}l.isFile?(e++,l.file(c=>{e--;let u=new File([c],c.name,{type:c.type||i});r.push({type:"file",file:u,fullPath:l.fullPath}),e===0&&t(r);})):l.isDirectory&&a(l.createReader());},"readEntry"),a=n(l=>{e++,l.readEntries(c=>{e--;for(let u of c)s(u);e===0&&t(r);});},"readReaderContent");s(o);})}n(md,"readEntryContentAsync");function Ga(o){let i=[],t=[];for(let e=0;e<o.items.length;e++){let r=o.items[e];if(r)if(r.kind==="file"){let s=r.type,a=r;if(typeof a.webkitGetAsEntry=="function"||typeof a.getAsEntry=="function"){let c=typeof a.webkitGetAsEntry=="function"?a.webkitGetAsEntry():a.getAsEntry?.();c&&t.push(md(c,s).then(u=>{u&&i.push(...u);}));continue}let l=r.getAsFile();l&&t.push(hd(l).then(c=>{c||i.push({type:"file",file:l});}));}else r.kind==="string"&&/^text\/uri-list/.test(r.type)&&t.push(new Promise(s=>{r.getAsString(a=>{i.push({type:"url",url:a}),s();});}));}return Promise.all(t).then(()=>i)}n(Ga,"getDropItems");var ut=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),qa=["focus"],fd=100,Ds=new Map;function gd(o,i){let t=Math.max(Math.min(o[0],i.x+i.width),i.x),e=Math.max(Math.min(o[1],i.y+i.height),i.y);return Math.sqrt((o[0]-t)*(o[0]-t)+(o[1]-e)*(o[1]-e))}n(gd,"distance");function Fs(o){let i=0,t=document.body,e=new Set,r=n(v=>{e.add(v);},"handleSwitch"),s=ut.INACTIVE,a=n(v=>{o.shouldIgnore()&&v!==ut.INACTIVE||(s!==v&&e.forEach(w=>{w(v);}),s=v);},"setState"),l=n(()=>i>0,"isDragging");r(v=>o.onChange(v));let c=n(()=>{i=0,a(ut.INACTIVE);},"onResetEvent"),u=n(()=>{i+=1,s===ut.INACTIVE&&a(ut.ACTIVE);},"onDragEnter"),p=n(()=>{i-=1,l()||a(ut.INACTIVE);},"onDragLeave"),d=n(v=>{v.preventDefault(),i=0,a(ut.INACTIVE);},"onDrop"),m=n(v=>{if(o.shouldIgnore())return;l()||(i+=1);let w=[v.x,v.y],E=o.element.getBoundingClientRect(),T=Math.floor(gd(w,E)),C=T<fd,A=v.composedPath().includes(o.element);Ds.set(o.element,T);let Tt=Math.min(...Ds.values())===T;A&&Tt?(v.preventDefault(),a(ut.OVER)):a(C&&Tt?ut.NEAR:ut.ACTIVE);},"onDragOver"),f=n(async v=>{if(o.shouldIgnore())return;v.preventDefault();let{dataTransfer:w}=v;if(!w)return;let E=await Ga(w);o.onItems(E),a(ut.INACTIVE);},"onElementDrop");return t.addEventListener("drop",d),t.addEventListener("dragleave",p),t.addEventListener("dragenter",u),t.addEventListener("dragover",m),o.element.addEventListener("drop",f),qa.forEach(v=>{window.addEventListener(v,c);}),()=>{Ds.delete(o.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",p),t.removeEventListener("dragenter",u),t.removeEventListener("dragover",m),o.element.removeEventListener("drop",f),qa.forEach(v=>{window.removeEventListener(v,c);});}}n(Fs,"addDropzone");var Vs=new Set,wt=class extends I{constructor(){super(...arguments);this.single=false;this.ghost=false;this.disabled=false;this.clickable=false;this.withIcon=false;this.fullscreen=false;this.initflow=false;this.Bt=true;this.Ma=true;this.Yo="drop-files-here";this.Ue=false;this.Ia=null;this.Xo=null;this.Pa=O();this.$e=t=>{if(t instanceof KeyboardEvent){if(t.code!=="Space"&&t.code!=="Enter")return}else if(!(t instanceof MouseEvent))return;if(this.initflow){this.api.initFlow();return}this.api.openSystemDialog();};this.La=true;this.De=false;}static{n(this,"DropArea");}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}Oa(){let t=this.text;if(typeof t=="string"&&t.length>0){this.Yo=t;return}this.Yo=this.Ue?"drop-files-here":"drop-file-here";}isActive(){if(!this.Bt)return false;let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,r=t.top>=0&&t.left>=0&&t.bottom<=(window.innerHeight||document.documentElement.clientHeight)&&t.right<=(window.innerWidth||document.documentElement.clientWidth),s=window.getComputedStyle(this),a=s.visibility!=="hidden"&&s.display!=="none";return e&&a&&r}initCallback(){super.initCallback(),Vs.add(this),this.Qo(),this.Jo(),this.Ra(),this.Ua(ut.INACTIVE),this.Ia=Fs({element:this,shouldIgnore:n(()=>this.$a(),"shouldIgnore"),onChange:n(t=>{this.Ua(t);},"onChange"),onItems:n(t=>{if(!t.length)return;let e=this.uploadCollection.size;t.forEach(r=>{r.type==="url"?this.api.addFileFromUrl(r.url,{source:$.DROP_AREA}):r.type==="file"&&this.api.addFileFromObject(r.file,{source:$.DROP_AREA,fullPath:r.fullPath});}),this.uploadCollection.size>e&&this.routerLayer.navigateAfterFileAdd();},"onItems")}),this.updateComplete.then(()=>this.od()),this.subConfigValue("sourceList",t=>{let e=Y(t);this.La=e.includes($.LOCAL),this.Qo(),this.Jo();}),this.subConfigValue("multiple",t=>{this.Ue=!!t,this.Oa();});}willUpdate(t){super.willUpdate(t),t.has("disabled")&&(this.Qo(),this.Jo()),(t.has("text")||t.has("localeId"))&&this.Oa();}updated(t){super.updated(t),t.has("clickable")&&this.Ra();}$a(){if(!this.Bt||!this.sd())return true;if(!this.fullscreen)return false;let t=Vs;return t.size===0?false:[...t].filter(s=>s!==this).filter(s=>s.isActive()).length>0}sd(){let t=this.cfg.multiple,e=this.cfg.multipleMax,r=this.uploadCollection.size;return !(t&&e&&r>=e||!t&&r>0)}Qo(){let t=this.La&&!this.disabled;this.Bt=t;}Jo(){let t=this.Bt||!this.querySelector("[data-default-slot]");this.Ma=t,this.hidden=!t;}Ua(t){let e=Object.entries(ut).find(([,r])=>r===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}od(){if(this.Xo)return;let t=this.Pa.value;t&&(this.Xo=Fs({element:t,onChange:n(e=>{let r=Object.entries(ut).find(([,s])=>s===e)?.[0].toLowerCase();r&&t.setAttribute("drag-state",r);},"onChange"),onItems:n(()=>{},"onItems"),shouldIgnore:n(()=>this.$a(),"shouldIgnore")}));}Ra(){this.clickable&&!this.De?(this.addEventListener("keydown",this.$e),this.addEventListener("click",this.$e),this.De=true):!this.clickable&&this.De&&(this.removeEventListener("keydown",this.$e),this.removeEventListener("click",this.$e),this.De=false);}disconnectedCallback(){super.disconnectedCallback(),Vs.delete(this),this.Ia?.(),this.Xo?.(),this.De&&(this.removeEventListener("keydown",this.$e),this.removeEventListener("click",this.$e),this.De=false);}render(){return y` ${this.yield("",y`<div data-default-slot hidden></div><div ${L(this.Pa)} class="uc-content-wrapper" ?hidden=${!this.Ma} ><div class="uc-icon-container" ?hidden=${!this.withIcon}><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">${this.l10n(this.Yo)}</span></div>`)} `}};h([b({type:Boolean,noAccessor:true})],wt.prototype,"single",2),h([b({type:Boolean,noAccessor:true})],wt.prototype,"ghost",2),h([b({type:Boolean,reflect:true})],wt.prototype,"disabled",2),h([b({type:Boolean,reflect:true})],wt.prototype,"clickable",2),h([b({type:Boolean,attribute:"with-icon",reflect:true})],wt.prototype,"withIcon",2),h([b({type:Boolean,reflect:true})],wt.prototype,"fullscreen",2),h([b({type:Boolean,reflect:true})],wt.prototype,"initflow",2),h([b({type:String})],wt.prototype,"text",2),h([g()],wt.prototype,"Bt",2),h([g()],wt.prototype,"Ma",2);var Pt=class extends I{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=D.activities.UPLOAD_LIST;this.Da=false;this.Fa=false;this.Na=false;this.ts=false;this.es=false;this.vr=null;this.Va=false;this.rs=null;this._a=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this.os=()=>{this.emit(k.UPLOAD_CLICK),this.api.uploadAll(),this.q();};this.ss=()=>{this.emit(k.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow();};this.Ut=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll();};this.q=he(()=>{this.isConnected&&(this.ld(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}static{n(this,"UploadList");}get nd(){return this.rs?this.ad(this.rs):""}ld(){let t=this.api.getOutputCollectionState(),e={total:t.totalCount,succeed:t.successCount,uploading:t.uploadingCount,failed:t.failedCount,validatingBeforeUploading:t.idleEntries.filter(f=>f.isValidationPending).length},r=!t.errors.some(f=>f.type==="TOO_MANY_FILES"||f.type==="TOO_FEW_FILES"),s=t.errors.some(f=>f.type==="TOO_MANY_FILES"),a=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),l=t.allEntries.some(f=>f.isValidationPending),c=e.failed===0&&t.errors.length===0&&!l,u=false,p=false,d=false;if(e.total-e.succeed-e.uploading-e.failed>0&&r&&c&&this.cfg.confirmUpload)u=true;else {p=true;let f=this.cfg.groupOutput?!!t.group:true;d=e.total===e.succeed&&r&&c&&f;}this.Da=p,this.Fa=d,this.Na=u,this.es=e.total===0||!s&&!a,this.ts=!a||this.cfg.multiple,this.Va=e.total>0,this.rs=e;}ad(t){let e=n(r=>{let s=t[r];return r==="uploading"&&(s+=t.validatingBeforeUploading),this.l10n(`header-${r}`,{count:s})},"localizedText");return t.uploading>0||t.validatingBeforeUploading>0?e("uploading"):t.failed>0?e("failed"):t.succeed>0?e("succeed"):e("total")}get couldOpenActivity(){return this.cfg.showEmptyList||this.uploadCollection.size>0}initCallback(){super.initCallback(),this.registerActivity(this.activityType),this.subConfigValue("multiple",this.q),this.subConfigValue("multipleMin",this.q),this.subConfigValue("multipleMax",this.q),this.sub("*groupInfo",t=>{t&&this.q();}),this.subConfigValue("filesViewMode",t=>{this.setAttribute("mode",t);}),this.sub("*currentActivity",t=>{!this.couldOpenActivity&&t===this.activityType&&(this.$["*currentActivity"]=this.initActivity);}),this.uploadCollection.observeProperties(this.q),this.uploadCollection.observeCollection(this.q),this.sub("*collectionErrors",t=>{let e=t.filter(r=>r.type!=="SOME_FILES_HAS_ERRORS")[0];if(!e){this.vr=null;return}this.vr=e.message;});}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this.q),this.uploadCollection.unobserveCollection(this.q));}render(){return y`<uc-activity-header><span aria-live="polite" class="uc-header-text">${this.nd}</span><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" ?hidden=${this.Va}>${this.yield("empty",y`<span>${this.l10n("no-files")}</span>`)}</div><div class="uc-files"><div class="uc-files-wrapper">${Ri(this.$["*uploadList"]??[],({uid:t})=>t,({uid:t})=>y`<uc-file-item .uid=${t}></uc-file-item>`)}</div><button type="button" class="uc-add-more-btn uc-secondary-btn" @click=${this._a} ?disabled=${!this.es} ?hidden=${!this.ts} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button></div><div class="uc-common-error" ?hidden=${!this.vr} >${this.vr??""}</div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Ut}>${this.l10n("clear")}</button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" ?hidden=${!this.ts} ?disabled=${!this.es} @click=${this._a} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button><button type="button" class="uc-upload-btn uc-primary-btn" ?hidden=${!this.Na} @click=${this.os} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.Da} ?disabled=${!this.Fa} @click=${this.ss} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};h([g()],Pt.prototype,"Da",2),h([g()],Pt.prototype,"Fa",2),h([g()],Pt.prototype,"Na",2),h([g()],Pt.prototype,"ts",2),h([g()],Pt.prototype,"es",2),h([g()],Pt.prototype,"vr",2),h([g()],Pt.prototype,"Va",2),h([g()],Pt.prototype,"rs",2);var vd=[{test:n(o=>!!o.accept&&!!o.imgOnly,"test"),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:n(o=>o.enableVideoRecording!==null,"test"),message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:n(o=>o.defaultCameraMode!==null,"test"),message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],Wa=V(o=>{for(let{test:i,message:t}of vd)i(o)&&qr(t);},0);var Za=n((o,i)=>{let t=new URL(i);return t.hostname=`${o}.${t.hostname}`,t.toString().replace(/\/$/,"")},"o"),yd="0123456789abcdefghijklmnopqrstuvwxyz",Ya=n(o=>{if(o<=0n)return "0";let i="";for(;o>0n;){let t=o%36n;i=yd[Number(t)]+i,o=o/36n;}return i},"a"),Ns=n((o,i)=>{try{let t=new URL(o),e=new URL(i);return t.hostname.endsWith(e.hostname)}catch{return false}},"c");var bd=n(async o=>{let i=new TextEncoder().encode(o),t=await window.crypto.subtle.digest("SHA-256",i),e=Array.from(new Uint8Array(t)).map(r=>r.toString(16).padStart(2,"0")).join("");return BigInt(`0x${e}`)},"c"),wd=10,Ed=n(async o=>{let i=await bd(o);return Ya(i).slice(0,wd)},"d"),Xa=n(async(o,i)=>{let t=await Ed(o);return Za(t,i)},"f");var Qa=n(o=>o instanceof Promise||!!(o&&typeof o=="object"&&"then"in o&&typeof o.then=="function"),"isPromiseLike");var _s=n(o=>o,"defineComputedProperty"),Cd=[_s({key:"cameraModes",deps:["enableVideoRecording"],fn:n(({cameraModes:o,enableVideoRecording:i})=>{let t=i();if(t===null)return o();let e=G(o());return t&&!e.includes("video")?e=e.concat("video"):t||(e=e.filter(r=>r!=="video")),jt(e)},"fn")}),_s({key:"cameraModes",deps:["defaultCameraMode"],fn:n(({cameraModes:o,defaultCameraMode:i})=>{let t=i();if(t===null)return o();let e=G(o());return e=e.sort((r,s)=>r===t?-1:s===t?1:0),jt(e)},"fn")}),_s({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:n(({pubkey:o,cdnCname:i,cdnCnamePrefixed:t})=>{let e=o(),r=i(),s=t();return e&&(r===yi||Ns(r,s))?Xa(e,s):r},"fn")})],Ja=n(({key:o,setValue:i,getValue:t,computationControllers:e})=>{for(let r of Cd){if(!r.deps.includes(o))continue;let s={[r.key]:()=>t(r.key)};for(let c of r.deps)s[c]=()=>t(c);let a=new AbortController;e.get(r.fn)?.abort(),e.set(r.fn,a);let l;try{l=r.fn(s,{signal:a.signal});}catch(c){e.get(r.fn)===a&&e.delete(r.fn),console.error(`Failed to compute value for "${r.key}"`,c);return}Qa(l)?l.then(c=>{a.signal.aborted||i(r.key,c);}).catch(c=>{a.signal.aborted||console.error(`Failed to compute value for "${r.key}"`,c);}).finally(()=>{e.get(r.fn)===a&&e.delete(r.fn);}):i(r.key,l);}},"computeProperty");var N=n(o=>String(o),"asString"),et=n(o=>{let i=Number(o);if(Number.isNaN(i))throw new Error(`Invalid number: "${o}"`);return i},"asNumber"),B=n(o=>{if(typeof o>"u"||o===null)return false;if(typeof o=="boolean")return o;if(o==="true"||o==="")return true;if(o==="false")return false;throw new Error(`Invalid boolean: "${o}"`)},"asBoolean"),tl=n(o=>o==="auto"?o:B(o),"asStore"),el=n(o=>{let i=N(o);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},"asCameraCapture"),il=n(o=>{let i=N(o);if(!Object.values(P).includes(i))throw new Error(`Invalid value: "${i}"`);return i},"asCameraMode"),rl=n(o=>{let i=N(o),t=G(i);if(t.some(e=>!Object.values(P).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},"asCameraModes"),ol=n(o=>{let i=N(o);if(i==="local"||i==="global")return i;if(B(o)===false)return false;throw new Error(`Invalid value: "${i}"`)},"asPasteScope"),sl=n(o=>{if(typeof o=="object"&&!Array.isArray(o)||typeof o=="function")return o;throw new Error("Invalid metadata value. Must be an object or function.")},"asMetadata"),Bs=n(o=>{if(typeof o=="object")return o;throw new Error("Invalid value. Must be an object.")},"asObject"),no=n(o=>{if(typeof o=="function")return o;throw new Error("Invalid value. Must be a function.")},"asFunction"),ao=n(o=>{if(Array.isArray(o))return o;throw new Error("Must be an array.")},"asArray"),nl=n(o=>{let i=N(o);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)},"asFilesViewMode"),al=n(o=>{let i=N(o);if(["auto","allwrap","nowrap","collapse"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)},"asSmartButtonViewMode");var Td={pubkey:N,multiple:B,multipleMin:et,multipleMax:et,confirmUpload:B,imgOnly:B,accept:N,externalSourcesPreferredTypes:N,externalSourcesEmbedCss:N,store:tl,cameraMirror:B,cameraCapture:el,sourceList:N,topLevelOrigin:N,maxLocalFileSizeBytes:et,thumbSize:et,showEmptyList:B,useLocalImageEditor:B,useCloudImageEditor:B,cloudImageEditorTabs:N,removeCopyright:B,cropPreset:N,imageShrink:N,modalScrollLock:B,modalBackdropStrokes:B,sourceListWrap:B,remoteTabSessionKey:N,cdnCname:N,cdnCnamePrefixed:N,baseUrl:N,socialBaseUrl:N,secureSignature:N,secureExpire:N,secureDeliveryProxy:N,retryThrottledRequestMaxTimes:et,retryNetworkErrorMaxTimes:et,multipartMinFileSize:et,multipartChunkSize:et,maxConcurrentRequests:et,multipartMaxConcurrentRequests:et,multipartMaxAttempts:et,checkForUrlDuplicates:B,saveUrlForRecurrentUploads:B,groupOutput:B,userAgentIntegration:N,debug:B,localeName:N,metadata:sl,secureUploadsExpireThreshold:et,localeDefinitionOverride:n(o=>Bs(o),"localeDefinitionOverride"),secureUploadsSignatureResolver:n(o=>no(o),"secureUploadsSignatureResolver"),secureDeliveryProxyUrlResolver:n(o=>no(o),"secureDeliveryProxyUrlResolver"),iconHrefResolver:n(o=>no(o),"iconHrefResolver"),plugins:n(o=>ao(o),"plugins"),fileValidators:ao,collectionValidators:ao,validationTimeout:et,validationConcurrency:et,cameraModes:rl,defaultCameraMode:il,enableAudioRecording:B,enableVideoRecording:B,mediaRecorderOptions:Bs,maxVideoRecordingDuration:et,filesViewMode:nl,gridShowFileNames:B,cloudImageEditorAutoOpen:B,cloudImageEditorMaskHref:N,testMode:B,qualityInsights:B,pasteScope:ol,smartButtonShowFirstIcon:B,smartButtonViewMode:al},ll=n((o,i)=>{if(!(typeof i>"u"||i===null))try{return Td[o](i)}catch(t){return console.error(`Invalid value for config key "${o}".`,t),tt[o]}},"normalizeConfigValue");var lo=[...new Set(["debug",...Object.keys(tt)])],xd=["metadata","plugins","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],ul=n(o=>xd.includes(o),"isComplexKey"),Hs=lo.filter(o=>!ul(o)),zs={...Object.fromEntries(Hs.map(o=>[br(o),o])),...Object.fromEntries(Hs.map(o=>[o.toLowerCase(),o]))},cl=n(o=>`__${o}`,"getLocalPropName"),ii=class extends x{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(tt).map(([t,e])=>[S(t),e]))};this.cd=new Map;this.fi={};this.Ba=new Set;this.Fe=new Map;}static{n(this,"Config");}ns(t){return this.Ba.has(t)}as(t){let e=this.e.pluginManager;if(e)return e.configRegistry.get(t)}ls(t){return [...new Set([br(t),t.toLowerCase()])]}ud(t,e){if(ul(t)||this.ns(t)&&this.as(t)?.attribute===false)return;let r=this.ls(t);for(let s of r)typeof e>"u"||e===null?this.removeAttribute(s):this.getAttribute(s)!==e.toString()&&this.setAttribute(s,e.toString());}dd(t,e){let r=S(t);if(this.$[r]!==e)if(typeof e>"u"||e===null){let s=tt[t];this.$[r]=s!==void 0?s:e;}else this.$[r]=e;}jt(t,e){let r;if(this.ns(t)){let l=this.as(t);try{r=l?.normalize?.(e)??e;}catch(c){console.warn(`[uc-config] normalize() for "${t}" threw an error, keeping previous value`,c);return}}else r=ll(t,e);let s=this,a=cl(t);s[a]!==r&&(this.pd(t,s[a],r),s[a]=r,this.ud(t,r),this.dd(t,r),this.debugPrint(`"${t}"`,r),this.ns(t)||Wa(this.cfg));}br(t){let e=this,r=cl(t);return e[r]??this.$[S(t)]}pd(t,e,r){this.cfg.debug&&r!==e&&typeof r=="object"&&typeof e=="object"&&JSON.stringify(r)===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:`,r));}za(t){let e=t.configRegistry.getAll();this.fi={},this.Ba=new Set(e.keys());for(let[r,s]of this.Fe)e.has(r)||(s(),this.Fe.delete(r));for(let[r,s]of e){let l=S(r);if(s.attribute){let f=this.ls(r);for(let v of f)this.fi[v]=r;}let c,u=false,p=Object.getOwnPropertyDescriptor(this,r);if(p&&!p.get&&!p.set&&p.value!==void 0&&(c=p.value,u=true),!u&&s.attribute)for(let f of this.ls(r)){let v=this.getAttribute(f);if(v!=null){try{c=s.fromAttribute?s.fromAttribute(v):v;}catch(w){console.warn(`[uc-config] fromAttribute() for "${r}" threw an error, using raw attribute value`,w),c=v;}u=true;break}}this.sharedCtx.has(l)||this.sharedCtx.add(l,s.defaultValue);let m=Object.getOwnPropertyDescriptor(this,r);if((!m||!m.set||!m.get)&&Object.defineProperty(this,r,{set:n(f=>{this.jt(r,f);},"set"),get:n(()=>this.br(r),"get"),enumerable:true,configurable:true}),!this.Fe.has(r)){let f=this.sub(l,v=>{this.jt(r,v);},false);this.Fe.set(r,f);}u&&this.jt(r,c);}}hd(){this.e.when("pluginManager",t=>{this.za(t),this.yr=t.onPluginsChange(()=>{this.za(t);});});}fd(){this.hi=new MutationObserver(t=>{for(let e of t)if(e.type==="attributes"&&e.attributeName){let r=e.attributeName,s=e.oldValue,a=this.getAttribute(r);if(s===a||r in zs)continue;if(r in this.fi){let c=this.fi[r],u=this.as(c);this.attributeChangedCallback(r,s??"",a??u?.defaultValue??"");}}}),this.hi.observe(this,{attributes:true,attributeOldValue:true});}initCallback(){super.initCallback();let t=this;this.hd(),this.fd();for(let r of Hs)this.sub(S(r),s=>{this.jt(r,s);},false);for(let r of lo){let s=t[r]??this.$[S(r)];s!==tt[r]&&this.jt(r,s);let a=Object.getOwnPropertyDescriptor(this,r);(!a||!a.set||!a.get)&&Object.defineProperty(this,r,{set:n(l=>{this.jt(r,l);},"set"),get:n(()=>this.br(r),"get")});}let e=n(r=>{Ja({key:r,setValue:this.jt.bind(this),getValue:this.br.bind(this),computationControllers:this.cd});},"runComputeProperty");for(let r of lo)this.sub(S(r),()=>e(r));}attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),e===r)return;let s=this,a=zs[t];a?s[a]=r:this.e.when("pluginManager",l=>{let c=this.getAttribute(t);if(c&&c!==r)return;let u=this.fi[t],p=u?l.configRegistry.get(u):void 0;if(u&&p){let d=p.fromAttribute?p.fromAttribute(r):r;if(this.br(u)===d)return;this.jt(u,d);}});}disconnectedCallback(){super.disconnectedCallback(),this.yr&&(this.yr(),this.yr=void 0),this.hi&&(this.hi.disconnect(),this.hi=void 0);for(let t of this.Fe.values())t();this.Fe.clear();}static get observedAttributes(){let t=super.observedAttributes,e=Object.keys(zs);return [...t,...e]}};for(let o of lo)ii.prototype[o]=void 0;var $i=class extends I{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.mi="upload-file";this.cs=()=>{this.api.initFlow();};}static{n(this,"SimpleBtn");}static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"];}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.mi=t?"upload-files":"upload-file";});}render(){return y`<uc-drop-area .disabled=${!this.dropzone}><button type="button" @click=${this.cs}><uc-icon name="upload"></uc-icon><span>${this.l10n(this.mi)}</span>${this.yield("")}<div class="uc-visual-drop-area">${this.l10n("drop-files-here")}</div></button></uc-drop-area>`}};h([b({attribute:"dropzone",type:Boolean})],$i.prototype,"dropzone",2),h([g()],$i.prototype,"mi",2);var dl=n(o=>_a(o)?o.Nt.h:o.strings,"d"),ri=lt(class extends mt{constructor(o){super(o),this.et=new WeakMap;}render(o){return [o]}update(o,[i]){let t=Ss(this.it)?dl(this.it):null,e=Ss(i)?dl(i):null;if(t!==null&&(e===null||t!==e)){let r=Mi(o).pop(),s=this.et.get(t);if(s===void 0){let a=document.createDocumentFragment();s=lr(U,a),s.setConnected(false),this.et.set(t,s);}ki(s,[r]),Qt(s,void 0,r);}if(e!==null){if(t===null||t!==e){let r=this.et.get(e);if(r!==void 0){let s=Mi(r).pop();za(o),Qt(o,void 0,s),ki(o,[s]);}}this.it=i;}else this.it=void 0;return this.render(i)}});var Oe=class Oe extends I{constructor(){super(...arguments);this.showIcon=false;this.Ue=false;}static{n(this,"PrimaryAction");}static{this.styleAttrs=[...super.styleAttrs,"uc-primary-action"];}static{this.SOURCE_TEXT_CONFIG={[$.LOCAL]:{action:"upload-from"},[$.URL]:{action:"upload-from"},[$.CAMERA]:{action:"capture-with"},[$.MOBILE_PHOTO_CAMERA]:{action:"take"},[$.MOBILE_VIDEO_CAMERA]:{action:"record"}};}initCallback(){super.initCallback(),this.subConfigValue("smartButtonShowFirstIcon",t=>{this.showIcon=t;}),this.subConfigValue("multiple",t=>{this.Ue=t;});}get hasEntries(){return (this.entries?.allEntries?.length??0)>0}get hasSingleSuccessImage(){return this.entries?.allEntries?.length===1&&this.entries.isSuccess&&(this.entries.allEntries[0]?.isImage??false)}get hasMultipleEntries(){return (this.entries?.allEntries?.length??0)>=1}get localizedSourceLabel(){return this.source?.label?["local","url","camera"].includes(this.source?.id)?this.l10n(this.source.label).toLowerCase():this.l10n(this.source.label):""}gi(t,e){return this.l10n(t,e)}get textBasedOnLocale(){let t=this.md();return t||this.gd()}md(){if(this.entries?.status==="uploading")return this.gi("header-uploading",{count:this.entries.uploadingCount});if(this.entries?.status==="failed")return this.gi("header-failed",{count:this.entries.failedCount});if(this.entries?.status==="success")return this.gi("header-succeed",{count:this.entries.successCount});if(this.entries?.totalCount>0)return this.gi("header-total",{count:this.entries?.totalCount??0})}gd(){if(!this.source?.id)return "";let e=Oe.SOURCE_TEXT_CONFIG[this.source.id]?.action??"get-from",r;return this.source.id===$.MOBILE_PHOTO_CAMERA?r=this.l10n("photo").toLowerCase():this.source.id===$.MOBILE_VIDEO_CAMERA?r=this.l10n("video").toLowerCase():r=this.localizedSourceLabel,this.gi(e,{source:r})}cs(){if(this.hasEntries){this.e.ctx.pub("*currentActivity","upload-list"),this.e.modalManager?.open("upload-list");return}this.source?.onClick();}vd(){if(!this.Ue&&this.hasSingleSuccessImage){let e=this.entries.allEntries[0];return e?y`<uc-thumb .uid=${e.internalId}></uc-thumb>`:null}if(this.Ue&&this.hasMultipleEntries)return null;let t=this.source?.icon;return this.showIcon&&t?y`<uc-icon .name=${t}></uc-icon>`:null}render(){return y`<button @click=${this.cs} aria-label=${this.textBasedOnLocale}>${this.vd()}<span>${this.textBasedOnLocale}</span></button>`}};h([b({type:Object})],Oe.prototype,"source",2),h([b({type:Object})],Oe.prototype,"entries",2),h([g()],Oe.prototype,"showIcon",2),h([g()],Oe.prototype,"Ue",2);var Ks=Oe;var co=class extends x{constructor(){super(...arguments);this.Ha=ot.generateFastUid();this.yd=t=>{t.currentTarget.hidePopover();};}static{n(this,"DropDown");}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-down"];}render(){return y`<button class="uc-mini-btn uc-dropdown-btn" popovertarget=${this.Ha} popovertargetaction="toggle">${this.yield("dd-header-button")}</button><div id=${this.Ha} class="uc-dropdown-content" popover="auto" @click=${this.yd}>${this.yield("dd-content")}</div>`}};h([g()],co.prototype,"Ha",2);var js=class extends I{static{n(this,"NoWrapModeSmartBtn");}static{this.styleAttrs=[...super.styleAttrs,"uc-no-wrap-mode-smart-btn"];}};var Sd=n((o,i)=>i==="collapse"||o.length===0?{main:null,remain:o}:{main:o[0]??null,remain:o.slice(1)},"adjustSourceBasedOnMode"),Ad={collapse:"paperclip",allwrap:"arrow-dropdown",auto:"arrow-dropdown"},kd=3,Nt=class extends I{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.le="auto";this.z=[];this.Ne="idle";this.ja=0;this.q=he(()=>{this.isConnected&&this.bd();},300);}static{n(this,"SmartBtn");}static{this.styleAttrs=[...super.styleAttrs,"uc-smart-btn","uc-wgt-common"];}get isIdle(){return this.Ne==="idle"}get isSuccess(){return this.Ne==="success"}get isFailed(){return this.Ne==="failed"}get isUploading(){return this.Ne==="uploading"}get isCollapsedMode(){return this.le==="collapse"}get shouldShowPrimaryAction(){return !this.isCollapsedMode||!this.isIdle||this.hasCollectionEntries}get shouldShowInline(){return this.isIdle&&!this.hasCollectionEntries&&this.z.length>1&&(this.le==="nowrap"||this.le==="auto"&&this.z.length<=kd)}get shouldShowDropdown(){return this.isIdle&&!this.shouldShowInline&&!this.hasCollectionEntries&&(this.z.length>1||this.isCollapsedMode)}get hasCollectionEntries(){return (this.xr?.allEntries?.length??0)>0}get shouldShowAbortAction(){return !this.isIdle&&this.hasCollectionEntries}bd(){let t=this.api?.getOutputCollectionState();if(!t){console.warn("Collection state is undefined");return}this.xr=t,this.Ne=t.status;}Ga(){this.wr=Sd(this.z,this.le);}initCallback(){super.initCallback(),this.subConfigValue("smartButtonViewMode",t=>{this.le!==t&&(this.le=t,this.Ga());}),this.sub("*commonProgress",t=>{this.ja=t;}),this._o=new Je(this,{ctx:this.e.ctx,sharedInstancesBag:this.e,onSourcesChange:n(t=>{this.z=t,this.Ga();},"onSourcesChange")}),this.uploadCollection.observeProperties(this.q),this.uploadCollection.observeCollection(this.q),this.Ka=this.routerLayer.registerAfterFileAddHook(({historyLength:t})=>{if(t>0)return false;let e=this.e.ctx.read("*currentActivity");return e?this.modalManager?.close(e):this.modalManager?.closeAll(),this.e.ctx.pub("*currentActivity",null),true});}disconnectedCallback(){typeof this.q.cancel=="function"&&this.q.cancel(),this.Ka?.(),super.disconnectedCallback();}wd(){return y`<uc-no-wrap-mode-smart-btn>${this.wr?.remain?.map(t=>y`<uc-source-btn .iconOnly=${ true} role="menuitem" .source=${t} ></uc-source-btn>`)}</uc-no-wrap-mode-smart-btn>`}xd(){return Ad[this.le]??"arrow-dropdown"}Ed(){this.uploadCollection.clearAll();}Cd(){this.xr.failedEntries.forEach(t=>{t&&this.uploadCollection.hasItem(t.internalId)&&this.uploadCollection.remove(t.internalId);});}Td(){this.uploadCollection.abortAll();}pi(){switch(this.Ne){case "failed":this.Cd();break;case "uploading":this.Td();break;default:this.Ed();}}Sd(){return y`<uc-drop-down><uc-icon content-for="dd-header-button" name=${this.xd()} ></uc-icon><div content-for="dd-content" role="menu" class="uc-dropdown-menu">${this.wr?.remain?.map(t=>y`<uc-source-btn role="menuitem" .source=${t} ></uc-source-btn>`)}</div></uc-drop-down>`}Ad(){return y`<uc-primary-action .entries=${this.xr} .source=${this.wr?.main} ></uc-primary-action>`}kd(){return y`<uc-file-action-button @uc:remove=${this.pi} .uploading=${this.isUploading} .failed=${this.isFailed} .success=${this.isSuccess} .idle=${this.isIdle} .progress=${this.ja} ></uc-file-action-button>`}Md(){return ct({"uc-smart-btn-inner":true,"uc-failed":this.isFailed,"uc-uploading":this.isUploading,"uc-success":this.isSuccess})}Od(){return y`<div class="uc-visual-drop-area"><uc-icon name="arrow-down"></uc-icon></div>`}render(){return y`<uc-drop-area .disabled=${!this.dropzone}><div class=${this.Md()}>${ri(this.shouldShowPrimaryAction?this.Ad():null)} ${ri(this.shouldShowInline?this.wd():null)} ${ri(this.shouldShowDropdown?this.Sd():null)} ${ri(this.shouldShowAbortAction||this.hasCollectionEntries?this.kd():null)} ${ri(this.Od())}</div></uc-drop-area>`}};h([b({attribute:"dropzone",type:Boolean})],Nt.prototype,"dropzone",2),h([g()],Nt.prototype,"le",2),h([g()],Nt.prototype,"z",2),h([g()],Nt.prototype,"Ne",2),h([g()],Nt.prototype,"wr",2),h([g()],Nt.prototype,"xr",2),h([g()],Nt.prototype,"ja",2);var Di=class extends D{constructor(){super(...arguments);this.ds=O();}static{n(this,"PluginActivityHost");}initCallback(){this.activityType=this.registration?.id??null,this.qa(),super.initCallback();}willUpdate(t){super.willUpdate(t),t.has("registration")&&(this.qa(),this.isActivityActive&&(this.Er(),this.Wa()));}qa(){this.registration&&(this.qn()||this.registerActivity(this.activityType??"",{onActivate:n(()=>this.Wa(),"onActivate"),onDeactivate:n(()=>this.Er(),"onDeactivate")}));}async Wa(){await this.updateComplete;let t=this.ds.value;if(!t||!this.registration)return;this.Er();let e=this.$["*currentActivityParams"];try{this.us=this.registration.render(t,e)??void 0;}catch(r){console.error(`[Plugin "${this.registration.pluginId}"] Activity render() threw an error`,r);}}Er(){let t=this.ds.value;if(t){try{this.us?.();}catch(e){console.error(`[Plugin "${this.registration?.pluginId}"] Activity dispose threw an error`,e);}this.us=void 0,t.replaceChildren();}}disconnectedCallback(){this.Er(),super.disconnectedCallback();}render(){return y`<div style="display: contents;" ${L(this.ds)}></div>`}};h([b({attribute:false})],Di.prototype,"registration",2);var oi=class extends x{constructor(){super(...arguments);this.mode="modal";this.Ct=[];}static{n(this,"PluginActivityRenderer");}initCallback(){super.initCallback();let t=this.e.pluginManager;t?.onPluginsChange&&(this.E=t.onPluginsChange(()=>this.Za())),this.Za();}Za(){let t=this.e.pluginManager;if(!t){this.Ct=[];return}this.Ct=t.snapshot().activities;}disconnectedCallback(){this.E?.(),this.E=void 0,super.disconnectedCallback();}render(){return this.mode==="inline"?y`${Ri(this.Ct,t=>t.id,t=>y`<uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host>`)}`:y`${Ri(this.Ct,t=>t.id,t=>y`<uc-modal id=${t.id} strokes block-body-scrolling><uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host></uc-modal>`)}`}};h([b({type:String})],oi.prototype,"mode",2),h([g()],oi.prototype,"Ct",2);function Fi(o,i,t){return o?i(o):t?.(o)}n(Fi,"n");function pl(...o){return o.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},{})}n(pl,"normalize");function Et(...o){let i=pl(...o);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}n(Et,"classNames");function hl(o,...i){let t=pl(...i);for(let e of Object.keys(t))o.classList.toggle(e,!!t[e]);}n(hl,"applyClassNames");var Md=n(o=>nt.includes(o),"isTabIdValue"),ml=n(o=>{if(!o)return nt;let i=G(o).filter(Md);return i.length===0?nt:i},"parseTabs");function fl(o){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":nt,"*tabId":H.CROP,"*on.retryNetwork":n(()=>{let i=o.querySelectorAll("img");for(let t of i){let e=t.src;t.src=Lt,t.src=e;}o.$["*networkProblems"]=false;},"*on.retryNetwork"),"*on.apply":n(i=>{if(!i)return;let t=o.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=st(re(i),"preview"),r=Z(t,e),s={originalUrl:t,cdnUrlModifiers:e,cdnUrl:r,transformations:i};o.dispatchEvent(new CustomEvent("apply",{detail:s,bubbles:true,composed:true})),o.remove();},"*on.apply"),"*on.cancel":n(()=>{o.remove(),o.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));},"*on.cancel")}}n(fl,"initState");var gl="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 24 24' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path d='M19.248 9.561 12 16.003 4.752 9.561l.996-1.122L12 13.995l6.252-5.556z' fill='currentColor'/></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 Le={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},si=class extends x{constructor(){super(...arguments);this.kt=false;this.Ya=Le;this.Xa=Le.visible;this.Qa=Le.hidden;this.ps=false;this.Ja=false;}static{n(this,"PresenceToggle");}set visible(t){this.kt=t,this.tl();}get visible(){return this.kt}set styles(t){this.Ya=t,this.ps=true,this.Xa=t.visible??Le.visible,this.Qa=t.hidden??Le.hidden;}get styles(){return this.Ya}tl(){this.style.visibility=this.kt?"inherit":"hidden",hl(this,{[Le.transition]:!this.ps,[this.Xa]:this.kt,[this.Qa]:!this.kt}),this.toggleAttribute("inert",!this.kt);}Id(){this.Ja||(this.Ja=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.ps||this.classList.add(Le.transition),this.tl(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.Id();},0);}};h([b({type:Boolean})],si.prototype,"visible",1),h([b({attribute:false})],si.prototype,"styles",1);var Vi=class extends x{constructor(){super(...arguments);this.active=false;this.ce=O();this.hs=false;this.fs=()=>{let t=this.ce.value;t&&(this.il(t),this.hs&&this.active&&this.ms());};}static{n(this,"LineLoaderUi");}firstUpdated(t){super.firstUpdated(t),this.active&&this.ms();}updated(t){super.updated(t),t.has("active")&&(this.active?this.ms():this.Pd());}ms(){let t=this.ce.value;if(!t)return;this.hs=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.fs),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.fs,{once:true});}Pd(){let t=this.ce.value;t&&(this.hs=false,t.removeEventListener("transitionend",this.fs),this.il(t));}il(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return y`<div class="uc-inner"><div class="uc-line" ${L(this.ce)}></div></div>`}};h([b({type:Boolean,reflect:true})],Vi.prototype,"active",2);var W=n(o=>o??U,"o");var kt=class extends x{constructor(){super(...arguments);this.text="";this.icon="";this.reverse=false;this.theme="default";this.ariaRole=void 0;this.ariaControls="";this.titleProp="";this.active=false;}static{n(this,"BtnUi");}firstUpdated(t){super.firstUpdated(t),this.rl(),this.ol();}updated(t){super.updated(t),t.has("reverse")&&this.rl(),t.has("theme")&&this.ol();}rl(){this.style.flexDirection=this.reverse?"row-reverse":"";}ol(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get Ld(){let t=this.gs;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.Rd}}get gs(){return !this.icon}get Rd(){return !this.text&&!this.gs}render(){return y`<button type="button" role=${W(this.ariaRole||void 0)} aria-controls=${W(this.ariaControls||void 0)} aria-label=${W(this.l10n(this.titleProp))} title=${W(this.l10n(this.titleProp))} ><uc-icon class=${ct(this.Ld)} name=${W(this.icon||void 0)} ?hidden=${this.gs} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};h([b({type:String})],kt.prototype,"text",2),h([b({type:String})],kt.prototype,"icon",2),h([b({type:Boolean,reflect:true})],kt.prototype,"reverse",2),h([b({type:String,reflect:true})],kt.prototype,"theme",2),h([b({attribute:"aria-role"})],kt.prototype,"ariaRole",2),h([b({attribute:"aria-controls"})],kt.prototype,"ariaControls",2),h([b({attribute:"title-prop"})],kt.prototype,"titleProp",2),h([b({type:Boolean,noAccessor:true})],kt.prototype,"active",2);function vl(o,i){let t={};for(let e of i){let r=o[e];(Object.hasOwn(o,e)||r!==void 0)&&(t[e]=r);}return t}n(vl,"pick");function ni(o,i,t){let r=window.devicePixelRatio,s=Math.min(Math.ceil(i*r),3e3),a=r>=2?"lightest":"normal";return Z(o,st(gr,re(t),`quality/${a}`,`stretch/off/-/resize/${s}x`,`@clib/${Rt}/${$t}/uc-cloud-image-editor/`))}n(ni,"viewerImageSrc");var Ni=class extends x{constructor(){super(...arguments);this.sl=`uc-backdrop-mask-${ot.generateFastUid()}`;this.Tr=false;this.wi=false;this.ll=O();this.xi=false;this.Ei=null;this.ul=t=>{this.dl(),this.Ci&&(t.stopPropagation(),t.preventDefault(),this.Ci=false);};this.pl=t=>{if(!this.Ci||!this.Cr||!this.ys)return;t.stopPropagation(),t.preventDefault();let e=this.Gt;if(!e)return;let{x:r,y:s}=e.getBoundingClientRect(),a=t.x-r,l=t.y-s,c=a-this.Cr[0],u=l-this.Cr[1],{direction:p}=this.ys,d=this.zd(p,[c,u]);d&&(this.$["*cropBox"]=d);};this.hl=t=>{if(!this.$t)return;let e=Object.values(this.$t).find(r=>{if(!r||this.xs(r.direction))return false;let a=r.interactionNode.getBoundingClientRect(),l={x:a.x,y:a.y,width:a.width,height:a.height};return Ma(l,[t.x,t.y])});this.nl=e,this.dl();};}static{n(this,"CropFrame");}get Gt(){return this.ll.value??null}get Ci(){return this.wi}set Ci(t){this.wi!==t&&(this.wi=t,this.bs());}bs(){this.yi&&this.yi.setAttribute("class",Et({"uc-guides--hidden":this.Tr,"uc-guides--visible":!this.Tr&&this.wi,"uc-guides--semi-hidden":!this.Tr&&!this.wi}));}xs(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=M&&e.width<=M)return true;let r=e.height<=M&&(t.includes("n")||t.includes("s")),s=e.width<=M&&(t.includes("e")||t.includes("w"));return r||s}Ud(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:a}=t,l=this.Gt;if(!l)return;let c=bt("mask",{id:this.sl}),u=bt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),p=bt("rect",{x:e,y:r,width:s,height:a,fill:"black"});c.appendChild(u),c.appendChild(p);let d=bt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.sl})`});l.appendChild(d),l.appendChild(c),this.vi=c,this.vs=p;}$d(){this.vi&&(this.vi.style.display="none",window.requestAnimationFrame(()=>{this.vi&&(this.vi.style.display="block");}));}Dd(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:a}=t;this.vs&&le(this.vs,{x:e,y:r,width:s,height:a});}Fd(){let t=this.$["*cropBox"];if(!(!t||!this.yi||!this.$t)){for(let e of Object.values(this.$t)){if(!e)continue;let{direction:r,pathNode:s,interactionNode:a,groupNode:l}=e,c=r==="",u=r.length===2,{x:p,y:d,width:m,height:f}=t;if(c)le(a,{x:p,y:d,width:m,height:f});else {let w=ce(Math.min(m,f)/82/2,0,1),E=u?Ta(t,r,w):xa(t,r,w),T=E.center;if(!T)continue;let C=Math.max(ys*ce(Math.min(m,f)/ys/3,0,1),Ca);le(a,{x:T[0]-C,y:T[1]-C,width:C*2,height:C*2}),le(s,{d:E.d});}let v=this.xs(r);l.setAttribute("class",Et("uc-thumb",{"uc-thumb--hidden":v,"uc-thumb--visible":!v}));}le(this.yi,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}cl(t,e){let r=bt("g");r.classList.add("uc-thumb"),r.setAttribute("with-effects","");let s=bt("rect",{fill:"transparent"}),a=bt("path",{stroke:"currentColor",fill:"none","stroke-width":3});r.appendChild(a),r.appendChild(s),t[e]={direction:e,pathNode:a,interactionNode:s,groupNode:r},e===""&&(r.style.cursor="move"),s.addEventListener("pointerdown",this.Nd.bind(this,e));}Vd(){let t={};for(let e=0;e<3;e++)for(let r=0;r<3;r++){let s=`${["n","","s"][e]}${["w","","e"][r]}`;s!==""&&this.cl(t,s);}return this.cl(t,""),t}_d(){let t=bt("svg"),e=bt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});t.appendChild(e);for(let r=1;r<=2;r++){let s=bt("line",{x1:`${Si*r}%`,y1:"0%",x2:`${Si*r}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}for(let r=1;r<=2;r++){let s=bt("line",{x1:"0%",y1:`${Si*r}%`,x2:"100%",y2:`${Si*r}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}Bd(){let t=this.Gt;if(!t)return;let e=document.createDocumentFragment(),r=this._d();e.appendChild(r);let s=this.Vd();for(let{groupNode:a}of Object.values(s))e.appendChild(a);t.appendChild(e),this.$t=s,this.yi=r,this.bs();}Nd(t,e){if(!this.$t)return;let r=this.$t[t];if(!r||this.xs(t))return;let s=this.$["*cropBox"],a=this.Gt;if(!a)return;let{x:l,y:c}=a.getBoundingClientRect(),u=e.x-l,p=e.y-c;this.Ci=true,this.ys=r,this.Cr=[u,p],this.al={...s};}zd(t,e){let[r,s]=e,a=this.$["*imageBox"],l=this.al??this.$["*cropBox"],c=this.$["*currentAspectRatio"],u=c?c.width/c.height:void 0;if(t===""?l=Aa({rect:l,delta:[r,s],imageBox:a}):l=ka({rect:l,delta:[r,s],direction:t,aspectRatio:u,imageBox:a}),!Object.values(l).every(p=>Number.isFinite(p)&&p>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:l});return}return Ge(We(l),a)}dl(){let t=this.nl,e=this.Gt;e&&(e.style.cursor=t?Sa(t.direction):"initial");}fl(t){if(this.bi){this.bi.setAttribute("href",t);return}let e=this.Gt;if(!e){this.Ei=t;return}this.Ei=null;let r=document.createDocumentFragment(),s=bt("image",{href:t});s.setAttribute("class","uc-cloud-mask"),r.appendChild(s),e.appendChild(r),this.bi=s;}Hd(){let t=this.$["*cropBox"];if(!t||!this.bi)return;let{x:e,y:r,width:s,height:a}=t;le(this.bi,{x:e,y:r,height:a,width:s});}Es(){this.xi&&(this.Dd(),this.Fd(),this.Hd());}toggleThumbs(t){if(this.$t)for(let e of Object.values(this.$t)){if(!e)continue;let{groupNode:r}=e;r.setAttribute("class",Et("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.$d(),this.xi&&window.requestAnimationFrame(()=>{this.Es();});}),this.sub("*cropBox",t=>{t&&(this.Tr=t.height<=M||t.width<=M,this.bs(),this.xi&&window.requestAnimationFrame(()=>{this.Es();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.fl(t);}),document.addEventListener("pointermove",this.pl,true),document.addEventListener("pointerup",this.ul,true);}firstUpdated(t){super.firstUpdated(t),this.Kd();}Kd(){let t=this.Gt;if(!(!t||this.xi)){if(this.Ud(),this.Bd(),this.xi=true,t.addEventListener("pointermove",this.hl,true),this.Ei){let e=this.Ei;this.Ei=null,this.fl(e);}this.Es();}}disconnectedCallback(){super.disconnectedCallback(),this.Gt?.removeEventListener("pointermove",this.hl,true),document.removeEventListener("pointermove",this.pl,true),document.removeEventListener("pointerup",this.ul,true);}render(){return y`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${L(this.ll)}></svg>`}};h([g()],Ni.prototype,"wi",2);function Od(o){return o?[({dimensions:t,coords:e})=>[...t,...e].every(r=>Number.isInteger(r)&&Number.isFinite(r)),({dimensions:t,coords:e})=>t.every(r=>r>0)&&e.every(r=>r>=0)].every(t=>t(o)):true}n(Od,"validateCrop");var _i=class extends x{constructor(){super();this.ctxOwner=true;this.ue={width:0,height:0};this.i=null;this._=false;this.vt=null;this.gl=O();this.Ts=O();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.ml=V(this.vl.bind(this),300),this.Cs=he(()=>{!this.isConnected||!this._||(this.Ss(),this.yl(),this.bl(),this.As(),this.ks());},100);}static{n(this,"EditorImageCropper");}firstUpdated(t){super.firstUpdated(t),this.Ss();}yl(){let t=this.$["*editorTransformations"],e=vl(t,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...e};this.$["*operations"]=r;}Ss(){let t=this.gl.value;if(!t)return;let e=t.getContext("2d"),r=this.offsetWidth,s=this.offsetHeight,a=window.devicePixelRatio;t.style.width=`${r}px`,t.style.height=`${s}px`,t.width=r*a,t.height=s*a,e?.scale(a,a),this.Mt=t,this.i=e;}bl(){if(!this._||!this.vt)return;let t=this.vt,e=this.$["*padding"],r=this.$["*operations"],{rotate:s}=r,a={width:this.offsetWidth,height:this.offsetHeight},l=qe({width:t.naturalWidth,height:t.naturalHeight},s),c;if(l.width>a.width-e*2||l.height>a.height-e*2){let u=l.width/l.height,p=a.width/a.height;if(u>p){let d=a.width-e*2,m=d/u,f=0+e,v=e+(a.height-e*2)/2-m/2;c={x:f,y:v,width:d,height:m};}else {let d=a.height-e*2,m=d*u,f=e+(a.width-e*2)/2-m/2,v=0+e;c={x:f,y:v,width:m,height:d};}}else {let{width:u,height:p}=l,d=e+(a.width-e*2)/2-u/2,m=e+(a.height-e*2)/2-p/2;c={x:d,y:m,width:u,height:p};}this.$["*imageBox"]=We(c);}As(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,a=this.$["*editorTransformations"].crop,{width:l,x:c,y:u}=e;if(a){let{dimensions:[m,f],coords:[v,w]}=a,{width:E}=qe(this.ue,s),T=l/E;t=Ge(We({x:c+v*T,y:u+w*T,width:m*T,height:f*T}),e);}let p=this.$["*currentAspectRatio"],d=p?p.width/p.height:void 0;if(!Ia(t,e)||d&&!Oa(t,d)){let m=e.width/e.height,f=e.width,v=e.height;d&&(m>d?f=Math.min(e.height*d,e.width):v=Math.min(e.width/d,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"]=Ge(We(t),e);}jd(){let t=this.i;if(!t)return;let e=this.vt;if(!e)return;let r=this.$["*imageBox"],s=this.$["*operations"],{mirror:a,flip:l,rotate:c}=s,u=qe({width:r.width,height:r.height},c);t.save(),t.translate(r.x+r.width/2,r.y+r.height/2),t.rotate(c*Math.PI*-1/180),t.scale(a?-1:1,l?-1:1),t.drawImage(e,-u.width/2,-u.height/2,u.width,u.height),t.restore();}ks(){if(!this._||!this.vt||!this.Mt||!this.i)return;let t=this.Mt;this.i.clearRect(0,0,t.width,t.height),this.jd();}Gd({fromViewer:t}){this.vt&&(this.Ts.value?.toggleThumbs(true),this.qd(),setTimeout(()=>{this.className=Et({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}wl(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,{width:a,height:l}=e,{width:c,height:u}=qe(this.ue,s),{width:p,height:d}=t,m=a/c,f=l/u;return [ce(Math.round(p/m),1,c),ce(Math.round(d/f),1,u)]}Wd(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,{width:a,height:l,x:c,y:u}=e,{width:p,height:d}=qe(this.ue,s),{x:m,y:f}=t,v=a/p,w=l/d,E=this.wl(),T={dimensions:E,coords:[ce(Math.round((m-c)/v),0,p-E[0]),ce(Math.round((f-u)/w),0,d-E[1])]};if(!Od(T)){console.error("Cropper is trying to create invalid crop object",{payload:T});return}if(!(E[0]===p&&E[1]===d))return T}vl(){if(!this.isConnected||!this.ue)return;let t=this.$["*operations"],{rotate:e,mirror:r,flip:s}=t,a=this.Wd(),c={...this.$["*editorTransformations"],crop:a,rotate:e,mirror:r,flip:s};this.$["*editorTransformations"]=c;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this._&&(this.bl(),this.As(),this.ks());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this._){this._=true,await this.updateComplete,this.Ss(),this.ue=t,this.removeEventListener("transitionend",this.xl);try{let r=this.$["*originalUrl"],s=this.$["*editorTransformations"];this.vt=await this.Zd(r,s),this.yl(),this.Cs(),this.Gd({fromViewer:e});}catch(r){console.error("Failed to activate cropper",{error:r}),this.telemetryManager.sendEventError(r,"cloud editor image. Failed to activate cropper");}this.s=new ResizeObserver(r=>{let[s]=r;if(!s)return;s.contentRect.width>0&&s.contentRect.height>0&&this._&&this.vt&&this.Cs();}),this.s.observe(this);}}deactivate({reset:t=false}={}){this._&&(!t&&this.vl(),this._=false,this.Yd(),this.className=Et({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.Ts.value?.toggleThumbs(false),this.addEventListener("transitionend",this.xl,{once:true}),this.s?.disconnect());}Yd(){let t=this.wl(),e=this.$["*cropBox"],r=Math.min(this.offsetWidth,t[0])/e.width,s=Math.min(this.offsetHeight,t[1])/e.height,a=Math.min(r,s),l=e.x+e.width/2,c=e.y+e.height/2;this.style.transform=`scale(${a}) translate(${(this.offsetWidth/2-l)/a}px, ${(this.offsetHeight/2-c)/a}px)`,this.style.transformOrigin=`${l}px ${c}px`;}qd(){let t=this.$["*cropBox"],e=t.x+t.width/2,r=t.y+t.height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${r}px`;}xl(){this._||(this.vt=null);}async Zd(t,e){let r=this.offsetWidth;e={...e,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let s=await this.proxyUrl(ni(t,r,e)),{promise:a,cancel:l,image:c}=Me(s),u=this.Ve(s);return c.addEventListener("load",u,{once:true}),c.addEventListener("error",u,{once:true}),this.b?.(),this.b=l,a.then(()=>c).catch(p=>(console.error("Failed to load image",{error:p}),this.$["*networkProblems"]=true,c))}Ve(t){let e="crop",r=this.$["*loadingOperations"],s=r.get(e);return s||(s=new Map,r.set(e,s)),s.get(t)||(s.set(t,true),this.$["*loadingOperations"]=r),()=>{let a=r.get(e);a?.has(t)&&(a.delete(t),this.$["*loadingOperations"]=r);}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.ks();}),this.sub("*cropBox",()=>{this.vt&&this.ml();}),this.sub("*currentAspectRatio",()=>{this.As();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this._&&this.ue&&this.activate(this.ue,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.vt&&(this.vt=null);}render(){return y`<canvas class="uc-canvas" ${L(this.gl)}></canvas><uc-crop-frame ${L(this.Ts)}></uc-crop-frame>`}};h([g()],_i.prototype,"vt",2);function Gs(o,i,t){let e=t,r=t-1,s=new Array(e);for(let a=r;a>=0;a-=1)s[a]=Math.ceil((a*i+(r-a)*o)/r);return s}n(Gs,"linspace");function Ld(o){return typeof o=="string"&&o in Ot}n(Ld,"isOperationKey");function Pd(o){let i=[];for(let t=0;t<o.length-1;t+=1){let e=o[t],r=o[t+1];typeof e=="number"&&typeof r=="number"&&i.push([e,r]);}return i}n(Pd,"splitBySections");function Ud(o,i,t){let e=Pd(o).find(([a,l])=>a<=i&&i<=l);if(!e)return o.map(()=>0);let[r,s]=e;return o.map(a=>{let l=Math.abs(r-s)||1,c=Math.abs(i-r)/l;return r===a?i>t?1:1-c:s===a?i>=t?c:1:0})}n(Ud,"calculateOpacities");function Rd(o,i){return o.map((t,e)=>t<i?o.length-e:e)}n(Rd,"calculateZIndices");function yl(o,i){let t=Ot[o].keypointsNumber,{range:e,zero:r}=Ot[o];return [...new Set([...Gs(e[0],r,t+1),...Gs(r,e[1],t+1),r,i])].sort((s,a)=>s-a)}n(yl,"keypointsRange");var uo=class extends x{constructor(){super();this._=false;this.Ms=true;this.n="initial";this.El={};this.qt=[];this.Cl=0;this.Sl=O();this.Sr=O();this.classList.add("uc-inactive_to_cropper"),this.Tl=V(async(t,e,r)=>{let s=n(()=>!this.Al(t,e)||this.Re!==r||!!this.qt.find(u=>u.value===r),"shouldSkip");if(s())return;let a=await this.kl(t,r),l=new Image;l.src=a.src;let c=this.Ve(a.src);l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),a.image=l,l.classList.add("uc-fader-image"),l.addEventListener("load",()=>{if(s())return;let u=this.qt,p=u.findIndex(v=>v.value>r);p===-1&&(p=u.length);let m=u[p]?.image,f=this.Sr.value;!f||m&&!f.contains(m)||(u.splice(p,0,a),m?f.insertBefore(l,m):f.appendChild(l),this.Ps(t,r));},{once:true}),l.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}static{n(this,"EditorImageFader");}Ve(t){let e=this.n,r=this.$["*loadingOperations"];r.has(e)||r.set(e,new Map);let s=r.get(e);return s&&!s.get(t)&&(s.set(t,true),this.$["*loadingOperations"]=r),()=>{let a=r.get(e);a?.has(t)&&(a.delete(t),this.$["*loadingOperations"]=r);}}Ml(){window.cancelAnimationFrame(this.Cl),this.Cl=window.requestAnimationFrame(()=>{for(let t of this.qt){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}de({url:t=this._e,filter:e=this.m??void 0,operation:r,value:s}={}){if(!t)throw new Error("URL is not defined");let a={...this.El};r&&(r==="filter"?e&&typeof s=="number"&&(a.filter={name:e,amount:s}):typeof s=="number"&&(a[r]=s));let l=this.offsetWidth;return this.proxyUrl(ni(t,l,a))}async kl(t,e){return {src:await this.de({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}Al(t,e){return this.n===t&&this.m===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!Ld(this.n)||!Number.isFinite(e)||(this.Ps(this.n,e),this.Tl(this.n,this.m,e));}Ps(t,e){this.n=t,this.Re=e;let{zero:r}=Ot[t],s=this.qt.map(c=>c.value),a=Ud(s,e,r),l=Rd(s,r);this.qt.forEach((c,u)=>{let p=a[u],d=l[u];typeof p=="number"&&(c.opacity=p),typeof d=="number"&&(c.zIndex=d);}),this.Ml();}Ol(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async Xd(){this.a=this.a||this.Ol();let t=this.a;t&&this.Il(t);let e=this.qt.map(u=>u.src),{images:r,promise:s,cancel:a}=Ui(e);r.forEach(u=>{let p=this.Ve(u.src);u.addEventListener("load",p),u.addEventListener("error",p);}),this.Os=()=>{a(),this.Os=void 0;};let l=this.n,c=this.m;if(await s,this._&&this.Al(l,c)){let u=this.Sr.value;if(!u)return;u.replaceChildren(),this.qt.forEach((p,d)=>{let m=r[d];m&&(m.classList.add("uc-fader-image"),p.image=m,u.appendChild(m));}),this.Ml();}}async setTransformations(t){if(this.El=t,this.a){let e=await this.de(),r=this.Ve(e);this.a.src=e,this.a.addEventListener("load",r,{once:true}),this.a.addEventListener("error",r,{once:true}),this.a.style.opacity="1",this.a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:t,filter:e,operation:r,value:s}){if(!r||typeof s!="number")return;this.Is?.();let a=yl(r,s),l=await Promise.all(a.map(u=>this.de({url:t,filter:e,operation:r,value:u}))),{cancel:c}=Ui(l);this.Is=c;}Qd(t){let e=this.a||this.Ol();if(this.Il(e),this.a=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=Et({"uc-active_from_viewer":this.Ti,"uc-active_from_cropper":!this.Ti,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let r=this.Ve(t);e.addEventListener("error",r,{once:true}),e.src=t,e.addEventListener("load",()=>{r(),e&&(e.style.opacity="1",e.style.transform="scale(1)",this.className=Et({"uc-active_from_viewer":this.Ti,"uc-active_from_cropper":!this.Ti,"uc-inactive_to_cropper":false}));},{once:true}),e.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}async activate({url:t,operation:e,value:r,filter:s,fromViewer:a}){if(this._=true,this.Ms=false,await this.updateComplete,this._e=t,this.n=e??"initial",this.Re=r,this.m=s,this.Ti=a,typeof r!="number"&&!s){let c=await this.de({operation:e,value:r});this.Qd(c),this.Ls();return}!e||typeof r!="number"||(this.qt=await Promise.all(yl(e,r).map(c=>this.kl(e,c))),this.Ps(e,r),this.Xd());}deactivate({hide:t=true}={}){this._=false,this.Os?.(),this.Is?.(),t&&!this.Ms?(this.Ms=true,this.a&&(this.a.style.transform="scale(1)"),this.className=Et({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.Ls();},{once:true})):this.Ls();}Il(t){let e=this.Sl.value;e&&(e.contains(t)||e.appendChild(t));}Ls(){this.Sr.value?.replaceChildren();}render(){return y`<div class="uc-fader-preview-host" ${L(this.Sl)}></div><div class="uc-fader-layers-host" ${L(this.Sr)}></div>`}};var bl="important",$d=" !"+bl,Ue=lt(class extends mt{constructor(o){if(super(o),o.type!==Dt.ATTRIBUTE||o.name!=="style"||o.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(o){return Object.keys(o).reduce((i,t)=>{let e=o[t];return e==null?i:i+`${t=t.includes("-")?t:t.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${e};`},"")}update(o,[i]){let{style:t}=o.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 r=i[e];if(r!=null){this.ft.add(e);let s=typeof r=="string"&&r.endsWith($d);e.includes("-")||s?t.setProperty(e,s?r.slice(0,-11):r,s?bl:""):t[e]=r;}}return rt}});var _t=class extends x{constructor(){super();this.Rs=0;this.Ar=O();this.Ll=O();this.Rl=O();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.Wt=0;this.tp=t=>{t.stopPropagation();let e=this.Ul(t);e!==null&&(this.Us(e),this.Jd("slider-input",e));};this.ep=t=>{t.stopPropagation();let e=this.Ul(t);e!==null&&this.Us(e);};this.$l=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.Dl=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}static{n(this,"SliderUi");}Jd(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.Rs=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.Fl(this.Wt),this.$s(),this.s=new ResizeObserver(()=>{this.$s(),this.kr(this.Wt);}),this.s.observe(this);let e=this.Ar.value;e?.addEventListener("focus",this.$l),e?.addEventListener("blur",this.Dl),window.setTimeout(()=>{this.kr(this.Wt);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.Wt&&this.Us(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.$s(),this.kr(this.Wt)),t.has("zero")&&this.hasUpdated&&this.Nl(this.Wt);}kr(t){this.Nl(t);let e=this.max-this.min;if(e===0)return;let{width:r}=this.getBoundingClientRect(),l=100/e*(t-this.min)*(r-this.Rs)/100;window.requestAnimationFrame(()=>{let c=this.Ll.value;c&&(c.style.transform=`translateX(${l}px)`);});}Nl(t){if(!this.Si)return;let e=this.max-this.min;if(e===0)return;this.Si.style.opacity=t===this.zero?"0":"1";let{width:r}=this.getBoundingClientRect(),l=100/e*(this.zero-this.min)*(r-this.Rs)/100;window.requestAnimationFrame(()=>{this.Si&&(this.Si.style.transform=`translateX(${l}px)`);});}$s(){let e=this.Rl.value;if(!e)return;let{width:r}=e.getBoundingClientRect(),s=Math.ceil(r/2),a=Math.ceil(s/15)-2;if(this.Pl===a)return;let l=document.createDocumentFragment(),c=document.createElement("div"),u=document.createElement("div");c.className="uc-minor-step",u.className="uc-border-step",l.appendChild(u);for(let d=0;d<a;d+=1)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());for(let d=0;d<a;d+=1)l.appendChild(c.cloneNode());l.appendChild(u.cloneNode());let p=document.createElement("div");p.className="uc-zero-dot",l.appendChild(p),this.Si=p,e.innerHTML="",e.appendChild(l),this.Pl=a;}disconnectedCallback(){super.disconnectedCallback();let t=this.Ar.value;t?.removeEventListener("focus",this.$l),t?.removeEventListener("blur",this.Dl),this.s?.disconnect(),this.s=void 0;}Us(t){Number.isFinite(t)&&(this.Wt=t,this.hasUpdated&&(this.Fl(t),this.kr(t)));}Fl(t){let e=this.Ar.value;e&&(e.value=String(t));}Ul(t){let e=t.currentTarget;if(!e)return null;let r=Number.parseInt(e.value,10);return Number.isFinite(r)?r:null}render(){return y`<div class="uc-steps" ${L(this.Rl)}></div><div class="uc-thumb" ${L(this.Ll)}></div><input class="uc-input" type="range" ${L(this.Ar)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.Wt)} ?disabled=${this.disabled} @input=${this.tp} @change=${this.ep} />`}};h([b({type:Boolean,reflect:true})],_t.prototype,"disabled",2),h([b({type:Number})],_t.prototype,"min",2),h([b({type:Number})],_t.prototype,"max",2),h([b({type:Number,attribute:false})],_t.prototype,"defaultValue",2),h([b({type:Number})],_t.prototype,"zero",2),h([g()],_t.prototype,"Wt",2);var Bt="original",Bi=class extends x{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.Ds=t=>{let{value:e}=t.detail;this.$["*faderEl"]?.set(e),this.state={...this.state,value:e};};}static{n(this,"EditorSlider");}setOperation(t,e){this.state={...this.state,operation:t,filter:e},this.ip();let r=this.$["*faderEl"],s=this.state.originalUrl||this.$["*originalUrl"];r&&s&&r.activate({url:s,operation:this.state.operation,value:this.state.filter===Bt?void 0:this.state.value,filter:this.state.filter===Bt?void 0:this.state.filter,fromViewer:false});}ip(){let t=this.state.operation,{range:e,zero:r}=Ot[t],[s,a]=e;this.state={...this.state,min:s,max:a,zero:r};let c=this.$["*editorTransformations"][t];if(t==="filter"){let p=Number(a),d=c;if(d){let{name:m,amount:f}=d;p=m===this.state.filter?f:a;}this.state={...this.state,value:p,defaultValue:p};return}let u=typeof c<"u"?c:r;this.state={...this.state,value:u,defaultValue:u};}apply(){let e={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===Bt?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 y`<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.Ds} ></uc-slider-ui>`}};h([g()],Bi.prototype,"state",2);function ai(o){if(!o)return null;let i=o.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)}}n(ai,"parseFilterValue");var dt=class extends x{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}static{n(this,"EditorButtonControl");}get buttonClasses(){let t=this.active;return {"uc-active":t,"uc-not_active":!t}}Vl(){let t=this.buttonClasses;for(let[e,r]of Object.entries(t))this.classList.toggle(e,r);}onClick(t){}connectedCallback(){super.connectedCallback(),this.Vl();}updated(t){super.updated(t),t.has("active")&&this.Vl();}render(){let t=this.onClick,e=this.title;return y`<button role="option" type="button" aria-label=${W(this.titleProp)} title=${W(this.titleProp)} @click=${t} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};h([g()],dt.prototype,"active",2),h([g()],dt.prototype,"title",2),h([g()],dt.prototype,"icon",2),h([g()],dt.prototype,"titleProp",2);var po=12,ho=16,Dd=n(o=>{let i=12,t=12;return o.width/o.height>=1?(i=po,t=Math.round(po*o.height/o.width)):(t=po,i=Math.round(po*o.width/o.height)),{width:i,height:t}},"getAdjustResolutions"),mo=class extends dt{static{n(this,"EditorFreeformButtonControl");}initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this.rp(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}rp(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 y`<button role="option" type="button" class=${ct(this.buttonClasses)} aria-label=${W(this.titleProp)} title=${W(this.titleProp)} @click=${i} ><div class="uc-title" ?hidden=${!t}>${t}</div><uc-icon name=${this.icon}></uc-icon></button>`}},zi=class extends dt{constructor(){super(...arguments);this.tt=null;}static{n(this,"EditorAspectRatioButtonControl");}get aspectRatio(){return this.tt}set aspectRatio(t){if(this.tt===t)return;let e=this.tt;this.tt=t,this.requestUpdate("aspectRatio",e),t?this._l(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.tt&&this._l(this.tt),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.tt?.id||t?.width===this.tt?.width&&t?.height===this.tt?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.tt?.id&&(this.$["*currentAspectRatio"]=this.tt);}_l(t){if(!this.isConnected)return;let e=!!t.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",e);let r=n(()=>{let a=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=a,a},"resolveTitle"),s=n(()=>{let a=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=a,a},"resolveTitleProp");r(),s(),e||this.requestUpdate();}op(){let t=this.tt;if(!t||t.hasFreeform)return y`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:r}=Dd(t),s=(ho-e)/2,a=(ho-r)/2;return y`<uc-icon><svg viewBox="0 0 ${ho} ${ho}" aria-hidden="true" focusable="false" ><rect x=${s} y=${a} width=${e} height=${r} 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 y`<button role="option" type="button" class=${ct(this.buttonClasses)} aria-label=${W(this.titleProp)} title=${W(this.titleProp)} @click=${t} >${this.op()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};h([b({attribute:false})],zi.prototype,"aspectRatio",1);function Fd(o){let i=o+90;return i=i>=360?0:i,i}n(Fd,"nextAngle");function Vd(o,i){if(o==="rotate")return Fd(typeof i=="number"?i:0);if(o==="mirror"||o==="flip")return !i;throw new Error(`Unsupported operation: ${o}`)}n(Vd,"nextValue");var Hi=class extends dt{constructor(){super(...arguments);this.operation=void 0;}static{n(this,"EditorCropButtonControl");}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"],r=e.getValue(this.operation),s=Vd(this.operation,r);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:s,prev:r}),e.setValue(this.operation,s);}};h([b({type:String})],Hi.prototype,"operation",2);var Jt=class extends dt{constructor(){super(...arguments);this.n="";this.m="";this.Ai="";this.Mr=0;this.a=null;this.ze=false;this.isOriginal=false;this.Bl=20;}static{n(this,"EditorFilterControl");}get filter(){return this.m}set filter(t){let e=t??"";if(this.m===e)return;let r=this.m;this.m=e,this.n="filter",this.isOriginal=e===Bt,this.icon=this.isOriginal?"original":"slider",this.Bl=this.isOriginal?40:20,this.requestUpdate("filter",r),this.isConnected&&this.zl(e);}onClick(t){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this.n,this.m),this.$["*showSlider"]=true);else {let e=this.$["*sliderEl"];e.setOperation(this.n,this.m),e.apply();}this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:ai(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.m;}sp(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.Bl||32,r=window.devicePixelRatio,s=Math.ceil(r*e),a=r>=2?"lightest":"normal",l=100,c={...this.$["*editorTransformations"]};return c[this.n]=this.m!==Bt?{name:this.m,amount:l}:void 0,Z(this.Ai,st(gr,re(c),`quality/${a}`,`scale_crop/${s}x${s}/center`,`@clib/${Rt}/${$t}/uc-cloud-image-editor/`))}async di(t,e){t[0]?.isIntersecting?await this.Fs(e):this.b?.();}initCallback(){super.initCallback(),this.s=new window.IntersectionObserver(this.di.bind(this),{threshold:[0,1]});let t=this.$["*originalUrl"];this.Ai=t??"",this.sub("*originalUrl",e=>{this.Ai=e??"",!this.isOriginal&&this.Ai&&this.isConnected&&!this.a&&(this.s?.observe(this),this.pe());}),this.isOriginal||(this.s?.observe(this),this.pe()),this.m&&this.zl(this.m),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.m);}),this.sub("*networkProblems",async e=>{e||(this.a?await this.Fs():this.pe());});}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.b?.(),this.Or();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.s?.unobserve(this):(this.s?.observe(this),this.pe()));}zl(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async Fs(t){if(!this.isConnected){t?.unobserve(this),this.b?.(),this.b=void 0;return}if(!this.Ai){!this.Be&&!this.Zt&&this.pe();return}let e=++this.Mr,r="";try{r=await this.proxyUrl(this.sp());}catch(l){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:l});return}this.ze=false,this.b?.();let{promise:s,cancel:a}=Me(r);this.b=()=>{a(),this.Mr===e&&(this.b=void 0);};try{if(await s,this.Mr!==e||!this.isConnected)return;this.a=r,this.ze=!0,this.Or(),(t??this.s)?.unobserve(this);}catch(l){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:l}),this.pe();}finally{this.Mr===e&&(this.b=void 0);}}pe(){if(!this.isConnected||this.a||this.ze||this.isOriginal||this.$["*networkProblems"]){this.Or();return}this.Zt&&cancelAnimationFrame(this.Zt),this.Zt=requestAnimationFrame(()=>{if(this.Zt=void 0,!this.isConnected||this.a||this.ze||this.isOriginal){this.Or();return}let t=this.getBoundingClientRect(),e=t.width>0&&t.height>0,r=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;if(e&&t.bottom>0&&t.right>0&&t.top<s&&t.left<r){this.Fs();return}this.Be=window.setTimeout(()=>{this.Be=void 0,this.pe();},500);});}Or(){this.Zt&&(cancelAnimationFrame(this.Zt),this.Zt=void 0),this.Be&&(window.clearTimeout(this.Be),this.Be=void 0);}get np(){return !!(this.ze&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.np?"1":"0"};this.a&&(e.backgroundImage=`url(${this.a})`);let r={opacity:this.active||this.isOriginal?"1":"0"};return y`<button role="option" type="button" class=${ct(this.buttonClasses)} aria-label=${W(this.titleProp)} title=${W(this.titleProp)} @click=${t} ><div class="uc-preview" ?data-loaded=${this.ze} style=${Ue(e)}></div><uc-icon class=${ct({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${Ue(r)} ></uc-icon></button>`}};h([g()],Jt.prototype,"a",2),h([g()],Jt.prototype,"ze",2),h([g()],Jt.prototype,"isOriginal",2),h([g()],Jt.prototype,"Bl",2),h([b({type:String})],Jt.prototype,"filter",1);var Ki=class extends dt{constructor(){super(...arguments);this.n="";}static{n(this,"EditorOperationControl");}get operation(){return this.n}set operation(t){let e=t??"";if(this.n===e)return;let r=this.n;this.n=e,this.requestUpdate("operation",r),this.isConnected&&e&&this.Hl(e);}Hl(t){this.icon=t;let e=n(()=>{let s=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=s,s},"resolveTitleProp"),r=n(()=>{let s=this.l10n(t);return this.title=s,s},"resolveTitle");e(),r();}initCallback(){super.initCallback(),this.n&&this.Hl(this.n),this.sub("*editorTransformations",t=>{if(!this.n)return;let{zero:e}=Ot[this.n],r=t[this.n],s=typeof r<"u"?r!==e:false;this.active=s;});}onClick(t){this.$["*sliderEl"]?.setOperation(this.n),this.$["*showSlider"]=true,this.$["*currentOperation"]=this.n,this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:ai(this.$["*operationTooltip"])});}};h([b({type:String})],Ki.prototype,"operation",1);var Nd=1,wl=n(()=>{},"noopScrollListener"),ji=class extends x{constructor(){super(...arguments);this.hiddenScrollbar=false;this.Kl=t=>{t.preventDefault();let{deltaY:e,deltaX:r}=t;if(Math.abs(r)>Nd){this.scrollLeft+=r;return}this.scrollLeft+=e;};}static{n(this,"EditorScroller");}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.Kl,{passive:false}),this.addEventListener("scroll",wl,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.Kl),this.removeEventListener("scroll",wl),super.disconnectedCallback();}};h([b({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],ji.prototype,"hiddenScrollbar",2);var gt=class extends x{constructor(){super(...arguments);this.ki=false;this.showMainToolbar=true;this.showSubToolbar=false;this.jl=true;this.tabList=[...nt];this.activeTab=H.CROP;this.Ir=true;this.Ns=false;this.Gl=null;this.ql=0;this.Wl=0;this.Pr=O();this.Zl=O();this.tabToggleRefs={[H.CROP]:O(),[H.TUNING]:O(),[H.FILTERS]:O()};this.Yl=()=>{this.he();};this.Mi=[];this.Lr=V(t=>{this.ki=t;},500);this.Rr=V(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],r="",s=false;if(this.$["*tabId"]===H.FILTERS)if(s=true,this.$["*currentFilter"]&&t?.filter?.name===this.$["*currentFilter"]){let a=t?.filter?.amount||100;r=`${this.$["*currentFilter"]} ${a}`;}else r=this.l10n(Bt);else if(this.showSubToolbar&&this.$["*tabId"]===H.TUNING&&e){s=true;let a=t?.[e]||Ot[e].zero;r=`${this.l10n(e)} ${a}`;}s&&(this.$["*operationTooltip"]=r),this.Ns=s;},0);this.ap={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.lp={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.cp={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.up={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":Bt,"*currentOperation":null,"*operationTooltip":null};this.Ut=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.b?.();let e=this.$["*on.cancel"];e?.();};this.zs=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.xp=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:ai(this.$["*operationTooltip"])}),this.Pr.value?.apply(),this.Xl();};this.Ep=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.Pr.value?.cancel(),this.Xl();};this.Cp=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&(this.telemetryManager.sendEventCloudImageEditor(t,r),this.Vs(r,{fromViewer:false}));};}static{n(this,"EditorToolbar");}Xl(){this.$["*showSlider"]=false,this.$["*tabId"]===H.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===H.TUNING&&(this.Ns=false);}Vs(t,{fromViewer:e=false,force:r=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.Ql(t,{fromViewer:e,force:r});}Ql(t,{fromViewer:e,force:r=false}){if(!r&&this.activeTab===t){this.he();return}this.activeTab=t;let s=this.$["*faderEl"],a=this.$["*cropperEl"];t===H.CROP?(s?.deactivate(),this.$["*imageSize"]&&a?.activate(this.$["*imageSize"],{fromViewer:e})):(s?.activate({url:this.$["*originalUrl"],fromViewer:e}),a?.deactivate());for(let l of nt){let c=l===t,p=this.tabToggleRefs[l]?.value;p&&(p.active=c),c&&this.he();}}he(){let e=this.tabToggleRefs[this.activeTab]?.value,r=this.Zl.value;if(!e||!r)return;let s=e.offsetLeft,a=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.ql!==s||this.Wl!==a)&&(this.ql=s,this.Wl=a,r.style.transform=`translateX(${s}px)`,r.style.width=`${a}px`);}get _s(){return this.Mi.length>=3}dp(t){switch(t){case H.CROP:return this.pp();case H.FILTERS:return this.hp();case H.TUNING:return this.fp();default:return []}}pp(){let t=[];if(this._s)t.push(()=>this.mp());else for(let e of this.Mi)t.push(()=>this.Jl(e));for(let e of Pn)t.push(()=>this.gp(e));return this.Bs(t)}hp(){let e=[Bt,...Ln].map(r=>()=>this.vp(r));return this.Bs(e)}fp(){let t=On.map(e=>()=>this.yp(e));return this.Bs(t)}Bs(t){return t.length?t.map(r=>r()):[]}mp(){return y`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}Jl(t){return y`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}gp(t){return y`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}vp(t){return y`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}yp(t){return y`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}bp(){return this._s?this.Mi.map(t=>this.Jl(t)):[]}async wp(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(ni(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.b?.();let{cancel:r}=Ui([e]);this.b=()=>{r(),this.b=void 0;};}}initCallback(){super.initCallback();let t=this.$["*cropPresetList"]??[];this.Mi=[...t],this.sub("*cropPresetList",e=>{this.Mi=[...e??[]];}),this.sub("*imageSize",e=>{e&&setTimeout(()=>{this.Vs(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let r=e?.filter?.name;this.$["*currentFilter"]!==r&&(this.$["*currentFilter"]=r??"");}),this.sub("*currentFilter",()=>{this.Rr();}),this.sub("*currentOperation",()=>{this.Rr();}),this.sub("*tabId",e=>{this.Ql(e,{fromViewer:false,force:true}),this.Rr();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.wp(),this.$["*faderEl"]?.setTransformations(e);}),this.sub("*loadingOperations",e=>{let r=false;for(let[,s]of e.entries()){if(r)break;for(let[,a]of s.entries())if(a){r=true;break}}this.Lr(r);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Ir=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Ir=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.jl=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[r]=e;r&&this.Vs(r,{fromViewer:false});return}this.he();}),this.sub("*operationTooltip",e=>{this.Gl=e;}),this.Rr();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.Yl);}firstUpdated(t){super.firstUpdated(t),this.Ur(),this.he();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.he()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.Ur();}disconnectedCallback(){window.removeEventListener("resize",this.Yl),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}Ur(){let t=this.Pr.value;t&&(this.$["*sliderEl"]=t);}Tp(t){let e=this.tabList.includes(t),r=this.activeTab===t,s=this.tabList.indexOf(t),a=s>=0?Ue({gridColumn:`${s+1}`}):U;return y`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.cp}><uc-btn-ui theme="tab" data-id=${t} icon=${t} role="tab" aria-controls=${`tab_${t}`} aria-selected=${r?"true":"false"} title-prop=${`a11y-editor-tab-${t}`} .active=${r} style=${a} @click=${this.Cp} ${L(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Sp(t){let e=this.dp(t);return y`<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:U}</div></div></uc-editor-scroller></div>`}render(){let t=["uc-info-tooltip",this.Ns?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this._s;return y`<uc-line-loader-ui .active=${this.ki}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.Gl??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.ap} ><div class="uc-tab-content-row">${nt.map(r=>Fi(this.activeTab===r,()=>this.Sp(r)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.jl} .styles=${this.up} @initial-render=${()=>this.he()} ><div class="uc-tab-toggles_indicator" ${L(this.Zl)} ></div>${nt.map(r=>this.Tp(r))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.Ut} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.zs}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.lp}><div class="uc-slider" ?hidden=${!this.Ir}><uc-editor-slider ${L(this.Pr)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.Ir||!e}>${e?y`<div class="uc-list-aspect-ratio">${this.bp()}</div>`:U}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.Ep} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.xp} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};h([g()],gt.prototype,"ki",2),h([g()],gt.prototype,"showMainToolbar",2),h([g()],gt.prototype,"showSubToolbar",2),h([g()],gt.prototype,"jl",2),h([g()],gt.prototype,"tabList",2),h([g()],gt.prototype,"activeTab",2),h([g()],gt.prototype,"Ir",2),h([g()],gt.prototype,"Ns",2),h([g()],gt.prototype,"Gl",2),h([g()],gt.prototype,"Mi",2);var El=jt([...nt]),it=class extends x{constructor(){super(...arguments);this.ctxOwner=true;this.Ap="";this.de=Lt;this.kp="";this.ki=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=El;this.tc=false;this._t=false;this.Hs=null;this.Oi=null;this.Lr=V(t=>{this.ki=t;},300);this.$r=O();this.ec=O();this.ic=O();this.rc=O();this.oc=()=>{this.Lr(false),this.de!==Lt&&(this.$["*networkProblems"]=false);};this.sc=()=>{this.Lr(false),this.$["*networkProblems"]=true;};this.Mp=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...fl(this)};}static{n(this,"CloudImageEditorBlock");}static{this.styleAttrs=["uc-cloud-image-editor"];}Op(){this._t||this.Hs||(this.Hs=this.updateComplete.then(()=>{this.Hs=null,this._t=true;}));}initCallback(){super.initCallback(),this.nc(),this.ac();}Ur(){let t=this.ic.value;t&&(this.$["*faderEl"]=t);let e=this.ec.value;e&&(this.$["*cropperEl"]=e);let r=this.rc.value;r&&(this.$["*imgContainerEl"]=r);let s=this.$r.value;s&&(this.$["*imgEl"]=s);}Ip(){let t=this.$r.value;t&&(t.addEventListener("load",this.oc),t.addEventListener("error",this.sc));}Pp(){let t=this.$r.value;t&&(t.removeEventListener("load",this.oc),t.removeEventListener("error",this.sc));}get Lp(){let t=this.$["*tabId"];return Et("uc-image",{"uc-image_hidden_to_cropper":t===H.CROP,"uc-image_hidden_effects":t!==H.CROP})}cc(){if(this.Oi)return this.Oi;let t=3e3;return this.Oi=new Promise((e,r)=>{let s=n(()=>{window.clearTimeout(p),u.disconnect(),this.Oi=null;},"cleanup"),a=n(()=>{let{width:d,height:m}=this.getBoundingClientRect();return d>0&&m>0},"hasNonZeroSize"),l=n(()=>{s(),window.setTimeout(()=>e(),0);},"resolveWait"),c=n(()=>{let d=new Error("[cloud-image-editor] timeout waiting for non-zero container size");s(),this.isConnected&&console.error(d.message),r(d);},"rejectWait"),u=new ResizeObserver(d=>{let[m]=d;m&&m.contentRect.width>0&&m.contentRect.height>0&&l();}),p=window.setTimeout(()=>{c();},t);if(a()){l();return}u.observe(this);}),this.Oi}firstUpdated(t){super.firstUpdated(t),this.Ur(),this.Ip(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),r=t.has("uuid")||t.has("cdnUrl");e&&!r&&this.updateImage();}disconnectedCallback(){this.Pp(),super.disconnectedCallback();}render(){let t=this.kp??"",e=this.Ap??"",r=this.de||Lt,s=this.ki,a=this.tc;return y` ${He(gl)}<div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" .visible=${a}><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.Mp}></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" ${L(this.rc)}><img src=${r} class=${this.Lp} ${L(this.$r)} />${Fi(this._t,()=>y`<uc-editor-image-cropper ${L(this.ec)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${L(this.ic)}></uc-editor-image-fader></div><div class="uc-info_pan">${e}</div></div><div class="uc-toolbar"><uc-line-loader-ui .active=${s}></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor">${Fi(this._t,()=>y`<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.nc(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.ac();}nc(){let t=this.tabs||El;this.$["*tabList"]=ml(t);}ac(){let t=Yr(this.cropPreset??""),e=null;if(this.cdnUrl){let r=No(this.cdnUrl),s=_o(r);if(Array.isArray(s?.crop?.dimensions)){let[a,l]=s.crop.dimensions;e=Pa(a,l,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){try{await this.cc();}catch{return}if(this.isConnected){if(this.cdnUrl){let t=this.cdnUrl,e=fr(t),r=ie(t,e);if(r===this.$["*originalUrl"])return;this.$["*originalUrl"]=r;let s=No(t),a=_o(s);this.$["*editorTransformations"]=a;}else if(this.uuid){let t=ie(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"]===H.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(Z(t,st("json"))),r=await fetch(e).then(l=>l.json()),{width:s,height:a}=r;this.$["*imageSize"]={width:s,height:a},this.$["*tabId"]===H.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.Op();}}}async initEditor(){try{await this.cc();}catch{return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.tc=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],r=st(re(t),"preview"),s=Z(e,r),a={originalUrl:e,cdnUrlModifiers:r,cdnUrl:s,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:a,bubbles:true,composed:true}));},false);}};h([g()],it.prototype,"Ap",2),h([g()],it.prototype,"de",2),h([g()],it.prototype,"kp",2),h([g()],it.prototype,"ki",2),h([b({type:String,reflect:true})],it.prototype,"uuid",2),h([b({type:String,attribute:"cdn-url",reflect:true})],it.prototype,"cdnUrl",2),h([b({type:String,attribute:"crop-preset",reflect:true})],it.prototype,"cropPreset",2),h([b({type:String,reflect:true})],it.prototype,"tabs",2),h([g()],it.prototype,"tc",2),h([g()],it.prototype,"_t",2);var qs={};Xs(qs,{CloudImageEditorActivity:()=>Gi});var fo=class extends it{static{n(this,"CloudImageEditor");}static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var Gi=class extends I{constructor(){super(...arguments);this.ot=null;}static{n(this,"CloudImageEditorActivity");}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.ot&&this.ot.cropPreset!==t&&(this.ot={...this.ot,cropPreset:t});}),this.subConfigValue("cloudImageEditorTabs",t=>{this.ot&&this.ot.tabs!==t&&(this.ot={...this.ot,tabs:t});}),this.Rp();}disconnectedCallback(){super.disconnectedCallback(),this.Up();}zs(t){if(!this.Ii)return;this.debugPrint('editor event "apply"',t.detail);let e=t.detail;this.Ii.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.modalManager?.close(D.activities.CLOUD_IMG_EDIT),this.historyBack();}Ut(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close(D.activities.CLOUD_IMG_EDIT),this.historyBack();}handleChange(t){this.debugPrint('editor event "change"',t.detail);}Rp(){let{internalId:t}=this.activityParams,e=this.uploadCollection.read(t);if(!e)throw new Error(`Entry with internalId "${t}" not found`);this.Ii=e;let r=this.Ii.getValue("cdnUrl");if(!r)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);this.ot=this.$p(r);}Up(){this.Ii=void 0,this.ot=null;}render(){if(!this.ot)return U;let{cdnUrl:t,cropPreset:e,tabs:r}=this.ot;return y`<uc-cloud-image-editor cdn-url=${t} crop-preset=${W(e)} tabs=${W(r)} @apply=${this.zs} @cancel=${this.Ut} @change=${this.handleChange} ></uc-cloud-image-editor>`}$p(t){return {cdnUrl:t,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}};h([g()],Gi.prototype,"ot",2);var li=class extends I{constructor(){super(...arguments);this._e="";this.Ds=t=>{this._e=t.target?.value??"";};this.os=t=>{t.preventDefault(),this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let e=this._e.trim();e&&(this.api.addFileFromUrl(e,{source:$.URL}),this.routerLayer.navigateAfterFileAdd());};}static{n(this,"UrlSource");}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.historyBack} title=${this.l10n("back")} aria-label=${this.l10n("back")} ><uc-icon name="back"></uc-icon></button><div><uc-icon name="url"></uc-icon><span>${this.l10n("caption-from-url")}</span></div><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><form class="uc-content" @submit=${this.os}><label><input placeholder="https://" class="uc-url-input" type="text" autofocus @input=${this.Ds} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${!this._e} >${this.l10n("upload-url")}</button></form>`}};h([g()],li.prototype,"_e",2);var Cl=n(()=>{let o=globalThis.top??globalThis.parent??globalThis.self;try{return o.location.origin}catch(i){return console.warn("Unable to access top-level window location:",i),globalThis.location.origin}},"getTopLevelOrigin");var _d=n(o=>o.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),"escapeRegExp"),Tl=n((o,i="i")=>{let t=o.split("*").map(_d);return new RegExp(`^${t.join(".+")}$`,i)},"wildcardRegexp");var Bd=["--uc-font-family","--uc-font-size","--uc-line-height","--uc-button-size","--uc-preview-size","--uc-input-size","--uc-padding","--uc-radius","--uc-transition","--uc-background","--uc-foreground","--uc-primary","--uc-primary-hover","--uc-primary-transparent","--uc-primary-foreground","--uc-secondary","--uc-secondary-hover","--uc-secondary-foreground","--uc-muted","--uc-muted-foreground","--uc-destructive","--uc-destructive-foreground","--uc-border"],zd=n((o,i)=>window.getComputedStyle(o).getPropertyValue(i).trim(),"getCssValue"),xl=n(o=>{let i={};for(let t of Bd){let e=zd(o,t);e&&(i[t]=e);}return i},"buildThemeDefinition");var Hd=["selected-files-change","toolbar-state-change"],Kd=n(o=>{if(!o||typeof o!="object"||!("type"in o))return false;let i=o.type;return !(typeof i!="string"||!Hd.includes(i))},"isWhitelistedMessage"),go=class{constructor(i,t){this.Dr=new Map;this.dc=i=>{if(i.source!==this.Ks)return;let t=i.data;if(!Kd(t))return;let e=this.Dr.get(t.type);if(e)for(let r of e)r(t);};this.Ks=i,this.uc=t,window.addEventListener("message",this.dc);}static{n(this,"MessageBridge");}on(i,t){let e=this.Dr.get(i)??new Set;this.Dr.has(i)||this.Dr.set(i,e),e.add(t);}send(i){let t=this.uc();this.Ks.postMessage(i,t);}destroy(){window.removeEventListener("message",this.dc);}};function Sl(o){let i=[];for(let[t,e]of Object.entries(o))e==null||typeof e=="string"&&e.length===0||i.push(`${t}=${encodeURIComponent(e)}`);return i.join("&")}n(Sl,"queryString");var jd={[ft.GDRIVE]:"ngdrive"},vt=class extends I{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.He=O();this.Fr=null;this.js=[];this.Gs=false;this.qs=false;this.Ws=false;this.Zs=false;this.Nr=false;this.Ys=false;this.Xs="uc-hidden";this.pc=true;this.ss=()=>{for(let t of this.js){let e=this.Fp(t),{filename:r}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:r,source:s});}this.routerLayer.navigateAfterFileAdd();};this.Ut=()=>{this.historyBack();};this.Hp=()=>{this.yt?.send({type:"select-all"});};this.Kp=()=>{this.yt?.send({type:"deselect-all"});};}static{n(this,"ExternalSource");}get Dp(){if(!this.Fr)return "";let{selectedCount:t,total:e}=this.Fr;return this.l10n("selected-count",{count:t,total:e})}get activityParams(){let t=super.activityParams;if("externalSourceType"in t)return t;throw new Error("External Source activity params not found")}initCallback(){super.initCallback();let{externalSourceType:t}=this.activityParams;t?this.hc():console.error('Param "externalSourceType" is required for external source activity'),this.sub("*currentActivityParams",()=>{setTimeout(()=>{this.isConnected&&(this.fc(),this.hc());});}),this.subConfigValue("multiple",e=>{this.Nr=e;}),this.subConfigValue("localeName",()=>{this.mc();}),this.subConfigValue("externalSourcesEmbedCss",e=>{this.gc(e);});}Fp(t){if(t.alternatives){let e=Y(this.cfg.externalSourcesPreferredTypes);for(let r of e){let s=Tl(r);for(let[a,l]of Object.entries(t.alternatives))if(s.test(a))return l}}return t.url}Np(t){this.pc=t.isVisible;}async Vp(t){if(this.cfg.multiple!==t.isMultipleMode){console.error("Multiple mode mismatch");return}this._p(t.selectedCount,t.total),this.Xs=t.isReady?"":"uc-hidden",this.Gs=t.isReady,this.qs=t.isReady&&t.selectedFiles.length>0,this.Nr=t.isMultipleMode&&t.total>0,this.Ws=t.selectedCount<t.total,this.Zs=t.selectedCount===t.total,this.js=t.selectedFiles??[],this.Ys=t.total>0;}vc(){this.gc(this.cfg.externalSourcesEmbedCss),this.Bp(),this.mc();}Bp(){this.yt?.send({type:"set-theme-definition",theme:xl(this)});}gc(t){this.yt?.send({type:"set-embed-css",css:t});}mc(){this.yt?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}zp(){let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:r,multiple:s}=this.cfg,{externalSourceType:a}=this.activityParams,l=jd[a]??a,u={lang:this.l10n("social-source-lang")?.split("-")?.[0]||"en",public_key:t,images_only:"false",session_key:e,wait_for_theme:true,multiple:s.toString(),origin:this.cfg.topLevelOrigin||Cl(),debug:this.cfg.debug},p=new URL(`/window4/${l}`,r);return p.search=Sl(u),p.toString()}_p(t,e){this.Fr={selectedCount:t,total:e};}hc(){let t=document.createElement("iframe");t.src=this.zp(),t.marginHeight=0,t.marginWidth=0,t.frameBorder="0",t.allowTransparency=true,t.addEventListener("load",this.vc.bind(this)),t.addEventListener("load",this.vc.bind(this)),this.He.value&&(this.He.value.innerHTML="",this.He.value.appendChild(t)),t.contentWindow&&(this.yt?.destroy(),this.yt=new go(t.contentWindow,()=>this.cfg.socialBaseUrl),this.yt.on("selected-files-change",this.Vp.bind(this)),this.yt.on("toolbar-state-change",this.Np.bind(this)),this.yc());}fc(){this.yt?.destroy(),this.yt=void 0,this.He.value&&(this.He.value.innerHTML=""),this.yc();}yc(){this.js=[],this.Gs=false,this.qs=false,this.Ws=false,this.Zs=false,this.Nr=false,this.Ys=false,this.Xs="uc-hidden",this.Fr=null;}disconnectedCallback(){super.disconnectedCallback(),this.fc();}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*historyBack"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><div ${L(this.He)} class="uc-iframe-wrapper"></div><div class="uc-toolbar" ?hidden=${!this.pc}><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Ut} >${this.l10n("cancel")}</button><div class="uc-selection-status-box" ?hidden=${!this.Nr} ><span>${this.Dp}</span><button type="button" @click=${this.Hp} ?hidden=${!this.Ws} >${this.l10n("select-all")}</button><button type="button" @click=${this.Kp} ?hidden=${!this.Zs} >${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.ss} ?disabled=${!this.qs} ?hidden=${!this.Ys} ><uc-spinner ?hidden=${this.Gs}></uc-spinner><span class=${this.Xs}>${this.l10n("done")}</span></button></div></div>`}};h([g()],vt.prototype,"js",2),h([g()],vt.prototype,"Gs",2),h([g()],vt.prototype,"qs",2),h([g()],vt.prototype,"Ws",2),h([g()],vt.prototype,"Zs",2),h([g()],vt.prototype,"Nr",2),h([g()],vt.prototype,"Ys",2),h([g()],vt.prototype,"Xs",2),h([g()],vt.prototype,"pc",2);var Al=n(()=>typeof navigator.permissions<"u","canUsePermissionsApi");var Gd={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},qd=["camera","microphone"];function vo(o){let i=Math.floor(o/60).toString().padStart(2,"0"),t=Math.floor(o%60).toString().padStart(2,"0");return `${i}:${t}`}n(vo,"formatTime");var kl="image/jpeg",Ml="video/webm",z=class extends I{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Vr=null;this.Qs=false;this.Pi=[];this.Ot=null;this.It=null;this._r=null;this.Br=null;this.g=null;this.Li={};this.Mt=null;this.i=null;this.Ke=[];this.je=[];this.jp={};this.zr=[];this.Hr=null;this.bc=()=>{this.wc(),this.Ri="pause";};this.xc=()=>{this.Ri="play",this.Gp();};this.Ui=O();this.ce=O();this.W=O();this.Ec=0;this.Cc=0;this.Tc=null;this.Kr=true;this.jr=true;this.qp=Al();this.Sc=[];this.fe=true;this.Js="";this.Ge=true;this.me=true;this.qe=true;this.Ac=[];this.ge=true;this.tn=true;this.ve=true;this.Dt=true;this.ye=true;this.We="camera-full";this.Ri="play";this.kc="microphone";this.Gr="uc-shot-btn uc-camera-action";this.Wp=()=>{if(this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.g}}}),this.g===P.PHOTO&&this.Zp(),this.g===P.VIDEO){if(this.Ot?.state==="recording"){this.Mc();return}this.Yp();}};this.Xp=t=>{let e=t.target;e&&(this.Br=e.value,this.Ze());};this.Qp=t=>{let e=t.target;e&&(this._r=e.value,this.Ze());};this.Jp=()=>{this.Ze();};this.th=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.g}}}),this.Wp();};this.eh=()=>{this.ih();};this.rh=()=>{this.oh();};this.sh=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.g}}}),this.nh();};this.ah=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.g}}}),this.lh();};this.Oc=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&this.Ic(r);};this.Pc=()=>{let t=Math.floor((performance.now()-this.Ec+this.Cc)/1e3);if(typeof this.cfg.maxVideoRecordingDuration=="number"&&this.cfg.maxVideoRecordingDuration>0){let e=this.cfg.maxVideoRecordingDuration-t;if(e<=0){let s=this.Ui.value;s&&(s.textContent=vo(e)),this.Mc();return}let r=this.Ui.value;r&&(r.textContent=vo(e));}else {let e=this.Ui.value;e&&(e.textContent=vo(t));}this.Ye=requestAnimationFrame(this.Pc);};this.ch=()=>{this.Ec=performance.now(),this.Cc=0,this.Pc();};this.Lc=()=>{this.Ye&&cancelAnimationFrame(this.Ye);};this.wc=()=>{let t=this.W.value;if(!t)return;let e=t.currentTime,r=t.duration||1,s=this.ce.value;s&&(s.style.transform=`scaleX(${e/r})`);let a=this.Ui.value;a&&(a.textContent=vo(e)),this.Ye=requestAnimationFrame(this.wc);};this.Gp=()=>{this.Ye&&cancelAnimationFrame(this.Ye);};this.Ye=null;this.Yp=()=>{try{this.Pi=[],this.Li={...this.cfg.mediaRecorderOptions};let{mimeType:t}=this.cfg.mediaRecorderOptions||{};t&&MediaRecorder.isTypeSupported(t)?this.Li.mimeType=t:MediaRecorder.isTypeSupported(Ml)?this.Li.mimeType=Ml:this.Li.mimeType="video/mp4",this.It&&(this.Ot=new MediaRecorder(this.It,this.Li),this.Ot.start(),this.Ot.addEventListener("dataavailable",e=>{this.Pi.push(e.data);}),this.ch(),this.classList.add("uc-recording"),this.$i(At.PLAY));}catch(t){console.error("Failed to start recording",t),this.telemetryManager.sendEventError(t,"camera recording. Failed to start recording");}};this.Mc=()=>{this.Ot?.addEventListener("stop",()=>{this.uh(),this.Lc(),this.$i(At.STOP);}),this.Ot?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this.g}}});};this.ih=()=>{if(this.Ot?.state==="recording")return;let t=this.W.value;t&&(!t.paused&&!t.ended&&t.readyState>2?t.pause():t.paused&&t.play());};this.oh=()=>{this.It?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.kc=t.enabled?"microphone":"microphone-mute",this.tn=!t.enabled;});};this.uh=()=>{try{let t=new Blob(this.Pi,{type:this.Ot?.mimeType}),e=URL.createObjectURL(t),r=this.W.value;if(!r)return;r.muted=!1,r.volume=1,this.Di(null),r.src=e,this.dh(r);}catch(t){console.error("Failed to preview video",t),this.telemetryManager.sendEventError(t,"camera previewing. Failed to preview video");}};this.nh=()=>{if(this.$i(At.RETAKE),this.g===P.VIDEO){this.Di(this.It);let t=this.W.value;t&&(t.muted=true);}this.W.value?.play?.();};this.lh=()=>{if(this.$i(At.ACCEPT),this.g===P.PHOTO){this.Mt?.toBlob(s=>{if(!s)return;let a=this.Rc("camera","jpeg",kl,s);this.Uc(a);},kl);return}let t=new Blob(this.Pi,{type:this.Ot?.mimeType}),e=this.ph(this.Ot?.mimeType),r=this.Rc("video",e,`video/${e}`,t);this.Uc(r),this.Pi=[];};this.hh=t=>{t===At.SHOT&&(this.ye=true,this.me=true,this.Dt=true,this.qe=false,this.fe=true),(t===At.RETAKE||t===At.ACCEPT)&&(this.ye=!this.Ft.includes(P.VIDEO),this.Dt=!this.Ft.includes(P.PHOTO),this.me=false,this.qe=true,this.fe=this.Ke.length<=1);};this.fh=t=>{t===At.PLAY&&(this.Ge=false,this.Dt=true,this.fe=true,this.ge=true,this.Ri="pause",this.We="square",this.Gr="uc-shot-btn uc-camera-action uc-stop-record"),t===At.STOP&&(this.Ge=false,this.me=true,this.ve=true,this.qe=false),(t===At.RETAKE||t===At.ACCEPT)&&(this.Ge=true,this.ye=!this.Ft.includes(P.VIDEO),this.Dt=!this.Ft.includes(P.PHOTO),this.me=false,this.qe=true,this.ve=!this.cfg.enableAudioRecording,this.We="video-camera-full",this.Gr="uc-shot-btn uc-camera-action",this.ge=!this.cfg.enableAudioRecording||this.je.length<=1,this.fe=this.Ke.length<=1);};this.$i=t=>{this.g===P.PHOTO&&(t==="shot"||t==="retake"||t==="accept")&&this.hh(t),this.g===P.VIDEO&&(t==="play"||t==="stop"||t==="retake"||t==="accept"||t==="pause"||t==="resume")&&this.fh(t);};this.Ic=t=>{t===P.PHOTO&&(this.We="camera-full",this.ge=true,this.ve=true),t===P.VIDEO&&(this.Ri="play",this.We="video-camera-full",this.ge=!this.cfg.enableAudioRecording||this.je.length<=1,this.ve=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId:t}}}),this.g=t;};this.Rc=(t,e,r,s)=>{let a=Date.now(),l=`${t}-${a}.${e}`;return new File([s],l,{lastModified:a,type:r})};this.Uc=t=>{this.api.addFileFromObject(t,{source:$.CAMERA}),this.routerLayer.navigateAfterFileAdd();};this.Fi=V(t=>{this.classList.toggle("uc-initialized",t==="granted");let e=this.g===P.VIDEO&&this.cfg.enableAudioRecording,r=this.g===P.PHOTO?"camera-full":"video-camera-full";t==="granted"?(this.Kr=false,this.me=false,this.Dt=!this.Ft.includes(P.PHOTO),this.ye=!this.Ft.includes(P.VIDEO),this.jr=true,this.Ge=true,this.We=r,this.ve=!e,this.ge=!e):t==="prompt"?(this.Js="camera-permissions-prompt",this.Kr=true,this.me=true,this.Dt=true,this.jr=false,this.sn()):(this.Js="camera-permissions-denied",this.Kr=true,this.jr=false,this.Dt=!this.Ft.includes(P.PHOTO),this.ye=!this.Ft.includes(P.VIDEO),this.qe=true,this.Gr="uc-shot-btn uc-camera-action",this.sn());},300);this.mh=()=>{if(!this.It)return false;let t=this.It?.getAudioTracks(),e=this.It?.getVideoTracks();return t.forEach(r=>{r.stop();}),e.forEach(r=>{r.stop();}),true};this.sn=()=>{this.Qs&&(this.W.value&&(this.W.value.volume=0),this.Hr?.getTracks?.()?.[0]?.stop(),this.en(this.W.value),this.Di(null),this.mh(),this.Lc(),this.Qs=false);};this.Ze=async()=>{let t={video:{...Gd},audio:this.cfg.enableAudioRecording?{}:false};this.Br&&(t.video={deviceId:{exact:this.Br}}),this._r&&this.cfg.enableAudioRecording&&(t.audio={deviceId:{exact:this._r}}),this.W.value&&(this.W.value.volume=0);try{this.Fi("prompt"),this.It=await navigator.mediaDevices.getUserMedia(t),this.It.addEventListener("inactive",()=>{this.Fi("denied");}),this.Di(this.It),this.Qs=!0,this.Fi("granted");}catch(e){this.Fi("denied"),console.log("Failed to capture camera",e),this.telemetryManager.sendEventError(e,"camera capturing. Failed to capture camera");}};this.$c=()=>{this.Ze();};this.gh=async()=>{try{this.qr();for(let t of qd){let e=await navigator.permissions.query({name:t});this.jp[t]=e,e.addEventListener("change",this.$c),this.zr.push(()=>{e.removeEventListener("change",this.$c);});}this.Vr=()=>{this.qr();};}catch(t){this.qr(),console.log("Failed to use permissions API. Fallback to manual request mode.",t),this.telemetryManager.sendEventError(t,"camera permissions. Failed to use permissions API"),this.Ze();}};this.vh=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this.nn(),navigator.mediaDevices.addEventListener("devicechange",this.nn);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.nn=async()=>{try{let t=await navigator.mediaDevices.enumerateDevices();this.Ke=t.filter(e=>e.kind==="videoinput").map((e,r)=>({text:e.label.trim()||`${this.l10n("caption-camera")} ${r+1}`,value:e.deviceId})),this.je=this.cfg.enableAudioRecording?t.filter(e=>e.kind==="audioinput").map(e=>({text:e.label.trim(),value:e.deviceId})):[],this.Sc=this.Ke,this.fe=this.Ke.length<=1,this.Br=this.Ke[0]?.value??null,this.Ac=this.je,this.ge=!this.cfg.enableAudioRecording||this.je.length<=1,this._r=this.je[0]?.value??null;}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get devices"),console.log("Failed to get devices",t);}};this.yh=async()=>{await this.gh(),await this.vh(),await this.Ze(),this.Dc(this.Ft);};this.bh=async()=>{this.Vr&&this.Vr(),window.chrome||this.Fi("denied"),this.sn();};this.Dc=t=>{this.ye=!t.includes(P.VIDEO),this.Dt=!t.includes(P.PHOTO);let e=t[0];e&&(!this.g||!t.includes(this.g))&&this.Ic(e);};}static{n(this,"CameraSource");}dh(t){this.en(t),t.addEventListener("play",this.bc),t.addEventListener("pause",this.xc);}en(t){t?.removeEventListener("play",this.bc),t?.removeEventListener("pause",this.xc);}Di(t){this.Hr!==t&&(this.Hr=t,this.rn());}rn(){let t=this.W.value;if(!t)return;let e=this.Hr??null;t.srcObject!==e&&(t.srcObject=e);}Zp(){if(this.$i("shot"),this.Mt=document.createElement("canvas"),this.i=this.Mt.getContext("2d"),!this.i)throw new Error("Failed to get canvas context");let t=this.W.value;if(!t)throw new Error("Video element not found");this.Mt.height=t.videoHeight,this.Mt.width=t.videoWidth,this.cfg.cameraMirror&&(this.i.translate(this.Mt.width,0),this.i.scale(-1,1)),this.i.drawImage(t,0,0),t.pause();}ph(t){let e={mp4:"mp4",ogg:"ogg",webm:"webm",quicktime:"mov","x-matroska":"mkv"};if(t==="")return "webm";if(t){let r=t.split("/");if(r?.[0]==="video"){let a=r.slice(1).join("/")?.split(";")[0];if(a&&e[a])return e[a]}}return "avi"}get Ft(){return Y(this.cfg.cameraModes).filter(t=>t===P.PHOTO||t===P.VIDEO)}qr(){if(this.zr.length!==0){for(let t of this.zr)t();this.zr=[],this.Vr=null;}}initCallback(){super.initCallback(),this.subConfigValue("cameraMirror",t=>{this.Tc=t?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",t=>{this.ve=!t,this.tn=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isConnected)return;let e=G(t);this.Dc(e.filter(r=>r===P.PHOTO||r===P.VIDEO));}),this.yh();}firstUpdated(t){super.firstUpdated(t),this.rn();}updated(t){super.updated(t),this.rn();}wh(){this.qr(),navigator.mediaDevices?.removeEventListener("devicechange",this.nn),this.en(this.W.value),this.Di(null);}disconnectedCallback(){super.disconnectedCallback(),this.bh(),this.wh();}render(){return y`<uc-activity-header><button type="button" class="uc-mini-btn" @click=${this.$["*historyBack"]} title=${this.l10n("back")} ><uc-icon name="back"></uc-icon></button><div ?hidden=${!this.fe}><uc-icon name="camera"></uc-icon><span>${this.l10n("caption-camera")}</span></div><uc-select class="uc-camera-select" .options=${this.Sc} ?hidden=${this.fe} @change=${this.Xp} ></uc-select><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-content"><video muted autoplay playsinline style=${Ue({transform:this.Tc})} ?hidden=${this.Kr} ${L(this.W)} ></video><div class="uc-message-box" ?hidden=${this.jr}><span>${this.l10n(this.Js)}</span><button type="button" @click=${this.Jp} ?hidden=${this.qp} >${this.l10n("camera-permissions-request")}</button></div></div><div class="uc-controls"><div class="uc-switcher" ?hidden=${!this.Ge}><button data-id="photo" type="button" class=${ct({"uc-switch":true,"uc-mini-btn":true,"uc-active":this.g===P.PHOTO})} @click=${this.Oc} ?hidden=${this.Dt} data-testid="tab-photo" ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class=${ct({"uc-switch":true,"uc-mini-btn":true,"uc-active":this.g===P.VIDEO})} @click=${this.Oc} ?hidden=${this.ye} data-testid="tab-video" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" @click=${this.eh} ?hidden=${this.Ge} data-testid="recording-timer" ><uc-icon name=${this.Ri}></uc-icon><span ${L(this.Ui)}> 00:00 </span><span ${L(this.ce)} class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" ?hidden=${this.qe} ><button type="button" class="uc-secondary-btn" @click=${this.sh} >${this.l10n("retake")}</button><button type="button" class="uc-primary-btn" @click=${this.ah} data-testid="accept" >${this.l10n("accept")}</button></div><button type="button" data-testid="shot" @click=${this.th} class=${this.Gr} ?hidden=${this.me} ><uc-icon name=${this.We}></uc-icon></button><div class="uc-select"><button type="button" class="uc-mini-btn uc-btn-microphone" @click=${this.rh} ?hidden=${this.ve} data-testid="toggle-microphone" ><uc-icon name=${this.kc}></uc-icon></button><uc-select class="uc-audio-select" .options=${this.Ac} ?hidden=${this.ge} ?disabled=${this.tn} @change=${this.Qp} data-testid="audio-select" ></uc-select></div></div>`}};h([g()],z.prototype,"Tc",2),h([g()],z.prototype,"Kr",2),h([g()],z.prototype,"jr",2),h([g()],z.prototype,"qp",2),h([g()],z.prototype,"Sc",2),h([g()],z.prototype,"fe",2),h([g()],z.prototype,"Js",2),h([g()],z.prototype,"Ge",2),h([g()],z.prototype,"me",2),h([g()],z.prototype,"qe",2),h([g()],z.prototype,"Ac",2),h([g()],z.prototype,"ge",2),h([g()],z.prototype,"tn",2),h([g()],z.prototype,"ve",2),h([g()],z.prototype,"Dt",2),h([g()],z.prototype,"ye",2),h([g()],z.prototype,"We",2),h([g()],z.prototype,"Ri",2),h([g()],z.prototype,"kc",2),h([g()],z.prototype,"Gr",2);var Il={id:"camera",setup:n(async({pluginApi:o,uploaderApi:i})=>{yt({CameraSource:z}),o.registry.registerSource({id:"camera",label:"src-type-camera",icon:"camera",expand:n(()=>{if(!ta.htmlMediaCapture)return ["camera"];let t=G(o.config.get("cameraModes"));return t.length?t.map(e=>`mobile-${e}-camera`):["mobile-photo-camera"]},"expand"),onSelect:n(()=>{i.setCurrentActivity(_.CAMERA),i.setModalState(true);},"onSelect")}),o.registry.registerSource({id:"mobile-photo-camera",label:"src-type-mobile-photo-camera",icon:"camera",onSelect:n(()=>{i.openSystemDialog({captureCamera:true,modeCamera:"photo"});},"onSelect")}),o.registry.registerSource({id:"mobile-video-camera",label:"src-type-mobile-video-camera",icon:"camera",onSelect:n(()=>{i.openSystemDialog({captureCamera:true,modeCamera:"video"});},"onSelect")}),o.registry.registerActivity({id:_.CAMERA,render:n(t=>{let e=document.createElement("uc-camera-source");return t.append(e),()=>{t.replaceChildren();}},"render")});},"setup")};var Ws={};Xs(Ws,{BtnUi:()=>kt,CloudImageEditor:()=>fo,CloudImageEditorBlock:()=>it,Config:()=>ii,CropFrame:()=>Ni,EditorAspectRatioButtonControl:()=>zi,EditorCropButtonControl:()=>Hi,EditorFilterControl:()=>Jt,EditorFreeformButtonControl:()=>mo,EditorImageCropper:()=>_i,EditorImageFader:()=>uo,EditorOperationControl:()=>Ki,EditorScroller:()=>ji,EditorSlider:()=>Bi,EditorToolbar:()=>gt,Icon:()=>ue,LineLoaderUi:()=>Vi,PresenceToggle:()=>si,SliderUi:()=>_t,defineComponents:()=>yt});var Wd="cloud-image-editor",Zd="<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>",Ol={id:Wd,setup:n(async({pluginApi:o,uploaderApi:i})=>(yt({...Ws,...qs}),o.registry.registerIcon({name:"edit-file",svg:Zd}),o.registry.registerFileAction({id:"edit-file",icon:"edit-file",label:"file-item-edit-button",shouldRender:n(e=>!!(e.isImage&&e.cdnUrl),"shouldRender"),onClick:n(e=>{i.setCurrentActivity?.(_.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true);},"onClick")}),o.registry.registerActivity({id:_.CLOUD_IMG_EDIT,render:n(e=>{let r=document.createElement("uc-cloud-image-editor-activity");return e.append(r),()=>{e.replaceChildren();}},"render")}),i.on(k.FILE_UPLOAD_SUCCESS,e=>{if(!e.isImage)return;let r=o.config.get("cropPreset"),s=o.config.get("useCloudImageEditor"),a=o.config.get("cloudImageEditorAutoOpen"),l=i.v.size;s&&l===1&&(r||a)&&(i.setCurrentActivity?.(_.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true));})),"setup")};var Ll={id:"external-sources",setup:n(async({pluginApi:o,uploaderApi:i})=>{yt({ExternalSource:vt}),o.registry.registerActivity({id:_.EXTERNAL,render:n(t=>{let e=document.createElement("uc-external-source");return t.append(e),()=>{t.replaceChildren();}},"render")});for(let t of Object.values(ft))o.registry.registerSource({id:t,label:`src-type-${t}`,icon:t,onSelect:n(()=>{i.setCurrentActivity(_.EXTERNAL,{externalSourceType:t}),i.setModalState(true);},"onSelect")});},"setup")};var bo=n(()=>{let o=[];return {stack:o,promiseReadJpegChunks:n(t=>new Promise((e,r)=>{let s=2,a=n((u,p)=>{let d=new FileReader;d.addEventListener("load",()=>{p(new DataView(d.result));}),d.addEventListener("error",m=>{r(`Reader error: ${m}`);}),d.readAsArrayBuffer(u);},"readToView"),l=n(()=>a(t.slice(s,s+128),u=>{let p,d,m;for(p=d=0,m=u.byteLength;m>=0?d<m:d>m;p=m>=0?++d:--d)if(u.getUint8(p)===255){s+=p;break}c();}),"readNext"),c=n(()=>{let u=s;return a(t.slice(s,s+=4),p=>{if(p.byteLength!==4||p.getUint8(0)!==255){r("Corrupted");return}let d=p.getUint8(1);if(d===218){e(true);return}let m=p.getUint16(2)-2;return a(t.slice(s,s+=m),f=>{if(f.byteLength!==m){r("Corrupted");return}o.push({startPos:u,length:m,marker:d,view:f}),l();})})},"readNextChunk");FileReader&&DataView||r("Not Support"),a(t.slice(0,2),u=>{u.getUint16(0)!==65496&&r("Not jpeg"),l();});}),"promiseReadJpegChunks")}},"readJpegChunks"),Yd=n(async o=>{let i=[],{promiseReadJpegChunks:t,stack:e}=bo();return await t(o),e.forEach(({marker:r,view:s})=>{r===226&&s.getUint32(0)===1229144927&&s.getUint32(4)===1347571526&&s.getUint32(8)===1229735168&&i.push(s);}),i},"getIccProfile"),Ul=n(async(o,i,t)=>{{let e=[],r=[],{promiseReadJpegChunks:s,stack:a}=bo();await s(o),a.forEach(u=>{if(u.marker===i)return e.push(u.startPos),r.push(u.length)});let l=[o.slice(0,2)];for(let u of t){let p=new DataView(new ArrayBuffer(4));p.setUint16(0,65280+i),p.setUint16(2,u.byteLength+2),l.push(p.buffer),l.push(u);}let c=2;for(let u=0;u<e.length;u++)e[u]>c&&l.push(o.slice(c,e[u])),c=e[u]+r[u]+4;return l.push(o.slice(c,o.size)),new Blob(l,{type:o.type})}},"replaceJpegChunk"),Xd=226,Rl=n((o,i)=>Ul(o,Xd,i.map(t=>t.buffer)),"replaceIccProfile"),Qd=n(async o=>{try{return await Rl(o,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},"stripIccProfile"),Jd=n((o,i,t)=>new Promise((e,r)=>{let s=n(a=>{if(!a){r("Failed to convert canvas to blob");return}e(a);},"callback");o.toBlob(s,i,t),o.width=o.height=1;}),"canvasToBlob"),qi=n(()=>{let o=document.createElement("canvas"),i=o.getContext("2d");return {canvas:o,ctx:i}},"createCanvas"),tp=n(o=>{let{ctx:t,canvas:e}=qi();e.width=e.height=50,t.drawImage(o,0,0,50,50);let r=t.getImageData(0,0,50,50).data;e.width=e.height=1;for(let s=3;s<r.length;s+=4)if(r[s]<254)return true;return false},"hasTransparency"),ep=n(async o=>{let i=null,{promiseReadJpegChunks:t,stack:e}=bo();return await t(o),e.forEach(({marker:r,view:s})=>{if(!i&&r===225&&s.byteLength>=14&&s.getUint32(0)===1165519206&&s.getUint16(4)===0){i=s;return}}),i},"getExif"),ip="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",yo,rp=n(()=>new Promise(o=>{if(yo!==void 0)o(yo);else {let i=new Image;i.addEventListener("load",()=>{yo=i.naturalWidth<i.naturalHeight,i.src="//:0",o(yo);}),i.src=ip;}}),"isBrowserApplyExifOrientation"),op=n((o,i)=>{let t,e,r,s;if(!o||o.byteLength<14||o.getUint32(0)!==1165519206||o.getUint16(4)!==0)return;if(o.getUint16(6)===18761)e=true;else if(o.getUint16(6)===19789)e=false;else return;if(o.getUint16(8,e)!==42)return;r=8+o.getUint32(10,e);let a=o.getUint16(r-2,e);for(t=0,s=a;s>=0?t<s:t>s;s>=0?++t:--t){if(o.byteLength<r+10)return;o.getUint16(r,e)===274&&i(r+8,e),r+=12;}},"findExifOrientation"),sp=n((o,i)=>{op(o,(t,e)=>o.setUint16(t,i,e));},"setExifOrientation"),np=n(async(o,i,t)=>(t&&sp(i,1),Ul(o,225,[i.buffer])),"replaceExif"),ap=n((o,i)=>new Promise((t,e)=>{i&&(o.src=i),o.complete?t(o):(o.addEventListener("load",()=>{t(o);}),o.addEventListener("error",()=>{e(new Error("Failed to load image. Probably not an image."));}));}),"processImage"),lp=n(o=>ap(new Image,o),"imageLoader"),cp=[1,3],up=[192,193,194,195,197,198,199,201,202,203,205,206,207],Pl={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},dp=n(async o=>{let i=false,{promiseReadJpegChunks:t,stack:e}=bo();return await t(o).then(()=>(e.forEach(({marker:r,view:s})=>{if(!i&&up.indexOf(r)>=0){let a=s.getUint8(5);cp.indexOf(a)<0&&(i=true);}}),i)).catch(()=>i)},"shouldSkipShrink"),$l=n((o,i)=>{let t={};return (...e)=>{let r=i(e,t);return r in t?t[r]:t[r]=o(...e)}},"memoize"),Dl=n((o,i)=>{let[t]=o,e=Object.keys(i).map(r=>parseInt(r,10)).sort((r,s)=>r-s);for(let r=0;r<e.length;r++){let s=e[r],a=!!i[s];if(s>t&&a||s<t&&!a)return s}return t},"memoKeySerializer"),me={R:55,G:110,B:165,A:255},pp=`rgba(${me.R}, ${me.G}, ${me.B}, ${me.A/255})`,Fl=n((o,i)=>{try{let t=[o-1,i-1,1,1],{canvas:e,ctx:r}=qi();e.width=1,e.height=1;let{canvas:s,ctx:a}=qi();s.width=o,s.height=i,a&&(a.fillStyle=pp,a.fillRect(...t),r.drawImage(s,o-1,i-1,1,1,0,0,1,1));let l=r&&r.getImageData(0,0,1,1).data,c=!1;return l&&(c=l[0]===me.R&&l[1]===me.G&&l[2]===me.B&&l[3]===me.A),s.width=s.height=1,c}catch{return console.error(`Failed to test for max canvas size of ${o}x${i}.`),false}},"canvasTest");function Vl(o){return (...i)=>new Promise(t=>{setTimeout(()=>{let e=o(...i);t(e);},0);})}n(Vl,"wrapAsync");var hp=Vl($l(Fl,Dl)),mp=Vl($l(Fl,Dl)),Nl=n(async(o,i)=>{let t=Pl.squareSide.find(a=>a*a>=o*i),e=Pl.dimension.find(a=>a>=o&&a>=i);if(!t||!e)throw new Error("Not supported");let[r,s]=await Promise.all([hp(t,t),mp(e,1)]);if(r&&s)return true;throw new Error("Not supported")},"testCanvasSize"),_l=n(async(o,i,t)=>{try{let{ctx:e,canvas:r}=qi();return r.width=i,r.height=t,e.imageSmoothingQuality="high",e.drawImage(o,0,0,i,t),o instanceof HTMLImageElement&&(o.src="//:0"),o instanceof HTMLCanvasElement&&(o.width=o.height=1),r}catch(e){throw new Error("Canvas resize error",{cause:e})}},"canvasResize"),fp=n(({img:o,targetW:i,targetH:t})=>_l(o,i,t),"native"),gp=n(function({sourceW:o,targetW:i,targetH:t,step:e}){let r=[],s=i,a=t;do r.push([s,a]),s=Math.round(s/e),a=Math.round(a/e);while(s<o*e);return r.reverse()},"calcShrinkSteps"),vp=n(({img:o,sourceW:i,targetW:t,targetH:e,step:r})=>{let s=gp({sourceW:i,targetW:t,targetH:e,step:r});return s.reduce((a,[l,c],u)=>a.then(p=>Nl(l,c).then(()=>_l(p,l,c)).catch(()=>{if(u===s.length-1)throw new Error("Not supported");return p})),Promise.resolve(o))},"fallback"),yp=n(()=>/iPad|iPhone|iPod/.test(navigator.platform)?true:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),"isIOS"),bp=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),Zs=.71,wp=n((o,i)=>{if(o.width*Zs*o.height*Zs<i.size)throw new Error("Not required");let t=o.width,e=o.height,r=t/e,s=Math.floor(Math.sqrt(i.size*r)),a=Math.floor(i.size/Math.sqrt(i.size*r));return Nl(s,a).then(()=>{let{ctx:l}=qi();return "imageSmoothingQuality"in l&&!yp()&&!bp?fp({img:o,targetW:s,targetH:a}):vp({img:o,sourceW:t,targetW:s,targetH:a,step:Zs})}).catch(()=>Promise.reject("Not supported"))},"shrinkImage"),Bl=n(async(o,i)=>{try{if(await dp(o))throw new Error("Should skipped");let e=await Promise.allSettled([ep(o),rp(),Yd(o)]),s=!e.some(w=>w.status==="rejected"),[a,l,c]=e,u=await Qd(o).catch(()=>o),p=await lp(URL.createObjectURL(u));URL.revokeObjectURL(p.src);let d=await wp(p,i),m="image/jpeg",f=i?.quality||.8;!s&&tp(d)&&(m="image/png",f=void 0);let v=await Jd(d,m,f);if(s&&a.status==="fulfilled"&&a.value){let w=a.value,E=l.status==="fulfilled"?l.value:!1;v=await np(v,w,E);}return s&&c.status==="fulfilled"&&c.value.length>0&&(v=await Rl(v,c.value)),v}catch(t){let e;throw t instanceof Error&&(e=t.message),typeof t=="string"&&(e=t),new Error(`Failed to shrink image. ${e?`Message: "${e}".`:""}`,{cause:t})}},"shrinkFile");var Ep=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,zl=n(o=>{if(typeof o!="string")return false;let i=Ep.exec(o.toLocaleLowerCase())??[];if(i.length===0)return false;let t=Number(i[1])*Number(i[2]),e=16384*16384;return t>e?(console.warn(`Shrinked size can not be larger than ${Math.floor(e/1e3/1e3)}MP. You have set ${i[1]}x${i[2]} (${Math.ceil(t/1e3/100)/10}MP).`),false):{quality:i[3]?Number(i[3])/100:void 0,size:t}},"parseShrink");var Hl={id:"image-shrink",setup({pluginApi:o}){o.registry.registerFileHook({type:"beforeUpload",handler:n(async({file:i})=>{let t=o.config.get("imageShrink");if(!t)return {file:i};let e=zl(t);if(!e)return console.warn("[ImageShrinkPlugin] Image shrink settings are invalid, skipping shrinking"),{file:i};try{return {file:await Bl(i,e)}}catch{return {file:i}}},"handler")});}};var Kl={id:"instagram",setup({pluginApi:o}){o.registry.registerSource({id:"instagram",label:"src-type-instagram",icon:"instagram",expand:n(()=>(console.error("Instagram source was removed because the Instagram Basic Display API hasn't been available since December 4, 2024. Official statement, see here: https://developers.facebook.com/blog/post/2024/09/04/update-on-instagram-basic-display-api/?locale=en_US"),[]),"expand"),onSelect:n(()=>{},"onSelect")});}};var jl={id:$.LOCAL,setup:n(({pluginApi:o,uploaderApi:i})=>{o.registry.registerSource({id:$.LOCAL,label:"src-type-local",icon:"local",onSelect:n(()=>{i.openSystemDialog();},"onSelect")});},"setup")};var Gl={id:"url-source",setup:n(async({pluginApi:o,uploaderApi:i})=>{yt({UrlSource:li}),o.registry.registerActivity({id:_.URL,render:n(t=>{let e=document.createElement("uc-url-source");return t.append(e),()=>{t.replaceChildren();}},"render")}),o.registry.registerSource({id:"url",label:"src-type-from-url",icon:"url",onSelect:n(()=>{i.setCurrentActivity(_.URL),i.setModalState(true);},"onSelect")});},"setup")};var ci=[{configDeps:["useCloudImageEditor"],isEnabled:n(o=>!!o("useCloudImageEditor"),"isEnabled"),load:n(()=>Ol,"load")},{configDeps:["imageShrink"],isEnabled:n(o=>!!o("imageShrink"),"isEnabled"),load:n(()=>Hl,"load")},{configDeps:["sourceList"],isEnabled:n(o=>G(o("sourceList")).includes($.LOCAL),"isEnabled"),load:n(()=>jl,"load")},{configDeps:["sourceList"],isEnabled:n(o=>G(o("sourceList")).includes($.CAMERA),"isEnabled"),load:n(()=>Il,"load")},{configDeps:["sourceList"],isEnabled:n(o=>G(o("sourceList")).includes("instagram"),"isEnabled"),load:n(()=>Kl,"load")},{configDeps:["sourceList"],isEnabled:n(o=>Object.values(ft).some(i=>G(o("sourceList")).includes(i)),"isEnabled"),load:n(()=>Ll,"load")},{configDeps:["sourceList"],isEnabled:n(o=>G(o("sourceList")).includes($.URL),"isEnabled"),load:n(()=>Gl,"load")}];var Wi=class extends Xt{constructor(){super();this.headless=false;this.smartButton=false;this.init$={...this.init$};}static{n(this,"FileUploaderRegular");}static{this.lazyPlugins=ci;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});}get isSmartBtnActive(){return this.smartButton}xh(){return y`<uc-smart-btn></uc-smart-btn>`}Eh(){return y`<uc-simple-btn></uc-simple-btn>`}Ch(){return this.headless?null:this.smartButton?this.xh():this.Eh()}render(){return y` ${super.render()} ${this.Ch()}<uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]}>${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from></uc-modal><uc-modal id="upload-list" strokes block-body-scrolling><uc-upload-list></uc-upload-list></uc-modal><uc-plugin-activity-renderer mode="modal"></uc-plugin-activity-renderer>`}};h([b({type:Boolean})],Wi.prototype,"headless",2),h([b({attribute:"smart-button",type:Boolean})],Wi.prototype,"smartButton",2);var wo=class extends Xt{constructor(){super();this.Fc=false;this.Ut=()=>{if(this.Nc){let t=this.$["*historyBack"];t?.();return}this.Vc&&(this.$["*currentActivity"]=D.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{n(this,"FileUploaderInline");}static{this.lazyPlugins=ci;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"];}get Nc(){let t=this.$["*history"];return !t||t.length<=1?false:t[t.length-1]!==D.activities.START_FROM}get Vc(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}an(){return this.getCssData("--cfg-init-activity")||D.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});let t=this.an();this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0&&this.$["*currentActivity"]===t&&(this.$["*currentActivity"]=D.activities.UPLOAD_LIST);}),this.sub("*history",()=>{this.Fc=this.Nc||this.Vc;});}render(){return y` ${super.render()}<uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Ut} ?hidden=${!this.Fc} >${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-plugin-activity-renderer mode="inline"></uc-plugin-activity-renderer>`}};h([g()],wo.prototype,"Fc",2);var Ys="active",Eo="",fe=class extends Xt{constructor(){super();this.ln=false;this.Wr=false;this.Zr=Eo;this.cn=Eo;this.mi="choose-file";this.ci=t=>{t.id===D.activities.CLOUD_IMG_EDIT&&(this.Zr=Ys),this.$["*currentActivity"]===D.activities.UPLOAD_LIST&&(this.Zr=Ys,this.Wr=true);let e=this.$["*uploadList"];(!e||e.length<=0)&&(this.cn=Ys);};this.ui=t=>{t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=D.activities.UPLOAD_LIST,this.Wr=false),t.id===D.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=D.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{n(this,"FileUploaderMinimal");}static{this.lazyPlugins=ci;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];}an(){return this.getCssData("--cfg-init-activity")||D.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});let t=this.an();this.sub("*currentActivity",e=>{e===D.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0?(this.$["*currentActivity"]=D.activities.UPLOAD_LIST,this.cn=Eo):(this.Zr=Eo,this.Wr=false,this.$["*currentActivity"]=t);}),this.subConfigValue("confirmUpload",e=>{e!==false&&(this.cfg.confirmUpload=false);}),this.subConfigValue("filesViewMode",e=>{this.setAttribute("mode",e),this.subConfigValue("multiple",r=>{e==="grid"?(r?this.style.removeProperty("--uc-grid-col"):this.style.setProperty("--uc-grid-col","1"),this.ln=!r):(this.style.removeProperty("--uc-grid-col"),this.ln=false);});}),this.subConfigValue("multiple",e=>{this.mi=e?"choose-files":"choose-file";}),this.modalManager?.subscribe(X.OPEN,this.ci),this.modalManager?.subscribe(X.CLOSE,this.ui);}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(X.OPEN,this.ci),this.modalManager?.unsubscribe(X.CLOSE,this.ui);}render(){return y` ${super.render()}<uc-start-from ?hidden=${this.Wr} class=${this.cn}><uc-drop-area ?single=${this.ln} initflow clickable tabindex="0" ><span>${this.l10n(this.mi)}</span></uc-drop-area><uc-copyright></uc-copyright></uc-start-from><uc-upload-list class=${this.Zr}></uc-upload-list><uc-modal id="start-from" strokes block-body-scrolling><uc-start-from><uc-drop-area with-icon clickable></uc-drop-area><uc-source-list role="list" wrap></uc-source-list><button type="button" class="uc-secondary-btn" @click=${this.$["*historyBack"]} >${this.l10n("start-from-cancel")}</button></uc-start-from></uc-modal><uc-plugin-activity-renderer mode="modal"></uc-plugin-activity-renderer>`}};h([g()],fe.prototype,"ln",2),h([g()],fe.prototype,"Wr",2),h([g()],fe.prototype,"Zr",2),h([g()],fe.prototype,"cn",2),h([g()],fe.prototype,"mi",2);/*! For license information please see file-uploader.iife.min.js.LEGAL.txt */
|
|
8
|
+
exports.ActivityBlock=D;exports.ActivityHeader=Ps;exports.BaseComponent=$o;exports.Block=x;exports.BtnUi=kt;exports.CameraSource=z;exports.CloudImageEditor=fo;exports.CloudImageEditorActivity=Gi;exports.CloudImageEditorBlock=it;exports.Config=ii;exports.Copyright=Is;exports.CropFrame=Ni;exports.Data=K;exports.DropArea=wt;exports.DropDown=co;exports.EditorAspectRatioButtonControl=zi;exports.EditorCropButtonControl=Hi;exports.EditorFilterControl=Jt;exports.EditorFreeformButtonControl=mo;exports.EditorImageCropper=_i;exports.EditorImageFader=uo;exports.EditorOperationControl=Ki;exports.EditorScroller=ji;exports.EditorSlider=Bi;exports.EditorToolbar=gt;exports.ExternalSource=vt;exports.ExternalUploadSource=ft;exports.FileActionButton=Ie;exports.FileItem=$s;exports.FileUploaderInline=wo;exports.FileUploaderMinimal=fe;exports.FileUploaderRegular=Wi;exports.FormInput=oo;exports.Icon=ue;exports.Img=xs;exports.LineLoaderUi=Vi;exports.Modal=Oi;exports.ModalEvents=X;exports.NoWrapModeSmartBtn=js;exports.PACKAGE_NAME=Rt;exports.PACKAGE_VERSION=$t;exports.PluginActivityHost=Di;exports.PluginActivityRenderer=oi;exports.PresenceToggle=si;exports.PrimaryAction=Ks;exports.ProgressBar=Xe;exports.ProgressBarCommon=Li;exports.Select=Qe;exports.SimpleBtn=$i;exports.SliderUi=_t;exports.SmartBtn=Nt;exports.SolutionBlock=Xt;exports.SourceBtn=pe;exports.SourceList=Pi;exports.Spinner=Os;exports.StartFrom=Us;exports.Thumb=ei;exports.UID=ot;exports.UploadCtxProvider=Rs;exports.UploadList=Pt;exports.UploadSource=$;exports.UploaderBlock=I;exports.UrlSource=li;exports.defineComponents=yt;exports.defineLocale=Cn;exports.loadFileUploaderFrom=fc;exports.toKebabCase=br;return exports;})({});
|