@uploadcare/file-uploader 1.31.1 → 1.32.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/dist/abstract/loadFileUploaderFrom.js +2 -2
  2. package/dist/env.js +3 -3
  3. package/dist/index.css +2 -2
  4. package/dist/index.d.ts +24 -1
  5. package/dist/index.js +4 -4
  6. package/dist/index.layered.css +2 -2
  7. package/dist/index.ssr.js +1 -1
  8. package/dist/locales/file-uploader/ar.js +2 -2
  9. package/dist/locales/file-uploader/az.js +2 -2
  10. package/dist/locales/file-uploader/ca.js +2 -2
  11. package/dist/locales/file-uploader/cs.js +2 -2
  12. package/dist/locales/file-uploader/da.js +2 -2
  13. package/dist/locales/file-uploader/de.js +2 -2
  14. package/dist/locales/file-uploader/el.js +2 -2
  15. package/dist/locales/file-uploader/en.js +2 -2
  16. package/dist/locales/file-uploader/es.js +2 -2
  17. package/dist/locales/file-uploader/et.js +2 -2
  18. package/dist/locales/file-uploader/fi.js +2 -2
  19. package/dist/locales/file-uploader/fr.js +2 -2
  20. package/dist/locales/file-uploader/he.js +2 -2
  21. package/dist/locales/file-uploader/hy.js +2 -2
  22. package/dist/locales/file-uploader/is.js +2 -2
  23. package/dist/locales/file-uploader/it.js +2 -2
  24. package/dist/locales/file-uploader/ja.js +2 -2
  25. package/dist/locales/file-uploader/ka.js +2 -2
  26. package/dist/locales/file-uploader/kk.js +2 -2
  27. package/dist/locales/file-uploader/ko.js +2 -2
  28. package/dist/locales/file-uploader/lv.js +2 -2
  29. package/dist/locales/file-uploader/nb.js +2 -2
  30. package/dist/locales/file-uploader/nl.js +2 -2
  31. package/dist/locales/file-uploader/pl.js +2 -2
  32. package/dist/locales/file-uploader/pt.js +2 -2
  33. package/dist/locales/file-uploader/ro.js +2 -2
  34. package/dist/locales/file-uploader/ru.js +2 -2
  35. package/dist/locales/file-uploader/sk.js +2 -2
  36. package/dist/locales/file-uploader/sr.js +2 -2
  37. package/dist/locales/file-uploader/sv.js +2 -2
  38. package/dist/locales/file-uploader/tr.js +2 -2
  39. package/dist/locales/file-uploader/uk.js +2 -2
  40. package/dist/locales/file-uploader/vi.js +2 -2
  41. package/dist/locales/file-uploader/zh-TW.js +2 -2
  42. package/dist/locales/file-uploader/zh.js +2 -2
  43. package/package.json +1 -1
  44. package/web/file-uploader.iife.min.d.ts +24 -1
  45. package/web/file-uploader.iife.min.js +4 -4
  46. package/web/file-uploader.min.d.ts +24 -1
  47. package/web/file-uploader.min.js +4 -4
  48. package/web/uc-basic.layered.min.css +2 -2
  49. package/web/uc-basic.min.css +2 -2
  50. package/web/uc-cloud-image-editor.layered.min.css +2 -2
  51. package/web/uc-cloud-image-editor.min.css +2 -2
  52. package/web/uc-cloud-image-editor.min.d.ts +24 -1
  53. package/web/uc-cloud-image-editor.min.js +3 -3
  54. package/web/uc-file-uploader-inline.layered.min.css +2 -2
  55. package/web/uc-file-uploader-inline.min.css +2 -2
  56. package/web/uc-file-uploader-inline.min.d.ts +24 -1
  57. package/web/uc-file-uploader-inline.min.js +4 -4
  58. package/web/uc-file-uploader-minimal.layered.min.css +2 -2
  59. package/web/uc-file-uploader-minimal.min.css +2 -2
  60. package/web/uc-file-uploader-minimal.min.d.ts +24 -1
  61. package/web/uc-file-uploader-minimal.min.js +4 -4
  62. package/web/uc-file-uploader-regular.layered.min.css +2 -2
  63. package/web/uc-file-uploader-regular.min.css +2 -2
  64. package/web/uc-file-uploader-regular.min.d.ts +24 -1
  65. package/web/uc-file-uploader-regular.min.js +4 -4
  66. package/web/uc-img.min.js +3 -3
@@ -1,8 +1,8 @@
1
1
  /**
2
2
  * @license
3
- * Package: @uploadcare/file-uploader@1.31.1 (MIT)
3
+ * Package: @uploadcare/file-uploader@1.32.0-alpha.0 (MIT)
4
4
  * License: https://github.com/uploadcare/blob/main/LICENSE
5
- * Built: 2026-06-08T19:52:46.503Z
5
+ * Built: 2026-06-16T18:23:34.086Z
6
6
  */
7
- var Ws=Object.defineProperty;var jl=Object.getOwnPropertyDescriptor;var Zs=(o,i)=>{for(var t in i)Ws(o,t,{get:i[t],enumerable:true});};var p=(o,i,t,e)=>{for(var r=e>1?void 0:e?jl(i,t):i,s=o.length-1,n;s>=0;s--)(n=o[s])&&(r=(e?n(i,t,r):n(r))||r);return e&&r&&Ws(i,t,r),r};var Mt=[],ee=0,Wi=4,Ys=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=ee+Wi;s<Mt.length;)Mt[s]===e?Mt.splice(s,Wi):s+=Wi;let r=i.indexOf(e);~r&&(i.splice(r,1),--t.lc||t.off());}},notify(e,r){let s=!Mt.length;for(let n of i)Mt.push(n,t.value,e,r);if(s){for(ee=0;ee<Mt.length;ee+=Wi)Mt[ee](Mt[ee+1],Mt[ee+2],Mt[ee+3]);Mt.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};function Zi(o,i,t){let e=new Set(i).add(void 0);return o.listen((r,s,n)=>{e.has(n)&&t(r,s,n);})}function To(o,i,t){let e=Zi(o,i,t);return t(o.value),e}var Co=(o={})=>{let i=Ys(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};var H=class o{static{this.Qe=new Map;}constructor(i,t){this.at=i,this.wt=t;}get id(){return this.at}pub(i,t){i in this.wt.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.wt.setKey(i,t);}sub(i,t,e=true){return (e?To:Zi)(this.wt,[i],s=>{t(s[i]);})}read(i){return i in this.wt.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.wt.get()[i]}add(i,t,e=false){(!(i in this.wt.get())||e)&&this.wt.setKey(i,t);}has(i){return i in this.wt.get()}get store(){return this.wt.get()}static registerCtx(i,t){if(o.Qe.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=Co(i);return o.Qe.set(t,e),new o(t,e)}static deleteCtx(i){o.Qe.delete(i);}static getCtx(i){let t=o.Qe.get(i);return t?new o(i,t):null}static hasCtx(i){return o.Qe.has(i)}};var Yi=globalThis,Qi=Yi.ShadowRoot&&(Yi.ShadyCSS===void 0||Yi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Qs=Symbol(),Xs=new WeakMap,Xi=class{constructor(i,t,e){if(this._c=true,e!==Qs)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(Qi&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=Xs.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&Xs.set(t,i));}return i}toString(){return this.cssText}},Js=o=>new Xi(typeof o=="string"?o:o+"",void 0,Qs);var tn=(o,i)=>{if(Qi)o.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),r=Yi.litNonce;r!==void 0&&e.setAttribute("nonce",r),e.textContent=t.cssText,o.appendChild(e);}},xo=Qi?o=>o:o=>o instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return Js(t)})(o):o;var{is:ql,defineProperty:Wl,getOwnPropertyDescriptor:Zl,getOwnPropertyNames:Yl,getOwnPropertySymbols:Xl,getPrototypeOf:Ql}=Object,Ji=globalThis,en=Ji.trustedTypes,Jl=en?en.emptyScript:"",tc=Ji.reactiveElementPolyfillSupport,ci=(o,i)=>o,ui={toAttribute(o,i){switch(i){case Boolean:o=o?Jl: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}},tr=(o,i)=>!ql(o,i),rn={attribute:true,type:String,converter:ui,reflect:false,useDefault:false,hasChanged:tr};Symbol.metadata??=Symbol("metadata"),Ji.litPropertyMetadata??=new WeakMap;var zt=class extends HTMLElement{static addInitializer(i){this.Xr(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.Ni&&[...this.Ni.keys()]}static createProperty(i,t=rn){if(t.state&&(t.attribute=false),this.Xr(),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&&Wl(this.prototype,i,r);}}static getPropertyDescriptor(i,t,e){let{get:r,set:s}=Zl(this.prototype,i)??{get(){return this[t]},set(n){this[t]=n;}};return {get:r,set(n){let a=r?.call(this);s?.call(this,n),this.requestUpdate(i,a,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??rn}static Xr(){if(this.hasOwnProperty(ci("elementProperties")))return;let i=Ql(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(ci("finalized")))return;if(this.finalized=true,this.Xr(),this.hasOwnProperty(ci("properties"))){let t=this.properties,e=[...Yl(t),...Xl(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.Qr(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(xo(r));}else i!==void 0&&t.push(xo(i));return t}static Qr(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.we=null,this.Bc();}Bc(){this.Jr=new Promise(i=>this.enableUpdating=i),this.Xt=new Map,this.zc(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this.Je??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.Je?.delete(i);}zc(){let i=new Map,t=this.constructor.elementProperties;for(let e of t.keys())this.hasOwnProperty(e)&&(i.set(e,this[e]),delete this[e]);i.size>0&&(this.Vi=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return tn(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.Je?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this.Je?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.to(i,e);}Hc(i,t){let e=this.constructor.elementProperties.get(i),r=this.constructor.Qr(i,e);if(r!==void 0&&e.reflect===true){let s=(e.converter?.toAttribute!==void 0?e.converter:ui).toAttribute(t,e.type);this.we=i,s==null?this.removeAttribute(r):this.setAttribute(r,s),this.we=null;}}to(i,t){let e=this.constructor,r=e.Ni.get(i);if(r!==void 0&&this.we!==r){let s=e.getPropertyOptions(r),n=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:ui;this.we=r;let a=n.fromAttribute(t,s.type);this[r]=a??this.eo?.get(r)??a,this.we=null;}}requestUpdate(i,t,e,r=false,s){if(i!==void 0){let n=this.constructor;if(r===false&&(s=this[i]),e??=n.getPropertyOptions(i),!((e.hasChanged??tr)(s,t)||e.useDefault&&e.reflect&&s===this.eo?.get(i)&&!this.hasAttribute(n.Qr(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.Jr=this.Kc());}C(i,t,{useDefault:e,reflect:r,wrapped:s},n){e&&!(this.eo??=new Map).has(i)&&(this.eo.set(i,n??t??this[i]),s!==true||n!==void 0)||(this.Xt.has(i)||(this.hasUpdated||e||(t=void 0),this.Xt.set(i,t)),r===true&&this.we!==i&&(this.dn??=new Set).add(i));}async Kc(){this.isUpdatePending=true;try{await this.Jr;}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:n}=s,a=this[r];n!==true||this.Xt.has(r)||a===void 0||this.C(r,void 0,s,a);}}let i=false,t=this.Xt;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.Je?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.io();}catch(e){throw i=false,this.io(),e}i&&this.jc(t);}willUpdate(i){}jc(i){this.Je?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}io(){this.Xt=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.Jr}shouldUpdate(i){return true}update(i){this.dn&&=this.dn.forEach(t=>this.Hc(t,this[t])),this.io();}updated(i){}firstUpdated(i){}};zt.elementStyles=[],zt.shadowRootOptions={mode:"open"},zt[ci("elementProperties")]=new Map,zt[ci("finalized")]=new Map,tc?.({ReactiveElement:zt}),(Ji.reactiveElementVersions??=[]).push("2.1.2");var Ao=globalThis,on=o=>o,er=Ao.trustedTypes,sn=er?er.createPolicy("lit-html",{createHTML:o=>o}):void 0,ko="$lit$",Ht=`lit$${Math.random().toFixed(9).slice(2)}$`,Mo="?"+Ht,ec=`<${Mo}>`,we=document,pi=()=>we.createComment(""),hi=o=>o===null||typeof o!="object"&&typeof o!="function",Io=Array.isArray,dn=o=>Io(o)||typeof o?.[Symbol.iterator]=="function",So=`[ \f\r]`,di=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,nn=/-->/g,an=/>/g,ye=RegExp(`>|${So}(?:([^\\s"'>=/]+)(${So}*=${So}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),ln=/'/g,cn=/"/g,pn=/^(?:script|style|textarea|title)$/i,Oo=o=>(i,...t)=>({Vt:o,strings:i,values:t}),v=Oo(1),it=Symbol.for("lit-noChange"),P=Symbol.for("lit-nothing"),un=new WeakMap,be=we.createTreeWalker(we,129);function hn(o,i){if(!Io(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return sn!==void 0?sn.createHTML(i):i}var mn=(o,i)=>{let t=o.length-1,e=[],r,s=i===2?"<svg>":i===3?"<math>":"",n=di;for(let a=0;a<t;a++){let l=o[a],c,d,u=-1,h=0;for(;h<l.length&&(n.lastIndex=h,d=n.exec(l),d!==null);)h=n.lastIndex,n===di?d[1]==="!--"?n=nn:d[1]!==void 0?n=an:d[2]!==void 0?(pn.test(d[2])&&(r=RegExp("</"+d[2],"g")),n=ye):d[3]!==void 0&&(n=ye):n===ye?d[0]===">"?(n=r??di,u=-1):d[1]===void 0?u=-2:(u=n.lastIndex-d[2].length,c=d[1],n=d[3]===void 0?ye:d[3]==='"'?cn:ln):n===cn||n===ln?n=ye:n===nn||n===an?n=di:(n=ye,r=void 0);let m=n===ye&&o[a+1].startsWith("/>")?" ":"";s+=n===di?l+ec:u>=0?(e.push(c),l.slice(0,u)+ko+l.slice(u)+Ht+m):l+Ht+(u===-2?a:m);}return [hn(o,s+(o[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},mi=class o{constructor({strings:i,Vt:t},e){let r;this.parts=[];let s=0,n=0,a=i.length-1,l=this.parts,[c,d]=mn(i,t);if(this.el=o.createElement(c,e),be.currentNode=this.el.content,t===2||t===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes);}for(;(r=be.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let u of r.getAttributeNames())if(u.endsWith(ko)){let h=d[n++],m=r.getAttribute(u).split(Ht),g=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:g[2],strings:m,ctor:g[1]==="."?rr:g[1]==="?"?or:g[1]==="@"?sr:Te}),r.removeAttribute(u);}else u.startsWith(Ht)&&(l.push({type:6,index:s}),r.removeAttribute(u));if(pn.test(r.tagName)){let u=r.textContent.split(Ht),h=u.length-1;if(h>0){r.textContent=er?er.emptyScript:"";for(let m=0;m<h;m++)r.append(u[m],pi()),be.nextNode(),l.push({type:2,index:++s});r.append(u[h],pi());}}}else if(r.nodeType===8)if(r.data===Mo)l.push({type:2,index:s});else {let u=-1;for(;(u=r.data.indexOf(Ht,u+1))!==-1;)l.push({type:7,index:s}),u+=Ht.length-1;}s++;}}static createElement(i,t){let e=we.createElement("template");return e.innerHTML=i,e}};function Ee(o,i,t=o,e){if(i===it)return i;let r=e!==void 0?t.Gc?.[e]:t.qc,s=hi(i)?void 0:i.ro;return r?.constructor!==s&&(r?.pn?.(false),s===void 0?r=void 0:(r=new s(o),r.oo(o,t,e)),e!==void 0?(t.Gc??=[])[e]=r:t.qc=r),r!==void 0&&(i=Ee(o,r.Wc(o,i.values),r,e)),i}var ir=class{constructor(i,t){this.hn=[],this.xt=void 0,this.mn=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.mn,r=(i?.creationScope??we).importNode(t,true);be.currentNode=r;let s=be.nextNode(),n=0,a=0,l=e[0];for(;l!==void 0;){if(n===l.index){let c;l.type===2?c=new Re(s,s.nextSibling,this,i):l.type===1?c=new l.ctor(s,l.name,l.strings,this,i):l.type===6&&(c=new nr(s,this,i)),this.hn.push(c),l=e[++a];}n!==l?.index&&(s=be.nextNode(),n++);}return be.currentNode=we,r}p(i){let t=0;for(let e of this.hn)e!==void 0&&(e.strings!==void 0?(e.Et(i,e,t),t+=e.strings.length-2):e.Et(i[t])),t++;}},Re=class o{get X(){return this.f?.X??this.gn}constructor(i,t,e,r){this.type=2,this.r=P,this.xt=void 0,this.Pt=i,this.xe=t,this.f=e,this.options=r,this.gn=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.xe}Et(i,t=this){i=Ee(this,i,t),hi(i)?i===P||i==null||i===""?(this.r!==P&&this.Ee(),this.r=P):i!==this.r&&i!==it&&this.vn(i):i.Vt!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):dn(i)?this.k(i):this.vn(i);}O(i){return this.Pt.parentNode.insertBefore(i,this.xe)}T(i){this.r!==i&&(this.Ee(),this.r=this.O(i));}vn(i){this.r!==P&&hi(this.r)?this.Pt.nextSibling.data=i:this.T(we.createTextNode(i)),this.r=i;}$(i){let{values:t,Vt:e}=i,r=typeof e=="number"?this.Zc(i):(e.el===void 0&&(e.el=mi.createElement(hn(e.h,e.h[0]),this.options)),e);if(this.r?.mn===r)this.r.p(t);else {let s=new ir(r,this),n=s.u(this.options);s.p(t),this.T(n),this.r=s;}}Zc(i){let t=un.get(i.strings);return t===void 0&&un.set(i.strings,t=new mi(i)),t}k(i){Io(this.r)||(this.r=[],this.Ee());let t=this.r,e,r=0;for(let s of i)r===t.length?t.push(e=new o(this.O(pi()),this.O(pi()),this,this.options)):e=t[r],e.Et(s),r++;r<t.length&&(this.Ee(e&&e.xe.nextSibling,r),t.length=r);}Ee(i=this.Pt.nextSibling,t){for(this._i?.(false,true,t);i!==this.xe;){let e=on(i).nextSibling;on(i).remove(),i=e;}}setConnected(i){this.f===void 0&&(this.gn=i,this._i?.(i));}},Te=class{get tagName(){return this.element.tagName}get X(){return this.f.X}constructor(i,t,e,r,s){this.type=1,this.r=P,this.xt=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=P;}Et(i,t=this,e,r){let s=this.strings,n=false;if(s===void 0)i=Ee(this,i,t,0),n=!hi(i)||i!==this.r&&i!==it,n&&(this.r=i);else {let a=i,l,c;for(i=s[0],l=0;l<s.length-1;l++)c=Ee(this,a[e+l],t,l),c===it&&(c=this.r[l]),n||=!hi(c)||c!==this.r[l],c===P?i=P:i!==P&&(i+=(c??"")+s[l+1]),this.r[l]=c;}n&&!r&&this.j(i);}j(i){i===P?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},rr=class extends Te{constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===P?void 0:i;}},or=class extends Te{constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==P);}},sr=class extends Te{constructor(i,t,e,r,s){super(i,t,e,r,s),this.type=5;}Et(i,t=this){if((i=Ee(this,i,t,0)??P)===it)return;let e=this.r,r=i===P&&e!==P||i.capture!==e.capture||i.once!==e.once||i.passive!==e.passive,s=i!==P&&(e===P||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);}},nr=class{constructor(i,t,e){this.element=i,this.type=6,this.xt=void 0,this.f=t,this.options=e;}get X(){return this.f.X}Et(i){Ee(this,i);}},fn={I:Re},ic=Ao.litHtmlPolyfillSupport;ic?.(mi,Re),(Ao.litHtmlVersions??=[]).push("3.3.2");var ar=(o,i,t)=>{let e=t?.renderBefore??i,r=e.Yc;if(r===void 0){let s=t?.renderBefore??null;e.Yc=r=new Re(i.insertBefore(pi(),s),s,void 0,t??{});}return r.Et(o),r};var Lo=globalThis,Ct=class extends zt{constructor(){super(...arguments),this.renderOptions={host:this},this.so=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.so=ar(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.so?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.so?.setConnected(false);}render(){return it}};Ct.Rh=true,Ct.finalized=true,Lo.litElementHydrateSupport?.({LitElement:Ct});var rc=Lo.litElementPolyfillSupport;rc?.({LitElement:Ct});(Lo.litElementVersions??=[]).push("4.2.2");var oc=/\\([0-9a-fA-F]{1,6} ?)/g;function sc(o){return o.length<2?false:(o[0]==='"'||o[0]==="'")&&(o[o.length-1]==='"'||o[o.length-1]==="'")}function nc(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}function ac(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}function gn(o){let i=o;sc(o)&&(i=nc(i),i=i.replace(oc,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=ac(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}function $e(o){class i extends o{constructor(){super(...arguments);this.yn=null;this.ao=null;}getCssData(r,s=false){let n=this.yn??Object.create(null);if(!Object.keys(n).includes(r)||!n[r]){this.ao||(this.ao=window.getComputedStyle(this));let a=this.ao.getPropertyValue(r).trim();try{n[r]=gn(a);}catch(l){s||console.warn(`CSS Data error: ${r}`,l),n[r]=null;}}return this.yn=n,n[r]}}return i}function lr(o){class i extends o{constructor(){super(...arguments);this.willYield=true;this.Qt={};this.Jt=null;this.Bi=false;}createRenderRoot(){return this}connectedCallback(){this.Jt||(this.Jt=Array.from(this.childNodes)),super.connectedCallback();}Xc(){if(this.Bi)return;this.Bi=true,this.Qt={};let r=Array.from(this.childNodes),s=r.length?r:this.Jt??[];for(let n of s){let a=this.bn(n),l=this.Qt[a]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),l.push(n),this.Qt[a]=l;}this.Jt=null;}bn(r){return r instanceof Comment&&r.nextSibling instanceof Element?this.bn(r.nextSibling):"contentFor"in r?r.contentFor||"":r instanceof Element&&r.hasAttribute("content-for")&&r.getAttribute("content-for")||""}Qc(r){return !r.textContent||!r.textContent.trim()}Jc(r){let s=this.Qt[r];return !s||s.every(n=>n instanceof Comment||n instanceof Text&&this.Qc(n))}update(r){!this.hasUpdated&&this.willYield&&this.Xc(),super.update(r);}yield(r,s){if(r===""&&!this.Qt[r]&&!this.Bi&&this.Jt?.length){let a=[];for(let l of this.Jt)l instanceof Element&&(l.removeAttribute("slot"),l.removeAttribute("content-for")),a.push(l);this.Qt[r]=a,this.Bi=true,this.Jt=null;}let n=this.Qt[r];return v` ${n} ${this.Jc(r)?s:void 0} `}}return i}function De(o){class i extends o{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}var ie=class extends Event{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{constructor(i,t,e,r){if(this.subscribe=false,this.provided=false,this.value=void 0,this.t=(s,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=false,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=true,this.callback&&this.callback(s,n)),this.unsubscribe=n;},this.host=i,t.context!==void 0){let s=t;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??false;}else this.context=t,this.callback=e,this.subscribe=r??false;this.host.addController(this);}hostConnected(){this.dispatchRequest();}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0);}dispatchRequest(){this.host.dispatchEvent(new ie(this.context,this.host,this.t,this.subscribe));}};var cr=class{get value(){return this.o}set value(i){this.setValue(i);}setValue(i,t=false){let e=t||!Object.is(i,this.o);this.o=i,e&&this.updateObservers();}constructor(i){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:e}]of this.subscriptions)t(this.o,e);},i!==void 0&&(this.value=i);}addCallback(i,t,e){if(!e)return void i(this.value);this.subscriptions.has(i)||this.subscriptions.set(i,{disposer:()=>{this.subscriptions.delete(i);},consumerHost:t});let{disposer:r}=this.subscriptions.get(i);i(this.value,r);}clearCallbacks(){this.subscriptions.clear();}};var Po=class extends Event{constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},Ve=class extends cr{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[n,{consumerHost:a}]of this.subscriptions)s.has(n)||(s.add(n),a.dispatchEvent(new ie(this.context,a,n,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 Po(this.context,this.host));}};var cc={attribute:true,type:String,converter:ui,reflect:false,hasChanged:tr},uc=(o=cc,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:n}=t;return {set(a){let l=i.get.call(this);i.set.call(this,a),this.requestUpdate(n,l,o,true,a);},init(a){return a!==void 0&&this.C(n,void 0,o,a),a}}}if(e==="setter"){let{name:n}=t;return function(a){let l=this[n];i.call(this,a),this.requestUpdate(n,l,o,true,a);}}throw Error("Unsupported decorator location: "+e)};function y(o){return (i,t)=>typeof t=="object"?uc(o,i,t):((e,r,s)=>{let n=r.hasOwnProperty(s);return r.constructor.createProperty(s,e),n?Object.getOwnPropertyDescriptor(r,s):void 0})(o,i,t)}function f(o){return y({...o,state:true,attribute:false})}function F(o,i){let t,e=((...r)=>{t&&clearTimeout(t),t=setTimeout(()=>o(...r),i);});return e.cancel=()=>{t&&clearTimeout(t);},e}var vn="ctx-name-context";function dr(){return function(o){class i extends o{constructor(...r){super(...r);this.pt=null;this.ti=false;this.lo=false;this.co=void 0;this.Te=new Map;this.ei=new Set;this.init$={};this.ctxOwner=false;this.zi=void 0;this.Hi=false;this.ctxName=this._t;this.Bt=false;this.zi=this.getAttribute("ctx-name")||void 0,this.ctxName=this._t,this.tu=new Fe(this,{context:vn,callback:s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.En=s,this.xn();},subscribe:true});}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 wn(){return this.zi}set wn(r){let s=r??void 0;this.zi!==s&&(this.zi=s,this.xn());}shouldUpdate(r){return this.Bt?super.shouldUpdate(r):false}get _t(){return this.wn||this.En||void 0}xn(){if(this.ctxName=this._t,!(!this.ctxName||this.ti)){if(this.isConnected){this.uo();return}this.Hi=true;}}willUpdate(r){super.willUpdate(r),this.ctxName=this._t,this.ctxName&&(this.co?this.co.setValue(this.ctxName):this.co=new Ve(this,{context:vn,initialValue:this.ctxName}));}Tn(){if(!(!this.pt||this.Te.size===0)){for(let[r,{value:s,rewrite:n}]of this.Te)this.pt.add(r,s,n);this.Te.clear();}}Cn(){return !this.pt&&this._t&&this.po(),this.pt&&this.Tn(),this.pt}Ki(){let r=this.Cn();if(!r)throw new Error("SymbioteMixin: Shared context is not initialized.");return r}po(){let r=this.init$,s=this._t;if(!s){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.pt){this.pt=H.getCtx(s)??H.registerCtx(r,s);for(let[n,a]of Object.entries(this.init$))this.pt.add(n,a,this.ctxOwner);this.Tn();}}get $(){return this._t&&this.po(),new Proxy({},{get:(r,s)=>{if(typeof s=="string")return this.pt?.read(s)},set:(r,s,n)=>(typeof s!="string"||this.pt?.pub(s,n),true)})}sub(r,s,n=true){let a=this.Ki().sub(r,s,n);if(!a||typeof a!="function")return ()=>{};let l=a.bind(a),c=false,d=()=>{c||(c=true,l(),this.ei.delete(d));};return this.ei.add(d),d}pub(r,s){this.Ki().pub(r,s);}set$(r){for(let[s,n]of Object.entries(r))this.pub(s,n);}get sharedCtx(){return this.Ki()}has(r){return this.pt?.has(r)??false}add(r,s,n=false){let a=this.Cn();if(!a){if(!n&&this.Te.has(r))return;this.Te.set(r,{value:s,rewrite:n});return}this.Te.delete(r),a.add(r,s,n);}add$(r,s=false){for(let[n,a]of Object.entries(r))this.add(n,a,s);}connectedCallback(){super.connectedCallback(),this.ti?this.Bt&&this.lo&&(this.lo=false,this.initCallback()):this.ctxName?(this.Hi=false,this.uo()):this.Hi&&this._t&&(this.Hi=false,this.uo());}uo(){if(this.ti)return;this.ti=true,this.po();let r=this.init$;if(Object.keys(r).length>0){let s=this.Ki();for(let[n,a]of Object.entries(r))s.read(n)===void 0&&s.pub(n,a),this.sub(n,F(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.Bt=true,this.requestUpdate();}firstUpdated(r){super.firstUpdated(r);}disconnectedCallback(){this.eu(),super.disconnectedCallback(),this.ti&&(this.lo=true);}eu(){if(this.ei.size!==0){for(let r of [...this.ei])r();this.ei.clear();}}initCallback(){}}return p([y({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"wn",1),p([f()],i.prototype,"En",2),p([f()],i.prototype,"ctxName",2),p([f()],i.prototype,"Bt",2),i}}var Uo=class extends De(dr()($e(lr(Ct)))){};var rt=class o{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 dc=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function vt(o){for(let i in o){if(dc.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);}}var Ro="UC";function pc(o,i=false){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[Ro]){t(window[Ro]);return}let r=document.createElement("script");r.async=true,r.src=o,r.onerror=()=>{e();},r.onload=()=>{let s=window[Ro];i&&vt(s),t(s);},document.head.appendChild(r);})}var fi={"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 $o=new Map,yn=new Map,bn=(o,i)=>{$o.has(o)&&console.log(`Locale ${o} is already defined. Overwriting...`);let t={...fi,...i};return $o.set(o,t),t},hc=(o,i)=>{yn.set(o,i);},wn=(o,i)=>{typeof i=="function"?hc(o,i):bn(o,i);},En=async o=>{let i=$o.get(o);if(!i){let t=yn.get(o);if(!t)throw new Error(`Locale ${o} is not defined`);let e=await t();i=bn(o,e);}return i};wn("en",fi);var x=o=>`*cfg/${o}`;var G=o=>o?o.split(",").map(i=>i.trim()).filter(Boolean):[],Kt=o=>o.join(",");var Tn=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},pr=(...o)=>o.filter(i=>typeof i=="string"&&!!i).map(i=>Tn(i)).join("/-/"),ot=(...o)=>{let i=pr(...o);return i?`-/${i}/`:""};function hr(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}function mr(o){let i=new URL(o),{pathname:t}=i,e=t.indexOf("/"),r=t.indexOf("/",e+1);return t.substring(e+1,r)}function Do(o){let i=Cn(o),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}function Fo(o){return Do(o).split("/-/").filter(Boolean).map(t=>Tn(t))}function Cn(o){let i=new URL(o),t=hr(o),e=xn(t)?Sn(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function xn(o){return o.startsWith("http")}function Sn(o){let i=new URL(o);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}var Z=(o,i,t)=>{let e=new URL(Cn(o)),r=t??hr(o),s=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),r&&xn(r)){let n=Sn(r);e.pathname=`${e.pathname}${s}${n.pathname||""}`,e.search=n.search,e.hash=n.hash;}else e.pathname=`${e.pathname}${s}${r||""}`;return e.toString()},re=(o,i)=>{let t=new URL(o);return t.pathname=`${i}/`,t.toString()};var Y=(o,i=",")=>o.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var gi=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}),kn=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function mc(o,i){if(typeof i=="number"){let t=i;return gi[o]!==t?`${o}/${t}`:""}if(typeof i=="boolean"){let t=i;return gi[o]!==t?`${o}`:""}if(o==="filter"&&i){let{name:t,amount:e}=i;return gi.filter===e?"":`${o}/${t}/${e}`}if(o==="crop"&&i){let{dimensions:t,coords:e}=i;return `${o}/${t.join("x")}/${e.join(",")}`}return ""}function oe(o){return pr(...kn.filter(i=>typeof o[i]<"u"&&o[i]!==null).map(i=>{let t=o[i];return mc(i,t)}).filter(i=>!!i))}var fr=pr("format/auto","progressive/yes"),jt=([o])=>typeof o<"u"?Number(o):void 0,An=()=>true,fc=([o,i])=>({name:o,amount:typeof i<"u"?Number(i):100}),gc=([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)}},vc=Object.freeze({enhance:jt,brightness:jt,exposure:jt,gamma:jt,contrast:jt,saturation:jt,vibrance:jt,warmth:jt,filter:fc,mirror:An,flip:An,rotate:jt,crop:o=>{let[i,t]=o,{dimensions:e,coords:r}=gc([i,t]);return {dimensions:e,coords:r}}});function Vo(o){let i={};for(let t of o){let[e,...r]=t.split("/");if(!e||!kn.includes(e))continue;let s=e,n=vc[s];try{let a=n(r);i[s]=a;}catch(a){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,a instanceof Error?`Error message: "${a.message}"`:a,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return i}var z=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),st=Object.freeze([z.CROP,z.TUNING,z.FILTERS]),Mn=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),In=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"]),On=Object.freeze(["rotate","mirror","flip"]),Gt=gi,It=Object.freeze({brightness:{zero:Gt.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:Gt.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:Gt.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:Gt.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:Gt.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:Gt.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:Gt.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:Gt.enhance,range:[0,100],keypointsNumber:1},filter:{zero:Gt.filter,range:[0,100],keypointsNumber:1}});var vi="https://ucarecdn.com",yc="https://upload.uploadcare.com",bc="https://social.uploadcare.com",wc="https://ucarecd.net",Ec={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:vi,cdnCnamePrefixed:wc,baseUrl:yc,socialBaseUrl:bc,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:Kt(st),cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true,pasteScope:"local",plugins:[],dynamicButtonViewMode:"auto",dynamicButtonShowFirstIcon:true},J=Object.freeze(Ec);var gr=(o,i)=>(...t)=>{let e=o();if(!e.read(x("debug")))return;let r=t;if(typeof t?.[0]=="function"){let n=t[0];r=n();}let s=[e.id,i].filter(Boolean);console.log(`[${s.join("][")}]`,...r);};var K=class{constructor(i){this.ho=new Set;this.te=null;this.E=gr(()=>this.e.ctx,this.constructor.name);this.e=i,this.i=i.ctx;}addSub(i){this.ho.add(i);}get ee(){if(!this.te){let i={};this.te=new Proxy(i,{set:()=>{throw new Error("SharedInstance cfg proxy is read-only")},get:(t,e)=>{if(typeof e!="string")return;let r=x(e);return this.e.ctx.has(r)?this.e.ctx.read(r):J[e]}});}return this.te}destroy(){for(let i of this.ho)try{i();}catch{}this.ho.clear();}},Tc={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"},xt=(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`)},Ln=o=>({get ctx(){return o()},get modalManager(){return xt(o(),"*modalManager",false)},get pluginManager(){return xt(o(),"*pluginManager")},get telemetryManager(){return xt(o(),"*telemetryManager")},get localeManager(){return xt(o(),"*localeManager")},get a11y(){return xt(o(),"*a11y")},get routerLayer(){return xt(o(),"*routerLayer")},get blocksRegistry(){return xt(o(),"*blocksRegistry")},get eventEmitter(){return xt(o(),"*eventEmitter")},get uploadCollection(){return xt(o(),"*uploadCollection")},get secureUploadsManager(){return xt(o(),"*secureUploadsManager",false)},get api(){return xt(o(),"*publicApi")},get validationManager(){return xt(o(),"*validationManager")},when(i,t){let e=Tc[i],r=o(),s=r.has(e)?r.read(e):void 0;if(s)return t(s),()=>{};let n;return n=r.sub(e,a=>{a&&(t(a),n?.());}),n},wait(i){return new Promise(t=>{let e;e=this.when(i,r=>{t(r),e?.();});})}});var X=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),vr=class extends K{constructor(){super(...arguments);this.ie=new Map;this.Tt=new Set;this.c=new Map;}registerModal(t,e){this.ie.set(t,e),this.Z(X.ADD,{id:t,modal:e});}deleteModal(t){let e=this.ie.get(t);return e?(this.ie.delete(t),this.Tt.delete(t),this.Z(X.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.ie.get(t);return e?(this.Tt.add(t),this.Z(X.OPEN,{modal:e,id:t}),true):(this.E(`Modal with ID "${t}" not found`),false)}close(t){let e=this.ie.get(t);return !e||!this.Tt.has(t)?(this.E(`Modal with ID "${t}" not found or not active`),false):(this.Tt.delete(t),this.Z(X.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.ie.has(t)?this.Tt.has(t)?this.close(t):this.open(t):(this.E(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.Tt.size>0}back(){if(this.Tt.size===0)return this.E("No active modals to go back from"),false;let t=Array.from(this.Tt).pop();return t?this.close(t):false}closeAll(){let t=this.Tt.size;return this.Tt.clear(),this.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.E("Error in modal subscriber:",s);}}destroy(){super.destroy(),this.closeAll(),this.ie.clear(),this.c.clear(),this.Z(X.DESTROY,{});}};var yr=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("-");function Pn(o){return Object.prototype.toString.call(o)==="[object Object]"}var Cc=/\W|_/g;function xc(o){return o.split(Cc).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}function Un(o,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(o)?o.map(t=>Wt(t,{ignoreKeys:i})):o}function Wt(o,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(o))return Un(o,{ignoreKeys:i});if(!Pn(o))return o;let t={};for(let e of Object.keys(o)){let r=o[e];if(i.includes(e)){t[e]=r;continue}Pn(r)?r=Wt(r,{ignoreKeys:i}):Array.isArray(r)&&(r=Un(r,{ignoreKeys:i})),t[xc(e)]=r;}return t}var Sc=o=>new Promise(i=>setTimeout(i,o));function jo({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 n=[o,i,e].filter(Boolean).join("/"),a=[s,r].filter(Boolean).join("; ");return `${n} (${a})`}var Ac={factor:2,time:100};function kc(o,i=Ac){let t=0;function e(r){let s=Math.round(i.time*i.factor**t);return r({attempt:t,retry:a=>Sc(a??s).then(()=>(t+=1,e(r)))})}return e(o)}var Ce=class extends Error{},Ne=class o extends Ce{originalProgressEvent;constructor(i){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,o.prototype),this.originalProgressEvent=i;}},br=(o,i)=>{o&&(o.aborted?Promise.resolve().then(i):o.addEventListener("abort",()=>i(),{once:true}));},se=class o extends Ce{isCancel=true;constructor(i="Request canceled"){super(i),this.name="CancelError",Object.setPrototypeOf(this,o.prototype);}},Mc=500,$n=({check:o,interval:i=Mc,timeout:t,signal:e})=>new Promise((r,s)=>{let n,a;br(e,()=>{n&&clearTimeout(n),s(new se("Poll cancelled"));}),t&&(a=setTimeout(()=>{n&&clearTimeout(n),s(new se("Timed out"));},t));let l=()=>{try{Promise.resolve(o(e)).then(c=>{c?(a&&clearTimeout(a),r(c)):n=setTimeout(l,i);}).catch(c=>{a&&clearTimeout(a),s(c);});}catch(c){a&&clearTimeout(a),s(c);}};n=setTimeout(l,0);}),U={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"},wr="application/octet-stream",Dn="original",ae=({method:o,url:i,data:t,headers:e={},signal:r,onProgress:s})=>new Promise((n,a)=>{let l=new XMLHttpRequest,c=o?.toUpperCase()||"GET",d=false;l.open(c,i,true),e&&Object.entries(e).forEach(u=>{let[h,m]=u;typeof m<"u"&&!Array.isArray(m)&&l.setRequestHeader(h,m);}),l.responseType="text",br(r,()=>{d=true,l.abort(),a(new se);}),l.onload=()=>{if(l.status!=200)a(new Error(`Error ${l.status}: ${l.statusText}`));else {let u={method:c,url:i,data:t,headers:e||void 0,signal:r,onProgress:s},h=l.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};h.forEach(function(w){let T=w.split(": "),E=T.shift(),S=T.join(": ");E&&typeof E<"u"&&(m[E]=S);});let g=l.response,b=l.status;n({request:u,data:g,headers:m,status:b});}},l.onerror=u=>{d||a(new Ne(u));},s&&typeof s=="function"&&(l.upload.onprogress=u=>{u.lengthComputable?s({isComputable:true,value:u.loaded/u.total}):s({isComputable:false});}),t?l.send(t):l.send();});function Ic(o,...i){return o}var Oc=({name:o})=>o?[o]:[],Lc=Ic,Pc=()=>new FormData,Fn=o=>false,Er=o=>typeof Blob<"u"&&o instanceof Blob,Tr=o=>typeof File<"u"&&o instanceof File,Cr=o=>!!o&&typeof o=="object"&&!Array.isArray(o)&&"uri"in o&&typeof o.uri=="string",_e=o=>Er(o)||Tr(o)||Fn()||Cr(o),Uc=o=>typeof o=="string"||typeof o=="number"||typeof o>"u",Rc=o=>!!o&&typeof o=="object"&&!Array.isArray(o),$c=o=>!!o&&typeof o=="object"&&"data"in o&&_e(o.data);function Vn(o,i,t){if(Array.isArray(t))for(let e of t)Vn(o,`${i}[]`,e);else if($c(t)){let{name:e,contentType:r}=t,s=Lc(t.data,e,r??wr),n=Oc({name:e});o.push([i,s,...n]);}else if(Rc(t))for(let[e,r]of Object.entries(t))typeof r<"u"&&o.push([`${i}[${e}]`,String(r)]);else Uc(t)&&t&&o.push([i,t.toString()]);}function Dc(o){let i=[];for(let[t,e]of Object.entries(o))Vn(i,t,e);return i}function xr(o){let i=Pc(),t=Dc(o);for(let e of t){let[r,s,...n]=e;i.append(r,s,...n);}return i}var nt=class o extends Ce{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);}},Fc=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()},qt=(o,i,t)=>{let e=new URL(o);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=Fc(t)),e.toString()},Vc="6.18.4",Nc="UploadcareUploadClient",_c=Vc;function Se(o){return jo({libraryName:Nc,libraryVersion:_c,...o})}var Bc="RequestThrottledError",Rn=15e3,zc=1e3;function Hc(o){let{headers:i}=o||{};if(!i||typeof i["retry-after"]!="string")return Rn;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:Rn}function le(o,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return kc(({attempt:r,retry:s})=>o().catch(n=>{if("response"in n&&n?.code===Bc&&r<t)return s(Hc(n));if(n instanceof Ne&&r<e)return s((r+1)*zc);throw n}))}var Nn=o=>{let i="";return (Er(o)||Tr(o)||Cr(o))&&(i=o.type),i||wr},_n=o=>{let i="";return Tr(o)&&o.name?i=o.name:Er(o)||Fn()?i="":Cr(o)&&o.name&&(i=o.name),i||Dn};function Go(o){return typeof o>"u"||o==="auto"?"auto":o?"1":"0"}function Kc(o,{publicKey:i,fileName:t,contentType:e,baseURL:r=U.baseURL,secureSignature:s,secureExpire:n,store:a,signal:l,onProgress:c,source:d="local",integration:u,userAgent:h,retryThrottledRequestMaxTimes:m=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=U.retryNetworkErrorMaxTimes,metadata:b}){return le(()=>ae({method:"POST",url:qt(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Se({publicKey:i,integration:u,userAgent:h})},data:xr({file:{data:o,name:t||_n(o),contentType:e||Nn(o)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Go(a),signature:s,expire:n,source:d,metadata:b}),signal:l,onProgress:c}).then(({data:w,headers:T,request:E})=>{let S=Wt(JSON.parse(w));if("error"in S)throw new nt(S.error.content,S.error.errorCode,E,S,T);return S}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}var Bo;(function(o){o.Token="token",o.FileInfo="file_info";})(Bo||(Bo={}));function jc(o,{publicKey:i,baseURL:t=U.baseURL,store:e,fileName:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,source:c="url",signal:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=U.retryNetworkErrorMaxTimes,metadata:b}){return le(()=>ae({method:"POST",headers:{"X-UC-User-Agent":Se({publicKey:i,integration:u,userAgent:h})},url:qt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:o,store:Go(e),filename:r,check_URL_duplicates:s?1:void 0,save_URL_duplicates:n?1:void 0,signature:a,expire:l,source:c,metadata:b}),signal:d}).then(({data:w,headers:T,request:E})=>{let S=Wt(JSON.parse(w));if("error"in S)throw new nt(S.error.content,S.error.errorCode,E,S,T);return S}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}var pt;(function(o){o.Unknown="unknown",o.Waiting="waiting",o.Progress="progress",o.Error="error",o.Success="success";})(pt||(pt={}));var Gc=o=>"status"in o&&o.status===pt.Error;function qc(o,{publicKey:i,baseURL:t=U.baseURL,signal:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=U.retryNetworkErrorMaxTimes}={}){return le(()=>ae({method:"GET",headers:i?{"X-UC-User-Agent":Se({publicKey:i,integration:r,userAgent:s})}:void 0,url:qt(t,"/from_url/status/",{jsonerrors:1,token:o}),signal:e}).then(({data:l,headers:c,request:d})=>{let u=Wt(JSON.parse(l));if("error"in u&&!Gc(u))throw new nt(u.error.content,u.error.errorCode,d,u,c);return u}),{retryNetworkErrorMaxTimes:a,retryThrottledRequestMaxTimes:n})}function Wc(o,{publicKey:i,baseURL:t=U.baseURL,jsonpCallback:e,secureSignature:r,secureExpire:s,signal:n,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:d=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:u=U.retryNetworkErrorMaxTimes}){return le(()=>ae({method:"POST",headers:{"X-UC-User-Agent":Se({publicKey:i,integration:l,userAgent:c})},url:qt(t,"/group/",{jsonerrors:1}),data:xr({files:o,callback:e,pub_key:i,signature:r,expire:s,source:a}),signal:n}).then(({data:h,headers:m,request:g})=>{let b=Wt(JSON.parse(h));if("error"in b)throw new nt(b.error.content,b.error.errorCode,g,b,m);return b}),{retryNetworkErrorMaxTimes:u,retryThrottledRequestMaxTimes:d})}function Bn(o,{publicKey:i,baseURL:t=U.baseURL,signal:e,source:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:a=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=U.retryNetworkErrorMaxTimes}){return le(()=>ae({method:"GET",headers:{"X-UC-User-Agent":Se({publicKey:i,integration:s,userAgent:n})},url:qt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:o,source:r}),signal:e}).then(({data:c,headers:d,request:u})=>{let h=Wt(JSON.parse(c));if("error"in h)throw new nt(h.error.content,h.error.errorCode,u,h,d);return h}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})}function Zc(o,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:r=U.multipartChunkSize,baseURL:s="",secureSignature:n,secureExpire:a,store:l,signal:c,source:d="local",integration:u,userAgent:h,retryThrottledRequestMaxTimes:m=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=U.retryNetworkErrorMaxTimes,metadata:b}){return le(()=>ae({method:"POST",url:qt(s,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Se({publicKey:i,integration:u,userAgent:h})},data:xr({filename:e,size:o,content_type:t||wr,part_size:r,UPLOADCARE_STORE:Go(l),UPLOADCARE_PUB_KEY:i,signature:n,expire:a,source:d,metadata:b}),signal:c}).then(({data:w,headers:T,request:E})=>{let S=Wt(JSON.parse(w));if("error"in S)throw new nt(S.error.content,S.error.errorCode,E,S,T);return S.parts=Object.keys(S.parts).map(Et=>S.parts[Number(Et)]),S}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})}function Yc(o,i,{contentType:t,signal:e,onProgress:r,retryThrottledRequestMaxTimes:s=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=U.retryNetworkErrorMaxTimes}){return le(()=>ae({method:"PUT",url:i,data:o,onProgress:r,signal:e,headers:{"Content-Type":t||wr}}).then(a=>(r&&r({isComputable:true,value:1}),a)).then(({status:a})=>({code:a})),{retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n})}function Xc(o,{publicKey:i,baseURL:t=U.baseURL,source:e="local",signal:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:a=U.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=U.retryNetworkErrorMaxTimes}){return le(()=>ae({method:"POST",url:qt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Se({publicKey:i,integration:s,userAgent:n})},data:xr({uuid:o,UPLOADCARE_PUB_KEY:i,source:e}),signal:r}).then(({data:c,headers:d,request:u})=>{let h=Wt(JSON.parse(c));if("error"in h)throw new nt(h.error.content,h.error.errorCode,u,h,d);return h}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})}function qo(o,{publicKey:i,baseURL:t,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a,signal:l,onProgress:c}){return $n({check:d=>Bn(o,{publicKey:i,baseURL:t,signal:d,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a}).then(u=>u.isReady?u:(c&&c({isComputable:true,value:1}),false)),signal:l})}function Qc(o){return "defaultEffects"in o}var xe=class{uuid;name;size;isStored;isImage;mimeType;cdnUrl;s3Url;originalFilename;imageInfo;videoInfo;contentInfo;metadata;s3Bucket;defaultEffects=null;constructor(i,{baseCDN:t=U.baseCDN,fileName:e}={}){let{uuid:r,s3Bucket:s}=i,n=qt(t,`${r}/`),a=s?qt(`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=n,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=s||null,this.s3Url=a,Qc(i)&&(this.defaultEffects=i.defaultEffects);}},Jc=(o,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,contentType:a,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,baseCDN:b,metadata:w})=>Kc(o,{publicKey:i,fileName:t,contentType:a,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,metadata:w}).then(({file:T})=>qo(T,{publicKey:i,baseURL:e,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:c,signal:l})).then(T=>new xe(T,{baseCDN:b})),tu=(o,{publicKey:i,fileName:t,baseURL:e,signal:r,onProgress:s,source:n,integration:a,userAgent:l,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:d,baseCDN:u})=>Bn(o,{publicKey:i,baseURL:e,signal:r,source:n,integration:a,userAgent:l,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:d}).then(h=>new xe(h,{baseCDN:u,fileName:t})).then(h=>(s&&s({isComputable:true,value:1}),h)),eu=(o,{signal:i}={})=>{let t=null,e=null,r=o.map(()=>new AbortController),s=n=>()=>{e=n,r.forEach((a,l)=>l!==n&&a.abort());};return br(i,()=>{r.forEach(n=>n.abort());}),Promise.all(o.map((n,a)=>{let l=s(a);return Promise.resolve().then(()=>n({stopRace:l,signal:r[a].signal})).then(c=>(l(),c)).catch(c=>(t=c,null))})).then(n=>{if(e===null)throw t;return n[e]})},iu=window.WebSocket,zo=class{events=Object.create({});emit(i,t){this.events[i]?.forEach(e=>e(t));}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t);}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[];}},ru=(o,i)=>o==="success"?{status:pt.Success,...i}:o==="progress"?{status:pt.Progress,...i}:{status:pt.Error,...i},Ho=class{key;disconnectTime;ws=void 0;queue=[];isConnected=false;subscribers=0;emmitter=new zo;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 iu(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,ru(e.event,JSON.parse(e.data)));}});}}disconnect(){let i=()=>{this.ws?.close(),this.ws=void 0,this.isConnected=false;};this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i();},this.disconnectTime):i();}send(i,t){let e=JSON.stringify({event:i,data:t});this.ws?.send(e);}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,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)}},No=null,Wo=o=>{if(!No){let i=typeof window>"u"?0:3e4;No=new Ho(o,i);}return No},ou=o=>{Wo(o).connect();};function su({token:o,publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,onProgress:a,signal:l}){return $n({check:c=>qc(o,{publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,signal:c}).then(d=>{switch(d.status){case pt.Error:return new nt(d.error,d.errorCode);case pt.Waiting:return false;case pt.Unknown:return new nt(`Token "${o}" was not found.`);case pt.Progress:return a&&(d.total==="unknown"?a({isComputable:false}):a({isComputable:true,value:d.done/d.total})),false;case pt.Success:return a&&a({isComputable:true,value:d.done/d.total}),d;default:throw new Error("Unknown status")}}),signal:l})}var nu=({token:o,pusherKey:i,signal:t,onProgress:e})=>new Promise((r,s)=>{let n=Wo(i),a=n.onError(s),l=()=>{a(),n.unsubscribe(o);};br(t,()=>{l(),s(new se("pusher cancelled"));}),n.subscribe(o,c=>{switch(c.status){case pt.Progress:{e&&(c.total==="unknown"?e({isComputable:false}):e({isComputable:true,value:c.done/c.total}));break}case pt.Success:{l(),e&&e({isComputable:true,value:c.done/c.total}),r(c);break}case pt.Error:l(),s(new nt(c.msg,c.error_code));}});}),au=(o,{publicKey:i,fileName:t,baseURL:e,baseCDN:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,store:c,signal:d,onProgress:u,source:h,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,pusherKey:w=U.pusherKey,metadata:T})=>Promise.resolve(ou(w)).then(()=>jc(o,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,store:c,signal:d,source:h,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,metadata:T})).catch(E=>(Wo(w)?.disconnect(),Promise.reject(E))).then(E=>E.type===Bo.FileInfo?E:eu([({signal:S})=>su({token:E.token,publicKey:i,baseURL:e,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:u,signal:S}),({signal:S})=>nu({token:E.token,pusherKey:w,signal:S,onProgress:u})],{signal:d})).then(E=>{if(E instanceof nt)throw E;return E}).then(E=>qo(E.uuid,{publicKey:i,baseURL:e,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:u,signal:d})).then(E=>new xe(E,{baseCDN:r})),_o=new WeakMap,lu=async o=>{if(_o.has(o))return _o.get(o);let i=await fetch(o.uri).then(t=>t.blob());return _o.set(o,i),i},zn=async o=>{if(Tr(o)||Er(o))return o.size;if(Cr(o))return (await lu(o)).size;throw new Error("Unknown file type. Cannot determine file size.")},cu=(o,i=U.multipartMinFileSize)=>o>=i,Hn=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)},Zo=o=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return !_e(o)&&t.test(o)},uu=(o,i)=>new Promise((t,e)=>{let r=[],s=false,n=i.length,a=[...i],l=()=>{let c=i.length-a.length,d=a.shift();d&&d().then(u=>{s||(r[c]=u,n-=1,n?l():t(r));}).catch(u=>{s=true,e(u);});};for(let c=0;c<o;c++)l();}),du=(o,i,t,e)=>{let r=e*i,s=Math.min(r+e,t);return o.slice(r,s)},pu=async(o,i,t)=>e=>du(o,e,i,t),hu=(o,i,{publicKey:t,contentType:e,onProgress:r,signal:s,integration:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})=>Yc(o,i,{contentType:e,onProgress:r,signal:s,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l}),mu=async(o,{publicKey:i,fileName:t,fileSize:e,baseURL:r,secureSignature:s,secureExpire:n,store:a,signal:l,onProgress:c,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,contentType:b,multipartChunkSize:w=U.multipartChunkSize,maxConcurrentRequests:T=U.maxConcurrentRequests,baseCDN:E,metadata:S})=>{let Et=e??await zn(o),Tt,ve=(Q,dt)=>{if(!c)return;Tt||(Tt=Array(Q).fill(0));let kt=Pt=>Pt.reduce((Bt,Eo)=>Bt+Eo,0);return Pt=>{Pt.isComputable&&(Tt[dt]=Pt.value,c({isComputable:true,value:kt(Tt)/Q}));}};return b||=Nn(o),Zc(Et,{publicKey:i,contentType:b,fileName:t||_n(o),baseURL:r,secureSignature:s,secureExpire:n,store:a,signal:l,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,metadata:S,multipartChunkSize:w}).then(async({uuid:Q,parts:dt})=>{let kt=await pu(o,Et,w);return Promise.all([Q,uu(T,dt.map((Pt,Bt)=>()=>hu(kt(Bt),Pt,{publicKey:i,contentType:b,onProgress:ve(dt.length,Bt),signal:l,integration:u,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})))])}).then(([Q])=>Xc(Q,{publicKey:i,baseURL:r,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})).then(Q=>Q.isReady?Q:qo(Q.uuid,{publicKey:i,baseURL:r,source:d,integration:u,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:c,signal:l})).then(Q=>new xe(Q,{baseCDN:E}))};async function Yo(o,{publicKey:i,fileName:t,baseURL:e=U.baseURL,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,contentType:g,multipartMinFileSize:b,multipartChunkSize:w,maxConcurrentRequests:T,baseCDN:E=U.baseCDN,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:Et,pusherKey:Tt,metadata:ve}){if(_e(o)){let Q=await zn(o);return cu(Q,b)?mu(o,{publicKey:i,contentType:g,multipartChunkSize:w,fileSize:Q,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,maxConcurrentRequests:T,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,baseCDN:E,metadata:ve}):Jc(o,{publicKey:i,fileName:t,contentType:g,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,baseCDN:E,metadata:ve})}if(Zo(o))return au(o,{publicKey:i,fileName:t,baseURL:e,baseCDN:E,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:Et,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,pusherKey:Tt,metadata:ve});if(Hn(o))return tu(o,{publicKey:i,fileName:t,baseURL:e,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,baseCDN:E});throw new TypeError(`File uploading from "${o}" is not supported`)}var fu=(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}},Ko=class{uuid;filesCount;totalSize;isStored;isImage;cdnUrl;files;createdAt;storedAt=null;constructor(i,{baseCDN:t=U.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=fu(i.cdnUrl,t),this.files=e.map(r=>new xe(r,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored;}},gu=o=>{for(let i of o)if(!_e(i))return false;return true},vu=o=>{for(let i of o)if(!Hn(i))return false;return true},yu=o=>{for(let i of o)if(!Zo(i))return false;return true};function Kn(o,{publicKey:i,fileName:t,baseURL:e=U.baseURL,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:b=U.multipartChunkSize,baseCDN:w=U.baseCDN,checkForUrlDuplicates:T,saveUrlForRecurrentUploads:E,jsonpCallback:S}){if(!gu(o)&&!yu(o)&&!vu(o))throw new TypeError(`Group uploading from "${o}" is not supported`);let Et,Tt=true,ve=o.length,Q=(dt,kt)=>{if(!l)return;Et||(Et=Array(dt).fill(0));let Pt=Bt=>Bt.reduce((Eo,Kl)=>Eo+Kl)/dt;return Bt=>{if(!Bt.isComputable||!Tt){Tt=false,l({isComputable:false});return}Et[kt]=Bt.value,l({isComputable:true,value:Pt(Et)});}};return Promise.all(o.map((dt,kt)=>_e(dt)||Zo(dt)?Yo(dt,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:Q(ve,kt),source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:b,baseCDN:w,checkForUrlDuplicates:T,saveUrlForRecurrentUploads:E}).then(Pt=>Pt.uuid):dt)).then(dt=>Wc(dt,{publicKey:i,baseURL:e,jsonpCallback:S,secureSignature:r,secureExpire:s,signal:a,source:c,integration:d,userAgent:u,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m}).then(kt=>new Ko(kt,{baseCDN:w})).then(kt=>(l&&l({isComputable:true,value:1}),kt)))}var ne=class{ji=1;fo=[];Gi=0;mo=new Map;go=new Map;constructor(i){this.ji=i;}run(){let i=this.ji-this.Gi;for(let t=0;t<i;t++){let e=this.fo.shift();if(!e)return;let r=this.mo.get(e),s=this.go.get(e);if(!r||!s)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.Gi+=1,e().finally(()=>{this.mo.delete(e),this.go.delete(e),this.Gi-=1,this.run();}).then(n=>r(n)).catch(n=>s(n));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,r)=>{this.mo.set(i,e),this.go.set(i,r),this.fo.push(i),t&&this.run();})}get pending(){return this.fo.length}get running(){return this.Gi}set concurrency(i){this.ji=i,this.run();}get concurrency(){return this.ji}};var Xo=()=>({}),Qo=o=>({...Xo(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{o.modalManager?.close(o.$["*currentActivity"]),o.pub("*currentActivity",null);}}),Jo=o=>({...Qo(o),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new ne(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),jn=o=>({...Jo(o),"*solution":null,"*lazyPlugins":null});var D=Object.freeze({START_FROM:"start-from",CAMERA:"camera",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var bu=new Set([D.START_FROM,D.UPLOAD_LIST]),Sr=class extends K{constructor(t){super(t);this.scopes=new Set;this.listener=this.iu.bind(this),window.addEventListener("paste",this.listener);}ru(t){if(!(t instanceof Element))return false;if(t.closest("input, textarea, select"))return true;let e=t.closest("[contenteditable]");return !!(e&&e.getAttribute("contenteditable")?.toLowerCase()!=="false"||t.closest('[role="textbox"], [role="searchbox"], [role="combobox"]'))}ou(t){return t.composedPath().some(e=>this.ru(e))}su(t){return typeof t=="string"&&bu.has(t)}nu(){return [...this.scopes].some(t=>t.isConnected)}au(){return [...this.scopes].some(t=>t.isConnected&&t instanceof Element&&t.localName==="uc-file-uploader-regular")}lu(t){return t?[...this.scopes].some(e=>e.isConnected&&e.contains(t)):false}cu(t){let e=t.trim();if(!e)return null;try{let r=new URL(e);return r.protocol!=="http:"&&r.protocol!=="https:"?null:r.toString()}catch{return null}}openUploadList(){this.e.routerLayer.navigateAfterFileAdd();}async iu(t){if(!t.clipboardData||this.ou(t)||!this.nu())return;let e=this.e.ctx.read("*currentActivity"),r=e===null,s=this.su(e);switch(this.ee.pasteScope){case "global":if(!s&&!(r&&this.au()))return;await this.handlePaste(t);return;case "local":{let n=t.target instanceof Node?t.target:null;if(!this.lu(n)||!s&&!r)return;await this.handlePaste(t);return}default:return}}async handlePaste(t){if(!t.clipboardData)return;let e=Array.from(t.clipboardData.items),r=e.filter(a=>a.kind==="file").map(a=>a.getAsFile()).filter(a=>a!==null),s=e.filter(a=>a.kind==="string"&&(a.type==="text/plain"||a.type==="text/uri-list")).map(a=>new Promise(l=>{a.getAsString(c=>{l(this.cu(c));});})),n=false;if(r.length>0&&(r.forEach(a=>{this.e.api.addFileFromObject(a,{source:"clipboard"});}),n=true),s.length>0){let a=(await Promise.all(s)).filter(l=>l!==null);a.forEach(l=>{this.e.api.addFileFromUrl(l,{source:"clipboard"});}),n||=a.length>0;}n&&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 Ar=class extends K{constructor(){super(...arguments);this.qi=[];}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",D.UPLOAD_LIST),this.e.modalManager?.open(D.UPLOAD_LIST));}};var wu={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function yi(o,i){i.tabIndex=0,i.focus(),o.tabIndex=-1;}function ts(o){let i=o.role||o.type||o.tagName;if(!i)return null;let t=wu[i.toLowerCase()];if(!t)return null;for(let e of t){let r=o.closest(`[role=${e}]`);if(r)return r}}function es(o,i){return i.role==="toolbar"?Tu(i):i.querySelectorAll(`[role=${o.role}]`)}function Eu(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})}function Tu(o){return [...o.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}function Cu(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"}function Gn(o){return i=>{let t=false,e=300,r=0,s="";function n(u){let h=ts(u.target);if(!h){a();return}let m=es(u.target,h),g=Eu(m,h),b=Array.from(g).indexOf(u.target),w="ArrowDown",T="ArrowUp";if(Cu(h)&&(i.document.dir==="rtl"?(w="ArrowLeft",T="ArrowRight"):(w="ArrowRight",T="ArrowLeft")),u.key===w)u.preventDefault(),yi(u.target,g[b+1]||g[0]);else if(u.key===T)u.preventDefault(),yi(u.target,g[b-1]||g[g.length-1]);else if(u.key==="Home")u.preventDefault(),yi(u.target,g[0]);else if(u.key==="End")u.preventDefault(),yi(u.target,g[g.length-1]);else if(u.key.length===1&&h.role!=="tablist"){u.timeStamp-r<=e?s+=u.key.toLowerCase():s=u.key.toLowerCase(),r=u.timeStamp;let E=Array.from(m).find(S=>S.textContent?.trim()?.toLowerCase()?.startsWith(s));E&&(u.preventDefault(),yi(u.target,E));}}function a(){t=false,i.removeEventListener("keydown",n);}function l(u){let h=ts(u.target);if(h){t||(t=true,i.addEventListener("keydown",n));let m=es(u.target,h);for(let g of m)g!==u.target&&g.setAttribute("tabindex",-1);}else t&&a();}function c(u){(!u.relatedTarget||u.relatedTarget===i.document)&&a();}function d(u){let h=ts(u.target);if(h){let m=es(u.target,h);for(let g of m)g!==u.target&&g.setAttribute("tabindex",-1);u.target.setAttribute("tabindex",0);}}return i.addEventListener("click",d),i.addEventListener("focusin",l),i.addEventListener("focusout",c),()=>{a(),i.removeEventListener("click",d),i.removeEventListener("focusin",l),i.removeEventListener("focusout",c);}}}function qn(){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 n=s.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');n&&(n.tabIndex=0);}}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 o.addEventListener("keyuxJump",e),o.addEventListener("focusout",r),()=>{o.removeEventListener("keyuxJump",e),o.removeEventListener("focusout",r);}}}function Wn(){return o=>{let i=[];function t(l){let c=o.document.activeElement;c&&c!==o.document.body&&i.push(new WeakRef(c)),l.focus({focusVisible:true});}function e(){let l=i.pop();if(!l){o.document.activeElement.blur();return}let c=l.deref();c&&c.isConnected?c.focus():e();}let r=0,s;function n(l){clearInterval(s);let c=l.getAttribute("aria-controls");s=setInterval(()=>{if(r++>50){clearInterval(s);return}let d=o.document.getElementById(c);if(d){let u=d.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');u&&(clearInterval(s),d.dispatchEvent(new o.CustomEvent("keyuxJump",{bubbles:true})),t(u));}},50);}function a(l){l.target.getAttribute("aria-controls")&&l.key==="Enter"&&n(l.target),l.key==="Escape"&&e();}return o.addEventListener("keydown",a),()=>{o.removeEventListener("keydown",a);}}}function Zn(o){let i,t=o.split(" "),e;function r(a){(a.key==="Enter"||a.key===" ")&&(a.target.tagName==="BUTTON"||a.target.tagName==="A")&&(s(),a.target.classList.add(...t),i=a.target,e=a.target);}function s(){i&&(i.classList.remove(...t),i=0,setTimeout(()=>{e=0;},0));}function n(a){a.clientX===0&&a.clientY===0&&i!==a.target&&(s(),e!==a.target&&(a.target.classList.add(...t),i=a.target));}return a=>(a.addEventListener("click",n),a.addEventListener("keydown",r),a.addEventListener("keyup",s),()=>{a.removeEventListener("click",n),a.removeEventListener("keydown",r),a.removeEventListener("keyup",s);})}function Yn(o,i){let t=i.map(e=>e(o));return ()=>{t.forEach(e=>e());}}var is=class{constructor(){this.mt=new Map;this.vo=[];}addEventListener(i,t){let e=r=>{let s=r.target;s instanceof Node&&this.vo.some(n=>n===s||n.contains(s))&&t(r);};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.vo.push(i);}destroy(){this.vo=[];for(let i of this.mt.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.mt.clear();}},kr=class{constructor(){this.Wi=new is,this.Sn=Yn(this.Wi,[Gn(),Zn("is-pressed"),Wn(),qn()]);}registerBlock(i){this.Wi.registerScope(i);}destroy(){this.Sn?.(),this.Wi.destroy();}};var Zt=o=>`*l10n/${o}`,xu="en",Mr=class extends K{constructor(t){super(t);this.Ce="";for(let[r,s]of Object.entries(fi)){let n=this.i.has(Zt(r))?!this.i.read(Zt(r)):true;this.i.add(Zt(r),s,n);}let e=t.pluginManager;e?.onPluginsChange&&this.addSub(e.onPluginsChange(()=>{this.Ce&&this.An(this.Ce);})),this.addSub(this.i.sub(x("localeName"),async r=>{if(!r)return;this.Ce=r;let s=await En(r);r!==xu&&this.Ce!==r||(this.An(r),this.kn(r,s));})),this.addSub(this.i.sub(x("localeDefinitionOverride"),r=>{if(!r)return;let s=r[this.Ce];s&&this.kn(this.Ce,s);}));}kn(t,e){let r=this.ee.localeDefinitionOverride?.[t];for(let[s,n]of Object.entries(e)){let a=r?.[s];this.i.add(Zt(s),a??n,true);}}An(t){let e=this.e.pluginManager;if(!e)return;let r=e.snapshot();for(let s of r.l10n){let{pluginId:n,...a}=s,l=a[t];if(l)for(let[c,d]of Object.entries(l))d!==void 0&&this.i.add(Zt(c),d,true);}}};var Su=()=>{let o=navigator.userAgent;return /Macintosh|Windows/.test(o)&&/Version\/[\d.]+.*Safari/.test(o)&&!/Chrome|Chromium|Edg|OPR/.test(o)},Au=()=>"capture"in document.createElement("input"),ku=()=>({safariDesktop:Su()}),Mu=()=>({htmlMediaCapture:Au()}),Xn=ku(),Qn=Mu();var bi="image/*",rs="video/*",Iu=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Ou=()=>Xn.safariDesktop?[bi]:[bi,...Iu],wi=Ou(),Ir=o=>o?o.filter(i=>typeof i=="string").flatMap(i=>Y(i)):[],os=(o,i)=>i.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return o.startsWith(e)}return o===t}),Jn=(o,i)=>i.some(t=>t.startsWith(".")?o.toLowerCase().endsWith(t.toLowerCase()):false),Be=o=>{let i=o?.type;return i?os(i,wi):false};function ta(o,i,t,e,r){return {registry:{registerSource:c=>o.addSource(e,c),registerActivity:c=>o.addActivity(e,c),registerFileAction:c=>o.addFileAction(e,c),registerFileHook:c=>o.addFileHook(e,c),registerIcon:c=>o.addIcon(e,c),registerL10n:c=>o.addL10n(e,c),registerConfig:c=>{o.addConfig(e,c);let d=x(c.name);i.has(d)||i.add(d,c.defaultValue);}},config:{get:c=>{let d=x(c);return i.read(d)},subscribe:(c,d)=>{let u=x(c),h=i.sub(u,m=>{d(m);});return r.push(h),h}},activity:{getParams:()=>i.read("*currentActivityParams"),subscribeToParams:c=>{let d=i.sub("*currentActivityParams",u=>{c(u);});return r.push(d),d}},files:{update:(c,d)=>{let u=t.uploadCollection?.read(c);u&&(d.file!==void 0&&(u.setValue("file",d.file),u.setValue("fileSize",d.file.size)),d.cdnUrl!==void 0&&u.setValue("cdnUrl",d.cdnUrl),d.cdnUrlModifiers!==void 0&&u.setValue("cdnUrlModifiers",d.cdnUrlModifiers),d.mimeType!==void 0&&u.setValue("mimeType",d.mimeType));}}}}var Lu=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),Or=class{constructor(i,t){this.i=i;this.du=t;this.ii=new Set;this.Mn=this.i.sub("*lazyPlugins",e=>{this.uu(e??[]);});}uu(i){for(let r of this.ii)r();if(this.ii.clear(),i.length===0)return;let t=new Set([x("plugins")]);for(let r of i)for(let s of r.configDeps)t.add(x(s));let e=()=>this.On(i);for(let r of t)this.ii.add(this.i.sub(r,e,false));this.On(i);}On(i){this.yo?.abort();let t=new AbortController;this.yo=t;let e=n=>this.i.read(x(n)),r=e("plugins"),s=Lu({entries:i.map(n=>({isEnabled:()=>n.isEnabled(e),load:n.load})),signal:t.signal}).then(n=>{if(!t.signal.aborted)return [...r,...n]});this.du(s);}destroy(){this.Mn();for(let i of this.ii)i();this.ii.clear(),this.yo?.abort();}};var Lr=class{constructor(){this.re=new Map;}register(i,t){if(this.re.has(t.name)){console.warn(`[CustomConfig] Config option "${t.name}" is already registered`);return}let e={attribute:true,...t,pluginId:i};this.re.set(t.name,e);}unregister(i){this.re.delete(i);}unregisterByPlugin(i){for(let[t,e]of this.re)e.pluginId===i&&this.re.delete(t);}get(i){return this.re.get(i)}getAll(){return new Map(this.re)}};var Pr=class{constructor(i=()=>{}){this.b=[];this.Ct=[];this.Zi=[];this.Yi=[];this.Xi=[];this.Se=[];this.config=new Lr;this.Lt=F(i,0);}destroy(){this.Lt.cancel();}Ae(i,t){return {...t,pluginId:i}}addSource(i,t){let e=this.b.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.b.push(this.Ae(i,t)),this.Lt();}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.Ae(i,t)),this.Lt();}addFileAction(i,t){this.Zi.push(this.Ae(i,t)),this.Lt();}addFileHook(i,t){this.Yi.push(this.Ae(i,{timeout:3e4,...t})),this.Lt();}addIcon(i,t){this.Xi.push(this.Ae(i,t)),this.Lt();}addL10n(i,t){this.Se.push(this.Ae(i,t)),this.Lt();}addConfig(i,t){this.config.register(i,t),this.Lt();}purge(i){this.b=this.b.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.Se=this.Se.filter(t=>t.pluginId!==i),this.config.unregisterByPlugin(i);}snapshot(){return {sources:[...this.b],activities:[...this.Ct],fileActions:[...this.Zi],fileHooks:[...this.Yi],icons:[...this.Xi],l10n:[...this.Se]}}};var Ur=class extends K{constructor(t){super(t);this.oe=new Map;this.c=new Set;this.bo=Promise.resolve();this.registry=new Pr(()=>this.Qi());this.In=new Or(this.i,e=>{this.bo=this.bo.then(()=>e).then(r=>{if(r)return this.pu(r)});});}get configRegistry(){return this.registry.config}pluginsReady(){return this.bo}onPluginsChange(t){return this.c.add(t),()=>{this.c.delete(t);}}async pu(t){let e=new Set(this.oe.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.oe.has(s.id))try{await this.hu(s);}catch(n){this.registry.purge(s.id),this.Qi(),console.error(`[PluginManager] Plugin "${s.id}" setup() threw an error`,n);}e.delete(s.id);}for(let s of e)this.wo(s);}async hu(t){this.oe.has(t.id)&&this.wo(t.id);let e=[],r=ta(this.registry,this.i,this.e,t.id,e),s=this.e.api,n;try{n=await t.setup({pluginApi:r,uploaderApi:s})??void 0;}catch(a){for(let l of e)try{l();}catch(c){this.E("Failed to unsubscribe config listener",c);}throw a}this.oe.set(t.id,{plugin:t,dispose:n,configSubscriptions:e}),this.Qi();}wo(t){let e=this.oe.get(t);if(e){this.registry.purge(t);for(let r of e.configSubscriptions)try{r();}catch(s){this.E("Failed to unsubscribe config listener",s);}e.dispose?.(),this.oe.delete(t),this.Qi();}}snapshot(){return this.registry.snapshot()}async runOnAddHooks(t){let e=t.getValue("file");if(!e)return;let r=this.registry.snapshot().fileHooks.filter(a=>a.type==="onAdd");if(r.length===0)return;let s=e,n=new AbortController;for(let a of r){if(n.signal.aborted)break;try{let l=a.handler({file:s,signal:n.signal}),c=new Promise((d,u)=>setTimeout(()=>u(new Error("onAdd hook timed out")),a.timeout));({file:s}=await Promise.race([l,c]));}catch(l){console.warn(`File hook "onAdd" from plugin "${a.pluginId}" failed`,l);}}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.oe.keys()))this.wo(t);this.registry.destroy(),this.In.destroy(),super.destroy();}Qi(){for(let t of this.c)try{t();}catch{}}};function Pu(o){return o.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}function ns(o){return Array.isArray(o)?o.map(i=>typeof i=="object"&&i!==null?ns(i):i):typeof o!="object"||o===null?o:Object.fromEntries(Object.entries(o).map(([i,t])=>{let e=Pu(i);return typeof t=="object"&&t!==null?[e,ns(t)]:[e,t]}))}function Uu(o){return {ok:true,value:o}}function ss(o){return {ok:false,error:o}}var Ru="https://tlm.uploadcare.com/api/",as=class{constructor(i=Ru){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let r=await fetch(e,t);if(!r.ok)return ss(new Error(`Got non-200 response from "${e}". Status: ${r.status.toString()}`));try{let s=await r.json();return Uu(s)}catch(s){return ss(new Error(`Error parsing JSON from "${e}". Error: ${s}`))}}catch(r){return ss(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(ns(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},$u=async(o,i)=>({success:true,data:i}),Du=async o=>$u(void 0,o),Rr=class extends as{constructor(){super();}async sendEvent(i,t){let e=await Du(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 Fu=20,V=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),A=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"}),$r=class extends K{constructor(){super(...arguments);this.ri=new Map;this.Ji=new Set;this.mt=new Map;}bindTarget(t){return this.Ji.add(t),()=>{this.Ji.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)}Pn(t,e){for(let s of this.Ji)s.dispatchEvent(new CustomEvent(t,{detail:e}));let r=this.mt.get(t);if(r)for(let s of r)s(e);this.E?.(()=>{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.Pn(t,typeof e=="function"?e():e);return}this.ri.has(t)&&window.clearTimeout(this.ri.get(t));let n=typeof s=="number"?s:Fu,a=window.setTimeout(()=>{try{let l=typeof e=="function"?e():e;this.Pn(t,l),this.ri.delete(t);}catch(l){this.E?.(()=>`Error while getting payload for event "${t}"`,l);}},n);this.ri.set(t,a);}destroy(){for(let t of this.ri.values())window.clearTimeout(t);this.Ji.clear(),this.mt.clear();}};var ea="1.31.1";var Ut="blocks",Rt=ea;var Dr=class extends K{constructor(t){super(t);this.fu=rt.generateRandomUUID();this.ke=structuredClone(J);this.xo=false;this.Eo=null;this.zt=false;this.Ln=new Rr,this.Me=new ne(10),this.addSub(this.i.sub(x("qualityInsights"),e=>{this.zt=!!e;}));for(let e of Object.keys(this.ke))this.addSub(this.i.sub(x(e),r=>{this.zt&&(this.xo&&this.ke[e]!==r&&this.sendEvent({eventType:V.CHANGE_CONFIG}),this.mu(e,r));}));}gu(t){t===V.INIT_SOLUTION&&!this.xo&&(this.xo=true);}mu(t,e){this.ke[t]!==e&&(this.ke[t]=e);}vu(t){let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let r={...t};return (t.eventType===V.INIT_SOLUTION||t.eventType===V.CHANGE_CONFIG)&&(r.config=this.ke),{...r,appVersion:Rt,appName:Ut,sessionId:this.fu,component:this.yu,activity:this.bu,projectPubkey:this.ke.pubkey,userAgent:navigator.userAgent,eventType:r.eventType??"",eventTimestamp:this.wu,payload:{location:this.xu,...e}}}Eu(t){return !!(t&&[A.CHANGE,A.COMMON_UPLOAD_PROGRESS,A.FILE_ADDED,A.FILE_REMOVED,A.FILE_UPLOAD_START,A.FILE_UPLOAD_PROGRESS,A.FILE_UPLOAD_SUCCESS,A.FILE_UPLOAD_FAILED].includes(t))}sendEvent(t){if(!this.zt)return;let e=this.vu({eventType:t.eventType,payload:t.payload,config:t.config});this.gu(t.eventType),!(this.Eu(t.eventType)||this.Eo&&this.Rn(this.Eo,e))&&this.Me.add(async()=>{this.Eo=e,await this.Ln.sendEvent(e);});}sendEventError(t,e="unknown"){this.sendEvent({eventType:V.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}});}sendEventCloudImageEditor(t,e,r={}){this.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{tabId:e,node:t.currentTarget?.tagName,event:t.type,...r}}});}Rn(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 n of r)if(!Object.hasOwn(e,n)||!this.Rn(t[n],e[n]))return false;return true}get wu(){return Date.now()}get yu(){if(!this.i.has("*solution"))return null;let t=this.i.read("*solution");return t?t.toLowerCase():null}get bu(){return this.i.has("*currentActivity")?this.i.read("*currentActivity"):null}get xu(){return location.origin}};var ia=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};var Nu=o=>o;var ra="plural:";function ze(o,i={},t={}){let{openToken:e="{{",closeToken:r="}}",transform:s=Nu}=t;for(let n in i){let a=i[n],l=a?.toString(),c=typeof l=="string"?s(l):String(l);o=o.replaceAll(e+n+r,c);}return o}function oa(o){let i=[],t=o.indexOf("{{");for(;t!==-1;){let e=o.indexOf("}}",t);if(e===-1)break;let r=o.substring(t+2,e);if(r.startsWith(ra)){let s=o.substring(t+2,e).replace(ra,""),n=s.substring(0,s.indexOf("(")),a=s.substring(s.indexOf("(")+1,s.indexOf(")"));i.push({variable:r,pluralKey:n,countVariable:a});}t=o.indexOf("{{",e);}return i}var sa="--uploadcare-blocks-window-height",Ei=class o{static{this.clientsRegistry=new Set;}static{this.flush=F(()=>{document.documentElement.style.setProperty(sa,`${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(sa);}};var Fr=(o,i)=>new Intl.PluralRules(o).select(i);var _u=o=>(i,t)=>{let e=o(),r=e("locale-id")||"en",s=Fr(r,t);return e(`${i}__${s}`)},Vr=o=>{let i=_u(()=>t),t=(e,r={})=>{if(!e)return "";let n=o().read(Zt(e))||e,a=oa(n);for(let c of a)r[c.variable]=i(c.pluralKey,Number(r[c.countVariable]));return ze(n,r)};return t};var Bu=o=>o.tagName?.includes("-")??false,Nr=class{constructor(i){this.se=new Set;this.tr=new Map;this.Un=false;this.ne=i,this.ne.addController(this);}hostDisconnected(){this.er?.(),this.er=void 0,this.se.clear(),this.tr.clear();}hostUpdated(){if(!this.er&&this.ne.has(x("testMode"))){let i=this.ne.subConfigValue("testMode",t=>{this.Un=!!t,this.$n();});this.er=i;}this.Tu(),this.$n();}Tu(){let i=this.ne,t=i.renderRoot??i;if(!t)return;let e=this.ne,r=e.tagName?.toLowerCase(),s=Array.from(t.querySelectorAll("[data-testid]")).filter(n=>!Bu(n));for(let n of s)if(!(r&&n.closest(r)!==e)&&!this.se.has(n)){let a=n.getAttribute("data-testid");if(!a)continue;this.se.add(n),this.tr.set(n,a);}for(let n of Array.from(this.se))(!n.isConnected||r&&n.closest(r)!==e)&&(this.se.delete(n),this.tr.delete(n));}$n(){if(!this.se.size)return;let i=this.ne.testId||"";for(let t of this.se){let e=this.tr.get(t);e&&(this.Un?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var zu=De(dr()($e(lr(Ct)))),C=class extends zu{constructor(){super();this.init$=Xo();this.l10n=Vr(()=>this.sharedCtx);this.debugPrint=gr(()=>this.sharedCtx,this.constructor.name);this.e=Ln(()=>this.sharedCtx);new Nr(this);}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 n=typeof e=="function"?e():e;this.telemetryManager.sendEvent({eventType:t,payload:n??void 0});}hasBlockInCtx(t){for(let e of this.blocksRegistry)if(t(e))return true;return false}connectedCallback(){this.constructor.styleAttrs.forEach(e=>{this.setAttribute(e,"");}),super.connectedCallback(),Ei.registerClient(this);}initCallback(){this.Y("*blocksRegistry",()=>new Set),this.Y("*pluginManager",t=>new Ur(t)),this.Y("*eventEmitter",t=>new $r(t)),this.Y("*localeManager",t=>new Mr(t)),this.Y("*modalManager",t=>new vr(t)),this.Y("*a11y",()=>new kr),this.Y("*routerLayer",t=>new Ar(t)),this.Y("*clipboard",t=>new Sr(t)),this.Y("*telemetryManager",t=>new Dr(t)),this.sub(Zt("locale-id"),t=>{let e=ia(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(),Ei.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),t?.size===0&&setTimeout(()=>{this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.Cu(),H.deleteCtx(this.ctxName);}Dn(){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.Dn();if(!r.has(t)&&(!this.has(t)||!this.$[t])){let s=e(this.e);this.add(t,s,true),r.set(t,s);return}}Cu(){let t=this.Dn();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:mr(t),cdnUrlModifiers:Do(t),fileName:hr(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:e=>window.encodeURIComponent(e)}):t}get cfg(){if(!this.te){let t={};this.te=new Proxy(t,{set:(e,r,s)=>{if(typeof r!="string"||!(r in J))return false;let n=r,a=x(n);return this.has(a)||this.add(a,J[n]),this.$[a]=s,true},get:(e,r)=>{let s=x(r);return this.has(s)||this.add(s,J[r]),this.$[s]}});}return this.te}subConfigValue(t,e){let r=x(t);return this.has(r)||this.add(r,J[t]),this.sub(r,e)}};var $t={ATTRIBUTE:1,CHILD:2},at=o=>(...i)=>({ro:o,values:i}),ht=class{constructor(i){}get X(){return this.f.X}oo(i,t,e){this.ir=i,this.f=t,this.Su=e;}Wc(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var Ae=class extends ht{constructor(i){if(super(i),this.it=P,i.type!==$t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===P||i==null)return this.Fn=void 0,this.it=i;if(i===it)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.Fn;this.it=i;let t=[i];return t.raw=t,this.Fn={Vt:this.constructor.resultType,strings:t,values:[]}}};Ae.directiveName="unsafeHTML",Ae.resultType=1;var Ti=class extends Ae{};Ti.directiveName="unsafeSVG",Ti.resultType=2;var He=at(Ti);var na="<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 fill='none' viewBox='0 0 24 24' id='uc-icon-preloader' xmlns='http://www.w3.org/2000/svg'><circle cx='12' cy='12' r='11' stroke='currentColor' stroke-linecap='round' style='stroke-dasharray:100 100;stroke-dashoffset:var(--l-progress-offset, 100);transition:stroke-dashoffset .6s linear' transform='rotate(-90 12 12)'/><circle cx='12' cy='12' r='11' stroke='currentColor' stroke-linecap='round' opacity='.2'/></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 Yt=class extends C{constructor(){super(...arguments);this.init$=jn(this);}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 v`${He(na)}`}};var aa=o=>typeof o!="number"?0:Math.floor(o/1e3),la=(o,{threshold:i})=>{let{secureExpire:t}=o,e=aa(Date.now()),r=Number(t),s=aa(i);return e+s>=r};var _r=class extends K{constructor(){super(...arguments);this.ae=null;}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:r,secureUploadsExpireThreshold:s}=this.ee;if((t||e)&&r&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),r){if(!this.ae||la(this.ae,{threshold:s})){this.ae?this.E("Secure signature is expired. Resolving a new one..."):this.E("Secure signature is not set yet.");try{let n=await r();n?!n.secureSignature||!n.secureExpire?console.error("Secure signature resolver returned an invalid result:",n):(this.E("Secure signature resolved:",n),this.E("Secure signature will expire in",new Date(Number(n.secureExpire)*1e3).toISOString()),this.ae=n):(this.E("Secure signature resolver returned nothing."),this.ae=null);}catch(n){console.error("Secure signature resolving failed. Falling back to the previous one.",n),this.e.telemetryManager.sendEventError(n,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this.ae}return t&&e?(this.E("Secure signature and expire are set. Using them...",{secureSignature:t,secureExpire:e}),{secureSignature:t,secureExpire:e}):null}destroy(){super.destroy(),this.ae=null;}};var ls=(o,i)=>{if(o.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}};var cs=(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}}};var us=(o,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,r=Ir([...t?wi:[],e]);if(!r.length)return;let s=o.mimeType,n=o.name;if(!s||!n)return;let a=os(s,r),l=Jn(n,r);if(!a&&!l)return {type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:o}}};var ds=(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}}};var Dt=1e3,ke=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Ci=o=>Math.ceil(o*100)/100,ca=(o,i=ke.AUTO)=>{let t=i===ke.AUTO;if(i===ke.BYTE||t&&o<Dt**1){let r=Fr("en-US",o)==="one"?"byte":"bytes";return `${o} ${r}`}return i===ke.KB||t&&o<Dt**2?`${Ci(o/Dt**1)} KB`:i===ke.MB||t&&o<Dt**3?`${Ci(o/Dt**2)} MB`:i===ke.GB||t&&o<Dt**4?`${Ci(o/Dt**3)} GB`:i===ke.TB||t&&o<Dt**5?`${Ci(o/Dt**4)} TB`:`${Ci(o/Dt**5)} PB`};var ps=(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:ca(t)}),payload:{entry:o}}};var hs=(o,i)=>{let{internalId:t}=o;if(!i.m.hasItem(t))return;let r=i.m.read(t)?.getValue("uploadError");if(!r)return;if(r instanceof nt)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}}};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."},Hu=o=>typeof o=="function"?{runOn:"change",validator:o}:o,Br=class extends K{constructor(t){super(t);this.Au=[ds,us,ps,hs];this.ku=[cs,ls];this.Me=new ne(20);this.Nn=F(()=>{this.Me.run();},500);this.Ht=false;this.Oe=new Map;let e=F(()=>{this.runFileValidators("change"),this.runCollectionValidators();},0);this.addSub(this.i.sub(x("maxLocalFileSizeBytes"),e)),this.addSub(this.i.sub(x("multipleMin"),e)),this.addSub(this.i.sub(x("multipleMax"),e)),this.addSub(this.i.sub(x("multiple"),e)),this.addSub(this.i.sub(x("imgOnly"),e)),this.addSub(this.i.sub(x("accept"),e)),this.addSub(this.i.sub(x("validationConcurrency"),r=>{this.Me.concurrency=r;}));}get m(){return this.e.uploadCollection}runFileValidators(t,e){if(this.Ht)return;let r=e??this.m.items();for(let s of r){let n=this.m.read(s);n&&this.Mu(n,t);}}runCollectionValidators(){if(this.Ht)return;let t=this.e.api,e=t.getOutputCollectionState(),r=[],s=this.ee.collectionValidators;for(let n of [...this.ku,...s])try{let a=n(e,t);if(!a)continue;a&&(r.push(this.Vn(a)),a.message||console.warn(Ke.MISSING_ERROR_MESSAGE));}catch(a){console.warn(Ke.COLLECTION_VALIDATION_FAILED,a);}this.i.pub("*collectionErrors",r),r.length>0&&this.e.eventEmitter.emit(A.COMMON_UPLOAD_FAILED,()=>t.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(t){let e=this.Oe.get(t.uid);e&&(e.abortController?.abort(),this.Oe.delete(t.uid));}async Mu(t,e){if(this.Ht)return;let r=this.e.api,s=this._n(t),n=s.promise??Promise.resolve(),a=(async()=>{if(this.Ht||(await n,this.Ht))return;let l=this.Ou(t,e);if(l.length===0||!this.m.hasItem(t.uid))return;t.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let c=r.getOutputItem(t.uid),d=new AbortController;s.abortController=d;let u=this.ee.validationTimeout,h=this.Bn(),m=new Set(l.map(w=>w.validator)),g=[];for(let w of h)if(!m.has(w.validator)){let T=s.lastErrorThrownByValidator.get(w.validator);T&&g.push(T);}let b=l.map(w=>async()=>{if(this.Ht)return;let T=setTimeout(()=>{s.skippedValidators.add(w.validator),d.abort(),console.warn(Ke.FILE_VALIDATION_TIMEOUT);},u);try{let E=await w.validator(c,r,{signal:d.signal});if(!E||d.signal.aborted){s.lastErrorThrownByValidator.set(w.validator,void 0);return}let S=this.Vn(E);s.lastErrorThrownByValidator.set(w.validator,S),g.push(S),E.message||console.warn(Ke.MISSING_ERROR_MESSAGE);}catch(E){d.signal.aborted||(s.skippedValidators.add(w.validator),console.warn(Ke.FILE_VALIDATION_FAILED,E),this.e.telemetryManager.sendEventError(E,`file validator. ${Ke.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(T),w.runOn!=="change"&&s.skippedValidators.add(w.validator);}});if(this.Nn(),await this.Me.add(async()=>{this.Ht||(t.setValue("isQueuedForValidation",false),await Promise.all(b.map(w=>w())).catch(()=>{}));},{autoRun:false}),d.signal.aborted){t.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}t.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:g});})();s.promise=a;try{await a;}finally{s.promise===a&&(s.promise=void 0);}}Vn(t){return {...t,type:t.type??"CUSTOM_ERROR"}}_n(t){let e=this.Oe.get(t.uid);if(e)return e;let r={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this.Oe.set(t.uid,r),r}Bn(){let t=this.ee.fileValidators;return [...this.Au,...t].map(Hu)}Ou(t,e){let r=this._n(t);return this.Bn().filter(s=>!r.skippedValidators.has(s.validator)).filter(s=>s.runOn===e)}destroy(){this.Ht=true,this.Nn.cancel();for(let t of this.Oe.values())t.abortController?.abort(),t.promise=void 0;this.Oe.clear();}};var ua="[Typed State] Wrong property name: ",zr=class{constructor(i){this.at=rt.generateFastUid(),this.J=H.registerCtx(i,this.at);}get uid(){return this.at}setValue(i,t){if(!this.J.has(i)){console.warn(`${ua}${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(`${ua}${String(i)}`),this.J.read(i)}subscribe(i,t){return this.J.sub(i,t)}destroy(){H.deleteCtx(this.at);}};var Hr=class o{constructor(i){this.Kt=Object.create(null);this.rr=new Set;this.or=new Set;this.St=new Set;this.To=new Set;this.Co=new Set;this.Ie=new Set;this.Kn=i.initialValue,this.at=rt.generateFastUid(),this.J=H.registerCtx({},this.at),this.zn=i.watchList||[];let t=Object.create(null);this.Hn=(e,r)=>{this.oi&&window.clearTimeout(this.oi),t[e]||(t[e]=new Set),t[e].add(r),this.oi=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.rr.forEach(s=>{s({...t});}),t=Object.create(null));}),this.jn();},i.handler&&this.observeCollection(i.handler);}static{this.Iu=1e4;}Z(){this.si&&window.clearTimeout(this.si),this.si=window.setTimeout(()=>{let i=new Set(this.Co),t=new Set(this.To);this.Co.clear(),this.To.clear();for(let e of this.or)e?.([...this.St],i,t);this.jn();});}jn(){this.Ie.size!==0&&(this.ni&&window.clearTimeout(this.ni),this.ni=window.setTimeout(()=>{let i=[...this.Ie];this.Ie.clear();for(let t of i)t.destroy();},o.Iu));}observeCollection(i){return this.or.add(i),this.St.size>0&&this.Z(),()=>{this.unobserveCollection(i);}}unobserveCollection(i){this.or.delete(i);}add(i){let t=new zr(this.Kn);for(let[e,r]of Object.entries(i))t.setValue(e,r);return this.St.add(t.uid),this.Z(),this.J.add(t.uid,t),this.Co.add(t),this.zn.forEach(e=>{this.Kt[t.uid]||(this.Kt[t.uid]=[]),this.Kt[t.uid]?.push(t.subscribe(e,()=>{this.Hn(e,t.uid);}));}),t.uid}hasItem(i){return this.St.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.To.add(t),this.Ie.add(t)),this.St.delete(i),this.Z(),this.J.pub(i,void 0),this.Kt[i]?.forEach(e=>{e();}),delete this.Kt[i];}abort(i){this.read(i)?.getValue("isUploading")&&this.remove(i);}abortAll(){this.St.forEach(i=>{this.abort(i);});}clearAll(){this.St.forEach(i=>{this.remove(i);});}observeProperties(i){return this.rr.add(i),()=>{this.unobserveProperties(i);}}unobserveProperties(i){this.rr.delete(i);}findItems(i){let t=[];return this.St.forEach(e=>{let r=this.read(e);r&&i(r)&&t.push(e);}),t}items(){return [...this.St]}get size(){return this.St.size}destroy(){this.oi&&window.clearTimeout(this.oi),this.si&&window.clearTimeout(this.si),this.ni&&window.clearTimeout(this.ni);for(let i of this.Ie)i.destroy();this.Ie.clear(),H.deleteCtx(this.at),this.rr=new Set,this.or=new Set;for(let i of Object.keys(this.Kt))this.Kt[i]?.forEach(t=>{t();}),delete this.Kt[i];}};var L=Object.freeze({PHOTO:"photo",VIDEO:"video"}),St=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var da=o=>({isVideoRecordingEnabled:G(o.cameraModes).includes(L.VIDEO),isPhotoEnabled:G(o.cameraModes).includes(L.PHOTO)});var pa=(o,i)=>{for(let t of o)if(i(t))return t};var ms=(o,i,{timeout:t=1e3,onTimeout:e}={})=>new Promise(r=>{let s,n=setTimeout(()=>{cancelAnimationFrame(s),e?.();},t),a=()=>{for(let l of o)if(i(l)){clearTimeout(n),r(l);return}s=requestAnimationFrame(a);};a();});function Kr(o,i){for(let t in i)t.includes("-")?o.style.setProperty(t,String(i[t])):o.style[t]=String(i[t]);}var Ku=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,ju=new RegExp(`^/?(${Ku.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),ha=({url:o,cdnBase:i})=>{let t=new URL(i),e=new URL(vi),r=new URL(o);if(t.host!==r.host&&e.host!==r.host)return null;let s=ju.exec(r.pathname);if(!s)return null;let[,n,a,l]=s;return n?{uuid:n,cdnUrlModifiers:a||"",filename:l||null}:null};var mt=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",DROPBOX_CHOOSER:"dropboxchooser",GDRIVE:"gdrive",GPHOTOS:"gphotos",BOX:"box",ONEDRIVE:"onedrive"}),Gu=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),R=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",...Gu,...mt}),qu={[mt.DROPBOX_CHOOSER]:mt.DROPBOX},ma=o=>qu[o]??o;var jr=o=>o.uploadCollection.items().map(e=>o.api.getOutputItem(e));function fa(o){let i=new Map;return (...e)=>{let r=JSON.stringify(e);if(i.has(r))return i.get(r);let s=o(...e);return i.set(r,s),s}}var ga=new Set;function Gr(o){ga.has(o)||(ga.add(o),console.warn(o));}function Wu(o){let i=false;return setTimeout(()=>{i=true;},0),e=>((...r)=>(i&&Gr(o),e(...r)))}function va(o){let i={},t=o.ctx,e={progress:()=>t.read("*commonProgress"),errors:()=>t.read("*collectionErrors"),group:()=>t.read("*groupInfo"),totalCount:()=>o.uploadCollection.size,failedCount:()=>i.failedEntries.length,successCount:()=>i.successEntries.length,uploadingCount:()=>i.uploadingEntries.length,status:()=>i.isFailed?"failed":i.isUploading?"uploading":i.isSuccess?"success":"idle",isSuccess:()=>i.allEntries.length>0&&i.errors.length===0&&i.successEntries.length===i.allEntries.length,isUploading:()=>i.allEntries.some(s=>s.status==="uploading"),isFailed:()=>i.errors.length>0||i.failedEntries.length>0,allEntries:()=>jr(o),successEntries:()=>i.allEntries.filter(s=>s.status==="success"),failedEntries:()=>i.allEntries.filter(s=>s.status==="failed"),uploadingEntries:()=>i.allEntries.filter(s=>s.status==="uploading"),idleEntries:()=>i.allEntries.filter(s=>s.status==="idle")},r=Wu("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[s,n]of Object.entries(e)){let a=s,c=fa(r(n));Object.defineProperty(i,a,{get:c,enumerable:true});}return i}var qr=class extends K{constructor(){super(...arguments);this.Se=Vr(()=>this.i);this.addFileFromUrl=(t,{silent:e,fileName:r,source:s}={})=>{let n=this.m.add({externalUrl:t,fileName:r??null,silent:e??false,source:s??R.API});return this.getOutputItem(n)};this.addFileFromUuid=(t,{silent:e,fileName:r,source:s}={})=>{let n=this.m.add({uuid:t,fileName:r??null,silent:e??false,source:s??R.API});return this.getOutputItem(n)};this.addFileFromCdnUrl=(t,{silent:e,fileName:r,source:s}={})=>{let n=ha({url:t,cdnBase:this.cfg.cdnCname});if(!n)throw new Error("Invalid CDN URL");let a=this.m.add({uuid:n.uuid,cdnUrl:t,cdnUrlModifiers:n.cdnUrlModifiers,fileName:r??n.filename??null,silent:e??false,source:s??R.API});return this.getOutputItem(a)};this.addFileFromObject=(t,{silent:e,fileName:r,source:s,fullPath:n}={})=>{let a=this.m.add({file:t,isImage:Be(t),mimeType:t.type||null,fileName:r??t.name,fileSize:t.size,silent:e??false,source:s??R.API,fullPath:n??null});return this.getOutputItem(a)};this.addFileFromUploadcareFile=(t,{silent:e,fileName:r,source:s}={})=>{let n=this.m.add({fileInfo:t,uuid:t.uuid,cdnUrl:t.cdnUrl,fileName:r??t.originalFilename,fileSize:t.size,isImage:t.isImage??false,mimeType:t.contentInfo?.mime?.mime??t.mimeType,uploadProgress:100,silent:e??false,source:s??R.API});return this.getOutputItem(n)};this.removeFileByInternalId=t=>{if(!this.m.read(t))throw new Error(`File with internalId ${t} not found`);this.m.remove(t);};this.uploadAll=()=>{let t=this.m.items().filter(e=>{let r=this.m.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(A.COMMON_UPLOAD_START,this.getOutputCollectionState()));};this.openSystemDialog=(t={})=>{let e=Kt(Ir([this.cfg.accept??"",...this.cfg.imgOnly?wi:[]])),r="uploadcare-file-input",s=document.createElement("input");if(s.setAttribute(r,""),Kr(s,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),s.type="file",s.multiple=this.cfg.multiple,t.captureCamera){s.capture=this.cfg.cameraCapture;let{isPhotoEnabled:n,isVideoRecordingEnabled:a}=da(this.cfg);t.modeCamera===L.PHOTO&&n?s.accept=bi:t.modeCamera===L.VIDEO&&a?s.accept=rs:s.accept=[bi,a&&rs].filter(Boolean).join(",");}else s.accept=e;s.addEventListener("change",()=>{s.files&&([...s.files].forEach(n=>{this.addFileFromObject(n,{source:t.captureCamera?R.CAMERA:R.LOCAL});}),this.e.routerLayer.navigateAfterFileAdd(),s.remove());},{once:true}),document.querySelectorAll(`[${r}]`).forEach(n=>{n.remove();}),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"));};this.initFlow=(t=false)=>{if(this.m.size>0&&!t)this.i.pub("*currentActivity",D.UPLOAD_LIST),this.e.modalManager?.open(D.UPLOAD_LIST);else if(this.Gn?.length===1){let e=this.Gn[0];this.So().then(()=>{let r=this.e.pluginManager.snapshot().sources,s=r.find(n=>n.id===e);if(s){let n=s.expand?.()??[e];n.length===1?(r.find(l=>l.id===n[0])??s).onSelect():(this.i.pub("*currentActivity",D.START_FROM),this.e.modalManager?.open(D.START_FROM));return}this.i.read("*currentActivity")&&this.e.modalManager?.open(this.i.read("*currentActivity"));});}else this.i.pub("*currentActivity",D.START_FROM),this.e.modalManager?.open(D.START_FROM);};this.doneFlow=()=>{let t=pa(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());};this.setCurrentActivity=(t,...e)=>{this.So().then(()=>{this.i.pub("*currentActivityParams",e[0]??{}),this.i.pub("*currentActivity",t),ms(this.e.blocksRegistry,r=>r.activityType===t,{onTimeout:()=>console.warn(`Activity type "${t}" not found in the context`),timeout:100});});};this.on=(t,e)=>this.e.eventEmitter.on(t,e);this.getCurrentActivity=()=>this.i.read("*currentActivity");this.historyBack=()=>{this.i.read("*historyBack")?.();};this.setModalState=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 ms(this.e.blocksRegistry,r=>r.activityType===e,{onTimeout:()=>console.warn(`Activity block "${e}" not found in the context`)}).then(()=>{this.e.modalManager?.open(e);})});};}get m(){return this.e.uploadCollection}get cfg(){return this.ee}get l10n(){return this.Se}removeAllFiles(){this.m.clearAll();}getOutputItem(t){let e=H.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,n=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:n==="success",isUploading:n==="uploading",isFailed:n==="failed",isRemoved:n==="removed",isValidationPending:r.isValidationPending,errors:r.errors,status:n,source:r?.source}}getOutputCollectionState(){return va(this.e)}async So(){return (await this.e.wait("pluginManager")).pluginsReady()}get Gn(){let t=[];return this.cfg.sourceList&&(t=Y(this.cfg.sourceList)),t}};var ya={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 xi=33.333333333333336,k=1,fs=24,ba=6;function ce(o,i){for(let[t,e]of Object.entries(i))o.setAttributeNS(null,t,e.toString());}function yt(o,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",o);return ce(t,i),t}function wa(o,i,t){let{x:e,y:r,width:s,height:n}=o,a=i.includes("w")?0:1,l=i.includes("n")?0:1,c=a===0?-1:1,d=l===0?-1:1,u=[e+a*s+1.5*c,r+l*n+1.5*d-24*t*d],h=[e+a*s+1.5*c,r+l*n+1.5*d],m=[e+a*s-24*t*c+1.5*c,r+l*n+1.5*d],g=`M ${u[0]} ${u[1]} L ${h[0]} ${h[1]} L ${m[0]} ${m[1]}`,b=[h[0],h[1]];return {d:g,center:b}}function Ea(o,i,t){let{x:e,y:r,width:s,height:n}=o,a=i==="n"||i==="s",l=i==="w"||i==="e",c=a?.5:i==="w"?0:1,d=l?.5:i==="n"?0:1,u=i==="w"?-1:i==="e"?1:0,h=i==="n"?-1:i==="s"?1:0,m,g;a?(m=[e+c*s-34*t/2,r+d*n+1.5*h],g=[e+c*s+34*t/2,r+d*n+1.5*h]):(m=[e+c*s+1.5*u,r+d*n-34*t/2],g=[e+c*s+1.5*u,r+d*n+34*t/2]);let b=`M ${m[0]} ${m[1]} L ${g[0]} ${g[1]}`,w=[(m[0]+g[0])/2,(m[1]+g[1])/2];return {d:b,center:w}}function Ta(o){return o===""?"move":["e","w"].includes(o)?"ew-resize":["n","s"].includes(o)?"ns-resize":["nw","se"].includes(o)?"nwse-resize":"nesw-resize"}function Ca({rect:o,delta:[i,t],imageBox:e}){return Ge({...o,x:o.x+i,y:o.y+t},e)}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}}function Zu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:n,height:a}=o;s+=r,a-=r,t&&(n=a*t);let l=o.x+o.width/2-n/2;return s<=e.y&&(s=e.y,a=o.y+o.height-s,t&&(n=a*t,l=o.x+o.width/2-n/2)),l<=e.x&&(l=e.x,s=o.y+o.height-a),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),s=o.y+o.height-a),a<k&&(a=k,t&&(n=a*t,l=o.x+o.width/2-n/2),s=o.y+o.height-a),n<k&&(n=k,t&&(a=n/t,l=o.x+o.width/2-n/2),s=o.y+o.height-a),{x:l,y:s,width:n,height:a}}function Yu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:n,height:a}=o;s+=r,n-=r,t&&(a=n/t);let l=o.y+o.height/2-a/2;return s<=e.x&&(s=e.x,n=o.x+o.width-s,t&&(a=n/t,l=o.y+o.height/2-a/2)),l<=e.y&&(l=e.y,s=o.x+o.width-n),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),s=o.x+o.width-n),a<k&&(a=k,t&&(n=a*t),l=o.y+o.height/2-a/2,s=o.x+o.width-n),n<k&&(n=k,t&&(a=n/t),l=o.y+o.height/2-a/2,s=o.x+o.width-n),{x:s,y:l,width:n,height:a}}function Xu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:n,height:a}=o;a+=r,t&&(n=a*t);let l=o.x+o.width/2-n/2;return s+a>=e.y+e.height&&(a=e.y+e.height-s,t&&(n=a*t),l=o.x+o.width/2-n/2),l<=e.x&&(l=e.x,s=o.y),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),s=o.y),a<k&&(a=k,t&&(n=a*t),l=o.x+o.width/2-n/2),n<k&&(n=k,t&&(a=n/t),l=o.x+o.width/2-n/2),{x:l,y:s,width:n,height:a}}function Qu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:n,height:a}=o;n+=r,t&&(a=n/t);let l=o.y+o.height/2-a/2;return s+n>=e.x+e.width&&(n=e.x+e.width-s,t&&(a=n/t),l=o.y+o.height/2-a/2),l<=e.y&&(l=e.y,s=o.x),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),s=o.x),a<k&&(a=k,t&&(n=a*t),l=o.y+o.height/2-a/2),n<k&&(n=k,t&&(a=n/t),l=o.y+o.height/2-a/2),{x:s,y:l,width:n,height:a}}function Ju({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+r<e.x&&(r=e.x-n),a+s<e.y&&(s=e.y-a),n+=r,l-=r,a+=s,c-=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a-=s,a<=e.y&&(c=c-(e.y-a),l=c*t,n=o.x+o.width-l,a=e.y)):t&&(r=c*t-l,l=l+r,n-=r,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=o.y+o.height-c)),c<k&&(c=k,t&&(l=c*t),n=o.x+o.width-l,a=o.y+o.height-c),l<k&&(l=k,t&&(c=l/t),n=o.x+o.width-l,a=o.y+o.height-c),{x:n,y:a,width:l,height:c}}function td({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+l+r>e.x+e.width&&(r=e.x+e.width-n-l),a+s<e.y&&(s=e.y-a),l+=r,a+=s,c-=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a-=s,a<=e.y&&(c=c-(e.y-a),l=c*t,n=o.x,a=e.y)):t&&(r=c*t-l,l+=r,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=o.y+o.height-c)),c<k&&(c=k,t&&(l=c*t),a=o.y+o.height-c),l<k&&(l=k,t&&(c=l/t),a=o.y+o.height-c),{x:n,y:a,width:l,height:c}}function ed({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+r<e.x&&(r=e.x-n),a+c+s>e.y+e.height&&(s=e.y+e.height-a-c),n+=r,l-=r,c+=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=o.x+o.width-l,a=e.y+e.height-c)):t&&(r=c*t-l,l+=r,n-=r,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=o.y)),c<k&&(c=k,t&&(l=c*t),n=o.x+o.width-l),l<k&&(l=k,t&&(c=l/t),n=o.x+o.width-l),{x:n,y:a,width:l,height:c}}function id({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+l+r>e.x+e.width&&(r=e.x+e.width-n-l),a+c+s>e.y+e.height&&(s=e.y+e.height-a-c),l+=r,c+=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=o.x,a=e.y+e.height-c)):t&&(r=c*t-l,l+=r,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=o.y)),c<k&&(c=k,t&&(l=c*t)),l<k&&(l=k,t&&(c=l/t)),{x:n,y:a,width:l,height:c}}function xa({direction:o,...i}){switch(o){case "n":return Zu(i);case "w":return Yu(i);case "s":return Xu(i);case "e":return Qu(i);case "nw":return Ju(i);case "ne":return td(i);case "sw":return ed(i);case "se":return id(i);default:return i.rect}}function Sa(o,[i,t]){return o.x<=i&&i<=o.x+o.width&&o.y<=t&&t<=o.y+o.height}function Aa(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}function ka(o,i){return Math.abs(o.width/o.height-i)<.1}function qe({width:o,height:i},t){let e=t/90%2!==0;return {width:e?i:o,height:e?o:i}}function Ma(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 n=Math.round((o-r)/2),a=Math.round((i-s)/2);return n+r>o&&(r=o-n),a+s>i&&(s=i-a),{x:n,y:a,width:r,height:s}}function We(o){return {x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)}}function ue(o,i,t){return Math.min(Math.max(o,i),t)}var Si=["free"],Zr=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&&!Si.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}let n=Number(r.slice(0,s)),a=Number(r.slice(s+1));if((!Number.isFinite(n)||!Number.isFinite(a)||n<=0||a<=0)&&!Si.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}t.push({id:rt.generateFastUid(),type:"aspect-ratio",width:Si.includes(r)?0:n,height:Si.includes(r)?0:a,hasFreeform:Si.includes(r)});}return t},Ia=(o,i,t,e=.1)=>{let r=o/i,s=null,n=1/0;for(let a of t){let[l,c]=[a.width,a.height],d=l/c,u=Math.abs(r-d);u<n&&(n=u,s=a);}if(s){let[a,l]=[s.width,s.height],c=a/l;if(Math.abs(r-c)/c>e)return null}return s};function Oa(o){return jo({...o,libraryName:Ut,libraryVersion:Rt})}var La="active",Ze="___ACTIVITY_IS_ACTIVE___",Pa,$=class o extends(Pa=C,Pa){constructor(){super(...arguments);this.historyTracked=false;this.activityType=null;this.init$=Qo(this);this.Pu=F(this.Lu.bind(this),10);}qn(){let t=o.ai.get(this);this[Ze]=false,this.removeAttribute(La),t?.deactivateCallback?.();}Ru(){let t=o.ai.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Ze]=true,this.setAttribute(La,""),t?.activateCallback?.(),this.Pu(),this.emit(A.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.qn():this.activityType===t&&!this[Ze]&&this.Ru();}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"]=[]);}));}Lu(){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);}Wn(){return !!this.activityType&&o.ai.has(this)}static{this.ai=new Map;}get isActivityActive(){return !!this[Ze]}get couldOpenActivity(){return true}registerActivity(t,e={}){let{onActivate:r,onDeactivate:s}=e;o.ai.set(this,{activateCallback:r,deactivateCallback:s});}Uu(){this.isActivityActive&&this.qn(),o.ai.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.Wn()&&this.Uu();}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(n=>n.activityType===e)?.couldOpenActivity??false),e=r?e:null,this.$["*currentActivity"]=e??null,e&&this.modalManager?.open(e),this.$["*history"]=t,e||this.modalManager?.closeAll();}}};$.activities=D;var M=class o extends ${constructor(){super(...arguments);this.couldBeCtxOwner=false;this.sr=false;this.init$=Jo(this);this.Mo=F(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(A.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this.Vu(e);},300);this.Fu=(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(A.FILE_ADDED,this.api.getOutputItem(s.uid)),this.e.wait("pluginManager").then(n=>n.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 n=s?.getValue("thumbUrl");n&&URL.revokeObjectURL(n),this.emit(A.FILE_REMOVED,this.api.getOutputItem(s.uid));}this.$["*uploadList"]=t.map(s=>({uid:s})),this.Xn(),this.Mo();}};this.Nu=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(n=>t.fileInfo?.has(n)&&!!H.getCtx(n)?.store.fileInfo);s.length>0&&this.validationManager.runFileValidators("upload",s),this.validationManager.runFileValidators("change",r);}),t.uploadProgress){for(let s of t.uploadProgress){let n=H.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(A.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(s));}this.Xn();}if(t.isUploading)for(let s of t.isUploading){let n=H.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(A.FILE_UPLOAD_START,this.api.getOutputItem(s));}if(t.fileInfo){for(let s of t.fileInfo){let n=H.getCtx(s);if(!n)continue;let{fileInfo:a,silent:l}=n.store;a&&!l&&this.emit(A.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(s));}this.cfg.cropPreset&&this._u();}if(t.errors){this.validationManager.runCollectionValidators();for(let a of t.errors){let l=H.getCtx(a);if(!l)continue;let{errors:c}=l.store;c.length>0&&(this.emit(A.FILE_UPLOAD_FAILED,this.api.getOutputItem(a)),this.emit(A.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let s=e.findItems(a=>!!a.getValue("fileInfo")),n=e.findItems(a=>a.getValue("errors").length>0);e.size>0&&n.length===0&&e.size===s.length&&this.$["*collectionErrors"].length===0&&this.emit(A.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}t.cdnUrl&&([...t.cdnUrl].filter(n=>!!this.uploadCollection.read(n)?.getValue("cdnUrl")).forEach(n=>{this.emit(A.FILE_URL_CHANGED,this.api.getOutputItem(n));}),this.$["*groupInfo"]=null);};this.Xn=()=>{let t=0,r=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));r.forEach(n=>{let a=this.uploadCollection.readProp(n,"uploadProgress");typeof a=="number"&&(t+=a);});let s=r.length?Math.round(t/r.length):0;this.$["*commonProgress"]!==s&&(this.$["*commonProgress"]=s,this.emit(A.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}get $u(){return this.hasBlockInCtx(t=>t instanceof o?t.sr&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this.Y("*uploadCollection",()=>new Hr({initialValue:ya,watchList:["file","uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]})),this.Y("*secureUploadsManager",t=>new _r(t)),this.Y("*validationManager",t=>new Br(t)),this.Y("*publicApi",t=>new qr(t)),!this.$u&&this.couldBeCtxOwner&&this.Du();}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.sr&&this.Zn(),this.Mo.cancel();}connectedCallback(){super.connectedCallback(),this.sr&&this.Yn();}Du(){this.sr=true,this.Yn(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}Yn(){this.Zn(),this.Ao=this.uploadCollection.observeCollection(this.Fu),this.ko=this.uploadCollection.observeProperties(this.Nu);}Zn(){this.ko?.(),this.Ao?.(),this.ko=void 0,this.Ao=void 0;}async Vu(t){let e=await this.getUploadClientOptions(),r=t.allEntries.map(l=>l.uuid+(l.cdnUrlModifiers?`/${l.cdnUrlModifiers}`:"")),s=new AbortController,n=await Kn(r,{...e,signal:s.signal});if(this.$["*collectionState"]!==t){s.abort();return}this.$["*groupInfo"]=n;let a=this.api.getOutputCollectionState();this.emit(A.GROUP_CREATED,a),this.emit(A.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.$["*collectionState"]=a;}_u(){let t=Zr(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 n=s.getValue("fileInfo");if(!n||!n.imageInfo){console.warn("Failed to get image info for entry",s.uid);continue}let{width:a,height:l}=n.imageInfo,c=typeof e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,d=Ma(a,l,c),u=ot(`crop/${d.width}x${d.height}/${d.x},${d.y}`,"preview"),h=s.getValue("cdnUrl");if(!h){console.warn("Failed to get cdnUrl for entry",s.uid);continue}s.setMultipleValues({cdnUrlModifiers:u,cdnUrl:Z(h,u)});}}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:Oa,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 jr(this.e)}};M.extSrcList=Object.freeze({...mt});M.sourceTypes=Object.freeze({...R});var de=class extends C{constructor(){super(...arguments);this.name="";this.nr="";this.li=null;this.Qn=null;}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",e=>{this.Qn=e,this.Oo();});let t=this.e.pluginManager;t?.onPluginsChange&&(this.S=t.onPluginsChange(()=>this.Oo()));}willUpdate(t){super.willUpdate(t),t.has("name")&&this.Oo();}Oo(){if(!this.name){this.nr="",this.li=null;return}let e=this.e.pluginManager?.snapshot().icons.find(n=>n.name===this.name);if(e){this.li=e.svg,this.nr="";return}this.li=null;let r=`#uc-icon-${this.name}`,s=this.Qn?.(this.name);this.nr=s??r;}render(){return this.li?v`${this.yield("",v`${He(this.li)}`)}`:v` ${this.yield("",v`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.nr}></use></svg>`)} `}disconnectedCallback(){this.S?.(),this.S=void 0,super.disconnectedCallback();}};p([y({type:String})],de.prototype,"name",2),p([f()],de.prototype,"nr",2),p([f()],de.prototype,"li",2);var Ua=o=>[...new Set(o)];var Me="--uc-img-",gs="unresolved";var vs=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),ys=3e3,bs=5e3,ws=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var rd="https://ucarecdn.com",Ye=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:rd},"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 Yr=class extends $e(De(Ct)){constructor(){super();this.Pe={};this.c=new Map;this.Le=null;this.ar=null;for(let t in Ye){let e=Ye[t];this.Pe[Me+t]=e?.default||"";}}createRenderRoot(){return this}$$(t){return this.Pe[Me+t]}set$$(t){for(let e in t){let r=Me+e,s=t[e];this.Pe[r]=s,this.Z(r,s);}}sub$$(t,e){let r=Me+t;this.c.has(r)||this.c.set(r,new Set),this.c.get(r)?.add(e);let s=this.Pe[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/${Ut}/${Rt}/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.Le=new IntersectionObserver(s=>{s.forEach(n=>{n.isIntersecting&&(e(),this.Le?.unobserve(t));});},r),this.Le.observe(t),this.ar||(this.ar=new Set),this.ar.add(t);}connectedCallback(){super.connectedCallback(),this.Bu();}Bu(){for(let t in Ye){let e=Me+t,r=this.getCssData(e,true);r!=null&&(this.Pe[e]=r);}}disconnectedCallback(){super.disconnectedCallback(),this.Le&&(this.ar?.forEach(t=>{this.Le?.unobserve(t);}),this.Le=null),this.c.clear();}static get observedAttributes(){return Object.keys(Ye)}attributeChangedCallback(t,e,r){window.setTimeout(()=>{let s=Me+t;this.Pe[s]=r,this.Z(s,r);});}};var Ra=o=>Object.entries(o).filter(([i,t])=>t!==void 0&&t!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`);var Jr=class extends Yr{constructor(){super(...arguments);this.Rt=new Image;this.At=new Image;}Jn(t){return !t.includes("//")&&!vs&&(t=new URL(t,document.baseURI).href),t}lr(t){if(!t)return;let e=t,r=e.match(/\d+/)?.[0],s=e.match(/[a-zA-Z]+/)?.[0];if(!r||!s)return;let n=parseInt(r,10);return Number(n)>bs&&this.ta?bs+s:Number(n)>ys&&!this.ta?ys+s:t}zu(t,e){let r={format:this.Io("format"),quality:this.Io("quality"),resize:this.lr(t),blur:e,"cdn-operations":this.Io("cdn-operations")??void 0,analytics:this.analyticsParams()};return ot(...Ra(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(vs&&r&&!r.includes("//"))return this.ci(r);let s=this.zu(t,e),n=this.$$("cdn-cname"),a=n;if(r.startsWith(String(n)))return Z(r,s);let l=this.$$("uuid");if(a&&l)return this.ci(Z(re(a,l),s));if(l)return this.ci(Z(re(a,l),s));let c=this.$$("proxy-cname");if(c)return this.ci(Z(c,s,this.Jn(r)));let d=this.$$("pubkey");if(d)return this.ci(Z(`https://${d}.ucr.io/`,s,this.Jn(r)))}ci(t){let e=this.$$("secure-delivery-proxy");return e?ze(e,{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}Re(t,e=1,r=true){let s=t.getBoundingClientRect(),n=e*Math.round(s.width),a=r?"":e*Math.round(s.height);return n||a?`${n||""}x${a||""}`:null}Hu(t){let e=s=>{s.stopPropagation();let n=new Event(s.type,s);this.dispatchEvent(n);},r=["load","error"];for(let s of r)t.addEventListener(s,e);}get img(){return this.Ut||(this.Po({elNode:this.Rt}),this.appendChild(this.Rt)),this.Rt}get cr(){return this.Ut?{type:ws.PREVIEW,img:this.At}:{type:ws.MAIN,img:this.img}}get Ut(){return this.$$("is-preview-blur")}get ea(){return this.$$("is-background-for")}get ia(){let t=this.$$("breakpoints");if(t){let e=Y(t);return Ua(e.map(r=>parseInt(r,10)))}else return null}get ta(){return this.$$("format").toLowerCase()==="jpeg"}ra(t){let e=new Set;e.add(`url("${this.gt(this.Re(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this.gt(this.Re(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this.gt(this.Re(t,3))}") ${3}x`);let r=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",r),t.style.setProperty("background-image",`-webkit-${r}`);}oa(){let t=new Set;return this.ia?this.ia.forEach(e=>{t.add(`${this.gt(`${e}x`)} ${this.lr(`${e}w`)}`),this.$$("hi-res-support")&&t.add(`${this.gt(`${e*2}x`)} ${this.lr(`${e*2}w`)}`),this.$$("ultra-res-support")&&t.add(`${this.gt(`${e*3}x`)} ${this.lr(`${e*3}w`)}`);}):(t.add(`${this.gt(this.Re(this.cr.img))} 1x`),this.$$("hi-res-support")&&t.add(`${this.gt(this.Re(this.cr.img,2))} 2x`),this.$$("ultra-res-support")&&t.add(`${this.gt(this.Re(this.cr.img,3))} 3x`)),[...t].join()}sa(){return this.gt()}get na(){return this.gt("100x","100")}Ku(){let t=this.ea;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.ra(e);}):this.ra(e);});}ju({elNode:t,src:e,srcset:r}){e&&(t.src=e),r&&(t.srcset=r);}Po({elNode:t}){this.Hu(t),this.initAttributes(t);}Lo({src:t,srcset:e,elNode:r}){return new Promise((s,n)=>{this.Po({elNode:r}),r.setAttribute(gs,""),r.addEventListener("load",()=>{r.removeAttribute(gs),s(r);}),r.addEventListener("error",()=>{n(false);}),this.ju({elNode:r,src:t,srcset:e});})}async Gu(){if(this.$$("intersection")){this.Ut&&(this.Po({elNode:this.At}),this.appendChild(this.At)),this.initIntersection(this.cr.img,async()=>{this.Ut&&(this.At.src=this.na);try{await this.Lo({src:this.sa(),srcset:this.oa(),elNode:this.Rt}),this.Ut&&await this.At.remove(),this.appendChild(this.Rt);}catch{this.Ut&&await this.At?.remove(),this.appendChild(this.Rt);}});return}try{this.Ut&&(await this.Lo({src:this.na,elNode:this.At}),this.appendChild(this.At)),await this.Lo({src:this.sa(),srcset:this.oa(),elNode:this.Rt}),this.Ut&&await this.At?.remove(),this.appendChild(this.Rt);}catch{this.Ut&&await this.At?.remove(),this.appendChild(this.Rt);}}init(){this.ea?this.Ku():this.Gu();}};var Es=class extends Jr{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:od}=fn,$a=o=>o;var Ts=(o,i)=>o?.Vt!==void 0,Fa=o=>o?.Vt?.h!=null;var Va=o=>o.strings===void 0,Da=()=>document.createComment(""),Xt=(o,i,t)=>{let e=o.Pt.parentNode,r=i===void 0?o.xe:i.Pt;if(t===void 0){let s=e.insertBefore(Da(),r),n=e.insertBefore(Da(),r);t=new od(s,n,o,o.options);}else {let s=t.xe.nextSibling,n=t.f,a=n!==o;if(a){let l;t.qu?.(o),t.f=o,t._i!==void 0&&(l=o.X)!==n.X&&t._i(l);}if(s!==r||a){let l=t.Pt;for(;l!==s;){let c=$a(l).nextSibling;$a(e).insertBefore(l,r),l=c;}}}return t},pe=(o,i,t=o)=>(o.Et(i,t),o),sd={},Ai=(o,i=sd)=>o.r=i,ki=o=>o.r,to=o=>{o.Ee(),o.Pt.remove();},Na=o=>{o.Ee();};var Mi=(o,i)=>{let t=o.xt;if(t===void 0)return false;for(let e of t)e.pn?.(i,false),Mi(e,i);return true},eo=o=>{let i,t;do{if((i=o.f)===void 0)break;t=i.xt,t.delete(o),o=i;}while(t?.size===0)},_a=o=>{for(let i;i=o.f;o=i){let t=i.xt;if(t===void 0)i.xt=t=new Set;else if(t.has(o))break;t.add(o),ld(i);}};function nd(o){this.xt!==void 0?(eo(this),this.f=o,_a(this)):this.f=o;}function ad(o,i=false,t=0){let e=this.r,r=this.xt;if(r!==void 0&&r.size!==0)if(i)if(Array.isArray(e))for(let s=t;s<e.length;s++)Mi(e[s],false),eo(e[s]);else e!=null&&(Mi(e,false),eo(e));else Mi(this,o);}var ld=o=>{o.type==$t.CHILD&&(o._i??=ad,o.qu??=nd);},io=class extends ht{constructor(){super(...arguments),this.xt=void 0;}oo(i,t,e){super.oo(i,t,e),_a(this),this.isConnected=i.X;}pn(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(Mi(this,i),eo(this));}setValue(i){if(Va(this.ir))this.ir.Et(i,this);else {let t=[...this.ir.r];t[this.Su]=i,this.ir.Et(t,this,0);}}disconnected(){}reconnected(){}};var I=()=>new xs,xs=class{},Cs=new WeakMap,O=at(class extends io{render(o){return P}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)),P}rt(o){if(this.isConnected||(o=void 0),typeof this.G=="function"){let i=this.ht??globalThis,t=Cs.get(i);t===void 0&&(t=new WeakMap,Cs.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"?Cs.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 Ss=null,Ii=class extends C{constructor(){super(...arguments);this.dialogEl=I();this.strokes=false;this.blockBodyScrolling=false;this.closeDialog=()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="",this.$["*currentActivity"]=null);};this.Wu=()=>{this.closeDialog();};this.Zu=t=>{this.Ro=t.target;};this.Yu=t=>{let e=t.target;e===this.dialogEl.value&&e===this.Ro&&this.closeDialog();};this.ui=({id:t})=>{t===this.id?(Ss=t,this.show(),this.emit(A.MODAL_OPEN,{modalId:t},{debounce:true})):this.hide();};this.di=({id:t})=>{t===this.id&&(this.hide(),this.emit(A.MODAL_CLOSE,{modalId:t,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true}));};this.aa=t=>{this.hide(),Ss===this.id&&this.emit(A.MODAL_CLOSE,{modalId:Ss,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true});};}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.ui),this.modalManager?.subscribe(X.CLOSE,this.di),this.modalManager?.subscribe(X.CLOSE_ALL,this.aa);}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this.Ro=void 0,this.modalManager?.unsubscribe(X.OPEN,this.ui),this.modalManager?.unsubscribe(X.CLOSE,this.di),this.modalManager?.unsubscribe(X.CLOSE_ALL,this.aa);}Xu(t){this.dialogEl={value:t},this.dialogEl.value?.addEventListener("close",this.Wu),this.dialogEl.value?.addEventListener("mousedown",this.Zu),this.dialogEl.value?.addEventListener("mouseup",this.Yu);}render(){return v`<dialog ${O(this.Xu)}>${this.yield("")}</dialog>`}};p([y({type:Boolean,noAccessor:true})],Ii.prototype,"strokes",2),p([y({type:Boolean,attribute:"block-body-scrolling",noAccessor:true})],Ii.prototype,"blockBodyScrolling",2);var ro=class extends M{constructor(){super(...arguments);this.K=null;this.ur=null;}get la(){return this.nameAttrValue??this.ctxName}ca(){let t=document.createElement("input");return t.type="text",t.name=this.la,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,Kr(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.K=this.ca(),this.appendChild(this.K),this.sub("*collectionState",t=>{if(!t)return;if(!this.ur){let n=document.createElement("div");this.appendChild(n),this.ur=n;}if(!this.K){let n=this.ca();this.appendChild(n),this.K=n;}if(this.ur.innerHTML="",t.status==="uploading"||t.status==="idle"){this.K.value="",this.K.setCustomValidity("");return}if(t.status==="failed"){let n=t.errors[0]?.message;this.K.value="",this.K.setCustomValidity(n??"");return}let e=t.group?t.group:null;if(e){this.K.value=e.cdnUrl??"",this.K.setCustomValidity("");return}let r=t.allEntries.map(n=>n.cdnUrl).filter(n=>typeof n=="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 n of r){let a=document.createElement("input");a.type="hidden",a.name=`${this.la}[]`,a.value=n,s.appendChild(a);}this.ur.replaceChildren(s);},false);}};p([y({type:String,noAccessor:true,attribute:"name"})],ro.prototype,"nameAttrValue",2);var As=class extends C{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i);});}render(){return v`<a href="https://uploadcare.com/?utm_source=copyright&amp;utm_medium=referral&amp;utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`}};var Xe=class extends C{constructor(){super(...arguments);this.hasFileName=false;this.value=0;this.visible=true;this.vt=0;this.dr=I();this.ua=()=>{let t=this.dr.value;if(t){if(!this.visible){t.classList.add("uc-fake-progress--hidden");return}this.vt>0&&t.classList.add("uc-fake-progress--hidden");}};}firstUpdated(t){super.firstUpdated(t),this.vt=this.Uo(this.value),this.$o(),this.dr.value?.addEventListener("animationiteration",this.ua);}updated(t){if(super.updated(t),t.has("value")){let e=this.Uo(this.value);if(!this.visible)this.vt=e;else {let r=Math.max(this.vt,e);r!==this.vt&&(this.vt=r,this.$o());}}t.has("visible")&&(this.classList.toggle("uc-progress-bar--hidden",!this.visible),this.visible?this.$o():this.vt=this.Uo(this.value));}disconnectedCallback(){super.disconnectedCallback(),this.dr.value?.removeEventListener("animationiteration",this.ua);}Uo(t){return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}$o(){this.visible&&this.style.setProperty("--l-progress-value",this.vt.toString());}render(){return v`<div ${O(this.dr)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}};p([y({type:Boolean,noAccessor:true})],Xe.prototype,"hasFileName",2),p([y({type:Number})],Xe.prototype,"value",2),p([y({type:Boolean,reflect:true})],Xe.prototype,"visible",2);var Oi=class extends M{constructor(){super();this.kt=false;this.Ue=0;this.init$={...this.init$,"*commonProgress":0};}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.Ue=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 v`<uc-progress-bar .value=${this.Ue} .visible=${this.kt}></uc-progress-bar>`}};p([f()],Oi.prototype,"kt",2),p([f()],Oi.prototype,"Ue",2);var Qe=class extends C{constructor(){super(...arguments);this.value="";this.disabled=false;this.options=[];this.Qu=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")));};}render(){return v`<select @change=${this.Qu} .value=${this.value} ?disabled=${this.disabled}>${this.options.map(t=>v`<option value=${t.value}>${t.text}</option>`)}</select>`}};p([y({type:String,attribute:false})],Qe.prototype,"value",2),p([y({type:Boolean,reflect:true})],Qe.prototype,"disabled",2),p([y({type:Array,attribute:false})],Qe.prototype,"options",2);var he=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.textOnly=false;this.iconOnly=false;this.Fo="default";this.pr="";}willUpdate(t){super.willUpdate(t),t.has("source")&&this.Ju(this.source);}Ju(t){if(!t){this.pr="",this.Fo="default";return}let{label:e,icon:r,id:s}=t;this.pr=e,this.Fo=r??s??"default";}activate(){this.source&&(this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{sourceId:this.source.id}}),this.source.onClick());}render(){return v`<button aria-label=${this.l10n(this.pr)} type="button" @click=${this.activate}>${this.textOnly?"":v`<uc-icon name=${this.Fo}></uc-icon>`} ${this.iconOnly?"":v`<div class="uc-txt">${this.l10n(this.pr)}</div>`}</button>`}};p([y({attribute:false})],he.prototype,"source",2),p([y({type:Boolean})],he.prototype,"textOnly",2),p([y({type:Boolean})],he.prototype,"iconOnly",2),p([f()],he.prototype,"Fo",2),p([f()],he.prototype,"pr",2);var Je=class{constructor(i,t){this.da=[];this.i=t.ctx,this.e=t.sharedInstancesBag,this.pa=t.onSourcesChange,i.addController(this);}hostConnected(){this.No=this.i.sub(x("sourceList"),t=>{this.da=Y(t),this.Vo();});let i=this.e.pluginManager;i?.onPluginsChange&&(this.S=i.onPluginsChange(()=>this.Vo())),this.Vo();}hostDisconnected(){this.S?.(),this.S=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.da.forEach(s=>{let n=this.td(s,e);if(n.length!==1||n[0]!==s){for(let c of n){let d=e.get(c);d&&r.push(this.ha(d));}return}let l=e.get(s);l&&r.push(this.ha(l));}),this.pa(r);}td(i,t){let e=t.get(i);return e?.expand?e.expand():[i]}ha(i){return {id:i.id,label:i.label,icon:i.icon,onClick:()=>i.onSelect()}}};var Li=class extends M{constructor(){super(...arguments);this.b=[];this.wrap=false;}initCallback(){super.initCallback(),new Je(this,{ctx:this.e.ctx,sharedInstancesBag:this.e,onSourcesChange:t=>{this.b=t;}});}updated(t){super.updated(t),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents";}render(){return v`${this.b.map(t=>v`<uc-source-btn role="listitem" .source=${t} data-source-id=${t.id}></uc-source-btn>`)}`}};p([f()],Li.prototype,"b",2),p([y({type:Boolean,attribute:"wrap",noAccessor:true})],Li.prototype,"wrap",2);var ks=class extends C{render(){return v`<div class="uc-spinner"></div>`}};var Ot="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Ie(o){let i=new Image;return {promise:new Promise((r,s)=>{i.src=o,i.onload=()=>r(),i.onerror=n=>s(n);}),image:i,cancel:()=>{i.naturalWidth===0&&(i.src=Ot);}}}function Pi(o){let i=[];for(let s of o){let n=Ie(s);i.push(n);}let t=i.map(s=>s.image);return {promise:Promise.allSettled(i.map(s=>s.promise)),images:t,cancel:()=>{i.forEach(s=>{s.cancel();});}}}function Ms(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((n,a)=>{r.onload=()=>{let l=r.height/r.width;l>1?(t.width=i,t.height=i*l):(t.height=i,t.width=i/l),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(c=>{if(!c){a();return}let d=URL.createObjectURL(c);n(d);});},r.onerror=l=>{a(l);};});return r.src=URL.createObjectURL(o),s}var ti=class extends M{constructor(){super(...arguments);this.hr=new Set;this.entry=null;}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,n)=>{let a=r.subscribe(s,l=>{this.isConnected&&n(l);});this.hr.add(a);})(t,e);}reset(){for(let t of this.hr)t();this.hr=new Set,this.entry=null;}disconnectedCallback(){super.disconnectedCallback(),this.hr=new Set;}};function cd(o){let i=new Blob([o],{type:"image/svg+xml"});return URL.createObjectURL(i)}function oo(o="hsl(209, 21%, 65%)",i=32,t=32){return cd(`<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>`)}var ud=3e3,ei=class extends ti{constructor(){super(...arguments);this.badgeIcon="";this.uid="";this.jt="";this.fa=false;this.fr=null;this.ma=false;this.ed=this.cfg.filesViewMode;this.ga=this.withEntry(async(t,e=false)=>{let r=t.getValue("fileInfo"),s=t.getValue("isImage"),n=t.getValue("uuid"),a=t.getValue("thumbUrl"),l=this.rd(e);if(r&&s&&n){let d=await this.proxyUrl(Z(re(this.cfg.cdnCname,n),ot(t.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${l}x${l}/center`)));if(a===d)return;let{promise:u}=Ie(d);u.then(()=>{t.setValue("thumbUrl",d),a?.startsWith("blob:")&&URL.revokeObjectURL(a);}).catch(async()=>{if(!a?.startsWith("blob:"))try{let h=t.getValue("file");if(!h)return;let m=await Ms(h,l);t.setValue("thumbUrl",m);}catch(h){this.telemetryManager.sendEventError(h,"thumbnail generation. Failed to generate thumb from file");let m=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",oo(m));}});return}if(t.getValue("thumbUrl"))return;let c=t.getValue("file");if(c?.type.includes("image"))try{let d=await Ms(c,l);t.setValue("thumbUrl",d);}catch(d){this.telemetryManager.sendEventError(d,"thumbnail generation. Failed to generate thumb from file");let u=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",oo(u));}else {let d=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",oo(d));}});this.mr=F(this.ga.bind(this),100);}rd(t=false){t&&(this.fr=this.getBoundingClientRect());let e=Math.max(parseInt(String(this?.fr?.height||0),10),parseInt(String(this?.fr?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(e*=window.devicePixelRatio),Math.min(Math.round(e),ud)}od(t,e){return new Promise((r,s)=>{let n=new Image;n.decoding="async";let a=()=>{n&&(n.onload=null,n.onerror=null,n.src=Ot,e?.removeEventListener("abort",l),n=null);},l=()=>{a(),s(new DOMException("Aborted","AbortError"));};if(e){if(e.aborted){l();return}e.addEventListener("abort",l,{once:true});}let c=()=>{a(),r();},d=u=>{a(),s(u);};if(typeof n.decode=="function"){n.src=t,n.decode().then(c).catch(d);return}n.onload=c,n.onerror=d,n.src=t;})}Bo(){this._o?.cancel(),this._o=void 0;}sd(t){if(this.Bo(),!t){this.jt&&(this.jt="");return}if(t===this.jt)return;let e=new AbortController,r={controller:e,cancel:()=>{e.abort(),r.rafId!==void 0&&window.cancelAnimationFrame(r.rafId);}};this._o=r,this.od(t,e.signal).then(()=>{e.signal.aborted||(r.rafId=window.requestAnimationFrame(()=>{e.signal.aborted||(this.jt=t);}));}).catch(s=>{e.signal.aborted||s instanceof DOMException&&s.name==="AbortError"||console.warn("[Thumb] Failed to decode thumbnail image",s);});}gr(t=false){if(this.entry){if(t){this.ga(true);return}this.ma&&this.mr();}}firstUpdated(t){super.firstUpdated(t),this.va();}updated(t){super.updated(t),t.has("uid")&&this.va();}pi(t){let[e]=t;e&&(this.ma=e.isIntersecting,e.isIntersecting&&(this.fr=e.boundingClientRect,this.gr(),this.s?.disconnect()),e.intersectionRatio===0&&this.mr.cancel());}reset(){super.reset(),this.mr.cancel(),this.Bo(),this.jt&&(this.jt="");}va(){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=()=>{this.gr();};this.subEntry("fileInfo",s=>{s?.isImage&&r();}),this.subEntry("thumbUrl",s=>{this.sd(s??void 0);}),this.subEntry("cdnUrlModifiers",r),this.gr(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this.fa&&(this.ed==="list"&&this.gr(true),this.fa=true);});}connectedCallback(){super.connectedCallback(),this.s?.disconnect(),this.s=new window.IntersectionObserver(this.pi.bind(this),{threshold:.1}),this.s.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.mr.cancel(),this.Bo(),this.s?.disconnect();}render(){return v`<div class="uc-thumb"><img class="uc-thumb__img" src=${this.jt||Ot} role="img" alt="Preview of uploaded image" ?hidden=${!this.jt} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}};p([y({type:String})],ei.prototype,"badgeIcon",2),p([y({attribute:false})],ei.prototype,"uid",2),p([f()],ei.prototype,"jt",2);var Is=class extends ${};var Os=class extends ${constructor(){super(...arguments);this.historyTracked=true;this.activityType=$.activities.START_FROM;}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"");}render(){return v`<div class="uc-content">${this.yield("")}</div>`}};var Ls=class extends M{constructor(){super(...arguments);this.ya=null;}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=A;}initCallback(){super.initCallback(),this.ya=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.ya?.();}};var me=(o,i)=>{let t=false,e,r=0,s=((...n)=>{t?(e&&clearTimeout(e),e=setTimeout(()=>{Date.now()-r>=i&&(o(...n),r=Date.now());},Math.max(i-(Date.now()-r),0))):(o(...n),r=Date.now(),t=true);});return Object.defineProperty(s,"cancel",{configurable:false,writable:false,enumerable:false,value:()=>{e&&clearTimeout(e);}}),s};var Ba=(o,i,t)=>{let e=new Map;for(let r=i;r<=t;r++)e.set(o[r],r);return e},Ui=at(class extends ht{constructor(o){if(super(o),o.type!==$t.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=[],n=0;for(let a of o)r[n]=e?e(a,n):n,s[n]=t(a,n),n++;return {values:s,keys:r}}render(o,i,t){return this.dt(o,i,t).values}update(o,[i,t,e]){let r=ki(o),{values:s,keys:n}=this.dt(i,t,e);if(!Array.isArray(r))return this.ut=n,s;let a=this.ut??=[],l=[],c,d,u=0,h=r.length-1,m=0,g=s.length-1;for(;u<=h&&m<=g;)if(r[u]===null)u++;else if(r[h]===null)h--;else if(a[u]===n[m])l[m]=pe(r[u],s[m]),u++,m++;else if(a[h]===n[g])l[g]=pe(r[h],s[g]),h--,g--;else if(a[u]===n[g])l[g]=pe(r[u],s[g]),Xt(o,l[g+1],r[u]),u++,g--;else if(a[h]===n[m])l[m]=pe(r[h],s[m]),Xt(o,r[u],r[h]),h--,m++;else if(c===void 0&&(c=Ba(n,m,g),d=Ba(a,u,h)),c.has(a[u]))if(c.has(a[h])){let b=d.get(n[m]),w=b!==void 0?r[b]:null;if(w===null){let T=Xt(o,r[u]);pe(T,s[m]),l[m]=T;}else l[m]=pe(w,s[m]),Xt(o,r[u],w),r[b]=null;m++;}else to(r[h]),h--;else to(r[u]),u++;for(;m<=g;){let b=Xt(o,l[g+1]);pe(b,s[m]),l[m++]=b;}for(;u<=h;){let b=r[u++];b!==null&&to(b);}return this.ut=n,Ai(o,l),it}});var za="important",dd=" !"+za,Qt=at(class extends ht{constructor(o){if(super(o),o.type!==$t.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(dd);e.includes("-")||s?t.setProperty(e,s?r.slice(0,-11):r,s?za:""):t[e]=r;}}return it}});var lt=at(class extends ht{constructor(o){if(super(o),o.type!==$t.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 it}});var pd="file-item-remove-button",Jt=class extends M{constructor(){super(...arguments);this.uploading=false;this.failed=false;this.success=false;this.idle=false;this.hideRemove=false;this.progress=0;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-action-button"];}get nd(){return Math.min(Math.max(this.progress||0,0),100)}ad(){this.dispatchEvent(new CustomEvent("uc:remove",{bubbles:true,composed:true}));}render(){let t=lt({"uc-remove-btn":true,"uc-mini-btn":true,"uc-idle":this.idle,"uc-uploading":this.uploading,"uc-hide-remove":this.hideRemove,"uc-failed":this.failed,"uc-success":this.success}),e=100-this.nd,r=this.l10n(pd);return v`<button type="button" @click=${this.ad} title=${r} aria-label=${r} class=${t} ><span class="uc-icon-wrap"><uc-icon name="close"></uc-icon><uc-icon name="remove-file"></uc-icon></span><uc-icon name="preloader" class="uc-preloader" style=${Qt({"--l-progress-offset":String(e)})} ></uc-icon></button>`}};p([y({type:Boolean})],Jt.prototype,"uploading",2),p([y({type:Boolean})],Jt.prototype,"failed",2),p([y({type:Boolean})],Jt.prototype,"success",2),p([y({type:Boolean})],Jt.prototype,"idle",2),p([y({type:Boolean})],Jt.prototype,"hideRemove",2),p([y({type:Number})],Jt.prototype,"progress",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")}),j=class j extends ti{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.ba=true;this.uid="";this.zo="";this.Ho="";this.Ko="";this.vt=0;this.ld=false;this.jo="";this.Go=false;this.qo=false;this.Wo=false;this.wa=false;this.xa=false;this.Zo=false;this.Ea="";this.vr=[];this.Ta=false;this.Yo=()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uid&&this.uploadCollection.hasItem(this.uid)&&(this.entry?.getValue("abortController")?.abort(),this.uploadCollection.remove(this.uid));};this.Uh=()=>{this.Ca();};this._=F(()=>this.Sa(),100);this.ud=this.withEntry(me((t,e)=>{let r=t.getValue("errors")?.[0]?.message??"",s=t.getValue("source"),n=t.getValue("externalUrl"),a=e===q.FINISHED,l=e===q.UPLOADING,c=e===q.QUEUED_UPLOADING,d=e===q.QUEUED_VALIDATION,u=e===q.VALIDATION,h=t.getValue("fileName"),m="";r?m="":!a&&n&&s&&Object.values(mt).includes(s)&&(m=this.l10n("waiting-for",{source:this.l10n(`src-type-${ma(s)}`)})),this.Ko=m,this.Ho=r,this.ld=l||c||d||u,this.vt=d||u?0:t.getValue("uploadProgress"),this.Ea=h?this.l10n("a11y-file-item-status",{fileName:h,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._();try{let r=new AbortController;t.setValue("abortController",r);let s=async()=>{t.setValue("isQueuedForUploading",!1);let a=t.getValue("file");if(a instanceof File||a instanceof Blob){let h=(this.e.pluginManager?.snapshot().fileHooks??[]).filter(m=>m.type==="beforeUpload");for(let m of h)try{let g=m.handler({file:a,signal:r.signal}),b=new Promise((T,E)=>setTimeout(()=>E(new Error("beforeUpload hook timed out")),m.timeout)),{file:w}=await Promise.race([g,b]);w!==a&&(a=w,t.setValue("mimeType",a.type||null),t.setValue("isImage",Be(a)),t.setValue("fileSize",a.size),a instanceof File&&t.setValue("fileName",a.name));}catch(g){console.warn(`File hook "beforeUpload" from plugin "${m.pluginId}" failed`,g);}}let l=a||t.getValue("externalUrl")||t.getValue("uuid");if(!l)throw new Error("No file input");let d={...await this.getUploadClientOptions(),fileName:t.getValue("fileName")??void 0,source:t.getValue("source")??void 0,onProgress:u=>{if(u.isComputable){let h=u.value*100;t.setValue("uploadProgress",h);}},signal:r.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",l,d),Yo(l,d)},n=await this.$["*uploadQueue"].add(s);t.setMultipleValues({fileInfo:n,isQueuedForUploading:!1,isUploading:!1,fileName:n.originalFilename,fileSize:n.size,isImage:n.isImage??!1,mimeType:n.contentInfo?.mime?.mime??n.mimeType,uuid:n.uuid,cdnUrl:t.getValue("cdnUrl")??n.cdnUrl,cdnUrlModifiers:t.getValue("cdnUrlModifiers")??"",uploadProgress:100,source:t.getValue("source")??null}),t===this.entry&&this._();}catch(r){let s=r instanceof se&&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._(),this.isConnected&&!s&&this.telemetryManager.sendEventError(r,"file upload. Failed to upload file");}}});}Sa(){let t=this.entry;if(!t)return;let e=q.IDLE;t.getValue("errors").length>0?e=q.FAILED:t.getValue("isQueuedForUploading")?e=q.QUEUED_UPLOADING:t.getValue("isQueuedForValidation")?e=q.QUEUED_VALIDATION:t.getValue("isValidationPending")?e=q.VALIDATION:t.getValue("isUploading")?e=q.UPLOADING:t.getValue("fileInfo")&&(e=q.FINISHED),this.cd(t,e);}cd(t,e){e===q.FAILED?this.jo="badge-error":e===q.FINISHED&&(this.jo="badge-success"),e===q.UPLOADING&&(this.xa=false,this.removeAttribute("focused")),this.qo=e===q.FAILED,this.Wo=e===q.UPLOADING,this.wa=e===q.QUEUED_UPLOADING||e===q.UPLOADING,this.Go=e===q.FINISHED,this.ud(e);}reset(){super.reset(),this._.cancel();}pi(t){let[e]=t;e&&e.isIntersecting&&!this.Ta&&(this.ba=false,this.Ta=true);}Aa(t){this.reset();let e=this.uploadCollection?.read(t);if(this.entry=e,!e){this.le();return}this.subEntry("isQueuedForValidation",()=>{this._();}),this.subEntry("isValidationPending",()=>{this._();}),this.subEntry("uploadProgress",()=>{this._();}),this.subEntry("isQueuedForUploading",()=>{this._();}),this.subEntry("fileName",r=>{this.zo=r||e.getValue("externalUrl")||this.l10n("file-no-name"),this._();}),this.subEntry("externalUrl",r=>{this.zo=e.getValue("fileName")||r||this.l10n("file-no-name");}),this.subEntry("fileInfo",()=>{this._();}),this.subEntry("errors",()=>this._()),this.subEntry("isUploading",()=>this._()),this.subEntry("fileSize",()=>this._()),this.subEntry("mimeType",()=>this._()),this.subEntry("isImage",()=>this._()),this.subEntry("fileInfo",()=>this.le()),this.subEntry("isUploading",()=>this.le()),this.subEntry("errors",()=>this.le()),this.Sa(),this.le();}ka(t){if(this.cfg.filesViewMode==="list"){this.Zo=true;return}this.Zo=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.Aa(this.uid);}le(){let t=this.e.pluginManager;if(!t||!this.uid){this.vr=[];return}let e=t.snapshot().fileActions,r=this.api.getOutputItem(this.uid);if(!r){this.vr=[];return}this.vr=e.filter(s=>{try{return s.shouldRender(r)}catch(n){return console.error(`Error in plugin file action shouldRender (${s.id}):`,n),false}});}dd(t){if(!this.uid)return;let e=this.api.getOutputItem(this.uid);if(e){this.telemetryManager.sendEvent({payload:{metadata:{event:t.id,node:this.tagName,pluginId:t.pluginId}}});try{t.onClick(e);}catch(r){console.error(`Error in plugin file action onClick (${t.id}):`,r);}}}initCallback(){super.initCallback(),this.Aa(this.uid),this.subConfigValue("filesViewMode",e=>{this.ka(this.cfg.gridShowFileNames),this.setAttribute("mode",e);}),this.subConfigValue("gridShowFileNames",e=>{this.ka(e);}),this.onclick=()=>{j.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.S=t.onPluginsChange(()=>this.le())),this.le(),j.activeInstances.add(this);}connectedCallback(){super.connectedCallback(),this.s=new window.IntersectionObserver(this.pi.bind(this),{threshold:[0,1]}),this.s.observe(this);}disconnectedCallback(){this.S?.(),this.S=void 0,super.disconnectedCallback(),this.s?.disconnect(),j.activeInstances.delete(this),this.reset();}static{this.activeInstances=new Set;}shouldUpdate(t){return this.ba?false:super.shouldUpdate(t)}render(){return v`<div class="uc-inner" ?data-finished=${this.Go} ?data-uploading=${this.Wo} ?data-failed=${this.qo} ?data-focused=${this.xa} ><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.Ea}><span class="uc-file-name" ?hidden=${!this.Zo}>${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.vr.map(t=>v`<button type="button" @click=${()=>this.dd(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.Yo} .uploading=${this.Wo} .hideRemove=${this.wa} .progress=${this.vt} .failed=${this.qo} .success=${this.Go} ></uc-file-action-button></div></div>`}};p([f()],j.prototype,"ba",2),p([y({attribute:false})],j.prototype,"uid",2),p([f()],j.prototype,"zo",2),p([f()],j.prototype,"Ho",2),p([f()],j.prototype,"Ko",2),p([f()],j.prototype,"vt",2),p([f()],j.prototype,"ld",2),p([f()],j.prototype,"jo",2),p([f()],j.prototype,"Go",2),p([f()],j.prototype,"qo",2),p([f()],j.prototype,"Wo",2),p([f()],j.prototype,"wa",2),p([f()],j.prototype,"xa",2),p([f()],j.prototype,"Zo",2),p([f()],j.prototype,"Ea",2),p([f()],j.prototype,"vr",2);var Ps=j;function hd(o){return new Promise(i=>{typeof window.FileReader!="function"&&i(false);try{let t=new FileReader;t.onerror=()=>{i(!0);};let e=r=>{r.type!=="loadend"&&t.abort(),i(!1);};t.onloadend=e,t.onprogress=e,t.readAsDataURL(o);}catch{i(false);}})}function md(o,i){return new Promise(t=>{let e=0,r=[],s=a=>{if(!a){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null);return}a.isFile?(e++,a.file(l=>{e--;let c=new File([l],l.name,{type:l.type||i});r.push({type:"file",file:c,fullPath:a.fullPath}),e===0&&t(r);})):a.isDirectory&&n(a.createReader());},n=a=>{e++,a.readEntries(l=>{e--;for(let c of l)s(c);e===0&&t(r);});};s(o);})}function Ha(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,n=r;if(typeof n.webkitGetAsEntry=="function"||typeof n.getAsEntry=="function"){let l=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():n.getAsEntry?.();l&&t.push(md(l,s).then(c=>{c&&i.push(...c);}));continue}let a=r.getAsFile();a&&t.push(hd(a).then(l=>{l||i.push({type:"file",file:a});}));}else r.kind==="string"&&/^text\/uri-list/.test(r.type)&&t.push(new Promise(s=>{r.getAsString(n=>{i.push({type:"url",url:n}),s();});}));}return Promise.all(t).then(()=>i)}var ct=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),Ka=["focus"],fd=100,Us=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))}function Rs(o){let i=0,t=document.body,e=new Set,r=g=>{e.add(g);},s=ct.INACTIVE,n=g=>{o.shouldIgnore()&&g!==ct.INACTIVE||(s!==g&&e.forEach(b=>{b(g);}),s=g);},a=()=>i>0;r(g=>o.onChange(g));let l=()=>{i=0,n(ct.INACTIVE);},c=()=>{i+=1,s===ct.INACTIVE&&n(ct.ACTIVE);},d=()=>{i-=1,a()||n(ct.INACTIVE);},u=g=>{g.preventDefault(),i=0,n(ct.INACTIVE);},h=g=>{if(o.shouldIgnore())return;a()||(i+=1);let b=[g.x,g.y],w=o.element.getBoundingClientRect(),T=Math.floor(gd(b,w)),E=T<fd,S=g.composedPath().includes(o.element);Us.set(o.element,T);let Tt=Math.min(...Us.values())===T;S&&Tt?(g.preventDefault(),n(ct.OVER)):n(E&&Tt?ct.NEAR:ct.ACTIVE);},m=async g=>{if(o.shouldIgnore())return;g.preventDefault();let{dataTransfer:b}=g;if(!b)return;let w=await Ha(b);o.onItems(w),n(ct.INACTIVE);};return t.addEventListener("drop",u),t.addEventListener("dragleave",d),t.addEventListener("dragenter",c),t.addEventListener("dragover",h),o.element.addEventListener("drop",m),Ka.forEach(g=>{window.addEventListener(g,l);}),()=>{Us.delete(o.element),t.removeEventListener("drop",u),t.removeEventListener("dragleave",d),t.removeEventListener("dragenter",c),t.removeEventListener("dragover",h),o.element.removeEventListener("drop",m),Ka.forEach(g=>{window.removeEventListener(g,l);});}}var $s=new Set,bt=class extends M{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.zt=true;this.Ma=true;this.Xo="drop-files-here";this.$e=false;this.Ia=null;this.Qo=null;this.Pa=I();this.De=t=>{if(t instanceof KeyboardEvent){if(t.code!=="Space"&&t.code!=="Enter")return}else if(!(t instanceof MouseEvent))return;if(this.initflow){this.api.initFlow();return}this.api.openSystemDialog();};this.La=true;this.Fe=false;}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}Oa(){let t=this.text;if(typeof t=="string"&&t.length>0){this.Xo=t;return}this.Xo=this.$e?"drop-files-here":"drop-file-here";}isActive(){if(!this.zt)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),n=s.visibility!=="hidden"&&s.display!=="none";return e&&n&&r}initCallback(){super.initCallback(),$s.add(this),this.Jo(),this.ts(),this.Ra(),this.Ua(ct.INACTIVE),this.Ia=Rs({element:this,shouldIgnore:()=>this.$a(),onChange:t=>{this.Ua(t);},onItems:t=>{if(!t.length)return;let e=this.uploadCollection.size;t.forEach(r=>{r.type==="url"?this.api.addFileFromUrl(r.url,{source:R.DROP_AREA}):r.type==="file"&&this.api.addFileFromObject(r.file,{source:R.DROP_AREA,fullPath:r.fullPath});}),this.uploadCollection.size>e&&this.routerLayer.navigateAfterFileAdd();}}),this.updateComplete.then(()=>this.pd()),this.subConfigValue("sourceList",t=>{let e=Y(t);this.La=e.includes(R.LOCAL),this.Jo(),this.ts();}),this.subConfigValue("multiple",t=>{this.$e=!!t,this.Oa();});}willUpdate(t){super.willUpdate(t),t.has("disabled")&&(this.Jo(),this.ts()),(t.has("text")||t.has("localeId"))&&this.Oa();}updated(t){super.updated(t),t.has("clickable")&&this.Ra();}$a(){if(!this.zt||!this.hd())return true;if(!this.fullscreen)return false;let t=$s;return t.size===0?false:[...t].filter(s=>s!==this).filter(s=>s.isActive()).length>0}hd(){let t=this.cfg.multiple,e=this.cfg.multipleMax,r=this.uploadCollection.size;return !(t&&e&&r>=e||!t&&r>0)}Jo(){let t=this.La&&!this.disabled;this.zt=t;}ts(){let t=this.zt||!this.querySelector("[data-default-slot]");this.Ma=t,this.hidden=!t;}Ua(t){let e=Object.entries(ct).find(([,r])=>r===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}pd(){if(this.Qo)return;let t=this.Pa.value;t&&(this.Qo=Rs({element:t,onChange:e=>{let r=Object.entries(ct).find(([,s])=>s===e)?.[0].toLowerCase();r&&t.setAttribute("drag-state",r);},onItems:()=>{},shouldIgnore:()=>this.$a()}));}Ra(){this.clickable&&!this.Fe?(this.addEventListener("keydown",this.De),this.addEventListener("click",this.De),this.Fe=true):!this.clickable&&this.Fe&&(this.removeEventListener("keydown",this.De),this.removeEventListener("click",this.De),this.Fe=false);}disconnectedCallback(){super.disconnectedCallback(),$s.delete(this),this.Ia?.(),this.Qo?.(),this.Fe&&(this.removeEventListener("keydown",this.De),this.removeEventListener("click",this.De),this.Fe=false);}render(){return v` ${this.yield("",v`<div data-default-slot hidden></div><div ${O(this.Pa)} class="uc-content-wrapper" ?hidden=${!this.Ma} ><div class="uc-icon-container" ?hidden=${!this.withIcon}><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">${this.l10n(this.Xo)}</span></div>`)} `}};p([y({type:Boolean,noAccessor:true})],bt.prototype,"single",2),p([y({type:Boolean,noAccessor:true})],bt.prototype,"ghost",2),p([y({type:Boolean,reflect:true})],bt.prototype,"disabled",2),p([y({type:Boolean,reflect:true})],bt.prototype,"clickable",2),p([y({type:Boolean,attribute:"with-icon",reflect:true})],bt.prototype,"withIcon",2),p([y({type:Boolean,reflect:true})],bt.prototype,"fullscreen",2),p([y({type:Boolean,reflect:true})],bt.prototype,"initflow",2),p([y({type:String})],bt.prototype,"text",2),p([f()],bt.prototype,"zt",2),p([f()],bt.prototype,"Ma",2);var Lt=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=$.activities.UPLOAD_LIST;this.Da=false;this.Fa=false;this.Na=false;this.es=false;this.rs=false;this.yr=null;this.Va=false;this.os=null;this._a=()=>{this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this.ss=()=>{this.emit(A.UPLOAD_CLICK),this.api.uploadAll(),this.q();};this.ns=()=>{this.emit(A.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow();};this.$t=()=>{this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll();};this.q=me(()=>{this.isConnected&&(this.gd(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}get fd(){return this.os?this.md(this.os):""}gd(){let t=this.api.getOutputCollectionState(),e={total:t.totalCount,succeed:t.successCount,uploading:t.uploadingCount,failed:t.failedCount,validatingBeforeUploading:t.idleEntries.filter(m=>m.isValidationPending).length},r=!t.errors.some(m=>m.type==="TOO_MANY_FILES"||m.type==="TOO_FEW_FILES"),s=t.errors.some(m=>m.type==="TOO_MANY_FILES"),n=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),a=t.allEntries.some(m=>m.isValidationPending),l=e.failed===0&&t.errors.length===0&&!a,c=false,d=false,u=false;if(e.total-e.succeed-e.uploading-e.failed>0&&r&&l&&this.cfg.confirmUpload)c=true;else {d=true;let m=this.cfg.groupOutput?!!t.group:true;u=e.total===e.succeed&&r&&l&&m;}this.Da=d,this.Fa=u,this.Na=c,this.rs=e.total===0||!s&&!n,this.es=!n||this.cfg.multiple,this.Va=e.total>0,this.os=e;}md(t){let e=r=>{let s=t[r];return r==="uploading"&&(s+=t.validatingBeforeUploading),this.l10n(`header-${r}`,{count:s})};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.yr=null;return}this.yr=e.message;});}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this.q),this.uploadCollection.unobserveCollection(this.q));}render(){return v`<uc-activity-header><span aria-live="polite" class="uc-header-text">${this.fd}</span><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" ?hidden=${this.Va}>${this.yield("empty",v`<span>${this.l10n("no-files")}</span>`)}</div><div class="uc-files"><div class="uc-files-wrapper">${Ui(this.$["*uploadList"]??[],({uid:t})=>t,({uid:t})=>v`<uc-file-item .uid=${t}></uc-file-item>`)}</div><button type="button" class="uc-add-more-btn uc-secondary-btn" @click=${this._a} ?disabled=${!this.rs} ?hidden=${!this.es} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button></div><div class="uc-common-error" ?hidden=${!this.yr} >${this.yr??""}</div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.$t}>${this.l10n("clear")}</button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" ?hidden=${!this.es} ?disabled=${!this.rs} @click=${this._a} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button><button type="button" class="uc-upload-btn uc-primary-btn" ?hidden=${!this.Na} @click=${this.ss} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.Da} ?disabled=${!this.Fa} @click=${this.ns} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};p([f()],Lt.prototype,"Da",2),p([f()],Lt.prototype,"Fa",2),p([f()],Lt.prototype,"Na",2),p([f()],Lt.prototype,"es",2),p([f()],Lt.prototype,"rs",2),p([f()],Lt.prototype,"yr",2),p([f()],Lt.prototype,"Va",2),p([f()],Lt.prototype,"os",2);var vd=[{test:o=>!!o.accept&&!!o.imgOnly,message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:o=>o.enableVideoRecording!==null,message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:o=>o.defaultCameraMode!==null,message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],ja=F(o=>{for(let{test:i,message:t}of vd)i(o)&&Gr(t);},0);var Ga=(o,i)=>{let t=new URL(i);return t.hostname=`${o}.${t.hostname}`,t.toString().replace(/\/$/,"")},yd="0123456789abcdefghijklmnopqrstuvwxyz",qa=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},Ds=(o,i)=>{try{let t=new URL(o),e=new URL(i);return t.hostname.endsWith(e.hostname)}catch{return false}};var bd=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}`)},wd=10,Ed=async o=>{let i=await bd(o);return qa(i).slice(0,wd)},Wa=async(o,i)=>{let t=await Ed(o);return Ga(t,i)};var Za=o=>o instanceof Promise||!!(o&&typeof o=="object"&&"then"in o&&typeof o.then=="function");var Fs=o=>o,Td=[Fs({key:"cameraModes",deps:["enableVideoRecording"],fn:({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")),Kt(e)}}),Fs({key:"cameraModes",deps:["defaultCameraMode"],fn:({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),Kt(e)}}),Fs({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:({pubkey:o,cdnCname:i,cdnCnamePrefixed:t})=>{let e=o(),r=i(),s=t();return e&&(r===vi||Ds(r,s))?Wa(e,s):r}})],Ya=({key:o,setValue:i,getValue:t,computationControllers:e})=>{for(let r of Td){if(!r.deps.includes(o))continue;let s={[r.key]:()=>t(r.key)};for(let l of r.deps)s[l]=()=>t(l);let n=new AbortController;e.get(r.fn)?.abort(),e.set(r.fn,n);let a;try{a=r.fn(s,{signal:n.signal});}catch(l){e.get(r.fn)===n&&e.delete(r.fn),console.error(`Failed to compute value for "${r.key}"`,l);return}Za(a)?a.then(l=>{n.signal.aborted||i(r.key,l);}).catch(l=>{n.signal.aborted||console.error(`Failed to compute value for "${r.key}"`,l);}).finally(()=>{e.get(r.fn)===n&&e.delete(r.fn);}):i(r.key,a);}};var N=o=>String(o),tt=o=>{let i=Number(o);if(Number.isNaN(i))throw new Error(`Invalid number: "${o}"`);return i},_=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}"`)},Xa=o=>o==="auto"?o:_(o),Qa=o=>{let i=N(o);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},Ja=o=>{let i=N(o);if(!Object.values(L).includes(i))throw new Error(`Invalid value: "${i}"`);return i},tl=o=>{let i=N(o),t=G(i);if(t.some(e=>!Object.values(L).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},el=o=>{let i=N(o);if(i==="local"||i==="global")return i;if(_(o)===false)return false;throw new Error(`Invalid value: "${i}"`)},il=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.")},Vs=o=>{if(typeof o=="object")return o;throw new Error("Invalid value. Must be an object.")},so=o=>{if(typeof o=="function")return o;throw new Error("Invalid value. Must be a function.")},no=o=>{if(Array.isArray(o))return o;throw new Error("Must be an array.")},rl=o=>{let i=N(o);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)},ol=o=>{let i=N(o);if(["auto","menu","toolbar","compact"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)};var Cd={pubkey:N,multiple:_,multipleMin:tt,multipleMax:tt,confirmUpload:_,imgOnly:_,accept:N,externalSourcesPreferredTypes:N,externalSourcesEmbedCss:N,store:Xa,cameraMirror:_,cameraCapture:Qa,sourceList:N,topLevelOrigin:N,maxLocalFileSizeBytes:tt,thumbSize:tt,showEmptyList:_,useLocalImageEditor:_,useCloudImageEditor:_,cloudImageEditorTabs:N,removeCopyright:_,cropPreset:N,imageShrink:N,modalScrollLock:_,modalBackdropStrokes:_,sourceListWrap:_,remoteTabSessionKey:N,cdnCname:N,cdnCnamePrefixed:N,baseUrl:N,socialBaseUrl:N,secureSignature:N,secureExpire:N,secureDeliveryProxy:N,retryThrottledRequestMaxTimes:tt,retryNetworkErrorMaxTimes:tt,multipartMinFileSize:tt,multipartChunkSize:tt,maxConcurrentRequests:tt,multipartMaxConcurrentRequests:tt,multipartMaxAttempts:tt,checkForUrlDuplicates:_,saveUrlForRecurrentUploads:_,groupOutput:_,userAgentIntegration:N,debug:_,localeName:N,metadata:il,secureUploadsExpireThreshold:tt,localeDefinitionOverride:o=>Vs(o),secureUploadsSignatureResolver:o=>so(o),secureDeliveryProxyUrlResolver:o=>so(o),iconHrefResolver:o=>so(o),plugins:o=>no(o),fileValidators:no,collectionValidators:no,validationTimeout:tt,validationConcurrency:tt,cameraModes:tl,defaultCameraMode:Ja,enableAudioRecording:_,enableVideoRecording:_,mediaRecorderOptions:Vs,maxVideoRecordingDuration:tt,filesViewMode:rl,gridShowFileNames:_,cloudImageEditorAutoOpen:_,cloudImageEditorMaskHref:N,testMode:_,qualityInsights:_,pasteScope:el,dynamicButtonShowFirstIcon:_,dynamicButtonViewMode:ol},sl=(o,i)=>{if(!(typeof i>"u"||i===null))try{return Cd[o](i)}catch(t){return console.error(`Invalid value for config key "${o}".`,t),J[o]}};var ao=[...new Set(["debug",...Object.keys(J)])],xd=["metadata","plugins","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],al=o=>xd.includes(o),_s=ao.filter(o=>!al(o)),Ns={...Object.fromEntries(_s.map(o=>[yr(o),o])),...Object.fromEntries(_s.map(o=>[o.toLowerCase(),o]))},nl=o=>`__${o}`,ii=class extends C{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(J).map(([t,e])=>[x(t),e]))};this.vd=new Map;this.fi={};this.Ba=new Set;this.Ne=new Map;}as(t){return this.Ba.has(t)}ls(t){let e=this.e.pluginManager;if(e)return e.configRegistry.get(t)}cs(t){return [...new Set([yr(t),t.toLowerCase()])]}yd(t,e){if(al(t)||this.as(t)&&this.ls(t)?.attribute===false)return;let r=this.cs(t);for(let s of r)typeof e>"u"||e===null?this.removeAttribute(s):this.getAttribute(s)!==e.toString()&&this.setAttribute(s,e.toString());}bd(t,e){let r=x(t);if(this.$[r]!==e)if(typeof e>"u"||e===null){let s=J[t];this.$[r]=s!==void 0?s:e;}else this.$[r]=e;}Gt(t,e){let r;if(this.as(t)){let a=this.ls(t);try{r=a?.normalize?.(e)??e;}catch(l){console.warn(`[uc-config] normalize() for "${t}" threw an error, keeping previous value`,l);return}}else r=sl(t,e);let s=this,n=nl(t);s[n]!==r&&(this.wd(t,s[n],r),s[n]=r,this.yd(t,r),this.bd(t,r),this.debugPrint(`"${t}"`,r),this.as(t)||ja(this.cfg));}wr(t){let e=this,r=nl(t);return e[r]??this.$[x(t)]}wd(t,e,r){this.cfg.debug&&r!==e&&typeof r=="object"&&typeof e=="object"&&JSON.stringify(r)===JSON.stringify(e)&&(console.warn(`[uc-config] Option "${t}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${t}" previous value:`,e),console.warn(`[uc-config] "${t}" new value:`,r));}za(t){let e=t.configRegistry.getAll();this.fi={},this.Ba=new Set(e.keys());for(let[r,s]of this.Ne)e.has(r)||(s(),this.Ne.delete(r));for(let[r,s]of e){let a=x(r);if(s.attribute){let m=this.cs(r);for(let g of m)this.fi[g]=r;}let l,c=false,d=Object.getOwnPropertyDescriptor(this,r);if(d&&!d.get&&!d.set&&d.value!==void 0&&(l=d.value,c=true),!c&&s.attribute)for(let m of this.cs(r)){let g=this.getAttribute(m);if(g!=null){try{l=s.fromAttribute?s.fromAttribute(g):g;}catch(b){console.warn(`[uc-config] fromAttribute() for "${r}" threw an error, using raw attribute value`,b),l=g;}c=true;break}}this.sharedCtx.has(a)||this.sharedCtx.add(a,s.defaultValue);let h=Object.getOwnPropertyDescriptor(this,r);if((!h||!h.set||!h.get)&&Object.defineProperty(this,r,{set:m=>{this.Gt(r,m);},get:()=>this.wr(r),enumerable:true,configurable:true}),!this.Ne.has(r)){let m=this.sub(a,g=>{this.Gt(r,g);},false);this.Ne.set(r,m);}c&&this.Gt(r,l);}}xd(){this.e.when("pluginManager",t=>{this.za(t),this.br=t.onPluginsChange(()=>{this.za(t);});});}Ed(){this.hi=new MutationObserver(t=>{for(let e of t)if(e.type==="attributes"&&e.attributeName){let r=e.attributeName,s=e.oldValue,n=this.getAttribute(r);if(s===n||r in Ns)continue;if(r in this.fi){let l=this.fi[r],c=this.ls(l);this.attributeChangedCallback(r,s??"",n??c?.defaultValue??"");}}}),this.hi.observe(this,{attributes:true,attributeOldValue:true});}initCallback(){super.initCallback();let t=this;this.xd(),this.Ed();for(let r of _s)this.sub(x(r),s=>{this.Gt(r,s);},false);for(let r of ao){let s=t[r]??this.$[x(r)];s!==J[r]&&this.Gt(r,s);let n=Object.getOwnPropertyDescriptor(this,r);(!n||!n.set||!n.get)&&Object.defineProperty(this,r,{set:a=>{this.Gt(r,a);},get:()=>this.wr(r)});}let e=r=>{Ya({key:r,setValue:this.Gt.bind(this),getValue:this.wr.bind(this),computationControllers:this.vd});};for(let r of ao)this.sub(x(r),()=>e(r));}attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),e===r)return;let s=this,n=Ns[t];n?s[n]=r:this.e.when("pluginManager",a=>{let l=this.getAttribute(t);if(l&&l!==r)return;let c=this.fi[t],d=c?a.configRegistry.get(c):void 0;if(c&&d){let u=d.fromAttribute?d.fromAttribute(r):r;if(this.wr(c)===u)return;this.Gt(c,u);}});}disconnectedCallback(){super.disconnectedCallback(),this.br&&(this.br(),this.br=void 0),this.hi&&(this.hi.disconnect(),this.hi=void 0);for(let t of this.Ne.values())t();this.Ne.clear();}static get observedAttributes(){let t=super.observedAttributes,e=Object.keys(Ns);return [...t,...e]}};for(let o of ao)ii.prototype[o]=void 0;var Ri=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.mi="upload-file";this.us=()=>{this.api.initFlow();};}static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"];}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.mi=t?"upload-files":"upload-file";});}render(){return v`<uc-drop-area .disabled=${!this.dropzone}><button type="button" @click=${this.us}><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>`}};p([y({attribute:"dropzone",type:Boolean})],Ri.prototype,"dropzone",2),p([f()],Ri.prototype,"mi",2);var ll=o=>Fa(o)?o.Vt.h:o.strings,Oe=at(class extends ht{constructor(o){super(o),this.et=new WeakMap;}render(o){return [o]}update(o,[i]){let t=Ts(this.it)?ll(this.it):null,e=Ts(i)?ll(i):null;if(t!==null&&(e===null||t!==e)){let r=ki(o).pop(),s=this.et.get(t);if(s===void 0){let n=document.createDocumentFragment();s=ar(P,n),s.setConnected(false),this.et.set(t,s);}Ai(s,[r]),Xt(s,void 0,r);}if(e!==null){if(t===null||t!==e){let r=this.et.get(e);if(r!==void 0){let s=ki(r).pop();Na(o),Xt(o,void 0,s),Ai(o,[s]);}}this.it=i;}else this.it=void 0;return this.render(i)}});var Le=class Le extends M{constructor(){super(...arguments);this.showIcon=false;this.$e=false;}static{this.styleAttrs=[...super.styleAttrs,"uc-primary-action"];}static{this.SOURCE_TEXT_CONFIG={[R.LOCAL]:{action:"upload-from"},[R.URL]:{action:"upload-from"},[R.CAMERA]:{action:"capture-with"},[R.MOBILE_PHOTO_CAMERA]:{action:"take"},[R.MOBILE_VIDEO_CAMERA]:{action:"record"}};}initCallback(){super.initCallback(),this.subConfigValue("dynamicButtonShowFirstIcon",t=>{this.showIcon=t;}),this.subConfigValue("multiple",t=>{this.$e=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.Td();return t||this.Cd()}Td(){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})}Cd(){if(!this.source?.id)return "";let e=Le.SOURCE_TEXT_CONFIG[this.source.id]?.action??"get-from",r;return this.source.id===R.MOBILE_PHOTO_CAMERA?r=this.l10n("photo").toLowerCase():this.source.id===R.MOBILE_VIDEO_CAMERA?r=this.l10n("video").toLowerCase():r=this.localizedSourceLabel,this.gi(e,{source:r})}us(){if(this.hasEntries){this.e.ctx.pub("*currentActivity","upload-list"),this.e.modalManager?.open("upload-list");return}this.source?.onClick();}Sd(){if(!this.$e&&this.hasSingleSuccessImage){let e=this.entries.allEntries[0];return e?v`<uc-thumb .uid=${e.internalId}></uc-thumb>`:null}if(this.$e&&this.hasMultipleEntries)return null;let t=this.source?.icon;return this.showIcon&&t?v`<uc-icon .name=${t}></uc-icon>`:null}render(){return v`<button type="button" @click=${this.us} aria-label=${this.textBasedOnLocale}>${this.Sd()}<span>${this.textBasedOnLocale}</span></button>`}};p([y({type:Object})],Le.prototype,"source",2),p([y({type:Object})],Le.prototype,"entries",2),p([f()],Le.prototype,"showIcon",2),p([f()],Le.prototype,"$e",2);var Bs=Le;var lo=class extends C{constructor(){super(...arguments);this.Ha=rt.generateFastUid();this.Ad=t=>{t.currentTarget.hidePopover();};}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-down"];}render(){return v`<button type="button" class="uc-mini-btn uc-dropdown-btn" popovertarget=${this.Ha} popovertargetaction="toggle">${this.yield("dd-header-button")}</button><div id=${this.Ha} class="uc-dropdown-content" popover="auto" @click=${this.Ad}>${this.yield("dd-content")}</div>`}};p([f()],lo.prototype,"Ha",2);var zs=class extends M{static{this.styleAttrs=[...super.styleAttrs,"uc-no-wrap-mode-dynamic-btn"];}};var Sd=(o,i)=>i==="compact"||o.length===0?{main:null,remain:o}:{main:o[0]??null,remain:o.slice(1)},cl={compact:"paperclip",menu:"arrow-dropdown",auto:"arrow-dropdown"},Ad=3,Vt=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.ce="auto";this.b=[];this.Ve="idle";this.ja=0;this.q=me(()=>{this.isConnected&&this.kd();},300);}static{this.styleAttrs=[...super.styleAttrs,"uc-dynamic-btn"];}get isIdle(){return this.Ve==="idle"}get isSuccess(){return this.Ve==="success"}get isFailed(){return this.Ve==="failed"}get isUploading(){return this.Ve==="uploading"}get isCollapsedMode(){return this.ce==="compact"}get shouldShowPrimaryAction(){return !this.isCollapsedMode||!this.isIdle||this.hasCollectionEntries}get shouldShowInline(){return this.isIdle&&!this.hasCollectionEntries&&this.b.length>1&&(this.ce==="toolbar"||this.ce==="auto"&&this.b.length<=Ad)}get shouldShowDropdown(){return this.isIdle&&!this.shouldShowInline&&!this.shouldShowCompactSingleSource&&!this.hasCollectionEntries&&(this.b.length>1||this.isCollapsedMode)}get shouldShowCompactSingleSource(){return this.isIdle&&this.isCollapsedMode&&!this.hasCollectionEntries&&this.b.length===1}get hasCollectionEntries(){return (this.Er?.allEntries?.length??0)>0}get shouldShowAbortAction(){return !this.isIdle&&this.hasCollectionEntries}kd(){let t=this.api?.getOutputCollectionState();if(!t){console.warn("Collection state is undefined");return}this.Er=t,this.Ve=t.status;}Ga(){this.xr=Sd(this.b,this.ce);}initCallback(){super.initCallback(),this.subConfigValue("dynamicButtonViewMode",t=>{this.ce!==t&&(this.ce=t,this.Ga());}),this.sub("*commonProgress",t=>{this.ja=t;}),new Je(this,{ctx:this.e.ctx,sharedInstancesBag:this.e,onSourcesChange:t=>{this.b=t,this.Ga();}}),this.uploadCollection.observeProperties(this.q),this.uploadCollection.observeCollection(this.q),this.Ka=this.routerLayer.registerAfterFileAddHook(({historyLength:t})=>{if(this.cfg.confirmUpload)return this.e.ctx.pub("*currentActivity",D.UPLOAD_LIST),this.modalManager?.open(D.UPLOAD_LIST),true;if(t>0)return false;let e=this.e.ctx.read("*currentActivity");return e?this.modalManager?.close(e):this.modalManager?.closeAll(),this.e.ctx.pub("*currentActivity",null),true});}disconnectedCallback(){typeof this.q.cancel=="function"&&this.q.cancel(),this.Ka?.(),super.disconnectedCallback();}Md(){return v`<uc-no-wrap-mode-dynamic-btn>${this.xr?.remain?.map(t=>v`<uc-source-btn .iconOnly=${ true} role="menuitem" .source=${t}></uc-source-btn>`)}</uc-no-wrap-mode-dynamic-btn>`}Od(){return cl[this.ce]??"arrow-dropdown"}Id(){this.uploadCollection.clearAll();}Pd(){this.Er.failedEntries.forEach(t=>{t&&this.uploadCollection.hasItem(t.internalId)&&this.uploadCollection.remove(t.internalId);});}Ld(){this.uploadCollection.abortAll();}Yo(){switch(this.Ve){case "failed":this.Pd();break;case "uploading":this.Ld();break;default:this.Id();}}Rd(){return v`<uc-drop-down><uc-icon content-for="dd-header-button" name=${this.Od()}></uc-icon><div content-for="dd-content" role="menu" class="uc-dropdown-menu">${this.xr?.remain?.map(t=>v`<uc-source-btn role="menuitem" .source=${t}></uc-source-btn>`)}</div></uc-drop-down>`}Ud(){let t=this.b[0],e=t&&{...t,icon:cl.compact};return v`<uc-no-wrap-mode-dynamic-btn><uc-source-btn .iconOnly=${ true} .source=${e}></uc-source-btn></uc-no-wrap-mode-dynamic-btn>`}$d(){return v`<uc-primary-action .entries=${this.Er} .source=${this.xr?.main} ></uc-primary-action>`}Dd(){return v`<uc-file-action-button @uc:remove=${this.Yo} .uploading=${this.isUploading} .failed=${this.isFailed} .success=${this.isSuccess} .idle=${this.isIdle} .progress=${this.ja} ></uc-file-action-button>`}Fd(){return lt({"uc-dynamic-btn-inner":true,"uc-failed":this.isFailed,"uc-uploading":this.isUploading,"uc-success":this.isSuccess})}Nd(){return v`<div class="uc-visual-drop-area"><uc-icon name="arrow-down"></uc-icon></div>`}render(){return v`<uc-drop-area .disabled=${!this.dropzone}><div class=${this.Fd()}>${Oe(this.shouldShowPrimaryAction?this.$d():null)} ${Oe(this.shouldShowInline?this.Md():null)} ${Oe(this.shouldShowCompactSingleSource?this.Ud():null)} ${Oe(this.shouldShowDropdown?this.Rd():null)} ${Oe(this.shouldShowAbortAction||this.hasCollectionEntries?this.Dd():null)} ${Oe(this.Nd())}</div></uc-drop-area>`}};p([y({attribute:"dropzone",type:Boolean})],Vt.prototype,"dropzone",2),p([f()],Vt.prototype,"ce",2),p([f()],Vt.prototype,"b",2),p([f()],Vt.prototype,"Ve",2),p([f()],Vt.prototype,"xr",2),p([f()],Vt.prototype,"Er",2),p([f()],Vt.prototype,"ja",2);var $i=class extends ${constructor(){super(...arguments);this.ps=I();}initCallback(){this.activityType=this.registration?.id??null,this.qa(),super.initCallback();}willUpdate(t){super.willUpdate(t),t.has("registration")&&(this.qa(),this.isActivityActive&&(this.Tr(),this.Wa()));}qa(){this.registration&&(this.Wn()||this.registerActivity(this.activityType??"",{onActivate:()=>this.Wa(),onDeactivate:()=>this.Tr()}));}async Wa(){await this.updateComplete;let t=this.ps.value;if(!t||!this.registration)return;this.Tr();let e=this.$["*currentActivityParams"];try{this.ds=this.registration.render(t,e)??void 0;}catch(r){console.error(`[Plugin "${this.registration.pluginId}"] Activity render() threw an error`,r);}}Tr(){let t=this.ps.value;if(t){try{this.ds?.();}catch(e){console.error(`[Plugin "${this.registration?.pluginId}"] Activity dispose threw an error`,e);}this.ds=void 0,t.replaceChildren();}}disconnectedCallback(){this.Tr(),super.disconnectedCallback();}render(){return v`<div style="display: contents;" ${O(this.ps)}></div>`}};p([y({attribute:false})],$i.prototype,"registration",2);var ri=class extends C{constructor(){super(...arguments);this.mode="modal";this.Ct=[];}initCallback(){super.initCallback();let t=this.e.pluginManager;t?.onPluginsChange&&(this.S=t.onPluginsChange(()=>this.Za())),this.Za();}Za(){let t=this.e.pluginManager;if(!t){this.Ct=[];return}this.Ct=t.snapshot().activities;}disconnectedCallback(){this.S?.(),this.S=void 0,super.disconnectedCallback();}render(){return this.mode==="inline"?v`${Ui(this.Ct,t=>t.id,t=>v`<uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host>`)}`:v`${Ui(this.Ct,t=>t.id,t=>v`<uc-modal id=${t.id} strokes block-body-scrolling><uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host></uc-modal>`)}`}};p([y({type:String})],ri.prototype,"mode",2),p([f()],ri.prototype,"Ct",2);function Di(o,i,t){return o?i(o):t?.(o)}function ul(...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},{})}function wt(...o){let i=ul(...o);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}function dl(o,...i){let t=ul(...i);for(let e of Object.keys(t))o.classList.toggle(e,!!t[e]);}var kd=o=>st.includes(o),pl=o=>{if(!o)return st;let i=G(o).filter(kd);return i.length===0?st:i};function hl(o){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":st,"*tabId":z.CROP,"*on.retryNetwork":()=>{let i=o.querySelectorAll("img");for(let t of i){let e=t.src;t.src=Ot,t.src=e;}o.$["*networkProblems"]=false;},"*on.apply":i=>{if(!i)return;let t=o.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=ot(oe(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.cancel":()=>{o.remove(),o.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));}}}var ml="<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 Pe={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},oi=class extends C{constructor(){super(...arguments);this.kt=false;this.Ya=Pe;this.Xa=Pe.visible;this.Qa=Pe.hidden;this.hs=false;this.Ja=false;}set visible(t){this.kt=t,this.tl();}get visible(){return this.kt}set styles(t){this.Ya=t,this.hs=true,this.Xa=t.visible??Pe.visible,this.Qa=t.hidden??Pe.hidden;}get styles(){return this.Ya}tl(){this.style.visibility=this.kt?"inherit":"hidden",dl(this,{[Pe.transition]:!this.hs,[this.Xa]:this.kt,[this.Qa]:!this.kt}),this.toggleAttribute("inert",!this.kt);}Vd(){this.Ja||(this.Ja=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.hs||this.classList.add(Pe.transition),this.tl(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.Vd();},0);}};p([y({type:Boolean})],oi.prototype,"visible",1),p([y({attribute:false})],oi.prototype,"styles",1);var Fi=class extends C{constructor(){super(...arguments);this.active=false;this.ue=I();this.fs=false;this.ms=()=>{let t=this.ue.value;t&&(this.il(t),this.fs&&this.active&&this.gs());};}firstUpdated(t){super.firstUpdated(t),this.active&&this.gs();}updated(t){super.updated(t),t.has("active")&&(this.active?this.gs():this._d());}gs(){let t=this.ue.value;if(!t)return;this.fs=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.ms),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.ms,{once:true});}_d(){let t=this.ue.value;t&&(this.fs=false,t.removeEventListener("transitionend",this.ms),this.il(t));}il(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return v`<div class="uc-inner"><div class="uc-line" ${O(this.ue)}></div></div>`}};p([y({type:Boolean,reflect:true})],Fi.prototype,"active",2);var W=o=>o??P;var At=class extends C{constructor(){super(...arguments);this.text="";this.icon="";this.reverse=false;this.theme="default";this.ariaRole=void 0;this.ariaControls="";this.titleProp="";this.active=false;}firstUpdated(t){super.firstUpdated(t),this.rl(),this.ol();}updated(t){super.updated(t),t.has("reverse")&&this.rl(),t.has("theme")&&this.ol();}rl(){this.style.flexDirection=this.reverse?"row-reverse":"";}ol(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get Bd(){let t=this.vs;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.zd}}get vs(){return !this.icon}get zd(){return !this.text&&!this.vs}render(){return v`<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=${lt(this.Bd)} name=${W(this.icon||void 0)} ?hidden=${this.vs} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};p([y({type:String})],At.prototype,"text",2),p([y({type:String})],At.prototype,"icon",2),p([y({type:Boolean,reflect:true})],At.prototype,"reverse",2),p([y({type:String,reflect:true})],At.prototype,"theme",2),p([y({attribute:"aria-role"})],At.prototype,"ariaRole",2),p([y({attribute:"aria-controls"})],At.prototype,"ariaControls",2),p([y({attribute:"title-prop"})],At.prototype,"titleProp",2),p([y({type:Boolean,noAccessor:true})],At.prototype,"active",2);function fl(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}function si(o,i,t){let r=window.devicePixelRatio,s=Math.min(Math.ceil(i*r),3e3),n=r>=2?"lightest":"normal";return Z(o,ot(fr,oe(t),`quality/${n}`,`stretch/off/-/resize/${s}x`,`@clib/${Ut}/${Rt}/uc-cloud-image-editor/`))}var Vi=class extends C{constructor(){super(...arguments);this.sl=`uc-backdrop-mask-${rt.generateFastUid()}`;this.Sr=false;this.wi=false;this.ll=I();this.xi=false;this.Ei=null;this.ul=t=>{this.dl(),this.Ti&&(t.stopPropagation(),t.preventDefault(),this.Ti=false);};this.pl=t=>{if(!this.Ti||!this.Cr||!this.bs)return;t.stopPropagation(),t.preventDefault();let e=this.qt;if(!e)return;let{x:r,y:s}=e.getBoundingClientRect(),n=t.x-r,a=t.y-s,l=n-this.Cr[0],c=a-this.Cr[1],{direction:d}=this.bs,u=this.Xd(d,[l,c]);u&&(this.$["*cropBox"]=u);};this.hl=t=>{if(!this.Dt)return;let e=Object.values(this.Dt).find(r=>{if(!r||this.Es(r.direction))return false;let n=r.interactionNode.getBoundingClientRect(),a={x:n.x,y:n.y,width:n.width,height:n.height};return Sa(a,[t.x,t.y])});this.nl=e,this.dl();};}get qt(){return this.ll.value??null}get Ti(){return this.wi}set Ti(t){this.wi!==t&&(this.wi=t,this.xs());}xs(){this.yi&&this.yi.setAttribute("class",wt({"uc-guides--hidden":this.Sr,"uc-guides--visible":!this.Sr&&this.wi,"uc-guides--semi-hidden":!this.Sr&&!this.wi}));}Es(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=k&&e.width<=k)return true;let r=e.height<=k&&(t.includes("n")||t.includes("s")),s=e.width<=k&&(t.includes("e")||t.includes("w"));return r||s}Hd(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:n}=t,a=this.qt;if(!a)return;let l=yt("mask",{id:this.sl}),c=yt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),d=yt("rect",{x:e,y:r,width:s,height:n,fill:"black"});l.appendChild(c),l.appendChild(d);let u=yt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.sl})`});a.appendChild(u),a.appendChild(l),this.vi=l,this.ys=d;}Kd(){this.vi&&(this.vi.style.display="none",window.requestAnimationFrame(()=>{this.vi&&(this.vi.style.display="block");}));}jd(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:n}=t;this.ys&&ce(this.ys,{x:e,y:r,width:s,height:n});}Gd(){let t=this.$["*cropBox"];if(!(!t||!this.yi||!this.Dt)){for(let e of Object.values(this.Dt)){if(!e)continue;let{direction:r,pathNode:s,interactionNode:n,groupNode:a}=e,l=r==="",c=r.length===2,{x:d,y:u,width:h,height:m}=t;if(l)ce(n,{x:d,y:u,width:h,height:m});else {let b=ue(Math.min(h,m)/82/2,0,1),w=c?wa(t,r,b):Ea(t,r,b),T=w.center;if(!T)continue;let E=Math.max(fs*ue(Math.min(h,m)/fs/3,0,1),ba);ce(n,{x:T[0]-E,y:T[1]-E,width:E*2,height:E*2}),ce(s,{d:w.d});}let g=this.Es(r);a.setAttribute("class",wt("uc-thumb",{"uc-thumb--hidden":g,"uc-thumb--visible":!g}));}ce(this.yi,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}cl(t,e){let r=yt("g");r.classList.add("uc-thumb"),r.setAttribute("with-effects","");let s=yt("rect",{fill:"transparent"}),n=yt("path",{stroke:"currentColor",fill:"none","stroke-width":3});r.appendChild(n),r.appendChild(s),t[e]={direction:e,pathNode:n,interactionNode:s,groupNode:r},e===""&&(r.style.cursor="move"),s.addEventListener("pointerdown",this.qd.bind(this,e));}Wd(){let t={};for(let e=0;e<3;e++)for(let r=0;r<3;r++){let s=`${["n","","s"][e]}${["w","","e"][r]}`;s!==""&&this.cl(t,s);}return this.cl(t,""),t}Zd(){let t=yt("svg"),e=yt("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=yt("line",{x1:`${xi*r}%`,y1:"0%",x2:`${xi*r}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}for(let r=1;r<=2;r++){let s=yt("line",{x1:"0%",y1:`${xi*r}%`,x2:"100%",y2:`${xi*r}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}Yd(){let t=this.qt;if(!t)return;let e=document.createDocumentFragment(),r=this.Zd();e.appendChild(r);let s=this.Wd();for(let{groupNode:n}of Object.values(s))e.appendChild(n);t.appendChild(e),this.Dt=s,this.yi=r,this.xs();}qd(t,e){if(!this.Dt)return;let r=this.Dt[t];if(!r||this.Es(t))return;let s=this.$["*cropBox"],n=this.qt;if(!n)return;let{x:a,y:l}=n.getBoundingClientRect(),c=e.x-a,d=e.y-l;this.Ti=true,this.bs=r,this.Cr=[c,d],this.al={...s};}Xd(t,e){let[r,s]=e,n=this.$["*imageBox"],a=this.al??this.$["*cropBox"],l=this.$["*currentAspectRatio"],c=l?l.width/l.height:void 0;if(t===""?a=Ca({rect:a,delta:[r,s],imageBox:n}):a=xa({rect:a,delta:[r,s],direction:t,aspectRatio:c,imageBox:n}),!Object.values(a).every(d=>Number.isFinite(d)&&d>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:a});return}return Ge(We(a),n)}dl(){let t=this.nl,e=this.qt;e&&(e.style.cursor=t?Ta(t.direction):"initial");}fl(t){if(this.bi){this.bi.setAttribute("href",t);return}let e=this.qt;if(!e){this.Ei=t;return}this.Ei=null;let r=document.createDocumentFragment(),s=yt("image",{href:t});s.setAttribute("class","uc-cloud-mask"),r.appendChild(s),e.appendChild(r),this.bi=s;}Qd(){let t=this.$["*cropBox"];if(!t||!this.bi)return;let{x:e,y:r,width:s,height:n}=t;ce(this.bi,{x:e,y:r,height:n,width:s});}Ts(){this.xi&&(this.jd(),this.Gd(),this.Qd());}toggleThumbs(t){if(this.Dt)for(let e of Object.values(this.Dt)){if(!e)continue;let{groupNode:r}=e;r.setAttribute("class",wt("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Kd(),this.xi&&window.requestAnimationFrame(()=>{this.Ts();});}),this.sub("*cropBox",t=>{t&&(this.Sr=t.height<=k||t.width<=k,this.xs(),this.xi&&window.requestAnimationFrame(()=>{this.Ts();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.fl(t);}),document.addEventListener("pointermove",this.pl,true),document.addEventListener("pointerup",this.ul,true);}firstUpdated(t){super.firstUpdated(t),this.Jd();}Jd(){let t=this.qt;if(!(!t||this.xi)){if(this.Hd(),this.Yd(),this.xi=true,t.addEventListener("pointermove",this.hl,true),this.Ei){let e=this.Ei;this.Ei=null,this.fl(e);}this.Ts();}}disconnectedCallback(){super.disconnectedCallback(),this.qt?.removeEventListener("pointermove",this.hl,true),document.removeEventListener("pointermove",this.pl,true),document.removeEventListener("pointerup",this.ul,true);}render(){return v`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${O(this.ll)}></svg>`}};p([f()],Vi.prototype,"wi",2);function Id(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}var Ni=class extends C{constructor(){super();this.ctxOwner=true;this.de={width:0,height:0};this.i=null;this.z=false;this.yt=null;this.gl=I();this.Ss=I();this.init$={...this.init$,"*padding":20,"*operations":{rotate:0,mirror:false,flip:false},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this.ml=F(this.vl.bind(this),300),this.Cs=me(()=>{!this.isConnected||!this.z||(this.As(),this.yl(),this.bl(),this.ks(),this.Ms());},100);}firstUpdated(t){super.firstUpdated(t),this.As();}yl(){let t=this.$["*editorTransformations"],e=fl(t,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...e};this.$["*operations"]=r;}As(){let t=this.gl.value;if(!t)return;let e=t.getContext("2d"),r=this.offsetWidth,s=this.offsetHeight,n=window.devicePixelRatio;t.style.width=`${r}px`,t.style.height=`${s}px`,t.width=r*n,t.height=s*n,e?.scale(n,n),this.Mt=t,this.i=e;}bl(){if(!this.z||!this.yt)return;let t=this.yt,e=this.$["*padding"],r=this.$["*operations"],{rotate:s}=r,n={width:this.offsetWidth,height:this.offsetHeight},a=qe({width:t.naturalWidth,height:t.naturalHeight},s),l;if(a.width>n.width-e*2||a.height>n.height-e*2){let c=a.width/a.height,d=n.width/n.height;if(c>d){let u=n.width-e*2,h=u/c,m=0+e,g=e+(n.height-e*2)/2-h/2;l={x:m,y:g,width:u,height:h};}else {let u=n.height-e*2,h=u*c,m=e+(n.width-e*2)/2-h/2,g=0+e;l={x:m,y:g,width:h,height:u};}}else {let{width:c,height:d}=a,u=e+(n.width-e*2)/2-c/2,h=e+(n.height-e*2)/2-d/2;l={x:u,y:h,width:c,height:d};}this.$["*imageBox"]=We(l);}ks(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,n=this.$["*editorTransformations"].crop,{width:a,x:l,y:c}=e;if(n){let{dimensions:[h,m],coords:[g,b]}=n,{width:w}=qe(this.de,s),T=a/w;t=Ge(We({x:l+g*T,y:c+b*T,width:h*T,height:m*T}),e);}let d=this.$["*currentAspectRatio"],u=d?d.width/d.height:void 0;if(!Aa(t,e)||u&&!ka(t,u)){let h=e.width/e.height,m=e.width,g=e.height;u&&(h>u?m=Math.min(e.height*u,e.width):g=Math.min(e.width/u,e.height)),t={x:e.x+e.width/2-m/2,y:e.y+e.height/2-g/2,width:m,height:g};}this.$["*cropBox"]=Ge(We(t),e);}tp(){let t=this.i;if(!t)return;let e=this.yt;if(!e)return;let r=this.$["*imageBox"],s=this.$["*operations"],{mirror:n,flip:a,rotate:l}=s,c=qe({width:r.width,height:r.height},l);t.save(),t.translate(r.x+r.width/2,r.y+r.height/2),t.rotate(l*Math.PI*-1/180),t.scale(n?-1:1,a?-1:1),t.drawImage(e,-c.width/2,-c.height/2,c.width,c.height),t.restore();}Ms(){if(!this.z||!this.yt||!this.Mt||!this.i)return;let t=this.Mt;this.i.clearRect(0,0,t.width,t.height),this.tp();}ep({fromViewer:t}){this.yt&&(this.Ss.value?.toggleThumbs(true),this.ip(),setTimeout(()=>{this.className=wt({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}wl(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,{width:n,height:a}=e,{width:l,height:c}=qe(this.de,s),{width:d,height:u}=t,h=n/l,m=a/c;return [ue(Math.round(d/h),1,l),ue(Math.round(u/m),1,c)]}rp(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,{width:n,height:a,x:l,y:c}=e,{width:d,height:u}=qe(this.de,s),{x:h,y:m}=t,g=n/d,b=a/u,w=this.wl(),T={dimensions:w,coords:[ue(Math.round((h-l)/g),0,d-w[0]),ue(Math.round((m-c)/b),0,u-w[1])]};if(!Id(T)){console.error("Cropper is trying to create invalid crop object",{payload:T});return}if(!(w[0]===d&&w[1]===u))return T}vl(){if(!this.isConnected||!this.de)return;let t=this.$["*operations"],{rotate:e,mirror:r,flip:s}=t,n=this.rp(),l={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:r,flip:s};this.$["*editorTransformations"]=l;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this.z&&(this.bl(),this.ks(),this.Ms());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this.z){this.z=true,await this.updateComplete,this.As(),this.de=t,this.removeEventListener("transitionend",this.xl);try{let r=this.$["*originalUrl"],s=this.$["*editorTransformations"];this.yt=await this.op(r,s),this.yl(),this.Cs(),this.ep({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.z&&this.yt&&this.Cs();}),this.s.observe(this);}}deactivate({reset:t=false}={}){this.z&&(!t&&this.vl(),this.z=false,this.sp(),this.className=wt({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.Ss.value?.toggleThumbs(false),this.addEventListener("transitionend",this.xl,{once:true}),this.s?.disconnect());}sp(){let t=this.wl(),e=this.$["*cropBox"],r=Math.min(this.offsetWidth,t[0])/e.width,s=Math.min(this.offsetHeight,t[1])/e.height,n=Math.min(r,s),a=e.x+e.width/2,l=e.y+e.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-a)/n}px, ${(this.offsetHeight/2-l)/n}px)`,this.style.transformOrigin=`${a}px ${l}px`;}ip(){let t=this.$["*cropBox"],e=t.x+t.width/2,r=t.y+t.height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${r}px`;}xl(){this.z||(this.yt=null);}async op(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(si(t,r,e)),{promise:n,cancel:a,image:l}=Ie(s),c=this._e(s);return l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),this.w?.(),this.w=a,n.then(()=>l).catch(d=>(console.error("Failed to load image",{error:d}),this.$["*networkProblems"]=true,l))}_e(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 n=r.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=r);}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Ms();}),this.sub("*cropBox",()=>{this.yt&&this.ml();}),this.sub("*currentAspectRatio",()=>{this.ks();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this.z&&this.de&&this.activate(this.de,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.yt&&(this.yt=null);}render(){return v`<canvas class="uc-canvas" ${O(this.gl)}></canvas><uc-crop-frame ${O(this.Ss)}></uc-crop-frame>`}};p([f()],Ni.prototype,"yt",2);function Hs(o,i,t){let e=t,r=t-1,s=new Array(e);for(let n=r;n>=0;n-=1)s[n]=Math.ceil((n*i+(r-n)*o)/r);return s}function Od(o){return typeof o=="string"&&o in It}function Ld(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}function Pd(o,i,t){let e=Ld(o).find(([n,a])=>n<=i&&i<=a);if(!e)return o.map(()=>0);let[r,s]=e;return o.map(n=>{let a=Math.abs(r-s)||1,l=Math.abs(i-r)/a;return r===n?i>t?1:1-l:s===n?i>=t?l:1:0})}function Ud(o,i){return o.map((t,e)=>t<i?o.length-e:e)}function gl(o,i){let t=It[o].keypointsNumber,{range:e,zero:r}=It[o];return [...new Set([...Hs(e[0],r,t+1),...Hs(r,e[1],t+1),r,i])].sort((s,n)=>s-n)}var co=class extends C{constructor(){super();this.z=false;this.Os=true;this.n="initial";this.El={};this.Wt=[];this.Tl=0;this.Sl=I();this.Ar=I();this.classList.add("uc-inactive_to_cropper"),this.Cl=F(async(t,e,r)=>{let s=()=>!this.Al(t,e)||this.Ue!==r||!!this.Wt.find(c=>c.value===r);if(s())return;let n=await this.kl(t,r),a=new Image;a.src=n.src;let l=this._e(n.src);a.addEventListener("load",l,{once:true}),a.addEventListener("error",l,{once:true}),n.image=a,a.classList.add("uc-fader-image"),a.addEventListener("load",()=>{if(s())return;let c=this.Wt,d=c.findIndex(g=>g.value>r);d===-1&&(d=c.length);let h=c[d]?.image,m=this.Ar.value;!m||h&&!m.contains(h)||(c.splice(d,0,n),h?m.insertBefore(a,h):m.appendChild(a),this.Ls(t,r));},{once:true}),a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}_e(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 n=r.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=r);}}Ml(){window.cancelAnimationFrame(this.Tl),this.Tl=window.requestAnimationFrame(()=>{for(let t of this.Wt){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}pe({url:t=this.Be,filter:e=this.g??void 0,operation:r,value:s}={}){if(!t)throw new Error("URL is not defined");let n={...this.El};r&&(r==="filter"?e&&typeof s=="number"&&(n.filter={name:e,amount:s}):typeof s=="number"&&(n[r]=s));let a=this.offsetWidth;return this.proxyUrl(si(t,a,n))}async kl(t,e){return {src:await this.pe({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}Al(t,e){return this.n===t&&this.g===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!Od(this.n)||!Number.isFinite(e)||(this.Ls(this.n,e),this.Cl(this.n,this.g,e));}Ls(t,e){this.n=t,this.Ue=e;let{zero:r}=It[t],s=this.Wt.map(l=>l.value),n=Pd(s,e,r),a=Ud(s,r);this.Wt.forEach((l,c)=>{let d=n[c],u=a[c];typeof d=="number"&&(l.opacity=d),typeof u=="number"&&(l.zIndex=u);}),this.Ml();}Ol(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async np(){this.a=this.a||this.Ol();let t=this.a;t&&this.Il(t);let e=this.Wt.map(c=>c.src),{images:r,promise:s,cancel:n}=Pi(e);r.forEach(c=>{let d=this._e(c.src);c.addEventListener("load",d),c.addEventListener("error",d);}),this.Is=()=>{n(),this.Is=void 0;};let a=this.n,l=this.g;if(await s,this.z&&this.Al(a,l)){let c=this.Ar.value;if(!c)return;c.replaceChildren(),this.Wt.forEach((d,u)=>{let h=r[u];h&&(h.classList.add("uc-fader-image"),d.image=h,c.appendChild(h));}),this.Ml();}}async setTransformations(t){if(this.El=t,this.a){let e=await this.pe(),r=this._e(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.Ps?.();let n=gl(r,s),a=await Promise.all(n.map(c=>this.pe({url:t,filter:e,operation:r,value:c}))),{cancel:l}=Pi(a);this.Ps=l;}ap(t){let e=this.a||this.Ol();if(this.Il(e),this.a=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=wt({"uc-active_from_viewer":this.Ci,"uc-active_from_cropper":!this.Ci,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let r=this._e(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=wt({"uc-active_from_viewer":this.Ci,"uc-active_from_cropper":!this.Ci,"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:n}){if(this.z=true,this.Os=false,await this.updateComplete,this.Be=t,this.n=e??"initial",this.Ue=r,this.g=s,this.Ci=n,typeof r!="number"&&!s){let l=await this.pe({operation:e,value:r});this.ap(l),this.Rs();return}!e||typeof r!="number"||(this.Wt=await Promise.all(gl(e,r).map(l=>this.kl(e,l))),this.Ls(e,r),this.np());}deactivate({hide:t=true}={}){this.z=false,this.Is?.(),this.Ps?.(),t&&!this.Os?(this.Os=true,this.a&&(this.a.style.transform="scale(1)"),this.className=wt({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.Rs();},{once:true})):this.Rs();}Il(t){let e=this.Sl.value;e&&(e.contains(t)||e.appendChild(t));}Rs(){this.Ar.value?.replaceChildren();}render(){return v`<div class="uc-fader-preview-host" ${O(this.Sl)}></div><div class="uc-fader-layers-host" ${O(this.Ar)}></div>`}};var Nt=class extends C{constructor(){super();this.Us=0;this.kr=I();this.Ll=I();this.Rl=I();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.Zt=0;this.cp=t=>{t.stopPropagation();let e=this.Ul(t);e!==null&&(this.$s(e),this.lp("slider-input",e));};this.up=t=>{t.stopPropagation();let e=this.Ul(t);e!==null&&this.$s(e);};this.$l=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.Dl=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}lp(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.Us=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.Fl(this.Zt),this.Ds(),this.s=new ResizeObserver(()=>{this.Ds(),this.Mr(this.Zt);}),this.s.observe(this);let e=this.kr.value;e?.addEventListener("focus",this.$l),e?.addEventListener("blur",this.Dl),window.setTimeout(()=>{this.Mr(this.Zt);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.Zt&&this.$s(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.Ds(),this.Mr(this.Zt)),t.has("zero")&&this.hasUpdated&&this.Nl(this.Zt);}Mr(t){this.Nl(t);let e=this.max-this.min;if(e===0)return;let{width:r}=this.getBoundingClientRect(),a=100/e*(t-this.min)*(r-this.Us)/100;window.requestAnimationFrame(()=>{let l=this.Ll.value;l&&(l.style.transform=`translateX(${a}px)`);});}Nl(t){if(!this.Si)return;let e=this.max-this.min;if(e===0)return;this.Si.style.opacity=t===this.zero?"0":"1";let{width:r}=this.getBoundingClientRect(),a=100/e*(this.zero-this.min)*(r-this.Us)/100;window.requestAnimationFrame(()=>{this.Si&&(this.Si.style.transform=`translateX(${a}px)`);});}Ds(){let e=this.Rl.value;if(!e)return;let{width:r}=e.getBoundingClientRect(),s=Math.ceil(r/2),n=Math.ceil(s/15)-2;if(this.Pl===n)return;let a=document.createDocumentFragment(),l=document.createElement("div"),c=document.createElement("div");l.className="uc-minor-step",c.className="uc-border-step",a.appendChild(c);for(let u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());for(let u=0;u<n;u+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());let d=document.createElement("div");d.className="uc-zero-dot",a.appendChild(d),this.Si=d,e.innerHTML="",e.appendChild(a),this.Pl=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.kr.value;t?.removeEventListener("focus",this.$l),t?.removeEventListener("blur",this.Dl),this.s?.disconnect(),this.s=void 0;}$s(t){Number.isFinite(t)&&(this.Zt=t,this.hasUpdated&&(this.Fl(t),this.Mr(t)));}Fl(t){let e=this.kr.value;e&&(e.value=String(t));}Ul(t){let e=t.currentTarget;if(!e)return null;let r=Number.parseInt(e.value,10);return Number.isFinite(r)?r:null}render(){return v`<div class="uc-steps" ${O(this.Rl)}></div><div class="uc-thumb" ${O(this.Ll)}></div><input class="uc-input" type="range" ${O(this.kr)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.Zt)} ?disabled=${this.disabled} @input=${this.cp} @change=${this.up} />`}};p([y({type:Boolean,reflect:true})],Nt.prototype,"disabled",2),p([y({type:Number})],Nt.prototype,"min",2),p([y({type:Number})],Nt.prototype,"max",2),p([y({type:Number,attribute:false})],Nt.prototype,"defaultValue",2),p([y({type:Number})],Nt.prototype,"zero",2),p([f()],Nt.prototype,"Zt",2);var _t="original",_i=class extends C{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.Fs=t=>{let{value:e}=t.detail;this.$["*faderEl"]?.set(e),this.state={...this.state,value:e};};}setOperation(t,e){this.state={...this.state,operation:t,filter:e},this.dp();let r=this.$["*faderEl"],s=this.state.originalUrl||this.$["*originalUrl"];r&&s&&r.activate({url:s,operation:this.state.operation,value:this.state.filter===_t?void 0:this.state.value,filter:this.state.filter===_t?void 0:this.state.filter,fromViewer:false});}dp(){let t=this.state.operation,{range:e,zero:r}=It[t],[s,n]=e;this.state={...this.state,min:s,max:n,zero:r};let l=this.$["*editorTransformations"][t];if(t==="filter"){let d=Number(n),u=l;if(u){let{name:h,amount:m}=u;d=h===this.state.filter?m:n;}this.state={...this.state,value:d,defaultValue:d};return}let c=typeof l<"u"?l:r;this.state={...this.state,value:c,defaultValue:c};}apply(){let e={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===_t?delete e.filter:e.filter={name:this.state.filter,amount:this.state.value}:e[this.state.operation]=this.state.value,this.$["*editorTransformations"]=e;}cancel(){this.$["*faderEl"]?.deactivate({hide:false});}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{t&&(this.state={...this.state,originalUrl:t});});}updated(t){if(super.updated(t),t.has("state")){let e=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$["*operationTooltip"]=e;}}render(){return v`<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.Fs} ></uc-slider-ui>`}};p([f()],_i.prototype,"state",2);function ni(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)}}var ut=class extends C{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}get buttonClasses(){let t=this.active;return {"uc-active":t,"uc-not_active":!t}}Vl(){let t=this.buttonClasses;for(let[e,r]of Object.entries(t))this.classList.toggle(e,r);}onClick(t){}connectedCallback(){super.connectedCallback(),this.Vl();}updated(t){super.updated(t),t.has("active")&&this.Vl();}render(){let t=this.onClick,e=this.title;return v`<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>`}};p([f()],ut.prototype,"active",2),p([f()],ut.prototype,"title",2),p([f()],ut.prototype,"icon",2),p([f()],ut.prototype,"titleProp",2);var uo=12,po=16,Rd=o=>{let i=12,t=12;return o.width/o.height>=1?(i=uo,t=Math.round(uo*o.height/o.width)):(t=uo,i=Math.round(uo*o.width/o.height)),{width:i,height:t}},ho=class extends ut{initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this.pp(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}pp(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 v`<button role="option" type="button" class=${lt(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>`}},Bi=class extends ut{constructor(){super(...arguments);this.tt=null;}get aspectRatio(){return this.tt}set aspectRatio(t){if(this.tt===t)return;let e=this.tt;this.tt=t,this.requestUpdate("aspectRatio",e),t?this._l(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.tt&&this._l(this.tt),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.tt?.id||t?.width===this.tt?.width&&t?.height===this.tt?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.tt?.id&&(this.$["*currentAspectRatio"]=this.tt);}_l(t){if(!this.isConnected)return;let e=!!t.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",e);let r=()=>{let n=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=n,n},s=()=>{let n=this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:e?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${t.width}:${t.height}`}).toLowerCase(),value:""});return this.titleProp=n,n};r(),s(),e||this.requestUpdate();}hp(){let t=this.tt;if(!t||t.hasFreeform)return v`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:r}=Rd(t),s=(po-e)/2,n=(po-r)/2;return v`<uc-icon><svg viewBox="0 0 ${po} ${po}" aria-hidden="true" focusable="false" ><rect x=${s} y=${n} 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 v`<button role="option" type="button" class=${lt(this.buttonClasses)} aria-label=${W(this.titleProp)} title=${W(this.titleProp)} @click=${t} >${this.hp()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};p([y({attribute:false})],Bi.prototype,"aspectRatio",1);function $d(o){let i=o+90;return i=i>=360?0:i,i}function Dd(o,i){if(o==="rotate")return $d(typeof i=="number"?i:0);if(o==="mirror"||o==="flip")return !i;throw new Error(`Unsupported operation: ${o}`)}var zi=class extends ut{constructor(){super(...arguments);this.operation=void 0;}willUpdate(t){super.willUpdate(t),this.operation?(this.titleProp=this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(this.operation).toLowerCase()}),this.icon=this.operation):(this.icon="",this.titleProp="");}onClick(t){if(!this.operation)return;let e=this.$["*cropperEl"],r=e.getValue(this.operation),s=Dd(this.operation,r);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:s,prev:r}),e.setValue(this.operation,s);}};p([y({type:String})],zi.prototype,"operation",2);var te=class extends ut{constructor(){super(...arguments);this.n="";this.g="";this.Ai="";this.Or=0;this.a=null;this.He=false;this.isOriginal=false;this.Bl=20;}get filter(){return this.g}set filter(t){let e=t??"";if(this.g===e)return;let r=this.g;this.g=e,this.n="filter",this.isOriginal=e===_t,this.icon=this.isOriginal?"original":"slider",this.Bl=this.isOriginal?40:20,this.requestUpdate("filter",r),this.isConnected&&this.zl(e);}onClick(t){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this.n,this.g),this.$["*showSlider"]=true);else {let e=this.$["*sliderEl"];e.setOperation(this.n,this.g),e.apply();}this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:ni(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.g;}fp(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.Bl||32,r=window.devicePixelRatio,s=Math.ceil(r*e),n=r>=2?"lightest":"normal",a=100,l={...this.$["*editorTransformations"]};return l[this.n]=this.g!==_t?{name:this.g,amount:a}:void 0,Z(this.Ai,ot(fr,oe(l),`quality/${n}`,`scale_crop/${s}x${s}/center`,`@clib/${Ut}/${Rt}/uc-cloud-image-editor/`))}async pi(t,e){t[0]?.isIntersecting?await this.Ns(e):this.w?.();}initCallback(){super.initCallback(),this.s=new window.IntersectionObserver(this.pi.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.he());}),this.isOriginal||(this.s?.observe(this),this.he()),this.g&&this.zl(this.g),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.g);}),this.sub("*networkProblems",async e=>{e||(this.a?await this.Ns():this.he());});}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.w?.(),this.Ir();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.s?.unobserve(this):(this.s?.observe(this),this.he()));}zl(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async Ns(t){if(!this.isConnected){t?.unobserve(this),this.w?.(),this.w=void 0;return}if(!this.Ai){!this.ze&&!this.Yt&&this.he();return}let e=++this.Or,r="";try{r=await this.proxyUrl(this.fp());}catch(a){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:a});return}this.He=false,this.w?.();let{promise:s,cancel:n}=Ie(r);this.w=()=>{n(),this.Or===e&&(this.w=void 0);};try{if(await s,this.Or!==e||!this.isConnected)return;this.a=r,this.He=!0,this.Ir(),(t??this.s)?.unobserve(this);}catch(a){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:a}),this.he();}finally{this.Or===e&&(this.w=void 0);}}he(){if(!this.isConnected||this.a||this.He||this.isOriginal||this.$["*networkProblems"]){this.Ir();return}this.Yt&&cancelAnimationFrame(this.Yt),this.Yt=requestAnimationFrame(()=>{if(this.Yt=void 0,!this.isConnected||this.a||this.He||this.isOriginal){this.Ir();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.Ns();return}this.ze=window.setTimeout(()=>{this.ze=void 0,this.he();},500);});}Ir(){this.Yt&&(cancelAnimationFrame(this.Yt),this.Yt=void 0),this.ze&&(window.clearTimeout(this.ze),this.ze=void 0);}get mp(){return !!(this.He&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.mp?"1":"0"};this.a&&(e.backgroundImage=`url(${this.a})`);let r={opacity:this.active||this.isOriginal?"1":"0"};return v`<button role="option" type="button" class=${lt(this.buttonClasses)} aria-label=${W(this.titleProp)} title=${W(this.titleProp)} @click=${t} ><div class="uc-preview" ?data-loaded=${this.He} style=${Qt(e)}></div><uc-icon class=${lt({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${Qt(r)} ></uc-icon></button>`}};p([f()],te.prototype,"a",2),p([f()],te.prototype,"He",2),p([f()],te.prototype,"isOriginal",2),p([f()],te.prototype,"Bl",2),p([y({type:String})],te.prototype,"filter",1);var Hi=class extends ut{constructor(){super(...arguments);this.n="";}get operation(){return this.n}set operation(t){let e=t??"";if(this.n===e)return;let r=this.n;this.n=e,this.requestUpdate("operation",r),this.isConnected&&e&&this.Hl(e);}Hl(t){this.icon=t;let e=()=>{let s=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=s,s},r=()=>{let s=this.l10n(t);return this.title=s,s};e(),r();}initCallback(){super.initCallback(),this.n&&this.Hl(this.n),this.sub("*editorTransformations",t=>{if(!this.n)return;let{zero:e}=It[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:ni(this.$["*operationTooltip"])});}};p([y({type:String})],Hi.prototype,"operation",1);var Fd=1,vl=()=>{},Ki=class extends C{constructor(){super(...arguments);this.hiddenScrollbar=false;this.Kl=t=>{t.preventDefault();let{deltaY:e,deltaX:r}=t;if(Math.abs(r)>Fd){this.scrollLeft+=r;return}this.scrollLeft+=e;};}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.Kl,{passive:false}),this.addEventListener("scroll",vl,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.Kl),this.removeEventListener("scroll",vl),super.disconnectedCallback();}};p([y({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],Ki.prototype,"hiddenScrollbar",2);var ft=class extends C{constructor(){super(...arguments);this.ki=false;this.showMainToolbar=true;this.showSubToolbar=false;this.jl=true;this.tabList=[...st];this.activeTab=z.CROP;this.Pr=true;this.Vs=false;this.Gl=null;this.ql=0;this.Wl=0;this.Lr=I();this.Zl=I();this.tabToggleRefs={[z.CROP]:I(),[z.TUNING]:I(),[z.FILTERS]:I()};this.Yl=()=>{this.fe();};this.Mi=[];this.Rr=F(t=>{this.ki=t;},500);this.Ur=F(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],r="",s=false;if(this.$["*tabId"]===z.FILTERS)if(s=true,this.$["*currentFilter"]&&t?.filter?.name===this.$["*currentFilter"]){let n=t?.filter?.amount||100;r=`${this.$["*currentFilter"]} ${n}`;}else r=this.l10n(_t);else if(this.showSubToolbar&&this.$["*tabId"]===z.TUNING&&e){s=true;let n=t?.[e]||It[e].zero;r=`${this.l10n(e)} ${n}`;}s&&(this.$["*operationTooltip"]=r),this.Vs=s;},0);this.gp={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.vp={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.yp={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.bp={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":_t,"*currentOperation":null,"*operationTooltip":null};this.$t=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.w?.();let e=this.$["*on.cancel"];e?.();};this.Hs=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.Ip=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:ni(this.$["*operationTooltip"])}),this.Lr.value?.apply(),this.Xl();};this.Pp=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.Lr.value?.cancel(),this.Xl();};this.Lp=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&(this.telemetryManager.sendEventCloudImageEditor(t,r),this._s(r,{fromViewer:false}));};}Xl(){this.$["*showSlider"]=false,this.$["*tabId"]===z.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===z.TUNING&&(this.Vs=false);}_s(t,{fromViewer:e=false,force:r=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.Ql(t,{fromViewer:e,force:r});}Ql(t,{fromViewer:e,force:r=false}){if(!r&&this.activeTab===t){this.fe();return}this.activeTab=t;let s=this.$["*faderEl"],n=this.$["*cropperEl"];t===z.CROP?(s?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:e})):(s?.activate({url:this.$["*originalUrl"],fromViewer:e}),n?.deactivate());for(let a of st){let l=a===t,d=this.tabToggleRefs[a]?.value;d&&(d.active=l),l&&this.fe();}}fe(){let e=this.tabToggleRefs[this.activeTab]?.value,r=this.Zl.value;if(!e||!r)return;let s=e.offsetLeft,n=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.ql!==s||this.Wl!==n)&&(this.ql=s,this.Wl=n,r.style.transform=`translateX(${s}px)`,r.style.width=`${n}px`);}get Bs(){return this.Mi.length>=3}wp(t){switch(t){case z.CROP:return this.xp();case z.FILTERS:return this.Ep();case z.TUNING:return this.Tp();default:return []}}xp(){let t=[];if(this.Bs)t.push(()=>this.Cp());else for(let e of this.Mi)t.push(()=>this.Jl(e));for(let e of On)t.push(()=>this.Sp(e));return this.zs(t)}Ep(){let e=[_t,...In].map(r=>()=>this.Ap(r));return this.zs(e)}Tp(){let t=Mn.map(e=>()=>this.kp(e));return this.zs(t)}zs(t){return t.length?t.map(r=>r()):[]}Cp(){return v`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}Jl(t){return v`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}Sp(t){return v`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}Ap(t){return v`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}kp(t){return v`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}Mp(){return this.Bs?this.Mi.map(t=>this.Jl(t)):[]}async Op(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(si(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.w?.();let{cancel:r}=Pi([e]);this.w=()=>{r(),this.w=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._s(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let r=e?.filter?.name;this.$["*currentFilter"]!==r&&(this.$["*currentFilter"]=r??"");}),this.sub("*currentFilter",()=>{this.Ur();}),this.sub("*currentOperation",()=>{this.Ur();}),this.sub("*tabId",e=>{this.Ql(e,{fromViewer:false,force:true}),this.Ur();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.Op(),this.$["*faderEl"]?.setTransformations(e);}),this.sub("*loadingOperations",e=>{let r=false;for(let[,s]of e.entries()){if(r)break;for(let[,n]of s.entries())if(n){r=true;break}}this.Rr(r);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Pr=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Pr=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.jl=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[r]=e;r&&this._s(r,{fromViewer:false});return}this.fe();}),this.sub("*operationTooltip",e=>{this.Gl=e;}),this.Ur();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.Yl);}firstUpdated(t){super.firstUpdated(t),this.$r(),this.fe();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.fe()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.$r();}disconnectedCallback(){window.removeEventListener("resize",this.Yl),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}$r(){let t=this.Lr.value;t&&(this.$["*sliderEl"]=t);}Rp(t){let e=this.tabList.includes(t),r=this.activeTab===t,s=this.tabList.indexOf(t),n=s>=0?Qt({gridColumn:`${s+1}`}):P;return v`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.yp}><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=${n} @click=${this.Lp} ${O(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Up(t){let e=this.wp(t);return v`<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:P}</div></div></uc-editor-scroller></div>`}render(){let t=["uc-info-tooltip",this.Vs?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.Bs;return v`<uc-line-loader-ui .active=${this.ki}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.Gl??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.gp} ><div class="uc-tab-content-row">${st.map(r=>Di(this.activeTab===r,()=>this.Up(r)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.jl} .styles=${this.bp} @initial-render=${()=>this.fe()} ><div class="uc-tab-toggles_indicator" ${O(this.Zl)} ></div>${st.map(r=>this.Rp(r))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.$t} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.Hs}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.vp}><div class="uc-slider" ?hidden=${!this.Pr}><uc-editor-slider ${O(this.Lr)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.Pr||!e}>${e?v`<div class="uc-list-aspect-ratio">${this.Mp()}</div>`:P}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.Pp} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.Ip} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};p([f()],ft.prototype,"ki",2),p([f()],ft.prototype,"showMainToolbar",2),p([f()],ft.prototype,"showSubToolbar",2),p([f()],ft.prototype,"jl",2),p([f()],ft.prototype,"tabList",2),p([f()],ft.prototype,"activeTab",2),p([f()],ft.prototype,"Pr",2),p([f()],ft.prototype,"Vs",2),p([f()],ft.prototype,"Gl",2),p([f()],ft.prototype,"Mi",2);var yl=Kt([...st]),et=class extends C{constructor(){super(...arguments);this.ctxOwner=true;this.$p="";this.pe=Ot;this.Dp="";this.ki=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=yl;this.tc=false;this.Bt=false;this.Ks=null;this.Oi=null;this.Rr=F(t=>{this.ki=t;},300);this.Dr=I();this.ec=I();this.ic=I();this.rc=I();this.oc=()=>{this.Rr(false),this.pe!==Ot&&(this.$["*networkProblems"]=false);};this.sc=()=>{this.Rr(false),this.$["*networkProblems"]=true;};this.Fp=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...hl(this)};}static{this.styleAttrs=["uc-cloud-image-editor"];}Np(){this.Bt||this.Ks||(this.Ks=this.updateComplete.then(()=>{this.Ks=null,this.Bt=true;}));}initCallback(){super.initCallback(),this.nc(),this.ac();}$r(){let t=this.ic.value;t&&(this.$["*faderEl"]=t);let e=this.ec.value;e&&(this.$["*cropperEl"]=e);let r=this.rc.value;r&&(this.$["*imgContainerEl"]=r);let s=this.Dr.value;s&&(this.$["*imgEl"]=s);}Vp(){let t=this.Dr.value;t&&(t.addEventListener("load",this.oc),t.addEventListener("error",this.sc));}_p(){let t=this.Dr.value;t&&(t.removeEventListener("load",this.oc),t.removeEventListener("error",this.sc));}get Bp(){let t=this.$["*tabId"];return wt("uc-image",{"uc-image_hidden_to_cropper":t===z.CROP,"uc-image_hidden_effects":t!==z.CROP})}cc(){if(this.Oi)return this.Oi;let t=3e3;return this.Oi=new Promise((e,r)=>{let s=()=>{window.clearTimeout(d),c.disconnect(),this.Oi=null;},n=()=>{let{width:u,height:h}=this.getBoundingClientRect();return u>0&&h>0},a=()=>{s(),window.setTimeout(()=>e(),0);},l=()=>{let u=new Error("[cloud-image-editor] timeout waiting for non-zero container size");s(),this.isConnected&&console.error(u.message),r(u);},c=new ResizeObserver(u=>{let[h]=u;h&&h.contentRect.width>0&&h.contentRect.height>0&&a();}),d=window.setTimeout(()=>{l();},t);if(n()){a();return}c.observe(this);}),this.Oi}firstUpdated(t){super.firstUpdated(t),this.$r(),this.Vp(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),r=t.has("uuid")||t.has("cdnUrl");e&&!r&&this.updateImage();}disconnectedCallback(){this._p(),super.disconnectedCallback();}render(){let t=this.Dp??"",e=this.$p??"",r=this.pe||Ot,s=this.ki,n=this.tc;return v` ${He(ml)}<div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" .visible=${n}><div class="uc-network_problems_content"><div class="uc-network_problems_icon"><uc-icon name="sad"></uc-icon></div><div class="uc-network_problems_text">Network error</div></div><div class="uc-network_problems_footer"><uc-btn-ui theme="primary" text="Retry" @click=${this.Fp}></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" ${O(this.rc)}><img src=${r} class=${this.Bp} ${O(this.Dr)} />${Di(this.Bt,()=>v`<uc-editor-image-cropper ${O(this.ec)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${O(this.ic)}></uc-editor-image-fader></div><div class="uc-info_pan">${e}</div></div><div class="uc-toolbar"><uc-line-loader-ui .active=${s}></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor">${Di(this.Bt,()=>v`<uc-editor-toolbar></uc-editor-toolbar>`)}</div></div></div>`}updated(t){super.updated(t),t.has("uuid")&&this.uuid&&this.updateImage(),t.has("cdnUrl")&&this.cdnUrl&&this.updateImage(),t.has("tabs")&&this.nc(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.ac();}nc(){let t=this.tabs||yl;this.$["*tabList"]=pl(t);}ac(){let t=Zr(this.cropPreset??""),e=null;if(this.cdnUrl){let r=Fo(this.cdnUrl),s=Vo(r);if(Array.isArray(s?.crop?.dimensions)){let[n,a]=s.crop.dimensions;e=Ia(n,a,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){try{await this.cc();}catch{return}if(this.isConnected){if(this.cdnUrl){let t=this.cdnUrl,e=mr(t),r=re(t,e);if(r===this.$["*originalUrl"])return;this.$["*originalUrl"]=r;let s=Fo(t),n=Vo(s);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=re(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"]===z.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(Z(t,ot("json"))),r=await fetch(e).then(a=>a.json()),{width:s,height:n}=r;this.$["*imageSize"]={width:s,height:n},this.$["*tabId"]===z.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.Np();}}}async initEditor(){try{await this.cc();}catch{return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.tc=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],r=ot(oe(t),"preview"),s=Z(e,r),n={originalUrl:e,cdnUrlModifiers:r,cdnUrl:s,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};p([f()],et.prototype,"$p",2),p([f()],et.prototype,"pe",2),p([f()],et.prototype,"Dp",2),p([f()],et.prototype,"ki",2),p([y({type:String,reflect:true})],et.prototype,"uuid",2),p([y({type:String,attribute:"cdn-url",reflect:true})],et.prototype,"cdnUrl",2),p([y({type:String,attribute:"crop-preset",reflect:true})],et.prototype,"cropPreset",2),p([y({type:String,reflect:true})],et.prototype,"tabs",2),p([f()],et.prototype,"tc",2),p([f()],et.prototype,"Bt",2);var Ks={};Zs(Ks,{CloudImageEditorActivity:()=>ji});var mo=class extends et{static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:V.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var ji=class extends M{constructor(){super(...arguments);this.ot=null;}get activityParams(){let t=super.activityParams;if("internalId"in t)return t;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.subConfigValue("cropPreset",t=>{this.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.zp();}disconnectedCallback(){super.disconnectedCallback(),this.Hp();}Hs(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($.activities.CLOUD_IMG_EDIT),this.historyBack();}$t(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close($.activities.CLOUD_IMG_EDIT),this.historyBack();}handleChange(t){this.debugPrint('editor event "change"',t.detail);}zp(){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.Kp(r);}Hp(){this.Ii=void 0,this.ot=null;}render(){if(!this.ot)return P;let{cdnUrl:t,cropPreset:e,tabs:r}=this.ot;return v`<uc-cloud-image-editor cdn-url=${t} crop-preset=${W(e)} tabs=${W(r)} @apply=${this.Hs} @cancel=${this.$t} @change=${this.handleChange} ></uc-cloud-image-editor>`}Kp(t){return {cdnUrl:t,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}};p([f()],ji.prototype,"ot",2);var ai=class extends M{constructor(){super(...arguments);this.Be="";this.Fs=t=>{this.Be=t.target?.value??"";};this.ss=t=>{t.preventDefault(),this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let e=this.Be.trim();e&&(this.api.addFileFromUrl(e,{source:R.URL}),this.routerLayer.navigateAfterFileAdd());};}render(){return v`<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.ss}><label><input placeholder="https://" class="uc-url-input" type="text" autofocus @input=${this.Fs} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${!this.Be} >${this.l10n("upload-url")}</button></form>`}};p([f()],ai.prototype,"Be",2);var bl=()=>{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}};var Vd=o=>o.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),wl=(o,i="i")=>{let t=o.split("*").map(Vd);return new RegExp(`^${t.join(".+")}$`,i)};var Nd=["--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"],_d=(o,i)=>window.getComputedStyle(o).getPropertyValue(i).trim(),El=o=>{let i={};for(let t of Nd){let e=_d(o,t);e&&(i[t]=e);}return i};var Bd=["selected-files-change","toolbar-state-change"],zd=o=>{if(!o||typeof o!="object"||!("type"in o))return false;let i=o.type;return !(typeof i!="string"||!Bd.includes(i))},fo=class{constructor(i,t){this.Fr=new Map;this.dc=i=>{if(i.source!==this.js)return;let t=i.data;if(!zd(t))return;let e=this.Fr.get(t.type);if(e)for(let r of e)r(t);};this.js=i,this.uc=t,window.addEventListener("message",this.dc);}on(i,t){let e=this.Fr.get(i)??new Set;this.Fr.has(i)||this.Fr.set(i,e),e.add(t);}send(i){let t=this.uc();this.js.postMessage(i,t);}destroy(){window.removeEventListener("message",this.dc);}};function Tl(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("&")}var Hd={[mt.GDRIVE]:"ngdrive"},gt=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Ke=I();this.Nr=null;this.Gs=[];this.qs=false;this.Ws=false;this.Zs=false;this.Ys=false;this.Vr=false;this.Xs=false;this.Qs="uc-hidden";this.pc=true;this.ns=()=>{for(let t of this.Gs){let e=this.Gp(t),{filename:r}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:r,source:s});}this.routerLayer.navigateAfterFileAdd();};this.$t=()=>{this.historyBack();};this.Qp=()=>{this.bt?.send({type:"select-all"});};this.Jp=()=>{this.bt?.send({type:"deselect-all"});};}get jp(){if(!this.Nr)return "";let{selectedCount:t,total:e}=this.Nr;return this.l10n("selected-count",{count:t,total:e})}get activityParams(){let t=super.activityParams;if("externalSourceType"in t)return t;throw new Error("External Source activity params not found")}initCallback(){super.initCallback();let{externalSourceType:t}=this.activityParams;t?this.hc():console.error('Param "externalSourceType" is required for external source activity'),this.sub("*currentActivityParams",()=>{setTimeout(()=>{this.isConnected&&(this.fc(),this.hc());});}),this.subConfigValue("multiple",e=>{this.Vr=e;}),this.subConfigValue("localeName",()=>{this.mc();}),this.subConfigValue("externalSourcesEmbedCss",e=>{this.gc(e);});}Gp(t){if(t.alternatives){let e=Y(this.cfg.externalSourcesPreferredTypes);for(let r of e){let s=wl(r);for(let[n,a]of Object.entries(t.alternatives))if(s.test(n))return a}}return t.url}qp(t){this.pc=t.isVisible;}async Wp(t){if(this.cfg.multiple!==t.isMultipleMode){console.error("Multiple mode mismatch");return}this.Zp(t.selectedCount,t.total),this.Qs=t.isReady?"":"uc-hidden",this.qs=t.isReady,this.Ws=t.isReady&&t.selectedFiles.length>0,this.Vr=t.isMultipleMode&&t.total>0,this.Zs=t.selectedCount<t.total,this.Ys=t.selectedCount===t.total,this.Gs=t.selectedFiles??[],this.Xs=t.total>0;}vc(){this.gc(this.cfg.externalSourcesEmbedCss),this.Yp(),this.mc();}Yp(){this.bt?.send({type:"set-theme-definition",theme:El(this)});}gc(t){this.bt?.send({type:"set-embed-css",css:t});}mc(){this.bt?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}Xp(){let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:r,multiple:s}=this.cfg,{externalSourceType:n}=this.activityParams,a=Hd[n]??n,c={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||bl(),debug:this.cfg.debug},d=new URL(`/window4/${a}`,r);return d.search=Tl(c),d.toString()}Zp(t,e){this.Nr={selectedCount:t,total:e};}hc(){let t=document.createElement("iframe");t.src=this.Xp(),t.marginHeight=0,t.marginWidth=0,t.frameBorder="0",t.allowTransparency=true,t.addEventListener("load",this.vc.bind(this)),t.addEventListener("load",this.vc.bind(this)),this.Ke.value&&(this.Ke.value.innerHTML="",this.Ke.value.appendChild(t)),t.contentWindow&&(this.bt?.destroy(),this.bt=new fo(t.contentWindow,()=>this.cfg.socialBaseUrl),this.bt.on("selected-files-change",this.Wp.bind(this)),this.bt.on("toolbar-state-change",this.qp.bind(this)),this.yc());}fc(){this.bt?.destroy(),this.bt=void 0,this.Ke.value&&(this.Ke.value.innerHTML=""),this.yc();}yc(){this.Gs=[],this.qs=false,this.Ws=false,this.Zs=false,this.Ys=false,this.Vr=false,this.Xs=false,this.Qs="uc-hidden",this.Nr=null;}disconnectedCallback(){super.disconnectedCallback(),this.fc();}render(){return v`<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 ${O(this.Ke)} class="uc-iframe-wrapper"></div><div class="uc-toolbar" ?hidden=${!this.pc}><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.$t} >${this.l10n("cancel")}</button><div class="uc-selection-status-box" ?hidden=${!this.Vr} ><span>${this.jp}</span><button type="button" @click=${this.Qp} ?hidden=${!this.Zs} >${this.l10n("select-all")}</button><button type="button" @click=${this.Jp} ?hidden=${!this.Ys} >${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.ns} ?disabled=${!this.Ws} ?hidden=${!this.Xs} ><uc-spinner ?hidden=${this.qs}></uc-spinner><span class=${this.Qs}>${this.l10n("done")}</span></button></div></div>`}};p([f()],gt.prototype,"Gs",2),p([f()],gt.prototype,"qs",2),p([f()],gt.prototype,"Ws",2),p([f()],gt.prototype,"Zs",2),p([f()],gt.prototype,"Ys",2),p([f()],gt.prototype,"Vr",2),p([f()],gt.prototype,"Xs",2),p([f()],gt.prototype,"Qs",2),p([f()],gt.prototype,"pc",2);var Cl=()=>typeof navigator.permissions<"u";var Kd={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},jd=["camera","microphone"];function go(o){let i=Math.floor(o/60).toString().padStart(2,"0"),t=Math.floor(o%60).toString().padStart(2,"0");return `${i}:${t}`}var xl="image/jpeg",Sl="video/webm",B=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this._r=null;this.Js=false;this.Pi=[];this.Ot=null;this.It=null;this.Br=null;this.zr=null;this.v=null;this.Li={};this.Mt=null;this.i=null;this.je=[];this.Ge=[];this.th={};this.Hr=[];this.Kr=null;this.bc=()=>{this.wc(),this.Ri="pause";};this.xc=()=>{this.Ri="play",this.eh();};this.Ui=I();this.ue=I();this.W=I();this.Ec=0;this.Tc=0;this.Cc=null;this.jr=true;this.Gr=true;this.ih=Cl();this.Sc=[];this.me=true;this.tn="";this.qe=true;this.ge=true;this.We=true;this.Ac=[];this.ve=true;this.en=true;this.ye=true;this.Ft=true;this.be=true;this.Ze="camera-full";this.Ri="play";this.kc="microphone";this.qr="uc-shot-btn uc-camera-action";this.rh=()=>{if(this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.v}}}),this.v===L.PHOTO&&this.oh(),this.v===L.VIDEO){if(this.Ot?.state==="recording"){this.Mc();return}this.sh();}};this.nh=t=>{let e=t.target;e&&(this.zr=e.value,this.Ye());};this.ah=t=>{let e=t.target;e&&(this.Br=e.value,this.Ye());};this.lh=()=>{this.Ye();};this.ch=()=>{this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.v}}}),this.rh();};this.uh=()=>{this.dh();};this.ph=()=>{this.hh();};this.fh=()=>{this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.v}}}),this.mh();};this.gh=()=>{this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.v}}}),this.vh();};this.Oc=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&this.Ic(r);};this.Pc=()=>{let t=Math.floor((performance.now()-this.Ec+this.Tc)/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=go(e)),this.Mc();return}let r=this.Ui.value;r&&(r.textContent=go(e));}else {let e=this.Ui.value;e&&(e.textContent=go(t));}this.Xe=requestAnimationFrame(this.Pc);};this.yh=()=>{this.Ec=performance.now(),this.Tc=0,this.Pc();};this.Lc=()=>{this.Xe&&cancelAnimationFrame(this.Xe);};this.wc=()=>{let t=this.W.value;if(!t)return;let e=t.currentTime,r=t.duration||1,s=this.ue.value;s&&(s.style.transform=`scaleX(${e/r})`);let n=this.Ui.value;n&&(n.textContent=go(e)),this.Xe=requestAnimationFrame(this.wc);};this.eh=()=>{this.Xe&&cancelAnimationFrame(this.Xe);};this.Xe=null;this.sh=()=>{try{this.Pi=[],this.Li={...this.cfg.mediaRecorderOptions};let{mimeType:t}=this.cfg.mediaRecorderOptions||{};t&&MediaRecorder.isTypeSupported(t)?this.Li.mimeType=t:MediaRecorder.isTypeSupported(Sl)?this.Li.mimeType=Sl: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.yh(),this.classList.add("uc-recording"),this.$i(St.PLAY));}catch(t){console.error("Failed to start recording",t),this.telemetryManager.sendEventError(t,"camera recording. Failed to start recording");}};this.Mc=()=>{this.Ot?.addEventListener("stop",()=>{this.bh(),this.Lc(),this.$i(St.STOP);}),this.Ot?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this.v}}});};this.dh=()=>{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.hh=()=>{this.It?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.kc=t.enabled?"microphone":"microphone-mute",this.en=!t.enabled;});};this.bh=()=>{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.wh(r);}catch(t){console.error("Failed to preview video",t),this.telemetryManager.sendEventError(t,"camera previewing. Failed to preview video");}};this.mh=()=>{if(this.$i(St.RETAKE),this.v===L.VIDEO){this.Di(this.It);let t=this.W.value;t&&(t.muted=true);}this.W.value?.play?.();};this.vh=()=>{if(this.$i(St.ACCEPT),this.v===L.PHOTO){this.Mt?.toBlob(s=>{if(!s)return;let n=this.Rc("camera","jpeg",xl,s);this.Uc(n);},xl);return}let t=new Blob(this.Pi,{type:this.Ot?.mimeType}),e=this.xh(this.Ot?.mimeType),r=this.Rc("video",e,`video/${e}`,t);this.Uc(r),this.Pi=[];};this.Eh=t=>{t===St.SHOT&&(this.be=true,this.ge=true,this.Ft=true,this.We=false,this.me=true),(t===St.RETAKE||t===St.ACCEPT)&&(this.be=!this.Nt.includes(L.VIDEO),this.Ft=!this.Nt.includes(L.PHOTO),this.ge=false,this.We=true,this.me=this.je.length<=1);};this.Th=t=>{t===St.PLAY&&(this.qe=false,this.Ft=true,this.me=true,this.ve=true,this.Ri="pause",this.Ze="square",this.qr="uc-shot-btn uc-camera-action uc-stop-record"),t===St.STOP&&(this.qe=false,this.ge=true,this.ye=true,this.We=false),(t===St.RETAKE||t===St.ACCEPT)&&(this.qe=true,this.be=!this.Nt.includes(L.VIDEO),this.Ft=!this.Nt.includes(L.PHOTO),this.ge=false,this.We=true,this.ye=!this.cfg.enableAudioRecording,this.Ze="video-camera-full",this.qr="uc-shot-btn uc-camera-action",this.ve=!this.cfg.enableAudioRecording||this.Ge.length<=1,this.me=this.je.length<=1);};this.$i=t=>{this.v===L.PHOTO&&(t==="shot"||t==="retake"||t==="accept")&&this.Eh(t),this.v===L.VIDEO&&(t==="play"||t==="stop"||t==="retake"||t==="accept"||t==="pause"||t==="resume")&&this.Th(t);};this.Ic=t=>{t===L.PHOTO&&(this.Ze="camera-full",this.ve=true,this.ye=true),t===L.VIDEO&&(this.Ri="play",this.Ze="video-camera-full",this.ve=!this.cfg.enableAudioRecording||this.Ge.length<=1,this.ye=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId:t}}}),this.v=t;};this.Rc=(t,e,r,s)=>{let n=Date.now(),a=`${t}-${n}.${e}`;return new File([s],a,{lastModified:n,type:r})};this.Uc=t=>{this.api.addFileFromObject(t,{source:R.CAMERA}),this.routerLayer.navigateAfterFileAdd();};this.Fi=F(t=>{this.classList.toggle("uc-initialized",t==="granted");let e=this.v===L.VIDEO&&this.cfg.enableAudioRecording,r=this.v===L.PHOTO?"camera-full":"video-camera-full";t==="granted"?(this.jr=false,this.ge=false,this.Ft=!this.Nt.includes(L.PHOTO),this.be=!this.Nt.includes(L.VIDEO),this.Gr=true,this.qe=true,this.Ze=r,this.ye=!e,this.ve=!e):t==="prompt"?(this.tn="camera-permissions-prompt",this.jr=true,this.ge=true,this.Ft=true,this.Gr=false,this.nn()):(this.tn="camera-permissions-denied",this.jr=true,this.Gr=false,this.Ft=!this.Nt.includes(L.PHOTO),this.be=!this.Nt.includes(L.VIDEO),this.We=true,this.qr="uc-shot-btn uc-camera-action",this.nn());},300);this.Ch=()=>{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.nn=()=>{this.Js&&(this.W.value&&(this.W.value.volume=0),this.Kr?.getTracks?.()?.[0]?.stop(),this.rn(this.W.value),this.Di(null),this.Ch(),this.Lc(),this.Js=false);};this.Ye=async()=>{let t={video:{...Kd},audio:this.cfg.enableAudioRecording?{}:false};this.zr&&(t.video={deviceId:{exact:this.zr}}),this.Br&&this.cfg.enableAudioRecording&&(t.audio={deviceId:{exact:this.Br}}),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.Js=!0,this.Fi("granted");}catch(e){this.Fi("denied"),console.log("Failed to capture camera",e),this.telemetryManager.sendEventError(e,"camera capturing. Failed to capture camera");}};this.$c=()=>{this.Ye();};this.Sh=async()=>{try{this.Wr();for(let t of jd){let e=await navigator.permissions.query({name:t});this.th[t]=e,e.addEventListener("change",this.$c),this.Hr.push(()=>{e.removeEventListener("change",this.$c);});}this._r=()=>{this.Wr();};}catch(t){this.Wr(),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.Ye();}};this.Ah=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this.an(),navigator.mediaDevices.addEventListener("devicechange",this.an);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.an=async()=>{try{let t=await navigator.mediaDevices.enumerateDevices();this.je=t.filter(e=>e.kind==="videoinput").map((e,r)=>({text:e.label.trim()||`${this.l10n("caption-camera")} ${r+1}`,value:e.deviceId})),this.Ge=this.cfg.enableAudioRecording?t.filter(e=>e.kind==="audioinput").map(e=>({text:e.label.trim(),value:e.deviceId})):[],this.Sc=this.je,this.me=this.je.length<=1,this.zr=this.je[0]?.value??null,this.Ac=this.Ge,this.ve=!this.cfg.enableAudioRecording||this.Ge.length<=1,this.Br=this.Ge[0]?.value??null;}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get devices"),console.log("Failed to get devices",t);}};this.kh=async()=>{await this.Sh(),await this.Ah(),await this.Ye(),this.Dc(this.Nt);};this.Mh=async()=>{this._r&&this._r(),window.chrome||this.Fi("denied"),this.nn();};this.Dc=t=>{this.be=!t.includes(L.VIDEO),this.Ft=!t.includes(L.PHOTO);let e=t[0];e&&(!this.v||!t.includes(this.v))&&this.Ic(e);};}wh(t){this.rn(t),t.addEventListener("play",this.bc),t.addEventListener("pause",this.xc);}rn(t){t?.removeEventListener("play",this.bc),t?.removeEventListener("pause",this.xc);}Di(t){this.Kr!==t&&(this.Kr=t,this.sn());}sn(){let t=this.W.value;if(!t)return;let e=this.Kr??null;t.srcObject!==e&&(t.srcObject=e);}oh(){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();}xh(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 n=r.slice(1).join("/")?.split(";")[0];if(n&&e[n])return e[n]}}return "avi"}get Nt(){return Y(this.cfg.cameraModes).filter(t=>t===L.PHOTO||t===L.VIDEO)}Wr(){if(this.Hr.length!==0){for(let t of this.Hr)t();this.Hr=[],this._r=null;}}initCallback(){super.initCallback(),this.subConfigValue("cameraMirror",t=>{this.Cc=t?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",t=>{this.ye=!t,this.en=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isConnected)return;let e=G(t);this.Dc(e.filter(r=>r===L.PHOTO||r===L.VIDEO));}),this.kh();}firstUpdated(t){super.firstUpdated(t),this.sn();}updated(t){super.updated(t),this.sn();}Oh(){this.Wr(),navigator.mediaDevices?.removeEventListener("devicechange",this.an),this.rn(this.W.value),this.Di(null);}disconnectedCallback(){super.disconnectedCallback(),this.Mh(),this.Oh();}render(){return v`<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.me}><uc-icon name="camera"></uc-icon><span>${this.l10n("caption-camera")}</span></div><uc-select class="uc-camera-select" .options=${this.Sc} ?hidden=${this.me} @change=${this.nh} ></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=${Qt({transform:this.Cc})} ?hidden=${this.jr} ${O(this.W)} ></video><div class="uc-message-box" ?hidden=${this.Gr}><span>${this.l10n(this.tn)}</span><button type="button" @click=${this.lh} ?hidden=${this.ih} >${this.l10n("camera-permissions-request")}</button></div></div><div class="uc-controls"><div class="uc-switcher" ?hidden=${!this.qe}><button data-id="photo" type="button" class=${lt({"uc-switch":true,"uc-mini-btn":true,"uc-active":this.v===L.PHOTO})} @click=${this.Oc} ?hidden=${this.Ft} data-testid="tab-photo" ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class=${lt({"uc-switch":true,"uc-mini-btn":true,"uc-active":this.v===L.VIDEO})} @click=${this.Oc} ?hidden=${this.be} data-testid="tab-video" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" @click=${this.uh} ?hidden=${this.qe} data-testid="recording-timer" ><uc-icon name=${this.Ri}></uc-icon><span ${O(this.Ui)}> 00:00 </span><span ${O(this.ue)} class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" ?hidden=${this.We} ><button type="button" class="uc-secondary-btn" @click=${this.fh} >${this.l10n("retake")}</button><button type="button" class="uc-primary-btn" @click=${this.gh} data-testid="accept" >${this.l10n("accept")}</button></div><button type="button" data-testid="shot" @click=${this.ch} class=${this.qr} ?hidden=${this.ge} ><uc-icon name=${this.Ze}></uc-icon></button><div class="uc-select"><button type="button" class="uc-mini-btn uc-btn-microphone" @click=${this.ph} ?hidden=${this.ye} data-testid="toggle-microphone" ><uc-icon name=${this.kc}></uc-icon></button><uc-select class="uc-audio-select" .options=${this.Ac} ?hidden=${this.ve} ?disabled=${this.en} @change=${this.ah} data-testid="audio-select" ></uc-select></div></div>`}};p([f()],B.prototype,"Cc",2),p([f()],B.prototype,"jr",2),p([f()],B.prototype,"Gr",2),p([f()],B.prototype,"ih",2),p([f()],B.prototype,"Sc",2),p([f()],B.prototype,"me",2),p([f()],B.prototype,"tn",2),p([f()],B.prototype,"qe",2),p([f()],B.prototype,"ge",2),p([f()],B.prototype,"We",2),p([f()],B.prototype,"Ac",2),p([f()],B.prototype,"ve",2),p([f()],B.prototype,"en",2),p([f()],B.prototype,"ye",2),p([f()],B.prototype,"Ft",2),p([f()],B.prototype,"be",2),p([f()],B.prototype,"Ze",2),p([f()],B.prototype,"Ri",2),p([f()],B.prototype,"kc",2),p([f()],B.prototype,"qr",2);var Al={id:"camera",setup:async({pluginApi:o,uploaderApi:i})=>{vt({CameraSource:B}),o.registry.registerSource({id:"camera",label:"src-type-camera",icon:"camera",expand:()=>{if(!Qn.htmlMediaCapture)return ["camera"];let t=G(o.config.get("cameraModes"));return t.length?t.map(e=>`mobile-${e}-camera`):["mobile-photo-camera"]},onSelect:()=>{i.setCurrentActivity(D.CAMERA),i.setModalState(true);}}),o.registry.registerSource({id:"mobile-photo-camera",label:"src-type-mobile-photo-camera",icon:"camera",onSelect:()=>{i.openSystemDialog({captureCamera:true,modeCamera:"photo"});}}),o.registry.registerSource({id:"mobile-video-camera",label:"src-type-mobile-video-camera",icon:"camera",onSelect:()=>{i.openSystemDialog({captureCamera:true,modeCamera:"video"});}}),o.registry.registerActivity({id:D.CAMERA,render:t=>{let e=document.createElement("uc-camera-source");return t.append(e),()=>{t.replaceChildren();}}});}};var js={};Zs(js,{BtnUi:()=>At,CloudImageEditor:()=>mo,CloudImageEditorBlock:()=>et,Config:()=>ii,CropFrame:()=>Vi,EditorAspectRatioButtonControl:()=>Bi,EditorCropButtonControl:()=>zi,EditorFilterControl:()=>te,EditorFreeformButtonControl:()=>ho,EditorImageCropper:()=>Ni,EditorImageFader:()=>co,EditorOperationControl:()=>Hi,EditorScroller:()=>Ki,EditorSlider:()=>_i,EditorToolbar:()=>ft,Icon:()=>de,LineLoaderUi:()=>Fi,PresenceToggle:()=>oi,SliderUi:()=>Nt,defineComponents:()=>vt});var Gd="cloud-image-editor",qd="<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>",kl={id:Gd,setup:async({pluginApi:o,uploaderApi:i})=>(vt({...js,...Ks}),o.registry.registerIcon({name:"edit-file",svg:qd}),o.registry.registerFileAction({id:"edit-file",icon:"edit-file",label:"file-item-edit-button",shouldRender:e=>!!(e.isImage&&e.cdnUrl),onClick:e=>{i.setCurrentActivity?.(D.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true);}}),o.registry.registerActivity({id:D.CLOUD_IMG_EDIT,render:e=>{let r=document.createElement("uc-cloud-image-editor-activity");return e.append(r),()=>{e.replaceChildren();}}}),i.on(A.FILE_UPLOAD_SUCCESS,e=>{if(!e.isImage)return;let r=o.config.get("cropPreset"),s=o.config.get("useCloudImageEditor"),n=o.config.get("cloudImageEditorAutoOpen"),a=i.m.size;s&&a===1&&(r||n)&&(i.setCurrentActivity?.(D.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true));}))};var Ml={id:"external-sources",setup:async({pluginApi:o,uploaderApi:i})=>{vt({ExternalSource:gt}),o.registry.registerActivity({id:D.EXTERNAL,render:t=>{let e=document.createElement("uc-external-source");return t.append(e),()=>{t.replaceChildren();}}});for(let t of Object.values(mt))o.registry.registerSource({id:t,label:`src-type-${t}`,icon:t,onSelect:()=>{i.setCurrentActivity(D.EXTERNAL,{externalSourceType:t}),i.setModalState(true);}});}};var yo=()=>{let o=[];return {stack:o,promiseReadJpegChunks:t=>new Promise((e,r)=>{let s=2,n=(c,d)=>{let u=new FileReader;u.addEventListener("load",()=>{d(new DataView(u.result));}),u.addEventListener("error",h=>{r(`Reader error: ${h}`);}),u.readAsArrayBuffer(c);},a=()=>n(t.slice(s,s+128),c=>{let d,u,h;for(d=u=0,h=c.byteLength;h>=0?u<h:u>h;d=h>=0?++u:--u)if(c.getUint8(d)===255){s+=d;break}l();}),l=()=>{let c=s;return n(t.slice(s,s+=4),d=>{if(d.byteLength!==4||d.getUint8(0)!==255){r("Corrupted");return}let u=d.getUint8(1);if(u===218){e(true);return}let h=d.getUint16(2)-2;return n(t.slice(s,s+=h),m=>{if(m.byteLength!==h){r("Corrupted");return}o.push({startPos:c,length:h,marker:u,view:m}),a();})})};FileReader&&DataView||r("Not Support"),n(t.slice(0,2),c=>{c.getUint16(0)!==65496&&r("Not jpeg"),a();});})}},Wd=async o=>{let i=[],{promiseReadJpegChunks:t,stack:e}=yo();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},Ol=async(o,i,t)=>{{let e=[],r=[],{promiseReadJpegChunks:s,stack:n}=yo();await s(o),n.forEach(c=>{if(c.marker===i)return e.push(c.startPos),r.push(c.length)});let a=[o.slice(0,2)];for(let c of t){let d=new DataView(new ArrayBuffer(4));d.setUint16(0,65280+i),d.setUint16(2,c.byteLength+2),a.push(d.buffer),a.push(c);}let l=2;for(let c=0;c<e.length;c++)e[c]>l&&a.push(o.slice(l,e[c])),l=e[c]+r[c]+4;return a.push(o.slice(l,o.size)),new Blob(a,{type:o.type})}};var Ll=(o,i)=>Ol(o,226,i.map(t=>t.buffer)),Zd=async o=>{try{return await Ll(o,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},Yd=(o,i,t)=>new Promise((e,r)=>{let s=n=>{if(!n){r("Failed to convert canvas to blob");return}e(n);};o.toBlob(s,i,t),o.width=o.height=1;}),Gi=()=>{let o=document.createElement("canvas"),i=o.getContext("2d");return {canvas:o,ctx:i}},Xd=o=>{let{ctx:t,canvas:e}=Gi();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},Qd=async o=>{let i=null,{promiseReadJpegChunks:t,stack:e}=yo();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},Jd="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",vo,tp=()=>new Promise(o=>{if(vo!==void 0)o(vo);else {let i=new Image;i.addEventListener("load",()=>{vo=i.naturalWidth<i.naturalHeight,i.src="//:0",o(vo);}),i.src=Jd;}}),ep=(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 n=o.getUint16(r-2,e);for(t=0,s=n;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;}},ip=(o,i)=>{ep(o,(t,e)=>o.setUint16(t,i,e));},rp=async(o,i,t)=>(t&&ip(i,1),Ol(o,225,[i.buffer])),op=(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."));}));}),sp=o=>op(new Image,o),np=[1,3],ap=[192,193,194,195,197,198,199,201,202,203,205,206,207],Il={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},lp=async o=>{let i=false,{promiseReadJpegChunks:t,stack:e}=yo();return await t(o).then(()=>(e.forEach(({marker:r,view:s})=>{if(!i&&ap.indexOf(r)>=0){let n=s.getUint8(5);np.indexOf(n)<0&&(i=true);}}),i)).catch(()=>i)},Pl=(o,i)=>{let t={};return (...e)=>{let r=i(e,t);return r in t?t[r]:t[r]=o(...e)}},Ul=(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],n=!!i[s];if(s>t&&n||s<t&&!n)return s}return t},fe={R:55,G:110,B:165,A:255},cp=`rgba(${fe.R}, ${fe.G}, ${fe.B}, ${fe.A/255})`,Rl=(o,i)=>{try{let t=[o-1,i-1,1,1],{canvas:e,ctx:r}=Gi();e.width=1,e.height=1;let{canvas:s,ctx:n}=Gi();s.width=o,s.height=i,n&&(n.fillStyle=cp,n.fillRect(...t),r.drawImage(s,o-1,i-1,1,1,0,0,1,1));let a=r&&r.getImageData(0,0,1,1).data,l=!1;return a&&(l=a[0]===fe.R&&a[1]===fe.G&&a[2]===fe.B&&a[3]===fe.A),s.width=s.height=1,l}catch{return console.error(`Failed to test for max canvas size of ${o}x${i}.`),false}};function $l(o){return (...i)=>new Promise(t=>{setTimeout(()=>{let e=o(...i);t(e);},0);})}var up=$l(Pl(Rl,Ul)),dp=$l(Pl(Rl,Ul)),Dl=async(o,i)=>{let t=Il.squareSide.find(n=>n*n>=o*i),e=Il.dimension.find(n=>n>=o&&n>=i);if(!t||!e)throw new Error("Not supported");let[r,s]=await Promise.all([up(t,t),dp(e,1)]);if(r&&s)return true;throw new Error("Not supported")},Fl=async(o,i,t)=>{try{let{ctx:e,canvas:r}=Gi();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})}},pp=({img:o,targetW:i,targetH:t})=>Fl(o,i,t),hp=function({sourceW:o,targetW:i,targetH:t,step:e}){let r=[],s=i,n=t;do r.push([s,n]),s=Math.round(s/e),n=Math.round(n/e);while(s<o*e);return r.reverse()},mp=({img:o,sourceW:i,targetW:t,targetH:e,step:r})=>{let s=hp({sourceW:i,targetW:t,targetH:e,step:r});return s.reduce((n,[a,l],c)=>n.then(d=>Dl(a,l).then(()=>Fl(d,a,l)).catch(()=>{if(c===s.length-1)throw new Error("Not supported");return d})),Promise.resolve(o))},fp=()=>/iPad|iPhone|iPod/.test(navigator.platform)?true:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),gp=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),Gs=.71,vp=(o,i)=>{if(o.width*Gs*o.height*Gs<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)),n=Math.floor(i.size/Math.sqrt(i.size*r));return Dl(s,n).then(()=>{let{ctx:a}=Gi();return "imageSmoothingQuality"in a&&!fp()&&!gp?pp({img:o,targetW:s,targetH:n}):mp({img:o,sourceW:t,targetW:s,targetH:n,step:Gs})}).catch(()=>Promise.reject("Not supported"))},Vl=async(o,i)=>{try{if(await lp(o))throw new Error("Should skipped");let e=await Promise.allSettled([Qd(o),tp(),Wd(o)]),s=!e.some(b=>b.status==="rejected"),[n,a,l]=e,c=await Zd(o).catch(()=>o),d=await sp(URL.createObjectURL(c));URL.revokeObjectURL(d.src);let u=await vp(d,i),h="image/jpeg",m=i?.quality||.8;!s&&Xd(u)&&(h="image/png",m=void 0);let g=await Yd(u,h,m);if(s&&n.status==="fulfilled"&&n.value){let b=n.value,w=a.status==="fulfilled"?a.value:!1;g=await rp(g,b,w);}return s&&l.status==="fulfilled"&&l.value.length>0&&(g=await Ll(g,l.value)),g}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})}};var yp=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,Nl=o=>{if(typeof o!="string")return false;let i=yp.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}};var _l={id:"image-shrink",setup({pluginApi:o}){o.registry.registerFileHook({type:"beforeUpload",handler:async({file:i})=>{let t=o.config.get("imageShrink");if(!t)return {file:i};let e=Nl(t);if(!e)return console.warn("[ImageShrinkPlugin] Image shrink settings are invalid, skipping shrinking"),{file:i};try{return {file:await Vl(i,e)}}catch{return {file:i}}}});}};var Bl={id:"instagram",setup({pluginApi:o}){o.registry.registerSource({id:"instagram",label:"src-type-instagram",icon:"instagram",expand:()=>(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"),[]),onSelect:()=>{}});}};var zl={id:R.LOCAL,setup:({pluginApi:o,uploaderApi:i})=>{o.registry.registerSource({id:R.LOCAL,label:"src-type-local",icon:"local",onSelect:()=>{i.openSystemDialog();}});}};var Hl={id:"url-source",setup:async({pluginApi:o,uploaderApi:i})=>{vt({UrlSource:ai}),o.registry.registerActivity({id:D.URL,render:t=>{let e=document.createElement("uc-url-source");return t.append(e),()=>{t.replaceChildren();}}}),o.registry.registerSource({id:"url",label:"src-type-from-url",icon:"url",onSelect:()=>{i.setCurrentActivity(D.URL),i.setModalState(true);}});}};var li=[{configDeps:["useCloudImageEditor"],isEnabled:o=>!!o("useCloudImageEditor"),load:()=>kl},{configDeps:["imageShrink"],isEnabled:o=>!!o("imageShrink"),load:()=>_l},{configDeps:["sourceList"],isEnabled:o=>G(o("sourceList")).includes(R.LOCAL),load:()=>zl},{configDeps:["sourceList"],isEnabled:o=>G(o("sourceList")).includes(R.CAMERA),load:()=>Al},{configDeps:["sourceList"],isEnabled:o=>G(o("sourceList")).includes("instagram"),load:()=>Bl},{configDeps:["sourceList"],isEnabled:o=>Object.values(mt).some(i=>G(o("sourceList")).includes(i)),load:()=>Ml},{configDeps:["sourceList"],isEnabled:o=>G(o("sourceList")).includes(R.URL),load:()=>Hl}];var qi=class extends Yt{constructor(){super();this.headless=false;this.dynamicButton=false;this.init$={...this.init$};}static{this.lazyPlugins=li;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:V.INIT_SOLUTION});}get isDynamicButtonActive(){return this.dynamicButton}Ih(){return v`<uc-dynamic-btn></uc-dynamic-btn>`}Ph(){return v`<uc-simple-btn></uc-simple-btn>`}Lh(){return this.headless?null:this.dynamicButton?this.Ih():this.Ph()}render(){return v` ${super.render()} ${this.Lh()}<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>`}};p([y({type:Boolean})],qi.prototype,"headless",2),p([y({attribute:"dynamic-button",type:Boolean})],qi.prototype,"dynamicButton",2);var bo=class extends Yt{constructor(){super();this.Fc=false;this.$t=()=>{if(this.Nc){let t=this.$["*historyBack"];t?.();return}this.Vc&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{this.lazyPlugins=li;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"];}get Nc(){let t=this.$["*history"];return !t||t.length<=1?false:t[t.length-1]!==$.activities.START_FROM}get Vc(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}ln(){return this.getCssData("--cfg-init-activity")||$.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:V.INIT_SOLUTION});let t=this.ln();this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0&&this.$["*currentActivity"]===t&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST);}),this.sub("*history",()=>{this.Fc=this.Nc||this.Vc;});}render(){return v` ${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.$t} ?hidden=${!this.Fc} >${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-plugin-activity-renderer mode="inline"></uc-plugin-activity-renderer>`}};p([f()],bo.prototype,"Fc",2);var qs="active",wo="",ge=class extends Yt{constructor(){super();this.cn=false;this.Zr=false;this.Yr=wo;this.un=wo;this.mi="choose-file";this.ui=t=>{t.id===$.activities.CLOUD_IMG_EDIT&&(this.Yr=qs),this.$["*currentActivity"]===$.activities.UPLOAD_LIST&&(this.Yr=qs,this.Zr=true);let e=this.$["*uploadList"];(!e||e.length<=0)&&(this.un=qs);};this.di=t=>{t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST,this.Zr=false),t.id===$.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{this.lazyPlugins=li;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];}ln(){return this.getCssData("--cfg-init-activity")||$.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:V.INIT_SOLUTION});let t=this.ln();this.sub("*currentActivity",e=>{e===$.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0?(this.$["*currentActivity"]=$.activities.UPLOAD_LIST,this.un=wo):(this.Yr=wo,this.Zr=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.cn=!r):(this.style.removeProperty("--uc-grid-col"),this.cn=false);});}),this.subConfigValue("multiple",e=>{this.mi=e?"choose-files":"choose-file";}),this.modalManager?.subscribe(X.OPEN,this.ui),this.modalManager?.subscribe(X.CLOSE,this.di);}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(X.OPEN,this.ui),this.modalManager?.unsubscribe(X.CLOSE,this.di);}render(){return v` ${super.render()}<uc-start-from ?hidden=${this.Zr} class=${this.un}><uc-drop-area ?single=${this.cn} 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.Yr}></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>`}};p([f()],ge.prototype,"cn",2),p([f()],ge.prototype,"Zr",2),p([f()],ge.prototype,"Yr",2),p([f()],ge.prototype,"un",2),p([f()],ge.prototype,"mi",2);/*! For license information please see file-uploader.min.js.LEGAL.txt */
8
- export{$ as ActivityBlock,Is as ActivityHeader,Uo as BaseComponent,C as Block,At as BtnUi,B as CameraSource,mo as CloudImageEditor,ji as CloudImageEditorActivity,et as CloudImageEditorBlock,ii as Config,As as Copyright,Vi as CropFrame,H as Data,bt as DropArea,lo as DropDown,Vt as DynamicBtn,Bi as EditorAspectRatioButtonControl,zi as EditorCropButtonControl,te as EditorFilterControl,ho as EditorFreeformButtonControl,Ni as EditorImageCropper,co as EditorImageFader,Hi as EditorOperationControl,Ki as EditorScroller,_i as EditorSlider,ft as EditorToolbar,gt as ExternalSource,mt as ExternalUploadSource,Jt as FileActionButton,Ps as FileItem,bo as FileUploaderInline,ge as FileUploaderMinimal,qi as FileUploaderRegular,ro as FormInput,de as Icon,Es as Img,Fi as LineLoaderUi,Ii as Modal,X as ModalEvents,zs as NoWrapModeDynamicBtn,Ut as PACKAGE_NAME,Rt as PACKAGE_VERSION,$i as PluginActivityHost,ri as PluginActivityRenderer,oi as PresenceToggle,Bs as PrimaryAction,Xe as ProgressBar,Oi as ProgressBarCommon,Qe as Select,Ri as SimpleBtn,Nt as SliderUi,Yt as SolutionBlock,he as SourceBtn,Li as SourceList,ks as Spinner,Os as StartFrom,ei as Thumb,rt as UID,Ls as UploadCtxProvider,Lt as UploadList,R as UploadSource,M as UploaderBlock,ai as UrlSource,vt as defineComponents,wn as defineLocale,pc as loadFileUploaderFrom,yr as toKebabCase};
7
+ var Zs=Object.defineProperty;var Gl=Object.getOwnPropertyDescriptor;var Ys=(o,i)=>{for(var t in i)Zs(o,t,{get:i[t],enumerable:true});};var p=(o,i,t,e)=>{for(var r=e>1?void 0:e?Gl(i,t):i,s=o.length-1,n;s>=0;s--)(n=o[s])&&(r=(e?n(i,t,r):n(r))||r);return e&&r&&Zs(i,t,r),r};var Mt=[],ee=0,Wi=4,Xs=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=ee+Wi;s<Mt.length;)Mt[s]===e?Mt.splice(s,Wi):s+=Wi;let r=i.indexOf(e);~r&&(i.splice(r,1),--t.lc||t.off());}},notify(e,r){let s=!Mt.length;for(let n of i)Mt.push(n,t.value,e,r);if(s){for(ee=0;ee<Mt.length;ee+=Wi)Mt[ee](Mt[ee+1],Mt[ee+2],Mt[ee+3]);Mt.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};function Zi(o,i,t){let e=new Set(i).add(void 0);return o.listen((r,s,n)=>{e.has(n)&&t(r,s,n);})}function To(o,i,t){let e=Zi(o,i,t);return t(o.value),e}var Co=(o={})=>{let i=Xs(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};var H=class o{static{this.Qt=new Map;}constructor(i,t){this.re=i,this.ue=t;}get id(){return this.re}pub(i,t){i in this.ue.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this.ue.setKey(i,t);}sub(i,t,e=true){return (e?To:Zi)(this.ue,[i],s=>{t(s[i]);})}read(i){return i in this.ue.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this.ue.get()[i]}add(i,t,e=false){(!(i in this.ue.get())||e)&&this.ue.setKey(i,t);}has(i){return i in this.ue.get()}get store(){return this.ue.get()}static registerCtx(i,t){if(o.Qt.has(t))throw new Error(`PubSub: Context with id "${t}" already exists`);let e=Co(i);return o.Qt.set(t,e),new o(t,e)}static deleteCtx(i){o.Qt.delete(i);}static getCtx(i){let t=o.Qt.get(i);return t?new o(i,t):null}static hasCtx(i){return o.Qt.has(i)}};var Yi=globalThis,Qi=Yi.ShadowRoot&&(Yi.ShadyCSS===void 0||Yi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Js=Symbol(),Qs=new WeakMap,Xi=class{constructor(i,t,e){if(this._c=true,e!==Js)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(Qi&&i===void 0){let e=t!==void 0&&t.length===1;e&&(i=Qs.get(t)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),e&&Qs.set(t,i));}return i}toString(){return this.cssText}},tn=o=>new Xi(typeof o=="string"?o:o+"",void 0,Js);var en=(o,i)=>{if(Qi)o.adoptedStyleSheets=i.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet);else for(let t of i){let e=document.createElement("style"),r=Yi.litNonce;r!==void 0&&e.setAttribute("nonce",r),e.textContent=t.cssText,o.appendChild(e);}},xo=Qi?o=>o:o=>o instanceof CSSStyleSheet?(i=>{let t="";for(let e of i.cssRules)t+=e.cssText;return tn(t)})(o):o;var{is:Wl,defineProperty:Zl,getOwnPropertyDescriptor:Yl,getOwnPropertyNames:Xl,getOwnPropertySymbols:Ql,getPrototypeOf:Jl}=Object,Ji=globalThis,rn=Ji.trustedTypes,tc=rn?rn.emptyScript:"",ec=Ji.reactiveElementPolyfillSupport,ci=(o,i)=>o,ui={toAttribute(o,i){switch(i){case Boolean:o=o?tc: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}},tr=(o,i)=>!Wl(o,i),on={attribute:true,type:String,converter:ui,reflect:false,useDefault:false,hasChanged:tr};Symbol.metadata??=Symbol("metadata"),Ji.litPropertyMetadata??=new WeakMap;var zt=class extends HTMLElement{static addInitializer(i){this.Xr(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this.Ni&&[...this.Ni.keys()]}static createProperty(i,t=on){if(t.state&&(t.attribute=false),this.Xr(),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&&Zl(this.prototype,i,r);}}static getPropertyDescriptor(i,t,e){let{get:r,set:s}=Yl(this.prototype,i)??{get(){return this[t]},set(n){this[t]=n;}};return {get:r,set(n){let a=r?.call(this);s?.call(this,n),this.requestUpdate(i,a,e);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??on}static Xr(){if(this.hasOwnProperty(ci("elementProperties")))return;let i=Jl(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(ci("finalized")))return;if(this.finalized=true,this.Xr(),this.hasOwnProperty(ci("properties"))){let t=this.properties,e=[...Xl(t),...Ql(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.Qr(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(xo(r));}else i!==void 0&&t.push(xo(i));return t}static Qr(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.wt=null,this.Bc();}Bc(){this.Jr=new Promise(i=>this.enableUpdating=i),this._e=new Map,this.zc(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this.Jt??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this.Jt?.delete(i);}zc(){let i=new Map,t=this.constructor.elementProperties;for(let e of t.keys())this.hasOwnProperty(e)&&(i.set(e,this[e]),delete this[e]);i.size>0&&(this.Vi=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return en(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.Jt?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this.Jt?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,t,e){this.eo(i,e);}Hc(i,t){let e=this.constructor.elementProperties.get(i),r=this.constructor.Qr(i,e);if(r!==void 0&&e.reflect===true){let s=(e.converter?.toAttribute!==void 0?e.converter:ui).toAttribute(t,e.type);this.wt=i,s==null?this.removeAttribute(r):this.setAttribute(r,s),this.wt=null;}}eo(i,t){let e=this.constructor,r=e.Ni.get(i);if(r!==void 0&&this.wt!==r){let s=e.getPropertyOptions(r),n=typeof s.converter=="function"?{fromAttribute:s.converter}:s.converter?.fromAttribute!==void 0?s.converter:ui;this.wt=r;let a=n.fromAttribute(t,s.type);this[r]=a??this.to?.get(r)??a,this.wt=null;}}requestUpdate(i,t,e,r=false,s){if(i!==void 0){let n=this.constructor;if(r===false&&(s=this[i]),e??=n.getPropertyOptions(i),!((e.hasChanged??tr)(s,t)||e.useDefault&&e.reflect&&s===this.to?.get(i)&&!this.hasAttribute(n.Qr(i,e))))return;this.C(i,t,e);}this.isUpdatePending===false&&(this.Jr=this.Kc());}C(i,t,{useDefault:e,reflect:r,wrapped:s},n){e&&!(this.to??=new Map).has(i)&&(this.to.set(i,n??t??this[i]),s!==true||n!==void 0)||(this._e.has(i)||(this.hasUpdated||e||(t=void 0),this._e.set(i,t)),r===true&&this.wt!==i&&(this.dn??=new Set).add(i));}async Kc(){this.isUpdatePending=true;try{await this.Jr;}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:n}=s,a=this[r];n!==true||this._e.has(r)||a===void 0||this.C(r,void 0,s,a);}}let i=false,t=this._e;try{i=this.shouldUpdate(t),i?(this.willUpdate(t),this.Jt?.forEach(e=>e.hostUpdate?.()),this.update(t)):this.io();}catch(e){throw i=false,this.io(),e}i&&this.jc(t);}willUpdate(i){}jc(i){this.Jt?.forEach(t=>t.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}io(){this._e=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.Jr}shouldUpdate(i){return true}update(i){this.dn&&=this.dn.forEach(t=>this.Hc(t,this[t])),this.io();}updated(i){}firstUpdated(i){}};zt.elementStyles=[],zt.shadowRootOptions={mode:"open"},zt[ci("elementProperties")]=new Map,zt[ci("finalized")]=new Map,ec?.({ReactiveElement:zt}),(Ji.reactiveElementVersions??=[]).push("2.1.2");var Ao=globalThis,sn=o=>o,er=Ao.trustedTypes,nn=er?er.createPolicy("lit-html",{createHTML:o=>o}):void 0,ko="$lit$",Ht=`lit$${Math.random().toFixed(9).slice(2)}$`,Mo="?"+Ht,ic=`<${Mo}>`,we=document,pi=()=>we.createComment(""),hi=o=>o===null||typeof o!="object"&&typeof o!="function",Io=Array.isArray,pn=o=>Io(o)||typeof o?.[Symbol.iterator]=="function",So=`[ \f\r]`,di=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,an=/-->/g,ln=/>/g,ye=RegExp(`>|${So}(?:([^\\s"'>=/]+)(${So}*=${So}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),cn=/'/g,un=/"/g,hn=/^(?:script|style|textarea|title)$/i,Oo=o=>(i,...t)=>({Me:o,strings:i,values:t}),v=Oo(1),it=Symbol.for("lit-noChange"),U=Symbol.for("lit-nothing"),dn=new WeakMap,be=we.createTreeWalker(we,129);function mn(o,i){if(!Io(o)||!o.hasOwnProperty("raw"))throw Error("invalid template strings array");return nn!==void 0?nn.createHTML(i):i}var fn=(o,i)=>{let t=o.length-1,e=[],r,s=i===2?"<svg>":i===3?"<math>":"",n=di;for(let a=0;a<t;a++){let l=o[a],c,u,d=-1,h=0;for(;h<l.length&&(n.lastIndex=h,u=n.exec(l),u!==null);)h=n.lastIndex,n===di?u[1]==="!--"?n=an:u[1]!==void 0?n=ln:u[2]!==void 0?(hn.test(u[2])&&(r=RegExp("</"+u[2],"g")),n=ye):u[3]!==void 0&&(n=ye):n===ye?u[0]===">"?(n=r??di,d=-1):u[1]===void 0?d=-2:(d=n.lastIndex-u[2].length,c=u[1],n=u[3]===void 0?ye:u[3]==='"'?un:cn):n===un||n===cn?n=ye:n===an||n===ln?n=di:(n=ye,r=void 0);let m=n===ye&&o[a+1].startsWith("/>")?" ":"";s+=n===di?l+ic:d>=0?(e.push(c),l.slice(0,d)+ko+l.slice(d)+Ht+m):l+Ht+(d===-2?a:m);}return [mn(o,s+(o[t]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),e]},mi=class o{constructor({strings:i,Me:t},e){let r;this.parts=[];let s=0,n=0,a=i.length-1,l=this.parts,[c,u]=fn(i,t);if(this.el=o.createElement(c,e),be.currentNode=this.el.content,t===2||t===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes);}for(;(r=be.nextNode())!==null&&l.length<a;){if(r.nodeType===1){if(r.hasAttributes())for(let d of r.getAttributeNames())if(d.endsWith(ko)){let h=u[n++],m=r.getAttribute(d).split(Ht),g=/([.?@])?(.*)/.exec(h);l.push({type:1,index:s,name:g[2],strings:m,ctor:g[1]==="."?rr:g[1]==="?"?or:g[1]==="@"?sr:Te}),r.removeAttribute(d);}else d.startsWith(Ht)&&(l.push({type:6,index:s}),r.removeAttribute(d));if(hn.test(r.tagName)){let d=r.textContent.split(Ht),h=d.length-1;if(h>0){r.textContent=er?er.emptyScript:"";for(let m=0;m<h;m++)r.append(d[m],pi()),be.nextNode(),l.push({type:2,index:++s});r.append(d[h],pi());}}}else if(r.nodeType===8)if(r.data===Mo)l.push({type:2,index:s});else {let d=-1;for(;(d=r.data.indexOf(Ht,d+1))!==-1;)l.push({type:7,index:s}),d+=Ht.length-1;}s++;}}static createElement(i,t){let e=we.createElement("template");return e.innerHTML=i,e}};function Ee(o,i,t=o,e){if(i===it)return i;let r=e!==void 0?t.Gc?.[e]:t.qc,s=hi(i)?void 0:i.ro;return r?.constructor!==s&&(r?.pn?.(false),s===void 0?r=void 0:(r=new s(o),r.oo(o,t,e)),e!==void 0?(t.Gc??=[])[e]=r:t.qc=r),r!==void 0&&(i=Ee(o,r.Wc(o,i.values),r,e)),i}var ir=class{constructor(i,t){this.hn=[],this.de=void 0,this.mn=i,this.m=t;}get parentNode(){return this.m.parentNode}get X(){return this.m.X}u(i){let{el:{content:t},parts:e}=this.mn,r=(i?.creationScope??we).importNode(t,true);be.currentNode=r;let s=be.nextNode(),n=0,a=0,l=e[0];for(;l!==void 0;){if(n===l.index){let c;l.type===2?c=new Re(s,s.nextSibling,this,i):l.type===1?c=new l.ctor(s,l.name,l.strings,this,i):l.type===6&&(c=new nr(s,this,i)),this.hn.push(c),l=e[++a];}n!==l?.index&&(s=be.nextNode(),n++);}return be.currentNode=we,r}p(i){let t=0;for(let e of this.hn)e!==void 0&&(e.strings!==void 0?(e.pe(i,e,t),t+=e.strings.length-2):e.pe(i[t])),t++;}},Re=class o{get X(){return this.m?.X??this.gn}constructor(i,t,e,r){this.type=2,this.r=U,this.de=void 0,this.we=i,this.xt=t,this.m=e,this.options=r,this.gn=r?.isConnected??true;}get parentNode(){let i=this.we.parentNode,t=this.m;return t!==void 0&&i?.nodeType===11&&(i=t.parentNode),i}get startNode(){return this.we}get endNode(){return this.xt}pe(i,t=this){i=Ee(this,i,t),hi(i)?i===U||i==null||i===""?(this.r!==U&&this.Et(),this.r=U):i!==this.r&&i!==it&&this.vn(i):i.Me!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):pn(i)?this.k(i):this.vn(i);}O(i){return this.we.parentNode.insertBefore(i,this.xt)}T(i){this.r!==i&&(this.Et(),this.r=this.O(i));}vn(i){this.r!==U&&hi(this.r)?this.we.nextSibling.data=i:this.T(we.createTextNode(i)),this.r=i;}$(i){let{values:t,Me:e}=i,r=typeof e=="number"?this.Zc(i):(e.el===void 0&&(e.el=mi.createElement(mn(e.h,e.h[0]),this.options)),e);if(this.r?.mn===r)this.r.p(t);else {let s=new ir(r,this),n=s.u(this.options);s.p(t),this.T(n),this.r=s;}}Zc(i){let t=dn.get(i.strings);return t===void 0&&dn.set(i.strings,t=new mi(i)),t}k(i){Io(this.r)||(this.r=[],this.Et());let t=this.r,e,r=0;for(let s of i)r===t.length?t.push(e=new o(this.O(pi()),this.O(pi()),this,this.options)):e=t[r],e.pe(s),r++;r<t.length&&(this.Et(e&&e.xt.nextSibling,r),t.length=r);}Et(i=this.we.nextSibling,t){for(this._i?.(false,true,t);i!==this.xt;){let e=sn(i).nextSibling;sn(i).remove(),i=e;}}setConnected(i){this.m===void 0&&(this.gn=i,this._i?.(i));}},Te=class{get tagName(){return this.element.tagName}get X(){return this.m.X}constructor(i,t,e,r,s){this.type=1,this.r=U,this.de=void 0,this.element=i,this.name=t,this.m=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;}pe(i,t=this,e,r){let s=this.strings,n=false;if(s===void 0)i=Ee(this,i,t,0),n=!hi(i)||i!==this.r&&i!==it,n&&(this.r=i);else {let a=i,l,c;for(i=s[0],l=0;l<s.length-1;l++)c=Ee(this,a[e+l],t,l),c===it&&(c=this.r[l]),n||=!hi(c)||c!==this.r[l],c===U?i=U:i!==U&&(i+=(c??"")+s[l+1]),this.r[l]=c;}n&&!r&&this.j(i);}j(i){i===U?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},rr=class extends Te{constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===U?void 0:i;}},or=class extends Te{constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==U);}},sr=class extends Te{constructor(i,t,e,r,s){super(i,t,e,r,s),this.type=5;}pe(i,t=this){if((i=Ee(this,i,t,0)??U)===it)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);}},nr=class{constructor(i,t,e){this.element=i,this.type=6,this.de=void 0,this.m=t,this.options=e;}get X(){return this.m.X}pe(i){Ee(this,i);}},gn={I:Re},rc=Ao.litHtmlPolyfillSupport;rc?.(mi,Re),(Ao.litHtmlVersions??=[]).push("3.3.2");var ar=(o,i,t)=>{let e=t?.renderBefore??i,r=e.Yc;if(r===void 0){let s=t?.renderBefore??null;e.Yc=r=new Re(i.insertBefore(pi(),s),s,void 0,t??{});}return r.pe(o),r};var Lo=globalThis,Ct=class extends zt{constructor(){super(...arguments),this.renderOptions={host:this},this.so=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.so=ar(t,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.so?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.so?.setConnected(false);}render(){return it}};Ct.Rh=true,Ct.finalized=true,Lo.litElementHydrateSupport?.({LitElement:Ct});var oc=Lo.litElementPolyfillSupport;oc?.({LitElement:Ct});(Lo.litElementVersions??=[]).push("4.2.2");var sc=/\\([0-9a-fA-F]{1,6} ?)/g;function nc(o){return o.length<2?false:(o[0]==='"'||o[0]==="'")&&(o[o.length-1]==='"'||o[o.length-1]==="'")}function ac(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}function lc(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}function vn(o){let i=o;nc(o)&&(i=ac(i),i=i.replace(sc,(t,e)=>String.fromCodePoint(parseInt(e.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=lc(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}function $e(o){class i extends o{constructor(){super(...arguments);this.yn=null;this.ao=null;}getCssData(r,s=false){let n=this.yn??Object.create(null);if(!Object.keys(n).includes(r)||!n[r]){this.ao||(this.ao=window.getComputedStyle(this));let a=this.ao.getPropertyValue(r).trim();try{n[r]=vn(a);}catch(l){s||console.warn(`CSS Data error: ${r}`,l),n[r]=null;}}return this.yn=n,n[r]}}return i}function lr(o){class i extends o{constructor(){super(...arguments);this.willYield=true;this.Be={};this.ze=null;this.Bi=false;}createRenderRoot(){return this}connectedCallback(){this.ze||(this.ze=Array.from(this.childNodes)),super.connectedCallback();}Xc(){if(this.Bi)return;this.Bi=true,this.Be={};let r=Array.from(this.childNodes),s=r.length?r:this.ze??[];for(let n of s){let a=this.bn(n),l=this.Be[a]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),l.push(n),this.Be[a]=l;}this.ze=null;}bn(r){return r instanceof Comment&&r.nextSibling instanceof Element?this.bn(r.nextSibling):"contentFor"in r?r.contentFor||"":r instanceof Element&&r.hasAttribute("content-for")&&r.getAttribute("content-for")||""}Qc(r){return !r.textContent||!r.textContent.trim()}Jc(r){let s=this.Be[r];return !s||s.every(n=>n instanceof Comment||n instanceof Text&&this.Qc(n))}update(r){!this.hasUpdated&&this.willYield&&this.Xc(),super.update(r);}yield(r,s){if(r===""&&!this.Be[r]&&!this.Bi&&this.ze?.length){let a=[];for(let l of this.ze)l instanceof Element&&(l.removeAttribute("slot"),l.removeAttribute("content-for")),a.push(l);this.Be[r]=a,this.Bi=true,this.ze=null;}let n=this.Be[r];return v` ${n} ${this.Jc(r)?s:void 0} `}}return i}function De(o){class i extends o{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}var ie=class extends Event{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{constructor(i,t,e,r){if(this.subscribe=false,this.provided=false,this.value=void 0,this.t=(s,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=false,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=s,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=true,this.callback&&this.callback(s,n)),this.unsubscribe=n;},this.host=i,t.context!==void 0){let s=t;this.context=s.context,this.callback=s.callback,this.subscribe=s.subscribe??false;}else this.context=t,this.callback=e,this.subscribe=r??false;this.host.addController(this);}hostConnected(){this.dispatchRequest();}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0);}dispatchRequest(){this.host.dispatchEvent(new ie(this.context,this.host,this.t,this.subscribe));}};var cr=class{get value(){return this.o}set value(i){this.setValue(i);}setValue(i,t=false){let e=t||!Object.is(i,this.o);this.o=i,e&&this.updateObservers();}constructor(i){this.subscriptions=new Map,this.updateObservers=()=>{for(let[t,{disposer:e}]of this.subscriptions)t(this.o,e);},i!==void 0&&(this.value=i);}addCallback(i,t,e){if(!e)return void i(this.value);this.subscriptions.has(i)||this.subscriptions.set(i,{disposer:()=>{this.subscriptions.delete(i);},consumerHost:t});let{disposer:r}=this.subscriptions.get(i);i(this.value,r);}clearCallbacks(){this.subscriptions.clear();}};var Po=class extends Event{constructor(i,t){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=t;}},Ve=class extends cr{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[n,{consumerHost:a}]of this.subscriptions)s.has(n)||(s.add(n),a.dispatchEvent(new ie(this.context,a,n,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 Po(this.context,this.host));}};var uc={attribute:true,type:String,converter:ui,reflect:false,hasChanged:tr},dc=(o=uc,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:n}=t;return {set(a){let l=i.get.call(this);i.set.call(this,a),this.requestUpdate(n,l,o,true,a);},init(a){return a!==void 0&&this.C(n,void 0,o,a),a}}}if(e==="setter"){let{name:n}=t;return function(a){let l=this[n];i.call(this,a),this.requestUpdate(n,l,o,true,a);}}throw Error("Unsupported decorator location: "+e)};function y(o){return (i,t)=>typeof t=="object"?dc(o,i,t):((e,r,s)=>{let n=r.hasOwnProperty(s);return r.constructor.createProperty(s,e),n?Object.getOwnPropertyDescriptor(r,s):void 0})(o,i,t)}function f(o){return y({...o,state:true,attribute:false})}function F(o,i){let t,e=((...r)=>{t&&clearTimeout(t),t=setTimeout(()=>o(...r),i);});return e.cancel=()=>{t&&clearTimeout(t);},e}var yn="ctx-name-context";function dr(){return function(o){class i extends o{constructor(...r){super(...r);this.oe=null;this.ei=false;this.lo=false;this.co=void 0;this.Tt=new Map;this.ti=new Set;this.init$={};this.ctxOwner=false;this.zi=void 0;this.Hi=false;this.ctxName=this.Oe;this.Ie=false;this.zi=this.getAttribute("ctx-name")||void 0,this.ctxName=this.Oe,this.eu=new Fe(this,{context:yn,callback:s=>{if(!s){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this.En=s,this.xn();},subscribe:true});}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 wn(){return this.zi}set wn(r){let s=r??void 0;this.zi!==s&&(this.zi=s,this.xn());}shouldUpdate(r){return this.Ie?super.shouldUpdate(r):false}get Oe(){return this.wn||this.En||void 0}xn(){if(this.ctxName=this.Oe,!(!this.ctxName||this.ei)){if(this.isConnected){this.uo();return}this.Hi=true;}}willUpdate(r){super.willUpdate(r),this.ctxName=this.Oe,this.ctxName&&(this.co?this.co.setValue(this.ctxName):this.co=new Ve(this,{context:yn,initialValue:this.ctxName}));}Tn(){if(!(!this.oe||this.Tt.size===0)){for(let[r,{value:s,rewrite:n}]of this.Tt)this.oe.add(r,s,n);this.Tt.clear();}}Cn(){return !this.oe&&this.Oe&&this.po(),this.oe&&this.Tn(),this.oe}Ki(){let r=this.Cn();if(!r)throw new Error("SymbioteMixin: Shared context is not initialized.");return r}po(){let r=this.init$,s=this.Oe;if(!s){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this.oe){this.oe=H.getCtx(s)??H.registerCtx(r,s);for(let[n,a]of Object.entries(this.init$))this.oe.add(n,a,this.ctxOwner);this.Tn();}}get $(){return this.Oe&&this.po(),new Proxy({},{get:(r,s)=>{if(typeof s=="string")return this.oe?.read(s)},set:(r,s,n)=>(typeof s!="string"||this.oe?.pub(s,n),true)})}sub(r,s,n=true){let a=this.Ki().sub(r,s,n);if(!a||typeof a!="function")return ()=>{};let l=a.bind(a),c=false,u=()=>{c||(c=true,l(),this.ti.delete(u));};return this.ti.add(u),u}pub(r,s){this.Ki().pub(r,s);}set$(r){for(let[s,n]of Object.entries(r))this.pub(s,n);}get sharedCtx(){return this.Ki()}has(r){return this.oe?.has(r)??false}add(r,s,n=false){let a=this.Cn();if(!a){if(!n&&this.Tt.has(r))return;this.Tt.set(r,{value:s,rewrite:n});return}this.Tt.delete(r),a.add(r,s,n);}add$(r,s=false){for(let[n,a]of Object.entries(r))this.add(n,a,s);}connectedCallback(){super.connectedCallback(),this.ei?this.Ie&&this.lo&&(this.lo=false,this.initCallback()):this.ctxName?(this.Hi=false,this.uo()):this.Hi&&this.Oe&&(this.Hi=false,this.uo());}uo(){if(this.ei)return;this.ei=true,this.po();let r=this.init$;if(Object.keys(r).length>0){let s=this.Ki();for(let[n,a]of Object.entries(r))s.read(n)===void 0&&s.pub(n,a),this.sub(n,F(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this.Ie=true,this.requestUpdate();}firstUpdated(r){super.firstUpdated(r);}disconnectedCallback(){this.tu(),super.disconnectedCallback(),this.ei&&(this.lo=true);}tu(){if(this.ti.size!==0){for(let r of [...this.ti])r();this.ti.clear();}}initCallback(){}}return p([y({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"wn",1),p([f()],i.prototype,"En",2),p([f()],i.prototype,"ctxName",2),p([f()],i.prototype,"Ie",2),i}}var Uo=class extends De(dr()($e(lr(Ct)))){};var rt=class o{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 pc=["UploaderBlock","ActivityBlock","Block","SolutionBlock"];function vt(o){for(let i in o){if(pc.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);}}var Ro="UC";function hc(o,i=false){return new Promise((t,e)=>{if(typeof document!="object"){t(null);return}if(typeof window=="object"&&window[Ro]){t(window[Ro]);return}let r=document.createElement("script");r.async=true,r.src=o,r.onerror=()=>{e();},r.onload=()=>{let s=window[Ro];i&&vt(s),t(s);},document.head.appendChild(r);})}var fi={"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 $o=new Map,bn=new Map,wn=(o,i)=>{$o.has(o)&&console.log(`Locale ${o} is already defined. Overwriting...`);let t={...fi,...i};return $o.set(o,t),t},mc=(o,i)=>{bn.set(o,i);},En=(o,i)=>{typeof i=="function"?mc(o,i):wn(o,i);},Tn=async o=>{let i=$o.get(o);if(!i){let t=bn.get(o);if(!t)throw new Error(`Locale ${o} is not defined`);let e=await t();i=wn(o,e);}return i};En("en",fi);var x=o=>`*cfg/${o}`;var G=o=>o?o.split(",").map(i=>i.trim()).filter(Boolean):[],Kt=o=>o.join(",");var Cn=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},pr=(...o)=>o.filter(i=>typeof i=="string"&&!!i).map(i=>Cn(i)).join("/-/"),ot=(...o)=>{let i=pr(...o);return i?`-/${i}/`:""};function hr(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}function mr(o){let i=new URL(o),{pathname:t}=i,e=t.indexOf("/"),r=t.indexOf("/",e+1);return t.substring(e+1,r)}function Do(o){let i=xn(o),t=new URL(i),e=t.pathname.indexOf("/-/");return e===-1?"":t.pathname.substring(e).slice(1)}function Fo(o){return Do(o).split("/-/").filter(Boolean).map(t=>Cn(t))}function xn(o){let i=new URL(o),t=hr(o),e=Sn(t)?An(t).pathname:t;return i.pathname=i.pathname.replace(e,""),i.search="",i.hash="",i.toString()}function Sn(o){return o.startsWith("http")}function An(o){let i=new URL(o);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}var Z=(o,i,t)=>{let e=new URL(xn(o)),r=t??hr(o),s=i??"";if(e.pathname.startsWith("//")&&(e.pathname=e.pathname.replace("//","/")),r&&Sn(r)){let n=An(r);e.pathname=`${e.pathname}${s}${n.pathname||""}`,e.search=n.search,e.hash=n.hash;}else e.pathname=`${e.pathname}${s}${r||""}`;return e.toString()},re=(o,i)=>{let t=new URL(o);return t.pathname=`${i}/`,t.toString()};var Y=(o,i=",")=>o.trim().split(i).map(t=>t.trim()).filter(t=>t.length>0);var gi=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}),Mn=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function fc(o,i){if(typeof i=="number"){let t=i;return gi[o]!==t?`${o}/${t}`:""}if(typeof i=="boolean"){let t=i;return gi[o]!==t?`${o}`:""}if(o==="filter"&&i){let{name:t,amount:e}=i;return gi.filter===e?"":`${o}/${t}/${e}`}if(o==="crop"&&i){let{dimensions:t,coords:e}=i;return `${o}/${t.join("x")}/${e.join(",")}`}return ""}function oe(o){return pr(...Mn.filter(i=>typeof o[i]<"u"&&o[i]!==null).map(i=>{let t=o[i];return fc(i,t)}).filter(i=>!!i))}var fr=pr("format/auto","progressive/yes"),jt=([o])=>typeof o<"u"?Number(o):void 0,kn=()=>true,gc=([o,i])=>({name:o,amount:typeof i<"u"?Number(i):100}),vc=([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)}},yc=Object.freeze({enhance:jt,brightness:jt,exposure:jt,gamma:jt,contrast:jt,saturation:jt,vibrance:jt,warmth:jt,filter:gc,mirror:kn,flip:kn,rotate:jt,crop:o=>{let[i,t]=o,{dimensions:e,coords:r}=vc([i,t]);return {dimensions:e,coords:r}}});function Vo(o){let i={};for(let t of o){let[e,...r]=t.split("/");if(!e||!Mn.includes(e))continue;let s=e,n=yc[s];try{let a=n(r);i[s]=a;}catch(a){console.warn([`Failed to parse URL operation "${t}". It will be ignored.`,a instanceof Error?`Error message: "${a.message}"`:a,"If you need this functionality, please feel free to open an issue at https://github.com/uploadcare/blocks/issues/new"].join(` `));}}return i}var z=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),st=Object.freeze([z.CROP,z.TUNING,z.FILTERS]),In=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),On=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"]),Ln=Object.freeze(["rotate","mirror","flip"]),Gt=gi,It=Object.freeze({brightness:{zero:Gt.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:Gt.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:Gt.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:Gt.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:Gt.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:Gt.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:Gt.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:Gt.enhance,range:[0,100],keypointsNumber:1},filter:{zero:Gt.filter,range:[0,100],keypointsNumber:1}});var vi="https://ucarecdn.com",bc="https://upload.uploadcare.com",wc="https://social.uploadcare.com",Ec="https://ucarecd.net",Tc={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:vi,cdnCnamePrefixed:Ec,baseUrl:bc,socialBaseUrl:wc,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:Kt(st),cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true,pasteScope:"local",plugins:[],dynamicButtonViewMode:"auto",dynamicButtonShowFirstIcon:true},J=Object.freeze(Tc);var gr=(o,i)=>(...t)=>{let e=o();if(!e.read(x("debug")))return;let r=t;if(typeof t?.[0]=="function"){let n=t[0];r=n();}let s=[e.id,i].filter(Boolean);console.log(`[${s.join("][")}]`,...r);};var K=class{constructor(i){this.ho=new Set;this.He=null;this.E=gr(()=>this.e.ctx,this.constructor.name);this.e=i,this.i=i.ctx;}addSub(i){this.ho.add(i);}get Ke(){if(!this.He){let i={};this.He=new Proxy(i,{set:()=>{throw new Error("SharedInstance cfg proxy is read-only")},get:(t,e)=>{if(typeof e!="string")return;let r=x(e);return this.e.ctx.has(r)?this.e.ctx.read(r):J[e]}});}return this.He}destroy(){for(let i of this.ho)try{i();}catch{}this.ho.clear();}},Cc={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"},xt=(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`)},Pn=o=>({get ctx(){return o()},get modalManager(){return xt(o(),"*modalManager",false)},get pluginManager(){return xt(o(),"*pluginManager")},get telemetryManager(){return xt(o(),"*telemetryManager")},get localeManager(){return xt(o(),"*localeManager")},get a11y(){return xt(o(),"*a11y")},get routerLayer(){return xt(o(),"*routerLayer")},get blocksRegistry(){return xt(o(),"*blocksRegistry")},get eventEmitter(){return xt(o(),"*eventEmitter")},get uploadCollection(){return xt(o(),"*uploadCollection")},get secureUploadsManager(){return xt(o(),"*secureUploadsManager",false)},get api(){return xt(o(),"*publicApi")},get validationManager(){return xt(o(),"*validationManager")},when(i,t){let e=Cc[i],r=o(),s=r.has(e)?r.read(e):void 0;if(s)return t(s),()=>{};let n;return n=r.sub(e,a=>{a&&(t(a),n?.());}),n},wait(i){return new Promise(t=>{let e;e=this.when(i,r=>{t(r),e?.();});})}});var X=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),vr=class extends K{constructor(){super(...arguments);this.je=new Map;this.he=new Set;this.f=new Map;}registerModal(t,e){this.je.set(t,e),this.Z(X.ADD,{id:t,modal:e});}deleteModal(t){let e=this.je.get(t);return e?(this.je.delete(t),this.he.delete(t),this.Z(X.DELETE,{id:t,modal:e}),true):false}open(t){let e=this.je.get(t);return e?(this.he.add(t),this.Z(X.OPEN,{modal:e,id:t}),true):(this.E(`Modal with ID "${t}" not found`),false)}close(t){let e=this.je.get(t);return !e||!this.he.has(t)?(this.E(`Modal with ID "${t}" not found or not active`),false):(this.he.delete(t),this.Z(X.CLOSE,{id:t,modal:e}),true)}toggle(t){return this.je.has(t)?this.he.has(t)?this.close(t):this.open(t):(this.E(`Modal with ID "${t}" not found`),false)}get hasActiveModals(){return this.he.size>0}back(){if(this.he.size===0)return this.E("No active modals to go back from"),false;let t=Array.from(this.he).pop();return t?this.close(t):false}closeAll(){let t=this.he.size;return this.he.clear(),this.Z(X.CLOSE_ALL,{}),t}subscribe(t,e){return this.f.has(t)||this.f.set(t,new Set),this.f.get(t)?.add(e),()=>this.unsubscribe(t,e)}unsubscribe(t,e){this.f.has(t)&&this.f.get(t)?.delete(e);}Z(t,e){if(this.f.has(t))for(let r of this.f.get(t)??new Set)try{r(e);}catch(s){this.e.telemetryManager.sendEventError(s,"modal subscriber"),this.E("Error in modal subscriber:",s);}}destroy(){super.destroy(),this.closeAll(),this.je.clear(),this.f.clear(),this.Z(X.DESTROY,{});}};var yr=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("-");function Un(o){return Object.prototype.toString.call(o)==="[object Object]"}var xc=/\W|_/g;function Sc(o){return o.split(xc).map((i,t)=>i.charAt(0)[t>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}function Rn(o,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(o)?o.map(t=>Wt(t,{ignoreKeys:i})):o}function Wt(o,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(o))return Rn(o,{ignoreKeys:i});if(!Un(o))return o;let t={};for(let e of Object.keys(o)){let r=o[e];if(i.includes(e)){t[e]=r;continue}Un(r)?r=Wt(r,{ignoreKeys:i}):Array.isArray(r)&&(r=Rn(r,{ignoreKeys:i})),t[Sc(e)]=r;}return t}var Ac=o=>new Promise(i=>setTimeout(i,o));function jo({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 n=[o,i,e].filter(Boolean).join("/"),a=[s,r].filter(Boolean).join("; ");return `${n} (${a})`}var kc={factor:2,time:100};function Mc(o,i=kc){let t=0;function e(r){let s=Math.round(i.time*i.factor**t);return r({attempt:t,retry:a=>Ac(a??s).then(()=>(t+=1,e(r)))})}return e(o)}var Ce=class extends Error{},Ne=class o extends Ce{originalProgressEvent;constructor(i){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,o.prototype),this.originalProgressEvent=i;}},br=(o,i)=>{o&&(o.aborted?Promise.resolve().then(i):o.addEventListener("abort",()=>i(),{once:true}));},se=class o extends Ce{isCancel=true;constructor(i="Request canceled"){super(i),this.name="CancelError",Object.setPrototypeOf(this,o.prototype);}},Ic=500,Dn=({check:o,interval:i=Ic,timeout:t,signal:e})=>new Promise((r,s)=>{let n,a;br(e,()=>{n&&clearTimeout(n),s(new se("Poll cancelled"));}),t&&(a=setTimeout(()=>{n&&clearTimeout(n),s(new se("Timed out"));},t));let l=()=>{try{Promise.resolve(o(e)).then(c=>{c?(a&&clearTimeout(a),r(c)):n=setTimeout(l,i);}).catch(c=>{a&&clearTimeout(a),s(c);});}catch(c){a&&clearTimeout(a),s(c);}};n=setTimeout(l,0);}),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"},wr="application/octet-stream",Fn="original",ae=({method:o,url:i,data:t,headers:e={},signal:r,onProgress:s})=>new Promise((n,a)=>{let l=new XMLHttpRequest,c=o?.toUpperCase()||"GET",u=false;l.open(c,i,true),e&&Object.entries(e).forEach(d=>{let[h,m]=d;typeof m<"u"&&!Array.isArray(m)&&l.setRequestHeader(h,m);}),l.responseType="text",br(r,()=>{u=true,l.abort(),a(new se);}),l.onload=()=>{if(l.status!=200)a(new Error(`Error ${l.status}: ${l.statusText}`));else {let d={method:c,url:i,data:t,headers:e||void 0,signal:r,onProgress:s},h=l.getAllResponseHeaders().trim().split(/[\r\n]+/),m={};h.forEach(function(w){let T=w.split(": "),E=T.shift(),S=T.join(": ");E&&typeof E<"u"&&(m[E]=S);});let g=l.response,b=l.status;n({request:d,data:g,headers:m,status:b});}},l.onerror=d=>{u||a(new Ne(d));},s&&typeof s=="function"&&(l.upload.onprogress=d=>{d.lengthComputable?s({isComputable:true,value:d.loaded/d.total}):s({isComputable:false});}),t?l.send(t):l.send();});function Oc(o,...i){return o}var Lc=({name:o})=>o?[o]:[],Pc=Oc,Uc=()=>new FormData,Vn=o=>false,Er=o=>typeof Blob<"u"&&o instanceof Blob,Tr=o=>typeof File<"u"&&o instanceof File,Cr=o=>!!o&&typeof o=="object"&&!Array.isArray(o)&&"uri"in o&&typeof o.uri=="string",_e=o=>Er(o)||Tr(o)||Vn()||Cr(o),Rc=o=>typeof o=="string"||typeof o=="number"||typeof o>"u",$c=o=>!!o&&typeof o=="object"&&!Array.isArray(o),Dc=o=>!!o&&typeof o=="object"&&"data"in o&&_e(o.data);function Nn(o,i,t){if(Array.isArray(t))for(let e of t)Nn(o,`${i}[]`,e);else if(Dc(t)){let{name:e,contentType:r}=t,s=Pc(t.data,e,r??wr),n=Lc({name:e});o.push([i,s,...n]);}else if($c(t))for(let[e,r]of Object.entries(t))typeof r<"u"&&o.push([`${i}[${e}]`,String(r)]);else Rc(t)&&t&&o.push([i,t.toString()]);}function Fc(o){let i=[];for(let[t,e]of Object.entries(o))Nn(i,t,e);return i}function xr(o){let i=Uc(),t=Fc(o);for(let e of t){let[r,s,...n]=e;i.append(r,s,...n);}return i}var nt=class o extends Ce{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);}},Vc=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()},qt=(o,i,t)=>{let e=new URL(o);return e.pathname=(e.pathname+i).replace("//","/"),t&&(e.search=Vc(t)),e.toString()},Nc="6.18.4",_c="UploadcareUploadClient",Bc=Nc;function Se(o){return jo({libraryName:_c,libraryVersion:Bc,...o})}var zc="RequestThrottledError",$n=15e3,Hc=1e3;function Kc(o){let{headers:i}=o||{};if(!i||typeof i["retry-after"]!="string")return $n;let t=parseInt(i["retry-after"],10);return Number.isFinite(t)?t*1e3:$n}function le(o,i){let{retryThrottledRequestMaxTimes:t,retryNetworkErrorMaxTimes:e}=i;return Mc(({attempt:r,retry:s})=>o().catch(n=>{if("response"in n&&n?.code===zc&&r<t)return s(Kc(n));if(n instanceof Ne&&r<e)return s((r+1)*Hc);throw n}))}var _n=o=>{let i="";return (Er(o)||Tr(o)||Cr(o))&&(i=o.type),i||wr},Bn=o=>{let i="";return Tr(o)&&o.name?i=o.name:Er(o)||Vn()?i="":Cr(o)&&o.name&&(i=o.name),i||Fn};function Go(o){return typeof o>"u"||o==="auto"?"auto":o?"1":"0"}function jc(o,{publicKey:i,fileName:t,contentType:e,baseURL:r=R.baseURL,secureSignature:s,secureExpire:n,store:a,signal:l,onProgress:c,source:u="local",integration:d,userAgent:h,retryThrottledRequestMaxTimes:m=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=R.retryNetworkErrorMaxTimes,metadata:b}){return le(()=>ae({method:"POST",url:qt(r,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Se({publicKey:i,integration:d,userAgent:h})},data:xr({file:{data:o,name:t||Bn(o),contentType:e||_n(o)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Go(a),signature:s,expire:n,source:u,metadata:b}),signal:l,onProgress:c}).then(({data:w,headers:T,request:E})=>{let S=Wt(JSON.parse(w));if("error"in S)throw new nt(S.error.content,S.error.errorCode,E,S,T);return S}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}var Bo;(function(o){o.Token="token",o.FileInfo="file_info";})(Bo||(Bo={}));function Gc(o,{publicKey:i,baseURL:t=R.baseURL,store:e,fileName:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,source:c="url",signal:u,integration:d,userAgent:h,retryThrottledRequestMaxTimes:m=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=R.retryNetworkErrorMaxTimes,metadata:b}){return le(()=>ae({method:"POST",headers:{"X-UC-User-Agent":Se({publicKey:i,integration:d,userAgent:h})},url:qt(t,"/from_url/",{jsonerrors:1,pub_key:i,source_url:o,store:Go(e),filename:r,check_URL_duplicates:s?1:void 0,save_URL_duplicates:n?1:void 0,signature:a,expire:l,source:c,metadata:b}),signal:u}).then(({data:w,headers:T,request:E})=>{let S=Wt(JSON.parse(w));if("error"in S)throw new nt(S.error.content,S.error.errorCode,E,S,T);return S}),{retryNetworkErrorMaxTimes:g,retryThrottledRequestMaxTimes:m})}var pt;(function(o){o.Unknown="unknown",o.Waiting="waiting",o.Progress="progress",o.Error="error",o.Success="success";})(pt||(pt={}));var qc=o=>"status"in o&&o.status===pt.Error;function Wc(o,{publicKey:i,baseURL:t=R.baseURL,signal:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=R.retryNetworkErrorMaxTimes}={}){return le(()=>ae({method:"GET",headers:i?{"X-UC-User-Agent":Se({publicKey:i,integration:r,userAgent:s})}:void 0,url:qt(t,"/from_url/status/",{jsonerrors:1,token:o}),signal:e}).then(({data:l,headers:c,request:u})=>{let d=Wt(JSON.parse(l));if("error"in d&&!qc(d))throw new nt(d.error.content,d.error.errorCode,u,d,c);return d}),{retryNetworkErrorMaxTimes:a,retryThrottledRequestMaxTimes:n})}function Zc(o,{publicKey:i,baseURL:t=R.baseURL,jsonpCallback:e,secureSignature:r,secureExpire:s,signal:n,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=R.retryNetworkErrorMaxTimes}){return le(()=>ae({method:"POST",headers:{"X-UC-User-Agent":Se({publicKey:i,integration:l,userAgent:c})},url:qt(t,"/group/",{jsonerrors:1}),data:xr({files:o,callback:e,pub_key:i,signature:r,expire:s,source:a}),signal:n}).then(({data:h,headers:m,request:g})=>{let b=Wt(JSON.parse(h));if("error"in b)throw new nt(b.error.content,b.error.errorCode,g,b,m);return b}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:u})}function zn(o,{publicKey:i,baseURL:t=R.baseURL,signal:e,source:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:a=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=R.retryNetworkErrorMaxTimes}){return le(()=>ae({method:"GET",headers:{"X-UC-User-Agent":Se({publicKey:i,integration:s,userAgent:n})},url:qt(t,"/info/",{jsonerrors:1,pub_key:i,file_id:o,source:r}),signal:e}).then(({data:c,headers:u,request:d})=>{let h=Wt(JSON.parse(c));if("error"in h)throw new nt(h.error.content,h.error.errorCode,d,h,u);return h}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})}function Yc(o,{publicKey:i,contentType:t,fileName:e,multipartChunkSize:r=R.multipartChunkSize,baseURL:s="",secureSignature:n,secureExpire:a,store:l,signal:c,source:u="local",integration:d,userAgent:h,retryThrottledRequestMaxTimes:m=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:g=R.retryNetworkErrorMaxTimes,metadata:b}){return le(()=>ae({method:"POST",url:qt(s,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Se({publicKey:i,integration:d,userAgent:h})},data:xr({filename:e,size:o,content_type:t||wr,part_size:r,UPLOADCARE_STORE:Go(l),UPLOADCARE_PUB_KEY:i,signature:n,expire:a,source:u,metadata:b}),signal:c}).then(({data:w,headers:T,request:E})=>{let S=Wt(JSON.parse(w));if("error"in S)throw new nt(S.error.content,S.error.errorCode,E,S,T);return S.parts=Object.keys(S.parts).map(Et=>S.parts[Number(Et)]),S}),{retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})}function Xc(o,i,{contentType:t,signal:e,onProgress:r,retryThrottledRequestMaxTimes:s=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=R.retryNetworkErrorMaxTimes}){return le(()=>ae({method:"PUT",url:i,data:o,onProgress:r,signal:e,headers:{"Content-Type":t||wr}}).then(a=>(r&&r({isComputable:true,value:1}),a)).then(({status:a})=>({code:a})),{retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n})}function Qc(o,{publicKey:i,baseURL:t=R.baseURL,source:e="local",signal:r,integration:s,userAgent:n,retryThrottledRequestMaxTimes:a=R.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=R.retryNetworkErrorMaxTimes}){return le(()=>ae({method:"POST",url:qt(t,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":Se({publicKey:i,integration:s,userAgent:n})},data:xr({uuid:o,UPLOADCARE_PUB_KEY:i,source:e}),signal:r}).then(({data:c,headers:u,request:d})=>{let h=Wt(JSON.parse(c));if("error"in h)throw new nt(h.error.content,h.error.errorCode,d,h,u);return h}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})}function qo(o,{publicKey:i,baseURL:t,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a,signal:l,onProgress:c}){return Dn({check:u=>zn(o,{publicKey:i,baseURL:t,signal:u,source:e,integration:r,userAgent:s,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a}).then(d=>d.isReady?d:(c&&c({isComputable:true,value:1}),false)),signal:l})}function Jc(o){return "defaultEffects"in o}var xe=class{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,n=qt(t,`${r}/`),a=s?qt(`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=n,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=s||null,this.s3Url=a,Jc(i)&&(this.defaultEffects=i.defaultEffects);}},tu=(o,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,contentType:a,signal:l,onProgress:c,source:u,integration:d,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,baseCDN:b,metadata:w})=>jc(o,{publicKey:i,fileName:t,contentType:a,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:l,onProgress:c,source:u,integration:d,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,metadata:w}).then(({file:T})=>qo(T,{publicKey:i,baseURL:e,source:u,integration:d,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:c,signal:l})).then(T=>new xe(T,{baseCDN:b})),eu=(o,{publicKey:i,fileName:t,baseURL:e,signal:r,onProgress:s,source:n,integration:a,userAgent:l,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:u,baseCDN:d})=>zn(o,{publicKey:i,baseURL:e,signal:r,source:n,integration:a,userAgent:l,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:u}).then(h=>new xe(h,{baseCDN:d,fileName:t})).then(h=>(s&&s({isComputable:true,value:1}),h)),iu=(o,{signal:i}={})=>{let t=null,e=null,r=o.map(()=>new AbortController),s=n=>()=>{e=n,r.forEach((a,l)=>l!==n&&a.abort());};return br(i,()=>{r.forEach(n=>n.abort());}),Promise.all(o.map((n,a)=>{let l=s(a);return Promise.resolve().then(()=>n({stopRace:l,signal:r[a].signal})).then(c=>(l(),c)).catch(c=>(t=c,null))})).then(n=>{if(e===null)throw t;return n[e]})},ru=window.WebSocket,zo=class{events=Object.create({});emit(i,t){this.events[i]?.forEach(e=>e(t));}on(i,t){this.events[i]=this.events[i]||[],this.events[i].push(t);}off(i,t){t?this.events[i]=this.events[i].filter(e=>e!==t):this.events[i]=[];}},ou=(o,i)=>o==="success"?{status:pt.Success,...i}:o==="progress"?{status:pt.Progress,...i}:{status:pt.Error,...i},Ho=class{key;disconnectTime;ws=void 0;queue=[];isConnected=false;subscribers=0;emmitter=new zo;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 ru(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,ou(e.event,JSON.parse(e.data)));}});}}disconnect(){let i=()=>{this.ws?.close(),this.ws=void 0,this.isConnected=false;};this.disconnectTime?this.disconnectTimeoutId=setTimeout(()=>{i();},this.disconnectTime):i();}send(i,t){let e=JSON.stringify({event:i,data:t});this.ws?.send(e);}subscribe(i,t){this.subscribers+=1,this.connect();let e=`task-status-${i}`,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)}},No=null,Wo=o=>{if(!No){let i=typeof window>"u"?0:3e4;No=new Ho(o,i);}return No},su=o=>{Wo(o).connect();};function nu({token:o,publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,onProgress:a,signal:l}){return Dn({check:c=>Wc(o,{publicKey:i,baseURL:t,integration:e,userAgent:r,retryThrottledRequestMaxTimes:s,retryNetworkErrorMaxTimes:n,signal:c}).then(u=>{switch(u.status){case pt.Error:return new nt(u.error,u.errorCode);case pt.Waiting:return false;case pt.Unknown:return new nt(`Token "${o}" was not found.`);case pt.Progress:return a&&(u.total==="unknown"?a({isComputable:false}):a({isComputable:true,value:u.done/u.total})),false;case pt.Success:return a&&a({isComputable:true,value:u.done/u.total}),u;default:throw new Error("Unknown status")}}),signal:l})}var au=({token:o,pusherKey:i,signal:t,onProgress:e})=>new Promise((r,s)=>{let n=Wo(i),a=n.onError(s),l=()=>{a(),n.unsubscribe(o);};br(t,()=>{l(),s(new se("pusher cancelled"));}),n.subscribe(o,c=>{switch(c.status){case pt.Progress:{e&&(c.total==="unknown"?e({isComputable:false}):e({isComputable:true,value:c.done/c.total}));break}case pt.Success:{l(),e&&e({isComputable:true,value:c.done/c.total}),r(c);break}case pt.Error:l(),s(new nt(c.msg,c.error_code));}});}),lu=(o,{publicKey:i,fileName:t,baseURL:e,baseCDN:r,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,store:c,signal:u,onProgress:d,source:h,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,pusherKey:w=R.pusherKey,metadata:T})=>Promise.resolve(su(w)).then(()=>Gc(o,{publicKey:i,fileName:t,baseURL:e,checkForUrlDuplicates:s,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,store:c,signal:u,source:h,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,metadata:T})).catch(E=>(Wo(w)?.disconnect(),Promise.reject(E))).then(E=>E.type===Bo.FileInfo?E:iu([({signal:S})=>nu({token:E.token,publicKey:i,baseURL:e,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:d,signal:S}),({signal:S})=>au({token:E.token,pusherKey:w,signal:S,onProgress:d})],{signal:u})).then(E=>{if(E instanceof nt)throw E;return E}).then(E=>qo(E.uuid,{publicKey:i,baseURL:e,integration:m,userAgent:g,retryThrottledRequestMaxTimes:b,onProgress:d,signal:u})).then(E=>new xe(E,{baseCDN:r})),_o=new WeakMap,cu=async o=>{if(_o.has(o))return _o.get(o);let i=await fetch(o.uri).then(t=>t.blob());return _o.set(o,i),i},Hn=async o=>{if(Tr(o)||Er(o))return o.size;if(Cr(o))return (await cu(o)).size;throw new Error("Unknown file type. Cannot determine file size.")},uu=(o,i=R.multipartMinFileSize)=>o>=i,Kn=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)},Zo=o=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",t=new RegExp(i);return !_e(o)&&t.test(o)},du=(o,i)=>new Promise((t,e)=>{let r=[],s=false,n=i.length,a=[...i],l=()=>{let c=i.length-a.length,u=a.shift();u&&u().then(d=>{s||(r[c]=d,n-=1,n?l():t(r));}).catch(d=>{s=true,e(d);});};for(let c=0;c<o;c++)l();}),pu=(o,i,t,e)=>{let r=e*i,s=Math.min(r+e,t);return o.slice(r,s)},hu=async(o,i,t)=>e=>pu(o,e,i,t),mu=(o,i,{publicKey:t,contentType:e,onProgress:r,signal:s,integration:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})=>Xc(o,i,{contentType:e,onProgress:r,signal:s,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l}),fu=async(o,{publicKey:i,fileName:t,fileSize:e,baseURL:r,secureSignature:s,secureExpire:n,store:a,signal:l,onProgress:c,source:u,integration:d,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,contentType:b,multipartChunkSize:w=R.multipartChunkSize,maxConcurrentRequests:T=R.maxConcurrentRequests,baseCDN:E,metadata:S})=>{let Et=e??await Hn(o),Tt,ve=(Q,dt)=>{if(!c)return;Tt||(Tt=Array(Q).fill(0));let kt=Pt=>Pt.reduce((Bt,Eo)=>Bt+Eo,0);return Pt=>{Pt.isComputable&&(Tt[dt]=Pt.value,c({isComputable:true,value:kt(Tt)/Q}));}};return b||=_n(o),Yc(Et,{publicKey:i,contentType:b,fileName:t||Bn(o),baseURL:r,secureSignature:s,secureExpire:n,store:a,signal:l,source:u,integration:d,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,metadata:S,multipartChunkSize:w}).then(async({uuid:Q,parts:dt})=>{let kt=await hu(o,Et,w);return Promise.all([Q,du(T,dt.map((Pt,Bt)=>()=>mu(kt(Bt),Pt,{publicKey:i,contentType:b,onProgress:ve(dt.length,Bt),signal:l,integration:d,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})))])}).then(([Q])=>Qc(Q,{publicKey:i,baseURL:r,source:u,integration:d,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g})).then(Q=>Q.isReady?Q:qo(Q.uuid,{publicKey:i,baseURL:r,source:u,integration:d,userAgent:h,retryThrottledRequestMaxTimes:m,retryNetworkErrorMaxTimes:g,onProgress:c,signal:l})).then(Q=>new xe(Q,{baseCDN:E}))};async function Yo(o,{publicKey:i,fileName:t,baseURL:e=R.baseURL,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,contentType:g,multipartMinFileSize:b,multipartChunkSize:w,maxConcurrentRequests:T,baseCDN:E=R.baseCDN,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:Et,pusherKey:Tt,metadata:ve}){if(_e(o)){let Q=await Hn(o);return uu(Q,b)?fu(o,{publicKey:i,contentType:g,multipartChunkSize:w,fileSize:Q,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:u,userAgent:d,maxConcurrentRequests:T,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,baseCDN:E,metadata:ve}):tu(o,{publicKey:i,fileName:t,contentType:g,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,baseCDN:E,metadata:ve})}if(Zo(o))return lu(o,{publicKey:i,fileName:t,baseURL:e,baseCDN:E,checkForUrlDuplicates:S,saveUrlForRecurrentUploads:Et,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:h,pusherKey:Tt,metadata:ve});if(Kn(o))return eu(o,{publicKey:i,fileName:t,baseURL:e,signal:a,onProgress:l,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,baseCDN:E});throw new TypeError(`File uploading from "${o}" is not supported`)}var gu=(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}},Ko=class{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=gu(i.cdnUrl,t),this.files=e.map(r=>new xe(r,{baseCDN:t})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored;}},vu=o=>{for(let i of o)if(!_e(i))return false;return true},yu=o=>{for(let i of o)if(!Kn(i))return false;return true},bu=o=>{for(let i of o)if(!Zo(i))return false;return true};function jn(o,{publicKey:i,fileName:t,baseURL:e=R.baseURL,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:l,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:b=R.multipartChunkSize,baseCDN:w=R.baseCDN,checkForUrlDuplicates:T,saveUrlForRecurrentUploads:E,jsonpCallback:S}){if(!vu(o)&&!bu(o)&&!yu(o))throw new TypeError(`Group uploading from "${o}" is not supported`);let Et,Tt=true,ve=o.length,Q=(dt,kt)=>{if(!l)return;Et||(Et=Array(dt).fill(0));let Pt=Bt=>Bt.reduce((Eo,jl)=>Eo+jl)/dt;return Bt=>{if(!Bt.isComputable||!Tt){Tt=false,l({isComputable:false});return}Et[kt]=Bt.value,l({isComputable:true,value:Pt(Et)});}};return Promise.all(o.map((dt,kt)=>_e(dt)||Zo(dt)?Yo(dt,{publicKey:i,fileName:t,baseURL:e,secureSignature:r,secureExpire:s,store:n,signal:a,onProgress:Q(ve,kt),source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:b,baseCDN:w,checkForUrlDuplicates:T,saveUrlForRecurrentUploads:E}).then(Pt=>Pt.uuid):dt)).then(dt=>Zc(dt,{publicKey:i,baseURL:e,jsonpCallback:S,secureSignature:r,secureExpire:s,signal:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m}).then(kt=>new Ko(kt,{baseCDN:w})).then(kt=>(l&&l({isComputable:true,value:1}),kt)))}var ne=class{ji=1;fo=[];Gi=0;mo=new Map;go=new Map;constructor(i){this.ji=i;}run(){let i=this.ji-this.Gi;for(let t=0;t<i;t++){let e=this.fo.shift();if(!e)return;let r=this.mo.get(e),s=this.go.get(e);if(!r||!s)throw new Error("Unexpected behavior: resolver or rejector is undefined");this.Gi+=1,e().finally(()=>{this.mo.delete(e),this.go.delete(e),this.Gi-=1,this.run();}).then(n=>r(n)).catch(n=>s(n));}}add(i,{autoRun:t}={autoRun:true}){return new Promise((e,r)=>{this.mo.set(i,e),this.go.set(i,r),this.fo.push(i),t&&this.run();})}get pending(){return this.fo.length}get running(){return this.Gi}set concurrency(i){this.ji=i,this.run();}get concurrency(){return this.ji}};var Xo=()=>({}),Qo=o=>({...Xo(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{o.modalManager?.close(o.$["*currentActivity"]),o.pub("*currentActivity",null);}}),Jo=o=>({...Qo(o),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new ne(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),Gn=o=>({...Jo(o),"*solution":null,"*lazyPlugins":null});var D=Object.freeze({START_FROM:"start-from",CAMERA:"camera",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});var wu=new Set([D.START_FROM,D.UPLOAD_LIST]),Sr=class extends K{constructor(t){super(t);this.scopes=new Set;this.listener=this.iu.bind(this),window.addEventListener("paste",this.listener);}ru(t){if(!(t instanceof Element))return false;if(t.closest("input, textarea, select"))return true;let e=t.closest("[contenteditable]");return !!(e&&e.getAttribute("contenteditable")?.toLowerCase()!=="false"||t.closest('[role="textbox"], [role="searchbox"], [role="combobox"]'))}ou(t){return t.composedPath().some(e=>this.ru(e))}su(t){return typeof t=="string"&&wu.has(t)}nu(){return [...this.scopes].some(t=>t.isConnected)}au(){return [...this.scopes].some(t=>t.isConnected&&t instanceof Element&&t.localName==="uc-file-uploader-regular")}lu(t){return t?[...this.scopes].some(e=>e.isConnected&&e.contains(t)):false}cu(t){let e=t.trim();if(!e)return null;try{let r=new URL(e);return r.protocol!=="http:"&&r.protocol!=="https:"?null:r.toString()}catch{return null}}openUploadList(){this.e.routerLayer.navigateAfterFileAdd();}async iu(t){if(!t.clipboardData||this.ou(t)||!this.nu())return;let e=this.e.ctx.read("*currentActivity"),r=e===null,s=this.su(e);switch(this.Ke.pasteScope){case "global":if(!s&&!(r&&this.au()))return;await this.handlePaste(t);return;case "local":{let n=t.target instanceof Node?t.target:null;if(!this.lu(n)||!s&&!r)return;await this.handlePaste(t);return}default:return}}async handlePaste(t){if(!t.clipboardData)return;let e=Array.from(t.clipboardData.items),r=e.filter(a=>a.kind==="file").map(a=>a.getAsFile()).filter(a=>a!==null),s=e.filter(a=>a.kind==="string"&&(a.type==="text/plain"||a.type==="text/uri-list")).map(a=>new Promise(l=>{a.getAsString(c=>{l(this.cu(c));});})),n=false;if(r.length>0&&(r.forEach(a=>{this.e.api.addFileFromObject(a,{source:"clipboard"});}),n=true),s.length>0){let a=(await Promise.all(s)).filter(l=>l!==null);a.forEach(l=>{this.e.api.addFileFromUrl(l,{source:"clipboard"});}),n||=a.length>0;}n&&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 Ar=class extends K{constructor(){super(...arguments);this.qi=[];}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",D.UPLOAD_LIST),this.e.modalManager?.open(D.UPLOAD_LIST));}};var Eu={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function yi(o,i){i.tabIndex=0,i.focus(),o.tabIndex=-1;}function ts(o){let i=o.role||o.type||o.tagName;if(!i)return null;let t=Eu[i.toLowerCase()];if(!t)return null;for(let e of t){let r=o.closest(`[role=${e}]`);if(r)return r}}function es(o,i){return i.role==="toolbar"?Cu(i):i.querySelectorAll(`[role=${o.role}]`)}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})}function Cu(o){return [...o.querySelectorAll("*")].filter(t=>t.role==="button"||t.type==="button"||t.role==="checkbox"||t.type==="checkbox")}function xu(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"}function qn(o){return i=>{let t=false,e=300,r=0,s="";function n(d){let h=ts(d.target);if(!h){a();return}let m=es(d.target,h),g=Tu(m,h),b=Array.from(g).indexOf(d.target),w="ArrowDown",T="ArrowUp";if(xu(h)&&(i.document.dir==="rtl"?(w="ArrowLeft",T="ArrowRight"):(w="ArrowRight",T="ArrowLeft")),d.key===w)d.preventDefault(),yi(d.target,g[b+1]||g[0]);else if(d.key===T)d.preventDefault(),yi(d.target,g[b-1]||g[g.length-1]);else if(d.key==="Home")d.preventDefault(),yi(d.target,g[0]);else if(d.key==="End")d.preventDefault(),yi(d.target,g[g.length-1]);else if(d.key.length===1&&h.role!=="tablist"){d.timeStamp-r<=e?s+=d.key.toLowerCase():s=d.key.toLowerCase(),r=d.timeStamp;let E=Array.from(m).find(S=>S.textContent?.trim()?.toLowerCase()?.startsWith(s));E&&(d.preventDefault(),yi(d.target,E));}}function a(){t=false,i.removeEventListener("keydown",n);}function l(d){let h=ts(d.target);if(h){t||(t=true,i.addEventListener("keydown",n));let m=es(d.target,h);for(let g of m)g!==d.target&&g.setAttribute("tabindex",-1);}else t&&a();}function c(d){(!d.relatedTarget||d.relatedTarget===i.document)&&a();}function u(d){let h=ts(d.target);if(h){let m=es(d.target,h);for(let g of m)g!==d.target&&g.setAttribute("tabindex",-1);d.target.setAttribute("tabindex",0);}}return i.addEventListener("click",u),i.addEventListener("focusin",l),i.addEventListener("focusout",c),()=>{a(),i.removeEventListener("click",u),i.removeEventListener("focusin",l),i.removeEventListener("focusout",c);}}}function Wn(){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 n=s.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');n&&(n.tabIndex=0);}}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 o.addEventListener("keyuxJump",e),o.addEventListener("focusout",r),()=>{o.removeEventListener("keyuxJump",e),o.removeEventListener("focusout",r);}}}function Zn(){return o=>{let i=[];function t(l){let c=o.document.activeElement;c&&c!==o.document.body&&i.push(new WeakRef(c)),l.focus({focusVisible:true});}function e(){let l=i.pop();if(!l){o.document.activeElement.blur();return}let c=l.deref();c&&c.isConnected?c.focus():e();}let r=0,s;function n(l){clearInterval(s);let c=l.getAttribute("aria-controls");s=setInterval(()=>{if(r++>50){clearInterval(s);return}let u=o.document.getElementById(c);if(u){let d=u.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');d&&(clearInterval(s),u.dispatchEvent(new o.CustomEvent("keyuxJump",{bubbles:true})),t(d));}},50);}function a(l){l.target.getAttribute("aria-controls")&&l.key==="Enter"&&n(l.target),l.key==="Escape"&&e();}return o.addEventListener("keydown",a),()=>{o.removeEventListener("keydown",a);}}}function Yn(o){let i,t=o.split(" "),e;function r(a){(a.key==="Enter"||a.key===" ")&&(a.target.tagName==="BUTTON"||a.target.tagName==="A")&&(s(),a.target.classList.add(...t),i=a.target,e=a.target);}function s(){i&&(i.classList.remove(...t),i=0,setTimeout(()=>{e=0;},0));}function n(a){a.clientX===0&&a.clientY===0&&i!==a.target&&(s(),e!==a.target&&(a.target.classList.add(...t),i=a.target));}return a=>(a.addEventListener("click",n),a.addEventListener("keydown",r),a.addEventListener("keyup",s),()=>{a.removeEventListener("click",n),a.removeEventListener("keydown",r),a.removeEventListener("keyup",s);})}function Xn(o,i){let t=i.map(e=>e(o));return ()=>{t.forEach(e=>e());}}var is=class{constructor(){this.se=new Map;this.vo=[];}addEventListener(i,t){let e=r=>{let s=r.target;s instanceof Node&&this.vo.some(n=>n===s||n.contains(s))&&t(r);};this.se.set(t,e),window.addEventListener(i,e);}removeEventListener(i,t){let e=this.se.get(t);e&&window.removeEventListener(i,e),this.se.delete(t);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this.vo.push(i);}destroy(){this.vo=[];for(let i of this.se.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this.se.clear();}},kr=class{constructor(){this.Wi=new is,this.Sn=Xn(this.Wi,[qn(),Yn("is-pressed"),Zn(),Wn()]);}registerBlock(i){this.Wi.registerScope(i);}destroy(){this.Sn?.(),this.Wi.destroy();}};var Zt=o=>`*l10n/${o}`,Su="en",Mr=class extends K{constructor(t){super(t);this.Ct="";for(let[r,s]of Object.entries(fi)){let n=this.i.has(Zt(r))?!this.i.read(Zt(r)):true;this.i.add(Zt(r),s,n);}let e=t.pluginManager;e?.onPluginsChange&&this.addSub(e.onPluginsChange(()=>{this.Ct&&this.An(this.Ct);})),this.addSub(this.i.sub(x("localeName"),async r=>{if(!r)return;this.Ct=r;let s=await Tn(r);r!==Su&&this.Ct!==r||(this.An(r),this.kn(r,s));})),this.addSub(this.i.sub(x("localeDefinitionOverride"),r=>{if(!r)return;let s=r[this.Ct];s&&this.kn(this.Ct,s);}));}kn(t,e){let r=this.Ke.localeDefinitionOverride?.[t];for(let[s,n]of Object.entries(e)){let a=r?.[s];this.i.add(Zt(s),a??n,true);}}An(t){let e=this.e.pluginManager;if(!e)return;let r=e.snapshot();for(let s of r.l10n){let{pluginId:n,...a}=s,l=a[t];if(l)for(let[c,u]of Object.entries(l))u!==void 0&&this.i.add(Zt(c),u,true);}}};var Au=()=>{let o=navigator.userAgent;return /Macintosh|Windows/.test(o)&&/Version\/[\d.]+.*Safari/.test(o)&&!/Chrome|Chromium|Edg|OPR/.test(o)},ku=()=>"capture"in document.createElement("input"),Mu=()=>({safariDesktop:Au()}),Iu=()=>({htmlMediaCapture:ku()}),Qn=Mu(),Jn=Iu();var bi="image/*",rs="video/*",Ou=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],Lu=()=>Qn.safariDesktop?[bi]:[bi,...Ou],wi=Lu(),Ir=o=>o?o.filter(i=>typeof i=="string").flatMap(i=>Y(i)):[],os=(o,i)=>i.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return o.startsWith(e)}return o===t}),ta=(o,i)=>i.some(t=>t.startsWith(".")?o.toLowerCase().endsWith(t.toLowerCase()):false),Be=o=>{let i=o?.type;return i?os(i,wi):false};function ea(o,i,t,e,r){return {registry:{registerSource:c=>o.addSource(e,c),registerActivity:c=>o.addActivity(e,c),registerFileAction:c=>o.addFileAction(e,c),registerFileHook:c=>o.addFileHook(e,c),registerIcon:c=>o.addIcon(e,c),registerL10n:c=>o.addL10n(e,c),registerConfig:c=>{o.addConfig(e,c);let u=x(c.name);i.has(u)||i.add(u,c.defaultValue);}},config:{get:c=>{let u=x(c);return i.read(u)},subscribe:(c,u)=>{let d=x(c),h=i.sub(d,m=>{u(m);});return r.push(h),h}},activity:{getParams:()=>i.read("*currentActivityParams"),subscribeToParams:c=>{let u=i.sub("*currentActivityParams",d=>{c(d);});return r.push(u),u}},files:{update:(c,u)=>{let d=t.uploadCollection?.read(c);d&&(u.file!==void 0&&(d.setValue("file",u.file),d.setValue("fileSize",u.file.size)),u.cdnUrl!==void 0&&d.setValue("cdnUrl",u.cdnUrl),u.cdnUrlModifiers!==void 0&&d.setValue("cdnUrlModifiers",u.cdnUrlModifiers),u.mimeType!==void 0&&d.setValue("mimeType",u.mimeType));},replace:(c,u)=>t.api.replaceFileFromUploadcareFile(c,u)}}}var Pu=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),Or=class{constructor(i,t){this.i=i;this.du=t;this.ii=new Set;this.Mn=this.i.sub("*lazyPlugins",e=>{this.uu(e??[]);});}uu(i){for(let r of this.ii)r();if(this.ii.clear(),i.length===0)return;let t=new Set([x("plugins")]);for(let r of i)for(let s of r.configDeps)t.add(x(s));let e=()=>this.On(i);for(let r of t)this.ii.add(this.i.sub(r,e,false));this.On(i);}On(i){this.yo?.abort();let t=new AbortController;this.yo=t;let e=n=>this.i.read(x(n)),r=e("plugins"),s=Pu({entries:i.map(n=>({isEnabled:()=>n.isEnabled(e),load:n.load})),signal:t.signal}).then(n=>{if(!t.signal.aborted)return [...r,...n]});this.du(s);}destroy(){this.Mn();for(let i of this.ii)i();this.ii.clear(),this.yo?.abort();}};var Lr=class{constructor(){this.Ge=new Map;}register(i,t){if(this.Ge.has(t.name)){console.warn(`[CustomConfig] Config option "${t.name}" is already registered`);return}let e={attribute:true,...t,pluginId:i};this.Ge.set(t.name,e);}unregister(i){this.Ge.delete(i);}unregisterByPlugin(i){for(let[t,e]of this.Ge)e.pluginId===i&&this.Ge.delete(t);}get(i){return this.Ge.get(i)}getAll(){return new Map(this.Ge)}};var Pr=class{constructor(i=()=>{}){this.b=[];this.fe=[];this.Zi=[];this.Yi=[];this.Xi=[];this.St=[];this.config=new Lr;this.xe=F(i,0);}destroy(){this.xe.cancel();}At(i,t){return {...t,pluginId:i}}addSource(i,t){let e=this.b.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.b.push(this.At(i,t)),this.xe();}addActivity(i,t){let e=this.fe.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.fe.push(this.At(i,t)),this.xe();}addFileAction(i,t){this.Zi.push(this.At(i,t)),this.xe();}addFileHook(i,t){this.Yi.push(this.At(i,{timeout:3e4,...t})),this.xe();}addIcon(i,t){this.Xi.push(this.At(i,t)),this.xe();}addL10n(i,t){this.St.push(this.At(i,t)),this.xe();}addConfig(i,t){this.config.register(i,t),this.xe();}purge(i){this.b=this.b.filter(t=>t.pluginId!==i),this.fe=this.fe.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.St=this.St.filter(t=>t.pluginId!==i),this.config.unregisterByPlugin(i);}snapshot(){return {sources:[...this.b],activities:[...this.fe],fileActions:[...this.Zi],fileHooks:[...this.Yi],icons:[...this.Xi],l10n:[...this.St]}}};var Ur=class extends K{constructor(t){super(t);this.qe=new Map;this.f=new Set;this.bo=Promise.resolve();this.registry=new Pr(()=>this.Qi());this.In=new Or(this.i,e=>{this.bo=this.bo.then(()=>e).then(r=>{if(r)return this.pu(r)});});}get configRegistry(){return this.registry.config}pluginsReady(){return this.bo}onPluginsChange(t){return this.f.add(t),()=>{this.f.delete(t);}}async pu(t){let e=new Set(this.qe.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.qe.has(s.id))try{await this.hu(s);}catch(n){this.registry.purge(s.id),this.Qi(),console.error(`[PluginManager] Plugin "${s.id}" setup() threw an error`,n);}e.delete(s.id);}for(let s of e)this.wo(s);}async hu(t){this.qe.has(t.id)&&this.wo(t.id);let e=[],r=ea(this.registry,this.i,this.e,t.id,e),s=this.e.api,n;try{n=await t.setup({pluginApi:r,uploaderApi:s})??void 0;}catch(a){for(let l of e)try{l();}catch(c){this.E("Failed to unsubscribe config listener",c);}throw a}this.qe.set(t.id,{plugin:t,dispose:n,configSubscriptions:e}),this.Qi();}wo(t){let e=this.qe.get(t);if(e){this.registry.purge(t);for(let r of e.configSubscriptions)try{r();}catch(s){this.E("Failed to unsubscribe config listener",s);}e.dispose?.(),this.qe.delete(t),this.Qi();}}snapshot(){return this.registry.snapshot()}async runOnAddHooks(t){let e=t.getValue("file");if(!e)return;let r=this.registry.snapshot().fileHooks.filter(a=>a.type==="onAdd");if(r.length===0)return;let s=e,n=new AbortController;for(let a of r){if(n.signal.aborted)break;try{let l=a.handler({file:s,signal:n.signal}),c=new Promise((u,d)=>setTimeout(()=>d(new Error("onAdd hook timed out")),a.timeout));({file:s}=await Promise.race([l,c]));}catch(l){console.warn(`File hook "onAdd" from plugin "${a.pluginId}" failed`,l);}}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.qe.keys()))this.wo(t);this.registry.destroy(),this.In.destroy(),super.destroy();}Qi(){for(let t of this.f)try{t();}catch{}}};function Uu(o){return o.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}function ns(o){return Array.isArray(o)?o.map(i=>typeof i=="object"&&i!==null?ns(i):i):typeof o!="object"||o===null?o:Object.fromEntries(Object.entries(o).map(([i,t])=>{let e=Uu(i);return typeof t=="object"&&t!==null?[e,ns(t)]:[e,t]}))}function Ru(o){return {ok:true,value:o}}function ss(o){return {ok:false,error:o}}var $u="https://tlm.uploadcare.com/api/",as=class{constructor(i=$u){this.baseUrl=i;}async base(i,t={}){let e=`${this.baseUrl}${i}`;try{let r=await fetch(e,t);if(!r.ok)return ss(new Error(`Got non-200 response from "${e}". Status: ${r.status.toString()}`));try{let s=await r.json();return Ru(s)}catch(s){return ss(new Error(`Error parsing JSON from "${e}". Error: ${s}`))}}catch(r){return ss(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(ns(t)),headers:{"Content-Type":"application/json",...e.headers||{}}})}async get(i,t={}){return await this.base(i,{method:"GET",...t})}},Du=async(o,i)=>({success:true,data:i}),Fu=async o=>Du(void 0,o),Rr=class extends as{constructor(){super();}async sendEvent(i,t){let e=await Fu(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 Vu=20,V=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),A=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"}),$r=class extends K{constructor(){super(...arguments);this.ri=new Map;this.Ji=new Set;this.se=new Map;}bindTarget(t){return this.Ji.add(t),()=>{this.Ji.delete(t);}}on(t,e){let r=this.se.get(t);return r||(r=new Set,this.se.set(t,r)),r.add(e),()=>this.se.get(t)?.delete(e)}Pn(t,e){for(let s of this.Ji)s.dispatchEvent(new CustomEvent(t,{detail:e}));let r=this.se.get(t);if(r)for(let s of r)s(e);this.E?.(()=>{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.Pn(t,typeof e=="function"?e():e);return}this.ri.has(t)&&window.clearTimeout(this.ri.get(t));let n=typeof s=="number"?s:Vu,a=window.setTimeout(()=>{try{let l=typeof e=="function"?e():e;this.Pn(t,l),this.ri.delete(t);}catch(l){this.E?.(()=>`Error while getting payload for event "${t}"`,l);}},n);this.ri.set(t,a);}destroy(){for(let t of this.ri.values())window.clearTimeout(t);this.Ji.clear(),this.se.clear();}};var ia="1.32.0-alpha.0";var Ut="blocks",Rt=ia;var Dr=class extends K{constructor(t){super(t);this.fu=rt.generateRandomUUID();this.kt=structuredClone(J);this.xo=false;this.Eo=null;this.Pe=false;this.Ln=new Rr,this.Mt=new ne(10),this.addSub(this.i.sub(x("qualityInsights"),e=>{this.Pe=!!e;}));for(let e of Object.keys(this.kt))this.addSub(this.i.sub(x(e),r=>{this.Pe&&(this.xo&&this.kt[e]!==r&&this.sendEvent({eventType:V.CHANGE_CONFIG}),this.mu(e,r));}));}gu(t){t===V.INIT_SOLUTION&&!this.xo&&(this.xo=true);}mu(t,e){this.kt[t]!==e&&(this.kt[t]=e);}vu(t){let e=t.payload?{...t.payload}:{};e.activity&&(e.activity=void 0);let r={...t};return (t.eventType===V.INIT_SOLUTION||t.eventType===V.CHANGE_CONFIG)&&(r.config=this.kt),{...r,appVersion:Rt,appName:Ut,sessionId:this.fu,component:this.yu,activity:this.bu,projectPubkey:this.kt.pubkey,userAgent:navigator.userAgent,eventType:r.eventType??"",eventTimestamp:this.wu,payload:{location:this.xu,...e}}}Eu(t){return !!(t&&[A.CHANGE,A.COMMON_UPLOAD_PROGRESS,A.FILE_ADDED,A.FILE_REMOVED,A.FILE_UPLOAD_START,A.FILE_UPLOAD_PROGRESS,A.FILE_UPLOAD_SUCCESS,A.FILE_UPLOAD_FAILED].includes(t))}sendEvent(t){if(!this.Pe)return;let e=this.vu({eventType:t.eventType,payload:t.payload,config:t.config});this.gu(t.eventType),!(this.Eu(t.eventType)||this.Eo&&this.Rn(this.Eo,e))&&this.Mt.add(async()=>{this.Eo=e,await this.Ln.sendEvent(e);});}sendEventError(t,e="unknown"){this.sendEvent({eventType:V.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${e}`,error:t.message}}});}sendEventCloudImageEditor(t,e,r={}){this.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{tabId:e,node:t.currentTarget?.tagName,event:t.type,...r}}});}Rn(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 n of r)if(!Object.hasOwn(e,n)||!this.Rn(t[n],e[n]))return false;return true}get wu(){return Date.now()}get yu(){if(!this.i.has("*solution"))return null;let t=this.i.read("*solution");return t?t.toLowerCase():null}get bu(){return this.i.has("*currentActivity")?this.i.read("*currentActivity"):null}get xu(){return location.origin}};var ra=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};var _u=o=>o;var oa="plural:";function ze(o,i={},t={}){let{openToken:e="{{",closeToken:r="}}",transform:s=_u}=t;for(let n in i){let a=i[n],l=a?.toString(),c=typeof l=="string"?s(l):String(l);o=o.replaceAll(e+n+r,c);}return o}function sa(o){let i=[],t=o.indexOf("{{");for(;t!==-1;){let e=o.indexOf("}}",t);if(e===-1)break;let r=o.substring(t+2,e);if(r.startsWith(oa)){let s=o.substring(t+2,e).replace(oa,""),n=s.substring(0,s.indexOf("(")),a=s.substring(s.indexOf("(")+1,s.indexOf(")"));i.push({variable:r,pluralKey:n,countVariable:a});}t=o.indexOf("{{",e);}return i}var na="--uploadcare-blocks-window-height",Ei=class o{static{this.clientsRegistry=new Set;}static{this.flush=F(()=>{document.documentElement.style.setProperty(na,`${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(na);}};var Fr=(o,i)=>new Intl.PluralRules(o).select(i);var Bu=o=>(i,t)=>{let e=o(),r=e("locale-id")||"en",s=Fr(r,t);return e(`${i}__${s}`)},Vr=o=>{let i=Bu(()=>t),t=(e,r={})=>{if(!e)return "";let n=o().read(Zt(e))||e,a=sa(n);for(let c of a)r[c.variable]=i(c.pluralKey,Number(r[c.countVariable]));return ze(n,r)};return t};var zu=o=>o.tagName?.includes("-")??false,Nr=class{constructor(i){this.We=new Set;this.er=new Map;this.Un=false;this.Ze=i,this.Ze.addController(this);}hostDisconnected(){this.tr?.(),this.tr=void 0,this.We.clear(),this.er.clear();}hostUpdated(){if(!this.tr&&this.Ze.has(x("testMode"))){let i=this.Ze.subConfigValue("testMode",t=>{this.Un=!!t,this.$n();});this.tr=i;}this.Tu(),this.$n();}Tu(){let i=this.Ze,t=i.renderRoot??i;if(!t)return;let e=this.Ze,r=e.tagName?.toLowerCase(),s=Array.from(t.querySelectorAll("[data-testid]")).filter(n=>!zu(n));for(let n of s)if(!(r&&n.closest(r)!==e)&&!this.We.has(n)){let a=n.getAttribute("data-testid");if(!a)continue;this.We.add(n),this.er.set(n,a);}for(let n of Array.from(this.We))(!n.isConnected||r&&n.closest(r)!==e)&&(this.We.delete(n),this.er.delete(n));}$n(){if(!this.We.size)return;let i=this.Ze.testId||"";for(let t of this.We){let e=this.er.get(t);e&&(this.Un?t.setAttribute("data-testid",`${i}--${e}`):t.removeAttribute("data-testid"));}}};var Hu=De(dr()($e(lr(Ct)))),C=class extends Hu{constructor(){super();this.init$=Xo();this.l10n=Vr(()=>this.sharedCtx);this.debugPrint=gr(()=>this.sharedCtx,this.constructor.name);this.e=Pn(()=>this.sharedCtx);new Nr(this);}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 n=typeof e=="function"?e():e;this.telemetryManager.sendEvent({eventType:t,payload:n??void 0});}hasBlockInCtx(t){for(let e of this.blocksRegistry)if(t(e))return true;return false}connectedCallback(){this.constructor.styleAttrs.forEach(e=>{this.setAttribute(e,"");}),super.connectedCallback(),Ei.registerClient(this);}initCallback(){this.Y("*blocksRegistry",()=>new Set),this.Y("*pluginManager",t=>new Ur(t)),this.Y("*eventEmitter",t=>new $r(t)),this.Y("*localeManager",t=>new Mr(t)),this.Y("*modalManager",t=>new vr(t)),this.Y("*a11y",()=>new kr),this.Y("*routerLayer",t=>new Ar(t)),this.Y("*clipboard",t=>new Sr(t)),this.Y("*telemetryManager",t=>new Dr(t)),this.sub(Zt("locale-id"),t=>{let e=ra(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(),Ei.unregisterClient(this);let t=this.blocksRegistry;t?.delete(this),t?.size===0&&setTimeout(()=>{this.isConnected||t?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this.Cu(),H.deleteCtx(this.ctxName);}Dn(){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.Dn();if(!r.has(t)&&(!this.has(t)||!this.$[t])){let s=e(this.e);this.add(t,s,true),r.set(t,s);return}}Cu(){let t=this.Dn();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:mr(t),cdnUrlModifiers:Do(t),fileName:hr(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:e=>window.encodeURIComponent(e)}):t}get cfg(){if(!this.He){let t={};this.He=new Proxy(t,{set:(e,r,s)=>{if(typeof r!="string"||!(r in J))return false;let n=r,a=x(n);return this.has(a)||this.add(a,J[n]),this.$[a]=s,true},get:(e,r)=>{let s=x(r);return this.has(s)||this.add(s,J[r]),this.$[s]}});}return this.He}subConfigValue(t,e){let r=x(t);return this.has(r)||this.add(r,J[t]),this.sub(r,e)}};var $t={ATTRIBUTE:1,CHILD:2},at=o=>(...i)=>({ro:o,values:i}),ht=class{constructor(i){}get X(){return this.m.X}oo(i,t,e){this.ir=i,this.m=t,this.Su=e;}Wc(i,t){return this.update(i,t)}update(i,t){return this.render(...t)}};var Ae=class extends ht{constructor(i){if(super(i),this.it=U,i.type!==$t.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===U||i==null)return this.Fn=void 0,this.it=i;if(i===it)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this.Fn;this.it=i;let t=[i];return t.raw=t,this.Fn={Me:this.constructor.resultType,strings:t,values:[]}}};Ae.directiveName="unsafeHTML",Ae.resultType=1;var Ti=class extends Ae{};Ti.directiveName="unsafeSVG",Ti.resultType=2;var He=at(Ti);var aa="<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 fill='none' viewBox='0 0 24 24' id='uc-icon-preloader' xmlns='http://www.w3.org/2000/svg'><circle cx='12' cy='12' r='11' stroke='currentColor' stroke-linecap='round' style='stroke-dasharray:100 100;stroke-dashoffset:var(--l-progress-offset, 100);transition:stroke-dashoffset .6s linear' transform='rotate(-90 12 12)'/><circle cx='12' cy='12' r='11' stroke='currentColor' stroke-linecap='round' opacity='.2'/></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 Yt=class extends C{constructor(){super(...arguments);this.init$=Gn(this);}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 v`${He(aa)}`}};var la=o=>typeof o!="number"?0:Math.floor(o/1e3),ca=(o,{threshold:i})=>{let{secureExpire:t}=o,e=la(Date.now()),r=Number(t),s=la(i);return e+s>=r};var _r=class extends K{constructor(){super(...arguments);this.Ye=null;}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:r,secureUploadsExpireThreshold:s}=this.Ke;if((t||e)&&r&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),r){if(!this.Ye||ca(this.Ye,{threshold:s})){this.Ye?this.E("Secure signature is expired. Resolving a new one..."):this.E("Secure signature is not set yet.");try{let n=await r();n?!n.secureSignature||!n.secureExpire?console.error("Secure signature resolver returned an invalid result:",n):(this.E("Secure signature resolved:",n),this.E("Secure signature will expire in",new Date(Number(n.secureExpire)*1e3).toISOString()),this.Ye=n):(this.E("Secure signature resolver returned nothing."),this.Ye=null);}catch(n){console.error("Secure signature resolving failed. Falling back to the previous one.",n),this.e.telemetryManager.sendEventError(n,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this.Ye}return t&&e?(this.E("Secure signature and expire are set. Using them...",{secureSignature:t,secureExpire:e}),{secureSignature:t,secureExpire:e}):null}destroy(){super.destroy(),this.Ye=null;}};var ls=(o,i)=>{if(o.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}};var cs=(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}}};var us=(o,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,r=Ir([...t?wi:[],e]);if(!r.length)return;let s=o.mimeType,n=o.name;if(!s||!n)return;let a=os(s,r),l=ta(n,r);if(!a&&!l)return {type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:o}}};var ds=(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}}};var Dt=1e3,ke=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),Ci=o=>Math.ceil(o*100)/100,ua=(o,i=ke.AUTO)=>{let t=i===ke.AUTO;if(i===ke.BYTE||t&&o<Dt**1){let r=Fr("en-US",o)==="one"?"byte":"bytes";return `${o} ${r}`}return i===ke.KB||t&&o<Dt**2?`${Ci(o/Dt**1)} KB`:i===ke.MB||t&&o<Dt**3?`${Ci(o/Dt**2)} MB`:i===ke.GB||t&&o<Dt**4?`${Ci(o/Dt**3)} GB`:i===ke.TB||t&&o<Dt**5?`${Ci(o/Dt**4)} TB`:`${Ci(o/Dt**5)} PB`};var ps=(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:ua(t)}),payload:{entry:o}}};var hs=(o,i)=>{let{internalId:t}=o;if(!i.a.hasItem(t))return;let r=i.a.read(t)?.getValue("uploadError");if(!r)return;if(r instanceof nt)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}}};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."},Ku=o=>typeof o=="function"?{runOn:"change",validator:o}:o,Br=class extends K{constructor(t){super(t);this.Au=[ds,us,ps,hs];this.ku=[cs,ls];this.Mt=new ne(20);this.Nn=F(()=>{this.Mt.run();},500);this.Le=false;this.Ot=new Map;let e=F(()=>{this.runFileValidators("change"),this.runCollectionValidators();},0);this.addSub(this.i.sub(x("maxLocalFileSizeBytes"),e)),this.addSub(this.i.sub(x("multipleMin"),e)),this.addSub(this.i.sub(x("multipleMax"),e)),this.addSub(this.i.sub(x("multiple"),e)),this.addSub(this.i.sub(x("imgOnly"),e)),this.addSub(this.i.sub(x("accept"),e)),this.addSub(this.i.sub(x("validationConcurrency"),r=>{this.Mt.concurrency=r;}));}get a(){return this.e.uploadCollection}runFileValidators(t,e){if(this.Le)return;let r=e??this.a.items();for(let s of r){let n=this.a.read(s);n&&this.Mu(n,t);}}runCollectionValidators(){if(this.Le)return;let t=this.e.api,e=t.getOutputCollectionState(),r=[],s=this.Ke.collectionValidators;for(let n of [...this.ku,...s])try{let a=n(e,t);if(!a)continue;a&&(r.push(this.Vn(a)),a.message||console.warn(Ke.MISSING_ERROR_MESSAGE));}catch(a){console.warn(Ke.COLLECTION_VALIDATION_FAILED,a);}this.i.pub("*collectionErrors",r),r.length>0&&this.e.eventEmitter.emit(A.COMMON_UPLOAD_FAILED,()=>t.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(t){let e=this.Ot.get(t.uid);e&&(e.abortController?.abort(),this.Ot.delete(t.uid));}async Mu(t,e){if(this.Le)return;let r=this.e.api,s=this._n(t),n=s.promise??Promise.resolve(),a=(async()=>{if(this.Le||(await n,this.Le))return;let l=this.Ou(t,e);if(l.length===0||!this.a.hasItem(t.uid))return;t.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let c=r.getOutputItem(t.uid),u=new AbortController;s.abortController=u;let d=this.Ke.validationTimeout,h=this.Bn(),m=new Set(l.map(w=>w.validator)),g=[];for(let w of h)if(!m.has(w.validator)){let T=s.lastErrorThrownByValidator.get(w.validator);T&&g.push(T);}let b=l.map(w=>async()=>{if(this.Le)return;let T=setTimeout(()=>{s.skippedValidators.add(w.validator),u.abort(),console.warn(Ke.FILE_VALIDATION_TIMEOUT);},d);try{let E=await w.validator(c,r,{signal:u.signal});if(!E||u.signal.aborted){s.lastErrorThrownByValidator.set(w.validator,void 0);return}let S=this.Vn(E);s.lastErrorThrownByValidator.set(w.validator,S),g.push(S),E.message||console.warn(Ke.MISSING_ERROR_MESSAGE);}catch(E){u.signal.aborted||(s.skippedValidators.add(w.validator),console.warn(Ke.FILE_VALIDATION_FAILED,E),this.e.telemetryManager.sendEventError(E,`file validator. ${Ke.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(T),w.runOn!=="change"&&s.skippedValidators.add(w.validator);}});if(this.Nn(),await this.Mt.add(async()=>{this.Le||(t.setValue("isQueuedForValidation",false),await Promise.all(b.map(w=>w())).catch(()=>{}));},{autoRun:false}),u.signal.aborted){t.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}t.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:g});})();s.promise=a;try{await a;}finally{s.promise===a&&(s.promise=void 0);}}Vn(t){return {...t,type:t.type??"CUSTOM_ERROR"}}_n(t){let e=this.Ot.get(t.uid);if(e)return e;let r={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this.Ot.set(t.uid,r),r}Bn(){let t=this.Ke.fileValidators;return [...this.Au,...t].map(Ku)}Ou(t,e){let r=this._n(t);return this.Bn().filter(s=>!r.skippedValidators.has(s.validator)).filter(s=>s.runOn===e)}destroy(){this.Le=true,this.Nn.cancel();for(let t of this.Ot.values())t.abortController?.abort(),t.promise=void 0;this.Ot.clear();}};var da="[Typed State] Wrong property name: ",zr=class{constructor(i){this.re=rt.generateFastUid(),this.J=H.registerCtx(i,this.re);}get uid(){return this.re}setValue(i,t){if(!this.J.has(i)){console.warn(`${da}${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(`${da}${String(i)}`),this.J.read(i)}subscribe(i,t){return this.J.sub(i,t)}destroy(){H.deleteCtx(this.re);}};var Hr=class o{constructor(i){this.Re=Object.create(null);this.rr=new Set;this.or=new Set;this.ee=new Set;this.To=new Set;this.Co=new Set;this.It=new Set;this.Kn=i.initialValue,this.re=rt.generateFastUid(),this.J=H.registerCtx({},this.re),this.zn=i.watchList||[];let t=Object.create(null);this.Hn=(e,r)=>{this.oi&&window.clearTimeout(this.oi),t[e]||(t[e]=new Set),t[e].add(r),this.oi=window.setTimeout(()=>{Object.keys(t).length!==0&&(this.rr.forEach(s=>{s({...t});}),t=Object.create(null));}),this.jn();},i.handler&&this.observeCollection(i.handler);}static{this.Iu=1e4;}Z(){this.si&&window.clearTimeout(this.si),this.si=window.setTimeout(()=>{let i=new Set(this.Co),t=new Set(this.To);this.Co.clear(),this.To.clear();for(let e of this.or)e?.([...this.ee],i,t);this.jn();});}jn(){this.It.size!==0&&(this.ni&&window.clearTimeout(this.ni),this.ni=window.setTimeout(()=>{let i=[...this.It];this.It.clear();for(let t of i)t.destroy();},o.Iu));}observeCollection(i){return this.or.add(i),this.ee.size>0&&this.Z(),()=>{this.unobserveCollection(i);}}unobserveCollection(i){this.or.delete(i);}add(i,t={}){let e=new zr(this.Kn);for(let[r,s]of Object.entries(i))e.setValue(r,s);if(t.index===void 0)this.ee.add(e.uid);else {let r=[...this.ee];r.splice(t.index,0,e.uid),this.ee=new Set(r);}return this.Z(),this.J.add(e.uid,e),this.Co.add(e),this.zn.forEach(r=>{this.Re[e.uid]||(this.Re[e.uid]=[]),this.Re[e.uid]?.push(e.subscribe(r,()=>{this.Hn(r,e.uid);}));}),e.uid}hasItem(i){return this.ee.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.To.add(t),this.It.add(t)),this.ee.delete(i),this.Z(),this.J.pub(i,void 0),this.Re[i]?.forEach(e=>{e();}),delete this.Re[i];}abort(i){this.read(i)?.getValue("isUploading")&&this.remove(i);}abortAll(){this.ee.forEach(i=>{this.abort(i);});}clearAll(){this.ee.forEach(i=>{this.remove(i);});}observeProperties(i){return this.rr.add(i),()=>{this.unobserveProperties(i);}}unobserveProperties(i){this.rr.delete(i);}findItems(i){let t=[];return this.ee.forEach(e=>{let r=this.read(e);r&&i(r)&&t.push(e);}),t}items(){return [...this.ee]}get size(){return this.ee.size}destroy(){this.oi&&window.clearTimeout(this.oi),this.si&&window.clearTimeout(this.si),this.ni&&window.clearTimeout(this.ni);for(let i of this.It)i.destroy();this.It.clear(),H.deleteCtx(this.re),this.rr=new Set,this.or=new Set;for(let i of Object.keys(this.Re))this.Re[i]?.forEach(t=>{t();}),delete this.Re[i];}};var L=Object.freeze({PHOTO:"photo",VIDEO:"video"}),St=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var pa=o=>({isVideoRecordingEnabled:G(o.cameraModes).includes(L.VIDEO),isPhotoEnabled:G(o.cameraModes).includes(L.PHOTO)});var ha=(o,i)=>{for(let t of o)if(i(t))return t};var ms=(o,i,{timeout:t=1e3,onTimeout:e}={})=>new Promise(r=>{let s,n=setTimeout(()=>{cancelAnimationFrame(s),e?.();},t),a=()=>{for(let l of o)if(i(l)){clearTimeout(n),r(l);return}s=requestAnimationFrame(a);};a();});function Kr(o,i){for(let t in i)t.includes("-")?o.style.setProperty(t,String(i[t])):o.style[t]=String(i[t]);}var ju=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,Gu=new RegExp(`^/?(${ju.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),ma=({url:o,cdnBase:i})=>{let t=new URL(i),e=new URL(vi),r=new URL(o);if(t.host!==r.host&&e.host!==r.host)return null;let s=Gu.exec(r.pathname);if(!s)return null;let[,n,a,l]=s;return n?{uuid:n,cdnUrlModifiers:a||"",filename:l||null}:null};var mt=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",DROPBOX_CHOOSER:"dropboxchooser",GDRIVE:"gdrive",GPHOTOS:"gphotos",BOX:"box",ONEDRIVE:"onedrive"}),qu=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),P=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",...qu,...mt}),Wu={[mt.DROPBOX_CHOOSER]:mt.DROPBOX},fa=o=>Wu[o]??o;var jr=o=>o.uploadCollection.items().map(e=>o.api.getOutputItem(e));function ga(o){let i=new Map;return (...e)=>{let r=JSON.stringify(e);if(i.has(r))return i.get(r);let s=o(...e);return i.set(r,s),s}}var va=new Set;function Gr(o){va.has(o)||(va.add(o),console.warn(o));}function Zu(o){let i=false;return setTimeout(()=>{i=true;},0),e=>((...r)=>(i&&Gr(o),e(...r)))}function ya(o){let i={},t=o.ctx,e={progress:()=>t.read("*commonProgress"),errors:()=>t.read("*collectionErrors"),group:()=>t.read("*groupInfo"),totalCount:()=>o.uploadCollection.size,failedCount:()=>i.failedEntries.length,successCount:()=>i.successEntries.length,uploadingCount:()=>i.uploadingEntries.length,status:()=>i.isFailed?"failed":i.isUploading?"uploading":i.isSuccess?"success":"idle",isSuccess:()=>i.allEntries.length>0&&i.errors.length===0&&i.successEntries.length===i.allEntries.length,isUploading:()=>i.allEntries.some(s=>s.status==="uploading"),isFailed:()=>i.errors.length>0||i.failedEntries.length>0,allEntries:()=>jr(o),successEntries:()=>i.allEntries.filter(s=>s.status==="success"),failedEntries:()=>i.allEntries.filter(s=>s.status==="failed"),uploadingEntries:()=>i.allEntries.filter(s=>s.status==="uploading"),idleEntries:()=>i.allEntries.filter(s=>s.status==="idle")},r=Zu("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[s,n]of Object.entries(e)){let a=s,c=ga(r(n));Object.defineProperty(i,a,{get:c,enumerable:true});}return i}var ba={file:null,externalUrl:null,fileName:null,fileSize:null,lastModified:Date.now(),uploadProgress:0,uuid:null,isImage:false,mimeType:null,ctxName:null,cdnUrl:null,cdnUrlModifiers:null,fileInfo:null,isUploading:false,abortController:null,thumbUrl:null,silent:false,source:null,fullPath:null,metadata:null,errors:[],uploadError:null,isRemoved:false,isQueuedForUploading:false,isValidationPending:false,isQueuedForValidation:false};function fs(o){return {fileInfo:o,uuid:o.uuid,cdnUrl:o.cdnUrl,fileName:o.originalFilename??null,fileSize:o.size,isImage:o.isImage??false,mimeType:o.contentInfo?.mime?.mime??o.mimeType??null,uploadProgress:100}}var qr=class extends K{constructor(){super(...arguments);this.St=Vr(()=>this.i);this.addFileFromUrl=(t,{silent:e,fileName:r,source:s}={})=>{let n=this.a.add({externalUrl:t,fileName:r??null,silent:e??false,source:s??P.API});return this.getOutputItem(n)};this.addFileFromUuid=(t,{silent:e,fileName:r,source:s}={})=>{let n=this.a.add({uuid:t,fileName:r??null,silent:e??false,source:s??P.API});return this.getOutputItem(n)};this.addFileFromCdnUrl=(t,{silent:e,fileName:r,source:s}={})=>{let n=ma({url:t,cdnBase:this.cfg.cdnCname});if(!n)throw new Error("Invalid CDN URL");let a=this.a.add({uuid:n.uuid,cdnUrl:t,cdnUrlModifiers:n.cdnUrlModifiers,fileName:r??n.filename??null,silent:e??false,source:s??P.API});return this.getOutputItem(a)};this.addFileFromObject=(t,{silent:e,fileName:r,source:s,fullPath:n}={})=>{let a=this.a.add({file:t,isImage:Be(t),mimeType:t.type||null,fileName:r??t.name,fileSize:t.size,silent:e??false,source:s??P.API,fullPath:n??null});return this.getOutputItem(a)};this.addFileFromUploadcareFile=(t,{silent:e,fileName:r,source:s}={})=>{let n=this.a.add({...fs(t),fileName:r??t.originalFilename??null,silent:e??false,source:s??P.API});return this.getOutputItem(n)};this.replaceFileFromUploadcareFile=(t,e,{silent:r,fileName:s,source:n}={})=>{let a=t,l=this.a.items().indexOf(a),c=this.a.read(a);if(l===-1||!c)throw new Error(`File with internalId ${t} not found`);let u={source:c.getValue("source"),metadata:c.getValue("metadata"),fullPath:c.getValue("fullPath"),silent:c.getValue("silent")};this.a.remove(a);let d=this.a.add({...fs(e),fileName:s??e.originalFilename??null,silent:r??u.silent,source:n??u.source??P.API,metadata:u.metadata,fullPath:u.fullPath},{index:l});return this.getOutputItem(d)};this.removeFileByInternalId=t=>{if(!this.a.read(t))throw new Error(`File with internalId ${t} not found`);this.a.remove(t);};this.uploadAll=()=>{let t=this.a.items().filter(e=>{let r=this.a.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(A.COMMON_UPLOAD_START,this.getOutputCollectionState()));};this.openSystemDialog=(t={})=>{let e=Kt(Ir([this.cfg.accept??"",...this.cfg.imgOnly?wi:[]])),r="uploadcare-file-input",s=document.createElement("input");if(s.setAttribute(r,""),Kr(s,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),s.type="file",s.multiple=this.cfg.multiple,t.captureCamera){s.capture=this.cfg.cameraCapture;let{isPhotoEnabled:n,isVideoRecordingEnabled:a}=pa(this.cfg);t.modeCamera===L.PHOTO&&n?s.accept=bi:t.modeCamera===L.VIDEO&&a?s.accept=rs:s.accept=[bi,a&&rs].filter(Boolean).join(",");}else s.accept=e;s.addEventListener("change",()=>{s.files&&([...s.files].forEach(n=>{this.addFileFromObject(n,{source:t.captureCamera?P.CAMERA:P.LOCAL});}),this.e.routerLayer.navigateAfterFileAdd(),s.remove());},{once:true}),document.querySelectorAll(`[${r}]`).forEach(n=>{n.remove();}),document.body.appendChild(s),s.dispatchEvent(new MouseEvent("click"));};this.initFlow=(t=false)=>{if(this.a.size>0&&!t)this.i.pub("*currentActivity",D.UPLOAD_LIST),this.e.modalManager?.open(D.UPLOAD_LIST);else if(this.Gn?.length===1){let e=this.Gn[0];this.So().then(()=>{let r=this.e.pluginManager.snapshot().sources,s=r.find(n=>n.id===e);if(s){let n=s.expand?.()??[e];n.length===1?(r.find(l=>l.id===n[0])??s).onSelect():(this.i.pub("*currentActivity",D.START_FROM),this.e.modalManager?.open(D.START_FROM));return}this.i.read("*currentActivity")&&this.e.modalManager?.open(this.i.read("*currentActivity"));});}else this.i.pub("*currentActivity",D.START_FROM),this.e.modalManager?.open(D.START_FROM);};this.doneFlow=()=>{let t=ha(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());};this.setCurrentActivity=(t,...e)=>{this.So().then(()=>{this.i.pub("*currentActivityParams",e[0]??{}),this.i.pub("*currentActivity",t),ms(this.e.blocksRegistry,r=>r.activityType===t,{onTimeout:()=>console.warn(`Activity type "${t}" not found in the context`),timeout:100});});};this.on=(t,e)=>this.e.eventEmitter.on(t,e);this.getCurrentActivity=()=>this.i.read("*currentActivity");this.historyBack=()=>{this.i.read("*historyBack")?.();};this.setModalState=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 ms(this.e.blocksRegistry,r=>r.activityType===e,{onTimeout:()=>console.warn(`Activity block "${e}" not found in the context`)}).then(()=>{this.e.modalManager?.open(e);})});};}get a(){return this.e.uploadCollection}get cfg(){return this.Ke}get l10n(){return this.St}removeAllFiles(){this.a.clearAll();}getOutputItem(t){let e=H.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,n=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:n==="success",isUploading:n==="uploading",isFailed:n==="failed",isRemoved:n==="removed",isValidationPending:r.isValidationPending,errors:r.errors,status:n,source:r?.source}}getOutputCollectionState(){return ya(this.e)}async So(){return (await this.e.wait("pluginManager")).pluginsReady()}get Gn(){let t=[];return this.cfg.sourceList&&(t=Y(this.cfg.sourceList)),t}};var xi=33.333333333333336,k=1,gs=24,wa=6;function ce(o,i){for(let[t,e]of Object.entries(i))o.setAttributeNS(null,t,e.toString());}function yt(o,i={}){let t=document.createElementNS("http://www.w3.org/2000/svg",o);return ce(t,i),t}function Ea(o,i,t){let{x:e,y:r,width:s,height:n}=o,a=i.includes("w")?0:1,l=i.includes("n")?0:1,c=a===0?-1:1,u=l===0?-1:1,d=[e+a*s+1.5*c,r+l*n+1.5*u-24*t*u],h=[e+a*s+1.5*c,r+l*n+1.5*u],m=[e+a*s-24*t*c+1.5*c,r+l*n+1.5*u],g=`M ${d[0]} ${d[1]} L ${h[0]} ${h[1]} L ${m[0]} ${m[1]}`,b=[h[0],h[1]];return {d:g,center:b}}function Ta(o,i,t){let{x:e,y:r,width:s,height:n}=o,a=i==="n"||i==="s",l=i==="w"||i==="e",c=a?.5:i==="w"?0:1,u=l?.5:i==="n"?0:1,d=i==="w"?-1:i==="e"?1:0,h=i==="n"?-1:i==="s"?1:0,m,g;a?(m=[e+c*s-34*t/2,r+u*n+1.5*h],g=[e+c*s+34*t/2,r+u*n+1.5*h]):(m=[e+c*s+1.5*d,r+u*n-34*t/2],g=[e+c*s+1.5*d,r+u*n+34*t/2]);let b=`M ${m[0]} ${m[1]} L ${g[0]} ${g[1]}`,w=[(m[0]+g[0])/2,(m[1]+g[1])/2];return {d:b,center:w}}function Ca(o){return o===""?"move":["e","w"].includes(o)?"ew-resize":["n","s"].includes(o)?"ns-resize":["nw","se"].includes(o)?"nwse-resize":"nesw-resize"}function xa({rect:o,delta:[i,t],imageBox:e}){return Ge({...o,x:o.x+i,y:o.y+t},e)}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}}function Yu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:n,height:a}=o;s+=r,a-=r,t&&(n=a*t);let l=o.x+o.width/2-n/2;return s<=e.y&&(s=e.y,a=o.y+o.height-s,t&&(n=a*t,l=o.x+o.width/2-n/2)),l<=e.x&&(l=e.x,s=o.y+o.height-a),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),s=o.y+o.height-a),a<k&&(a=k,t&&(n=a*t,l=o.x+o.width/2-n/2),s=o.y+o.height-a),n<k&&(n=k,t&&(a=n/t,l=o.x+o.width/2-n/2),s=o.y+o.height-a),{x:l,y:s,width:n,height:a}}function Xu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:n,height:a}=o;s+=r,n-=r,t&&(a=n/t);let l=o.y+o.height/2-a/2;return s<=e.x&&(s=e.x,n=o.x+o.width-s,t&&(a=n/t,l=o.y+o.height/2-a/2)),l<=e.y&&(l=e.y,s=o.x+o.width-n),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),s=o.x+o.width-n),a<k&&(a=k,t&&(n=a*t),l=o.y+o.height/2-a/2,s=o.x+o.width-n),n<k&&(n=k,t&&(a=n/t),l=o.y+o.height/2-a/2,s=o.x+o.width-n),{x:s,y:l,width:n,height:a}}function Qu({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[,r]=i,{y:s,width:n,height:a}=o;a+=r,t&&(n=a*t);let l=o.x+o.width/2-n/2;return s+a>=e.y+e.height&&(a=e.y+e.height-s,t&&(n=a*t),l=o.x+o.width/2-n/2),l<=e.x&&(l=e.x,s=o.y),l+n>=e.x+e.width&&(l=Math.max(e.x,e.x+e.width-n),n=e.x+e.width-l,t&&(a=n/t),s=o.y),a<k&&(a=k,t&&(n=a*t),l=o.x+o.width/2-n/2),n<k&&(n=k,t&&(a=n/t),l=o.x+o.width/2-n/2),{x:l,y:s,width:n,height:a}}function Ju({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r]=i,{x:s,width:n,height:a}=o;n+=r,t&&(a=n/t);let l=o.y+o.height/2-a/2;return s+n>=e.x+e.width&&(n=e.x+e.width-s,t&&(a=n/t),l=o.y+o.height/2-a/2),l<=e.y&&(l=e.y,s=o.x),l+a>=e.y+e.height&&(l=Math.max(e.y,e.y+e.height-a),a=e.y+e.height-l,t&&(n=a*t),s=o.x),a<k&&(a=k,t&&(n=a*t),l=o.y+o.height/2-a/2),n<k&&(n=k,t&&(a=n/t),l=o.y+o.height/2-a/2),{x:s,y:l,width:n,height:a}}function td({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+r<e.x&&(r=e.x-n),a+s<e.y&&(s=e.y-a),n+=r,l-=r,a+=s,c-=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a-=s,a<=e.y&&(c=c-(e.y-a),l=c*t,n=o.x+o.width-l,a=e.y)):t&&(r=c*t-l,l=l+r,n-=r,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=o.y+o.height-c)),c<k&&(c=k,t&&(l=c*t),n=o.x+o.width-l,a=o.y+o.height-c),l<k&&(l=k,t&&(c=l/t),n=o.x+o.width-l,a=o.y+o.height-c),{x:n,y:a,width:l,height:c}}function ed({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+l+r>e.x+e.width&&(r=e.x+e.width-n-l),a+s<e.y&&(s=e.y-a),l+=r,a+=s,c-=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a-=s,a<=e.y&&(c=c-(e.y-a),l=c*t,n=o.x,a=e.y)):t&&(r=c*t-l,l+=r,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=o.y+o.height-c)),c<k&&(c=k,t&&(l=c*t),a=o.y+o.height-c),l<k&&(l=k,t&&(c=l/t),a=o.y+o.height-c),{x:n,y:a,width:l,height:c}}function id({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+r<e.x&&(r=e.x-n),a+c+s>e.y+e.height&&(s=e.y+e.height-a-c),n+=r,l-=r,c+=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=o.x+o.width-l,a=e.y+e.height-c)):t&&(r=c*t-l,l+=r,n-=r,n<=e.x&&(l=l-(e.x-n),c=l/t,n=e.x,a=o.y)),c<k&&(c=k,t&&(l=c*t),n=o.x+o.width-l),l<k&&(l=k,t&&(c=l/t),n=o.x+o.width-l),{x:n,y:a,width:l,height:c}}function rd({rect:o,delta:i,aspectRatio:t,imageBox:e}){let[r,s]=i,{x:n,y:a,width:l,height:c}=o;return n+l+r>e.x+e.width&&(r=e.x+e.width-n-l),a+c+s>e.y+e.height&&(s=e.y+e.height-a-c),l+=r,c+=s,t&&Math.abs(l/c)>t?(s=l/t-c,c+=s,a+c>=e.y+e.height&&(c=e.y+e.height-a,l=c*t,n=o.x,a=e.y+e.height-c)):t&&(r=c*t-l,l+=r,n+l>=e.x+e.width&&(l=e.x+e.width-n,c=l/t,n=e.x+e.width-l,a=o.y)),c<k&&(c=k,t&&(l=c*t)),l<k&&(l=k,t&&(c=l/t)),{x:n,y:a,width:l,height:c}}function Sa({direction:o,...i}){switch(o){case "n":return Yu(i);case "w":return Xu(i);case "s":return Qu(i);case "e":return Ju(i);case "nw":return td(i);case "ne":return ed(i);case "sw":return id(i);case "se":return rd(i);default:return i.rect}}function Aa(o,[i,t]){return o.x<=i&&i<=o.x+o.width&&o.y<=t&&t<=o.y+o.height}function ka(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}function Ma(o,i){return Math.abs(o.width/o.height-i)<.1}function qe({width:o,height:i},t){let e=t/90%2!==0;return {width:e?i:o,height:e?o:i}}function Ia(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 n=Math.round((o-r)/2),a=Math.round((i-s)/2);return n+r>o&&(r=o-n),a+s>i&&(s=i-a),{x:n,y:a,width:r,height:s}}function We(o){return {x:Math.round(o.x),y:Math.round(o.y),width:Math.round(o.width),height:Math.round(o.height)}}function ue(o,i,t){return Math.min(Math.max(o,i),t)}var Si=["free"],Zr=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&&!Si.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}let n=Number(r.slice(0,s)),a=Number(r.slice(s+1));if((!Number.isFinite(n)||!Number.isFinite(a)||n<=0||a<=0)&&!Si.includes(r)){console.warn(`Invalid crop preset: ${r}`);continue}t.push({id:rt.generateFastUid(),type:"aspect-ratio",width:Si.includes(r)?0:n,height:Si.includes(r)?0:a,hasFreeform:Si.includes(r)});}return t},Oa=(o,i,t,e=.1)=>{let r=o/i,s=null,n=1/0;for(let a of t){let[l,c]=[a.width,a.height],u=l/c,d=Math.abs(r-u);d<n&&(n=d,s=a);}if(s){let[a,l]=[s.width,s.height],c=a/l;if(Math.abs(r-c)/c>e)return null}return s};function La(o){return jo({...o,libraryName:Ut,libraryVersion:Rt})}var Pa="active",Ze="___ACTIVITY_IS_ACTIVE___",Ua,$=class o extends(Ua=C,Ua){constructor(){super(...arguments);this.historyTracked=false;this.activityType=null;this.init$=Qo(this);this.Pu=F(this.Lu.bind(this),10);}qn(){let t=o.ai.get(this);this[Ze]=false,this.removeAttribute(Pa),t?.deactivateCallback?.();}Ru(){let t=o.ai.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[Ze]=true,this.setAttribute(Pa,""),t?.activateCallback?.(),this.Pu(),this.emit(A.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.qn():this.activityType===t&&!this[Ze]&&this.Ru();}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"]=[]);}));}Lu(){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);}Wn(){return !!this.activityType&&o.ai.has(this)}static{this.ai=new Map;}get isActivityActive(){return !!this[Ze]}get couldOpenActivity(){return true}registerActivity(t,e={}){let{onActivate:r,onDeactivate:s}=e;o.ai.set(this,{activateCallback:r,deactivateCallback:s});}Uu(){this.isActivityActive&&this.qn(),o.ai.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this.Wn()&&this.Uu();}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(n=>n.activityType===e)?.couldOpenActivity??false),e=r?e:null,this.$["*currentActivity"]=e??null,e&&this.modalManager?.open(e),this.$["*history"]=t,e||this.modalManager?.closeAll();}}};$.activities=D;var M=class o extends ${constructor(){super(...arguments);this.couldBeCtxOwner=false;this.sr=false;this.init$=Jo(this);this.Mo=F(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(A.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this.Vu(e);},300);this.Fu=(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(A.FILE_ADDED,this.api.getOutputItem(s.uid)),this.e.wait("pluginManager").then(n=>n.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 n=s?.getValue("thumbUrl");n&&URL.revokeObjectURL(n),this.emit(A.FILE_REMOVED,this.api.getOutputItem(s.uid));}this.$["*uploadList"]=t.map(s=>({uid:s})),this.Xn(),this.Mo();}};this.Nu=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(n=>t.fileInfo?.has(n)&&!!H.getCtx(n)?.store.fileInfo);s.length>0&&this.validationManager.runFileValidators("upload",s),this.validationManager.runFileValidators("change",r);}),t.uploadProgress){for(let s of t.uploadProgress){let n=H.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(A.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(s));}this.Xn();}if(t.isUploading)for(let s of t.isUploading){let n=H.getCtx(s);if(!n)continue;let{isUploading:a,silent:l}=n.store;a&&!l&&this.emit(A.FILE_UPLOAD_START,this.api.getOutputItem(s));}if(t.fileInfo){for(let s of t.fileInfo){let n=H.getCtx(s);if(!n)continue;let{fileInfo:a,silent:l}=n.store;a&&!l&&this.emit(A.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(s));}this.cfg.cropPreset&&this._u();}if(t.errors){this.validationManager.runCollectionValidators();for(let a of t.errors){let l=H.getCtx(a);if(!l)continue;let{errors:c}=l.store;c.length>0&&(this.emit(A.FILE_UPLOAD_FAILED,this.api.getOutputItem(a)),this.emit(A.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let s=e.findItems(a=>!!a.getValue("fileInfo")),n=e.findItems(a=>a.getValue("errors").length>0);e.size>0&&n.length===0&&e.size===s.length&&this.$["*collectionErrors"].length===0&&this.emit(A.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}t.cdnUrl&&([...t.cdnUrl].filter(n=>!!this.uploadCollection.read(n)?.getValue("cdnUrl")).forEach(n=>{this.emit(A.FILE_URL_CHANGED,this.api.getOutputItem(n));}),this.$["*groupInfo"]=null);};this.Xn=()=>{let t=0,r=[...this.$["*uploadTrigger"]].filter(n=>!!this.uploadCollection.read(n));r.forEach(n=>{let a=this.uploadCollection.readProp(n,"uploadProgress");typeof a=="number"&&(t+=a);});let s=r.length?Math.round(t/r.length):0;this.$["*commonProgress"]!==s&&(this.$["*commonProgress"]=s,this.emit(A.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}get $u(){return this.hasBlockInCtx(t=>t instanceof o?t.sr&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this.Y("*uploadCollection",()=>new Hr({initialValue:ba,watchList:["file","uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]})),this.Y("*secureUploadsManager",t=>new _r(t)),this.Y("*validationManager",t=>new Br(t)),this.Y("*publicApi",t=>new qr(t)),!this.$u&&this.couldBeCtxOwner&&this.Du();}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.sr&&this.Zn(),this.Mo.cancel();}connectedCallback(){super.connectedCallback(),this.sr&&this.Yn();}Du(){this.sr=true,this.Yn(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}Yn(){this.Zn(),this.Ao=this.uploadCollection.observeCollection(this.Fu),this.ko=this.uploadCollection.observeProperties(this.Nu);}Zn(){this.ko?.(),this.Ao?.(),this.ko=void 0,this.Ao=void 0;}async Vu(t){let e=await this.getUploadClientOptions(),r=t.allEntries.map(l=>l.uuid+(l.cdnUrlModifiers?`/${l.cdnUrlModifiers}`:"")),s=new AbortController,n=await jn(r,{...e,signal:s.signal});if(this.$["*collectionState"]!==t){s.abort();return}this.$["*groupInfo"]=n;let a=this.api.getOutputCollectionState();this.emit(A.GROUP_CREATED,a),this.emit(A.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.$["*collectionState"]=a;}_u(){let t=Zr(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 n=s.getValue("fileInfo");if(!n||!n.imageInfo){console.warn("Failed to get image info for entry",s.uid);continue}let{width:a,height:l}=n.imageInfo,c=typeof e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,u=Ia(a,l,c),d=ot(`crop/${u.width}x${u.height}/${u.x},${u.y}`,"preview"),h=s.getValue("cdnUrl");if(!h){console.warn("Failed to get cdnUrl for entry",s.uid);continue}s.setMultipleValues({cdnUrlModifiers:d,cdnUrl:Z(h,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:La,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 jr(this.e)}};M.extSrcList=Object.freeze({...mt});M.sourceTypes=Object.freeze({...P});var de=class extends C{constructor(){super(...arguments);this.name="";this.nr="";this.li=null;this.Qn=null;}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",e=>{this.Qn=e,this.Oo();});let t=this.e.pluginManager;t?.onPluginsChange&&(this.S=t.onPluginsChange(()=>this.Oo()));}willUpdate(t){super.willUpdate(t),t.has("name")&&this.Oo();}Oo(){if(!this.name){this.nr="",this.li=null;return}let e=this.e.pluginManager?.snapshot().icons.find(n=>n.name===this.name);if(e){this.li=e.svg,this.nr="";return}this.li=null;let r=`#uc-icon-${this.name}`,s=this.Qn?.(this.name);this.nr=s??r;}render(){return this.li?v`${this.yield("",v`${He(this.li)}`)}`:v` ${this.yield("",v`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this.nr}></use></svg>`)} `}disconnectedCallback(){this.S?.(),this.S=void 0,super.disconnectedCallback();}};p([y({type:String})],de.prototype,"name",2),p([f()],de.prototype,"nr",2),p([f()],de.prototype,"li",2);var Ra=o=>[...new Set(o)];var Me="--uc-img-",vs="unresolved";var ys=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),bs=3e3,ws=5e3,Es=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var od="https://ucarecdn.com",Ye=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:od},"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 Yr=class extends $e(De(Ct)){constructor(){super();this.Pt={};this.f=new Map;this.Lt=null;this.ar=null;for(let t in Ye){let e=Ye[t];this.Pt[Me+t]=e?.default||"";}}createRenderRoot(){return this}$$(t){return this.Pt[Me+t]}set$$(t){for(let e in t){let r=Me+e,s=t[e];this.Pt[r]=s,this.Z(r,s);}}sub$$(t,e){let r=Me+t;this.f.has(r)||this.f.set(r,new Set),this.f.get(r)?.add(e);let s=this.Pt[r];s!==null&&s!==""&&e(s);}Z(t,e){this.f.has(t)&&this.f.get(t)?.forEach(r=>{e===null||e===""||r(e);});}analyticsParams(){return `-/@clib/${Ut}/${Rt}/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.Lt=new IntersectionObserver(s=>{s.forEach(n=>{n.isIntersecting&&(e(),this.Lt?.unobserve(t));});},r),this.Lt.observe(t),this.ar||(this.ar=new Set),this.ar.add(t);}connectedCallback(){super.connectedCallback(),this.Bu();}Bu(){for(let t in Ye){let e=Me+t,r=this.getCssData(e,true);r!=null&&(this.Pt[e]=r);}}disconnectedCallback(){super.disconnectedCallback(),this.Lt&&(this.ar?.forEach(t=>{this.Lt?.unobserve(t);}),this.Lt=null),this.f.clear();}static get observedAttributes(){return Object.keys(Ye)}attributeChangedCallback(t,e,r){window.setTimeout(()=>{let s=Me+t;this.Pt[s]=r,this.Z(s,r);});}};var $a=o=>Object.entries(o).filter(([i,t])=>t!==void 0&&t!=="").map(([i,t])=>i==="cdn-operations"||i==="analytics"?t:`${i}/${t}`);var Jr=class extends Yr{constructor(){super(...arguments);this.Ee=new Image;this.me=new Image;}Jn(t){return !t.includes("//")&&!ys&&(t=new URL(t,document.baseURI).href),t}lr(t){if(!t)return;let e=t,r=e.match(/\d+/)?.[0],s=e.match(/[a-zA-Z]+/)?.[0];if(!r||!s)return;let n=parseInt(r,10);return Number(n)>ws&&this.ea?ws+s:Number(n)>bs&&!this.ea?bs+s:t}zu(t,e){let r={format:this.Io("format"),quality:this.Io("quality"),resize:this.lr(t),blur:e,"cdn-operations":this.Io("cdn-operations")??void 0,analytics:this.analyticsParams()};return ot(...$a(r))}Io(t){let e=this.$$(t);if(e==null||typeof e=="string"||typeof e=="number"||typeof e=="boolean")return e}ne(t="",e=""){let r=this.$$("src");if(r.startsWith("data:")||r.startsWith("blob:"))return r;if(ys&&r&&!r.includes("//"))return this.ci(r);let s=this.zu(t,e),n=this.$$("cdn-cname"),a=n;if(r.startsWith(String(n)))return Z(r,s);let l=this.$$("uuid");if(a&&l)return this.ci(Z(re(a,l),s));if(l)return this.ci(Z(re(a,l),s));let c=this.$$("proxy-cname");if(c)return this.ci(Z(c,s,this.Jn(r)));let u=this.$$("pubkey");if(u)return this.ci(Z(`https://${u}.ucr.io/`,s,this.Jn(r)))}ci(t){let e=this.$$("secure-delivery-proxy");return e?ze(e,{previewUrl:t},{transform:r=>window.encodeURIComponent(r)}):t}Rt(t,e=1,r=true){let s=t.getBoundingClientRect(),n=e*Math.round(s.width),a=r?"":e*Math.round(s.height);return n||a?`${n||""}x${a||""}`:null}Hu(t){let e=s=>{s.stopPropagation();let n=new Event(s.type,s);this.dispatchEvent(n);},r=["load","error"];for(let s of r)t.addEventListener(s,e);}get img(){return this.Te||(this.Po({elNode:this.Ee}),this.appendChild(this.Ee)),this.Ee}get cr(){return this.Te?{type:Es.PREVIEW,img:this.me}:{type:Es.MAIN,img:this.img}}get Te(){return this.$$("is-preview-blur")}get ta(){return this.$$("is-background-for")}get ia(){let t=this.$$("breakpoints");if(t){let e=Y(t);return Ra(e.map(r=>parseInt(r,10)))}else return null}get ea(){return this.$$("format").toLowerCase()==="jpeg"}ra(t){let e=new Set;e.add(`url("${this.ne(this.Rt(t))}") 1x`),this.$$("hi-res-support")&&e.add(`url("${this.ne(this.Rt(t,2))}") ${2}x`),this.$$("ultra-res-support")&&e.add(`url("${this.ne(this.Rt(t,3))}") ${3}x`);let r=`image-set(${[...e].join(", ")})`;t.style.setProperty("background-image",r),t.style.setProperty("background-image",`-webkit-${r}`);}oa(){let t=new Set;return this.ia?this.ia.forEach(e=>{t.add(`${this.ne(`${e}x`)} ${this.lr(`${e}w`)}`),this.$$("hi-res-support")&&t.add(`${this.ne(`${e*2}x`)} ${this.lr(`${e*2}w`)}`),this.$$("ultra-res-support")&&t.add(`${this.ne(`${e*3}x`)} ${this.lr(`${e*3}w`)}`);}):(t.add(`${this.ne(this.Rt(this.cr.img))} 1x`),this.$$("hi-res-support")&&t.add(`${this.ne(this.Rt(this.cr.img,2))} 2x`),this.$$("ultra-res-support")&&t.add(`${this.ne(this.Rt(this.cr.img,3))} 3x`)),[...t].join()}sa(){return this.ne()}get na(){return this.ne("100x","100")}Ku(){let t=this.ta;[...document.querySelectorAll(t)].forEach(e=>{this.$$("intersection")?this.initIntersection(e,()=>{this.ra(e);}):this.ra(e);});}ju({elNode:t,src:e,srcset:r}){e&&(t.src=e),r&&(t.srcset=r);}Po({elNode:t}){this.Hu(t),this.initAttributes(t);}Lo({src:t,srcset:e,elNode:r}){return new Promise((s,n)=>{this.Po({elNode:r}),r.setAttribute(vs,""),r.addEventListener("load",()=>{r.removeAttribute(vs),s(r);}),r.addEventListener("error",()=>{n(false);}),this.ju({elNode:r,src:t,srcset:e});})}async Gu(){if(this.$$("intersection")){this.Te&&(this.Po({elNode:this.me}),this.appendChild(this.me)),this.initIntersection(this.cr.img,async()=>{this.Te&&(this.me.src=this.na);try{await this.Lo({src:this.sa(),srcset:this.oa(),elNode:this.Ee}),this.Te&&await this.me.remove(),this.appendChild(this.Ee);}catch{this.Te&&await this.me?.remove(),this.appendChild(this.Ee);}});return}try{this.Te&&(await this.Lo({src:this.na,elNode:this.me}),this.appendChild(this.me)),await this.Lo({src:this.sa(),srcset:this.oa(),elNode:this.Ee}),this.Te&&await this.me?.remove(),this.appendChild(this.Ee);}catch{this.Te&&await this.me?.remove(),this.appendChild(this.Ee);}}init(){this.ta?this.Ku():this.Gu();}};var Ts=class extends Jr{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:sd}=gn,Da=o=>o;var Cs=(o,i)=>o?.Me!==void 0,Va=o=>o?.Me?.h!=null;var Na=o=>o.strings===void 0,Fa=()=>document.createComment(""),Xt=(o,i,t)=>{let e=o.we.parentNode,r=i===void 0?o.xt:i.we;if(t===void 0){let s=e.insertBefore(Fa(),r),n=e.insertBefore(Fa(),r);t=new sd(s,n,o,o.options);}else {let s=t.xt.nextSibling,n=t.m,a=n!==o;if(a){let l;t.qu?.(o),t.m=o,t._i!==void 0&&(l=o.X)!==n.X&&t._i(l);}if(s!==r||a){let l=t.we;for(;l!==s;){let c=Da(l).nextSibling;Da(e).insertBefore(l,r),l=c;}}}return t},pe=(o,i,t=o)=>(o.pe(i,t),o),nd={},Ai=(o,i=nd)=>o.r=i,ki=o=>o.r,to=o=>{o.Et(),o.we.remove();},_a=o=>{o.Et();};var Mi=(o,i)=>{let t=o.de;if(t===void 0)return false;for(let e of t)e.pn?.(i,false),Mi(e,i);return true},eo=o=>{let i,t;do{if((i=o.m)===void 0)break;t=i.de,t.delete(o),o=i;}while(t?.size===0)},Ba=o=>{for(let i;i=o.m;o=i){let t=i.de;if(t===void 0)i.de=t=new Set;else if(t.has(o))break;t.add(o),cd(i);}};function ad(o){this.de!==void 0?(eo(this),this.m=o,Ba(this)):this.m=o;}function ld(o,i=false,t=0){let e=this.r,r=this.de;if(r!==void 0&&r.size!==0)if(i)if(Array.isArray(e))for(let s=t;s<e.length;s++)Mi(e[s],false),eo(e[s]);else e!=null&&(Mi(e,false),eo(e));else Mi(this,o);}var cd=o=>{o.type==$t.CHILD&&(o._i??=ld,o.qu??=ad);},io=class extends ht{constructor(){super(...arguments),this.de=void 0;}oo(i,t,e){super.oo(i,t,e),Ba(this),this.isConnected=i.X;}pn(i,t=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),t&&(Mi(this,i),eo(this));}setValue(i){if(Na(this.ir))this.ir.pe(i,this);else {let t=[...this.ir.r];t[this.Su]=i,this.ir.pe(t,this,0);}}disconnected(){}reconnected(){}};var I=()=>new Ss,Ss=class{},xs=new WeakMap,O=at(class extends io{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=xs.get(i);t===void 0&&(t=new WeakMap,xs.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"?xs.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 As=null,Ii=class extends C{constructor(){super(...arguments);this.dialogEl=I();this.strokes=false;this.blockBodyScrolling=false;this.closeDialog=()=>{this.modalManager?.close(this.id),this.modalManager?.hasActiveModals||(document.body.style.overflow="",this.$["*currentActivity"]=null);};this.Wu=()=>{this.closeDialog();};this.Zu=t=>{this.Ro=t.target;};this.Yu=t=>{let e=t.target;e===this.dialogEl.value&&e===this.Ro&&this.closeDialog();};this.ui=({id:t})=>{t===this.id?(As=t,this.show(),this.emit(A.MODAL_OPEN,{modalId:t},{debounce:true})):this.hide();};this.di=({id:t})=>{t===this.id&&(this.hide(),this.emit(A.MODAL_CLOSE,{modalId:t,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true}));};this.aa=t=>{this.hide(),As===this.id&&this.emit(A.MODAL_CLOSE,{modalId:As,hasActiveModals:this.modalManager?.hasActiveModals},{debounce:true});};}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.ui),this.modalManager?.subscribe(X.CLOSE,this.di),this.modalManager?.subscribe(X.CLOSE_ALL,this.aa);}disconnectedCallback(){super.disconnectedCallback(),document.body.style.overflow="",this.Ro=void 0,this.modalManager?.unsubscribe(X.OPEN,this.ui),this.modalManager?.unsubscribe(X.CLOSE,this.di),this.modalManager?.unsubscribe(X.CLOSE_ALL,this.aa);}Xu(t){this.dialogEl={value:t},this.dialogEl.value?.addEventListener("close",this.Wu),this.dialogEl.value?.addEventListener("mousedown",this.Zu),this.dialogEl.value?.addEventListener("mouseup",this.Yu);}render(){return v`<dialog ${O(this.Xu)}>${this.yield("")}</dialog>`}};p([y({type:Boolean,noAccessor:true})],Ii.prototype,"strokes",2),p([y({type:Boolean,attribute:"block-body-scrolling",noAccessor:true})],Ii.prototype,"blockBodyScrolling",2);var ro=class extends M{constructor(){super(...arguments);this.K=null;this.ur=null;}get la(){return this.nameAttrValue??this.ctxName}ca(){let t=document.createElement("input");return t.type="text",t.name=this.la,t.required=this.cfg.multipleMin>0,t.tabIndex=-1,Kr(t,{opacity:0,height:0,width:0}),t}initCallback(){super.initCallback(),this.K=this.ca(),this.appendChild(this.K),this.sub("*collectionState",t=>{if(!t)return;if(!this.ur){let n=document.createElement("div");this.appendChild(n),this.ur=n;}if(!this.K){let n=this.ca();this.appendChild(n),this.K=n;}if(this.ur.innerHTML="",t.status==="uploading"||t.status==="idle"){this.K.value="",this.K.setCustomValidity("");return}if(t.status==="failed"){let n=t.errors[0]?.message;this.K.value="",this.K.setCustomValidity(n??"");return}let e=t.group?t.group:null;if(e){this.K.value=e.cdnUrl??"",this.K.setCustomValidity("");return}let r=t.allEntries.map(n=>n.cdnUrl).filter(n=>typeof n=="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 n of r){let a=document.createElement("input");a.type="hidden",a.name=`${this.la}[]`,a.value=n,s.appendChild(a);}this.ur.replaceChildren(s);},false);}};p([y({type:String,noAccessor:true,attribute:"name"})],ro.prototype,"nameAttrValue",2);var ks=class extends C{initCallback(){super.initCallback(),this.subConfigValue("removeCopyright",i=>{this.toggleAttribute("hidden",!!i);});}render(){return v`<a href="https://uploadcare.com/?utm_source=copyright&amp;utm_medium=referral&amp;utm_campaign=v4" target="_blank noopener" class="uc-credits" >Powered by Uploadcare</a >`}};var Xe=class extends C{constructor(){super(...arguments);this.hasFileName=false;this.value=0;this.visible=true;this.ae=0;this.dr=I();this.ua=()=>{let t=this.dr.value;if(t){if(!this.visible){t.classList.add("uc-fake-progress--hidden");return}this.ae>0&&t.classList.add("uc-fake-progress--hidden");}};}firstUpdated(t){super.firstUpdated(t),this.ae=this.Uo(this.value),this.$o(),this.dr.value?.addEventListener("animationiteration",this.ua);}updated(t){if(super.updated(t),t.has("value")){let e=this.Uo(this.value);if(!this.visible)this.ae=e;else {let r=Math.max(this.ae,e);r!==this.ae&&(this.ae=r,this.$o());}}t.has("visible")&&(this.classList.toggle("uc-progress-bar--hidden",!this.visible),this.visible?this.$o():this.ae=this.Uo(this.value));}disconnectedCallback(){super.disconnectedCallback(),this.dr.value?.removeEventListener("animationiteration",this.ua);}Uo(t){return Number.isFinite(t)?Math.min(100,Math.max(0,t)):0}$o(){this.visible&&this.style.setProperty("--l-progress-value",this.ae.toString());}render(){return v`<div ${O(this.dr)} class="uc-fake-progress"></div><div class="uc-progress"></div>`}};p([y({type:Boolean,noAccessor:true})],Xe.prototype,"hasFileName",2),p([y({type:Number})],Xe.prototype,"value",2),p([y({type:Boolean,reflect:true})],Xe.prototype,"visible",2);var Oi=class extends M{constructor(){super();this.ge=false;this.Ut=0;this.init$={...this.init$,"*commonProgress":0};}initCallback(){super.initCallback(),this.Do=this.uploadCollection.observeProperties(()=>{let t=this.uploadCollection.items().some(e=>this.uploadCollection.read(e)?.getValue("isUploading")??false);this.ge=t;}),this.sub("*commonProgress",t=>{this.Ut=t;});}updated(t){super.updated(t),t.has("visible")&&(this.ge?this.setAttribute("active",""):this.removeAttribute("active"));}disconnectedCallback(){super.disconnectedCallback(),this.Do?.(),this.Do=void 0;}render(){return v`<uc-progress-bar .value=${this.Ut} .visible=${this.ge}></uc-progress-bar>`}};p([f()],Oi.prototype,"ge",2),p([f()],Oi.prototype,"Ut",2);var Qe=class extends C{constructor(){super(...arguments);this.value="";this.disabled=false;this.options=[];this.Qu=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")));};}render(){return v`<select @change=${this.Qu} .value=${this.value} ?disabled=${this.disabled}>${this.options.map(t=>v`<option value=${t.value}>${t.text}</option>`)}</select>`}};p([y({type:String,attribute:false})],Qe.prototype,"value",2),p([y({type:Boolean,reflect:true})],Qe.prototype,"disabled",2),p([y({type:Array,attribute:false})],Qe.prototype,"options",2);var he=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.textOnly=false;this.iconOnly=false;this.Fo="default";this.pr="";}willUpdate(t){super.willUpdate(t),t.has("source")&&this.Ju(this.source);}Ju(t){if(!t){this.pr="",this.Fo="default";return}let{label:e,icon:r,id:s}=t;this.pr=e,this.Fo=r??s??"default";}activate(){this.source&&(this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{sourceId:this.source.id}}),this.source.onClick());}render(){return v`<button aria-label=${this.l10n(this.pr)} type="button" @click=${this.activate}>${this.textOnly?"":v`<uc-icon name=${this.Fo}></uc-icon>`} ${this.iconOnly?"":v`<div class="uc-txt">${this.l10n(this.pr)}</div>`}</button>`}};p([y({attribute:false})],he.prototype,"source",2),p([y({type:Boolean})],he.prototype,"textOnly",2),p([y({type:Boolean})],he.prototype,"iconOnly",2),p([f()],he.prototype,"Fo",2),p([f()],he.prototype,"pr",2);var Je=class{constructor(i,t){this.da=[];this.i=t.ctx,this.e=t.sharedInstancesBag,this.pa=t.onSourcesChange,i.addController(this);}hostConnected(){this.No=this.i.sub(x("sourceList"),t=>{this.da=Y(t),this.Vo();});let i=this.e.pluginManager;i?.onPluginsChange&&(this.S=i.onPluginsChange(()=>this.Vo())),this.Vo();}hostDisconnected(){this.S?.(),this.S=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.da.forEach(s=>{let n=this.ed(s,e);if(n.length!==1||n[0]!==s){for(let c of n){let u=e.get(c);u&&r.push(this.ha(u));}return}let l=e.get(s);l&&r.push(this.ha(l));}),this.pa(r);}ed(i,t){let e=t.get(i);return e?.expand?e.expand():[i]}ha(i){return {id:i.id,label:i.label,icon:i.icon,onClick:()=>i.onSelect()}}};var Li=class extends M{constructor(){super(...arguments);this.b=[];this.wrap=false;}initCallback(){super.initCallback(),new Je(this,{ctx:this.e.ctx,sharedInstancesBag:this.e,onSourcesChange:t=>{this.b=t;}});}updated(t){super.updated(t),this.cfg.sourceListWrap?this.style.removeProperty("display"):this.style.display="contents";}render(){return v`${this.b.map(t=>v`<uc-source-btn role="listitem" .source=${t} data-source-id=${t.id}></uc-source-btn>`)}`}};p([f()],Li.prototype,"b",2),p([y({type:Boolean,attribute:"wrap",noAccessor:true})],Li.prototype,"wrap",2);var Ms=class extends C{render(){return v`<div class="uc-spinner"></div>`}};var Ot="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function Ie(o){let i=new Image;return {promise:new Promise((r,s)=>{i.src=o,i.onload=()=>r(),i.onerror=n=>s(n);}),image:i,cancel:()=>{i.naturalWidth===0&&(i.src=Ot);}}}function Pi(o){let i=[];for(let s of o){let n=Ie(s);i.push(n);}let t=i.map(s=>s.image);return {promise:Promise.allSettled(i.map(s=>s.promise)),images:t,cancel:()=>{i.forEach(s=>{s.cancel();});}}}function Is(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((n,a)=>{r.onload=()=>{let l=r.height/r.width;l>1?(t.width=i,t.height=i*l):(t.height=i,t.width=i/l),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(c=>{if(!c){a();return}let u=URL.createObjectURL(c);n(u);});},r.onerror=l=>{a(l);};});return r.src=URL.createObjectURL(o),s}var ti=class extends M{constructor(){super(...arguments);this.hr=new Set;this.entry=null;}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,n)=>{let a=r.subscribe(s,l=>{this.isConnected&&n(l);});this.hr.add(a);})(t,e);}reset(){for(let t of this.hr)t();this.hr=new Set,this.entry=null;}disconnectedCallback(){super.disconnectedCallback(),this.hr=new Set;}};function ud(o){let i=new Blob([o],{type:"image/svg+xml"});return URL.createObjectURL(i)}function oo(o="hsl(209, 21%, 65%)",i=32,t=32){return ud(`<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>`)}var dd=3e3,ei=class extends ti{constructor(){super(...arguments);this.badgeIcon="";this.uid="";this.Ue="";this.fa=false;this.fr=null;this.ma=false;this.td=this.cfg.filesViewMode;this.ga=this.withEntry(async(t,e=false)=>{let r=t.getValue("fileInfo"),s=t.getValue("isImage"),n=t.getValue("uuid"),a=t.getValue("thumbUrl"),l=this.rd(e);if(r&&s&&n){let u=await this.proxyUrl(Z(re(this.cfg.cdnCname,n),ot(t.getValue("cdnUrlModifiers"),"stretch/off",`scale_crop/${l}x${l}/center`)));if(a===u)return;let{promise:d}=Ie(u);d.then(()=>{t.setValue("thumbUrl",u),a?.startsWith("blob:")&&URL.revokeObjectURL(a);}).catch(async()=>{if(!a?.startsWith("blob:"))try{let h=t.getValue("file");if(!h)return;let m=await Is(h,l);t.setValue("thumbUrl",m);}catch(h){this.telemetryManager.sendEventError(h,"thumbnail generation. Failed to generate thumb from file");let m=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",oo(m));}});return}if(t.getValue("thumbUrl"))return;let c=t.getValue("file");if(c?.type.includes("image"))try{let u=await Is(c,l);t.setValue("thumbUrl",u);}catch(u){this.telemetryManager.sendEventError(u,"thumbnail generation. Failed to generate thumb from file");let d=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",oo(d));}else {let u=window.getComputedStyle(this).getPropertyValue("--uc-muted-foreground");t.setValue("thumbUrl",oo(u));}});this.mr=F(this.ga.bind(this),100);}rd(t=false){t&&(this.fr=this.getBoundingClientRect());let e=Math.max(parseInt(String(this?.fr?.height||0),10),parseInt(String(this?.fr?.width||0),10),this.cfg.thumbSize);return window.devicePixelRatio>1&&(e*=window.devicePixelRatio),Math.min(Math.round(e),dd)}od(t,e){return new Promise((r,s)=>{let n=new Image;n.decoding="async";let a=()=>{n&&(n.onload=null,n.onerror=null,n.src=Ot,e?.removeEventListener("abort",l),n=null);},l=()=>{a(),s(new DOMException("Aborted","AbortError"));};if(e){if(e.aborted){l();return}e.addEventListener("abort",l,{once:true});}let c=()=>{a(),r();},u=d=>{a(),s(d);};if(typeof n.decode=="function"){n.src=t,n.decode().then(c).catch(u);return}n.onload=c,n.onerror=u,n.src=t;})}Bo(){this._o?.cancel(),this._o=void 0;}sd(t){if(this.Bo(),!t){this.Ue&&(this.Ue="");return}if(t===this.Ue)return;let e=new AbortController,r={controller:e,cancel:()=>{e.abort(),r.rafId!==void 0&&window.cancelAnimationFrame(r.rafId);}};this._o=r,this.od(t,e.signal).then(()=>{e.signal.aborted||(r.rafId=window.requestAnimationFrame(()=>{e.signal.aborted||(this.Ue=t);}));}).catch(s=>{e.signal.aborted||s instanceof DOMException&&s.name==="AbortError"||console.warn("[Thumb] Failed to decode thumbnail image",s);});}gr(t=false){if(this.entry){if(t){this.ga(true);return}this.ma&&this.mr();}}firstUpdated(t){super.firstUpdated(t),this.va();}updated(t){super.updated(t),t.has("uid")&&this.va();}pi(t){let[e]=t;e&&(this.ma=e.isIntersecting,e.isIntersecting&&(this.fr=e.boundingClientRect,this.gr(),this.s?.disconnect()),e.intersectionRatio===0&&this.mr.cancel());}reset(){super.reset(),this.mr.cancel(),this.Bo(),this.Ue&&(this.Ue="");}va(){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=()=>{this.gr();};this.subEntry("fileInfo",s=>{s?.isImage&&r();}),this.subEntry("thumbUrl",s=>{this.sd(s??void 0);}),this.subEntry("cdnUrlModifiers",r),this.gr(true);}initCallback(){super.initCallback(),this.subConfigValue("filesViewMode",t=>{t==="grid"&&!this.fa&&(this.td==="list"&&this.gr(true),this.fa=true);});}connectedCallback(){super.connectedCallback(),this.s?.disconnect(),this.s=new window.IntersectionObserver(this.pi.bind(this),{threshold:.1}),this.s.observe(this);}disconnectedCallback(){super.disconnectedCallback(),this.mr.cancel(),this.Bo(),this.s?.disconnect();}render(){return v`<div class="uc-thumb"><img class="uc-thumb__img" src=${this.Ue||Ot} role="img" alt="Preview of uploaded image" ?hidden=${!this.Ue} draggable="false" /><div class="uc-badge"><uc-icon name=${this.badgeIcon}></uc-icon></div></div>`}};p([y({type:String})],ei.prototype,"badgeIcon",2),p([y({attribute:false})],ei.prototype,"uid",2),p([f()],ei.prototype,"Ue",2);var Os=class extends ${};var Ls=class extends ${constructor(){super(...arguments);this.historyTracked=true;this.activityType=$.activities.START_FROM;}initCallback(){super.initCallback(),this.registerActivity(this.activityType??"");}render(){return v`<div class="uc-content">${this.yield("")}</div>`}};var Ps=class extends M{constructor(){super(...arguments);this.ya=null;}static{this.styleAttrs=["uc-wgt-common"];}static{this.EventType=A;}initCallback(){super.initCallback(),this.ya=this.eventEmitter.bindTarget(this);}disconnectedCallback(){super.disconnectedCallback(),this.ya?.();}};var me=(o,i)=>{let t=false,e,r=0,s=((...n)=>{t?(e&&clearTimeout(e),e=setTimeout(()=>{Date.now()-r>=i&&(o(...n),r=Date.now());},Math.max(i-(Date.now()-r),0))):(o(...n),r=Date.now(),t=true);});return Object.defineProperty(s,"cancel",{configurable:false,writable:false,enumerable:false,value:()=>{e&&clearTimeout(e);}}),s};var za=(o,i,t)=>{let e=new Map;for(let r=i;r<=t;r++)e.set(o[r],r);return e},Ui=at(class extends ht{constructor(o){if(super(o),o.type!==$t.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=[],n=0;for(let a of o)r[n]=e?e(a,n):n,s[n]=t(a,n),n++;return {values:s,keys:r}}render(o,i,t){return this.dt(o,i,t).values}update(o,[i,t,e]){let r=ki(o),{values:s,keys:n}=this.dt(i,t,e);if(!Array.isArray(r))return this.ut=n,s;let a=this.ut??=[],l=[],c,u,d=0,h=r.length-1,m=0,g=s.length-1;for(;d<=h&&m<=g;)if(r[d]===null)d++;else if(r[h]===null)h--;else if(a[d]===n[m])l[m]=pe(r[d],s[m]),d++,m++;else if(a[h]===n[g])l[g]=pe(r[h],s[g]),h--,g--;else if(a[d]===n[g])l[g]=pe(r[d],s[g]),Xt(o,l[g+1],r[d]),d++,g--;else if(a[h]===n[m])l[m]=pe(r[h],s[m]),Xt(o,r[d],r[h]),h--,m++;else if(c===void 0&&(c=za(n,m,g),u=za(a,d,h)),c.has(a[d]))if(c.has(a[h])){let b=u.get(n[m]),w=b!==void 0?r[b]:null;if(w===null){let T=Xt(o,r[d]);pe(T,s[m]),l[m]=T;}else l[m]=pe(w,s[m]),Xt(o,r[d],w),r[b]=null;m++;}else to(r[h]),h--;else to(r[d]),d++;for(;m<=g;){let b=Xt(o,l[g+1]);pe(b,s[m]),l[m++]=b;}for(;d<=h;){let b=r[d++];b!==null&&to(b);}return this.ut=n,Ai(o,l),it}});var Ha="important",pd=" !"+Ha,Qt=at(class extends ht{constructor(o){if(super(o),o.type!==$t.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(pd);e.includes("-")||s?t.setProperty(e,s?r.slice(0,-11):r,s?Ha:""):t[e]=r;}}return it}});var lt=at(class extends ht{constructor(o){if(super(o),o.type!==$t.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 it}});var hd="file-item-remove-button",Jt=class extends M{constructor(){super(...arguments);this.uploading=false;this.failed=false;this.success=false;this.idle=false;this.hideRemove=false;this.progress=0;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-action-button"];}get nd(){return Math.min(Math.max(this.progress||0,0),100)}ad(){this.dispatchEvent(new CustomEvent("uc:remove",{bubbles:true,composed:true}));}render(){let t=lt({"uc-remove-btn":true,"uc-mini-btn":true,"uc-idle":this.idle,"uc-uploading":this.uploading,"uc-hide-remove":this.hideRemove,"uc-failed":this.failed,"uc-success":this.success}),e=100-this.nd,r=this.l10n(hd);return v`<button type="button" @click=${this.ad} title=${r} aria-label=${r} class=${t} ><span class="uc-icon-wrap"><uc-icon name="close"></uc-icon><uc-icon name="remove-file"></uc-icon></span><uc-icon name="preloader" class="uc-preloader" style=${Qt({"--l-progress-offset":String(e)})} ></uc-icon></button>`}};p([y({type:Boolean})],Jt.prototype,"uploading",2),p([y({type:Boolean})],Jt.prototype,"failed",2),p([y({type:Boolean})],Jt.prototype,"success",2),p([y({type:Boolean})],Jt.prototype,"idle",2),p([y({type:Boolean})],Jt.prototype,"hideRemove",2),p([y({type:Number})],Jt.prototype,"progress",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")}),j=class j extends ti{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.ba=true;this.uid="";this.zo="";this.Ho="";this.Ko="";this.ae=0;this.ld=false;this.jo="";this.Go=false;this.qo=false;this.Wo=false;this.wa=false;this.xa=false;this.Zo=false;this.Ea="";this.vr=[];this.Ta=false;this.Yo=()=>{this.telemetryManager.sendEvent({payload:{metadata:{event:"remove-file",node:this.tagName}}}),this.uid&&this.uploadCollection.hasItem(this.uid)&&(this.entry?.getValue("abortController")?.abort(),this.uploadCollection.remove(this.uid));};this.Uh=()=>{this.Ca();};this._=F(()=>this.Sa(),100);this.ud=this.withEntry(me((t,e)=>{let r=t.getValue("errors")?.[0]?.message??"",s=t.getValue("source"),n=t.getValue("externalUrl"),a=e===q.FINISHED,l=e===q.UPLOADING,c=e===q.QUEUED_UPLOADING,u=e===q.QUEUED_VALIDATION,d=e===q.VALIDATION,h=t.getValue("fileName"),m="";r?m="":!a&&n&&s&&Object.values(mt).includes(s)&&(m=this.l10n("waiting-for",{source:this.l10n(`src-type-${fa(s)}`)})),this.Ko=m,this.Ho=r,this.ld=l||c||u||d,this.ae=u||d?0:t.getValue("uploadProgress"),this.Ea=h?this.l10n("a11y-file-item-status",{fileName:h,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._();try{let r=new AbortController;t.setValue("abortController",r);let s=async()=>{t.setValue("isQueuedForUploading",!1);let a=t.getValue("file");if(a instanceof File||a instanceof Blob){let h=(this.e.pluginManager?.snapshot().fileHooks??[]).filter(m=>m.type==="beforeUpload");for(let m of h)try{let g=m.handler({file:a,signal:r.signal}),b=new Promise((T,E)=>setTimeout(()=>E(new Error("beforeUpload hook timed out")),m.timeout)),{file:w}=await Promise.race([g,b]);w!==a&&(a=w,t.setValue("mimeType",a.type||null),t.setValue("isImage",Be(a)),t.setValue("fileSize",a.size),a instanceof File&&t.setValue("fileName",a.name));}catch(g){console.warn(`File hook "beforeUpload" from plugin "${m.pluginId}" failed`,g);}}let l=a||t.getValue("externalUrl")||t.getValue("uuid");if(!l)throw new Error("No file input");let u={...await this.getUploadClientOptions(),fileName:t.getValue("fileName")??void 0,source:t.getValue("source")??void 0,onProgress:d=>{if(d.isComputable){let h=d.value*100;t.setValue("uploadProgress",h);}},signal:r.signal,metadata:await this.getMetadataFor(t.uid)};return this.debugPrint("upload options",l,u),Yo(l,u)},n=await this.$["*uploadQueue"].add(s);t.setMultipleValues({fileInfo:n,isQueuedForUploading:!1,isUploading:!1,fileName:n.originalFilename,fileSize:n.size,isImage:n.isImage??!1,mimeType:n.contentInfo?.mime?.mime??n.mimeType,uuid:n.uuid,cdnUrl:t.getValue("cdnUrl")??n.cdnUrl,cdnUrlModifiers:t.getValue("cdnUrlModifiers")??"",uploadProgress:100,source:t.getValue("source")??null}),t===this.entry&&this._();}catch(r){let s=r instanceof se&&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._(),this.isConnected&&!s&&this.telemetryManager.sendEventError(r,"file upload. Failed to upload file");}}});}Sa(){let t=this.entry;if(!t)return;let e=q.IDLE;t.getValue("errors").length>0?e=q.FAILED:t.getValue("isQueuedForUploading")?e=q.QUEUED_UPLOADING:t.getValue("isQueuedForValidation")?e=q.QUEUED_VALIDATION:t.getValue("isValidationPending")?e=q.VALIDATION:t.getValue("isUploading")?e=q.UPLOADING:t.getValue("fileInfo")&&(e=q.FINISHED),this.cd(t,e);}cd(t,e){e===q.FAILED?this.jo="badge-error":e===q.FINISHED&&(this.jo="badge-success"),e===q.UPLOADING&&(this.xa=false,this.removeAttribute("focused")),this.qo=e===q.FAILED,this.Wo=e===q.UPLOADING,this.wa=e===q.QUEUED_UPLOADING||e===q.UPLOADING,this.Go=e===q.FINISHED,this.ud(e);}reset(){super.reset(),this._.cancel();}pi(t){let[e]=t;e&&e.isIntersecting&&!this.Ta&&(this.ba=false,this.Ta=true);}Aa(t){this.reset();let e=this.uploadCollection?.read(t);if(this.entry=e,!e){this.Xe();return}this.subEntry("isQueuedForValidation",()=>{this._();}),this.subEntry("isValidationPending",()=>{this._();}),this.subEntry("uploadProgress",()=>{this._();}),this.subEntry("isQueuedForUploading",()=>{this._();}),this.subEntry("fileName",r=>{this.zo=r||e.getValue("externalUrl")||this.l10n("file-no-name"),this._();}),this.subEntry("externalUrl",r=>{this.zo=e.getValue("fileName")||r||this.l10n("file-no-name");}),this.subEntry("fileInfo",()=>{this._();}),this.subEntry("errors",()=>this._()),this.subEntry("isUploading",()=>this._()),this.subEntry("fileSize",()=>this._()),this.subEntry("mimeType",()=>this._()),this.subEntry("isImage",()=>this._()),this.subEntry("fileInfo",()=>this.Xe()),this.subEntry("isUploading",()=>this.Xe()),this.subEntry("errors",()=>this.Xe()),this.Sa(),this.Xe();}ka(t){if(this.cfg.filesViewMode==="list"){this.Zo=true;return}this.Zo=t;}willUpdate(t){super.willUpdate(t),t.has("uid")&&this.Aa(this.uid);}Xe(){let t=this.e.pluginManager;if(!t||!this.uid){this.vr=[];return}let e=t.snapshot().fileActions,r=this.api.getOutputItem(this.uid);if(!r){this.vr=[];return}this.vr=e.filter(s=>{try{return s.shouldRender(r)}catch(n){return console.error(`Error in plugin file action shouldRender (${s.id}):`,n),false}});}dd(t){if(!this.uid)return;let e=this.api.getOutputItem(this.uid);if(e){this.telemetryManager.sendEvent({payload:{metadata:{event:t.id,node:this.tagName,pluginId:t.pluginId}}});try{t.onClick(e);}catch(r){console.error(`Error in plugin file action onClick (${t.id}):`,r);}}}initCallback(){super.initCallback(),this.Aa(this.uid),this.subConfigValue("filesViewMode",e=>{this.ka(this.cfg.gridShowFileNames),this.setAttribute("mode",e);}),this.subConfigValue("gridShowFileNames",e=>{this.ka(e);}),this.onclick=()=>{j.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.S=t.onPluginsChange(()=>this.Xe())),this.Xe(),j.activeInstances.add(this);}connectedCallback(){super.connectedCallback(),this.s=new window.IntersectionObserver(this.pi.bind(this),{threshold:[0,1]}),this.s.observe(this);}disconnectedCallback(){this.S?.(),this.S=void 0,super.disconnectedCallback(),this.s?.disconnect(),j.activeInstances.delete(this),this.reset();}static{this.activeInstances=new Set;}shouldUpdate(t){return this.ba?false:super.shouldUpdate(t)}render(){return v`<div class="uc-inner" ?data-finished=${this.Go} ?data-uploading=${this.Wo} ?data-failed=${this.qo} ?data-focused=${this.xa} ><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.Ea}><span class="uc-file-name" ?hidden=${!this.Zo}>${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.vr.map(t=>v`<button type="button" @click=${()=>this.dd(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.Yo} .uploading=${this.Wo} .hideRemove=${this.wa} .progress=${this.ae} .failed=${this.qo} .success=${this.Go} ></uc-file-action-button></div></div>`}};p([f()],j.prototype,"ba",2),p([y({attribute:false})],j.prototype,"uid",2),p([f()],j.prototype,"zo",2),p([f()],j.prototype,"Ho",2),p([f()],j.prototype,"Ko",2),p([f()],j.prototype,"ae",2),p([f()],j.prototype,"ld",2),p([f()],j.prototype,"jo",2),p([f()],j.prototype,"Go",2),p([f()],j.prototype,"qo",2),p([f()],j.prototype,"Wo",2),p([f()],j.prototype,"wa",2),p([f()],j.prototype,"xa",2),p([f()],j.prototype,"Zo",2),p([f()],j.prototype,"Ea",2),p([f()],j.prototype,"vr",2);var Us=j;function md(o){return new Promise(i=>{typeof window.FileReader!="function"&&i(false);try{let t=new FileReader;t.onerror=()=>{i(!0);};let e=r=>{r.type!=="loadend"&&t.abort(),i(!1);};t.onloadend=e,t.onprogress=e,t.readAsDataURL(o);}catch{i(false);}})}function fd(o,i){return new Promise(t=>{let e=0,r=[],s=a=>{if(!a){console.warn("Unexpectedly received empty content entry",{scope:"drag-and-drop"}),t(null);return}a.isFile?(e++,a.file(l=>{e--;let c=new File([l],l.name,{type:l.type||i});r.push({type:"file",file:c,fullPath:a.fullPath}),e===0&&t(r);})):a.isDirectory&&n(a.createReader());},n=a=>{e++,a.readEntries(l=>{e--;for(let c of l)s(c);e===0&&t(r);});};s(o);})}function Ka(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,n=r;if(typeof n.webkitGetAsEntry=="function"||typeof n.getAsEntry=="function"){let l=typeof n.webkitGetAsEntry=="function"?n.webkitGetAsEntry():n.getAsEntry?.();l&&t.push(fd(l,s).then(c=>{c&&i.push(...c);}));continue}let a=r.getAsFile();a&&t.push(md(a).then(l=>{l||i.push({type:"file",file:a});}));}else r.kind==="string"&&/^text\/uri-list/.test(r.type)&&t.push(new Promise(s=>{r.getAsString(n=>{i.push({type:"url",url:n}),s();});}));}return Promise.all(t).then(()=>i)}var ct=Object.freeze({ACTIVE:0,INACTIVE:1,NEAR:2,OVER:3}),ja=["focus"],gd=100,Rs=new Map;function vd(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))}function $s(o){let i=0,t=document.body,e=new Set,r=g=>{e.add(g);},s=ct.INACTIVE,n=g=>{o.shouldIgnore()&&g!==ct.INACTIVE||(s!==g&&e.forEach(b=>{b(g);}),s=g);},a=()=>i>0;r(g=>o.onChange(g));let l=()=>{i=0,n(ct.INACTIVE);},c=()=>{i+=1,s===ct.INACTIVE&&n(ct.ACTIVE);},u=()=>{i-=1,a()||n(ct.INACTIVE);},d=g=>{g.preventDefault(),i=0,n(ct.INACTIVE);},h=g=>{if(o.shouldIgnore())return;a()||(i+=1);let b=[g.x,g.y],w=o.element.getBoundingClientRect(),T=Math.floor(vd(b,w)),E=T<gd,S=g.composedPath().includes(o.element);Rs.set(o.element,T);let Tt=Math.min(...Rs.values())===T;S&&Tt?(g.preventDefault(),n(ct.OVER)):n(E&&Tt?ct.NEAR:ct.ACTIVE);},m=async g=>{if(o.shouldIgnore())return;g.preventDefault();let{dataTransfer:b}=g;if(!b)return;let w=await Ka(b);o.onItems(w),n(ct.INACTIVE);};return t.addEventListener("drop",d),t.addEventListener("dragleave",u),t.addEventListener("dragenter",c),t.addEventListener("dragover",h),o.element.addEventListener("drop",m),ja.forEach(g=>{window.addEventListener(g,l);}),()=>{Rs.delete(o.element),t.removeEventListener("drop",d),t.removeEventListener("dragleave",u),t.removeEventListener("dragenter",c),t.removeEventListener("dragover",h),o.element.removeEventListener("drop",m),ja.forEach(g=>{window.removeEventListener(g,l);});}}var Ds=new Set,bt=class extends M{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.Pe=true;this.Ma=true;this.Xo="drop-files-here";this.$t=false;this.Ia=null;this.Qo=null;this.Pa=I();this.Dt=t=>{if(t instanceof KeyboardEvent){if(t.code!=="Space"&&t.code!=="Enter")return}else if(!(t instanceof MouseEvent))return;if(this.initflow){this.api.initFlow();return}this.api.openSystemDialog();};this.La=true;this.Ft=false;}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-area"];}Oa(){let t=this.text;if(typeof t=="string"&&t.length>0){this.Xo=t;return}this.Xo=this.$t?"drop-files-here":"drop-file-here";}isActive(){if(!this.Pe)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),n=s.visibility!=="hidden"&&s.display!=="none";return e&&n&&r}initCallback(){super.initCallback(),Ds.add(this),this.Jo(),this.es(),this.Ra(),this.Ua(ct.INACTIVE),this.Ia=$s({element:this,shouldIgnore:()=>this.$a(),onChange:t=>{this.Ua(t);},onItems:t=>{if(!t.length)return;let e=this.uploadCollection.size;t.forEach(r=>{r.type==="url"?this.api.addFileFromUrl(r.url,{source:P.DROP_AREA}):r.type==="file"&&this.api.addFileFromObject(r.file,{source:P.DROP_AREA,fullPath:r.fullPath});}),this.uploadCollection.size>e&&this.routerLayer.navigateAfterFileAdd();}}),this.updateComplete.then(()=>this.pd()),this.subConfigValue("sourceList",t=>{let e=Y(t);this.La=e.includes(P.LOCAL),this.Jo(),this.es();}),this.subConfigValue("multiple",t=>{this.$t=!!t,this.Oa();});}willUpdate(t){super.willUpdate(t),t.has("disabled")&&(this.Jo(),this.es()),(t.has("text")||t.has("localeId"))&&this.Oa();}updated(t){super.updated(t),t.has("clickable")&&this.Ra();}$a(){if(!this.Pe||!this.hd())return true;if(!this.fullscreen)return false;let t=Ds;return t.size===0?false:[...t].filter(s=>s!==this).filter(s=>s.isActive()).length>0}hd(){let t=this.cfg.multiple,e=this.cfg.multipleMax,r=this.uploadCollection.size;return !(t&&e&&r>=e||!t&&r>0)}Jo(){let t=this.La&&!this.disabled;this.Pe=t;}es(){let t=this.Pe||!this.querySelector("[data-default-slot]");this.Ma=t,this.hidden=!t;}Ua(t){let e=Object.entries(ct).find(([,r])=>r===t)?.[0].toLowerCase();e&&this.setAttribute("drag-state",e);}pd(){if(this.Qo)return;let t=this.Pa.value;t&&(this.Qo=$s({element:t,onChange:e=>{let r=Object.entries(ct).find(([,s])=>s===e)?.[0].toLowerCase();r&&t.setAttribute("drag-state",r);},onItems:()=>{},shouldIgnore:()=>this.$a()}));}Ra(){this.clickable&&!this.Ft?(this.addEventListener("keydown",this.Dt),this.addEventListener("click",this.Dt),this.Ft=true):!this.clickable&&this.Ft&&(this.removeEventListener("keydown",this.Dt),this.removeEventListener("click",this.Dt),this.Ft=false);}disconnectedCallback(){super.disconnectedCallback(),Ds.delete(this),this.Ia?.(),this.Qo?.(),this.Ft&&(this.removeEventListener("keydown",this.Dt),this.removeEventListener("click",this.Dt),this.Ft=false);}render(){return v` ${this.yield("",v`<div data-default-slot hidden></div><div ${O(this.Pa)} class="uc-content-wrapper" ?hidden=${!this.Ma} ><div class="uc-icon-container" ?hidden=${!this.withIcon}><uc-icon name="default"></uc-icon><uc-icon name="arrow-down"></uc-icon></div><span class="uc-text">${this.l10n(this.Xo)}</span></div>`)} `}};p([y({type:Boolean,noAccessor:true})],bt.prototype,"single",2),p([y({type:Boolean,noAccessor:true})],bt.prototype,"ghost",2),p([y({type:Boolean,reflect:true})],bt.prototype,"disabled",2),p([y({type:Boolean,reflect:true})],bt.prototype,"clickable",2),p([y({type:Boolean,attribute:"with-icon",reflect:true})],bt.prototype,"withIcon",2),p([y({type:Boolean,reflect:true})],bt.prototype,"fullscreen",2),p([y({type:Boolean,reflect:true})],bt.prototype,"initflow",2),p([y({type:String})],bt.prototype,"text",2),p([f()],bt.prototype,"Pe",2),p([f()],bt.prototype,"Ma",2);var Lt=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.historyTracked=true;this.activityType=$.activities.UPLOAD_LIST;this.Da=false;this.Fa=false;this.Na=false;this.ts=false;this.rs=false;this.yr=null;this.Va=false;this.os=null;this._a=()=>{this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"add-more",node:this.tagName}}}),this.api.initFlow(true);};this.ss=()=>{this.emit(A.UPLOAD_CLICK),this.api.uploadAll(),this.q();};this.ns=()=>{this.emit(A.DONE_CLICK,this.api.getOutputCollectionState()),this.api.doneFlow();};this.Ce=()=>{this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"clear-all",node:this.tagName}}}),this.uploadCollection.clearAll();};this.q=me(()=>{this.isConnected&&(this.gd(),!this.couldOpenActivity&&this.$["*currentActivity"]===this.activityType&&this.historyBack(),this.cfg.confirmUpload||this.api.uploadAll());},300);}get fd(){return this.os?this.md(this.os):""}gd(){let t=this.api.getOutputCollectionState(),e={total:t.totalCount,succeed:t.successCount,uploading:t.uploadingCount,failed:t.failedCount,validatingBeforeUploading:t.idleEntries.filter(m=>m.isValidationPending).length},r=!t.errors.some(m=>m.type==="TOO_MANY_FILES"||m.type==="TOO_FEW_FILES"),s=t.errors.some(m=>m.type==="TOO_MANY_FILES"),n=t.totalCount===(this.cfg.multiple?this.cfg.multipleMax:1),a=t.allEntries.some(m=>m.isValidationPending),l=e.failed===0&&t.errors.length===0&&!a,c=false,u=false,d=false;if(e.total-e.succeed-e.uploading-e.failed>0&&r&&l&&this.cfg.confirmUpload)c=true;else {u=true;let m=this.cfg.groupOutput?!!t.group:true;d=e.total===e.succeed&&r&&l&&m;}this.Da=u,this.Fa=d,this.Na=c,this.rs=e.total===0||!s&&!n,this.ts=!n||this.cfg.multiple,this.Va=e.total>0,this.os=e;}md(t){let e=r=>{let s=t[r];return r==="uploading"&&(s+=t.validatingBeforeUploading),this.l10n(`header-${r}`,{count:s})};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.yr=null;return}this.yr=e.message;});}disconnectedCallback(){super.disconnectedCallback(),this.has("*uploadCollection")&&(this.uploadCollection.unobserveProperties(this.q),this.uploadCollection.unobserveCollection(this.q));}render(){return v`<uc-activity-header><span aria-live="polite" class="uc-header-text">${this.fd}</span><button type="button" class="uc-mini-btn uc-close-btn" @click=${this.$["*closeModal"]} title=${this.l10n("a11y-activity-header-button-close")} aria-label=${this.l10n("a11y-activity-header-button-close")} ><uc-icon name="close"></uc-icon></button></uc-activity-header><div class="uc-no-files" ?hidden=${this.Va}>${this.yield("empty",v`<span>${this.l10n("no-files")}</span>`)}</div><div class="uc-files"><div class="uc-files-wrapper">${Ui(this.$["*uploadList"]??[],({uid:t})=>t,({uid:t})=>v`<uc-file-item .uid=${t}></uc-file-item>`)}</div><button type="button" class="uc-add-more-btn uc-secondary-btn" @click=${this._a} ?disabled=${!this.rs} ?hidden=${!this.ts} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button></div><div class="uc-common-error" ?hidden=${!this.yr} >${this.yr??""}</div><div class="uc-toolbar"><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Ce}>${this.l10n("clear")}</button><div class="uc-toolbar-spacer"></div><button type="button" class="uc-add-more-btn uc-secondary-btn" ?hidden=${!this.ts} ?disabled=${!this.rs} @click=${this._a} ><uc-icon name="add"></uc-icon><span>${this.l10n("add-more")}</span></button><button type="button" class="uc-upload-btn uc-primary-btn" ?hidden=${!this.Na} @click=${this.ss} >${this.l10n("upload")}</button><button type="button" class="uc-done-btn uc-primary-btn" ?hidden=${!this.Da} ?disabled=${!this.Fa} @click=${this.ns} >${this.l10n("done")}</button></div><uc-drop-area ghost></uc-drop-area>`}};p([f()],Lt.prototype,"Da",2),p([f()],Lt.prototype,"Fa",2),p([f()],Lt.prototype,"Na",2),p([f()],Lt.prototype,"ts",2),p([f()],Lt.prototype,"rs",2),p([f()],Lt.prototype,"yr",2),p([f()],Lt.prototype,"Va",2),p([f()],Lt.prototype,"os",2);var yd=[{test:o=>!!o.accept&&!!o.imgOnly,message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:o=>o.enableVideoRecording!==null,message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:o=>o.defaultCameraMode!==null,message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],Ga=F(o=>{for(let{test:i,message:t}of yd)i(o)&&Gr(t);},0);var qa=(o,i)=>{let t=new URL(i);return t.hostname=`${o}.${t.hostname}`,t.toString().replace(/\/$/,"")},bd="0123456789abcdefghijklmnopqrstuvwxyz",Wa=o=>{if(o<=0n)return "0";let i="";for(;o>0n;){let t=o%36n;i=bd[Number(t)]+i,o=o/36n;}return i},Fs=(o,i)=>{try{let t=new URL(o),e=new URL(i);return t.hostname.endsWith(e.hostname)}catch{return false}};var wd=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}`)},Ed=10,Td=async o=>{let i=await wd(o);return Wa(i).slice(0,Ed)},Za=async(o,i)=>{let t=await Td(o);return qa(t,i)};var Ya=o=>o instanceof Promise||!!(o&&typeof o=="object"&&"then"in o&&typeof o.then=="function");var Vs=o=>o,Cd=[Vs({key:"cameraModes",deps:["enableVideoRecording"],fn:({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")),Kt(e)}}),Vs({key:"cameraModes",deps:["defaultCameraMode"],fn:({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),Kt(e)}}),Vs({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:({pubkey:o,cdnCname:i,cdnCnamePrefixed:t})=>{let e=o(),r=i(),s=t();return e&&(r===vi||Fs(r,s))?Za(e,s):r}})],Xa=({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 l of r.deps)s[l]=()=>t(l);let n=new AbortController;e.get(r.fn)?.abort(),e.set(r.fn,n);let a;try{a=r.fn(s,{signal:n.signal});}catch(l){e.get(r.fn)===n&&e.delete(r.fn),console.error(`Failed to compute value for "${r.key}"`,l);return}Ya(a)?a.then(l=>{n.signal.aborted||i(r.key,l);}).catch(l=>{n.signal.aborted||console.error(`Failed to compute value for "${r.key}"`,l);}).finally(()=>{e.get(r.fn)===n&&e.delete(r.fn);}):i(r.key,a);}};var N=o=>String(o),tt=o=>{let i=Number(o);if(Number.isNaN(i))throw new Error(`Invalid number: "${o}"`);return i},_=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}"`)},Qa=o=>o==="auto"?o:_(o),Ja=o=>{let i=N(o);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},tl=o=>{let i=N(o);if(!Object.values(L).includes(i))throw new Error(`Invalid value: "${i}"`);return i},el=o=>{let i=N(o),t=G(i);if(t.some(e=>!Object.values(L).includes(e)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},il=o=>{let i=N(o);if(i==="local"||i==="global")return i;if(_(o)===false)return false;throw new Error(`Invalid value: "${i}"`)},rl=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.")},Ns=o=>{if(typeof o=="object")return o;throw new Error("Invalid value. Must be an object.")},so=o=>{if(typeof o=="function")return o;throw new Error("Invalid value. Must be a function.")},no=o=>{if(Array.isArray(o))return o;throw new Error("Must be an array.")},ol=o=>{let i=N(o);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)},sl=o=>{let i=N(o);if(["auto","menu","toolbar","compact"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)};var xd={pubkey:N,multiple:_,multipleMin:tt,multipleMax:tt,confirmUpload:_,imgOnly:_,accept:N,externalSourcesPreferredTypes:N,externalSourcesEmbedCss:N,store:Qa,cameraMirror:_,cameraCapture:Ja,sourceList:N,topLevelOrigin:N,maxLocalFileSizeBytes:tt,thumbSize:tt,showEmptyList:_,useLocalImageEditor:_,useCloudImageEditor:_,cloudImageEditorTabs:N,removeCopyright:_,cropPreset:N,imageShrink:N,modalScrollLock:_,modalBackdropStrokes:_,sourceListWrap:_,remoteTabSessionKey:N,cdnCname:N,cdnCnamePrefixed:N,baseUrl:N,socialBaseUrl:N,secureSignature:N,secureExpire:N,secureDeliveryProxy:N,retryThrottledRequestMaxTimes:tt,retryNetworkErrorMaxTimes:tt,multipartMinFileSize:tt,multipartChunkSize:tt,maxConcurrentRequests:tt,multipartMaxConcurrentRequests:tt,multipartMaxAttempts:tt,checkForUrlDuplicates:_,saveUrlForRecurrentUploads:_,groupOutput:_,userAgentIntegration:N,debug:_,localeName:N,metadata:rl,secureUploadsExpireThreshold:tt,localeDefinitionOverride:o=>Ns(o),secureUploadsSignatureResolver:o=>so(o),secureDeliveryProxyUrlResolver:o=>so(o),iconHrefResolver:o=>so(o),plugins:o=>no(o),fileValidators:no,collectionValidators:no,validationTimeout:tt,validationConcurrency:tt,cameraModes:el,defaultCameraMode:tl,enableAudioRecording:_,enableVideoRecording:_,mediaRecorderOptions:Ns,maxVideoRecordingDuration:tt,filesViewMode:ol,gridShowFileNames:_,cloudImageEditorAutoOpen:_,cloudImageEditorMaskHref:N,testMode:_,qualityInsights:_,pasteScope:il,dynamicButtonShowFirstIcon:_,dynamicButtonViewMode:sl},nl=(o,i)=>{if(!(typeof i>"u"||i===null))try{return xd[o](i)}catch(t){return console.error(`Invalid value for config key "${o}".`,t),J[o]}};var ao=[...new Set(["debug",...Object.keys(J)])],Sd=["metadata","plugins","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],ll=o=>Sd.includes(o),Bs=ao.filter(o=>!ll(o)),_s={...Object.fromEntries(Bs.map(o=>[yr(o),o])),...Object.fromEntries(Bs.map(o=>[o.toLowerCase(),o]))},al=o=>`__${o}`,ii=class extends C{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(J).map(([t,e])=>[x(t),e]))};this.vd=new Map;this.fi={};this.Ba=new Set;this.Nt=new Map;}as(t){return this.Ba.has(t)}ls(t){let e=this.e.pluginManager;if(e)return e.configRegistry.get(t)}cs(t){return [...new Set([yr(t),t.toLowerCase()])]}yd(t,e){if(ll(t)||this.as(t)&&this.ls(t)?.attribute===false)return;let r=this.cs(t);for(let s of r)typeof e>"u"||e===null?this.removeAttribute(s):this.getAttribute(s)!==e.toString()&&this.setAttribute(s,e.toString());}bd(t,e){let r=x(t);if(this.$[r]!==e)if(typeof e>"u"||e===null){let s=J[t];this.$[r]=s!==void 0?s:e;}else this.$[r]=e;}$e(t,e){let r;if(this.as(t)){let a=this.ls(t);try{r=a?.normalize?.(e)??e;}catch(l){console.warn(`[uc-config] normalize() for "${t}" threw an error, keeping previous value`,l);return}}else r=nl(t,e);let s=this,n=al(t);s[n]!==r&&(this.wd(t,s[n],r),s[n]=r,this.yd(t,r),this.bd(t,r),this.debugPrint(`"${t}"`,r),this.as(t)||Ga(this.cfg));}wr(t){let e=this,r=al(t);return e[r]??this.$[x(t)]}wd(t,e,r){this.cfg.debug&&r!==e&&typeof r=="object"&&typeof e=="object"&&JSON.stringify(r)===JSON.stringify(e)&&(console.warn(`[uc-config] Option "${t}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${t}" previous value:`,e),console.warn(`[uc-config] "${t}" new value:`,r));}za(t){let e=t.configRegistry.getAll();this.fi={},this.Ba=new Set(e.keys());for(let[r,s]of this.Nt)e.has(r)||(s(),this.Nt.delete(r));for(let[r,s]of e){let a=x(r);if(s.attribute){let m=this.cs(r);for(let g of m)this.fi[g]=r;}let l,c=false,u=Object.getOwnPropertyDescriptor(this,r);if(u&&!u.get&&!u.set&&u.value!==void 0&&(l=u.value,c=true),!c&&s.attribute)for(let m of this.cs(r)){let g=this.getAttribute(m);if(g!=null){try{l=s.fromAttribute?s.fromAttribute(g):g;}catch(b){console.warn(`[uc-config] fromAttribute() for "${r}" threw an error, using raw attribute value`,b),l=g;}c=true;break}}this.sharedCtx.has(a)||this.sharedCtx.add(a,s.defaultValue);let h=Object.getOwnPropertyDescriptor(this,r);if((!h||!h.set||!h.get)&&Object.defineProperty(this,r,{set:m=>{this.$e(r,m);},get:()=>this.wr(r),enumerable:true,configurable:true}),!this.Nt.has(r)){let m=this.sub(a,g=>{this.$e(r,g);},false);this.Nt.set(r,m);}c&&this.$e(r,l);}}xd(){this.e.when("pluginManager",t=>{this.za(t),this.br=t.onPluginsChange(()=>{this.za(t);});});}Ed(){this.hi=new MutationObserver(t=>{for(let e of t)if(e.type==="attributes"&&e.attributeName){let r=e.attributeName,s=e.oldValue,n=this.getAttribute(r);if(s===n||r in _s)continue;if(r in this.fi){let l=this.fi[r],c=this.ls(l);this.attributeChangedCallback(r,s??"",n??c?.defaultValue??"");}}}),this.hi.observe(this,{attributes:true,attributeOldValue:true});}initCallback(){super.initCallback();let t=this;this.xd(),this.Ed();for(let r of Bs)this.sub(x(r),s=>{this.$e(r,s);},false);for(let r of ao){let s=t[r]??this.$[x(r)];s!==J[r]&&this.$e(r,s);let n=Object.getOwnPropertyDescriptor(this,r);(!n||!n.set||!n.get)&&Object.defineProperty(this,r,{set:a=>{this.$e(r,a);},get:()=>this.wr(r)});}let e=r=>{Xa({key:r,setValue:this.$e.bind(this),getValue:this.wr.bind(this),computationControllers:this.vd});};for(let r of ao)this.sub(x(r),()=>e(r));}attributeChangedCallback(t,e,r){if(super.attributeChangedCallback(t,e,r),e===r)return;let s=this,n=_s[t];n?s[n]=r:this.e.when("pluginManager",a=>{let l=this.getAttribute(t);if(l&&l!==r)return;let c=this.fi[t],u=c?a.configRegistry.get(c):void 0;if(c&&u){let d=u.fromAttribute?u.fromAttribute(r):r;if(this.wr(c)===d)return;this.$e(c,d);}});}disconnectedCallback(){super.disconnectedCallback(),this.br&&(this.br(),this.br=void 0),this.hi&&(this.hi.disconnect(),this.hi=void 0);for(let t of this.Nt.values())t();this.Nt.clear();}static get observedAttributes(){let t=super.observedAttributes,e=Object.keys(_s);return [...t,...e]}};for(let o of ao)ii.prototype[o]=void 0;var Ri=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.mi="upload-file";this.us=()=>{this.api.initFlow();};}static{this.styleAttrs=[...super.styleAttrs,"uc-simple-btn"];}initCallback(){super.initCallback(),this.subConfigValue("multiple",t=>{this.mi=t?"upload-files":"upload-file";});}render(){return v`<uc-drop-area .disabled=${!this.dropzone}><button type="button" @click=${this.us}><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>`}};p([y({attribute:"dropzone",type:Boolean})],Ri.prototype,"dropzone",2),p([f()],Ri.prototype,"mi",2);var cl=o=>Va(o)?o.Me.h:o.strings,Oe=at(class extends ht{constructor(o){super(o),this.et=new WeakMap;}render(o){return [o]}update(o,[i]){let t=Cs(this.it)?cl(this.it):null,e=Cs(i)?cl(i):null;if(t!==null&&(e===null||t!==e)){let r=ki(o).pop(),s=this.et.get(t);if(s===void 0){let n=document.createDocumentFragment();s=ar(U,n),s.setConnected(false),this.et.set(t,s);}Ai(s,[r]),Xt(s,void 0,r);}if(e!==null){if(t===null||t!==e){let r=this.et.get(e);if(r!==void 0){let s=ki(r).pop();_a(o),Xt(o,void 0,s),Ai(o,[s]);}}this.it=i;}else this.it=void 0;return this.render(i)}});var Le=class Le extends M{constructor(){super(...arguments);this.showIcon=false;this.$t=false;}static{this.styleAttrs=[...super.styleAttrs,"uc-primary-action"];}static{this.SOURCE_TEXT_CONFIG={[P.LOCAL]:{action:"upload-from"},[P.URL]:{action:"upload-from"},[P.CAMERA]:{action:"capture-with"},[P.MOBILE_PHOTO_CAMERA]:{action:"take"},[P.MOBILE_VIDEO_CAMERA]:{action:"record"}};}initCallback(){super.initCallback(),this.subConfigValue("dynamicButtonShowFirstIcon",t=>{this.showIcon=t;}),this.subConfigValue("multiple",t=>{this.$t=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.Td();return t||this.Cd()}Td(){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})}Cd(){if(!this.source?.id)return "";let e=Le.SOURCE_TEXT_CONFIG[this.source.id]?.action??"get-from",r;return this.source.id===P.MOBILE_PHOTO_CAMERA?r=this.l10n("photo").toLowerCase():this.source.id===P.MOBILE_VIDEO_CAMERA?r=this.l10n("video").toLowerCase():r=this.localizedSourceLabel,this.gi(e,{source:r})}us(){if(this.hasEntries){this.e.ctx.pub("*currentActivity","upload-list"),this.e.modalManager?.open("upload-list");return}this.source?.onClick();}Sd(){if(!this.$t&&this.hasSingleSuccessImage){let e=this.entries.allEntries[0];return e?v`<uc-thumb .uid=${e.internalId}></uc-thumb>`:null}if(this.$t&&this.hasMultipleEntries)return null;let t=this.source?.icon;return this.showIcon&&t?v`<uc-icon .name=${t}></uc-icon>`:null}render(){return v`<button type="button" @click=${this.us} aria-label=${this.textBasedOnLocale}>${this.Sd()}<span>${this.textBasedOnLocale}</span></button>`}};p([y({type:Object})],Le.prototype,"source",2),p([y({type:Object})],Le.prototype,"entries",2),p([f()],Le.prototype,"showIcon",2),p([f()],Le.prototype,"$t",2);var zs=Le;var lo=class extends C{constructor(){super(...arguments);this.Ha=rt.generateFastUid();this.Ad=t=>{t.currentTarget.hidePopover();};}static{this.styleAttrs=[...super.styleAttrs,"uc-drop-down"];}render(){return v`<button type="button" class="uc-mini-btn uc-dropdown-btn" popovertarget=${this.Ha} popovertargetaction="toggle">${this.yield("dd-header-button")}</button><div id=${this.Ha} class="uc-dropdown-content" popover="auto" @click=${this.Ad}>${this.yield("dd-content")}</div>`}};p([f()],lo.prototype,"Ha",2);var Hs=class extends M{static{this.styleAttrs=[...super.styleAttrs,"uc-no-wrap-mode-dynamic-btn"];}};var Ad=(o,i)=>i==="compact"||o.length===0?{main:null,remain:o}:{main:o[0]??null,remain:o.slice(1)},ul={compact:"paperclip",menu:"arrow-dropdown",auto:"arrow-dropdown"},kd=3,Vt=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.dropzone=true;this.Qe="auto";this.b=[];this.Vt="idle";this.ja=0;this.q=me(()=>{this.isConnected&&this.kd();},300);}static{this.styleAttrs=[...super.styleAttrs,"uc-dynamic-btn"];}get isIdle(){return this.Vt==="idle"}get isSuccess(){return this.Vt==="success"}get isFailed(){return this.Vt==="failed"}get isUploading(){return this.Vt==="uploading"}get isCollapsedMode(){return this.Qe==="compact"}get shouldShowPrimaryAction(){return !this.isCollapsedMode||!this.isIdle||this.hasCollectionEntries}get shouldShowInline(){return this.isIdle&&!this.hasCollectionEntries&&this.b.length>1&&(this.Qe==="toolbar"||this.Qe==="auto"&&this.b.length<=kd)}get shouldShowDropdown(){return this.isIdle&&!this.shouldShowInline&&!this.shouldShowCompactSingleSource&&!this.hasCollectionEntries&&(this.b.length>1||this.isCollapsedMode)}get shouldShowCompactSingleSource(){return this.isIdle&&this.isCollapsedMode&&!this.hasCollectionEntries&&this.b.length===1}get hasCollectionEntries(){return (this.Er?.allEntries?.length??0)>0}get shouldShowAbortAction(){return !this.isIdle&&this.hasCollectionEntries}kd(){let t=this.api?.getOutputCollectionState();if(!t){console.warn("Collection state is undefined");return}this.Er=t,this.Vt=t.status;}Ga(){this.xr=Ad(this.b,this.Qe);}initCallback(){super.initCallback(),this.subConfigValue("dynamicButtonViewMode",t=>{this.Qe!==t&&(this.Qe=t,this.Ga());}),this.sub("*commonProgress",t=>{this.ja=t;}),new Je(this,{ctx:this.e.ctx,sharedInstancesBag:this.e,onSourcesChange:t=>{this.b=t,this.Ga();}}),this.uploadCollection.observeProperties(this.q),this.uploadCollection.observeCollection(this.q),this.Ka=this.routerLayer.registerAfterFileAddHook(({historyLength:t})=>{if(this.cfg.confirmUpload)return this.e.ctx.pub("*currentActivity",D.UPLOAD_LIST),this.modalManager?.open(D.UPLOAD_LIST),true;if(t>0)return false;let e=this.e.ctx.read("*currentActivity");return e?this.modalManager?.close(e):this.modalManager?.closeAll(),this.e.ctx.pub("*currentActivity",null),true});}disconnectedCallback(){typeof this.q.cancel=="function"&&this.q.cancel(),this.Ka?.(),super.disconnectedCallback();}Md(){return v`<uc-no-wrap-mode-dynamic-btn>${this.xr?.remain?.map(t=>v`<uc-source-btn .iconOnly=${ true} role="menuitem" .source=${t}></uc-source-btn>`)}</uc-no-wrap-mode-dynamic-btn>`}Od(){return ul[this.Qe]??"arrow-dropdown"}Id(){this.uploadCollection.clearAll();}Pd(){this.Er.failedEntries.forEach(t=>{t&&this.uploadCollection.hasItem(t.internalId)&&this.uploadCollection.remove(t.internalId);});}Ld(){this.uploadCollection.abortAll();}Yo(){switch(this.Vt){case "failed":this.Pd();break;case "uploading":this.Ld();break;default:this.Id();}}Rd(){return v`<uc-drop-down><uc-icon content-for="dd-header-button" name=${this.Od()}></uc-icon><div content-for="dd-content" role="menu" class="uc-dropdown-menu">${this.xr?.remain?.map(t=>v`<uc-source-btn role="menuitem" .source=${t}></uc-source-btn>`)}</div></uc-drop-down>`}Ud(){let t=this.b[0],e=t&&{...t,icon:ul.compact};return v`<uc-no-wrap-mode-dynamic-btn><uc-source-btn .iconOnly=${ true} .source=${e}></uc-source-btn></uc-no-wrap-mode-dynamic-btn>`}$d(){return v`<uc-primary-action .entries=${this.Er} .source=${this.xr?.main} ></uc-primary-action>`}Dd(){return v`<uc-file-action-button @uc:remove=${this.Yo} .uploading=${this.isUploading} .failed=${this.isFailed} .success=${this.isSuccess} .idle=${this.isIdle} .progress=${this.ja} ></uc-file-action-button>`}Fd(){return lt({"uc-dynamic-btn-inner":true,"uc-failed":this.isFailed,"uc-uploading":this.isUploading,"uc-success":this.isSuccess})}Nd(){return v`<div class="uc-visual-drop-area"><uc-icon name="arrow-down"></uc-icon></div>`}render(){return v`<uc-drop-area .disabled=${!this.dropzone}><div class=${this.Fd()}>${Oe(this.shouldShowPrimaryAction?this.$d():null)} ${Oe(this.shouldShowInline?this.Md():null)} ${Oe(this.shouldShowCompactSingleSource?this.Ud():null)} ${Oe(this.shouldShowDropdown?this.Rd():null)} ${Oe(this.shouldShowAbortAction||this.hasCollectionEntries?this.Dd():null)} ${Oe(this.Nd())}</div></uc-drop-area>`}};p([y({attribute:"dropzone",type:Boolean})],Vt.prototype,"dropzone",2),p([f()],Vt.prototype,"Qe",2),p([f()],Vt.prototype,"b",2),p([f()],Vt.prototype,"Vt",2),p([f()],Vt.prototype,"xr",2),p([f()],Vt.prototype,"Er",2),p([f()],Vt.prototype,"ja",2);var $i=class extends ${constructor(){super(...arguments);this.ps=I();}initCallback(){this.activityType=this.registration?.id??null,this.qa(),super.initCallback();}willUpdate(t){super.willUpdate(t),t.has("registration")&&(this.qa(),this.isActivityActive&&(this.Tr(),this.Wa()));}qa(){this.registration&&(this.Wn()||this.registerActivity(this.activityType??"",{onActivate:()=>this.Wa(),onDeactivate:()=>this.Tr()}));}async Wa(){await this.updateComplete;let t=this.ps.value;if(!t||!this.registration)return;this.Tr();let e=this.$["*currentActivityParams"];try{this.ds=this.registration.render(t,e)??void 0;}catch(r){console.error(`[Plugin "${this.registration.pluginId}"] Activity render() threw an error`,r);}}Tr(){let t=this.ps.value;if(t){try{this.ds?.();}catch(e){console.error(`[Plugin "${this.registration?.pluginId}"] Activity dispose threw an error`,e);}this.ds=void 0,t.replaceChildren();}}disconnectedCallback(){this.Tr(),super.disconnectedCallback();}render(){return v`<div style="display: contents;" ${O(this.ps)}></div>`}};p([y({attribute:false})],$i.prototype,"registration",2);var ri=class extends C{constructor(){super(...arguments);this.mode="modal";this.fe=[];}initCallback(){super.initCallback();let t=this.e.pluginManager;t?.onPluginsChange&&(this.S=t.onPluginsChange(()=>this.Za())),this.Za();}Za(){let t=this.e.pluginManager;if(!t){this.fe=[];return}this.fe=t.snapshot().activities;}disconnectedCallback(){this.S?.(),this.S=void 0,super.disconnectedCallback();}render(){return this.mode==="inline"?v`${Ui(this.fe,t=>t.id,t=>v`<uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host>`)}`:v`${Ui(this.fe,t=>t.id,t=>v`<uc-modal id=${t.id} strokes block-body-scrolling><uc-plugin-activity-host .registration=${t}></uc-plugin-activity-host></uc-modal>`)}`}};p([y({type:String})],ri.prototype,"mode",2),p([f()],ri.prototype,"fe",2);function Di(o,i,t){return o?i(o):t?.(o)}function dl(...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},{})}function wt(...o){let i=dl(...o);return Object.keys(i).reduce((t,e)=>(i[e]&&t.push(e),t),[]).join(" ")}function pl(o,...i){let t=dl(...i);for(let e of Object.keys(t))o.classList.toggle(e,!!t[e]);}var Md=o=>st.includes(o),hl=o=>{if(!o)return st;let i=G(o).filter(Md);return i.length===0?st:i};function ml(o){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":st,"*tabId":z.CROP,"*on.retryNetwork":()=>{let i=o.querySelectorAll("img");for(let t of i){let e=t.src;t.src=Ot,t.src=e;}o.$["*networkProblems"]=false;},"*on.apply":i=>{if(!i)return;let t=o.$["*originalUrl"];if(!t){console.warn("Original URL is null, cannot apply transformations");return}let e=ot(oe(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.cancel":()=>{o.remove(),o.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));}}}var fl="<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 Pe={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},oi=class extends C{constructor(){super(...arguments);this.ge=false;this.Ya=Pe;this.Xa=Pe.visible;this.Qa=Pe.hidden;this.hs=false;this.Ja=false;}set visible(t){this.ge=t,this.tl();}get visible(){return this.ge}set styles(t){this.Ya=t,this.hs=true,this.Xa=t.visible??Pe.visible,this.Qa=t.hidden??Pe.hidden;}get styles(){return this.Ya}tl(){this.style.visibility=this.ge?"inherit":"hidden",pl(this,{[Pe.transition]:!this.hs,[this.Xa]:this.ge,[this.Qa]:!this.ge}),this.toggleAttribute("inert",!this.ge);}Vd(){this.Ja||(this.Ja=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this.hs||this.classList.add(Pe.transition),this.tl(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this.Vd();},0);}};p([y({type:Boolean})],oi.prototype,"visible",1),p([y({attribute:false})],oi.prototype,"styles",1);var Fi=class extends C{constructor(){super(...arguments);this.active=false;this.Je=I();this.fs=false;this.ms=()=>{let t=this.Je.value;t&&(this.il(t),this.fs&&this.active&&this.gs());};}firstUpdated(t){super.firstUpdated(t),this.active&&this.gs();}updated(t){super.updated(t),t.has("active")&&(this.active?this.gs():this._d());}gs(){let t=this.Je.value;if(!t)return;this.fs=true;let{width:e}=this.getBoundingClientRect();t.removeEventListener("transitionend",this.ms),t.style.transition="transform 1s",t.style.opacity="1",t.style.transform=`translateX(${e}px)`,t.addEventListener("transitionend",this.ms,{once:true});}_d(){let t=this.Je.value;t&&(this.fs=false,t.removeEventListener("transitionend",this.ms),this.il(t));}il(t){t.style.transition="initial",t.style.opacity="0",t.style.transform="translateX(-101%)";}render(){return v`<div class="uc-inner"><div class="uc-line" ${O(this.Je)}></div></div>`}};p([y({type:Boolean,reflect:true})],Fi.prototype,"active",2);var W=o=>o??U;var At=class extends C{constructor(){super(...arguments);this.text="";this.icon="";this.reverse=false;this.theme="default";this.ariaRole=void 0;this.ariaControls="";this.titleProp="";this.active=false;}firstUpdated(t){super.firstUpdated(t),this.rl(),this.ol();}updated(t){super.updated(t),t.has("reverse")&&this.rl(),t.has("theme")&&this.ol();}rl(){this.style.flexDirection=this.reverse?"row-reverse":"";}ol(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get Bd(){let t=this.vs;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":t,"uc-icon_single":this.zd}}get vs(){return !this.icon}get zd(){return !this.text&&!this.vs}render(){return v`<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=${lt(this.Bd)} name=${W(this.icon||void 0)} ?hidden=${this.vs} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};p([y({type:String})],At.prototype,"text",2),p([y({type:String})],At.prototype,"icon",2),p([y({type:Boolean,reflect:true})],At.prototype,"reverse",2),p([y({type:String,reflect:true})],At.prototype,"theme",2),p([y({attribute:"aria-role"})],At.prototype,"ariaRole",2),p([y({attribute:"aria-controls"})],At.prototype,"ariaControls",2),p([y({attribute:"title-prop"})],At.prototype,"titleProp",2),p([y({type:Boolean,noAccessor:true})],At.prototype,"active",2);function gl(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}function si(o,i,t){let r=window.devicePixelRatio,s=Math.min(Math.ceil(i*r),3e3),n=r>=2?"lightest":"normal";return Z(o,ot(fr,oe(t),`quality/${n}`,`stretch/off/-/resize/${s}x`,`@clib/${Ut}/${Rt}/uc-cloud-image-editor/`))}var Vi=class extends C{constructor(){super(...arguments);this.sl=`uc-backdrop-mask-${rt.generateFastUid()}`;this.Sr=false;this.wi=false;this.ll=I();this.xi=false;this.Ei=null;this.ul=t=>{this.dl(),this.Ti&&(t.stopPropagation(),t.preventDefault(),this.Ti=false);};this.pl=t=>{if(!this.Ti||!this.Cr||!this.bs)return;t.stopPropagation(),t.preventDefault();let e=this.De;if(!e)return;let{x:r,y:s}=e.getBoundingClientRect(),n=t.x-r,a=t.y-s,l=n-this.Cr[0],c=a-this.Cr[1],{direction:u}=this.bs,d=this.Xd(u,[l,c]);d&&(this.$["*cropBox"]=d);};this.hl=t=>{if(!this.Se)return;let e=Object.values(this.Se).find(r=>{if(!r||this.Es(r.direction))return false;let n=r.interactionNode.getBoundingClientRect(),a={x:n.x,y:n.y,width:n.width,height:n.height};return Aa(a,[t.x,t.y])});this.nl=e,this.dl();};}get De(){return this.ll.value??null}get Ti(){return this.wi}set Ti(t){this.wi!==t&&(this.wi=t,this.xs());}xs(){this.yi&&this.yi.setAttribute("class",wt({"uc-guides--hidden":this.Sr,"uc-guides--visible":!this.Sr&&this.wi,"uc-guides--semi-hidden":!this.Sr&&!this.wi}));}Es(t){let e=this.$["*imageBox"];if(!e)return false;if(t===""&&e.height<=k&&e.width<=k)return true;let r=e.height<=k&&(t.includes("n")||t.includes("s")),s=e.width<=k&&(t.includes("e")||t.includes("w"));return r||s}Hd(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:n}=t,a=this.De;if(!a)return;let l=yt("mask",{id:this.sl}),c=yt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),u=yt("rect",{x:e,y:r,width:s,height:n,fill:"black"});l.appendChild(c),l.appendChild(u);let d=yt("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this.sl})`});a.appendChild(d),a.appendChild(l),this.vi=l,this.ys=u;}Kd(){this.vi&&(this.vi.style.display="none",window.requestAnimationFrame(()=>{this.vi&&(this.vi.style.display="block");}));}jd(){let t=this.$["*cropBox"];if(!t)return;let{x:e,y:r,width:s,height:n}=t;this.ys&&ce(this.ys,{x:e,y:r,width:s,height:n});}Gd(){let t=this.$["*cropBox"];if(!(!t||!this.yi||!this.Se)){for(let e of Object.values(this.Se)){if(!e)continue;let{direction:r,pathNode:s,interactionNode:n,groupNode:a}=e,l=r==="",c=r.length===2,{x:u,y:d,width:h,height:m}=t;if(l)ce(n,{x:u,y:d,width:h,height:m});else {let b=ue(Math.min(h,m)/82/2,0,1),w=c?Ea(t,r,b):Ta(t,r,b),T=w.center;if(!T)continue;let E=Math.max(gs*ue(Math.min(h,m)/gs/3,0,1),wa);ce(n,{x:T[0]-E,y:T[1]-E,width:E*2,height:E*2}),ce(s,{d:w.d});}let g=this.Es(r);a.setAttribute("class",wt("uc-thumb",{"uc-thumb--hidden":g,"uc-thumb--visible":!g}));}ce(this.yi,{x:t.x-1*.5,y:t.y-1*.5,width:t.width+1,height:t.height+1});}}cl(t,e){let r=yt("g");r.classList.add("uc-thumb"),r.setAttribute("with-effects","");let s=yt("rect",{fill:"transparent"}),n=yt("path",{stroke:"currentColor",fill:"none","stroke-width":3});r.appendChild(n),r.appendChild(s),t[e]={direction:e,pathNode:n,interactionNode:s,groupNode:r},e===""&&(r.style.cursor="move"),s.addEventListener("pointerdown",this.qd.bind(this,e));}Wd(){let t={};for(let e=0;e<3;e++)for(let r=0;r<3;r++){let s=`${["n","","s"][e]}${["w","","e"][r]}`;s!==""&&this.cl(t,s);}return this.cl(t,""),t}Zd(){let t=yt("svg"),e=yt("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=yt("line",{x1:`${xi*r}%`,y1:"0%",x2:`${xi*r}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}for(let r=1;r<=2;r++){let s=yt("line",{x1:"0%",y1:`${xi*r}%`,x2:"100%",y2:`${xi*r}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});t.appendChild(s);}return t.classList.add("uc-guides","uc-guides--semi-hidden"),t}Yd(){let t=this.De;if(!t)return;let e=document.createDocumentFragment(),r=this.Zd();e.appendChild(r);let s=this.Wd();for(let{groupNode:n}of Object.values(s))e.appendChild(n);t.appendChild(e),this.Se=s,this.yi=r,this.xs();}qd(t,e){if(!this.Se)return;let r=this.Se[t];if(!r||this.Es(t))return;let s=this.$["*cropBox"],n=this.De;if(!n)return;let{x:a,y:l}=n.getBoundingClientRect(),c=e.x-a,u=e.y-l;this.Ti=true,this.bs=r,this.Cr=[c,u],this.al={...s};}Xd(t,e){let[r,s]=e,n=this.$["*imageBox"],a=this.al??this.$["*cropBox"],l=this.$["*currentAspectRatio"],c=l?l.width/l.height:void 0;if(t===""?a=xa({rect:a,delta:[r,s],imageBox:n}):a=Sa({rect:a,delta:[r,s],direction:t,aspectRatio:c,imageBox:n}),!Object.values(a).every(u=>Number.isFinite(u)&&u>=0)){console.error("CropFrame is trying to create invalid rectangle",{payload:a});return}return Ge(We(a),n)}dl(){let t=this.nl,e=this.De;e&&(e.style.cursor=t?Ca(t.direction):"initial");}fl(t){if(this.bi){this.bi.setAttribute("href",t);return}let e=this.De;if(!e){this.Ei=t;return}this.Ei=null;let r=document.createDocumentFragment(),s=yt("image",{href:t});s.setAttribute("class","uc-cloud-mask"),r.appendChild(s),e.appendChild(r),this.bi=s;}Qd(){let t=this.$["*cropBox"];if(!t||!this.bi)return;let{x:e,y:r,width:s,height:n}=t;ce(this.bi,{x:e,y:r,height:n,width:s});}Ts(){this.xi&&(this.jd(),this.Gd(),this.Qd());}toggleThumbs(t){if(this.Se)for(let e of Object.values(this.Se)){if(!e)continue;let{groupNode:r}=e;r.setAttribute("class",wt("uc-thumb",{"uc-thumb--hidden":!t,"uc-thumb--visible":t}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Kd(),this.xi&&window.requestAnimationFrame(()=>{this.Ts();});}),this.sub("*cropBox",t=>{t&&(this.Sr=t.height<=k||t.width<=k,this.xs(),this.xi&&window.requestAnimationFrame(()=>{this.Ts();}));}),this.subConfigValue("cloudImageEditorMaskHref",t=>{t&&this.fl(t);}),document.addEventListener("pointermove",this.pl,true),document.addEventListener("pointerup",this.ul,true);}firstUpdated(t){super.firstUpdated(t),this.Jd();}Jd(){let t=this.De;if(!(!t||this.xi)){if(this.Hd(),this.Yd(),this.xi=true,t.addEventListener("pointermove",this.hl,true),this.Ei){let e=this.Ei;this.Ei=null,this.fl(e);}this.Ts();}}disconnectedCallback(){super.disconnectedCallback(),this.De?.removeEventListener("pointermove",this.hl,true),document.removeEventListener("pointermove",this.pl,true),document.removeEventListener("pointerup",this.ul,true);}render(){return v`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${O(this.ll)}></svg>`}};p([f()],Vi.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}var Ni=class extends C{constructor(){super();this.ctxOwner=true;this.tt={width:0,height:0};this.i=null;this.z=false;this.le=null;this.gl=I();this.Ss=I();this.init$={...this.init$,"*padding":20,"*operations":{rotate:0,mirror:false,flip:false},"*imageBox":{x:0,y:0,width:0,height:0},"*cropBox":{x:0,y:0,width:0,height:0}},this.ml=F(this.vl.bind(this),300),this.Cs=me(()=>{!this.isConnected||!this.z||(this.As(),this.yl(),this.bl(),this.ks(),this.Ms());},100);}firstUpdated(t){super.firstUpdated(t),this.As();}yl(){let t=this.$["*editorTransformations"],e=gl(t,Object.keys(this.$["*operations"])),r={...this.$["*operations"],...e};this.$["*operations"]=r;}As(){let t=this.gl.value;if(!t)return;let e=t.getContext("2d"),r=this.offsetWidth,s=this.offsetHeight,n=window.devicePixelRatio;t.style.width=`${r}px`,t.style.height=`${s}px`,t.width=r*n,t.height=s*n,e?.scale(n,n),this.ve=t,this.i=e;}bl(){if(!this.z||!this.le)return;let t=this.le,e=this.$["*padding"],r=this.$["*operations"],{rotate:s}=r,n={width:this.offsetWidth,height:this.offsetHeight},a=qe({width:t.naturalWidth,height:t.naturalHeight},s),l;if(a.width>n.width-e*2||a.height>n.height-e*2){let c=a.width/a.height,u=n.width/n.height;if(c>u){let d=n.width-e*2,h=d/c,m=0+e,g=e+(n.height-e*2)/2-h/2;l={x:m,y:g,width:d,height:h};}else {let d=n.height-e*2,h=d*c,m=e+(n.width-e*2)/2-h/2,g=0+e;l={x:m,y:g,width:h,height:d};}}else {let{width:c,height:u}=a,d=e+(n.width-e*2)/2-c/2,h=e+(n.height-e*2)/2-u/2;l={x:d,y:h,width:c,height:u};}this.$["*imageBox"]=We(l);}ks(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,n=this.$["*editorTransformations"].crop,{width:a,x:l,y:c}=e;if(n){let{dimensions:[h,m],coords:[g,b]}=n,{width:w}=qe(this.tt,s),T=a/w;t=Ge(We({x:l+g*T,y:c+b*T,width:h*T,height:m*T}),e);}let u=this.$["*currentAspectRatio"],d=u?u.width/u.height:void 0;if(!ka(t,e)||d&&!Ma(t,d)){let h=e.width/e.height,m=e.width,g=e.height;d&&(h>d?m=Math.min(e.height*d,e.width):g=Math.min(e.width/d,e.height)),t={x:e.x+e.width/2-m/2,y:e.y+e.height/2-g/2,width:m,height:g};}this.$["*cropBox"]=Ge(We(t),e);}ep(){let t=this.i;if(!t)return;let e=this.le;if(!e)return;let r=this.$["*imageBox"],s=this.$["*operations"],{mirror:n,flip:a,rotate:l}=s,c=qe({width:r.width,height:r.height},l);t.save(),t.translate(r.x+r.width/2,r.y+r.height/2),t.rotate(l*Math.PI*-1/180),t.scale(n?-1:1,a?-1:1),t.drawImage(e,-c.width/2,-c.height/2,c.width,c.height),t.restore();}Ms(){if(!this.z||!this.le||!this.ve||!this.i)return;let t=this.ve;this.i.clearRect(0,0,t.width,t.height),this.ep();}tp({fromViewer:t}){this.le&&(this.Ss.value?.toggleThumbs(true),this.ip(),setTimeout(()=>{this.className=wt({"uc-active_from_viewer":t,"uc-active_from_editor":!t,"uc-inactive_to_editor":false});}));}wl(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,{width:n,height:a}=e,{width:l,height:c}=qe(this.tt,s),{width:u,height:d}=t,h=n/l,m=a/c;return [ue(Math.round(u/h),1,l),ue(Math.round(d/m),1,c)]}rp(){let t=this.$["*cropBox"],e=this.$["*imageBox"],r=this.$["*operations"],{rotate:s}=r,{width:n,height:a,x:l,y:c}=e,{width:u,height:d}=qe(this.tt,s),{x:h,y:m}=t,g=n/u,b=a/d,w=this.wl(),T={dimensions:w,coords:[ue(Math.round((h-l)/g),0,u-w[0]),ue(Math.round((m-c)/b),0,d-w[1])]};if(!Od(T)){console.error("Cropper is trying to create invalid crop object",{payload:T});return}if(!(w[0]===u&&w[1]===d))return T}vl(){if(!this.isConnected||!this.tt)return;let t=this.$["*operations"],{rotate:e,mirror:r,flip:s}=t,n=this.rp(),l={...this.$["*editorTransformations"],crop:n,rotate:e,mirror:r,flip:s};this.$["*editorTransformations"]=l;}setValue(t,e){this.$["*operations"]={...this.$["*operations"],[t]:e},this.z&&(this.bl(),this.ks(),this.Ms());}getValue(t){return this.$["*operations"][t]}async activate(t,{fromViewer:e}={}){if(!this.z){this.z=true,await this.updateComplete,this.As(),this.tt=t,this.removeEventListener("transitionend",this.xl);try{let r=this.$["*originalUrl"],s=this.$["*editorTransformations"];this.le=await this.op(r,s),this.yl(),this.Cs(),this.tp({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.z&&this.le&&this.Cs();}),this.s.observe(this);}}deactivate({reset:t=false}={}){this.z&&(!t&&this.vl(),this.z=false,this.sp(),this.className=wt({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this.Ss.value?.toggleThumbs(false),this.addEventListener("transitionend",this.xl,{once:true}),this.s?.disconnect());}sp(){let t=this.wl(),e=this.$["*cropBox"],r=Math.min(this.offsetWidth,t[0])/e.width,s=Math.min(this.offsetHeight,t[1])/e.height,n=Math.min(r,s),a=e.x+e.width/2,l=e.y+e.height/2;this.style.transform=`scale(${n}) translate(${(this.offsetWidth/2-a)/n}px, ${(this.offsetHeight/2-l)/n}px)`,this.style.transformOrigin=`${a}px ${l}px`;}ip(){let t=this.$["*cropBox"],e=t.x+t.width/2,r=t.y+t.height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${e}px ${r}px`;}xl(){this.z||(this.le=null);}async op(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(si(t,r,e)),{promise:n,cancel:a,image:l}=Ie(s),c=this._t(s);return l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),this.w?.(),this.w=a,n.then(()=>l).catch(u=>(console.error("Failed to load image",{error:u}),this.$["*networkProblems"]=true,l))}_t(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 n=r.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=r);}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this.Ms();}),this.sub("*cropBox",()=>{this.le&&this.ml();}),this.sub("*currentAspectRatio",()=>{this.ks();}),setTimeout(()=>{this.sub("*networkProblems",t=>{t||this.z&&this.tt&&this.activate(this.tt,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.le&&(this.le=null);}render(){return v`<canvas class="uc-canvas" ${O(this.gl)}></canvas><uc-crop-frame ${O(this.Ss)}></uc-crop-frame>`}};p([f()],Ni.prototype,"le",2);function Ks(o,i,t){let e=t,r=t-1,s=new Array(e);for(let n=r;n>=0;n-=1)s[n]=Math.ceil((n*i+(r-n)*o)/r);return s}function Ld(o){return typeof o=="string"&&o in It}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}function Ud(o,i,t){let e=Pd(o).find(([n,a])=>n<=i&&i<=a);if(!e)return o.map(()=>0);let[r,s]=e;return o.map(n=>{let a=Math.abs(r-s)||1,l=Math.abs(i-r)/a;return r===n?i>t?1:1-l:s===n?i>=t?l:1:0})}function Rd(o,i){return o.map((t,e)=>t<i?o.length-e:e)}function vl(o,i){let t=It[o].keypointsNumber,{range:e,zero:r}=It[o];return [...new Set([...Ks(e[0],r,t+1),...Ks(r,e[1],t+1),r,i])].sort((s,n)=>s-n)}var co=class extends C{constructor(){super();this.z=false;this.Os=true;this.n="initial";this.El={};this.Fe=[];this.Tl=0;this.Sl=I();this.Ar=I();this.classList.add("uc-inactive_to_cropper"),this.Cl=F(async(t,e,r)=>{let s=()=>!this.Al(t,e)||this.Ut!==r||!!this.Fe.find(c=>c.value===r);if(s())return;let n=await this.kl(t,r),a=new Image;a.src=n.src;let l=this._t(n.src);a.addEventListener("load",l,{once:true}),a.addEventListener("error",l,{once:true}),n.image=a,a.classList.add("uc-fader-image"),a.addEventListener("load",()=>{if(s())return;let c=this.Fe,u=c.findIndex(g=>g.value>r);u===-1&&(u=c.length);let h=c[u]?.image,m=this.Ar.value;!m||h&&!m.contains(h)||(c.splice(u,0,n),h?m.insertBefore(a,h):m.appendChild(a),this.Ls(t,r));},{once:true}),a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}_t(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 n=r.get(e);n?.has(t)&&(n.delete(t),this.$["*loadingOperations"]=r);}}Ml(){window.cancelAnimationFrame(this.Tl),this.Tl=window.requestAnimationFrame(()=>{for(let t of this.Fe){let{image:e}=t;e&&(e.style.opacity=t.opacity.toString(),e.style.zIndex=t.zIndex.toString());}});}ot({url:t=this.Bt,filter:e=this.g??void 0,operation:r,value:s}={}){if(!t)throw new Error("URL is not defined");let n={...this.El};r&&(r==="filter"?e&&typeof s=="number"&&(n.filter={name:e,amount:s}):typeof s=="number"&&(n[r]=s));let a=this.offsetWidth;return this.proxyUrl(si(t,a,n))}async kl(t,e){return {src:await this.ot({operation:t,value:e}),image:void 0,opacity:0,zIndex:0,value:e}}Al(t,e){return this.n===t&&this.g===e}set(t){let e=typeof t=="string"?parseInt(t,10):t;!Ld(this.n)||!Number.isFinite(e)||(this.Ls(this.n,e),this.Cl(this.n,this.g,e));}Ls(t,e){this.n=t,this.Ut=e;let{zero:r}=It[t],s=this.Fe.map(l=>l.value),n=Ud(s,e,r),a=Rd(s,r);this.Fe.forEach((l,c)=>{let u=n[c],d=a[c];typeof u=="number"&&(l.opacity=u),typeof d=="number"&&(l.zIndex=d);}),this.Ml();}Ol(){let t=new Image;return t.classList.add("uc-fader-image","uc-fader-image--preview"),t.style.opacity="0",t}async np(){this.c=this.c||this.Ol();let t=this.c;t&&this.Il(t);let e=this.Fe.map(c=>c.src),{images:r,promise:s,cancel:n}=Pi(e);r.forEach(c=>{let u=this._t(c.src);c.addEventListener("load",u),c.addEventListener("error",u);}),this.Is=()=>{n(),this.Is=void 0;};let a=this.n,l=this.g;if(await s,this.z&&this.Al(a,l)){let c=this.Ar.value;if(!c)return;c.replaceChildren(),this.Fe.forEach((u,d)=>{let h=r[d];h&&(h.classList.add("uc-fader-image"),u.image=h,c.appendChild(h));}),this.Ml();}}async setTransformations(t){if(this.El=t,this.c){let e=await this.ot(),r=this._t(e);this.c.src=e,this.c.addEventListener("load",r,{once:true}),this.c.addEventListener("error",r,{once:true}),this.c.style.opacity="1",this.c.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:t,filter:e,operation:r,value:s}){if(!r||typeof s!="number")return;this.Ps?.();let n=vl(r,s),a=await Promise.all(n.map(c=>this.ot({url:t,filter:e,operation:r,value:c}))),{cancel:l}=Pi(a);this.Ps=l;}ap(t){let e=this.c||this.Ol();if(this.Il(e),this.c=e,e.src===t){e.style.opacity="1",e.style.transform="scale(1)",this.className=wt({"uc-active_from_viewer":this.Ci,"uc-active_from_cropper":!this.Ci,"uc-inactive_to_cropper":false});return}e.style.opacity="0";let r=this._t(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=wt({"uc-active_from_viewer":this.Ci,"uc-active_from_cropper":!this.Ci,"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:n}){if(this.z=true,this.Os=false,await this.updateComplete,this.Bt=t,this.n=e??"initial",this.Ut=r,this.g=s,this.Ci=n,typeof r!="number"&&!s){let l=await this.ot({operation:e,value:r});this.ap(l),this.Rs();return}!e||typeof r!="number"||(this.Fe=await Promise.all(vl(e,r).map(l=>this.kl(e,l))),this.Ls(e,r),this.np());}deactivate({hide:t=true}={}){this.z=false,this.Is?.(),this.Ps?.(),t&&!this.Os?(this.Os=true,this.c&&(this.c.style.transform="scale(1)"),this.className=wt({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this.Rs();},{once:true})):this.Rs();}Il(t){let e=this.Sl.value;e&&(e.contains(t)||e.appendChild(t));}Rs(){this.Ar.value?.replaceChildren();}render(){return v`<div class="uc-fader-preview-host" ${O(this.Sl)}></div><div class="uc-fader-layers-host" ${O(this.Ar)}></div>`}};var Nt=class extends C{constructor(){super();this.Us=0;this.kr=I();this.Ll=I();this.Rl=I();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this.Ne=0;this.cp=t=>{t.stopPropagation();let e=this.Ul(t);e!==null&&(this.$s(e),this.lp("slider-input",e));};this.up=t=>{t.stopPropagation();let e=this.Ul(t);e!==null&&this.$s(e);};this.$l=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this.Dl=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}lp(t,e){this.dispatchEvent(new CustomEvent(t,{detail:{value:e},bubbles:true,composed:true}));}firstUpdated(t){super.firstUpdated(t),this.Us=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this.Fl(this.Ne),this.Ds(),this.s=new ResizeObserver(()=>{this.Ds(),this.Mr(this.Ne);}),this.s.observe(this);let e=this.kr.value;e?.addEventListener("focus",this.$l),e?.addEventListener("blur",this.Dl),window.setTimeout(()=>{this.Mr(this.Ne);},0);}willUpdate(t){super.willUpdate(t),t.has("defaultValue")&&this.defaultValue!==this.Ne&&this.$s(this.defaultValue),(t.has("min")||t.has("max"))&&this.hasUpdated&&(this.Ds(),this.Mr(this.Ne)),t.has("zero")&&this.hasUpdated&&this.Nl(this.Ne);}Mr(t){this.Nl(t);let e=this.max-this.min;if(e===0)return;let{width:r}=this.getBoundingClientRect(),a=100/e*(t-this.min)*(r-this.Us)/100;window.requestAnimationFrame(()=>{let l=this.Ll.value;l&&(l.style.transform=`translateX(${a}px)`);});}Nl(t){if(!this.Si)return;let e=this.max-this.min;if(e===0)return;this.Si.style.opacity=t===this.zero?"0":"1";let{width:r}=this.getBoundingClientRect(),a=100/e*(this.zero-this.min)*(r-this.Us)/100;window.requestAnimationFrame(()=>{this.Si&&(this.Si.style.transform=`translateX(${a}px)`);});}Ds(){let e=this.Rl.value;if(!e)return;let{width:r}=e.getBoundingClientRect(),s=Math.ceil(r/2),n=Math.ceil(s/15)-2;if(this.Pl===n)return;let a=document.createDocumentFragment(),l=document.createElement("div"),c=document.createElement("div");l.className="uc-minor-step",c.className="uc-border-step",a.appendChild(c);for(let d=0;d<n;d+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());for(let d=0;d<n;d+=1)a.appendChild(l.cloneNode());a.appendChild(c.cloneNode());let u=document.createElement("div");u.className="uc-zero-dot",a.appendChild(u),this.Si=u,e.innerHTML="",e.appendChild(a),this.Pl=n;}disconnectedCallback(){super.disconnectedCallback();let t=this.kr.value;t?.removeEventListener("focus",this.$l),t?.removeEventListener("blur",this.Dl),this.s?.disconnect(),this.s=void 0;}$s(t){Number.isFinite(t)&&(this.Ne=t,this.hasUpdated&&(this.Fl(t),this.Mr(t)));}Fl(t){let e=this.kr.value;e&&(e.value=String(t));}Ul(t){let e=t.currentTarget;if(!e)return null;let r=Number.parseInt(e.value,10);return Number.isFinite(r)?r:null}render(){return v`<div class="uc-steps" ${O(this.Rl)}></div><div class="uc-thumb" ${O(this.Ll)}></div><input class="uc-input" type="range" ${O(this.kr)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this.Ne)} ?disabled=${this.disabled} @input=${this.cp} @change=${this.up} />`}};p([y({type:Boolean,reflect:true})],Nt.prototype,"disabled",2),p([y({type:Number})],Nt.prototype,"min",2),p([y({type:Number})],Nt.prototype,"max",2),p([y({type:Number,attribute:false})],Nt.prototype,"defaultValue",2),p([y({type:Number})],Nt.prototype,"zero",2),p([f()],Nt.prototype,"Ne",2);var _t="original",_i=class extends C{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this.Fs=t=>{let{value:e}=t.detail;this.$["*faderEl"]?.set(e),this.state={...this.state,value:e};};}setOperation(t,e){this.state={...this.state,operation:t,filter:e},this.dp();let r=this.$["*faderEl"],s=this.state.originalUrl||this.$["*originalUrl"];r&&s&&r.activate({url:s,operation:this.state.operation,value:this.state.filter===_t?void 0:this.state.value,filter:this.state.filter===_t?void 0:this.state.filter,fromViewer:false});}dp(){let t=this.state.operation,{range:e,zero:r}=It[t],[s,n]=e;this.state={...this.state,min:s,max:n,zero:r};let l=this.$["*editorTransformations"][t];if(t==="filter"){let u=Number(n),d=l;if(d){let{name:h,amount:m}=d;u=h===this.state.filter?m:n;}this.state={...this.state,value:u,defaultValue:u};return}let c=typeof l<"u"?l:r;this.state={...this.state,value:c,defaultValue:c};}apply(){let e={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===_t?delete e.filter:e.filter={name:this.state.filter,amount:this.state.value}:e[this.state.operation]=this.state.value,this.$["*editorTransformations"]=e;}cancel(){this.$["*faderEl"]?.deactivate({hide:false});}initCallback(){super.initCallback(),this.sub("*originalUrl",t=>{t&&(this.state={...this.state,originalUrl:t});});}updated(t){if(super.updated(t),t.has("state")){let e=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$["*operationTooltip"]=e;}}render(){return v`<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.Fs} ></uc-slider-ui>`}};p([f()],_i.prototype,"state",2);function ni(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)}}var ut=class extends C{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}get buttonClasses(){let t=this.active;return {"uc-active":t,"uc-not_active":!t}}Vl(){let t=this.buttonClasses;for(let[e,r]of Object.entries(t))this.classList.toggle(e,r);}onClick(t){}connectedCallback(){super.connectedCallback(),this.Vl();}updated(t){super.updated(t),t.has("active")&&this.Vl();}render(){let t=this.onClick,e=this.title;return v`<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>`}};p([f()],ut.prototype,"active",2),p([f()],ut.prototype,"title",2),p([f()],ut.prototype,"icon",2),p([f()],ut.prototype,"titleProp",2);var uo=12,po=16,$d=o=>{let i=12,t=12;return o.width/o.height>=1?(i=uo,t=Math.round(uo*o.height/o.width)):(t=uo,i=Math.round(uo*o.width/o.height)),{width:i,height:t}},ho=class extends ut{initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let t=this.pp(i);this.title=t,this.titleProp=t;});}onClick(){this.$["*showListAspectRatio"]=true;}pp(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 v`<button role="option" type="button" class=${lt(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>`}},Bi=class extends ut{constructor(){super(...arguments);this.te=null;}get aspectRatio(){return this.te}set aspectRatio(t){if(this.te===t)return;let e=this.te;this.te=t,this.requestUpdate("aspectRatio",e),t?this._l(t):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this.te&&this._l(this.te),this.sub("*currentAspectRatio",t=>{this.active=t&&t.id===this.te?.id||t?.width===this.te?.width&&t?.height===this.te?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this.te?.id&&(this.$["*currentAspectRatio"]=this.te);}_l(t){if(!this.isConnected)return;let e=!!t.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",e);let r=()=>{let n=e?this.l10n("custom"):`${t.width}:${t.height}`;return this.title=n,n},s=()=>{let n=this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:e?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${t.width}:${t.height}`}).toLowerCase(),value:""});return this.titleProp=n,n};r(),s(),e||this.requestUpdate();}hp(){let t=this.te;if(!t||t.hasFreeform)return v`<uc-icon name=${this.icon}></uc-icon>`;let{width:e,height:r}=$d(t),s=(po-e)/2,n=(po-r)/2;return v`<uc-icon><svg viewBox="0 0 ${po} ${po}" aria-hidden="true" focusable="false" ><rect x=${s} y=${n} 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 v`<button role="option" type="button" class=${lt(this.buttonClasses)} aria-label=${W(this.titleProp)} title=${W(this.titleProp)} @click=${t} >${this.hp()}<div class="uc-title" ?hidden=${!e}>${e}</div></button>`}};p([y({attribute:false})],Bi.prototype,"aspectRatio",1);function Dd(o){let i=o+90;return i=i>=360?0:i,i}function Fd(o,i){if(o==="rotate")return Dd(typeof i=="number"?i:0);if(o==="mirror"||o==="flip")return !i;throw new Error(`Unsupported operation: ${o}`)}var zi=class extends ut{constructor(){super(...arguments);this.operation=void 0;}willUpdate(t){super.willUpdate(t),this.operation?(this.titleProp=this.l10n("a11y-cloud-editor-apply-crop",{name:this.l10n(this.operation).toLowerCase()}),this.icon=this.operation):(this.icon="",this.titleProp="");}onClick(t){if(!this.operation)return;let e=this.$["*cropperEl"],r=e.getValue(this.operation),s=Fd(this.operation,r);this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:this.operation,next:s,prev:r}),e.setValue(this.operation,s);}};p([y({type:String})],zi.prototype,"operation",2);var te=class extends ut{constructor(){super(...arguments);this.n="";this.g="";this.Ai="";this.Or=0;this.c=null;this.Ht=false;this.isOriginal=false;this.Bl=20;}get filter(){return this.g}set filter(t){let e=t??"";if(this.g===e)return;let r=this.g;this.g=e,this.n="filter",this.isOriginal=e===_t,this.icon=this.isOriginal?"original":"slider",this.Bl=this.isOriginal?40:20,this.requestUpdate("filter",r),this.isConnected&&this.zl(e);}onClick(t){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this.n,this.g),this.$["*showSlider"]=true);else {let e=this.$["*sliderEl"];e.setOperation(this.n,this.g),e.apply();}this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{operation:ni(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this.g;}fp(){let t=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),e=Number.isFinite(t)&&t>0?t:this.Bl||32,r=window.devicePixelRatio,s=Math.ceil(r*e),n=r>=2?"lightest":"normal",a=100,l={...this.$["*editorTransformations"]};return l[this.n]=this.g!==_t?{name:this.g,amount:a}:void 0,Z(this.Ai,ot(fr,oe(l),`quality/${n}`,`scale_crop/${s}x${s}/center`,`@clib/${Ut}/${Rt}/uc-cloud-image-editor/`))}async pi(t,e){t[0]?.isIntersecting?await this.Ns(e):this.w?.();}initCallback(){super.initCallback(),this.s=new window.IntersectionObserver(this.pi.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.c&&(this.s?.observe(this),this.at());}),this.isOriginal||(this.s?.observe(this),this.at()),this.g&&this.zl(this.g),this.sub("*currentFilter",e=>{this.active=!!(e&&e===this.g);}),this.sub("*networkProblems",async e=>{e||(this.c?await this.Ns():this.at());});}disconnectedCallback(){super.disconnectedCallback(),this.s?.disconnect(),this.w?.(),this.Ir();}updated(t){super.updated(t),t.has("isOriginal")&&(this.isOriginal?this.s?.unobserve(this):(this.s?.observe(this),this.at()));}zl(t){if(!t){this.titleProp="";return}let e=this.l10n("a11y-cloud-editor-apply-filter",{name:t.toLowerCase()});this.titleProp=e;}async Ns(t){if(!this.isConnected){t?.unobserve(this),this.w?.(),this.w=void 0;return}if(!this.Ai){!this.zt&&!this.Ve&&this.at();return}let e=++this.Or,r="";try{r=await this.proxyUrl(this.fp());}catch(a){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:a});return}this.Ht=false,this.w?.();let{promise:s,cancel:n}=Ie(r);this.w=()=>{n(),this.Or===e&&(this.w=void 0);};try{if(await s,this.Or!==e||!this.isConnected)return;this.c=r,this.Ht=!0,this.Ir(),(t??this.s)?.unobserve(this);}catch(a){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:a}),this.at();}finally{this.Or===e&&(this.w=void 0);}}at(){if(!this.isConnected||this.c||this.Ht||this.isOriginal||this.$["*networkProblems"]){this.Ir();return}this.Ve&&cancelAnimationFrame(this.Ve),this.Ve=requestAnimationFrame(()=>{if(this.Ve=void 0,!this.isConnected||this.c||this.Ht||this.isOriginal){this.Ir();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.Ns();return}this.zt=window.setTimeout(()=>{this.zt=void 0,this.at();},500);});}Ir(){this.Ve&&(cancelAnimationFrame(this.Ve),this.Ve=void 0),this.zt&&(window.clearTimeout(this.zt),this.zt=void 0);}get mp(){return !!(this.Ht&&!this.active&&!this.isOriginal)}render(){let t=this.onClick,e={opacity:this.mp?"1":"0"};this.c&&(e.backgroundImage=`url(${this.c})`);let r={opacity:this.active||this.isOriginal?"1":"0"};return v`<button role="option" type="button" class=${lt(this.buttonClasses)} aria-label=${W(this.titleProp)} title=${W(this.titleProp)} @click=${t} ><div class="uc-preview" ?data-loaded=${this.Ht} style=${Qt(e)}></div><uc-icon class=${lt({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${Qt(r)} ></uc-icon></button>`}};p([f()],te.prototype,"c",2),p([f()],te.prototype,"Ht",2),p([f()],te.prototype,"isOriginal",2),p([f()],te.prototype,"Bl",2),p([y({type:String})],te.prototype,"filter",1);var Hi=class extends ut{constructor(){super(...arguments);this.n="";}get operation(){return this.n}set operation(t){let e=t??"";if(this.n===e)return;let r=this.n;this.n=e,this.requestUpdate("operation",r),this.isConnected&&e&&this.Hl(e);}Hl(t){this.icon=t;let e=()=>{let s=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(t).toLowerCase()});return this.titleProp=s,s},r=()=>{let s=this.l10n(t);return this.title=s,s};e(),r();}initCallback(){super.initCallback(),this.n&&this.Hl(this.n),this.sub("*editorTransformations",t=>{if(!this.n)return;let{zero:e}=It[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:ni(this.$["*operationTooltip"])});}};p([y({type:String})],Hi.prototype,"operation",1);var Vd=1,yl=()=>{},Ki=class extends C{constructor(){super(...arguments);this.hiddenScrollbar=false;this.Kl=t=>{t.preventDefault();let{deltaY:e,deltaX:r}=t;if(Math.abs(r)>Vd){this.scrollLeft+=r;return}this.scrollLeft+=e;};}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this.Kl,{passive:false}),this.addEventListener("scroll",yl,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this.Kl),this.removeEventListener("scroll",yl),super.disconnectedCallback();}};p([y({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],Ki.prototype,"hiddenScrollbar",2);var ft=class extends C{constructor(){super(...arguments);this.ki=false;this.showMainToolbar=true;this.showSubToolbar=false;this.jl=true;this.tabList=[...st];this.activeTab=z.CROP;this.Pr=true;this.Vs=false;this.Gl=null;this.ql=0;this.Wl=0;this.Lr=I();this.Zl=I();this.tabToggleRefs={[z.CROP]:I(),[z.TUNING]:I(),[z.FILTERS]:I()};this.Yl=()=>{this.pt();};this.Mi=[];this.Rr=F(t=>{this.ki=t;},500);this.Ur=F(()=>{let t=this.$["*editorTransformations"],e=this.$["*currentOperation"],r="",s=false;if(this.$["*tabId"]===z.FILTERS)if(s=true,this.$["*currentFilter"]&&t?.filter?.name===this.$["*currentFilter"]){let n=t?.filter?.amount||100;r=`${this.$["*currentFilter"]} ${n}`;}else r=this.l10n(_t);else if(this.showSubToolbar&&this.$["*tabId"]===z.TUNING&&e){s=true;let n=t?.[e]||It[e].zero;r=`${this.l10n(e)} ${n}`;}s&&(this.$["*operationTooltip"]=r),this.Vs=s;},0);this.gp={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this.vp={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this.yp={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this.bp={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":_t,"*currentOperation":null,"*operationTooltip":null};this.Ce=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel"}),this.w?.();let e=this.$["*on.cancel"];e?.();};this.Hs=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply"});let e=this.$["*on.apply"];e?.(this.$["*editorTransformations"]);};this.Ip=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"apply-slider",operation:ni(this.$["*operationTooltip"])}),this.Lr.value?.apply(),this.Xl();};this.Pp=t=>{this.telemetryManager.sendEventCloudImageEditor(t,this.$["*tabId"],{action:"cancel-slider"}),this.Lr.value?.cancel(),this.Xl();};this.Lp=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&(this.telemetryManager.sendEventCloudImageEditor(t,r),this._s(r,{fromViewer:false}));};}Xl(){this.$["*showSlider"]=false,this.$["*tabId"]===z.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===z.TUNING&&(this.Vs=false);}_s(t,{fromViewer:e=false,force:r=false}={}){this.$["*tabId"]!==t&&(this.$["*tabId"]=t),this.Ql(t,{fromViewer:e,force:r});}Ql(t,{fromViewer:e,force:r=false}){if(!r&&this.activeTab===t){this.pt();return}this.activeTab=t;let s=this.$["*faderEl"],n=this.$["*cropperEl"];t===z.CROP?(s?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:e})):(s?.activate({url:this.$["*originalUrl"],fromViewer:e}),n?.deactivate());for(let a of st){let l=a===t,u=this.tabToggleRefs[a]?.value;u&&(u.active=l),l&&this.pt();}}pt(){let e=this.tabToggleRefs[this.activeTab]?.value,r=this.Zl.value;if(!e||!r)return;let s=e.offsetLeft,n=e.offsetWidth||Number(getComputedStyle(e).width.replace("px",""));(this.ql!==s||this.Wl!==n)&&(this.ql=s,this.Wl=n,r.style.transform=`translateX(${s}px)`,r.style.width=`${n}px`);}get Bs(){return this.Mi.length>=3}wp(t){switch(t){case z.CROP:return this.xp();case z.FILTERS:return this.Ep();case z.TUNING:return this.Tp();default:return []}}xp(){let t=[];if(this.Bs)t.push(()=>this.Cp());else for(let e of this.Mi)t.push(()=>this.Jl(e));for(let e of Ln)t.push(()=>this.Sp(e));return this.zs(t)}Ep(){let e=[_t,...On].map(r=>()=>this.Ap(r));return this.zs(e)}Tp(){let t=In.map(e=>()=>this.kp(e));return this.zs(t)}zs(t){return t.length?t.map(r=>r()):[]}Cp(){return v`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}Jl(t){return v`<uc-editor-aspect-ratio-button-control .aspectRatio=${t}></uc-editor-aspect-ratio-button-control>`}Sp(t){return v`<uc-editor-crop-button-control .operation=${t}></uc-editor-crop-button-control>`}Ap(t){return v`<uc-editor-filter-control .filter=${t}></uc-editor-filter-control>`}kp(t){return v`<uc-editor-operation-control .operation=${t}></uc-editor-operation-control>`}Mp(){return this.Bs?this.Mi.map(t=>this.Jl(t)):[]}async Op(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let t=this.$["*imgContainerEl"].offsetWidth,e=await this.proxyUrl(si(this.$["*originalUrl"],t,this.$["*editorTransformations"]));this.w?.();let{cancel:r}=Pi([e]);this.w=()=>{r(),this.w=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._s(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",e=>{let r=e?.filter?.name;this.$["*currentFilter"]!==r&&(this.$["*currentFilter"]=r??"");}),this.sub("*currentFilter",()=>{this.Ur();}),this.sub("*currentOperation",()=>{this.Ur();}),this.sub("*tabId",e=>{this.Ql(e,{fromViewer:false,force:true}),this.Ur();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",e=>{this.Op(),this.$["*faderEl"]?.setTransformations(e);}),this.sub("*loadingOperations",e=>{let r=false;for(let[,s]of e.entries()){if(r)break;for(let[,n]of s.entries())if(n){r=true;break}}this.Rr(r);}),this.sub("*showSlider",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Pr=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",e=>{e?(this.showSubToolbar=true,this.showMainToolbar=false,this.Pr=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",e=>{if(this.tabList=e,this.jl=e.length>1,!e.includes(this.$["*tabId"])&&e.length>0){let[r]=e;r&&this._s(r,{fromViewer:false});return}this.pt();}),this.sub("*operationTooltip",e=>{this.Gl=e;}),this.Ur();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this.Yl);}firstUpdated(t){super.firstUpdated(t),this.$r(),this.pt();}updated(t){super.updated(t),(t.has("activeTab")||t.has("tabList"))&&this.updateComplete.then(()=>this.pt()),(t.has("showSubToolbar")||t.has("showMainToolbar"))&&this.$r();}disconnectedCallback(){window.removeEventListener("resize",this.Yl),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}$r(){let t=this.Lr.value;t&&(this.$["*sliderEl"]=t);}Rp(t){let e=this.tabList.includes(t),r=this.activeTab===t,s=this.tabList.indexOf(t),n=s>=0?Qt({gridColumn:`${s+1}`}):U;return v`<uc-presence-toggle class="uc-tab-toggle" .visible=${e} .styles=${this.yp}><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=${n} @click=${this.Lp} ${O(this.tabToggleRefs[t])} ></uc-btn-ui></uc-presence-toggle>`}Up(t){let e=this.wp(t);return v`<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.Vs?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),e=this.Bs;return v`<uc-line-loader-ui .active=${this.ki}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${t}>${this.Gl??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this.gp} ><div class="uc-tab-content-row">${st.map(r=>Di(this.activeTab===r,()=>this.Up(r)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this.jl} .styles=${this.bp} @initial-render=${()=>this.pt()} ><div class="uc-tab-toggles_indicator" ${O(this.Zl)} ></div>${st.map(r=>this.Rp(r))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this.Ce} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this.Hs}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this.vp}><div class="uc-slider" ?hidden=${!this.Pr}><uc-editor-slider ${O(this.Lr)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this.Pr||!e}>${e?v`<div class="uc-list-aspect-ratio">${this.Mp()}</div>`:U}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this.Pp} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this.Ip} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};p([f()],ft.prototype,"ki",2),p([f()],ft.prototype,"showMainToolbar",2),p([f()],ft.prototype,"showSubToolbar",2),p([f()],ft.prototype,"jl",2),p([f()],ft.prototype,"tabList",2),p([f()],ft.prototype,"activeTab",2),p([f()],ft.prototype,"Pr",2),p([f()],ft.prototype,"Vs",2),p([f()],ft.prototype,"Gl",2),p([f()],ft.prototype,"Mi",2);var bl=Kt([...st]),et=class extends C{constructor(){super(...arguments);this.ctxOwner=true;this.$p="";this.ot=Ot;this.Dp="";this.ki=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=bl;this.ec=false;this.Ie=false;this.Ks=null;this.Oi=null;this.Rr=F(t=>{this.ki=t;},300);this.Dr=I();this.tc=I();this.ic=I();this.rc=I();this.oc=()=>{this.Rr(false),this.ot!==Ot&&(this.$["*networkProblems"]=false);};this.sc=()=>{this.Rr(false),this.$["*networkProblems"]=true;};this.Fp=()=>{let t=this.$["*on.retryNetwork"];t?.();};this.init$={...this.init$,...ml(this)};}static{this.styleAttrs=["uc-cloud-image-editor"];}Np(){this.Ie||this.Ks||(this.Ks=this.updateComplete.then(()=>{this.Ks=null,this.Ie=true;}));}initCallback(){super.initCallback(),this.nc(),this.ac();}$r(){let t=this.ic.value;t&&(this.$["*faderEl"]=t);let e=this.tc.value;e&&(this.$["*cropperEl"]=e);let r=this.rc.value;r&&(this.$["*imgContainerEl"]=r);let s=this.Dr.value;s&&(this.$["*imgEl"]=s);}Vp(){let t=this.Dr.value;t&&(t.addEventListener("load",this.oc),t.addEventListener("error",this.sc));}_p(){let t=this.Dr.value;t&&(t.removeEventListener("load",this.oc),t.removeEventListener("error",this.sc));}get Bp(){let t=this.$["*tabId"];return wt("uc-image",{"uc-image_hidden_to_cropper":t===z.CROP,"uc-image_hidden_effects":t!==z.CROP})}cc(){if(this.Oi)return this.Oi;let t=3e3;return this.Oi=new Promise((e,r)=>{let s=()=>{window.clearTimeout(u),c.disconnect(),this.Oi=null;},n=()=>{let{width:d,height:h}=this.getBoundingClientRect();return d>0&&h>0},a=()=>{s(),window.setTimeout(()=>e(),0);},l=()=>{let d=new Error("[cloud-image-editor] timeout waiting for non-zero container size");s(),this.isConnected&&console.error(d.message),r(d);},c=new ResizeObserver(d=>{let[h]=d;h&&h.contentRect.width>0&&h.contentRect.height>0&&a();}),u=window.setTimeout(()=>{l();},t);if(n()){a();return}c.observe(this);}),this.Oi}firstUpdated(t){super.firstUpdated(t),this.$r(),this.Vp(),this.initEditor();let e=!!(this.uuid||this.cdnUrl),r=t.has("uuid")||t.has("cdnUrl");e&&!r&&this.updateImage();}disconnectedCallback(){this._p(),super.disconnectedCallback();}render(){let t=this.Dp??"",e=this.$p??"",r=this.ot||Ot,s=this.ki,n=this.ec;return v` ${He(fl)}<div class="uc-wrapper uc-wrapper_desktop"><uc-presence-toggle class="uc-network_problems_splash" .visible=${n}><div class="uc-network_problems_content"><div class="uc-network_problems_icon"><uc-icon name="sad"></uc-icon></div><div class="uc-network_problems_text">Network error</div></div><div class="uc-network_problems_footer"><uc-btn-ui theme="primary" text="Retry" @click=${this.Fp}></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" ${O(this.rc)}><img src=${r} class=${this.Bp} ${O(this.Dr)} />${Di(this.Ie,()=>v`<uc-editor-image-cropper ${O(this.tc)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${O(this.ic)}></uc-editor-image-fader></div><div class="uc-info_pan">${e}</div></div><div class="uc-toolbar"><uc-line-loader-ui .active=${s}></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor">${Di(this.Ie,()=>v`<uc-editor-toolbar></uc-editor-toolbar>`)}</div></div></div>`}updated(t){super.updated(t),t.has("uuid")&&this.uuid&&this.updateImage(),t.has("cdnUrl")&&this.cdnUrl&&this.updateImage(),t.has("tabs")&&this.nc(),(t.has("cropPreset")||t.has("cdnUrl"))&&this.ac();}nc(){let t=this.tabs||bl;this.$["*tabList"]=hl(t);}ac(){let t=Zr(this.cropPreset??""),e=null;if(this.cdnUrl){let r=Fo(this.cdnUrl),s=Vo(r);if(Array.isArray(s?.crop?.dimensions)){let[n,a]=s.crop.dimensions;e=Oa(n,a,t,.1);}}this.$["*cropPresetList"]=t,this.$["*currentAspectRatio"]=e??t?.[0]??null;}async updateImage(){if(this.isConnected){try{await this.cc();}catch{return}if(this.isConnected){if(this.cdnUrl){let t=this.cdnUrl,e=mr(t),r=re(t,e);if(r===this.$["*originalUrl"])return;this.$["*originalUrl"]=r;let s=Fo(t),n=Vo(s);this.$["*editorTransformations"]=n;}else if(this.uuid){let t=re(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"]===z.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let t=this.$["*originalUrl"],e=await this.proxyUrl(Z(t,ot("json"))),r=await fetch(e).then(a=>a.json()),{width:s,height:n}=r;this.$["*imageSize"]={width:s,height:n},this.$["*tabId"]===z.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.Np();}}}async initEditor(){try{await this.cc();}catch{return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",t=>{let e=!!t;this.ec=e;}),this.sub("*editorTransformations",t=>{if(Object.keys(t).length===0)return;let e=this.$["*originalUrl"],r=ot(oe(t),"preview"),s=Z(e,r),n={originalUrl:e,cdnUrlModifiers:r,cdnUrl:s,transformations:t};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};p([f()],et.prototype,"$p",2),p([f()],et.prototype,"ot",2),p([f()],et.prototype,"Dp",2),p([f()],et.prototype,"ki",2),p([y({type:String,reflect:true})],et.prototype,"uuid",2),p([y({type:String,attribute:"cdn-url",reflect:true})],et.prototype,"cdnUrl",2),p([y({type:String,attribute:"crop-preset",reflect:true})],et.prototype,"cropPreset",2),p([y({type:String,reflect:true})],et.prototype,"tabs",2),p([f()],et.prototype,"ec",2),p([f()],et.prototype,"Ie",2);var js={};Ys(js,{CloudImageEditorActivity:()=>ji});var mo=class extends et{static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:V.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var ji=class extends M{constructor(){super(...arguments);this.ie=null;}get activityParams(){let t=super.activityParams;if("internalId"in t)return t;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.subConfigValue("cropPreset",t=>{this.ie&&this.ie.cropPreset!==t&&(this.ie={...this.ie,cropPreset:t});}),this.subConfigValue("cloudImageEditorTabs",t=>{this.ie&&this.ie.tabs!==t&&(this.ie={...this.ie,tabs:t});}),this.zp();}disconnectedCallback(){super.disconnectedCallback(),this.Hp();}Hs(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($.activities.CLOUD_IMG_EDIT),this.historyBack();}Ce(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close($.activities.CLOUD_IMG_EDIT),this.historyBack();}handleChange(t){this.debugPrint('editor event "change"',t.detail);}zp(){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.ie=this.Kp(r);}Hp(){this.Ii=void 0,this.ie=null;}render(){if(!this.ie)return U;let{cdnUrl:t,cropPreset:e,tabs:r}=this.ie;return v`<uc-cloud-image-editor cdn-url=${t} crop-preset=${W(e)} tabs=${W(r)} @apply=${this.Hs} @cancel=${this.Ce} @change=${this.handleChange} ></uc-cloud-image-editor>`}Kp(t){return {cdnUrl:t,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}};p([f()],ji.prototype,"ie",2);var ai=class extends M{constructor(){super(...arguments);this.Bt="";this.Fs=t=>{this.Bt=t.target?.value??"";};this.ss=t=>{t.preventDefault(),this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"upload-from-url",node:this.tagName}}});let e=this.Bt.trim();e&&(this.api.addFileFromUrl(e,{source:P.URL}),this.routerLayer.navigateAfterFileAdd());};}render(){return v`<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.ss}><label><input placeholder="https://" class="uc-url-input" type="text" autofocus @input=${this.Fs} /></label><button type="submit" class="uc-url-upload-btn uc-primary-btn" ?disabled=${!this.Bt} >${this.l10n("upload-url")}</button></form>`}};p([f()],ai.prototype,"Bt",2);var wl=()=>{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}};var Nd=o=>o.replace(/[\\-\\[]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),El=(o,i="i")=>{let t=o.split("*").map(Nd);return new RegExp(`^${t.join(".+")}$`,i)};var _d=["--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"],Bd=(o,i)=>window.getComputedStyle(o).getPropertyValue(i).trim(),Tl=o=>{let i={};for(let t of _d){let e=Bd(o,t);e&&(i[t]=e);}return i};var zd=["selected-files-change","toolbar-state-change"],Hd=o=>{if(!o||typeof o!="object"||!("type"in o))return false;let i=o.type;return !(typeof i!="string"||!zd.includes(i))},fo=class{constructor(i,t){this.Fr=new Map;this.dc=i=>{if(i.source!==this.js)return;let t=i.data;if(!Hd(t))return;let e=this.Fr.get(t.type);if(e)for(let r of e)r(t);};this.js=i,this.uc=t,window.addEventListener("message",this.dc);}on(i,t){let e=this.Fr.get(i)??new Set;this.Fr.has(i)||this.Fr.set(i,e),e.add(t);}send(i){let t=this.uc();this.js.postMessage(i,t);}destroy(){window.removeEventListener("message",this.dc);}};function Cl(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("&")}var Kd={[mt.GDRIVE]:"ngdrive"},gt=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this.Kt=I();this.Nr=null;this.Gs=[];this.qs=false;this.Ws=false;this.Zs=false;this.Ys=false;this.Vr=false;this.Xs=false;this.Qs="uc-hidden";this.pc=true;this.ns=()=>{for(let t of this.Gs){let e=this.Gp(t),{filename:r}=t,{externalSourceType:s}=this.activityParams;this.api.addFileFromUrl(e,{fileName:r,source:s});}this.routerLayer.navigateAfterFileAdd();};this.Ce=()=>{this.historyBack();};this.Qp=()=>{this.ce?.send({type:"select-all"});};this.Jp=()=>{this.ce?.send({type:"deselect-all"});};}get jp(){if(!this.Nr)return "";let{selectedCount:t,total:e}=this.Nr;return this.l10n("selected-count",{count:t,total:e})}get activityParams(){let t=super.activityParams;if("externalSourceType"in t)return t;throw new Error("External Source activity params not found")}initCallback(){super.initCallback();let{externalSourceType:t}=this.activityParams;t?this.hc():console.error('Param "externalSourceType" is required for external source activity'),this.sub("*currentActivityParams",()=>{setTimeout(()=>{this.isConnected&&(this.fc(),this.hc());});}),this.subConfigValue("multiple",e=>{this.Vr=e;}),this.subConfigValue("localeName",()=>{this.mc();}),this.subConfigValue("externalSourcesEmbedCss",e=>{this.gc(e);});}Gp(t){if(t.alternatives){let e=Y(this.cfg.externalSourcesPreferredTypes);for(let r of e){let s=El(r);for(let[n,a]of Object.entries(t.alternatives))if(s.test(n))return a}}return t.url}qp(t){this.pc=t.isVisible;}async Wp(t){if(this.cfg.multiple!==t.isMultipleMode){console.error("Multiple mode mismatch");return}this.Zp(t.selectedCount,t.total),this.Qs=t.isReady?"":"uc-hidden",this.qs=t.isReady,this.Ws=t.isReady&&t.selectedFiles.length>0,this.Vr=t.isMultipleMode&&t.total>0,this.Zs=t.selectedCount<t.total,this.Ys=t.selectedCount===t.total,this.Gs=t.selectedFiles??[],this.Xs=t.total>0;}vc(){this.gc(this.cfg.externalSourcesEmbedCss),this.Yp(),this.mc();}Yp(){this.ce?.send({type:"set-theme-definition",theme:Tl(this)});}gc(t){this.ce?.send({type:"set-embed-css",css:t});}mc(){this.ce?.send({type:"set-locale-definition",localeDefinition:this.cfg.localeName});}Xp(){let{pubkey:t,remoteTabSessionKey:e,socialBaseUrl:r,multiple:s}=this.cfg,{externalSourceType:n}=this.activityParams,a=Kd[n]??n,c={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||wl(),debug:this.cfg.debug},u=new URL(`/window4/${a}`,r);return u.search=Cl(c),u.toString()}Zp(t,e){this.Nr={selectedCount:t,total:e};}hc(){let t=document.createElement("iframe");t.src=this.Xp(),t.marginHeight=0,t.marginWidth=0,t.frameBorder="0",t.allowTransparency=true,t.addEventListener("load",this.vc.bind(this)),t.addEventListener("load",this.vc.bind(this)),this.Kt.value&&(this.Kt.value.innerHTML="",this.Kt.value.appendChild(t)),t.contentWindow&&(this.ce?.destroy(),this.ce=new fo(t.contentWindow,()=>this.cfg.socialBaseUrl),this.ce.on("selected-files-change",this.Wp.bind(this)),this.ce.on("toolbar-state-change",this.qp.bind(this)),this.yc());}fc(){this.ce?.destroy(),this.ce=void 0,this.Kt.value&&(this.Kt.value.innerHTML=""),this.yc();}yc(){this.Gs=[],this.qs=false,this.Ws=false,this.Zs=false,this.Ys=false,this.Vr=false,this.Xs=false,this.Qs="uc-hidden",this.Nr=null;}disconnectedCallback(){super.disconnectedCallback(),this.fc();}render(){return v`<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 ${O(this.Kt)} class="uc-iframe-wrapper"></div><div class="uc-toolbar" ?hidden=${!this.pc}><button type="button" class="uc-cancel-btn uc-secondary-btn" @click=${this.Ce} >${this.l10n("cancel")}</button><div class="uc-selection-status-box" ?hidden=${!this.Vr} ><span>${this.jp}</span><button type="button" @click=${this.Qp} ?hidden=${!this.Zs} >${this.l10n("select-all")}</button><button type="button" @click=${this.Jp} ?hidden=${!this.Ys} >${this.l10n("deselect-all")}</button></div><button type="button" class="uc-done-btn uc-primary-btn" @click=${this.ns} ?disabled=${!this.Ws} ?hidden=${!this.Xs} ><uc-spinner ?hidden=${this.qs}></uc-spinner><span class=${this.Qs}>${this.l10n("done")}</span></button></div></div>`}};p([f()],gt.prototype,"Gs",2),p([f()],gt.prototype,"qs",2),p([f()],gt.prototype,"Ws",2),p([f()],gt.prototype,"Zs",2),p([f()],gt.prototype,"Ys",2),p([f()],gt.prototype,"Vr",2),p([f()],gt.prototype,"Xs",2),p([f()],gt.prototype,"Qs",2),p([f()],gt.prototype,"pc",2);var xl=()=>typeof navigator.permissions<"u";var jd={width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},Gd=["camera","microphone"];function go(o){let i=Math.floor(o/60).toString().padStart(2,"0"),t=Math.floor(o%60).toString().padStart(2,"0");return `${i}:${t}`}var Sl="image/jpeg",Al="video/webm",B=class extends M{constructor(){super(...arguments);this.couldBeCtxOwner=true;this._r=null;this.Js=false;this.Pi=[];this.ye=null;this.be=null;this.Br=null;this.zr=null;this.v=null;this.Li={};this.ve=null;this.i=null;this.jt=[];this.Gt=[];this.eh={};this.Hr=[];this.Kr=null;this.bc=()=>{this.wc(),this.Ri="pause";};this.xc=()=>{this.Ri="play",this.th();};this.Ui=I();this.Je=I();this.W=I();this.Ec=0;this.Tc=0;this.Cc=null;this.jr=true;this.Gr=true;this.ih=xl();this.Sc=[];this.mt=true;this.en="";this.qt=true;this.gt=true;this.Wt=true;this.Ac=[];this.vt=true;this.tn=true;this.yt=true;this.Ae=true;this.bt=true;this.Zt="camera-full";this.Ri="play";this.kc="microphone";this.qr="uc-shot-btn uc-camera-action";this.rh=()=>{if(this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"start-camera",node:this.tagName,tabId:this.v}}}),this.v===L.PHOTO&&this.oh(),this.v===L.VIDEO){if(this.ye?.state==="recording"){this.Mc();return}this.sh();}};this.nh=t=>{let e=t.target;e&&(this.zr=e.value,this.Yt());};this.ah=t=>{let e=t.target;e&&(this.Br=e.value,this.Yt());};this.lh=()=>{this.Yt();};this.ch=()=>{this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"shot-camera",node:this.tagName,tabId:this.v}}}),this.rh();};this.uh=()=>{this.dh();};this.ph=()=>{this.hh();};this.fh=()=>{this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"retake-camera",node:this.tagName,tabId:this.v}}}),this.mh();};this.gh=()=>{this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"accept-camera",node:this.tagName,tabId:this.v}}}),this.vh();};this.Oc=t=>{let r=t.currentTarget?.getAttribute("data-id");r&&this.Ic(r);};this.Pc=()=>{let t=Math.floor((performance.now()-this.Ec+this.Tc)/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=go(e)),this.Mc();return}let r=this.Ui.value;r&&(r.textContent=go(e));}else {let e=this.Ui.value;e&&(e.textContent=go(t));}this.Xt=requestAnimationFrame(this.Pc);};this.yh=()=>{this.Ec=performance.now(),this.Tc=0,this.Pc();};this.Lc=()=>{this.Xt&&cancelAnimationFrame(this.Xt);};this.wc=()=>{let t=this.W.value;if(!t)return;let e=t.currentTime,r=t.duration||1,s=this.Je.value;s&&(s.style.transform=`scaleX(${e/r})`);let n=this.Ui.value;n&&(n.textContent=go(e)),this.Xt=requestAnimationFrame(this.wc);};this.th=()=>{this.Xt&&cancelAnimationFrame(this.Xt);};this.Xt=null;this.sh=()=>{try{this.Pi=[],this.Li={...this.cfg.mediaRecorderOptions};let{mimeType:t}=this.cfg.mediaRecorderOptions||{};t&&MediaRecorder.isTypeSupported(t)?this.Li.mimeType=t:MediaRecorder.isTypeSupported(Al)?this.Li.mimeType=Al:this.Li.mimeType="video/mp4",this.be&&(this.ye=new MediaRecorder(this.be,this.Li),this.ye.start(),this.ye.addEventListener("dataavailable",e=>{this.Pi.push(e.data);}),this.yh(),this.classList.add("uc-recording"),this.$i(St.PLAY));}catch(t){console.error("Failed to start recording",t),this.telemetryManager.sendEventError(t,"camera recording. Failed to start recording");}};this.Mc=()=>{this.ye?.addEventListener("stop",()=>{this.bh(),this.Lc(),this.$i(St.STOP);}),this.ye?.stop(),this.classList.remove("uc-recording"),this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"stop-camera",node:this.tagName,tabId:this.v}}});};this.dh=()=>{if(this.ye?.state==="recording")return;let t=this.W.value;t&&(!t.paused&&!t.ended&&t.readyState>2?t.pause():t.paused&&t.play());};this.hh=()=>{this.be?.getAudioTracks().forEach(t=>{t.enabled=!t.enabled,this.kc=t.enabled?"microphone":"microphone-mute",this.tn=!t.enabled;});};this.bh=()=>{try{let t=new Blob(this.Pi,{type:this.ye?.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.wh(r);}catch(t){console.error("Failed to preview video",t),this.telemetryManager.sendEventError(t,"camera previewing. Failed to preview video");}};this.mh=()=>{if(this.$i(St.RETAKE),this.v===L.VIDEO){this.Di(this.be);let t=this.W.value;t&&(t.muted=true);}this.W.value?.play?.();};this.vh=()=>{if(this.$i(St.ACCEPT),this.v===L.PHOTO){this.ve?.toBlob(s=>{if(!s)return;let n=this.Rc("camera","jpeg",Sl,s);this.Uc(n);},Sl);return}let t=new Blob(this.Pi,{type:this.ye?.mimeType}),e=this.xh(this.ye?.mimeType),r=this.Rc("video",e,`video/${e}`,t);this.Uc(r),this.Pi=[];};this.Eh=t=>{t===St.SHOT&&(this.bt=true,this.gt=true,this.Ae=true,this.Wt=false,this.mt=true),(t===St.RETAKE||t===St.ACCEPT)&&(this.bt=!this.ke.includes(L.VIDEO),this.Ae=!this.ke.includes(L.PHOTO),this.gt=false,this.Wt=true,this.mt=this.jt.length<=1);};this.Th=t=>{t===St.PLAY&&(this.qt=false,this.Ae=true,this.mt=true,this.vt=true,this.Ri="pause",this.Zt="square",this.qr="uc-shot-btn uc-camera-action uc-stop-record"),t===St.STOP&&(this.qt=false,this.gt=true,this.yt=true,this.Wt=false),(t===St.RETAKE||t===St.ACCEPT)&&(this.qt=true,this.bt=!this.ke.includes(L.VIDEO),this.Ae=!this.ke.includes(L.PHOTO),this.gt=false,this.Wt=true,this.yt=!this.cfg.enableAudioRecording,this.Zt="video-camera-full",this.qr="uc-shot-btn uc-camera-action",this.vt=!this.cfg.enableAudioRecording||this.Gt.length<=1,this.mt=this.jt.length<=1);};this.$i=t=>{this.v===L.PHOTO&&(t==="shot"||t==="retake"||t==="accept")&&this.Eh(t),this.v===L.VIDEO&&(t==="play"||t==="stop"||t==="retake"||t==="accept"||t==="pause"||t==="resume")&&this.Th(t);};this.Ic=t=>{t===L.PHOTO&&(this.Zt="camera-full",this.vt=true,this.yt=true),t===L.VIDEO&&(this.Ri="play",this.Zt="video-camera-full",this.vt=!this.cfg.enableAudioRecording||this.Gt.length<=1,this.yt=!this.cfg.enableAudioRecording),this.telemetryManager.sendEvent({eventType:V.ACTION_EVENT,payload:{metadata:{event:"camera-tab-switch",node:this.tagName,tabId:t}}}),this.v=t;};this.Rc=(t,e,r,s)=>{let n=Date.now(),a=`${t}-${n}.${e}`;return new File([s],a,{lastModified:n,type:r})};this.Uc=t=>{this.api.addFileFromObject(t,{source:P.CAMERA}),this.routerLayer.navigateAfterFileAdd();};this.Fi=F(t=>{this.classList.toggle("uc-initialized",t==="granted");let e=this.v===L.VIDEO&&this.cfg.enableAudioRecording,r=this.v===L.PHOTO?"camera-full":"video-camera-full";t==="granted"?(this.jr=false,this.gt=false,this.Ae=!this.ke.includes(L.PHOTO),this.bt=!this.ke.includes(L.VIDEO),this.Gr=true,this.qt=true,this.Zt=r,this.yt=!e,this.vt=!e):t==="prompt"?(this.en="camera-permissions-prompt",this.jr=true,this.gt=true,this.Ae=true,this.Gr=false,this.nn()):(this.en="camera-permissions-denied",this.jr=true,this.Gr=false,this.Ae=!this.ke.includes(L.PHOTO),this.bt=!this.ke.includes(L.VIDEO),this.Wt=true,this.qr="uc-shot-btn uc-camera-action",this.nn());},300);this.Ch=()=>{if(!this.be)return false;let t=this.be?.getAudioTracks(),e=this.be?.getVideoTracks();return t.forEach(r=>{r.stop();}),e.forEach(r=>{r.stop();}),true};this.nn=()=>{this.Js&&(this.W.value&&(this.W.value.volume=0),this.Kr?.getTracks?.()?.[0]?.stop(),this.rn(this.W.value),this.Di(null),this.Ch(),this.Lc(),this.Js=false);};this.Yt=async()=>{let t={video:{...jd},audio:this.cfg.enableAudioRecording?{}:false};this.zr&&(t.video={deviceId:{exact:this.zr}}),this.Br&&this.cfg.enableAudioRecording&&(t.audio={deviceId:{exact:this.Br}}),this.W.value&&(this.W.value.volume=0);try{this.Fi("prompt"),this.be=await navigator.mediaDevices.getUserMedia(t),this.be.addEventListener("inactive",()=>{this.Fi("denied");}),this.Di(this.be),this.Js=!0,this.Fi("granted");}catch(e){this.Fi("denied"),console.log("Failed to capture camera",e),this.telemetryManager.sendEventError(e,"camera capturing. Failed to capture camera");}};this.$c=()=>{this.Yt();};this.Sh=async()=>{try{this.Wr();for(let t of Gd){let e=await navigator.permissions.query({name:t});this.eh[t]=e,e.addEventListener("change",this.$c),this.Hr.push(()=>{e.removeEventListener("change",this.$c);});}this._r=()=>{this.Wr();};}catch(t){this.Wr(),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.Yt();}};this.Ah=async()=>{try{await navigator.mediaDevices.getUserMedia({video:!0,audio:this.cfg.enableAudioRecording}),await this.an(),navigator.mediaDevices.addEventListener("devicechange",this.an);}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get user media"),console.log("Failed to get user media",t);}};this.an=async()=>{try{let t=await navigator.mediaDevices.enumerateDevices();this.jt=t.filter(e=>e.kind==="videoinput").map((e,r)=>({text:e.label.trim()||`${this.l10n("caption-camera")} ${r+1}`,value:e.deviceId})),this.Gt=this.cfg.enableAudioRecording?t.filter(e=>e.kind==="audioinput").map(e=>({text:e.label.trim(),value:e.deviceId})):[],this.Sc=this.jt,this.mt=this.jt.length<=1,this.zr=this.jt[0]?.value??null,this.Ac=this.Gt,this.vt=!this.cfg.enableAudioRecording||this.Gt.length<=1,this.Br=this.Gt[0]?.value??null;}catch(t){this.telemetryManager.sendEventError(t,"camera devices. Failed to get devices"),console.log("Failed to get devices",t);}};this.kh=async()=>{await this.Sh(),await this.Ah(),await this.Yt(),this.Dc(this.ke);};this.Mh=async()=>{this._r&&this._r(),window.chrome||this.Fi("denied"),this.nn();};this.Dc=t=>{this.bt=!t.includes(L.VIDEO),this.Ae=!t.includes(L.PHOTO);let e=t[0];e&&(!this.v||!t.includes(this.v))&&this.Ic(e);};}wh(t){this.rn(t),t.addEventListener("play",this.bc),t.addEventListener("pause",this.xc);}rn(t){t?.removeEventListener("play",this.bc),t?.removeEventListener("pause",this.xc);}Di(t){this.Kr!==t&&(this.Kr=t,this.sn());}sn(){let t=this.W.value;if(!t)return;let e=this.Kr??null;t.srcObject!==e&&(t.srcObject=e);}oh(){if(this.$i("shot"),this.ve=document.createElement("canvas"),this.i=this.ve.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.ve.height=t.videoHeight,this.ve.width=t.videoWidth,this.cfg.cameraMirror&&(this.i.translate(this.ve.width,0),this.i.scale(-1,1)),this.i.drawImage(t,0,0),t.pause();}xh(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 n=r.slice(1).join("/")?.split(";")[0];if(n&&e[n])return e[n]}}return "avi"}get ke(){return Y(this.cfg.cameraModes).filter(t=>t===L.PHOTO||t===L.VIDEO)}Wr(){if(this.Hr.length!==0){for(let t of this.Hr)t();this.Hr=[],this._r=null;}}initCallback(){super.initCallback(),this.subConfigValue("cameraMirror",t=>{this.Cc=t?"scaleX(-1)":null;}),this.subConfigValue("enableAudioRecording",t=>{this.yt=!t,this.tn=!t;}),this.subConfigValue("cameraModes",t=>{if(!this.isConnected)return;let e=G(t);this.Dc(e.filter(r=>r===L.PHOTO||r===L.VIDEO));}),this.kh();}firstUpdated(t){super.firstUpdated(t),this.sn();}updated(t){super.updated(t),this.sn();}Oh(){this.Wr(),navigator.mediaDevices?.removeEventListener("devicechange",this.an),this.rn(this.W.value),this.Di(null);}disconnectedCallback(){super.disconnectedCallback(),this.Mh(),this.Oh();}render(){return v`<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.mt}><uc-icon name="camera"></uc-icon><span>${this.l10n("caption-camera")}</span></div><uc-select class="uc-camera-select" .options=${this.Sc} ?hidden=${this.mt} @change=${this.nh} ></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=${Qt({transform:this.Cc})} ?hidden=${this.jr} ${O(this.W)} ></video><div class="uc-message-box" ?hidden=${this.Gr}><span>${this.l10n(this.en)}</span><button type="button" @click=${this.lh} ?hidden=${this.ih} >${this.l10n("camera-permissions-request")}</button></div></div><div class="uc-controls"><div class="uc-switcher" ?hidden=${!this.qt}><button data-id="photo" type="button" class=${lt({"uc-switch":true,"uc-mini-btn":true,"uc-active":this.v===L.PHOTO})} @click=${this.Oc} ?hidden=${this.Ae} data-testid="tab-photo" ><uc-icon name="camera"></uc-icon></button><button data-id="video" type="button" class=${lt({"uc-switch":true,"uc-mini-btn":true,"uc-active":this.v===L.VIDEO})} @click=${this.Oc} ?hidden=${this.bt} data-testid="tab-video" ><uc-icon name="video-camera"></uc-icon></button></div><button class="uc-secondary-btn uc-recording-timer" @click=${this.uh} ?hidden=${this.qt} data-testid="recording-timer" ><uc-icon name=${this.Ri}></uc-icon><span ${O(this.Ui)}> 00:00 </span><span ${O(this.Je)} class="uc-line"></span></button><div class="uc-camera-actions uc-camera-action" ?hidden=${this.Wt} ><button type="button" class="uc-secondary-btn" @click=${this.fh} >${this.l10n("retake")}</button><button type="button" class="uc-primary-btn" @click=${this.gh} data-testid="accept" >${this.l10n("accept")}</button></div><button type="button" data-testid="shot" @click=${this.ch} class=${this.qr} ?hidden=${this.gt} ><uc-icon name=${this.Zt}></uc-icon></button><div class="uc-select"><button type="button" class="uc-mini-btn uc-btn-microphone" @click=${this.ph} ?hidden=${this.yt} data-testid="toggle-microphone" ><uc-icon name=${this.kc}></uc-icon></button><uc-select class="uc-audio-select" .options=${this.Ac} ?hidden=${this.vt} ?disabled=${this.tn} @change=${this.ah} data-testid="audio-select" ></uc-select></div></div>`}};p([f()],B.prototype,"Cc",2),p([f()],B.prototype,"jr",2),p([f()],B.prototype,"Gr",2),p([f()],B.prototype,"ih",2),p([f()],B.prototype,"Sc",2),p([f()],B.prototype,"mt",2),p([f()],B.prototype,"en",2),p([f()],B.prototype,"qt",2),p([f()],B.prototype,"gt",2),p([f()],B.prototype,"Wt",2),p([f()],B.prototype,"Ac",2),p([f()],B.prototype,"vt",2),p([f()],B.prototype,"tn",2),p([f()],B.prototype,"yt",2),p([f()],B.prototype,"Ae",2),p([f()],B.prototype,"bt",2),p([f()],B.prototype,"Zt",2),p([f()],B.prototype,"Ri",2),p([f()],B.prototype,"kc",2),p([f()],B.prototype,"qr",2);var kl={id:"camera",setup:async({pluginApi:o,uploaderApi:i})=>{vt({CameraSource:B}),o.registry.registerSource({id:"camera",label:"src-type-camera",icon:"camera",expand:()=>{if(!Jn.htmlMediaCapture)return ["camera"];let t=G(o.config.get("cameraModes"));return t.length?t.map(e=>`mobile-${e}-camera`):["mobile-photo-camera"]},onSelect:()=>{i.setCurrentActivity(D.CAMERA),i.setModalState(true);}}),o.registry.registerSource({id:"mobile-photo-camera",label:"src-type-mobile-photo-camera",icon:"camera",onSelect:()=>{i.openSystemDialog({captureCamera:true,modeCamera:"photo"});}}),o.registry.registerSource({id:"mobile-video-camera",label:"src-type-mobile-video-camera",icon:"camera",onSelect:()=>{i.openSystemDialog({captureCamera:true,modeCamera:"video"});}}),o.registry.registerActivity({id:D.CAMERA,render:t=>{let e=document.createElement("uc-camera-source");return t.append(e),()=>{t.replaceChildren();}}});}};var Gs={};Ys(Gs,{BtnUi:()=>At,CloudImageEditor:()=>mo,CloudImageEditorBlock:()=>et,Config:()=>ii,CropFrame:()=>Vi,EditorAspectRatioButtonControl:()=>Bi,EditorCropButtonControl:()=>zi,EditorFilterControl:()=>te,EditorFreeformButtonControl:()=>ho,EditorImageCropper:()=>Ni,EditorImageFader:()=>co,EditorOperationControl:()=>Hi,EditorScroller:()=>Ki,EditorSlider:()=>_i,EditorToolbar:()=>ft,Icon:()=>de,LineLoaderUi:()=>Fi,PresenceToggle:()=>oi,SliderUi:()=>Nt,defineComponents:()=>vt});var qd="cloud-image-editor",Wd="<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>",Ml={id:qd,setup:async({pluginApi:o,uploaderApi:i})=>(vt({...Gs,...js}),o.registry.registerIcon({name:"edit-file",svg:Wd}),o.registry.registerFileAction({id:"edit-file",icon:"edit-file",label:"file-item-edit-button",shouldRender:e=>!!(e.isImage&&e.cdnUrl),onClick:e=>{i.setCurrentActivity?.(D.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true);}}),o.registry.registerActivity({id:D.CLOUD_IMG_EDIT,render:e=>{let r=document.createElement("uc-cloud-image-editor-activity");return e.append(r),()=>{e.replaceChildren();}}}),i.on(A.FILE_UPLOAD_SUCCESS,e=>{if(!e.isImage)return;let r=o.config.get("cropPreset"),s=o.config.get("useCloudImageEditor"),n=o.config.get("cloudImageEditorAutoOpen"),a=i.a.size;s&&a===1&&(r||n)&&(i.setCurrentActivity?.(D.CLOUD_IMG_EDIT,{internalId:e.internalId}),i.setModalState?.(true));}))};var Il={id:"external-sources",setup:async({pluginApi:o,uploaderApi:i})=>{vt({ExternalSource:gt}),o.registry.registerActivity({id:D.EXTERNAL,render:t=>{let e=document.createElement("uc-external-source");return t.append(e),()=>{t.replaceChildren();}}});for(let t of Object.values(mt))o.registry.registerSource({id:t,label:`src-type-${t}`,icon:t,onSelect:()=>{i.setCurrentActivity(D.EXTERNAL,{externalSourceType:t}),i.setModalState(true);}});}};var yo=()=>{let o=[];return {stack:o,promiseReadJpegChunks:t=>new Promise((e,r)=>{let s=2,n=(c,u)=>{let d=new FileReader;d.addEventListener("load",()=>{u(new DataView(d.result));}),d.addEventListener("error",h=>{r(`Reader error: ${h}`);}),d.readAsArrayBuffer(c);},a=()=>n(t.slice(s,s+128),c=>{let u,d,h;for(u=d=0,h=c.byteLength;h>=0?d<h:d>h;u=h>=0?++d:--d)if(c.getUint8(u)===255){s+=u;break}l();}),l=()=>{let c=s;return n(t.slice(s,s+=4),u=>{if(u.byteLength!==4||u.getUint8(0)!==255){r("Corrupted");return}let d=u.getUint8(1);if(d===218){e(true);return}let h=u.getUint16(2)-2;return n(t.slice(s,s+=h),m=>{if(m.byteLength!==h){r("Corrupted");return}o.push({startPos:c,length:h,marker:d,view:m}),a();})})};FileReader&&DataView||r("Not Support"),n(t.slice(0,2),c=>{c.getUint16(0)!==65496&&r("Not jpeg"),a();});})}},Zd=async o=>{let i=[],{promiseReadJpegChunks:t,stack:e}=yo();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},Ll=async(o,i,t)=>{{let e=[],r=[],{promiseReadJpegChunks:s,stack:n}=yo();await s(o),n.forEach(c=>{if(c.marker===i)return e.push(c.startPos),r.push(c.length)});let a=[o.slice(0,2)];for(let c of t){let u=new DataView(new ArrayBuffer(4));u.setUint16(0,65280+i),u.setUint16(2,c.byteLength+2),a.push(u.buffer),a.push(c);}let l=2;for(let c=0;c<e.length;c++)e[c]>l&&a.push(o.slice(l,e[c])),l=e[c]+r[c]+4;return a.push(o.slice(l,o.size)),new Blob(a,{type:o.type})}};var Pl=(o,i)=>Ll(o,226,i.map(t=>t.buffer)),Yd=async o=>{try{return await Pl(o,[])}catch(i){throw new Error(`Failed to strip ICC profile: ${i}`)}},Xd=(o,i,t)=>new Promise((e,r)=>{let s=n=>{if(!n){r("Failed to convert canvas to blob");return}e(n);};o.toBlob(s,i,t),o.width=o.height=1;}),Gi=()=>{let o=document.createElement("canvas"),i=o.getContext("2d");return {canvas:o,ctx:i}},Qd=o=>{let{ctx:t,canvas:e}=Gi();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},Jd=async o=>{let i=null,{promiseReadJpegChunks:t,stack:e}=yo();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},tp="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEASABIAAD/4QA6RXhpZgAATU0AKgAAAAgAAwESAAMAAAABAAYAAAEoAAMAAAABAAIAAAITAAMAAAABAAEAAAAAAAD/2wBDAP//////////////////////////////////////////////////////////////////////////////////////wAALCAABAAIBASIA/8QAJgABAAAAAAAAAAAAAAAAAAAAAxABAAAAAAAAAAAAAAAAAAAAAP/aAAgBAQAAPwBH/9k=",vo,ep=()=>new Promise(o=>{if(vo!==void 0)o(vo);else {let i=new Image;i.addEventListener("load",()=>{vo=i.naturalWidth<i.naturalHeight,i.src="//:0",o(vo);}),i.src=tp;}}),ip=(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 n=o.getUint16(r-2,e);for(t=0,s=n;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;}},rp=(o,i)=>{ip(o,(t,e)=>o.setUint16(t,i,e));},op=async(o,i,t)=>(t&&rp(i,1),Ll(o,225,[i.buffer])),sp=(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."));}));}),np=o=>sp(new Image,o),ap=[1,3],lp=[192,193,194,195,197,198,199,201,202,203,205,206,207],Ol={squareSide:[Math.floor(Math.sqrt(5*1e3*1e3)),4096,8192,11180,10836,11402,14188,16384],dimension:[4096,8192,16384,32767,65535]},cp=async o=>{let i=false,{promiseReadJpegChunks:t,stack:e}=yo();return await t(o).then(()=>(e.forEach(({marker:r,view:s})=>{if(!i&&lp.indexOf(r)>=0){let n=s.getUint8(5);ap.indexOf(n)<0&&(i=true);}}),i)).catch(()=>i)},Ul=(o,i)=>{let t={};return (...e)=>{let r=i(e,t);return r in t?t[r]:t[r]=o(...e)}},Rl=(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],n=!!i[s];if(s>t&&n||s<t&&!n)return s}return t},fe={R:55,G:110,B:165,A:255},up=`rgba(${fe.R}, ${fe.G}, ${fe.B}, ${fe.A/255})`,$l=(o,i)=>{try{let t=[o-1,i-1,1,1],{canvas:e,ctx:r}=Gi();e.width=1,e.height=1;let{canvas:s,ctx:n}=Gi();s.width=o,s.height=i,n&&(n.fillStyle=up,n.fillRect(...t),r.drawImage(s,o-1,i-1,1,1,0,0,1,1));let a=r&&r.getImageData(0,0,1,1).data,l=!1;return a&&(l=a[0]===fe.R&&a[1]===fe.G&&a[2]===fe.B&&a[3]===fe.A),s.width=s.height=1,l}catch{return console.error(`Failed to test for max canvas size of ${o}x${i}.`),false}};function Dl(o){return (...i)=>new Promise(t=>{setTimeout(()=>{let e=o(...i);t(e);},0);})}var dp=Dl(Ul($l,Rl)),pp=Dl(Ul($l,Rl)),Fl=async(o,i)=>{let t=Ol.squareSide.find(n=>n*n>=o*i),e=Ol.dimension.find(n=>n>=o&&n>=i);if(!t||!e)throw new Error("Not supported");let[r,s]=await Promise.all([dp(t,t),pp(e,1)]);if(r&&s)return true;throw new Error("Not supported")},Vl=async(o,i,t)=>{try{let{ctx:e,canvas:r}=Gi();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})}},hp=({img:o,targetW:i,targetH:t})=>Vl(o,i,t),mp=function({sourceW:o,targetW:i,targetH:t,step:e}){let r=[],s=i,n=t;do r.push([s,n]),s=Math.round(s/e),n=Math.round(n/e);while(s<o*e);return r.reverse()},fp=({img:o,sourceW:i,targetW:t,targetH:e,step:r})=>{let s=mp({sourceW:i,targetW:t,targetH:e,step:r});return s.reduce((n,[a,l],c)=>n.then(u=>Fl(a,l).then(()=>Vl(u,a,l)).catch(()=>{if(c===s.length-1)throw new Error("Not supported");return u})),Promise.resolve(o))},gp=()=>/iPad|iPhone|iPod/.test(navigator.platform)?true:navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),vp=navigator.maxTouchPoints&&navigator.maxTouchPoints>2&&/MacIntel/.test(navigator.platform),qs=.71,yp=(o,i)=>{if(o.width*qs*o.height*qs<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)),n=Math.floor(i.size/Math.sqrt(i.size*r));return Fl(s,n).then(()=>{let{ctx:a}=Gi();return "imageSmoothingQuality"in a&&!gp()&&!vp?hp({img:o,targetW:s,targetH:n}):fp({img:o,sourceW:t,targetW:s,targetH:n,step:qs})}).catch(()=>Promise.reject("Not supported"))},Nl=async(o,i)=>{try{if(await cp(o))throw new Error("Should skipped");let e=await Promise.allSettled([Jd(o),ep(),Zd(o)]),s=!e.some(b=>b.status==="rejected"),[n,a,l]=e,c=await Yd(o).catch(()=>o),u=await np(URL.createObjectURL(c));URL.revokeObjectURL(u.src);let d=await yp(u,i),h="image/jpeg",m=i?.quality||.8;!s&&Qd(d)&&(h="image/png",m=void 0);let g=await Xd(d,h,m);if(s&&n.status==="fulfilled"&&n.value){let b=n.value,w=a.status==="fulfilled"?a.value:!1;g=await op(g,b,w);}return s&&l.status==="fulfilled"&&l.value.length>0&&(g=await Pl(g,l.value)),g}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})}};var bp=/^([0-9]+)x([0-9]+)(?:\s+(\d{1,2}|100)%)?$/i,_l=o=>{if(typeof o!="string")return false;let i=bp.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}};var Bl={id:"image-shrink",setup({pluginApi:o}){o.registry.registerFileHook({type:"beforeUpload",handler:async({file:i})=>{let t=o.config.get("imageShrink");if(!t)return {file:i};let e=_l(t);if(!e)return console.warn("[ImageShrinkPlugin] Image shrink settings are invalid, skipping shrinking"),{file:i};try{return {file:await Nl(i,e)}}catch{return {file:i}}}});}};var zl={id:"instagram",setup({pluginApi:o}){o.registry.registerSource({id:"instagram",label:"src-type-instagram",icon:"instagram",expand:()=>(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"),[]),onSelect:()=>{}});}};var Hl={id:P.LOCAL,setup:({pluginApi:o,uploaderApi:i})=>{o.registry.registerSource({id:P.LOCAL,label:"src-type-local",icon:"local",onSelect:()=>{i.openSystemDialog();}});}};var Kl={id:"url-source",setup:async({pluginApi:o,uploaderApi:i})=>{vt({UrlSource:ai}),o.registry.registerActivity({id:D.URL,render:t=>{let e=document.createElement("uc-url-source");return t.append(e),()=>{t.replaceChildren();}}}),o.registry.registerSource({id:"url",label:"src-type-from-url",icon:"url",onSelect:()=>{i.setCurrentActivity(D.URL),i.setModalState(true);}});}};var li=[{configDeps:["useCloudImageEditor"],isEnabled:o=>!!o("useCloudImageEditor"),load:()=>Ml},{configDeps:["imageShrink"],isEnabled:o=>!!o("imageShrink"),load:()=>Bl},{configDeps:["sourceList"],isEnabled:o=>G(o("sourceList")).includes(P.LOCAL),load:()=>Hl},{configDeps:["sourceList"],isEnabled:o=>G(o("sourceList")).includes(P.CAMERA),load:()=>kl},{configDeps:["sourceList"],isEnabled:o=>G(o("sourceList")).includes("instagram"),load:()=>zl},{configDeps:["sourceList"],isEnabled:o=>Object.values(mt).some(i=>G(o("sourceList")).includes(i)),load:()=>Il},{configDeps:["sourceList"],isEnabled:o=>G(o("sourceList")).includes(P.URL),load:()=>Kl}];var qi=class extends Yt{constructor(){super();this.headless=false;this.dynamicButton=false;this.init$={...this.init$};}static{this.lazyPlugins=li;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-regular"];}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:V.INIT_SOLUTION});}get isDynamicButtonActive(){return this.dynamicButton}Ih(){return v`<uc-dynamic-btn></uc-dynamic-btn>`}Ph(){return v`<uc-simple-btn></uc-simple-btn>`}Lh(){return this.headless?null:this.dynamicButton?this.Ih():this.Ph()}render(){return v` ${super.render()} ${this.Lh()}<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>`}};p([y({type:Boolean})],qi.prototype,"headless",2),p([y({attribute:"dynamic-button",type:Boolean})],qi.prototype,"dynamicButton",2);var bo=class extends Yt{constructor(){super();this.Fc=false;this.Ce=()=>{if(this.Nc){let t=this.$["*historyBack"];t?.();return}this.Vc&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{this.lazyPlugins=li;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-inline"];}get Nc(){let t=this.$["*history"];return !t||t.length<=1?false:t[t.length-1]!==$.activities.START_FROM}get Vc(){let t=this.$["*uploadList"];return this.cfg.showEmptyList||Array.isArray(t)&&t.length>0}ln(){return this.getCssData("--cfg-init-activity")||$.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:V.INIT_SOLUTION});let t=this.ln();this.sub("*currentActivity",e=>{e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0&&this.$["*currentActivity"]===t&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST);}),this.sub("*history",()=>{this.Fc=this.Nc||this.Vc;});}render(){return v` ${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.Ce} ?hidden=${!this.Fc} >${this.l10n("start-from-cancel")}</button><uc-copyright></uc-copyright></uc-start-from><uc-upload-list></uc-upload-list><uc-plugin-activity-renderer mode="inline"></uc-plugin-activity-renderer>`}};p([f()],bo.prototype,"Fc",2);var Ws="active",wo="",ge=class extends Yt{constructor(){super();this.cn=false;this.Zr=false;this.Yr=wo;this.un=wo;this.mi="choose-file";this.ui=t=>{t.id===$.activities.CLOUD_IMG_EDIT&&(this.Yr=Ws),this.$["*currentActivity"]===$.activities.UPLOAD_LIST&&(this.Yr=Ws,this.Zr=true);let e=this.$["*uploadList"];(!e||e.length<=0)&&(this.un=Ws);};this.di=t=>{t.id===this.$["*currentActivity"]&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST,this.Zr=false),t.id===$.activities.CLOUD_IMG_EDIT&&(this.$["*currentActivity"]=$.activities.UPLOAD_LIST);};this.init$={...this.init$};}static{this.lazyPlugins=li;}static{this.styleAttrs=[...super.styleAttrs,"uc-file-uploader-minimal"];}ln(){return this.getCssData("--cfg-init-activity")||$.activities.START_FROM}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:V.INIT_SOLUTION});let t=this.ln();this.sub("*currentActivity",e=>{e===$.activities.UPLOAD_LIST&&this.modalManager?.closeAll(),e||(this.$["*currentActivity"]=t);}),this.sub("*uploadList",e=>{Array.isArray(e)&&e.length>0?(this.$["*currentActivity"]=$.activities.UPLOAD_LIST,this.un=wo):(this.Yr=wo,this.Zr=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.cn=!r):(this.style.removeProperty("--uc-grid-col"),this.cn=false);});}),this.subConfigValue("multiple",e=>{this.mi=e?"choose-files":"choose-file";}),this.modalManager?.subscribe(X.OPEN,this.ui),this.modalManager?.subscribe(X.CLOSE,this.di);}disconnectedCallback(){super.disconnectedCallback(),this.modalManager?.unsubscribe(X.OPEN,this.ui),this.modalManager?.unsubscribe(X.CLOSE,this.di);}render(){return v` ${super.render()}<uc-start-from ?hidden=${this.Zr} class=${this.un}><uc-drop-area ?single=${this.cn} 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.Yr}></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>`}};p([f()],ge.prototype,"cn",2),p([f()],ge.prototype,"Zr",2),p([f()],ge.prototype,"Yr",2),p([f()],ge.prototype,"un",2),p([f()],ge.prototype,"mi",2);/*! For license information please see file-uploader.min.js.LEGAL.txt */
8
+ export{$ as ActivityBlock,Os as ActivityHeader,Uo as BaseComponent,C as Block,At as BtnUi,B as CameraSource,mo as CloudImageEditor,ji as CloudImageEditorActivity,et as CloudImageEditorBlock,ii as Config,ks as Copyright,Vi as CropFrame,H as Data,bt as DropArea,lo as DropDown,Vt as DynamicBtn,Bi as EditorAspectRatioButtonControl,zi as EditorCropButtonControl,te as EditorFilterControl,ho as EditorFreeformButtonControl,Ni as EditorImageCropper,co as EditorImageFader,Hi as EditorOperationControl,Ki as EditorScroller,_i as EditorSlider,ft as EditorToolbar,gt as ExternalSource,mt as ExternalUploadSource,Jt as FileActionButton,Us as FileItem,bo as FileUploaderInline,ge as FileUploaderMinimal,qi as FileUploaderRegular,ro as FormInput,de as Icon,Ts as Img,Fi as LineLoaderUi,Ii as Modal,X as ModalEvents,Hs as NoWrapModeDynamicBtn,Ut as PACKAGE_NAME,Rt as PACKAGE_VERSION,$i as PluginActivityHost,ri as PluginActivityRenderer,oi as PresenceToggle,zs as PrimaryAction,Xe as ProgressBar,Oi as ProgressBarCommon,Qe as Select,Ri as SimpleBtn,Nt as SliderUi,Yt as SolutionBlock,he as SourceBtn,Li as SourceList,Ms as Spinner,Ls as StartFrom,ei as Thumb,rt as UID,Ps as UploadCtxProvider,Lt as UploadList,P as UploadSource,M as UploaderBlock,ai as UrlSource,vt as defineComponents,En as defineLocale,hc as loadFileUploaderFrom,yr as toKebabCase};