@uploadcare/file-uploader 1.30.0-alpha.7 → 1.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/abstract/loadFileUploaderFrom.js +2 -2
- package/dist/env.js +3 -3
- package/dist/index.css +2 -2
- package/dist/index.d.ts +0 -8
- package/dist/index.js +3 -3
- package/dist/index.layered.css +2 -2
- package/dist/index.ssr.js +1 -161
- package/dist/locales/file-uploader/ar.js +2 -2
- package/dist/locales/file-uploader/az.js +2 -2
- package/dist/locales/file-uploader/ca.js +2 -2
- package/dist/locales/file-uploader/cs.js +2 -2
- package/dist/locales/file-uploader/da.js +2 -2
- package/dist/locales/file-uploader/de.js +2 -2
- package/dist/locales/file-uploader/el.js +2 -2
- package/dist/locales/file-uploader/en.js +2 -2
- package/dist/locales/file-uploader/es.js +2 -2
- package/dist/locales/file-uploader/et.js +2 -2
- package/dist/locales/file-uploader/fi.js +2 -2
- package/dist/locales/file-uploader/fr.js +2 -2
- package/dist/locales/file-uploader/he.js +2 -2
- package/dist/locales/file-uploader/hy.js +2 -2
- package/dist/locales/file-uploader/is.js +2 -2
- package/dist/locales/file-uploader/it.js +2 -2
- package/dist/locales/file-uploader/ja.js +2 -2
- package/dist/locales/file-uploader/ka.js +2 -2
- package/dist/locales/file-uploader/kk.js +2 -2
- package/dist/locales/file-uploader/ko.js +2 -2
- package/dist/locales/file-uploader/lv.js +2 -2
- package/dist/locales/file-uploader/nb.js +2 -2
- package/dist/locales/file-uploader/nl.js +2 -2
- package/dist/locales/file-uploader/pl.js +2 -2
- package/dist/locales/file-uploader/pt.js +2 -2
- package/dist/locales/file-uploader/ro.js +2 -2
- package/dist/locales/file-uploader/ru.js +2 -2
- package/dist/locales/file-uploader/sk.js +2 -2
- package/dist/locales/file-uploader/sr.js +2 -2
- package/dist/locales/file-uploader/sv.js +2 -2
- package/dist/locales/file-uploader/tr.js +2 -2
- package/dist/locales/file-uploader/uk.js +2 -2
- package/dist/locales/file-uploader/vi.js +2 -2
- package/dist/locales/file-uploader/zh-TW.js +2 -2
- package/dist/locales/file-uploader/zh.js +2 -2
- package/package.json +1 -1
- package/web/file-uploader.iife.min.d.ts +0 -8
- package/web/file-uploader.iife.min.js +3 -3
- package/web/file-uploader.min.d.ts +0 -8
- package/web/file-uploader.min.js +3 -3
- package/web/uc-basic.layered.min.css +2 -2
- package/web/uc-basic.min.css +2 -2
- package/web/uc-cloud-image-editor.layered.min.css +2 -2
- package/web/uc-cloud-image-editor.min.css +2 -2
- package/web/uc-cloud-image-editor.min.d.ts +0 -8
- package/web/uc-cloud-image-editor.min.js +3 -3
- package/web/uc-file-uploader-inline.layered.min.css +2 -2
- package/web/uc-file-uploader-inline.min.css +2 -2
- package/web/uc-file-uploader-inline.min.d.ts +0 -8
- package/web/uc-file-uploader-inline.min.js +3 -3
- package/web/uc-file-uploader-minimal.layered.min.css +2 -2
- package/web/uc-file-uploader-minimal.min.css +2 -2
- package/web/uc-file-uploader-minimal.min.d.ts +0 -8
- package/web/uc-file-uploader-minimal.min.js +3 -3
- package/web/uc-file-uploader-regular.layered.min.css +2 -2
- package/web/uc-file-uploader-regular.min.css +2 -2
- package/web/uc-file-uploader-regular.min.d.ts +0 -8
- package/web/uc-file-uploader-regular.min.js +3 -3
- 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
|
|
3
|
+
* Package: @uploadcare/file-uploader@1.30.0 (MIT)
|
|
4
4
|
* License: https://github.com/uploadcare/blob/main/LICENSE
|
|
5
|
-
* Built: 2026-05-
|
|
5
|
+
* Built: 2026-05-27T12:20:49.112Z
|
|
6
6
|
*/
|
|
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.Vc=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._c();}_c(){this.Qr=new Promise(i=>this.enableUpdating=i),this.Yt=new Map,this.Bc(),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);}Bc(){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);}zc(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.Hc());}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.cn??=new Set).add(i));}async Hc(){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.Kc(t);}willUpdate(i){}Kc(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.cn&&=this.cn.forEach(t=>this.zc(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.jc?.[e]:t.Gc,s=mi(i)?void 0:i.io;return r?.constructor!==s&&(r?.un?.(false),s===void 0?r=void 0:(r=new s(o),r.ro(o,t,e)),e!==void 0?(t.jc??=[])[e]=r:t.Gc=r),r!==void 0&&(i=we(o,r.qc(o,i.values),r,e)),i}n(we,"M");var rr=class{static{n(this,"R");}constructor(i,t){this.dn=[],this.wt=void 0,this.pn=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.pn,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.dn.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.dn)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.hn}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.hn=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.mn(i):i.Nt!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):hn(i)?this.k(i):this.mn(i);}O(i){return this.Pt.parentNode.insertBefore(i,this.we)}T(i){this.r!==i&&(this.xe(),this.r=this.O(i));}mn(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.Wc(i):(e.el===void 0&&(e.el=fi.createElement(fn(e.h,e.h[0]),this.options)),e);if(this.r?.pn===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;}}Wc(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.hn=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.Zc;if(r===void 0){let s=t?.renderBefore??null;e.Zc=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.Ch=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.gn=null;this.so=null;}static{n(this,"CssDataMixinClass");}getCssData(r,s=false){let a=this.gn??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.gn=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();}Yc(){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.vn(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;}vn(r){return r instanceof Comment&&r.nextSibling instanceof Element?this.vn(r.nextSibling):"contentFor"in r?r.contentFor||"":r instanceof Element&&r.hasAttribute("content-for")&&r.getAttribute("content-for")||""}Xc(r){return !r.textContent||!r.textContent.trim()}Qc(r){let s=this.Xt[r];return !s||s.every(a=>a instanceof Comment||a instanceof Text&&this.Xc(a))}update(r){!this.hasUpdated&&this.willYield&&this.Yc(),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.Qc(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.Jc=new Fe(this,{context:bn,callback:n(s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.wn=s,this.bn();},"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 yn(){return this.zi}set yn(r){let s=r??void 0;this.zi!==s&&(this.zi=s,this.bn());}shouldUpdate(r){return this._t?super.shouldUpdate(r):false}get Vt(){return this.yn||this.wn||void 0}bn(){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}));}xn(){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();}}En(){return !this.pt&&this.Vt&&this.uo(),this.pt&&this.xn(),this.pt}Ki(){let r=this.En();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.xn();}}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.En();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.tu(),super.disconnectedCallback(),this.Je&&(this.ao=true);}tu(){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,"yn",1),h([g()],i.prototype,"wn",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.eu.bind(this),window.addEventListener("paste",this.listener);}static{n(this,"ClipboardLayer");}iu(t){return !!t.closest("uc-url-source")}openUploadList(){this.e.routerLayer.navigateAfterFileAdd();}async eu(t){if(t.clipboardData){for(let e of this.scopes)if(e.isConnected){if(this.iu(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.Cn=Qn(this.Wi,[Wn(),Xn("is-pressed"),Yn(),Zn()]);}registerBlock(i){this.Wi.registerScope(i);}destroy(){this.Cn?.(),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.Tn(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.Tn(r),this.Sn(r,s));})),this.addSub(this.i.sub(S("localeDefinitionOverride"),r=>{if(!r)return;let s=r[this.Ce];s&&this.Sn(this.Ce,s);}));}static{n(this,"LocaleManager");}Sn(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);}}Tn(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.ou=t;this.ei=new Set;this.An=this.i.sub("*lazyPlugins",e=>{this.ru(e??[]);});}static{n(this,"LazyPluginLoader");}ru(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.kn(i),"recompute");for(let r of t)this.ei.add(this.i.sub(r,e,false));this.kn(i);}kn(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.ou(s);}destroy(){this.An();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.Mn=new Lr(this.i,e=>{this.yo=this.yo.then(()=>e).then(r=>{if(r)return this.su(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 su(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.nu(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 nu(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.Mn.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)}On(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.On(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.On(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.7";var Rt="blocks",$t=ra;var Fr=class extends j{constructor(t){super(t);this.au=ot.generateRandomUUID();this.Ae=structuredClone(tt);this.xo=false;this.Eo=null;this.Bt=false;this.In=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.lu(e,r));}));}static{n(this,"TelemetryManager");}cu(t){t===F.INIT_SOLUTION&&!this.xo&&(this.xo=true);}lu(t,e){this.Ae[t]!==e&&(this.Ae[t]=e);}uu(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.au,component:this.du,activity:this.pu,projectPubkey:this.Ae.pubkey,userAgent:navigator.userAgent,eventType:r.eventType??"",eventTimestamp:this.hu,payload:{location:this.fu,...e}}}mu(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.uu({eventType:t.eventType,payload:t.payload,config:t.config});this.cu(t.eventType),!(this.mu(t.eventType)||this.Eo&&this.Pn(this.Eo,e))&&this.ke.add(async()=>{this.Eo=e,await this.In.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}}});}Pn(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.Pn(t[a],e[a]))return false;return true}get hu(){return Date.now()}get du(){if(!this.i.has("*solution"))return null;let t=this.i.read("*solution");return t?t.toLowerCase():null}get pu(){return this.i.has("*currentActivity")?this.i.read("*currentActivity"):null}get fu(){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.Ln=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.Ln=!!t,this.Rn();});this.tr=i;}this.gu(),this.Rn();}gu(){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));}Rn(){if(!this.oe.size)return;let i=this.se.testId||"";for(let t of this.oe){let e=this.Ji.get(t);e&&(this.Ln?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.vu(),K.deleteCtx(this.ctxName);}Un(){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.Un();if(!r.has(t)&&(!this.has(t)||!this.$[t])){let s=e(this.e);this.add(t,s,true),r.set(t,s);return}}vu(){let t=this.Un();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.yu=e;}qc(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.$n=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.$n;this.it=i;let t=[i];return t.raw=t,this.$n={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.bu=[ms,hs,fs,gs];this.wu=[ps,ds];this.ke=new se(20);this.Dn=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.xu(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.wu,...s])try{let l=a(e,t);if(!l)continue;l&&(r.push(this.Fn(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 xu(t,e){if(this.zt)return;let r=this.e.api,s=this.Nn(t),a=s.promise??Promise.resolve(),l=(async()=>{if(this.zt||(await a,this.zt))return;let c=this.Eu(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.Vn(),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.Fn(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.Dn(),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);}}Fn(t){return {...t,type:t.type??"CUSTOM_ERROR"}}Nn(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}Vn(){let t=this.te.fileValidators;return [...this.bu,...t].map(ju)}Eu(t,e){let r=this.Nn(t);return this.Vn().filter(s=>!r.skippedValidators.has(s.validator)).filter(s=>s.runOn===e)}destroy(){this.zt=true,this.Dn.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.zn=i.initialValue,this.at=ot.generateFastUid(),this.J=K.registerCtx({},this.at),this._n=i.watchList||[];let t=Object.create(null);this.Bn=(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.Hn();},i.handler&&this.observeCollection(i.handler);}static{n(this,"TypedCollection");}static{this.Cu=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.Hn();});}Hn(){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.Cu));}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.zn);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._n.forEach(e=>{this.Ht[t.uid]||(this.Ht[t.uid]=[]),this.Ht[t.uid]?.push(t.subscribe(e,()=>{this.Bn(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.Kn?.length===1){let e=this.Kn[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 Kn(){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.Tu=V(this.Su.bind(this),10);}static{n(this,"LitActivityBlock");}jn(){let t=o.ni.get(this);this[Ze]=false,this.removeAttribute(Ra),t?.deactivateCallback?.();}Au(){let t=o.ni.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Ze]=true,this.setAttribute(Ra,""),t?.activateCallback?.(),this.Tu(),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.jn():this.activityType===t&&!this[Ze]&&this.Au();}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"]=[]);}));}Su(){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);}Gn(){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});}ku(){this.isActivityActive&&this.jn(),o.ni.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.Gn()&&this.ku();}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.Lu(e);},300);this.Iu=(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.Zn(),this.Mo();}};this.Pu=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.Zn();}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.Ru();}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.Zn=()=>{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 Mu(){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.Mu&&this.couldBeCtxOwner&&this.Ou();}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.qn(),this.Mo.cancel();}connectedCallback(){super.connectedCallback(),this.or&&this.Wn();}Ou(){this.or=true,this.Wn(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}Wn(){this.qn(),this.Ao=this.uploadCollection.observeCollection(this.Iu),this.ko=this.uploadCollection.observeProperties(this.Pu);}qn(){this.ko?.(),this.Ao?.(),this.ko=void 0,this.Ao=void 0;}async Lu(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;}Ru(){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.Yn=null;}static{n(this,"Icon");}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",e=>{this.Yn=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.Yn?.(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.Uu();}Uu(){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");}Xn(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.Qn?Cs+s:Number(a)>Es&&!this.Qn?Es+s:t}$u(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.$u(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.Xn(r)));let p=this.$$("pubkey");if(p)return this.li(Z(`https://${p}.ucr.io/`,s,this.Xn(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}Du(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 Jn(){return this.$$("is-background-for")}get ta(){let t=this.$$("breakpoints");if(t){let e=Y(t);return Da(e.map(r=>parseInt(r,10)))}else return null}get Qn(){return this.$$("format").toLowerCase()==="jpeg"}ea(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}`);}ia(){let t=new Set;return this.ta?this.ta.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()}ra(){return this.gt()}get oa(){return this.gt("100x","100")}Fu(){let t=this.Jn;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.ea(e);}):this.ea(e);});}Nu({elNode:t,src:e,srcset:r}){e&&(t.src=e),r&&(t.srcset=r);}Po({elNode:t}){this.Du(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.Nu({elNode:r,src:t,srcset:e});})}async Vu(){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.oa);try{await this.Lo({src:this.ra(),srcset:this.ia(),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.oa,elNode:this.St}),this.appendChild(this.St)),await this.Lo({src:this.ra(),srcset:this.ia(),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.Jn?this.Fu():this.Vu();}};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._u?.(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.un?.(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._u??=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;}un(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.yu]=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.Bu=()=>{this.closeDialog();};this.zu=t=>{this.Ro=t.target;};this.Hu=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.sa=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.sa);}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.sa);}Ku(t){this.dialogEl={value:t},this.dialogEl.value?.addEventListener("close",this.Bu),this.dialogEl.value?.addEventListener("mousedown",this.zu),this.dialogEl.value?.addEventListener("mouseup",this.Hu);}render(){return y`<dialog ${L(this.Ku)}>${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 na(){return this.nameAttrValue??this.ctxName}aa(){let t=document.createElement("input");return t.type="text",t.name=this.na,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,jr(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.K=this.aa(),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.aa();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.na}[]`,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.la=()=>{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.la);}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.la);}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.ju=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.ju} .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.Gu(this.source);}Gu(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.ca=[];this.i=t.ctx,this.e=t.sharedInstancesBag,this.ua=t.onSourcesChange,i.addController(this);}static{n(this,"SourceListController");}hostConnected(){this.No=this.i.sub(S("sourceList"),t=>{this.ca=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.ca.forEach(s=>{let a=this.qu(s,e);if(a.length!==1||a[0]!==s){for(let u of a){let p=e.get(u);p&&r.push(this.da(p));}return}let c=e.get(s);c&&r.push(this.da(c));}),this.ua(r);}qu(i,t){let e=t.get(i);return e?.expand?e.expand():[i]}da(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(),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.pa=false;this.hr=null;this.ha=false;this.Wu=this.cfg.filesViewMode;this.fa=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.Zu(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.fa.bind(this),100);}static{n(this,"Thumb");}Zu(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)}Yu(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;})}Bo(){this._o?.cancel(),this._o=void 0;}Xu(t){if(this.Bo(),!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._o=r,this.Yu(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.fa(true);return}this.ha&&this.fr();}}firstUpdated(t){super.firstUpdated(t),this.ma();}updated(t){super.updated(t),t.has("uid")&&this.ma();}di(t){let[e]=t;e&&(this.ha=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.Bo(),this.Kt&&(this.Kt="");}ma(){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.Xu(s??void 0);}),this.subEntry("cdnUrlModifiers",r),this.mr(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this.pa&&(this.Wu==="list"&&this.mr(true),this.pa=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.Bo(),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.ga=null;}static{n(this,"UploadCtxProvider");}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=k;}initCallback(){super.initCallback(),this.ga=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.ga?.();}};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.va=true;this.uid="";this.zo="";this.Ho="";this.Ko="";this.At=0;this.ya=false;this.jo="";this.Go=false;this.qo=false;this.ba=false;this.wa=false;this.Wo=false;this.xa="";this.gr=[];this.Ea=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.Qu=()=>{this.Ca();};this.S=V(()=>this.Ta(),100);this.td=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.Ko=f,this.Ho=r,this.ya=c||u||p||d,this.At=p||d?0:t.getValue("uploadProgress"),this.xa=m?this.l10n("a11y-file-item-status",{fileName:m,status:this.l10n(e?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):"";},100));this.Ca=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");}Ta(){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.Ju(t,e);}Ju(t,e){e===Q.FAILED?this.jo="badge-error":e===Q.FINISHED&&(this.jo="badge-success"),e===Q.UPLOADING&&(this.wa=false,this.removeAttribute("focused")),this.qo=e===Q.FAILED,this.ba=e===Q.UPLOADING,this.Go=e===Q.FINISHED,this.td(e);}reset(){super.reset(),this.S.cancel();}di(t){let[e]=t;e&&e.isIntersecting&&!this.Ea&&(this.va=false,this.Ea=true);}Sa(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.zo=r||e.getValue("externalUrl")||this.l10n("file-no-name"),this.S();}),this.subEntry("externalUrl",r=>{this.zo=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.Ta(),this.ae();}Aa(t){if(this.cfg.filesViewMode==="list"){this.Wo=true;return}this.Wo=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.Sa(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}});}ed(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.Sa(this.uid),this.subConfigValue("filesViewMode",e=>{this.Aa(this.cfg.gridShowFileNames),this.setAttribute("mode",e);}),this.subConfigValue("gridShowFileNames",e=>{this.Aa(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.Ca());});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.va?false:super.shouldUpdate(t)}render(){return y`<div class="uc-inner" ?data-finished=${this.Go} ?data-uploading=${this.ba} ?data-failed=${this.qo} ?data-focused=${this.wa} ><uc-thumb .uid=${this.uid} .badgeIcon=${this.jo}></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this.xa}><span class="uc-file-name" ?hidden=${!this.Wo}>${this.zo}</span><span class="uc-file-error" ?hidden=${!this.Ho}>${this.Ho}</span><span class="uc-file-hint" ?hidden=${!this.Ko}>${this.Ko}</span></div><div class="uc-file-actions">${this.gr.map(t=>y`<button type="button" @click=${()=>this.ed(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.ya} .failed=${this.qo} .success=${this.Go}></uc-file-action-button><button type="button" class="uc-upload-btn uc-mini-btn" @click=${this.Qu}><uc-icon name="upload"></uc-icon></button></div></div>`}};h([g()],q.prototype,"va",2),h([b({attribute:false})],q.prototype,"uid",2),h([g()],q.prototype,"zo",2),h([g()],q.prototype,"Ho",2),h([g()],q.prototype,"Ko",2),h([g()],q.prototype,"At",2),h([g()],q.prototype,"ya",2),h([g()],q.prototype,"jo",2),h([g()],q.prototype,"Go",2),h([g()],q.prototype,"qo",2),h([g()],q.prototype,"ba",2),h([g()],q.prototype,"wa",2),h([g()],q.prototype,"Wo",2),h([g()],q.prototype,"xa",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.ka=true;this.Zo="drop-files-here";this.Ue=false;this.Oa=null;this.Yo=null;this.Ia=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.Pa=true;this.De=false;}static{n(this,"DropArea");}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}Ma(){let t=this.text;if(typeof t=="string"&&t.length>0){this.Zo=t;return}this.Zo=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.Xo(),this.Qo(),this.La(),this.Ra(ut.INACTIVE),this.Oa=Fs({element:this,shouldIgnore:n(()=>this.Ua(),"shouldIgnore"),onChange:n(t=>{this.Ra(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.rd()),this.subConfigValue("sourceList",t=>{let e=Y(t);this.Pa=e.includes($.LOCAL),this.Xo(),this.Qo();}),this.subConfigValue("multiple",t=>{this.Ue=!!t,this.Ma();});}willUpdate(t){super.willUpdate(t),t.has("disabled")&&(this.Xo(),this.Qo()),(t.has("text")||t.has("localeId"))&&this.Ma();}updated(t){super.updated(t),t.has("clickable")&&this.La();}Ua(){if(!this.Bt||!this.od())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}od(){let t=this.cfg.multiple,e=this.cfg.multipleMax,r=this.uploadCollection.size;return !(t&&e&&r>=e||!t&&r>0)}Xo(){let t=this.Pa&&!this.disabled;this.Bt=t;}Qo(){let t=this.Bt||!this.querySelector("[data-default-slot]");this.ka=t,this.hidden=!t;}Ra(t){let e=Object.entries(ut).find(([,r])=>r===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}rd(){if(this.Yo)return;let t=this.Ia.value;t&&(this.Yo=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.Ua(),"shouldIgnore")}));}La(){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.Oa?.(),this.Yo?.(),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.Ia)} class="uc-content-wrapper" ?hidden=${!this.ka} ><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.Zo)}</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,"ka",2);var Pt=class extends I{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=D.activities.UPLOAD_LIST;this.$a=false;this.Da=false;this.Fa=false;this.Jo=false;this.ts=false;this.vr=null;this.Na=false;this.es=null;this.Va=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this.rs=()=>{this.emit(k.UPLOAD_CLICK),this.api.uploadAll(),this.q();};this.os=()=>{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.ad(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}static{n(this,"UploadList");}get sd(){return this.es?this.nd(this.es):""}ad(){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.$a=p,this.Da=d,this.Fa=u,this.ts=e.total===0||!s&&!a,this.Jo=!a||this.cfg.multiple,this.Na=e.total>0,this.es=e;}nd(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.sd}</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.Na}>${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.Va} ?disabled=${!this.ts} ?hidden=${!this.Jo} ><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.Jo} ?disabled=${!this.ts} @click=${this.Va} ><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.Fa} @click=${this.rs} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.$a} ?disabled=${!this.Da} @click=${this.os} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};h([g()],Pt.prototype,"$a",2),h([g()],Pt.prototype,"Da",2),h([g()],Pt.prototype,"Fa",2),h([g()],Pt.prototype,"Jo",2),h([g()],Pt.prototype,"ts",2),h([g()],Pt.prototype,"vr",2),h([g()],Pt.prototype,"Na",2),h([g()],Pt.prototype,"es",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","menu","toolbar","compact"].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.ld=new Map;this.fi={};this._a=new Set;this.Fe=new Map;}static{n(this,"Config");}ss(t){return this._a.has(t)}ns(t){let e=this.e.pluginManager;if(e)return e.configRegistry.get(t)}as(t){return [...new Set([br(t),t.toLowerCase()])]}cd(t,e){if(ul(t)||this.ss(t)&&this.ns(t)?.attribute===false)return;let r=this.as(t);for(let s of r)typeof e>"u"||e===null?this.removeAttribute(s):this.getAttribute(s)!==e.toString()&&this.setAttribute(s,e.toString());}ud(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.ss(t)){let l=this.ns(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.dd(t,s[a],r),s[a]=r,this.cd(t,r),this.ud(t,r),this.debugPrint(`"${t}"`,r),this.ss(t)||Wa(this.cfg));}br(t){let e=this,r=cl(t);return e[r]??this.$[S(t)]}dd(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));}Ba(t){let e=t.configRegistry.getAll();this.fi={},this._a=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.as(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.as(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);}}pd(){this.e.when("pluginManager",t=>{this.Ba(t),this.yr=t.onPluginsChange(()=>{this.Ba(t);});});}hd(){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.ns(c);this.attributeChangedCallback(r,s??"",a??u?.defaultValue??"");}}}),this.hi.observe(this,{attributes:true,attributeOldValue:true});}initCallback(){super.initCallback();let t=this;this.pd(),this.hd();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.ld});},"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.ls=()=>{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.ls}><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.fd();return t||this.md()}fd(){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})}md(){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})}ls(){if(this.hasEntries){this.e.ctx.pub("*currentActivity","upload-list"),this.e.modalManager?.open("upload-list");return}this.source?.onClick();}gd(){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.ls} aria-label=${this.textBasedOnLocale}>${this.gd()}<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.za=ot.generateFastUid();this.vd=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.za} popovertargetaction="toggle">${this.yield("dd-header-button")}</button><div id=${this.za} class="uc-dropdown-content" popover="auto" @click=${this.vd}>${this.yield("dd-content")}</div>`}};h([g()],co.prototype,"za",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==="compact"||o.length===0?{main:null,remain:o}:{main:o[0]??null,remain:o.slice(1)},"adjustSourceBasedOnMode"),Ad={compact:"paperclip",menu:"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.Ka=0;this.q=he(()=>{this.isConnected&&this.yd();},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==="compact"}get shouldShowPrimaryAction(){return !this.isCollapsedMode||!this.isIdle||this.hasCollectionEntries}get shouldShowInline(){return this.isIdle&&!this.hasCollectionEntries&&this.z.length>1&&(this.le==="toolbar"||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}yd(){let t=this.api?.getOutputCollectionState();if(!t){console.warn("Collection state is undefined");return}this.xr=t,this.Ne=t.status;}ja(){this.wr=Sd(this.z,this.le);}initCallback(){super.initCallback(),this.subConfigValue("smartButtonViewMode",t=>{this.le!==t&&(this.le=t,this.ja());}),this.sub("*commonProgress",t=>{this.Ka=t;}),new Je(this,{ctx:this.e.ctx,sharedInstancesBag:this.e,onSourcesChange:n(t=>{this.z=t,this.ja();},"onSourcesChange")}),this.uploadCollection.observeProperties(this.q),this.uploadCollection.observeCollection(this.q),this.Ha=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.Ha?.(),super.disconnectedCallback();}bd(){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>`}wd(){return Ad[this.le]??"arrow-dropdown"}xd(){this.uploadCollection.clearAll();}Ed(){this.xr.failedEntries.forEach(t=>{t&&this.uploadCollection.hasItem(t.internalId)&&this.uploadCollection.remove(t.internalId);});}Cd(){this.uploadCollection.abortAll();}pi(){switch(this.Ne){case "failed":this.Ed();break;case "uploading":this.Cd();break;default:this.xd();}}Td(){return y`<uc-drop-down><uc-icon content-for="dd-header-button" name=${this.wd()} ></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>`}Sd(){return y`<uc-primary-action .entries=${this.xr} .source=${this.wr?.main} ></uc-primary-action>`}Ad(){return y`<uc-file-action-button @uc:remove=${this.pi} .uploading=${this.isUploading} .failed=${this.isFailed} .success=${this.isSuccess} .idle=${this.isIdle} .progress=${this.Ka} ></uc-file-action-button>`}kd(){return ct({"uc-smart-btn-inner":true,"uc-failed":this.isFailed,"uc-uploading":this.isUploading,"uc-success":this.isSuccess})}Md(){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.kd()}>${ri(this.shouldShowPrimaryAction?this.Sd():null)} ${ri(this.shouldShowInline?this.bd():null)} ${ri(this.shouldShowDropdown?this.Td():null)} ${ri(this.shouldShowAbortAction||this.hasCollectionEntries?this.Ad():null)} ${ri(this.Md())}</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,"Ka",2);var Di=class extends D{constructor(){super(...arguments);this.us=O();}static{n(this,"PluginActivityHost");}initCallback(){this.activityType=this.registration?.id??null,this.Ga(),super.initCallback();}willUpdate(t){super.willUpdate(t),t.has("registration")&&(this.Ga(),this.isActivityActive&&(this.Er(),this.qa()));}Ga(){this.registration&&(this.Gn()||this.registerActivity(this.activityType??"",{onActivate:n(()=>this.qa(),"onActivate"),onDeactivate:n(()=>this.Er(),"onDeactivate")}));}async qa(){await this.updateComplete;let t=this.us.value;if(!t||!this.registration)return;this.Er();let e=this.$["*currentActivityParams"];try{this.cs=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.us.value;if(t){try{this.cs?.();}catch(e){console.error(`[Plugin "${this.registration?.pluginId}"] Activity dispose threw an error`,e);}this.cs=void 0,t.replaceChildren();}}disconnectedCallback(){this.Er(),super.disconnectedCallback();}render(){return y`<div style="display: contents;" ${L(this.us)}></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.Wa())),this.Wa();}Wa(){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.Za=Le;this.Ya=Le.visible;this.Xa=Le.hidden;this.ds=false;this.Qa=false;}static{n(this,"PresenceToggle");}set visible(t){this.kt=t,this.Ja();}get visible(){return this.kt}set styles(t){this.Za=t,this.ds=true,this.Ya=t.visible??Le.visible,this.Xa=t.hidden??Le.hidden;}get styles(){return this.Za}Ja(){this.style.visibility=this.kt?"inherit":"hidden",hl(this,{[Le.transition]:!this.ds,[this.Ya]:this.kt,[this.Xa]:!this.kt}),this.toggleAttribute("inert",!this.kt);}Od(){this.Qa||(this.Qa=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.ds||this.classList.add(Le.transition),this.Ja(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.Od();},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.ps=false;this.hs=()=>{let t=this.ce.value;t&&(this.tl(t),this.ps&&this.active&&this.fs());};}static{n(this,"LineLoaderUi");}firstUpdated(t){super.firstUpdated(t),this.active&&this.fs();}updated(t){super.updated(t),t.has("active")&&(this.active?this.fs():this.Id());}fs(){let t=this.ce.value;if(!t)return;this.ps=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.hs),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.hs,{once:true});}Id(){let t=this.ce.value;t&&(this.ps=false,t.removeEventListener("transitionend",this.hs),this.tl(t));}tl(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.il(),this.rl();}updated(t){super.updated(t),t.has("reverse")&&this.il(),t.has("theme")&&this.rl();}il(){this.style.flexDirection=this.reverse?"row-reverse":"";}rl(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get Pd(){let t=this.ms;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.Ld}}get ms(){return !this.icon}get Ld(){return !this.text&&!this.ms}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.Pd)} name=${W(this.icon||void 0)} ?hidden=${this.ms} ></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.ol=`uc-backdrop-mask-${ot.generateFastUid()}`;this.Tr=false;this.wi=false;this.al=O();this.xi=false;this.Ei=null;this.cl=t=>{this.ul(),this.Ci&&(t.stopPropagation(),t.preventDefault(),this.Ci=false);};this.dl=t=>{if(!this.Ci||!this.Cr||!this.vs)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.vs,d=this.Bd(p,[c,u]);d&&(this.$["*cropBox"]=d);};this.pl=t=>{if(!this.$t)return;let e=Object.values(this.$t).find(r=>{if(!r||this.bs(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.sl=e,this.ul();};}static{n(this,"CropFrame");}get Gt(){return this.al.value??null}get Ci(){return this.wi}set Ci(t){this.wi!==t&&(this.wi=t,this.ys());}ys(){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}));}bs(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}Rd(){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.ol}),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.ol})`});l.appendChild(d),l.appendChild(c),this.vi=c,this.gs=p;}Ud(){this.vi&&(this.vi.style.display="none",window.requestAnimationFrame(()=>{this.vi&&(this.vi.style.display="block");}));}$d(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:a}=t;this.gs&&le(this.gs,{x:e,y:r,width:s,height:a});}Dd(){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.bs(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});}}ll(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.Fd.bind(this,e));}Nd(){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.ll(t,s);}return this.ll(t,""),t}Vd(){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}_d(){let t=this.Gt;if(!t)return;let e=document.createDocumentFragment(),r=this.Vd();e.appendChild(r);let s=this.Nd();for(let{groupNode:a}of Object.values(s))e.appendChild(a);t.appendChild(e),this.$t=s,this.yi=r,this.ys();}Fd(t,e){if(!this.$t)return;let r=this.$t[t];if(!r||this.bs(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.vs=r,this.Cr=[u,p],this.nl={...s};}Bd(t,e){let[r,s]=e,a=this.$["*imageBox"],l=this.nl??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)}ul(){let t=this.sl,e=this.Gt;e&&(e.style.cursor=t?Sa(t.direction):"initial");}hl(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;}zd(){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});}xs(){this.xi&&(this.$d(),this.Dd(),this.zd());}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.Ud(),this.xi&&window.requestAnimationFrame(()=>{this.xs();});}),this.sub("*cropBox",t=>{t&&(this.Tr=t.height<=M||t.width<=M,this.ys(),this.xi&&window.requestAnimationFrame(()=>{this.xs();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.hl(t);}),document.addEventListener("pointermove",this.dl,true),document.addEventListener("pointerup",this.cl,true);}firstUpdated(t){super.firstUpdated(t),this.Hd();}Hd(){let t=this.Gt;if(!(!t||this.xi)){if(this.Rd(),this._d(),this.xi=true,t.addEventListener("pointermove",this.pl,true),this.Ei){let e=this.Ei;this.Ei=null,this.hl(e);}this.xs();}}disconnectedCallback(){super.disconnectedCallback(),this.Gt?.removeEventListener("pointermove",this.pl,true),document.removeEventListener("pointermove",this.dl,true),document.removeEventListener("pointerup",this.cl,true);}render(){return y`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${L(this.al)}></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.ml=O();this.Cs=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.fl=V(this.gl.bind(this),300),this.Es=he(()=>{!this.isConnected||!this._||(this.Ts(),this.vl(),this.yl(),this.Ss(),this.As());},100);}static{n(this,"EditorImageCropper");}firstUpdated(t){super.firstUpdated(t),this.Ts();}vl(){let t=this.$["*editorTransformations"],e=vl(t,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...e};this.$["*operations"]=r;}Ts(){let t=this.ml.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;}yl(){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);}Ss(){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);}Kd(){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();}As(){if(!this._||!this.vt||!this.Mt||!this.i)return;let t=this.Mt;this.i.clearRect(0,0,t.width,t.height),this.Kd();}jd({fromViewer:t}){this.vt&&(this.Cs.value?.toggleThumbs(true),this.Gd(),setTimeout(()=>{this.className=Et({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}bl(){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)]}qd(){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.bl(),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}gl(){if(!this.isConnected||!this.ue)return;let t=this.$["*operations"],{rotate:e,mirror:r,flip:s}=t,a=this.qd(),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.yl(),this.Ss(),this.As());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this._){this._=true,await this.updateComplete,this.Ts(),this.ue=t,this.removeEventListener("transitionend",this.wl);try{let r=this.$["*originalUrl"],s=this.$["*editorTransformations"];this.vt=await this.Wd(r,s),this.vl(),this.Es(),this.jd({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.Es();}),this.s.observe(this);}}deactivate({reset:t=false}={}){this._&&(!t&&this.gl(),this._=false,this.Zd(),this.className=Et({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.Cs.value?.toggleThumbs(false),this.addEventListener("transitionend",this.wl,{once:true}),this.s?.disconnect());}Zd(){let t=this.bl(),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`;}Gd(){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`;}wl(){this._||(this.vt=null);}async Wd(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.As();}),this.sub("*cropBox",()=>{this.vt&&this.fl();}),this.sub("*currentAspectRatio",()=>{this.Ss();}),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.ml)}></canvas><uc-crop-frame ${L(this.Cs)}></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.ks=true;this.n="initial";this.xl={};this.qt=[];this.El=0;this.Tl=O();this.Sr=O();this.classList.add("uc-inactive_to_cropper"),this.Cl=V(async(t,e,r)=>{let s=n(()=>!this.Sl(t,e)||this.Re!==r||!!this.qt.find(u=>u.value===r),"shouldSkip");if(s())return;let a=await this.Al(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.Is(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);}}kl(){window.cancelAnimationFrame(this.El),this.El=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.xl};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 Al(t,e){return {src:await this.de({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}Sl(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.Is(this.n,e),this.Cl(this.n,this.m,e));}Is(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.kl();}Ml(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async Yd(){this.a=this.a||this.Ml();let t=this.a;t&&this.Ol(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.Ms=()=>{a(),this.Ms=void 0;};let l=this.n,c=this.m;if(await s,this._&&this.Sl(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.kl();}}async setTransformations(t){if(this.xl=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.Os?.();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.Os=c;}Xd(t){let e=this.a||this.Ml();if(this.Ol(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.ks=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.Xd(c),this.Ps();return}!e||typeof r!="number"||(this.qt=await Promise.all(yl(e,r).map(c=>this.Al(e,c))),this.Is(e,r),this.Yd());}deactivate({hide:t=true}={}){this._=false,this.Ms?.(),this.Os?.(),t&&!this.ks?(this.ks=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.Ps();},{once:true})):this.Ps();}Ol(t){let e=this.Tl.value;e&&(e.contains(t)||e.appendChild(t));}Ps(){this.Sr.value?.replaceChildren();}render(){return y`<div class="uc-fader-preview-host" ${L(this.Tl)}></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.Ls=0;this.Ar=O();this.Pl=O();this.Ll=O();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.Wt=0;this.Jd=t=>{t.stopPropagation();let e=this.Rl(t);e!==null&&(this.Rs(e),this.Qd("slider-input",e));};this.tp=t=>{t.stopPropagation();let e=this.Rl(t);e!==null&&this.Rs(e);};this.Ul=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.$l=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}static{n(this,"SliderUi");}Qd(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.Ls=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.Dl(this.Wt),this.Us(),this.s=new ResizeObserver(()=>{this.Us(),this.kr(this.Wt);}),this.s.observe(this);let e=this.Ar.value;e?.addEventListener("focus",this.Ul),e?.addEventListener("blur",this.$l),window.setTimeout(()=>{this.kr(this.Wt);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.Wt&&this.Rs(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.Us(),this.kr(this.Wt)),t.has("zero")&&this.hasUpdated&&this.Fl(this.Wt);}kr(t){this.Fl(t);let e=this.max-this.min;if(e===0)return;let{width:r}=this.getBoundingClientRect(),l=100/e*(t-this.min)*(r-this.Ls)/100;window.requestAnimationFrame(()=>{let c=this.Pl.value;c&&(c.style.transform=`translateX(${l}px)`);});}Fl(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.Ls)/100;window.requestAnimationFrame(()=>{this.Si&&(this.Si.style.transform=`translateX(${l}px)`);});}Us(){let e=this.Ll.value;if(!e)return;let{width:r}=e.getBoundingClientRect(),s=Math.ceil(r/2),a=Math.ceil(s/15)-2;if(this.Il===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.Il=a;}disconnectedCallback(){super.disconnectedCallback();let t=this.Ar.value;t?.removeEventListener("focus",this.Ul),t?.removeEventListener("blur",this.$l),this.s?.disconnect(),this.s=void 0;}Rs(t){Number.isFinite(t)&&(this.Wt=t,this.hasUpdated&&(this.Dl(t),this.kr(t)));}Dl(t){let e=this.Ar.value;e&&(e.value=String(t));}Rl(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.Ll)}></div><div class="uc-thumb" ${L(this.Pl)}></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.Jd} @change=${this.tp} />`}};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.$s=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.ep();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});}ep(){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.$s} ></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}}Nl(){let t=this.buttonClasses;for(let[e,r]of Object.entries(t))this.classList.toggle(e,r);}onClick(t){}connectedCallback(){super.connectedCallback(),this.Nl();}updated(t){super.updated(t),t.has("active")&&this.Nl();}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.ip(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}ip(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.Vl(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.tt&&this.Vl(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);}Vl(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();}rp(){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.rp()}<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._l=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._l=this.isOriginal?40:20,this.requestUpdate("filter",r),this.isConnected&&this.Bl(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;}op(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this._l||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.Ds(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.Bl(this.m),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.m);}),this.sub("*networkProblems",async e=>{e||(this.a?await this.Ds():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()));}Bl(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async Ds(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.op());}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.Ds();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 sp(){return !!(this.ze&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.sp?"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,"_l",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.zl(e);}zl(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.zl(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.Hl=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.Hl,{passive:false}),this.addEventListener("scroll",wl,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.Hl),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.Kl=true;this.tabList=[...nt];this.activeTab=H.CROP;this.Ir=true;this.Fs=false;this.jl=null;this.Gl=0;this.ql=0;this.Pr=O();this.Wl=O();this.tabToggleRefs={[H.CROP]:O(),[H.TUNING]:O(),[H.FILTERS]:O()};this.Zl=()=>{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.Fs=s;},0);this.np={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.ap={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.lp={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.cp={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.Bs=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.wp=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:ai(this.$["*operationTooltip"])}),this.Pr.value?.apply(),this.Yl();};this.xp=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.Pr.value?.cancel(),this.Yl();};this.Ep=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&(this.telemetryManager.sendEventCloudImageEditor(t,r),this.Ns(r,{fromViewer:false}));};}static{n(this,"EditorToolbar");}Yl(){this.$["*showSlider"]=false,this.$["*tabId"]===H.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===H.TUNING&&(this.Fs=false);}Ns(t,{fromViewer:e=false,force:r=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.Xl(t,{fromViewer:e,force:r});}Xl(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.Wl.value;if(!e||!r)return;let s=e.offsetLeft,a=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.Gl!==s||this.ql!==a)&&(this.Gl=s,this.ql=a,r.style.transform=`translateX(${s}px)`,r.style.width=`${a}px`);}get Vs(){return this.Mi.length>=3}up(t){switch(t){case H.CROP:return this.dp();case H.FILTERS:return this.pp();case H.TUNING:return this.hp();default:return []}}dp(){let t=[];if(this.Vs)t.push(()=>this.fp());else for(let e of this.Mi)t.push(()=>this.Ql(e));for(let e of Pn)t.push(()=>this.mp(e));return this._s(t)}pp(){let e=[Bt,...Ln].map(r=>()=>this.gp(r));return this._s(e)}hp(){let t=On.map(e=>()=>this.vp(e));return this._s(t)}_s(t){return t.length?t.map(r=>r()):[]}fp(){return y`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}Ql(t){return y`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}mp(t){return y`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}gp(t){return y`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}vp(t){return y`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}yp(){return this.Vs?this.Mi.map(t=>this.Ql(t)):[]}async bp(){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.Ns(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.Xl(e,{fromViewer:false,force:true}),this.Rr();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.bp(),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.Kl=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[r]=e;r&&this.Ns(r,{fromViewer:false});return}this.he();}),this.sub("*operationTooltip",e=>{this.jl=e;}),this.Rr();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.Zl);}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.Zl),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}Ur(){let t=this.Pr.value;t&&(this.$["*sliderEl"]=t);}Cp(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.lp}><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.Ep} ${L(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Tp(t){let e=this.up(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.Fs?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.Vs;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.jl??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.np} ><div class="uc-tab-content-row">${nt.map(r=>Fi(this.activeTab===r,()=>this.Tp(r)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.Kl} .styles=${this.cp} @initial-render=${()=>this.he()} ><div class="uc-tab-toggles_indicator" ${L(this.Wl)} ></div>${nt.map(r=>this.Cp(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.Bs}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.ap}><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.yp()}</div>`:U}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.xp} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.wp} 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,"Kl",2),h([g()],gt.prototype,"tabList",2),h([g()],gt.prototype,"activeTab",2),h([g()],gt.prototype,"Ir",2),h([g()],gt.prototype,"Fs",2),h([g()],gt.prototype,"jl",2),h([g()],gt.prototype,"Mi",2);var El=jt([...nt]),it=class extends x{constructor(){super(...arguments);this.ctxOwner=true;this.Sp="";this.de=Lt;this.Ap="";this.ki=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=El;this.Jl=false;this._t=false;this.zs=null;this.Oi=null;this.Lr=V(t=>{this.ki=t;},300);this.$r=O();this.tc=O();this.ec=O();this.ic=O();this.rc=()=>{this.Lr(false),this.de!==Lt&&(this.$["*networkProblems"]=false);};this.oc=()=>{this.Lr(false),this.$["*networkProblems"]=true;};this.kp=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...fl(this)};}static{n(this,"CloudImageEditorBlock");}static{this.styleAttrs=["uc-cloud-image-editor"];}Mp(){this._t||this.zs||(this.zs=this.updateComplete.then(()=>{this.zs=null,this._t=true;}));}initCallback(){super.initCallback(),this.sc(),this.nc();}Ur(){let t=this.ec.value;t&&(this.$["*faderEl"]=t);let e=this.tc.value;e&&(this.$["*cropperEl"]=e);let r=this.ic.value;r&&(this.$["*imgContainerEl"]=r);let s=this.$r.value;s&&(this.$["*imgEl"]=s);}Op(){let t=this.$r.value;t&&(t.addEventListener("load",this.rc),t.addEventListener("error",this.oc));}Ip(){let t=this.$r.value;t&&(t.removeEventListener("load",this.rc),t.removeEventListener("error",this.oc));}get Pp(){let t=this.$["*tabId"];return Et("uc-image",{"uc-image_hidden_to_cropper":t===H.CROP,"uc-image_hidden_effects":t!==H.CROP})}ac(){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.Op(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),r=t.has("uuid")||t.has("cdnUrl");e&&!r&&this.updateImage();}disconnectedCallback(){this.Ip(),super.disconnectedCallback();}render(){let t=this.Ap??"",e=this.Sp??"",r=this.de||Lt,s=this.ki,a=this.Jl;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.kp}></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.ic)}><img src=${r} class=${this.Pp} ${L(this.$r)} />${Fi(this._t,()=>y`<uc-editor-image-cropper ${L(this.tc)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${L(this.ec)}></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.sc(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.nc();}sc(){let t=this.tabs||El;this.$["*tabList"]=ml(t);}nc(){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.ac();}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.Mp();}}}async initEditor(){try{await this.ac();}catch{return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.Jl=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,"Sp",2),h([g()],it.prototype,"de",2),h([g()],it.prototype,"Ap",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,"Jl",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.Lp();}disconnectedCallback(){super.disconnectedCallback(),this.Rp();}Bs(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);}Lp(){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.Up(r);}Rp(){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.Bs} @cancel=${this.Ut} @change=${this.handleChange} ></uc-cloud-image-editor>`}Up(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.$s=t=>{this._e=t.target?.value??"";};this.rs=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.rs}><label><input placeholder="https://" class="uc-url-input" type="text" autofocus @input=${this.$s} /></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.uc=i=>{if(i.source!==this.Hs)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.Hs=i,this.cc=t,window.addEventListener("message",this.uc);}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.cc();this.Hs.postMessage(i,t);}destroy(){window.removeEventListener("message",this.uc);}};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.Ks=[];this.js=false;this.Gs=false;this.qs=false;this.Ws=false;this.Nr=false;this.Zs=false;this.Ys="uc-hidden";this.dc=true;this.os=()=>{for(let t of this.Ks){let e=this.Dp(t),{filename:r}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:r,source:s});}this.routerLayer.navigateAfterFileAdd();};this.Ut=()=>{this.historyBack();};this.zp=()=>{this.yt?.send({type:"select-all"});};this.Hp=()=>{this.yt?.send({type:"deselect-all"});};}static{n(this,"ExternalSource");}get $p(){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.pc():console.error('Param "externalSourceType" is required for external source activity'),this.sub("*currentActivityParams",()=>{setTimeout(()=>{this.isConnected&&(this.hc(),this.pc());});}),this.subConfigValue("multiple",e=>{this.Nr=e;}),this.subConfigValue("localeName",()=>{this.fc();}),this.subConfigValue("externalSourcesEmbedCss",e=>{this.mc(e);});}Dp(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}Fp(t){this.dc=t.isVisible;}async Np(t){if(this.cfg.multiple!==t.isMultipleMode){console.error("Multiple mode mismatch");return}this.Vp(t.selectedCount,t.total),this.Ys=t.isReady?"":"uc-hidden",this.js=t.isReady,this.Gs=t.isReady&&t.selectedFiles.length>0,this.Nr=t.isMultipleMode&&t.total>0,this.qs=t.selectedCount<t.total,this.Ws=t.selectedCount===t.total,this.Ks=t.selectedFiles??[],this.Zs=t.total>0;}gc(){this.mc(this.cfg.externalSourcesEmbedCss),this._p(),this.fc();}_p(){this.yt?.send({type:"set-theme-definition",theme:xl(this)});}mc(t){this.yt?.send({type:"set-embed-css",css:t});}fc(){this.yt?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}Bp(){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()}Vp(t,e){this.Fr={selectedCount:t,total:e};}pc(){let t=document.createElement("iframe");t.src=this.Bp(),t.marginHeight=0,t.marginWidth=0,t.frameBorder="0",t.allowTransparency=true,t.addEventListener("load",this.gc.bind(this)),t.addEventListener("load",this.gc.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.Np.bind(this)),this.yt.on("toolbar-state-change",this.Fp.bind(this)),this.vc());}hc(){this.yt?.destroy(),this.yt=void 0,this.He.value&&(this.He.value.innerHTML=""),this.vc();}vc(){this.Ks=[],this.js=false,this.Gs=false,this.qs=false,this.Ws=false,this.Nr=false,this.Zs=false,this.Ys="uc-hidden",this.Fr=null;}disconnectedCallback(){super.disconnectedCallback(),this.hc();}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.dc}><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.$p}</span><button type="button" @click=${this.zp} ?hidden=${!this.qs} >${this.l10n("select-all")}</button><button type="button" @click=${this.Hp} ?hidden=${!this.Ws} >${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.os} ?disabled=${!this.Gs} ?hidden=${!this.Zs} ><uc-spinner ?hidden=${this.js}></uc-spinner><span class=${this.Ys}>${this.l10n("done")}</span></button></div></div>`}};h([g()],vt.prototype,"Ks",2),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,"Nr",2),h([g()],vt.prototype,"Zs",2),h([g()],vt.prototype,"Ys",2),h([g()],vt.prototype,"dc",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.Xs=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.Kp={};this.zr=[];this.Hr=null;this.yc=()=>{this.bc(),this.Ri="pause";};this.wc=()=>{this.Ri="play",this.jp();};this.Ui=O();this.ce=O();this.W=O();this.xc=0;this.Ec=0;this.Cc=null;this.Kr=true;this.jr=true;this.Gp=Al();this.Tc=[];this.fe=true;this.Qs="";this.Ge=true;this.me=true;this.qe=true;this.Sc=[];this.ge=true;this.Js=true;this.ve=true;this.Dt=true;this.ye=true;this.We="camera-full";this.Ri="play";this.Ac="microphone";this.Gr="uc-shot-btn uc-camera-action";this.qp=()=>{if(this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.g}}}),this.g===P.PHOTO&&this.Wp(),this.g===P.VIDEO){if(this.Ot?.state==="recording"){this.kc();return}this.Zp();}};this.Yp=t=>{let e=t.target;e&&(this.Br=e.value,this.Ze());};this.Xp=t=>{let e=t.target;e&&(this._r=e.value,this.Ze());};this.Qp=()=>{this.Ze();};this.Jp=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.g}}}),this.qp();};this.th=()=>{this.eh();};this.ih=()=>{this.rh();};this.oh=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.g}}}),this.sh();};this.nh=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.g}}}),this.ah();};this.Mc=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&this.Oc(r);};this.Ic=()=>{let t=Math.floor((performance.now()-this.xc+this.Ec)/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.kc();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.Ic);};this.lh=()=>{this.xc=performance.now(),this.Ec=0,this.Ic();};this.Pc=()=>{this.Ye&&cancelAnimationFrame(this.Ye);};this.bc=()=>{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.bc);};this.jp=()=>{this.Ye&&cancelAnimationFrame(this.Ye);};this.Ye=null;this.Zp=()=>{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.lh(),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.kc=()=>{this.Ot?.addEventListener("stop",()=>{this.ch(),this.Pc(),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.eh=()=>{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.rh=()=>{this.It?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.Ac=t.enabled?"microphone":"microphone-mute",this.Js=!t.enabled;});};this.ch=()=>{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.uh(r);}catch(t){console.error("Failed to preview video",t),this.telemetryManager.sendEventError(t,"camera previewing. Failed to preview video");}};this.sh=()=>{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.ah=()=>{if(this.$i(At.ACCEPT),this.g===P.PHOTO){this.Mt?.toBlob(s=>{if(!s)return;let a=this.Lc("camera","jpeg",kl,s);this.Rc(a);},kl);return}let t=new Blob(this.Pi,{type:this.Ot?.mimeType}),e=this.dh(this.Ot?.mimeType),r=this.Lc("video",e,`video/${e}`,t);this.Rc(r),this.Pi=[];};this.ph=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.hh=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.ph(t),this.g===P.VIDEO&&(t==="play"||t==="stop"||t==="retake"||t==="accept"||t==="pause"||t==="resume")&&this.hh(t);};this.Oc=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.Lc=(t,e,r,s)=>{let a=Date.now(),l=`${t}-${a}.${e}`;return new File([s],l,{lastModified:a,type:r})};this.Rc=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.Qs="camera-permissions-prompt",this.Kr=true,this.me=true,this.Dt=true,this.jr=false,this.rn()):(this.Qs="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.rn());},300);this.fh=()=>{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.rn=()=>{this.Xs&&(this.W.value&&(this.W.value.volume=0),this.Hr?.getTracks?.()?.[0]?.stop(),this.tn(this.W.value),this.Di(null),this.fh(),this.Pc(),this.Xs=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.Xs=!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.Uc=()=>{this.Ze();};this.mh=async()=>{try{this.qr();for(let t of qd){let e=await navigator.permissions.query({name:t});this.Kp[t]=e,e.addEventListener("change",this.Uc),this.zr.push(()=>{e.removeEventListener("change",this.Uc);});}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.gh=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this.sn(),navigator.mediaDevices.addEventListener("devicechange",this.sn);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.sn=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.Tc=this.Ke,this.fe=this.Ke.length<=1,this.Br=this.Ke[0]?.value??null,this.Sc=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.vh=async()=>{await this.mh(),await this.gh(),await this.Ze(),this.$c(this.Ft);};this.yh=async()=>{this.Vr&&this.Vr(),window.chrome||this.Fi("denied"),this.rn();};this.$c=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.Oc(e);};}static{n(this,"CameraSource");}uh(t){this.tn(t),t.addEventListener("play",this.yc),t.addEventListener("pause",this.wc);}tn(t){t?.removeEventListener("play",this.yc),t?.removeEventListener("pause",this.wc);}Di(t){this.Hr!==t&&(this.Hr=t,this.en());}en(){let t=this.W.value;if(!t)return;let e=this.Hr??null;t.srcObject!==e&&(t.srcObject=e);}Wp(){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();}dh(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.Cc=t?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",t=>{this.ve=!t,this.Js=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isConnected)return;let e=G(t);this.$c(e.filter(r=>r===P.PHOTO||r===P.VIDEO));}),this.vh();}firstUpdated(t){super.firstUpdated(t),this.en();}updated(t){super.updated(t),this.en();}bh(){this.qr(),navigator.mediaDevices?.removeEventListener("devicechange",this.sn),this.tn(this.W.value),this.Di(null);}disconnectedCallback(){super.disconnectedCallback(),this.yh(),this.bh();}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.Tc} ?hidden=${this.fe} @change=${this.Yp} ></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.Cc})} ?hidden=${this.Kr} ${L(this.W)} ></video><div class="uc-message-box" ?hidden=${this.jr}><span>${this.l10n(this.Qs)}</span><button type="button" @click=${this.Qp} ?hidden=${this.Gp} >${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.Mc} ?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.Mc} ?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.th} ?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.oh} >${this.l10n("retake")}</button><button type="button" class="uc-primary-btn" @click=${this.nh} data-testid="accept" >${this.l10n("accept")}</button></div><button type="button" data-testid="shot" @click=${this.Jp} 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.ih} ?hidden=${this.ve} data-testid="toggle-microphone" ><uc-icon name=${this.Ac}></uc-icon></button><uc-select class="uc-audio-select" .options=${this.Sc} ?hidden=${this.ge} ?disabled=${this.Js} @change=${this.Xp} data-testid="audio-select" ></uc-select></div></div>`}};h([g()],z.prototype,"Cc",2),h([g()],z.prototype,"Kr",2),h([g()],z.prototype,"jr",2),h([g()],z.prototype,"Gp",2),h([g()],z.prototype,"Tc",2),h([g()],z.prototype,"fe",2),h([g()],z.prototype,"Qs",2),h([g()],z.prototype,"Ge",2),h([g()],z.prototype,"me",2),h([g()],z.prototype,"qe",2),h([g()],z.prototype,"Sc",2),h([g()],z.prototype,"ge",2),h([g()],z.prototype,"Js",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,"Ac",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}wh(){return y`<uc-smart-btn></uc-smart-btn>`}xh(){return y`<uc-simple-btn></uc-simple-btn>`}Eh(){return this.headless?null:this.smartButton?this.wh():this.xh()}render(){return y` ${super.render()} ${this.Eh()}<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.Dc=false;this.Ut=()=>{if(this.Fc){let t=this.$["*historyBack"];t?.();return}this.Nc&&(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 Fc(){let t=this.$["*history"];return !t||t.length<=1?false:t[t.length-1]!==D.activities.START_FROM}get Nc(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}nn(){return this.getCssData("--cfg-init-activity")||D.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});let t=this.nn();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.Dc=this.Fc||this.Nc;});}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.Dc} >${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,"Dc",2);var Ys="active",Eo="",fe=class extends Xt{constructor(){super();this.an=false;this.Wr=false;this.Zr=Eo;this.ln=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.ln=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"];}nn(){return this.getCssData("--cfg-init-activity")||D.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});let t=this.nn();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.ln=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.an=!r):(this.style.removeProperty("--uc-grid-col"),this.an=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.ln}><uc-drop-area ?single=${this.an} 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,"an",2),h([g()],fe.prototype,"Wr",2),h([g()],fe.prototype,"Zr",2),h([g()],fe.prototype,"ln",2),h([g()],fe.prototype,"mi",2);/*! For license information please see file-uploader.iife.min.js.LEGAL.txt */
|
|
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.Vc=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._c();}_c(){this.Qr=new Promise(i=>this.enableUpdating=i),this.Yt=new Map,this.Bc(),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);}Bc(){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);}zc(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.Hc());}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.cn??=new Set).add(i));}async Hc(){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.Kc(t);}willUpdate(i){}Kc(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.cn&&=this.cn.forEach(t=>this.zc(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.jc?.[e]:t.Gc,s=mi(i)?void 0:i.io;return r?.constructor!==s&&(r?.un?.(false),s===void 0?r=void 0:(r=new s(o),r.ro(o,t,e)),e!==void 0?(t.jc??=[])[e]=r:t.Gc=r),r!==void 0&&(i=we(o,r.qc(o,i.values),r,e)),i}n(we,"M");var rr=class{static{n(this,"R");}constructor(i,t){this.dn=[],this.wt=void 0,this.pn=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.pn,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.dn.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.dn)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.hn}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.hn=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.mn(i):i.Nt!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):hn(i)?this.k(i):this.mn(i);}O(i){return this.Pt.parentNode.insertBefore(i,this.we)}T(i){this.r!==i&&(this.xe(),this.r=this.O(i));}mn(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.Wc(i):(e.el===void 0&&(e.el=fi.createElement(fn(e.h,e.h[0]),this.options)),e);if(this.r?.pn===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;}}Wc(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.hn=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.Zc;if(r===void 0){let s=t?.renderBefore??null;e.Zc=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.Ch=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.gn=null;this.so=null;}static{n(this,"CssDataMixinClass");}getCssData(r,s=false){let a=this.gn??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.gn=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();}Yc(){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.vn(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;}vn(r){return r instanceof Comment&&r.nextSibling instanceof Element?this.vn(r.nextSibling):"contentFor"in r?r.contentFor||"":r instanceof Element&&r.hasAttribute("content-for")&&r.getAttribute("content-for")||""}Xc(r){return !r.textContent||!r.textContent.trim()}Qc(r){let s=this.Xt[r];return !s||s.every(a=>a instanceof Comment||a instanceof Text&&this.Xc(a))}update(r){!this.hasUpdated&&this.willYield&&this.Yc(),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.Qc(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.Jc=new Fe(this,{context:bn,callback:n(s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.wn=s,this.bn();},"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 yn(){return this.zi}set yn(r){let s=r??void 0;this.zi!==s&&(this.zi=s,this.bn());}shouldUpdate(r){return this._t?super.shouldUpdate(r):false}get Vt(){return this.yn||this.wn||void 0}bn(){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}));}xn(){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();}}En(){return !this.pt&&this.Vt&&this.uo(),this.pt&&this.xn(),this.pt}Ki(){let r=this.En();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.xn();}}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.En();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.tu(),super.disconnectedCallback(),this.Je&&(this.ao=true);}tu(){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,"yn",1),h([g()],i.prototype,"wn",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.eu.bind(this),window.addEventListener("paste",this.listener);}static{n(this,"ClipboardLayer");}iu(t){return !!t.closest("uc-url-source")}openUploadList(){this.e.routerLayer.navigateAfterFileAdd();}async eu(t){if(t.clipboardData){for(let e of this.scopes)if(e.isConnected){if(this.iu(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.Cn=Qn(this.Wi,[Wn(),Xn("is-pressed"),Yn(),Zn()]);}registerBlock(i){this.Wi.registerScope(i);}destroy(){this.Cn?.(),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.Tn(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.Tn(r),this.Sn(r,s));})),this.addSub(this.i.sub(S("localeDefinitionOverride"),r=>{if(!r)return;let s=r[this.Ce];s&&this.Sn(this.Ce,s);}));}static{n(this,"LocaleManager");}Sn(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);}}Tn(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.ou=t;this.ei=new Set;this.An=this.i.sub("*lazyPlugins",e=>{this.ru(e??[]);});}static{n(this,"LazyPluginLoader");}ru(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.kn(i),"recompute");for(let r of t)this.ei.add(this.i.sub(r,e,false));this.kn(i);}kn(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.ou(s);}destroy(){this.An();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.Mn=new Lr(this.i,e=>{this.yo=this.yo.then(()=>e).then(r=>{if(r)return this.su(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 su(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.nu(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 nu(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.Mn.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)}On(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.On(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.On(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";var Rt="blocks",$t=ra;var Fr=class extends j{constructor(t){super(t);this.au=ot.generateRandomUUID();this.Ae=structuredClone(tt);this.xo=false;this.Eo=null;this.Bt=false;this.In=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.lu(e,r));}));}static{n(this,"TelemetryManager");}cu(t){t===F.INIT_SOLUTION&&!this.xo&&(this.xo=true);}lu(t,e){this.Ae[t]!==e&&(this.Ae[t]=e);}uu(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.au,component:this.du,activity:this.pu,projectPubkey:this.Ae.pubkey,userAgent:navigator.userAgent,eventType:r.eventType??"",eventTimestamp:this.hu,payload:{location:this.fu,...e}}}mu(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.uu({eventType:t.eventType,payload:t.payload,config:t.config});this.cu(t.eventType),!(this.mu(t.eventType)||this.Eo&&this.Pn(this.Eo,e))&&this.ke.add(async()=>{this.Eo=e,await this.In.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}}});}Pn(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.Pn(t[a],e[a]))return false;return true}get hu(){return Date.now()}get du(){if(!this.i.has("*solution"))return null;let t=this.i.read("*solution");return t?t.toLowerCase():null}get pu(){return this.i.has("*currentActivity")?this.i.read("*currentActivity"):null}get fu(){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.Ln=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.Ln=!!t,this.Rn();});this.tr=i;}this.gu(),this.Rn();}gu(){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));}Rn(){if(!this.oe.size)return;let i=this.se.testId||"";for(let t of this.oe){let e=this.Ji.get(t);e&&(this.Ln?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.vu(),K.deleteCtx(this.ctxName);}Un(){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.Un();if(!r.has(t)&&(!this.has(t)||!this.$[t])){let s=e(this.e);this.add(t,s,true),r.set(t,s);return}}vu(){let t=this.Un();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.yu=e;}qc(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.$n=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.$n;this.it=i;let t=[i];return t.raw=t,this.$n={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.bu=[ms,hs,fs,gs];this.wu=[ps,ds];this.ke=new se(20);this.Dn=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.xu(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.wu,...s])try{let l=a(e,t);if(!l)continue;l&&(r.push(this.Fn(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 xu(t,e){if(this.zt)return;let r=this.e.api,s=this.Nn(t),a=s.promise??Promise.resolve(),l=(async()=>{if(this.zt||(await a,this.zt))return;let c=this.Eu(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.Vn(),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.Fn(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.Dn(),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);}}Fn(t){return {...t,type:t.type??"CUSTOM_ERROR"}}Nn(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}Vn(){let t=this.te.fileValidators;return [...this.bu,...t].map(ju)}Eu(t,e){let r=this.Nn(t);return this.Vn().filter(s=>!r.skippedValidators.has(s.validator)).filter(s=>s.runOn===e)}destroy(){this.zt=true,this.Dn.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.zn=i.initialValue,this.at=ot.generateFastUid(),this.J=K.registerCtx({},this.at),this._n=i.watchList||[];let t=Object.create(null);this.Bn=(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.Hn();},i.handler&&this.observeCollection(i.handler);}static{n(this,"TypedCollection");}static{this.Cu=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.Hn();});}Hn(){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.Cu));}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.zn);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._n.forEach(e=>{this.Ht[t.uid]||(this.Ht[t.uid]=[]),this.Ht[t.uid]?.push(t.subscribe(e,()=>{this.Bn(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",BOX:"box",ONEDRIVE:"onedrive"}),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.Kn?.length===1){let e=this.Kn[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 Kn(){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.Tu=V(this.Su.bind(this),10);}static{n(this,"LitActivityBlock");}jn(){let t=o.ni.get(this);this[Ze]=false,this.removeAttribute(Ra),t?.deactivateCallback?.();}Au(){let t=o.ni.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Ze]=true,this.setAttribute(Ra,""),t?.activateCallback?.(),this.Tu(),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.jn():this.activityType===t&&!this[Ze]&&this.Au();}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"]=[]);}));}Su(){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);}Gn(){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});}ku(){this.isActivityActive&&this.jn(),o.ni.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.Gn()&&this.ku();}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.Lu(e);},300);this.Iu=(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.Zn(),this.Mo();}};this.Pu=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.Zn();}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.Ru();}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.Zn=()=>{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 Mu(){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.Mu&&this.couldBeCtxOwner&&this.Ou();}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.qn(),this.Mo.cancel();}connectedCallback(){super.connectedCallback(),this.or&&this.Wn();}Ou(){this.or=true,this.Wn(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}Wn(){this.qn(),this.Ao=this.uploadCollection.observeCollection(this.Iu),this.ko=this.uploadCollection.observeProperties(this.Pu);}qn(){this.ko?.(),this.Ao?.(),this.ko=void 0,this.Ao=void 0;}async Lu(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;}Ru(){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.Yn=null;}static{n(this,"Icon");}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",e=>{this.Yn=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.Yn?.(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.Uu();}Uu(){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");}Xn(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.Qn?Cs+s:Number(a)>Es&&!this.Qn?Es+s:t}$u(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.$u(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.Xn(r)));let p=this.$$("pubkey");if(p)return this.li(Z(`https://${p}.ucr.io/`,s,this.Xn(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}Du(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 Jn(){return this.$$("is-background-for")}get ta(){let t=this.$$("breakpoints");if(t){let e=Y(t);return Da(e.map(r=>parseInt(r,10)))}else return null}get Qn(){return this.$$("format").toLowerCase()==="jpeg"}ea(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}`);}ia(){let t=new Set;return this.ta?this.ta.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()}ra(){return this.gt()}get oa(){return this.gt("100x","100")}Fu(){let t=this.Jn;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.ea(e);}):this.ea(e);});}Nu({elNode:t,src:e,srcset:r}){e&&(t.src=e),r&&(t.srcset=r);}Po({elNode:t}){this.Du(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.Nu({elNode:r,src:t,srcset:e});})}async Vu(){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.oa);try{await this.Lo({src:this.ra(),srcset:this.ia(),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.oa,elNode:this.St}),this.appendChild(this.St)),await this.Lo({src:this.ra(),srcset:this.ia(),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.Jn?this.Fu():this.Vu();}};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._u?.(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.un?.(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._u??=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;}un(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.yu]=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.Bu=()=>{this.closeDialog();};this.zu=t=>{this.Ro=t.target;};this.Hu=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.sa=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.sa);}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.sa);}Ku(t){this.dialogEl={value:t},this.dialogEl.value?.addEventListener("close",this.Bu),this.dialogEl.value?.addEventListener("mousedown",this.zu),this.dialogEl.value?.addEventListener("mouseup",this.Hu);}render(){return y`<dialog ${L(this.Ku)}>${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 na(){return this.nameAttrValue??this.ctxName}aa(){let t=document.createElement("input");return t.type="text",t.name=this.na,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,jr(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.K=this.aa(),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.aa();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.na}[]`,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.la=()=>{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.la);}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.la);}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.ju=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.ju} .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.Gu(this.source);}Gu(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.ca=[];this.i=t.ctx,this.e=t.sharedInstancesBag,this.ua=t.onSourcesChange,i.addController(this);}static{n(this,"SourceListController");}hostConnected(){this.No=this.i.sub(S("sourceList"),t=>{this.ca=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.ca.forEach(s=>{let a=this.qu(s,e);if(a.length!==1||a[0]!==s){for(let u of a){let p=e.get(u);p&&r.push(this.da(p));}return}let c=e.get(s);c&&r.push(this.da(c));}),this.ua(r);}qu(i,t){let e=t.get(i);return e?.expand?e.expand():[i]}da(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(),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.pa=false;this.hr=null;this.ha=false;this.Wu=this.cfg.filesViewMode;this.fa=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.Zu(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.fa.bind(this),100);}static{n(this,"Thumb");}Zu(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)}Yu(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;})}Bo(){this._o?.cancel(),this._o=void 0;}Xu(t){if(this.Bo(),!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._o=r,this.Yu(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.fa(true);return}this.ha&&this.fr();}}firstUpdated(t){super.firstUpdated(t),this.ma();}updated(t){super.updated(t),t.has("uid")&&this.ma();}di(t){let[e]=t;e&&(this.ha=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.Bo(),this.Kt&&(this.Kt="");}ma(){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.Xu(s??void 0);}),this.subEntry("cdnUrlModifiers",r),this.mr(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this.pa&&(this.Wu==="list"&&this.mr(true),this.pa=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.Bo(),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.ga=null;}static{n(this,"UploadCtxProvider");}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=k;}initCallback(){super.initCallback(),this.ga=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.ga?.();}};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.va=true;this.uid="";this.zo="";this.Ho="";this.Ko="";this.At=0;this.ya=false;this.jo="";this.Go=false;this.qo=false;this.ba=false;this.wa=false;this.Wo=false;this.xa="";this.gr=[];this.Ea=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.Qu=()=>{this.Ca();};this.S=V(()=>this.Ta(),100);this.td=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.Ko=f,this.Ho=r,this.ya=c||u||p||d,this.At=p||d?0:t.getValue("uploadProgress"),this.xa=m?this.l10n("a11y-file-item-status",{fileName:m,status:this.l10n(e?.description?.toLocaleLowerCase()??"").toLocaleLowerCase()}):"";},100));this.Ca=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");}Ta(){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.Ju(t,e);}Ju(t,e){e===Q.FAILED?this.jo="badge-error":e===Q.FINISHED&&(this.jo="badge-success"),e===Q.UPLOADING&&(this.wa=false,this.removeAttribute("focused")),this.qo=e===Q.FAILED,this.ba=e===Q.UPLOADING,this.Go=e===Q.FINISHED,this.td(e);}reset(){super.reset(),this.S.cancel();}di(t){let[e]=t;e&&e.isIntersecting&&!this.Ea&&(this.va=false,this.Ea=true);}Sa(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.zo=r||e.getValue("externalUrl")||this.l10n("file-no-name"),this.S();}),this.subEntry("externalUrl",r=>{this.zo=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.Ta(),this.ae();}Aa(t){if(this.cfg.filesViewMode==="list"){this.Wo=true;return}this.Wo=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.Sa(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}});}ed(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.Sa(this.uid),this.subConfigValue("filesViewMode",e=>{this.Aa(this.cfg.gridShowFileNames),this.setAttribute("mode",e);}),this.subConfigValue("gridShowFileNames",e=>{this.Aa(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.Ca());});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.va?false:super.shouldUpdate(t)}render(){return y`<div class="uc-inner" ?data-finished=${this.Go} ?data-uploading=${this.ba} ?data-failed=${this.qo} ?data-focused=${this.wa} ><uc-thumb .uid=${this.uid} .badgeIcon=${this.jo}></uc-thumb><div aria-atomic="true" aria-live="polite" class="uc-file-name-wrapper" aria-label=${this.xa}><span class="uc-file-name" ?hidden=${!this.Wo}>${this.zo}</span><span class="uc-file-error" ?hidden=${!this.Ho}>${this.Ho}</span><span class="uc-file-hint" ?hidden=${!this.Ko}>${this.Ko}</span></div><div class="uc-file-actions">${this.gr.map(t=>y`<button type="button" @click=${()=>this.ed(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.ya} .failed=${this.qo} .success=${this.Go}></uc-file-action-button><button type="button" class="uc-upload-btn uc-mini-btn" @click=${this.Qu}><uc-icon name="upload"></uc-icon></button></div></div>`}};h([g()],q.prototype,"va",2),h([b({attribute:false})],q.prototype,"uid",2),h([g()],q.prototype,"zo",2),h([g()],q.prototype,"Ho",2),h([g()],q.prototype,"Ko",2),h([g()],q.prototype,"At",2),h([g()],q.prototype,"ya",2),h([g()],q.prototype,"jo",2),h([g()],q.prototype,"Go",2),h([g()],q.prototype,"qo",2),h([g()],q.prototype,"ba",2),h([g()],q.prototype,"wa",2),h([g()],q.prototype,"Wo",2),h([g()],q.prototype,"xa",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.ka=true;this.Zo="drop-files-here";this.Ue=false;this.Oa=null;this.Yo=null;this.Ia=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.Pa=true;this.De=false;}static{n(this,"DropArea");}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}Ma(){let t=this.text;if(typeof t=="string"&&t.length>0){this.Zo=t;return}this.Zo=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.Xo(),this.Qo(),this.La(),this.Ra(ut.INACTIVE),this.Oa=Fs({element:this,shouldIgnore:n(()=>this.Ua(),"shouldIgnore"),onChange:n(t=>{this.Ra(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.rd()),this.subConfigValue("sourceList",t=>{let e=Y(t);this.Pa=e.includes($.LOCAL),this.Xo(),this.Qo();}),this.subConfigValue("multiple",t=>{this.Ue=!!t,this.Ma();});}willUpdate(t){super.willUpdate(t),t.has("disabled")&&(this.Xo(),this.Qo()),(t.has("text")||t.has("localeId"))&&this.Ma();}updated(t){super.updated(t),t.has("clickable")&&this.La();}Ua(){if(!this.Bt||!this.od())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}od(){let t=this.cfg.multiple,e=this.cfg.multipleMax,r=this.uploadCollection.size;return !(t&&e&&r>=e||!t&&r>0)}Xo(){let t=this.Pa&&!this.disabled;this.Bt=t;}Qo(){let t=this.Bt||!this.querySelector("[data-default-slot]");this.ka=t,this.hidden=!t;}Ra(t){let e=Object.entries(ut).find(([,r])=>r===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}rd(){if(this.Yo)return;let t=this.Ia.value;t&&(this.Yo=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.Ua(),"shouldIgnore")}));}La(){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.Oa?.(),this.Yo?.(),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.Ia)} class="uc-content-wrapper" ?hidden=${!this.ka} ><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.Zo)}</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,"ka",2);var Pt=class extends I{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=D.activities.UPLOAD_LIST;this.$a=false;this.Da=false;this.Fa=false;this.Jo=false;this.ts=false;this.vr=null;this.Na=false;this.es=null;this.Va=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this.rs=()=>{this.emit(k.UPLOAD_CLICK),this.api.uploadAll(),this.q();};this.os=()=>{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.ad(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}static{n(this,"UploadList");}get sd(){return this.es?this.nd(this.es):""}ad(){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.$a=p,this.Da=d,this.Fa=u,this.ts=e.total===0||!s&&!a,this.Jo=!a||this.cfg.multiple,this.Na=e.total>0,this.es=e;}nd(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.sd}</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.Na}>${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.Va} ?disabled=${!this.ts} ?hidden=${!this.Jo} ><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.Jo} ?disabled=${!this.ts} @click=${this.Va} ><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.Fa} @click=${this.rs} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.$a} ?disabled=${!this.Da} @click=${this.os} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};h([g()],Pt.prototype,"$a",2),h([g()],Pt.prototype,"Da",2),h([g()],Pt.prototype,"Fa",2),h([g()],Pt.prototype,"Jo",2),h([g()],Pt.prototype,"ts",2),h([g()],Pt.prototype,"vr",2),h([g()],Pt.prototype,"Na",2),h([g()],Pt.prototype,"es",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","menu","toolbar","compact"].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.ld=new Map;this.fi={};this._a=new Set;this.Fe=new Map;}static{n(this,"Config");}ss(t){return this._a.has(t)}ns(t){let e=this.e.pluginManager;if(e)return e.configRegistry.get(t)}as(t){return [...new Set([br(t),t.toLowerCase()])]}cd(t,e){if(ul(t)||this.ss(t)&&this.ns(t)?.attribute===false)return;let r=this.as(t);for(let s of r)typeof e>"u"||e===null?this.removeAttribute(s):this.getAttribute(s)!==e.toString()&&this.setAttribute(s,e.toString());}ud(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.ss(t)){let l=this.ns(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.dd(t,s[a],r),s[a]=r,this.cd(t,r),this.ud(t,r),this.debugPrint(`"${t}"`,r),this.ss(t)||Wa(this.cfg));}br(t){let e=this,r=cl(t);return e[r]??this.$[S(t)]}dd(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));}Ba(t){let e=t.configRegistry.getAll();this.fi={},this._a=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.as(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.as(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);}}pd(){this.e.when("pluginManager",t=>{this.Ba(t),this.yr=t.onPluginsChange(()=>{this.Ba(t);});});}hd(){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.ns(c);this.attributeChangedCallback(r,s??"",a??u?.defaultValue??"");}}}),this.hi.observe(this,{attributes:true,attributeOldValue:true});}initCallback(){super.initCallback();let t=this;this.pd(),this.hd();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.ld});},"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.ls=()=>{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.ls}><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.fd();return t||this.md()}fd(){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})}md(){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})}ls(){if(this.hasEntries){this.e.ctx.pub("*currentActivity","upload-list"),this.e.modalManager?.open("upload-list");return}this.source?.onClick();}gd(){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.ls} aria-label=${this.textBasedOnLocale}>${this.gd()}<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.za=ot.generateFastUid();this.vd=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.za} popovertargetaction="toggle">${this.yield("dd-header-button")}</button><div id=${this.za} class="uc-dropdown-content" popover="auto" @click=${this.vd}>${this.yield("dd-content")}</div>`}};h([g()],co.prototype,"za",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==="compact"||o.length===0?{main:null,remain:o}:{main:o[0]??null,remain:o.slice(1)},"adjustSourceBasedOnMode"),Ad={compact:"paperclip",menu:"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.Ka=0;this.q=he(()=>{this.isConnected&&this.yd();},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==="compact"}get shouldShowPrimaryAction(){return !this.isCollapsedMode||!this.isIdle||this.hasCollectionEntries}get shouldShowInline(){return this.isIdle&&!this.hasCollectionEntries&&this.z.length>1&&(this.le==="toolbar"||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}yd(){let t=this.api?.getOutputCollectionState();if(!t){console.warn("Collection state is undefined");return}this.xr=t,this.Ne=t.status;}ja(){this.wr=Sd(this.z,this.le);}initCallback(){super.initCallback(),this.subConfigValue("smartButtonViewMode",t=>{this.le!==t&&(this.le=t,this.ja());}),this.sub("*commonProgress",t=>{this.Ka=t;}),new Je(this,{ctx:this.e.ctx,sharedInstancesBag:this.e,onSourcesChange:n(t=>{this.z=t,this.ja();},"onSourcesChange")}),this.uploadCollection.observeProperties(this.q),this.uploadCollection.observeCollection(this.q),this.Ha=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.Ha?.(),super.disconnectedCallback();}bd(){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>`}wd(){return Ad[this.le]??"arrow-dropdown"}xd(){this.uploadCollection.clearAll();}Ed(){this.xr.failedEntries.forEach(t=>{t&&this.uploadCollection.hasItem(t.internalId)&&this.uploadCollection.remove(t.internalId);});}Cd(){this.uploadCollection.abortAll();}pi(){switch(this.Ne){case "failed":this.Ed();break;case "uploading":this.Cd();break;default:this.xd();}}Td(){return y`<uc-drop-down><uc-icon content-for="dd-header-button" name=${this.wd()} ></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>`}Sd(){return y`<uc-primary-action .entries=${this.xr} .source=${this.wr?.main} ></uc-primary-action>`}Ad(){return y`<uc-file-action-button @uc:remove=${this.pi} .uploading=${this.isUploading} .failed=${this.isFailed} .success=${this.isSuccess} .idle=${this.isIdle} .progress=${this.Ka} ></uc-file-action-button>`}kd(){return ct({"uc-smart-btn-inner":true,"uc-failed":this.isFailed,"uc-uploading":this.isUploading,"uc-success":this.isSuccess})}Md(){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.kd()}>${ri(this.shouldShowPrimaryAction?this.Sd():null)} ${ri(this.shouldShowInline?this.bd():null)} ${ri(this.shouldShowDropdown?this.Td():null)} ${ri(this.shouldShowAbortAction||this.hasCollectionEntries?this.Ad():null)} ${ri(this.Md())}</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,"Ka",2);var Di=class extends D{constructor(){super(...arguments);this.us=O();}static{n(this,"PluginActivityHost");}initCallback(){this.activityType=this.registration?.id??null,this.Ga(),super.initCallback();}willUpdate(t){super.willUpdate(t),t.has("registration")&&(this.Ga(),this.isActivityActive&&(this.Er(),this.qa()));}Ga(){this.registration&&(this.Gn()||this.registerActivity(this.activityType??"",{onActivate:n(()=>this.qa(),"onActivate"),onDeactivate:n(()=>this.Er(),"onDeactivate")}));}async qa(){await this.updateComplete;let t=this.us.value;if(!t||!this.registration)return;this.Er();let e=this.$["*currentActivityParams"];try{this.cs=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.us.value;if(t){try{this.cs?.();}catch(e){console.error(`[Plugin "${this.registration?.pluginId}"] Activity dispose threw an error`,e);}this.cs=void 0,t.replaceChildren();}}disconnectedCallback(){this.Er(),super.disconnectedCallback();}render(){return y`<div style="display: contents;" ${L(this.us)}></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.Wa())),this.Wa();}Wa(){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.Za=Le;this.Ya=Le.visible;this.Xa=Le.hidden;this.ds=false;this.Qa=false;}static{n(this,"PresenceToggle");}set visible(t){this.kt=t,this.Ja();}get visible(){return this.kt}set styles(t){this.Za=t,this.ds=true,this.Ya=t.visible??Le.visible,this.Xa=t.hidden??Le.hidden;}get styles(){return this.Za}Ja(){this.style.visibility=this.kt?"inherit":"hidden",hl(this,{[Le.transition]:!this.ds,[this.Ya]:this.kt,[this.Xa]:!this.kt}),this.toggleAttribute("inert",!this.kt);}Od(){this.Qa||(this.Qa=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.ds||this.classList.add(Le.transition),this.Ja(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.Od();},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.ps=false;this.hs=()=>{let t=this.ce.value;t&&(this.tl(t),this.ps&&this.active&&this.fs());};}static{n(this,"LineLoaderUi");}firstUpdated(t){super.firstUpdated(t),this.active&&this.fs();}updated(t){super.updated(t),t.has("active")&&(this.active?this.fs():this.Id());}fs(){let t=this.ce.value;if(!t)return;this.ps=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.hs),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.hs,{once:true});}Id(){let t=this.ce.value;t&&(this.ps=false,t.removeEventListener("transitionend",this.hs),this.tl(t));}tl(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.il(),this.rl();}updated(t){super.updated(t),t.has("reverse")&&this.il(),t.has("theme")&&this.rl();}il(){this.style.flexDirection=this.reverse?"row-reverse":"";}rl(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get Pd(){let t=this.ms;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.Ld}}get ms(){return !this.icon}get Ld(){return !this.text&&!this.ms}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.Pd)} name=${W(this.icon||void 0)} ?hidden=${this.ms} ></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.ol=`uc-backdrop-mask-${ot.generateFastUid()}`;this.Tr=false;this.wi=false;this.al=O();this.xi=false;this.Ei=null;this.cl=t=>{this.ul(),this.Ci&&(t.stopPropagation(),t.preventDefault(),this.Ci=false);};this.dl=t=>{if(!this.Ci||!this.Cr||!this.vs)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.vs,d=this.Bd(p,[c,u]);d&&(this.$["*cropBox"]=d);};this.pl=t=>{if(!this.$t)return;let e=Object.values(this.$t).find(r=>{if(!r||this.bs(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.sl=e,this.ul();};}static{n(this,"CropFrame");}get Gt(){return this.al.value??null}get Ci(){return this.wi}set Ci(t){this.wi!==t&&(this.wi=t,this.ys());}ys(){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}));}bs(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}Rd(){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.ol}),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.ol})`});l.appendChild(d),l.appendChild(c),this.vi=c,this.gs=p;}Ud(){this.vi&&(this.vi.style.display="none",window.requestAnimationFrame(()=>{this.vi&&(this.vi.style.display="block");}));}$d(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:a}=t;this.gs&&le(this.gs,{x:e,y:r,width:s,height:a});}Dd(){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.bs(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});}}ll(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.Fd.bind(this,e));}Nd(){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.ll(t,s);}return this.ll(t,""),t}Vd(){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}_d(){let t=this.Gt;if(!t)return;let e=document.createDocumentFragment(),r=this.Vd();e.appendChild(r);let s=this.Nd();for(let{groupNode:a}of Object.values(s))e.appendChild(a);t.appendChild(e),this.$t=s,this.yi=r,this.ys();}Fd(t,e){if(!this.$t)return;let r=this.$t[t];if(!r||this.bs(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.vs=r,this.Cr=[u,p],this.nl={...s};}Bd(t,e){let[r,s]=e,a=this.$["*imageBox"],l=this.nl??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)}ul(){let t=this.sl,e=this.Gt;e&&(e.style.cursor=t?Sa(t.direction):"initial");}hl(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;}zd(){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});}xs(){this.xi&&(this.$d(),this.Dd(),this.zd());}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.Ud(),this.xi&&window.requestAnimationFrame(()=>{this.xs();});}),this.sub("*cropBox",t=>{t&&(this.Tr=t.height<=M||t.width<=M,this.ys(),this.xi&&window.requestAnimationFrame(()=>{this.xs();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.hl(t);}),document.addEventListener("pointermove",this.dl,true),document.addEventListener("pointerup",this.cl,true);}firstUpdated(t){super.firstUpdated(t),this.Hd();}Hd(){let t=this.Gt;if(!(!t||this.xi)){if(this.Rd(),this._d(),this.xi=true,t.addEventListener("pointermove",this.pl,true),this.Ei){let e=this.Ei;this.Ei=null,this.hl(e);}this.xs();}}disconnectedCallback(){super.disconnectedCallback(),this.Gt?.removeEventListener("pointermove",this.pl,true),document.removeEventListener("pointermove",this.dl,true),document.removeEventListener("pointerup",this.cl,true);}render(){return y`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${L(this.al)}></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.ml=O();this.Cs=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.fl=V(this.gl.bind(this),300),this.Es=he(()=>{!this.isConnected||!this._||(this.Ts(),this.vl(),this.yl(),this.Ss(),this.As());},100);}static{n(this,"EditorImageCropper");}firstUpdated(t){super.firstUpdated(t),this.Ts();}vl(){let t=this.$["*editorTransformations"],e=vl(t,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...e};this.$["*operations"]=r;}Ts(){let t=this.ml.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;}yl(){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);}Ss(){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);}Kd(){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();}As(){if(!this._||!this.vt||!this.Mt||!this.i)return;let t=this.Mt;this.i.clearRect(0,0,t.width,t.height),this.Kd();}jd({fromViewer:t}){this.vt&&(this.Cs.value?.toggleThumbs(true),this.Gd(),setTimeout(()=>{this.className=Et({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}bl(){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)]}qd(){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.bl(),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}gl(){if(!this.isConnected||!this.ue)return;let t=this.$["*operations"],{rotate:e,mirror:r,flip:s}=t,a=this.qd(),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.yl(),this.Ss(),this.As());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this._){this._=true,await this.updateComplete,this.Ts(),this.ue=t,this.removeEventListener("transitionend",this.wl);try{let r=this.$["*originalUrl"],s=this.$["*editorTransformations"];this.vt=await this.Wd(r,s),this.vl(),this.Es(),this.jd({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.Es();}),this.s.observe(this);}}deactivate({reset:t=false}={}){this._&&(!t&&this.gl(),this._=false,this.Zd(),this.className=Et({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.Cs.value?.toggleThumbs(false),this.addEventListener("transitionend",this.wl,{once:true}),this.s?.disconnect());}Zd(){let t=this.bl(),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`;}Gd(){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`;}wl(){this._||(this.vt=null);}async Wd(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.As();}),this.sub("*cropBox",()=>{this.vt&&this.fl();}),this.sub("*currentAspectRatio",()=>{this.Ss();}),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.ml)}></canvas><uc-crop-frame ${L(this.Cs)}></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.ks=true;this.n="initial";this.xl={};this.qt=[];this.El=0;this.Tl=O();this.Sr=O();this.classList.add("uc-inactive_to_cropper"),this.Cl=V(async(t,e,r)=>{let s=n(()=>!this.Sl(t,e)||this.Re!==r||!!this.qt.find(u=>u.value===r),"shouldSkip");if(s())return;let a=await this.Al(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.Is(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);}}kl(){window.cancelAnimationFrame(this.El),this.El=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.xl};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 Al(t,e){return {src:await this.de({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}Sl(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.Is(this.n,e),this.Cl(this.n,this.m,e));}Is(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.kl();}Ml(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async Yd(){this.a=this.a||this.Ml();let t=this.a;t&&this.Ol(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.Ms=()=>{a(),this.Ms=void 0;};let l=this.n,c=this.m;if(await s,this._&&this.Sl(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.kl();}}async setTransformations(t){if(this.xl=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.Os?.();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.Os=c;}Xd(t){let e=this.a||this.Ml();if(this.Ol(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.ks=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.Xd(c),this.Ps();return}!e||typeof r!="number"||(this.qt=await Promise.all(yl(e,r).map(c=>this.Al(e,c))),this.Is(e,r),this.Yd());}deactivate({hide:t=true}={}){this._=false,this.Ms?.(),this.Os?.(),t&&!this.ks?(this.ks=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.Ps();},{once:true})):this.Ps();}Ol(t){let e=this.Tl.value;e&&(e.contains(t)||e.appendChild(t));}Ps(){this.Sr.value?.replaceChildren();}render(){return y`<div class="uc-fader-preview-host" ${L(this.Tl)}></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.Ls=0;this.Ar=O();this.Pl=O();this.Ll=O();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.Wt=0;this.Jd=t=>{t.stopPropagation();let e=this.Rl(t);e!==null&&(this.Rs(e),this.Qd("slider-input",e));};this.tp=t=>{t.stopPropagation();let e=this.Rl(t);e!==null&&this.Rs(e);};this.Ul=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.$l=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}static{n(this,"SliderUi");}Qd(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.Ls=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.Dl(this.Wt),this.Us(),this.s=new ResizeObserver(()=>{this.Us(),this.kr(this.Wt);}),this.s.observe(this);let e=this.Ar.value;e?.addEventListener("focus",this.Ul),e?.addEventListener("blur",this.$l),window.setTimeout(()=>{this.kr(this.Wt);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.Wt&&this.Rs(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.Us(),this.kr(this.Wt)),t.has("zero")&&this.hasUpdated&&this.Fl(this.Wt);}kr(t){this.Fl(t);let e=this.max-this.min;if(e===0)return;let{width:r}=this.getBoundingClientRect(),l=100/e*(t-this.min)*(r-this.Ls)/100;window.requestAnimationFrame(()=>{let c=this.Pl.value;c&&(c.style.transform=`translateX(${l}px)`);});}Fl(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.Ls)/100;window.requestAnimationFrame(()=>{this.Si&&(this.Si.style.transform=`translateX(${l}px)`);});}Us(){let e=this.Ll.value;if(!e)return;let{width:r}=e.getBoundingClientRect(),s=Math.ceil(r/2),a=Math.ceil(s/15)-2;if(this.Il===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.Il=a;}disconnectedCallback(){super.disconnectedCallback();let t=this.Ar.value;t?.removeEventListener("focus",this.Ul),t?.removeEventListener("blur",this.$l),this.s?.disconnect(),this.s=void 0;}Rs(t){Number.isFinite(t)&&(this.Wt=t,this.hasUpdated&&(this.Dl(t),this.kr(t)));}Dl(t){let e=this.Ar.value;e&&(e.value=String(t));}Rl(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.Ll)}></div><div class="uc-thumb" ${L(this.Pl)}></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.Jd} @change=${this.tp} />`}};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.$s=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.ep();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});}ep(){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.$s} ></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}}Nl(){let t=this.buttonClasses;for(let[e,r]of Object.entries(t))this.classList.toggle(e,r);}onClick(t){}connectedCallback(){super.connectedCallback(),this.Nl();}updated(t){super.updated(t),t.has("active")&&this.Nl();}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.ip(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}ip(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.Vl(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.tt&&this.Vl(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);}Vl(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();}rp(){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.rp()}<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._l=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._l=this.isOriginal?40:20,this.requestUpdate("filter",r),this.isConnected&&this.Bl(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;}op(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this._l||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.Ds(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.Bl(this.m),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.m);}),this.sub("*networkProblems",async e=>{e||(this.a?await this.Ds():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()));}Bl(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async Ds(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.op());}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.Ds();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 sp(){return !!(this.ze&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.sp?"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,"_l",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.zl(e);}zl(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.zl(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.Hl=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.Hl,{passive:false}),this.addEventListener("scroll",wl,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.Hl),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.Kl=true;this.tabList=[...nt];this.activeTab=H.CROP;this.Ir=true;this.Fs=false;this.jl=null;this.Gl=0;this.ql=0;this.Pr=O();this.Wl=O();this.tabToggleRefs={[H.CROP]:O(),[H.TUNING]:O(),[H.FILTERS]:O()};this.Zl=()=>{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.Fs=s;},0);this.np={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.ap={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.lp={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.cp={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.Bs=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.wp=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:ai(this.$["*operationTooltip"])}),this.Pr.value?.apply(),this.Yl();};this.xp=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.Pr.value?.cancel(),this.Yl();};this.Ep=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&(this.telemetryManager.sendEventCloudImageEditor(t,r),this.Ns(r,{fromViewer:false}));};}static{n(this,"EditorToolbar");}Yl(){this.$["*showSlider"]=false,this.$["*tabId"]===H.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===H.TUNING&&(this.Fs=false);}Ns(t,{fromViewer:e=false,force:r=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.Xl(t,{fromViewer:e,force:r});}Xl(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.Wl.value;if(!e||!r)return;let s=e.offsetLeft,a=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.Gl!==s||this.ql!==a)&&(this.Gl=s,this.ql=a,r.style.transform=`translateX(${s}px)`,r.style.width=`${a}px`);}get Vs(){return this.Mi.length>=3}up(t){switch(t){case H.CROP:return this.dp();case H.FILTERS:return this.pp();case H.TUNING:return this.hp();default:return []}}dp(){let t=[];if(this.Vs)t.push(()=>this.fp());else for(let e of this.Mi)t.push(()=>this.Ql(e));for(let e of Pn)t.push(()=>this.mp(e));return this._s(t)}pp(){let e=[Bt,...Ln].map(r=>()=>this.gp(r));return this._s(e)}hp(){let t=On.map(e=>()=>this.vp(e));return this._s(t)}_s(t){return t.length?t.map(r=>r()):[]}fp(){return y`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}Ql(t){return y`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}mp(t){return y`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}gp(t){return y`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}vp(t){return y`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}yp(){return this.Vs?this.Mi.map(t=>this.Ql(t)):[]}async bp(){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.Ns(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.Xl(e,{fromViewer:false,force:true}),this.Rr();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.bp(),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.Kl=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[r]=e;r&&this.Ns(r,{fromViewer:false});return}this.he();}),this.sub("*operationTooltip",e=>{this.jl=e;}),this.Rr();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.Zl);}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.Zl),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}Ur(){let t=this.Pr.value;t&&(this.$["*sliderEl"]=t);}Cp(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.lp}><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.Ep} ${L(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Tp(t){let e=this.up(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.Fs?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.Vs;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.jl??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.np} ><div class="uc-tab-content-row">${nt.map(r=>Fi(this.activeTab===r,()=>this.Tp(r)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.Kl} .styles=${this.cp} @initial-render=${()=>this.he()} ><div class="uc-tab-toggles_indicator" ${L(this.Wl)} ></div>${nt.map(r=>this.Cp(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.Bs}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.ap}><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.yp()}</div>`:U}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.xp} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.wp} 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,"Kl",2),h([g()],gt.prototype,"tabList",2),h([g()],gt.prototype,"activeTab",2),h([g()],gt.prototype,"Ir",2),h([g()],gt.prototype,"Fs",2),h([g()],gt.prototype,"jl",2),h([g()],gt.prototype,"Mi",2);var El=jt([...nt]),it=class extends x{constructor(){super(...arguments);this.ctxOwner=true;this.Sp="";this.de=Lt;this.Ap="";this.ki=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=El;this.Jl=false;this._t=false;this.zs=null;this.Oi=null;this.Lr=V(t=>{this.ki=t;},300);this.$r=O();this.tc=O();this.ec=O();this.ic=O();this.rc=()=>{this.Lr(false),this.de!==Lt&&(this.$["*networkProblems"]=false);};this.oc=()=>{this.Lr(false),this.$["*networkProblems"]=true;};this.kp=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...fl(this)};}static{n(this,"CloudImageEditorBlock");}static{this.styleAttrs=["uc-cloud-image-editor"];}Mp(){this._t||this.zs||(this.zs=this.updateComplete.then(()=>{this.zs=null,this._t=true;}));}initCallback(){super.initCallback(),this.sc(),this.nc();}Ur(){let t=this.ec.value;t&&(this.$["*faderEl"]=t);let e=this.tc.value;e&&(this.$["*cropperEl"]=e);let r=this.ic.value;r&&(this.$["*imgContainerEl"]=r);let s=this.$r.value;s&&(this.$["*imgEl"]=s);}Op(){let t=this.$r.value;t&&(t.addEventListener("load",this.rc),t.addEventListener("error",this.oc));}Ip(){let t=this.$r.value;t&&(t.removeEventListener("load",this.rc),t.removeEventListener("error",this.oc));}get Pp(){let t=this.$["*tabId"];return Et("uc-image",{"uc-image_hidden_to_cropper":t===H.CROP,"uc-image_hidden_effects":t!==H.CROP})}ac(){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.Op(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),r=t.has("uuid")||t.has("cdnUrl");e&&!r&&this.updateImage();}disconnectedCallback(){this.Ip(),super.disconnectedCallback();}render(){let t=this.Ap??"",e=this.Sp??"",r=this.de||Lt,s=this.ki,a=this.Jl;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.kp}></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.ic)}><img src=${r} class=${this.Pp} ${L(this.$r)} />${Fi(this._t,()=>y`<uc-editor-image-cropper ${L(this.tc)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${L(this.ec)}></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.sc(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.nc();}sc(){let t=this.tabs||El;this.$["*tabList"]=ml(t);}nc(){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.ac();}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.Mp();}}}async initEditor(){try{await this.ac();}catch{return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.Jl=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,"Sp",2),h([g()],it.prototype,"de",2),h([g()],it.prototype,"Ap",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,"Jl",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.Lp();}disconnectedCallback(){super.disconnectedCallback(),this.Rp();}Bs(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);}Lp(){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.Up(r);}Rp(){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.Bs} @cancel=${this.Ut} @change=${this.handleChange} ></uc-cloud-image-editor>`}Up(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.$s=t=>{this._e=t.target?.value??"";};this.rs=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.rs}><label><input placeholder="https://" class="uc-url-input" type="text" autofocus @input=${this.$s} /></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.uc=i=>{if(i.source!==this.Hs)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.Hs=i,this.cc=t,window.addEventListener("message",this.uc);}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.cc();this.Hs.postMessage(i,t);}destroy(){window.removeEventListener("message",this.uc);}};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.Ks=[];this.js=false;this.Gs=false;this.qs=false;this.Ws=false;this.Nr=false;this.Zs=false;this.Ys="uc-hidden";this.dc=true;this.os=()=>{for(let t of this.Ks){let e=this.Dp(t),{filename:r}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:r,source:s});}this.routerLayer.navigateAfterFileAdd();};this.Ut=()=>{this.historyBack();};this.zp=()=>{this.yt?.send({type:"select-all"});};this.Hp=()=>{this.yt?.send({type:"deselect-all"});};}static{n(this,"ExternalSource");}get $p(){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.pc():console.error('Param "externalSourceType" is required for external source activity'),this.sub("*currentActivityParams",()=>{setTimeout(()=>{this.isConnected&&(this.hc(),this.pc());});}),this.subConfigValue("multiple",e=>{this.Nr=e;}),this.subConfigValue("localeName",()=>{this.fc();}),this.subConfigValue("externalSourcesEmbedCss",e=>{this.mc(e);});}Dp(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}Fp(t){this.dc=t.isVisible;}async Np(t){if(this.cfg.multiple!==t.isMultipleMode){console.error("Multiple mode mismatch");return}this.Vp(t.selectedCount,t.total),this.Ys=t.isReady?"":"uc-hidden",this.js=t.isReady,this.Gs=t.isReady&&t.selectedFiles.length>0,this.Nr=t.isMultipleMode&&t.total>0,this.qs=t.selectedCount<t.total,this.Ws=t.selectedCount===t.total,this.Ks=t.selectedFiles??[],this.Zs=t.total>0;}gc(){this.mc(this.cfg.externalSourcesEmbedCss),this._p(),this.fc();}_p(){this.yt?.send({type:"set-theme-definition",theme:xl(this)});}mc(t){this.yt?.send({type:"set-embed-css",css:t});}fc(){this.yt?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}Bp(){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()}Vp(t,e){this.Fr={selectedCount:t,total:e};}pc(){let t=document.createElement("iframe");t.src=this.Bp(),t.marginHeight=0,t.marginWidth=0,t.frameBorder="0",t.allowTransparency=true,t.addEventListener("load",this.gc.bind(this)),t.addEventListener("load",this.gc.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.Np.bind(this)),this.yt.on("toolbar-state-change",this.Fp.bind(this)),this.vc());}hc(){this.yt?.destroy(),this.yt=void 0,this.He.value&&(this.He.value.innerHTML=""),this.vc();}vc(){this.Ks=[],this.js=false,this.Gs=false,this.qs=false,this.Ws=false,this.Nr=false,this.Zs=false,this.Ys="uc-hidden",this.Fr=null;}disconnectedCallback(){super.disconnectedCallback(),this.hc();}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.dc}><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.$p}</span><button type="button" @click=${this.zp} ?hidden=${!this.qs} >${this.l10n("select-all")}</button><button type="button" @click=${this.Hp} ?hidden=${!this.Ws} >${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.os} ?disabled=${!this.Gs} ?hidden=${!this.Zs} ><uc-spinner ?hidden=${this.js}></uc-spinner><span class=${this.Ys}>${this.l10n("done")}</span></button></div></div>`}};h([g()],vt.prototype,"Ks",2),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,"Nr",2),h([g()],vt.prototype,"Zs",2),h([g()],vt.prototype,"Ys",2),h([g()],vt.prototype,"dc",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.Xs=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.Kp={};this.zr=[];this.Hr=null;this.yc=()=>{this.bc(),this.Ri="pause";};this.wc=()=>{this.Ri="play",this.jp();};this.Ui=O();this.ce=O();this.W=O();this.xc=0;this.Ec=0;this.Cc=null;this.Kr=true;this.jr=true;this.Gp=Al();this.Tc=[];this.fe=true;this.Qs="";this.Ge=true;this.me=true;this.qe=true;this.Sc=[];this.ge=true;this.Js=true;this.ve=true;this.Dt=true;this.ye=true;this.We="camera-full";this.Ri="play";this.Ac="microphone";this.Gr="uc-shot-btn uc-camera-action";this.qp=()=>{if(this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.g}}}),this.g===P.PHOTO&&this.Wp(),this.g===P.VIDEO){if(this.Ot?.state==="recording"){this.kc();return}this.Zp();}};this.Yp=t=>{let e=t.target;e&&(this.Br=e.value,this.Ze());};this.Xp=t=>{let e=t.target;e&&(this._r=e.value,this.Ze());};this.Qp=()=>{this.Ze();};this.Jp=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.g}}}),this.qp();};this.th=()=>{this.eh();};this.ih=()=>{this.rh();};this.oh=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.g}}}),this.sh();};this.nh=()=>{this.telemetryManager.sendEvent({eventType:F.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.g}}}),this.ah();};this.Mc=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&this.Oc(r);};this.Ic=()=>{let t=Math.floor((performance.now()-this.xc+this.Ec)/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.kc();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.Ic);};this.lh=()=>{this.xc=performance.now(),this.Ec=0,this.Ic();};this.Pc=()=>{this.Ye&&cancelAnimationFrame(this.Ye);};this.bc=()=>{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.bc);};this.jp=()=>{this.Ye&&cancelAnimationFrame(this.Ye);};this.Ye=null;this.Zp=()=>{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.lh(),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.kc=()=>{this.Ot?.addEventListener("stop",()=>{this.ch(),this.Pc(),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.eh=()=>{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.rh=()=>{this.It?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.Ac=t.enabled?"microphone":"microphone-mute",this.Js=!t.enabled;});};this.ch=()=>{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.uh(r);}catch(t){console.error("Failed to preview video",t),this.telemetryManager.sendEventError(t,"camera previewing. Failed to preview video");}};this.sh=()=>{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.ah=()=>{if(this.$i(At.ACCEPT),this.g===P.PHOTO){this.Mt?.toBlob(s=>{if(!s)return;let a=this.Lc("camera","jpeg",kl,s);this.Rc(a);},kl);return}let t=new Blob(this.Pi,{type:this.Ot?.mimeType}),e=this.dh(this.Ot?.mimeType),r=this.Lc("video",e,`video/${e}`,t);this.Rc(r),this.Pi=[];};this.ph=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.hh=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.ph(t),this.g===P.VIDEO&&(t==="play"||t==="stop"||t==="retake"||t==="accept"||t==="pause"||t==="resume")&&this.hh(t);};this.Oc=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.Lc=(t,e,r,s)=>{let a=Date.now(),l=`${t}-${a}.${e}`;return new File([s],l,{lastModified:a,type:r})};this.Rc=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.Qs="camera-permissions-prompt",this.Kr=true,this.me=true,this.Dt=true,this.jr=false,this.rn()):(this.Qs="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.rn());},300);this.fh=()=>{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.rn=()=>{this.Xs&&(this.W.value&&(this.W.value.volume=0),this.Hr?.getTracks?.()?.[0]?.stop(),this.tn(this.W.value),this.Di(null),this.fh(),this.Pc(),this.Xs=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.Xs=!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.Uc=()=>{this.Ze();};this.mh=async()=>{try{this.qr();for(let t of qd){let e=await navigator.permissions.query({name:t});this.Kp[t]=e,e.addEventListener("change",this.Uc),this.zr.push(()=>{e.removeEventListener("change",this.Uc);});}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.gh=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this.sn(),navigator.mediaDevices.addEventListener("devicechange",this.sn);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.sn=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.Tc=this.Ke,this.fe=this.Ke.length<=1,this.Br=this.Ke[0]?.value??null,this.Sc=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.vh=async()=>{await this.mh(),await this.gh(),await this.Ze(),this.$c(this.Ft);};this.yh=async()=>{this.Vr&&this.Vr(),window.chrome||this.Fi("denied"),this.rn();};this.$c=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.Oc(e);};}static{n(this,"CameraSource");}uh(t){this.tn(t),t.addEventListener("play",this.yc),t.addEventListener("pause",this.wc);}tn(t){t?.removeEventListener("play",this.yc),t?.removeEventListener("pause",this.wc);}Di(t){this.Hr!==t&&(this.Hr=t,this.en());}en(){let t=this.W.value;if(!t)return;let e=this.Hr??null;t.srcObject!==e&&(t.srcObject=e);}Wp(){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();}dh(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.Cc=t?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",t=>{this.ve=!t,this.Js=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isConnected)return;let e=G(t);this.$c(e.filter(r=>r===P.PHOTO||r===P.VIDEO));}),this.vh();}firstUpdated(t){super.firstUpdated(t),this.en();}updated(t){super.updated(t),this.en();}bh(){this.qr(),navigator.mediaDevices?.removeEventListener("devicechange",this.sn),this.tn(this.W.value),this.Di(null);}disconnectedCallback(){super.disconnectedCallback(),this.yh(),this.bh();}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.Tc} ?hidden=${this.fe} @change=${this.Yp} ></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.Cc})} ?hidden=${this.Kr} ${L(this.W)} ></video><div class="uc-message-box" ?hidden=${this.jr}><span>${this.l10n(this.Qs)}</span><button type="button" @click=${this.Qp} ?hidden=${this.Gp} >${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.Mc} ?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.Mc} ?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.th} ?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.oh} >${this.l10n("retake")}</button><button type="button" class="uc-primary-btn" @click=${this.nh} data-testid="accept" >${this.l10n("accept")}</button></div><button type="button" data-testid="shot" @click=${this.Jp} 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.ih} ?hidden=${this.ve} data-testid="toggle-microphone" ><uc-icon name=${this.Ac}></uc-icon></button><uc-select class="uc-audio-select" .options=${this.Sc} ?hidden=${this.ge} ?disabled=${this.Js} @change=${this.Xp} data-testid="audio-select" ></uc-select></div></div>`}};h([g()],z.prototype,"Cc",2),h([g()],z.prototype,"Kr",2),h([g()],z.prototype,"jr",2),h([g()],z.prototype,"Gp",2),h([g()],z.prototype,"Tc",2),h([g()],z.prototype,"fe",2),h([g()],z.prototype,"Qs",2),h([g()],z.prototype,"Ge",2),h([g()],z.prototype,"me",2),h([g()],z.prototype,"qe",2),h([g()],z.prototype,"Sc",2),h([g()],z.prototype,"ge",2),h([g()],z.prototype,"Js",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,"Ac",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}wh(){return y`<uc-smart-btn></uc-smart-btn>`}xh(){return y`<uc-simple-btn></uc-simple-btn>`}Eh(){return this.headless?null:this.smartButton?this.wh():this.xh()}render(){return y` ${super.render()} ${this.Eh()}<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.Dc=false;this.Ut=()=>{if(this.Fc){let t=this.$["*historyBack"];t?.();return}this.Nc&&(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 Fc(){let t=this.$["*history"];return !t||t.length<=1?false:t[t.length-1]!==D.activities.START_FROM}get Nc(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}nn(){return this.getCssData("--cfg-init-activity")||D.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});let t=this.nn();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.Dc=this.Fc||this.Nc;});}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.Dc} >${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,"Dc",2);var Ys="active",Eo="",fe=class extends Xt{constructor(){super();this.an=false;this.Wr=false;this.Zr=Eo;this.ln=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.ln=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"];}nn(){return this.getCssData("--cfg-init-activity")||D.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:F.INIT_SOLUTION});let t=this.nn();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.ln=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.an=!r):(this.style.removeProperty("--uc-grid-col"),this.an=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.ln}><uc-drop-area ?single=${this.an} 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,"an",2),h([g()],fe.prototype,"Wr",2),h([g()],fe.prototype,"Zr",2),h([g()],fe.prototype,"ln",2),h([g()],fe.prototype,"mi",2);/*! For license information please see file-uploader.iife.min.js.LEGAL.txt */
|
|
8
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;})({});
|