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

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 (84) hide show
  1. package/dist/{CloudImageEditorActivity-HGSS7NV2.css → CloudImageEditorActivity-H7IY5ZRN.css} +2 -2
  2. package/dist/{CloudImageEditorActivity-HGSS7NV2.layered.css → CloudImageEditorActivity-H7IY5ZRN.layered.css} +2 -2
  3. package/dist/CloudImageEditorActivity-LKW4OYEK.js +1 -0
  4. package/dist/abstract/loadFileUploaderFrom.js +2 -2
  5. package/dist/chunk-BMGLMZ7T.js +7 -0
  6. package/dist/{chunk-TVCYFFRR.js → chunk-GVVHCZH5.js} +2 -2
  7. package/dist/chunk-JYWKOLXZ.js +7 -0
  8. package/dist/{chunk-BDD5ZPFI.js → chunk-PHLC56Y5.js} +2 -2
  9. package/dist/chunk-SX25NGUM.js +8 -0
  10. package/dist/chunk-SX25NGUM.js.LEGAL.txt +70 -0
  11. package/dist/{chunk-LNXFGGSC.js → chunk-TMF3R5Q2.js} +2 -2
  12. package/dist/{cloud-image-editor-PX6YZMOH.css → cloud-image-editor-ANNQTRKP.css} +2 -2
  13. package/dist/{cloud-image-editor-PX6YZMOH.layered.css → cloud-image-editor-ANNQTRKP.layered.css} +2 -2
  14. package/dist/cloud-image-editor-JGU7R22E.js +1 -0
  15. package/dist/{cloudImageEditorPlugin-WZCVZALK.css → cloudImageEditorPlugin-IUHTPZGK.css} +2 -2
  16. package/dist/{cloudImageEditorPlugin-WZCVZALK.layered.css → cloudImageEditorPlugin-IUHTPZGK.layered.css} +2 -2
  17. package/dist/{cloudImageEditorPlugin-BE5HU2W4.js → cloudImageEditorPlugin-TRD2OAR2.js} +4 -4
  18. package/dist/core.css +2 -2
  19. package/dist/core.js +5 -5
  20. package/dist/core.js.LEGAL.txt +8 -0
  21. package/dist/core.layered.css +2 -2
  22. package/dist/env.js +3 -3
  23. package/dist/index.css +2 -2
  24. package/dist/index.js +3 -3
  25. package/dist/index.layered.css +2 -2
  26. package/dist/index.ssr.js +1 -1
  27. package/dist/locales/file-uploader/ar.js +2 -2
  28. package/dist/locales/file-uploader/az.js +2 -2
  29. package/dist/locales/file-uploader/ca.js +2 -2
  30. package/dist/locales/file-uploader/cs.js +2 -2
  31. package/dist/locales/file-uploader/da.js +2 -2
  32. package/dist/locales/file-uploader/de.js +2 -2
  33. package/dist/locales/file-uploader/el.js +2 -2
  34. package/dist/locales/file-uploader/en.js +2 -2
  35. package/dist/locales/file-uploader/es.js +2 -2
  36. package/dist/locales/file-uploader/et.js +2 -2
  37. package/dist/locales/file-uploader/fi.js +2 -2
  38. package/dist/locales/file-uploader/fr.js +2 -2
  39. package/dist/locales/file-uploader/he.js +2 -2
  40. package/dist/locales/file-uploader/hy.js +2 -2
  41. package/dist/locales/file-uploader/is.js +2 -2
  42. package/dist/locales/file-uploader/it.js +2 -2
  43. package/dist/locales/file-uploader/ja.js +2 -2
  44. package/dist/locales/file-uploader/ka.js +2 -2
  45. package/dist/locales/file-uploader/kk.js +2 -2
  46. package/dist/locales/file-uploader/ko.js +2 -2
  47. package/dist/locales/file-uploader/lv.js +2 -2
  48. package/dist/locales/file-uploader/nb.js +2 -2
  49. package/dist/locales/file-uploader/nl.js +2 -2
  50. package/dist/locales/file-uploader/pl.js +2 -2
  51. package/dist/locales/file-uploader/pt.js +2 -2
  52. package/dist/locales/file-uploader/ro.js +2 -2
  53. package/dist/locales/file-uploader/ru.js +2 -2
  54. package/dist/locales/file-uploader/sk.js +2 -2
  55. package/dist/locales/file-uploader/sr.js +2 -2
  56. package/dist/locales/file-uploader/sv.js +2 -2
  57. package/dist/locales/file-uploader/tr.js +2 -2
  58. package/dist/locales/file-uploader/uk.js +2 -2
  59. package/dist/locales/file-uploader/vi.js +2 -2
  60. package/dist/locales/file-uploader/zh-TW.js +2 -2
  61. package/dist/locales/file-uploader/zh.js +2 -2
  62. package/package.json +1 -1
  63. package/web/file-uploader.iife.min.js +3 -3
  64. package/web/file-uploader.min.js +3 -3
  65. package/web/uc-basic.layered.min.css +2 -2
  66. package/web/uc-basic.min.css +2 -2
  67. package/web/uc-cloud-image-editor.layered.min.css +2 -2
  68. package/web/uc-cloud-image-editor.min.css +2 -2
  69. package/web/uc-cloud-image-editor.min.js +3 -3
  70. package/web/uc-file-uploader-inline.layered.min.css +2 -2
  71. package/web/uc-file-uploader-inline.min.css +2 -2
  72. package/web/uc-file-uploader-inline.min.js +3 -3
  73. package/web/uc-file-uploader-minimal.layered.min.css +2 -2
  74. package/web/uc-file-uploader-minimal.min.css +2 -2
  75. package/web/uc-file-uploader-minimal.min.js +3 -3
  76. package/web/uc-file-uploader-regular.layered.min.css +2 -2
  77. package/web/uc-file-uploader-regular.min.css +2 -2
  78. package/web/uc-file-uploader-regular.min.js +3 -3
  79. package/web/uc-img.min.js +3 -3
  80. package/dist/CloudImageEditorActivity-7EK7P3UP.js +0 -1
  81. package/dist/chunk-5OA6ZVWQ.js +0 -7
  82. package/dist/chunk-GCTQN3DZ.js +0 -7
  83. package/dist/chunk-NJ77GRVX.js +0 -8
  84. package/dist/cloud-image-editor-Q5333S7T.js +0 -1
@@ -0,0 +1,8 @@
1
+ import {a}from'./chunk-GVVHCZH5.js';/**
2
+ * @license
3
+ * Package: @uploadcare/file-uploader@1.27.0-alpha.1 (MIT)
4
+ * License: https://github.com/uploadcare/blob/main/LICENSE
5
+ * Built: 2026-02-17T12:21:36.712Z
6
+ */
7
+ var W=[],ve=0,xt=4,lr=r=>{let i=[],e={get(){return e.lc||e.listen(()=>{})(),e.value},lc:0,listen(t){return e.lc=i.push(t),()=>{for(let o=ve+xt;o<W.length;)W[o]===t?W.splice(o,xt):o+=xt;let s=i.indexOf(t);~s&&(i.splice(s,1),--e.lc||e.off());}},notify(t,s){let o=!W.length;for(let n of i)W.push(n,e.value,t,s);if(o){for(ve=0;ve<W.length;ve+=xt)W[ve](W[ve+1],W[ve+2],W[ve+3]);W.length=0;}},off(){},set(t){let s=e.value;s!==t&&(e.value=t,e.notify(s));},subscribe(t){let s=e.listen(t);return t(e.value),s},value:r};return e};function St(r,i,e){let t=new Set(i).add(void 0);return r.listen((s,o,n)=>{t.has(n)&&e(s,o,n);})}function vi(r,i,e){let t=St(r,i,e);return e(r.value),t}var bi=(r={})=>{let i=lr(r);return i.setKey=function(e,t){let s=i.value;typeof t>"u"&&e in i.value?(i.value={...i.value},delete i.value[e],i.notify(s,e)):i.value[e]!==t&&(i.value={...i.value,[e]:t},i.notify(s,e));},i};var ke=class r{static{this._contexts=new Map;}constructor(i,e){this._ctxId=i,this._store=e;}get id(){return this._ctxId}pub(i,e){i in this._store.get()||console.warn(`PubSub#pub: Key "${String(i)}" not found`),this._store.setKey(i,e);}sub(i,e,t=true){return (t?vi:St)(this._store,[i],o=>{e(o[i]);})}read(i){return i in this._store.get()||console.warn(`PubSub#read: Key "${String(i)}" not found`),this._store.get()[i]}add(i,e,t=false){(!(i in this._store.get())||t)&&this._store.setKey(i,e);}has(i){return i in this._store.get()}get store(){return this._store.get()}static registerCtx(i,e){if(r._contexts.has(e))throw new Error(`PubSub: Context with id "${e}" already exists`);let t=bi(i);return r._contexts.set(e,t),new r(e,t)}static deleteCtx(i){r._contexts.delete(i);}static getCtx(i){let e=r._contexts.get(i);return e?new r(i,e):null}static hasCtx(i){return r._contexts.has(i)}};var _i=globalThis,cr=r=>r,At=_i.trustedTypes,dr=At?At.createPolicy("lit-html",{createHTML:r=>r}):void 0,Ti="$lit$",oe=`lit$${Math.random().toFixed(9).slice(2)}$`,wi="?"+oe,Ys=`<${wi}>`,Me=document,ot=()=>Me.createComment(""),nt=r=>r===null||typeof r!="object"&&typeof r!="function",Ci=Array.isArray,gr=r=>Ci(r)||typeof r?.[Symbol.iterator]=="function",yi=`[ \f\r]`,st=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ur=/-->/g,pr=/>/g,Pe=RegExp(`>|${yi}(?:([^\\s"'>=/]+)(${yi}*=${yi}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),hr=/'/g,fr=/"/g,vr=/^(?:script|style|textarea|title)$/i,Ei=r=>(i,...e)=>({_$litType$:r,strings:i,values:e}),v=Ei(1),F=Symbol.for("lit-noChange"),S=Symbol.for("lit-nothing"),mr=new WeakMap,Oe=Me.createTreeWalker(Me,129);function br(r,i){if(!Ci(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return dr!==void 0?dr.createHTML(i):i}var yr=(r,i)=>{let e=r.length-1,t=[],s,o=i===2?"<svg>":i===3?"<math>":"",n=st;for(let a=0;a<e;a++){let l=r[a],c,u,d=-1,p=0;for(;p<l.length&&(n.lastIndex=p,u=n.exec(l),u!==null);)p=n.lastIndex,n===st?u[1]==="!--"?n=ur:u[1]!==void 0?n=pr:u[2]!==void 0?(vr.test(u[2])&&(s=RegExp("</"+u[2],"g")),n=Pe):u[3]!==void 0&&(n=Pe):n===Pe?u[0]===">"?(n=s??st,d=-1):u[1]===void 0?d=-2:(d=n.lastIndex-u[2].length,c=u[1],n=u[3]===void 0?Pe:u[3]==='"'?fr:hr):n===fr||n===hr?n=Pe:n===ur||n===pr?n=st:(n=Pe,s=void 0);let h=n===Pe&&r[a+1].startsWith("/>")?" ":"";o+=n===st?l+Ys:d>=0?(t.push(c),l.slice(0,d)+Ti+l.slice(d)+oe+h):l+oe+(d===-2?a:h);}return [br(r,o+(r[e]||"<?>")+(i===2?"</svg>":i===3?"</math>":"")),t]},at=class r{constructor({strings:i,_$litType$:e},t){let s;this.parts=[];let o=0,n=0,a=i.length-1,l=this.parts,[c,u]=yr(i,e);if(this.el=r.createElement(c,t),Oe.currentNode=this.el.content,e===2||e===3){let d=this.el.content.firstChild;d.replaceWith(...d.childNodes);}for(;(s=Oe.nextNode())!==null&&l.length<a;){if(s.nodeType===1){if(s.hasAttributes())for(let d of s.getAttributeNames())if(d.endsWith(Ti)){let p=u[n++],h=s.getAttribute(d).split(oe),m=/([.?@])?(.*)/.exec(p);l.push({type:1,index:o,name:m[2],strings:h,ctor:m[1]==="."?Rt:m[1]==="?"?$t:m[1]==="@"?kt:Ne}),s.removeAttribute(d);}else d.startsWith(oe)&&(l.push({type:6,index:o}),s.removeAttribute(d));if(vr.test(s.tagName)){let d=s.textContent.split(oe),p=d.length-1;if(p>0){s.textContent=At?At.emptyScript:"";for(let h=0;h<p;h++)s.append(d[h],ot()),Oe.nextNode(),l.push({type:2,index:++o});s.append(d[p],ot());}}}else if(s.nodeType===8)if(s.data===wi)l.push({type:2,index:o});else {let d=-1;for(;(d=s.data.indexOf(oe,d+1))!==-1;)l.push({type:7,index:o}),d+=oe.length-1;}o++;}}static createElement(i,e){let t=Me.createElement("template");return t.innerHTML=i,t}};function Le(r,i,e=r,t){if(i===F)return i;let s=t!==void 0?e._$Co?.[t]:e._$Cl,o=nt(i)?void 0:i._$litDirective$;return s?.constructor!==o&&(s?._$AO?.(false),o===void 0?s=void 0:(s=new o(r),s._$AT(r,e,t)),t!==void 0?(e._$Co??=[])[t]=s:e._$Cl=s),s!==void 0&&(i=Le(r,s._$AS(r,i.values),s,t)),i}var It=class{constructor(i,e){this._$AV=[],this._$AN=void 0,this._$AD=i,this._$AM=e;}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(i){let{el:{content:e},parts:t}=this._$AD,s=(i?.creationScope??Me).importNode(e,true);Oe.currentNode=s;let o=Oe.nextNode(),n=0,a=0,l=t[0];for(;l!==void 0;){if(n===l.index){let c;l.type===2?c=new je(o,o.nextSibling,this,i):l.type===1?c=new l.ctor(o,l.name,l.strings,this,i):l.type===6&&(c=new Pt(o,this,i)),this._$AV.push(c),l=t[++a];}n!==l?.index&&(o=Oe.nextNode(),n++);}return Oe.currentNode=Me,s}p(i){let e=0;for(let t of this._$AV)t!==void 0&&(t.strings!==void 0?(t._$AI(i,t,e),e+=t.strings.length-2):t._$AI(i[e])),e++;}},je=class r{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(i,e,t,s){this.type=2,this._$AH=S,this._$AN=void 0,this._$AA=i,this._$AB=e,this._$AM=t,this.options=s,this._$Cv=s?.isConnected??true;}get parentNode(){let i=this._$AA.parentNode,e=this._$AM;return e!==void 0&&i?.nodeType===11&&(i=e.parentNode),i}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(i,e=this){i=Le(this,i,e),nt(i)?i===S||i==null||i===""?(this._$AH!==S&&this._$AR(),this._$AH=S):i!==this._$AH&&i!==F&&this._(i):i._$litType$!==void 0?this.$(i):i.nodeType!==void 0?this.T(i):gr(i)?this.k(i):this._(i);}O(i){return this._$AA.parentNode.insertBefore(i,this._$AB)}T(i){this._$AH!==i&&(this._$AR(),this._$AH=this.O(i));}_(i){this._$AH!==S&&nt(this._$AH)?this._$AA.nextSibling.data=i:this.T(Me.createTextNode(i)),this._$AH=i;}$(i){let{values:e,_$litType$:t}=i,s=typeof t=="number"?this._$AC(i):(t.el===void 0&&(t.el=at.createElement(br(t.h,t.h[0]),this.options)),t);if(this._$AH?._$AD===s)this._$AH.p(e);else {let o=new It(s,this),n=o.u(this.options);o.p(e),this.T(n),this._$AH=o;}}_$AC(i){let e=mr.get(i.strings);return e===void 0&&mr.set(i.strings,e=new at(i)),e}k(i){Ci(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,t,s=0;for(let o of i)s===e.length?e.push(t=new r(this.O(ot()),this.O(ot()),this,this.options)):t=e[s],t._$AI(o),s++;s<e.length&&(this._$AR(t&&t._$AB.nextSibling,s),e.length=s);}_$AR(i=this._$AA.nextSibling,e){for(this._$AP?.(false,true,e);i!==this._$AB;){let t=cr(i).nextSibling;cr(i).remove(),i=t;}}setConnected(i){this._$AM===void 0&&(this._$Cv=i,this._$AP?.(i));}},Ne=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(i,e,t,s,o){this.type=1,this._$AH=S,this._$AN=void 0,this.element=i,this.name=e,this._$AM=s,this.options=o,t.length>2||t[0]!==""||t[1]!==""?(this._$AH=Array(t.length-1).fill(new String),this.strings=t):this._$AH=S;}_$AI(i,e=this,t,s){let o=this.strings,n=false;if(o===void 0)i=Le(this,i,e,0),n=!nt(i)||i!==this._$AH&&i!==F,n&&(this._$AH=i);else {let a=i,l,c;for(i=o[0],l=0;l<o.length-1;l++)c=Le(this,a[t+l],e,l),c===F&&(c=this._$AH[l]),n||=!nt(c)||c!==this._$AH[l],c===S?i=S:i!==S&&(i+=(c??"")+o[l+1]),this._$AH[l]=c;}n&&!s&&this.j(i);}j(i){i===S?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,i??"");}},Rt=class extends Ne{constructor(){super(...arguments),this.type=3;}j(i){this.element[this.name]=i===S?void 0:i;}},$t=class extends Ne{constructor(){super(...arguments),this.type=4;}j(i){this.element.toggleAttribute(this.name,!!i&&i!==S);}},kt=class extends Ne{constructor(i,e,t,s,o){super(i,e,t,s,o),this.type=5;}_$AI(i,e=this){if((i=Le(this,i,e,0)??S)===F)return;let t=this._$AH,s=i===S&&t!==S||i.capture!==t.capture||i.once!==t.once||i.passive!==t.passive,o=i!==S&&(t===S||s);s&&this.element.removeEventListener(this.name,this,t),o&&this.element.addEventListener(this.name,this,i),this._$AH=i;}handleEvent(i){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,i):this._$AH.handleEvent(i);}},Pt=class{constructor(i,e,t){this.element=i,this.type=6,this._$AN=void 0,this._$AM=e,this.options=t;}get _$AU(){return this._$AM._$AU}_$AI(i){Le(this,i);}},_r={I:je},Zs=_i.litHtmlPolyfillSupport;Zs?.(at,je),(_i.litHtmlVersions??=[]).push("3.3.2");var Tr=(r,i,e)=>{let t=e?.renderBefore??i,s=t._$litPart$;if(s===void 0){let o=e?.renderBefore??null;t._$litPart$=s=new je(i.insertBefore(ot(),o),o,void 0,e??{});}return s._$AI(r),s};var Ot=globalThis,Lt=Ot.ShadowRoot&&(Ot.ShadyCSS===void 0||Ot.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Cr=Symbol(),wr=new WeakMap,Mt=class{constructor(i,e,t){if(this._$cssResult$=true,t!==Cr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=i,this.t=e;}get styleSheet(){let i=this.o,e=this.t;if(Lt&&i===void 0){let t=e!==void 0&&e.length===1;t&&(i=wr.get(e)),i===void 0&&((this.o=i=new CSSStyleSheet).replaceSync(this.cssText),t&&wr.set(e,i));}return i}toString(){return this.cssText}},Er=r=>new Mt(typeof r=="string"?r:r+"",void 0,Cr);var xr=(r,i)=>{if(Lt)r.adoptedStyleSheets=i.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of i){let t=document.createElement("style"),s=Ot.litNonce;s!==void 0&&t.setAttribute("nonce",s),t.textContent=e.cssText,r.appendChild(t);}},xi=Lt?r=>r:r=>r instanceof CSSStyleSheet?(i=>{let e="";for(let t of i.cssRules)e+=t.cssText;return Er(e)})(r):r;var{is:Qs,defineProperty:Js,getOwnPropertyDescriptor:eo,getOwnPropertyNames:to,getOwnPropertySymbols:io,getPrototypeOf:ro}=Object,Nt=globalThis,Sr=Nt.trustedTypes,so=Sr?Sr.emptyScript:"",oo=Nt.reactiveElementPolyfillSupport,lt=(r,i)=>r,ct={toAttribute(r,i){switch(i){case Boolean:r=r?so:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r);}return r},fromAttribute(r,i){let e=r;switch(i){case Boolean:e=r!==null;break;case Number:e=r===null?null:Number(r);break;case Object:case Array:try{e=JSON.parse(r);}catch{e=null;}}return e}},Ut=(r,i)=>!Qs(r,i),Ar={attribute:true,type:String,converter:ct,reflect:false,useDefault:false,hasChanged:Ut};Symbol.metadata??=Symbol("metadata"),Nt.litPropertyMetadata??=new WeakMap;var ne=class extends HTMLElement{static addInitializer(i){this._$Ei(),(this.l??=[]).push(i);}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(i,e=Ar){if(e.state&&(e.attribute=false),this._$Ei(),this.prototype.hasOwnProperty(i)&&((e=Object.create(e)).wrapped=true),this.elementProperties.set(i,e),!e.noAccessor){let t=Symbol(),s=this.getPropertyDescriptor(i,t,e);s!==void 0&&Js(this.prototype,i,s);}}static getPropertyDescriptor(i,e,t){let{get:s,set:o}=eo(this.prototype,i)??{get(){return this[e]},set(n){this[e]=n;}};return {get:s,set(n){let a=s?.call(this);o?.call(this,n),this.requestUpdate(i,a,t);},configurable:true,enumerable:true}}static getPropertyOptions(i){return this.elementProperties.get(i)??Ar}static _$Ei(){if(this.hasOwnProperty(lt("elementProperties")))return;let i=ro(this);i.finalize(),i.l!==void 0&&(this.l=[...i.l]),this.elementProperties=new Map(i.elementProperties);}static finalize(){if(this.hasOwnProperty(lt("finalized")))return;if(this.finalized=true,this._$Ei(),this.hasOwnProperty(lt("properties"))){let e=this.properties,t=[...to(e),...io(e)];for(let s of t)this.createProperty(s,e[s]);}let i=this[Symbol.metadata];if(i!==null){let e=litPropertyMetadata.get(i);if(e!==void 0)for(let[t,s]of e)this.elementProperties.set(t,s);}this._$Eh=new Map;for(let[e,t]of this.elementProperties){let s=this._$Eu(e,t);s!==void 0&&this._$Eh.set(s,e);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(i){let e=[];if(Array.isArray(i)){let t=new Set(i.flat(1/0).reverse());for(let s of t)e.unshift(xi(s));}else i!==void 0&&e.push(xi(i));return e}static _$Eu(i,e){let t=e.attribute;return t===false?void 0:typeof t=="string"?t:typeof i=="string"?i.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=false,this.hasUpdated=false,this._$Em=null,this._$Ev();}_$Ev(){this._$ES=new Promise(i=>this.enableUpdating=i),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(i=>i(this));}addController(i){(this._$EO??=new Set).add(i),this.renderRoot!==void 0&&this.isConnected&&i.hostConnected?.();}removeController(i){this._$EO?.delete(i);}_$E_(){let i=new Map,e=this.constructor.elementProperties;for(let t of e.keys())this.hasOwnProperty(t)&&(i.set(t,this[t]),delete this[t]);i.size>0&&(this._$Ep=i);}createRenderRoot(){let i=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return xr(i,this.constructor.elementStyles),i}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this._$EO?.forEach(i=>i.hostConnected?.());}enableUpdating(i){}disconnectedCallback(){this._$EO?.forEach(i=>i.hostDisconnected?.());}attributeChangedCallback(i,e,t){this._$AK(i,t);}_$ET(i,e){let t=this.constructor.elementProperties.get(i),s=this.constructor._$Eu(i,t);if(s!==void 0&&t.reflect===true){let o=(t.converter?.toAttribute!==void 0?t.converter:ct).toAttribute(e,t.type);this._$Em=i,o==null?this.removeAttribute(s):this.setAttribute(s,o),this._$Em=null;}}_$AK(i,e){let t=this.constructor,s=t._$Eh.get(i);if(s!==void 0&&this._$Em!==s){let o=t.getPropertyOptions(s),n=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:ct;this._$Em=s;let a=n.fromAttribute(e,o.type);this[s]=a??this._$Ej?.get(s)??a,this._$Em=null;}}requestUpdate(i,e,t,s=false,o){if(i!==void 0){let n=this.constructor;if(s===false&&(o=this[i]),t??=n.getPropertyOptions(i),!((t.hasChanged??Ut)(o,e)||t.useDefault&&t.reflect&&o===this._$Ej?.get(i)&&!this.hasAttribute(n._$Eu(i,t))))return;this.C(i,e,t);}this.isUpdatePending===false&&(this._$ES=this._$EP());}C(i,e,{useDefault:t,reflect:s,wrapped:o},n){t&&!(this._$Ej??=new Map).has(i)&&(this._$Ej.set(i,n??e??this[i]),o!==true||n!==void 0)||(this._$AL.has(i)||(this.hasUpdated||t||(e=void 0),this._$AL.set(i,e)),s===true&&this._$Em!==i&&(this._$Eq??=new Set).add(i));}async _$EP(){this.isUpdatePending=true;try{await this._$ES;}catch(e){Promise.reject(e);}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._$Ep){for(let[s,o]of this._$Ep)this[s]=o;this._$Ep=void 0;}let t=this.constructor.elementProperties;if(t.size>0)for(let[s,o]of t){let{wrapped:n}=o,a=this[s];n!==true||this._$AL.has(s)||a===void 0||this.C(s,void 0,o,a);}}let i=false,e=this._$AL;try{i=this.shouldUpdate(e),i?(this.willUpdate(e),this._$EO?.forEach(t=>t.hostUpdate?.()),this.update(e)):this._$EM();}catch(t){throw i=false,this._$EM(),t}i&&this._$AE(e);}willUpdate(i){}_$AE(i){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(i)),this.updated(i);}_$EM(){this._$AL=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(i){return true}update(i){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM();}updated(i){}firstUpdated(i){}};ne.elementStyles=[],ne.shadowRootOptions={mode:"open"},ne[lt("elementProperties")]=new Map,ne[lt("finalized")]=new Map,oo?.({ReactiveElement:ne}),(Nt.reactiveElementVersions??=[]).push("2.1.2");var Si=globalThis,be=class extends ne{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0;}createRenderRoot(){let i=super.createRenderRoot();return this.renderOptions.renderBefore??=i.firstChild,i}update(i){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(i),this._$Do=Tr(e,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(false);}render(){return F}};be._$litElement$=true,be.finalized=true,Si.litElementHydrateSupport?.({LitElement:be});var no=Si.litElementPolyfillSupport;no?.({LitElement:be});(Si.litElementVersions??=[]).push("4.2.2");var ao={attribute:true,type:String,converter:ct,reflect:false,hasChanged:Ut},lo=(r=ao,i,e)=>{let{kind:t,metadata:s}=e,o=globalThis.litPropertyMetadata.get(s);if(o===void 0&&globalThis.litPropertyMetadata.set(s,o=new Map),t==="setter"&&((r=Object.create(r)).wrapped=true),o.set(e.name,r),t==="accessor"){let{name:n}=e;return {set(a){let l=i.get.call(this);i.set.call(this,a),this.requestUpdate(n,l,r,true,a);},init(a){return a!==void 0&&this.C(n,void 0,r,a),a}}}if(t==="setter"){let{name:n}=e;return function(a){let l=this[n];i.call(this,a),this.requestUpdate(n,l,r,true,a);}}throw Error("Unsupported decorator location: "+t)};function _(r){return (i,e)=>typeof e=="object"?lo(r,i,e):((t,s,o)=>{let n=s.hasOwnProperty(o);return s.constructor.createProperty(o,t),n?Object.getOwnPropertyDescriptor(s,o):void 0})(r,i,e)}function b(r){return _({...r,state:true,attribute:false})}var ye=class r{static generateFastUid(){return `uid-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,11)}`}static generateRandomUUID(){let i=globalThis.crypto;return i&&typeof i.randomUUID=="function"?i.randomUUID():r.generateFastUid()}};var dt={"locale-id":"en","social-source-lang":"en","upload-file":"Upload file","upload-files":"Upload files","choose-file":"Choose file","choose-files":"Choose files","drop-files-here":"Drop files here","select-file-source":"Select file source",selected:"Selected",upload:"Upload","add-more":"Add more",cancel:"Cancel","start-from-cancel":"Cancel",clear:"Clear","camera-shot":"Shot","upload-url":"Import","upload-url-placeholder":"Paste link here","edit-image":"Edit image","edit-detail":"Details",back:"Back",done:"Done",ok:"Ok","remove-from-list":"Remove",no:"No",yes:"Yes","confirm-your-action":"Confirm your action","are-you-sure":"Are you sure?","selected-count":"{{count}} of {{total}} selected","select-all":"Select all","deselect-all":"Deselect all","upload-error":"Upload error","validation-error":"Validation error","no-files":"No files selected",browse:"Browse","not-uploaded-yet":"Not uploaded yet...",file__one:"file",file__other:"files",error__one:"error",error__other:"errors","header-uploading":"Uploading {{count}} {{plural:file(count)}}","header-failed":"{{count}} {{plural:error(count)}}","header-succeed":"{{count}} {{plural:file(count)}} uploaded","header-total":"{{count}} {{plural:file(count)}} selected","src-type-local":"From device","src-type-from-url":"From link","src-type-camera":"Camera","src-type-mobile-video-camera":"Video","src-type-mobile-photo-camera":"Photo","src-type-draw":"Draw","src-type-facebook":"Facebook","src-type-dropbox":"Dropbox","src-type-gdrive":"Google Drive","src-type-ngdrive":"Google Drive","src-type-gphotos":"Google Photos","src-type-flickr":"Flickr","src-type-vk":"VK","src-type-evernote":"Evernote","src-type-box":"Box","src-type-onedrive":"OneDrive","src-type-huddle":"Huddle","src-type-other":"Other","caption-from-url":"Import from link","caption-camera":"Camera","caption-draw":"Draw","caption-edit-file":"Edit file","file-no-name":"No name...","toggle-fullscreen":"Toggle fullscreen","toggle-guides":"Toggle guides",rotate:"Rotate","flip-vertical":"Flip vertical","flip-horizontal":"Flip horizontal",apply:"Apply",brightness:"Brightness",contrast:"Contrast",saturation:"Saturation",exposure:"Exposure",gamma:"Gamma",vibrance:"Vibrance",warmth:"Warmth",enhance:"Enhance",original:"Original",resize:"Resize image",crop:"Crop","select-color":"Select color",text:"Text",draw:"Draw","cancel-edit":"Cancel edit","tab-view":"Preview","tab-details":"Details","file-name":"Name","file-size":"Size","cdn-url":"CDN URL","file-size-unknown":"Unknown","camera-permissions-denied":"Camera access denied","camera-permissions-prompt":"Please allow access to the camera","camera-permissions-request":"Request access","files-count-limit-error-title":"Files count limit overflow","files-count-limit-error-too-few":"You\u2019ve chosen {{total}} {{plural:file(total)}}. At least {{min}} {{plural:file(min)}} required.","files-count-limit-error-too-many":"You\u2019ve chosen too many files. {{max}} {{plural:file(max)}} is maximum.","files-max-size-limit-error":"File is too big. Max file size is {{maxFileSize}}.","has-validation-errors":"File validation error occurred. Please, check your files before upload.","images-only-accepted":"Only image files are accepted.","file-type-not-allowed":"Uploading of these file types is not allowed.","some-files-were-not-uploaded":"Some files were not uploaded.","file-item-edit-button":"Edit","file-item-remove-button":"Remove","a11y-editor-tab-filters":"Filters","a11y-editor-tab-tuning":"Tuning","a11y-editor-tab-crop":"Crop","a11y-activity-header-button-close":"Close",flip:"Flip",mirror:"Mirror","a11y-cloud-editor-apply-filter":"Apply {{name}} filter","a11y-cloud-editor-apply-crop":"Apply {{name}} operation","a11y-cloud-editor-apply-tuning":"Apply {{name}} tuning","a11y-cloud-editor-apply-aspect-ratio":"Apply operation {{name}} {{value}}",finished:"Finished",failed:"Failed",uploading:"Uploading",idle:"Idle","a11y-file-item-status":"File {{fileName}} in status {{status}}","waiting-for":"Waiting for {{source}}","queued-uploading":"Queued for upload","queued-validation":"Queued for validation",validation:"Validating","crop-to-shape":"Crop to {{value}}",custom:"Freeform","freeform-crop":"Freeform crop"};var Ai=new Map,Ir=new Map,Rr=(r,i)=>{Ai.has(r)&&console.log(`Locale ${r} is already defined. Overwriting...`);let e={...dt,...i};return Ai.set(r,e),e},co=(r,i)=>{Ir.set(r,i);},uo=(r,i)=>{typeof i=="function"?co(r,i):Rr(r,i);},$r=async r=>{let i=Ai.get(r);if(!i){let e=Ir.get(r);if(!e)throw new Error(`Locale ${r} is not defined`);let t=await e();i=Rr(r,t);}return i};uo("en",dt);var k=r=>`*cfg/${r}`;var kr=r=>r?r.split(",").map(i=>i.trim()).filter(Boolean):[],Ft=r=>r.join(",");var Pr=r=>{if(typeof r!="string"||!r)return "";let i=r.trim();return i.startsWith("-/")?i=i.slice(2):i.startsWith("/")&&(i=i.slice(1)),i.endsWith("/")&&(i=i.slice(0,i.length-1)),i},Vt=(...r)=>r.filter(i=>typeof i=="string"&&!!i).map(i=>Pr(i)).join("/-/"),ae=(...r)=>{let i=Vt(...r);return i?`-/${i}/`:""};function zt(r){let i=new URL(r),e=i.pathname+i.search+i.hash,t=e.lastIndexOf("http"),s=e.lastIndexOf("/"),o="";return t>=0?o=e.slice(t):s>=0&&(o=e.slice(s+1)),o}function Ht(r){let i=new URL(r),{pathname:e}=i,t=e.indexOf("/"),s=e.indexOf("/",t+1);return e.substring(t+1,s)}function Ii(r){let i=Or(r),e=new URL(i),t=e.pathname.indexOf("/-/");return t===-1?"":e.pathname.substring(t).slice(1)}function Ri(r){return Ii(r).split("/-/").filter(Boolean).map(e=>Pr(e))}function Or(r){let i=new URL(r),e=zt(r),t=Mr(e)?Lr(e).pathname:e;return i.pathname=i.pathname.replace(t,""),i.search="",i.hash="",i.toString()}function Mr(r){return r.startsWith("http")}function Lr(r){let i=new URL(r);return {pathname:`${i.origin}${i.pathname??""}`,search:i.search??"",hash:i.hash??""}}var le=(r,i,e)=>{let t=new URL(Or(r)),s=e??zt(r),o=i??"";if(t.pathname.startsWith("//")&&(t.pathname=t.pathname.replace("//","/")),s&&Mr(s)){let n=Lr(s);t.pathname=`${t.pathname}${o}${n.pathname||""}`,t.search=n.search,t.hash=n.hash;}else t.pathname=`${t.pathname}${o}${s||""}`;return t.toString()},$i=(r,i)=>{let e=new URL(r);return e.pathname=`${i}/`,e.toString()};var ut=(r,i=",")=>r.trim().split(i).map(e=>e.trim()).filter(e=>e.length>0);var pt=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}),Ur=["enhance","brightness","exposure","gamma","contrast","saturation","vibrance","warmth","filter","mirror","flip","rotate","crop"];function po(r,i){if(typeof i=="number"){let e=i;return pt[r]!==e?`${r}/${e}`:""}if(typeof i=="boolean"){let e=i;return pt[r]!==e?`${r}`:""}if(r==="filter"&&i){let{name:e,amount:t}=i;return pt.filter===t?"":`${r}/${e}/${t}`}if(r==="crop"&&i){let{dimensions:e,coords:t}=i;return `${r}/${e.join("x")}/${t.join(",")}`}return ""}function _e(r){return Vt(...Ur.filter(i=>typeof r[i]<"u"&&r[i]!==null).map(i=>{let e=r[i];return po(i,e)}).filter(i=>!!i))}var jt=Vt("format/auto","progressive/yes"),ce=([r])=>typeof r<"u"?Number(r):void 0,Nr=()=>true,ho=([r,i])=>({name:r,amount:typeof i<"u"?Number(i):100}),fo=([r,i])=>{if(!/\d+x\d+/.test(r)||!/\d+,\d+/.test(i))throw new Error("Crop by aspect ratio, percentage or alignment shortcuts is not supported.");return {dimensions:ut(r,"x").map(Number),coords:ut(i).map(Number)}},mo=Object.freeze({enhance:ce,brightness:ce,exposure:ce,gamma:ce,contrast:ce,saturation:ce,vibrance:ce,warmth:ce,filter:ho,mirror:Nr,flip:Nr,rotate:ce,crop:r=>{let[i,e]=r,{dimensions:t,coords:s}=fo([i,e]);return {dimensions:t,coords:s}}});function ki(r){let i={};for(let e of r){let[t,...s]=e.split("/");if(!t||!Ur.includes(t))continue;let o=t,n=mo[o];try{let a=n(s);i[o]=a;}catch(a){console.warn([`Failed to parse URL operation "${e}". 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 R=Object.freeze({CROP:"crop",TUNING:"tuning",FILTERS:"filters"}),M=Object.freeze([R.CROP,R.TUNING,R.FILTERS]),Dr=Object.freeze(["brightness","exposure","gamma","contrast","saturation","vibrance","warmth","enhance"]),Fr=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"]),Vr=Object.freeze(["rotate","mirror","flip"]),de=pt,X=Object.freeze({brightness:{zero:de.brightness,range:[-100,100],keypointsNumber:2},exposure:{zero:de.exposure,range:[-500,500],keypointsNumber:2},gamma:{zero:de.gamma,range:[0,1e3],keypointsNumber:2},contrast:{zero:de.contrast,range:[-100,500],keypointsNumber:2},saturation:{zero:de.saturation,range:[-100,500],keypointsNumber:1},vibrance:{zero:de.vibrance,range:[-100,500],keypointsNumber:1},warmth:{zero:de.warmth,range:[-100,100],keypointsNumber:1},enhance:{zero:de.enhance,range:[0,100],keypointsNumber:1},filter:{zero:de.filter,range:[0,100],keypointsNumber:1}});var go="https://ucarecdn.com",vo="https://upload.uploadcare.com",bo="https://social.uploadcare.com",yo="https://ucarecd.net",_o={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:go,cdnCnamePrefixed:yo,baseUrl:vo,socialBaseUrl:bo,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:Ft(M),cloudImageEditorMaskHref:null,testMode:false,qualityInsights:true,plugins:[]},ue=Object.freeze(_o);var Kt=(r,i)=>(...e)=>{let t=r();if(!t.read(k("debug")))return;let s=e;if(typeof e?.[0]=="function"){let n=e[0];s=n();}let o=[t.id,i].filter(Boolean);console.log(`[${o.join("][")}]`,...s);};var K=class{constructor(i){this._subscriptions=new Set;this._cfgProxy=null;this._debugPrint=Kt(()=>this._sharedInstancesBag.ctx,this.constructor.name);this._sharedInstancesBag=i,this._ctx=i.ctx;}addSub(i){this._subscriptions.add(i);}get _cfg(){if(!this._cfgProxy){let i={};this._cfgProxy=new Proxy(i,{set:()=>{throw new Error("SharedInstance cfg proxy is read-only")},get:(e,t)=>{if(typeof t!="string")return;let s=k(t);return this._sharedInstancesBag.ctx.has(s)?this._sharedInstancesBag.ctx.read(s):ue[t]}});}return this._cfgProxy}destroy(){for(let i of this._subscriptions)try{i();}catch{}this._subscriptions.clear();}},To={modalManager:"*modalManager",pluginManager:"*pluginManager",telemetryManager:"*telemetryManager",localeManager:"*localeManager",a11y:"*a11y",blocksRegistry:"*blocksRegistry",eventEmitter:"*eventEmitter",uploadCollection:"*uploadCollection",secureUploadsManager:"*secureUploadsManager",api:"*publicApi",validationManager:"*validationManager"},Y=(r,i,e=true)=>{let t=r.has(i),s=t?r.read(i):null;if(t&&s||!e)return s;throw new Error(`Unexpected error: shared instance for key "${String(i)}" is not available`)},zr=r=>({get ctx(){return r()},get modalManager(){return Y(r(),"*modalManager",false)},get pluginManager(){return Y(r(),"*pluginManager")},get telemetryManager(){return Y(r(),"*telemetryManager")},get localeManager(){return Y(r(),"*localeManager")},get a11y(){return Y(r(),"*a11y")},get blocksRegistry(){return Y(r(),"*blocksRegistry")},get eventEmitter(){return Y(r(),"*eventEmitter")},get uploadCollection(){return Y(r(),"*uploadCollection")},get secureUploadsManager(){return Y(r(),"*secureUploadsManager",false)},get api(){return Y(r(),"*publicApi")},get validationManager(){return Y(r(),"*validationManager")},when(i,e){let t=To[i],s=r(),o=s.has(t)?s.read(t):void 0;if(o)return e(o),()=>{};let n=s.sub(t,a=>{a&&(e(a),n());});return n}});var Ke=Object.freeze({ADD:"modal:add",DELETE:"modal:delete",OPEN:"modal:open",CLOSE:"modal:close",CLOSE_ALL:"modal:closeAll",DESTROY:"modal:destroy"}),Bt=class extends K{constructor(){super(...arguments);this._modals=new Map;this._activeModals=new Set;this._subscribers=new Map;}registerModal(e,t){this._modals.set(e,t),this._notify(Ke.ADD,{id:e,modal:t});}deleteModal(e){let t=this._modals.get(e);return t?(this._modals.delete(e),this._activeModals.delete(e),this._notify(Ke.DELETE,{id:e,modal:t}),true):false}open(e){let t=this._modals.get(e);return t?(this._activeModals.add(e),this._notify(Ke.OPEN,{modal:t,id:e}),true):(this._debugPrint(`Modal with ID "${e}" not found`),false)}close(e){let t=this._modals.get(e);return !t||!this._activeModals.has(e)?(this._debugPrint(`Modal with ID "${e}" not found or not active`),false):(this._activeModals.delete(e),this._notify(Ke.CLOSE,{id:e,modal:t}),true)}toggle(e){return this._modals.has(e)?this._activeModals.has(e)?this.close(e):this.open(e):(this._debugPrint(`Modal with ID "${e}" not found`),false)}get hasActiveModals(){return this._activeModals.size>0}back(){if(this._activeModals.size===0)return this._debugPrint("No active modals to go back from"),false;let e=Array.from(this._activeModals).pop();return e?this.close(e):false}closeAll(){let e=this._activeModals.size;return this._activeModals.clear(),this._notify(Ke.CLOSE_ALL,{}),e}subscribe(e,t){return this._subscribers.has(e)||this._subscribers.set(e,new Set),this._subscribers.get(e)?.add(t),()=>this.unsubscribe(e,t)}unsubscribe(e,t){this._subscribers.has(e)&&this._subscribers.get(e)?.delete(t);}_notify(e,t){if(this._subscribers.has(e))for(let s of this._subscribers.get(e)??new Set)try{s(t);}catch(o){this._sharedInstancesBag.telemetryManager.sendEventError(o,"modal subscriber"),this._debugPrint("Error in modal subscriber:",o);}}destroy(){super.destroy(),this.closeAll(),this._modals.clear(),this._subscribers.clear(),this._notify(Ke.DESTROY,{});}};var Hr="1.27.0-alpha.1";var Be="blocks",Ge=Hr;function jr(r){return Object.prototype.toString.call(r)==="[object Object]"}var Co=/\W|_/g;function Eo(r){return r.split(Co).map((i,e)=>i.charAt(0)[e>0?"toUpperCase":"toLowerCase"]()+i.slice(1)).join("")}function Kr(r,{ignoreKeys:i}={ignoreKeys:[]}){return Array.isArray(r)?r.map(e=>he(e,{ignoreKeys:i})):r}function he(r,{ignoreKeys:i}={ignoreKeys:[]}){if(Array.isArray(r))return Kr(r,{ignoreKeys:i});if(!jr(r))return r;let e={};for(let t of Object.keys(r)){let s=r[t];if(i.includes(t)){e[t]=s;continue}jr(s)?s=he(s,{ignoreKeys:i}):Array.isArray(s)&&(s=Kr(s,{ignoreKeys:i})),e[Eo(t)]=s;}return e}var xo=r=>new Promise(i=>setTimeout(i,r));function So({libraryName:r,libraryVersion:i,userAgent:e,publicKey:t="",integration:s=""}){let o="JavaScript";if(typeof e=="string")return e;if(typeof e=="function")return e({publicKey:t,libraryName:r,libraryVersion:i,languageName:o,integration:s});let n=[r,i,t].filter(Boolean).join("/"),a=[o,s].filter(Boolean).join("; ");return `${n} (${a})`}var Ao={factor:2,time:100};function Io(r,i=Ao){let e=0;function t(s){let o=Math.round(i.time*i.factor**e);return s({attempt:e,retry:a=>xo(a??o).then(()=>(e+=1,t(s)))})}return t(r)}var ht=class extends Error{},Gt=class r extends ht{originalProgressEvent;constructor(i){super(),this.name="NetworkError",this.message="Network error",Object.setPrototypeOf(this,r.prototype),this.originalProgressEvent=i;}},qt=(r,i)=>{r&&(r.aborted?Promise.resolve().then(i):r.addEventListener("abort",()=>i(),{once:true}));},qe=class r extends ht{isCancel=true;constructor(i="Request canceled"){super(i),this.name="CancelError",Object.setPrototypeOf(this,r.prototype);}},Ro=500,Gr=({check:r,interval:i=Ro,timeout:e,signal:t})=>new Promise((s,o)=>{let n,a;qt(t,()=>{n&&clearTimeout(n),o(new qe("Poll cancelled"));}),e&&(a=setTimeout(()=>{n&&clearTimeout(n),o(new qe("Timed out"));},e));let l=()=>{try{Promise.resolve(r(t)).then(c=>{c?(a&&clearTimeout(a),s(c)):n=setTimeout(l,i);}).catch(c=>{a&&clearTimeout(a),o(c);});}catch(c){a&&clearTimeout(a),o(c);}};n=setTimeout(l,0);}),x={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"},Wt="application/octet-stream",qr="original",Te=({method:r,url:i,data:e,headers:t={},signal:s,onProgress:o})=>new Promise((n,a)=>{let l=new XMLHttpRequest,c=r?.toUpperCase()||"GET",u=false;l.open(c,i,true),t&&Object.entries(t).forEach(d=>{let[p,h]=d;typeof h<"u"&&!Array.isArray(h)&&l.setRequestHeader(p,h);}),l.responseType="text",qt(s,()=>{u=true,l.abort(),a(new qe);}),l.onload=()=>{if(l.status!=200)a(new Error(`Error ${l.status}: ${l.statusText}`));else {let d={method:c,url:i,data:e,headers:t||void 0,signal:s,onProgress:o},p=l.getAllResponseHeaders().trim().split(/[\r\n]+/),h={};p.forEach(function(w){let C=w.split(": "),y=C.shift(),E=C.join(": ");y&&typeof y<"u"&&(h[y]=E);});let m=l.response,g=l.status;n({request:d,data:m,headers:h,status:g});}},l.onerror=d=>{u||a(new Gt(d));},o&&typeof o=="function"&&(l.upload.onprogress=d=>{d.lengthComputable?o({isComputable:true,value:d.loaded/d.total}):o({isComputable:false});}),e?l.send(e):l.send();});function $o(r,...i){return r}var ko=({name:r})=>r?[r]:[],Po=$o,Oo=()=>new FormData,Wr=r=>false,Xt=r=>typeof Blob<"u"&&r instanceof Blob,Yt=r=>typeof File<"u"&&r instanceof File,Zt=r=>!!r&&typeof r=="object"&&!Array.isArray(r)&&"uri"in r&&typeof r.uri=="string",Xe=r=>Xt(r)||Yt(r)||Wr()||Zt(r),Mo=r=>typeof r=="string"||typeof r=="number"||typeof r>"u",Lo=r=>!!r&&typeof r=="object"&&!Array.isArray(r),No=r=>!!r&&typeof r=="object"&&"data"in r&&Xe(r.data);function Xr(r,i,e){if(Array.isArray(e))for(let t of e)Xr(r,`${i}[]`,t);else if(No(e)){let{name:t,contentType:s}=e,o=Po(e.data,t,s??Wt),n=ko({name:t});r.push([i,o,...n]);}else if(Lo(e))for(let[t,s]of Object.entries(e))typeof s<"u"&&r.push([`${i}[${t}]`,String(s)]);else Mo(e)&&e&&r.push([i,e.toString()]);}function Uo(r){let i=[];for(let[e,t]of Object.entries(r))Xr(i,e,t);return i}function Qt(r){let i=Oo(),e=Uo(r);for(let t of e){let[s,o,...n]=t;i.append(s,o,...n);}return i}var V=class r extends ht{code;request;response;headers;constructor(i,e,t,s,o){super(),this.name="UploadError",this.message=i,this.code=e,this.request=t,this.response=s,this.headers=o,Object.setPrototypeOf(this,r.prototype);}},Do=r=>{let i=new URLSearchParams;for(let[e,t]of Object.entries(r))t&&typeof t=="object"&&!Array.isArray(t)?Object.entries(t).filter(s=>s[1]??false).forEach(s=>i.set(`${e}[${s[0]}]`,String(s[1]))):Array.isArray(t)?t.forEach(s=>{i.append(`${e}[]`,s);}):typeof t=="string"&&t?i.set(e,t):typeof t=="number"&&i.set(e,t.toString());return i.toString()},pe=(r,i,e)=>{let t=new URL(r);return t.pathname=(t.pathname+i).replace("//","/"),e&&(t.search=Do(e)),t.toString()},Fo="6.18.4",Vo="UploadcareUploadClient",zo=Fo;function De(r){return So({libraryName:Vo,libraryVersion:zo,...r})}var Ho="RequestThrottledError",Br=15e3,jo=1e3;function Ko(r){let{headers:i}=r||{};if(!i||typeof i["retry-after"]!="string")return Br;let e=parseInt(i["retry-after"],10);return Number.isFinite(e)?e*1e3:Br}function we(r,i){let{retryThrottledRequestMaxTimes:e,retryNetworkErrorMaxTimes:t}=i;return Io(({attempt:s,retry:o})=>r().catch(n=>{if("response"in n&&n?.code===Ho&&s<e)return o(Ko(n));if(n instanceof Gt&&s<t)return o((s+1)*jo);throw n}))}var Yr=r=>{let i="";return (Xt(r)||Yt(r)||Zt(r))&&(i=r.type),i||Wt},Zr=r=>{let i="";return Yt(r)&&r.name?i=r.name:Xt(r)||Wr()?i="":Zt(r)&&r.name&&(i=r.name),i||qr};function Di(r){return typeof r>"u"||r==="auto"?"auto":r?"1":"0"}function Bo(r,{publicKey:i,fileName:e,contentType:t,baseURL:s=x.baseURL,secureSignature:o,secureExpire:n,store:a,signal:l,onProgress:c,source:u="local",integration:d,userAgent:p,retryThrottledRequestMaxTimes:h=x.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=x.retryNetworkErrorMaxTimes,metadata:g}){return we(()=>Te({method:"POST",url:pe(s,"/base/",{jsonerrors:1}),headers:{"X-UC-User-Agent":De({publicKey:i,integration:d,userAgent:p})},data:Qt({file:{data:r,name:e||Zr(r),contentType:t||Yr(r)},UPLOADCARE_PUB_KEY:i,UPLOADCARE_STORE:Di(a),signature:o,expire:n,source:u,metadata:g}),signal:l,onProgress:c}).then(({data:w,headers:C,request:y})=>{let E=he(JSON.parse(w));if("error"in E)throw new V(E.error.content,E.error.errorCode,y,E,C);return E}),{retryNetworkErrorMaxTimes:m,retryThrottledRequestMaxTimes:h})}var Mi;(function(r){r.Token="token",r.FileInfo="file_info";})(Mi||(Mi={}));function Go(r,{publicKey:i,baseURL:e=x.baseURL,store:t,fileName:s,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,source:c="url",signal:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:h=x.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=x.retryNetworkErrorMaxTimes,metadata:g}){return we(()=>Te({method:"POST",headers:{"X-UC-User-Agent":De({publicKey:i,integration:d,userAgent:p})},url:pe(e,"/from_url/",{jsonerrors:1,pub_key:i,source_url:r,store:Di(t),filename:s,check_URL_duplicates:o?1:void 0,save_URL_duplicates:n?1:void 0,signature:a,expire:l,source:c,metadata:g}),signal:u}).then(({data:w,headers:C,request:y})=>{let E=he(JSON.parse(w));if("error"in E)throw new V(E.error.content,E.error.errorCode,y,E,C);return E}),{retryNetworkErrorMaxTimes:m,retryThrottledRequestMaxTimes:h})}var U;(function(r){r.Unknown="unknown",r.Waiting="waiting",r.Progress="progress",r.Error="error",r.Success="success";})(U||(U={}));var qo=r=>"status"in r&&r.status===U.Error;function Wo(r,{publicKey:i,baseURL:e=x.baseURL,signal:t,integration:s,userAgent:o,retryThrottledRequestMaxTimes:n=x.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:a=x.retryNetworkErrorMaxTimes}={}){return we(()=>Te({method:"GET",headers:i?{"X-UC-User-Agent":De({publicKey:i,integration:s,userAgent:o})}:void 0,url:pe(e,"/from_url/status/",{jsonerrors:1,token:r}),signal:t}).then(({data:l,headers:c,request:u})=>{let d=he(JSON.parse(l));if("error"in d&&!qo(d))throw new V(d.error.content,d.error.errorCode,u,d,c);return d}),{retryNetworkErrorMaxTimes:a,retryThrottledRequestMaxTimes:n})}function Xo(r,{publicKey:i,baseURL:e=x.baseURL,jsonpCallback:t,secureSignature:s,secureExpire:o,signal:n,source:a,integration:l,userAgent:c,retryThrottledRequestMaxTimes:u=x.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:d=x.retryNetworkErrorMaxTimes}){return we(()=>Te({method:"POST",headers:{"X-UC-User-Agent":De({publicKey:i,integration:l,userAgent:c})},url:pe(e,"/group/",{jsonerrors:1}),data:Qt({files:r,callback:t,pub_key:i,signature:s,expire:o,source:a}),signal:n}).then(({data:p,headers:h,request:m})=>{let g=he(JSON.parse(p));if("error"in g)throw new V(g.error.content,g.error.errorCode,m,g,h);return g}),{retryNetworkErrorMaxTimes:d,retryThrottledRequestMaxTimes:u})}function Qr(r,{publicKey:i,baseURL:e=x.baseURL,signal:t,source:s,integration:o,userAgent:n,retryThrottledRequestMaxTimes:a=x.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=x.retryNetworkErrorMaxTimes}){return we(()=>Te({method:"GET",headers:{"X-UC-User-Agent":De({publicKey:i,integration:o,userAgent:n})},url:pe(e,"/info/",{jsonerrors:1,pub_key:i,file_id:r,source:s}),signal:t}).then(({data:c,headers:u,request:d})=>{let p=he(JSON.parse(c));if("error"in p)throw new V(p.error.content,p.error.errorCode,d,p,u);return p}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})}function Yo(r,{publicKey:i,contentType:e,fileName:t,multipartChunkSize:s=x.multipartChunkSize,baseURL:o="",secureSignature:n,secureExpire:a,store:l,signal:c,source:u="local",integration:d,userAgent:p,retryThrottledRequestMaxTimes:h=x.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:m=x.retryNetworkErrorMaxTimes,metadata:g}){return we(()=>Te({method:"POST",url:pe(o,"/multipart/start/",{jsonerrors:1}),headers:{"X-UC-User-Agent":De({publicKey:i,integration:d,userAgent:p})},data:Qt({filename:t,size:r,content_type:e||Wt,part_size:s,UPLOADCARE_STORE:Di(l),UPLOADCARE_PUB_KEY:i,signature:n,expire:a,source:u,metadata:g}),signal:c}).then(({data:w,headers:C,request:y})=>{let E=he(JSON.parse(w));if("error"in E)throw new V(E.error.content,E.error.errorCode,y,E,C);return E.parts=Object.keys(E.parts).map(G=>E.parts[Number(G)]),E}),{retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m})}function Zo(r,i,{contentType:e,signal:t,onProgress:s,retryThrottledRequestMaxTimes:o=x.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:n=x.retryNetworkErrorMaxTimes}){return we(()=>Te({method:"PUT",url:i,data:r,onProgress:s,signal:t,headers:{"Content-Type":e||Wt}}).then(a=>(s&&s({isComputable:true,value:1}),a)).then(({status:a})=>({code:a})),{retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n})}function Qo(r,{publicKey:i,baseURL:e=x.baseURL,source:t="local",signal:s,integration:o,userAgent:n,retryThrottledRequestMaxTimes:a=x.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:l=x.retryNetworkErrorMaxTimes}){return we(()=>Te({method:"POST",url:pe(e,"/multipart/complete/",{jsonerrors:1}),headers:{"X-UC-User-Agent":De({publicKey:i,integration:o,userAgent:n})},data:Qt({uuid:r,UPLOADCARE_PUB_KEY:i,source:t}),signal:s}).then(({data:c,headers:u,request:d})=>{let p=he(JSON.parse(c));if("error"in p)throw new V(p.error.content,p.error.errorCode,d,p,u);return p}),{retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})}function Fi(r,{publicKey:i,baseURL:e,source:t,integration:s,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a,signal:l,onProgress:c}){return Gr({check:u=>Qr(r,{publicKey:i,baseURL:e,signal:u,source:t,integration:s,userAgent:o,retryThrottledRequestMaxTimes:n,retryNetworkErrorMaxTimes:a}).then(d=>d.isReady?d:(c&&c({isComputable:true,value:1}),false)),signal:l})}function Jo(r){return "defaultEffects"in r}var Ue=class{uuid;name;size;isStored;isImage;mimeType;cdnUrl;s3Url;originalFilename;imageInfo;videoInfo;contentInfo;metadata;s3Bucket;defaultEffects=null;constructor(i,{baseCDN:e=x.baseCDN,fileName:t}={}){let{uuid:s,s3Bucket:o}=i,n=pe(e,`${s}/`),a=o?pe(`https://${o}.s3.amazonaws.com/`,`${s}/${i.filename}`):null;this.uuid=s,this.name=t||i.filename,this.size=i.size,this.isStored=i.isStored,this.isImage=i.isImage,this.mimeType=i.mimeType,this.cdnUrl=n,this.originalFilename=i.originalFilename,this.imageInfo=i.imageInfo,this.videoInfo=i.videoInfo,this.contentInfo=i.contentInfo,this.metadata=i.metadata||null,this.s3Bucket=o||null,this.s3Url=a,Jo(i)&&(this.defaultEffects=i.defaultEffects);}},en=(r,{publicKey:i,fileName:e,baseURL:t,secureSignature:s,secureExpire:o,store:n,contentType:a,signal:l,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,baseCDN:g,metadata:w})=>Bo(r,{publicKey:i,fileName:e,contentType:a,baseURL:t,secureSignature:s,secureExpire:o,store:n,signal:l,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,metadata:w}).then(({file:C})=>Fi(C,{publicKey:i,baseURL:t,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,onProgress:c,signal:l})).then(C=>new Ue(C,{baseCDN:g})),tn=(r,{publicKey:i,fileName:e,baseURL:t,signal:s,onProgress:o,source:n,integration:a,userAgent:l,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:u,baseCDN:d})=>Qr(r,{publicKey:i,baseURL:t,signal:s,source:n,integration:a,userAgent:l,retryThrottledRequestMaxTimes:c,retryNetworkErrorMaxTimes:u}).then(p=>new Ue(p,{baseCDN:d,fileName:e})).then(p=>(o&&o({isComputable:true,value:1}),p)),rn=(r,{signal:i}={})=>{let e=null,t=null,s=r.map(()=>new AbortController),o=n=>()=>{t=n,s.forEach((a,l)=>l!==n&&a.abort());};return qt(i,()=>{s.forEach(n=>n.abort());}),Promise.all(r.map((n,a)=>{let l=o(a);return Promise.resolve().then(()=>n({stopRace:l,signal:s[a].signal})).then(c=>(l(),c)).catch(c=>(e=c,null))})).then(n=>{if(t===null)throw e;return n[t]})},sn=window.WebSocket,Li=class{events=Object.create({});emit(i,e){this.events[i]?.forEach(t=>t(e));}on(i,e){this.events[i]=this.events[i]||[],this.events[i].push(e);}off(i,e){e?this.events[i]=this.events[i].filter(t=>t!==e):this.events[i]=[];}},on=(r,i)=>r==="success"?{status:U.Success,...i}:r==="progress"?{status:U.Progress,...i}:{status:U.Error,...i},Ni=class{key;disconnectTime;ws=void 0;queue=[];isConnected=false;subscribers=0;emmitter=new Li;disconnectTimeoutId=null;constructor(i,e=3e4){this.key=i,this.disconnectTime=e;}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 sn(i),this.ws.addEventListener("error",e=>{this.emmitter.emit("error",new Error(e.message));}),this.emmitter.on("connected",()=>{this.isConnected=true,this.queue.forEach(e=>this.send(e.event,e.data)),this.queue=[];}),this.ws.addEventListener("message",e=>{let t=JSON.parse(e.data.toString());switch(t.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(t.channel,on(t.event,JSON.parse(t.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,e){let t=JSON.stringify({event:i,data:e});this.ws?.send(t);}subscribe(i,e){this.subscribers+=1,this.connect();let t=`task-status-${i}`,s={event:"pusher:subscribe",data:{channel:t}};this.emmitter.on(t,e),this.isConnected?this.send(s.event,s.data):this.queue.push(s);}unsubscribe(i){this.subscribers-=1;let e=`task-status-${i}`,t={event:"pusher:unsubscribe",data:{channel:e}};this.emmitter.off(e),this.isConnected?this.send(t.event,t.data):this.queue=this.queue.filter(s=>s.data.channel!==e),this.subscribers===0&&this.disconnect();}onError(i){return this.emmitter.on("error",i),()=>this.emmitter.off("error",i)}},Pi=null,Vi=r=>{if(!Pi){let i=typeof window>"u"?0:3e4;Pi=new Ni(r,i);}return Pi},nn=r=>{Vi(r).connect();};function an({token:r,publicKey:i,baseURL:e,integration:t,userAgent:s,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n,onProgress:a,signal:l}){return Gr({check:c=>Wo(r,{publicKey:i,baseURL:e,integration:t,userAgent:s,retryThrottledRequestMaxTimes:o,retryNetworkErrorMaxTimes:n,signal:c}).then(u=>{switch(u.status){case U.Error:return new V(u.error,u.errorCode);case U.Waiting:return false;case U.Unknown:return new V(`Token "${r}" was not found.`);case U.Progress:return a&&(u.total==="unknown"?a({isComputable:false}):a({isComputable:true,value:u.done/u.total})),false;case U.Success:return a&&a({isComputable:true,value:u.done/u.total}),u;default:throw new Error("Unknown status")}}),signal:l})}var ln=({token:r,pusherKey:i,signal:e,onProgress:t})=>new Promise((s,o)=>{let n=Vi(i),a=n.onError(o),l=()=>{a(),n.unsubscribe(r);};qt(e,()=>{l(),o(new qe("pusher cancelled"));}),n.subscribe(r,c=>{switch(c.status){case U.Progress:{t&&(c.total==="unknown"?t({isComputable:false}):t({isComputable:true,value:c.done/c.total}));break}case U.Success:{l(),t&&t({isComputable:true,value:c.done/c.total}),s(c);break}case U.Error:l(),o(new V(c.msg,c.error_code));}});}),cn=(r,{publicKey:i,fileName:e,baseURL:t,baseCDN:s,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,store:c,signal:u,onProgress:d,source:p,integration:h,userAgent:m,retryThrottledRequestMaxTimes:g,pusherKey:w=x.pusherKey,metadata:C})=>Promise.resolve(nn(w)).then(()=>Go(r,{publicKey:i,fileName:e,baseURL:t,checkForUrlDuplicates:o,saveUrlForRecurrentUploads:n,secureSignature:a,secureExpire:l,store:c,signal:u,source:p,integration:h,userAgent:m,retryThrottledRequestMaxTimes:g,metadata:C})).catch(y=>(Vi(w)?.disconnect(),Promise.reject(y))).then(y=>y.type===Mi.FileInfo?y:rn([({signal:E})=>an({token:y.token,publicKey:i,baseURL:t,integration:h,userAgent:m,retryThrottledRequestMaxTimes:g,onProgress:d,signal:E}),({signal:E})=>ln({token:y.token,pusherKey:w,signal:E,onProgress:d})],{signal:u})).then(y=>{if(y instanceof V)throw y;return y}).then(y=>Fi(y.uuid,{publicKey:i,baseURL:t,integration:h,userAgent:m,retryThrottledRequestMaxTimes:g,onProgress:d,signal:u})).then(y=>new Ue(y,{baseCDN:s})),Oi=new WeakMap,dn=async r=>{if(Oi.has(r))return Oi.get(r);let i=await fetch(r.uri).then(e=>e.blob());return Oi.set(r,i),i},Jr=async r=>{if(Yt(r)||Xt(r))return r.size;if(Zt(r))return (await dn(r)).size;throw new Error("Unknown file type. Cannot determine file size.")},un=(r,i=x.multipartMinFileSize)=>r>=i,es=r=>{let i="[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}",e=new RegExp(i);return !Xe(r)&&e.test(r)},zi=r=>{let i="^(?:\\w+:)?\\/\\/([^\\s\\.]+\\.\\S{2}|localhost[\\:?\\d]*)\\S*$",e=new RegExp(i);return !Xe(r)&&e.test(r)},pn=(r,i)=>new Promise((e,t)=>{let s=[],o=false,n=i.length,a=[...i],l=()=>{let c=i.length-a.length,u=a.shift();u&&u().then(d=>{o||(s[c]=d,n-=1,n?l():e(s));}).catch(d=>{o=true,t(d);});};for(let c=0;c<r;c++)l();}),hn=(r,i,e,t)=>{let s=t*i,o=Math.min(s+t,e);return r.slice(s,o)},fn=async(r,i,e)=>t=>hn(r,t,i,e),mn=(r,i,{publicKey:e,contentType:t,onProgress:s,signal:o,integration:n,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l})=>Zo(r,i,{contentType:t,onProgress:s,signal:o,retryThrottledRequestMaxTimes:a,retryNetworkErrorMaxTimes:l}),gn=async(r,{publicKey:i,fileName:e,fileSize:t,baseURL:s,secureSignature:o,secureExpire:n,store:a,signal:l,onProgress:c,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,contentType:g,multipartChunkSize:w=x.multipartChunkSize,maxConcurrentRequests:C=x.maxConcurrentRequests,baseCDN:y,metadata:E})=>{let G=t??await Jr(r),re,$e=(P,N)=>{if(!c)return;re||(re=Array(P).fill(0));let q=Q=>Q.reduce((se,gi)=>se+gi,0);return Q=>{Q.isComputable&&(re[N]=Q.value,c({isComputable:true,value:q(re)/P}));}};return g||=Yr(r),Yo(G,{publicKey:i,contentType:g,fileName:e||Zr(r),baseURL:s,secureSignature:o,secureExpire:n,store:a,signal:l,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,metadata:E,multipartChunkSize:w}).then(async({uuid:P,parts:N})=>{let q=await fn(r,G,w);return Promise.all([P,pn(C,N.map((Q,se)=>()=>mn(q(se),Q,{publicKey:i,contentType:g,onProgress:$e(N.length,se),signal:l,integration:d,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m})))])}).then(([P])=>Qo(P,{publicKey:i,baseURL:s,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m})).then(P=>P.isReady?P:Fi(P.uuid,{publicKey:i,baseURL:s,source:u,integration:d,userAgent:p,retryThrottledRequestMaxTimes:h,retryNetworkErrorMaxTimes:m,onProgress:c,signal:l})).then(P=>new Ue(P,{baseCDN:y}))};async function vn(r,{publicKey:i,fileName:e,baseURL:t=x.baseURL,secureSignature:s,secureExpire:o,store:n,signal:a,onProgress:l,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:h,contentType:m,multipartMinFileSize:g,multipartChunkSize:w,maxConcurrentRequests:C,baseCDN:y=x.baseCDN,checkForUrlDuplicates:E,saveUrlForRecurrentUploads:G,pusherKey:re,metadata:$e}){if(Xe(r)){let P=await Jr(r);return un(P,g)?gn(r,{publicKey:i,contentType:m,multipartChunkSize:w,fileSize:P,fileName:e,baseURL:t,secureSignature:s,secureExpire:o,store:n,signal:a,onProgress:l,source:c,integration:u,userAgent:d,maxConcurrentRequests:C,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:h,baseCDN:y,metadata:$e}):en(r,{publicKey:i,fileName:e,contentType:m,baseURL:t,secureSignature:s,secureExpire:o,store:n,signal:a,onProgress:l,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:h,baseCDN:y,metadata:$e})}if(zi(r))return cn(r,{publicKey:i,fileName:e,baseURL:t,baseCDN:y,checkForUrlDuplicates:E,saveUrlForRecurrentUploads:G,secureSignature:s,secureExpire:o,store:n,signal:a,onProgress:l,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,pusherKey:re,metadata:$e});if(es(r))return tn(r,{publicKey:i,fileName:e,baseURL:t,signal:a,onProgress:l,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:h,baseCDN:y});throw new TypeError(`File uploading from "${r}" is not supported`)}var bn=(r,i)=>{try{let e=new URL(r),t=new URL(i);return e.protocol=t.protocol,e.hostname=t.hostname,e.port=t.port,e.toString()}catch{return r}},Ui=class{uuid;filesCount;totalSize;isStored;isImage;cdnUrl;files;createdAt;storedAt=null;constructor(i,{baseCDN:e=x.baseCDN}={}){this.uuid=i.id,this.filesCount=i.filesCount;let t=i.files.filter(Boolean);this.totalSize=Object.values(t).reduce((s,o)=>s+o.size,0),this.isStored=!!i.datetimeStored,this.isImage=!!Object.values(t).filter(s=>s.isImage).length,this.cdnUrl=bn(i.cdnUrl,e),this.files=t.map(s=>new Ue(s,{baseCDN:e})),this.createdAt=i.datetimeCreated,this.storedAt=i.datetimeStored;}},yn=r=>{for(let i of r)if(!Xe(i))return false;return true},_n=r=>{for(let i of r)if(!es(i))return false;return true},Tn=r=>{for(let i of r)if(!zi(i))return false;return true};function Hl(r,{publicKey:i,fileName:e,baseURL:t=x.baseURL,secureSignature:s,secureExpire:o,store:n,signal:a,onProgress:l,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:h,contentType:m,multipartChunkSize:g=x.multipartChunkSize,baseCDN:w=x.baseCDN,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:y,jsonpCallback:E}){if(!yn(r)&&!Tn(r)&&!_n(r))throw new TypeError(`Group uploading from "${r}" is not supported`);let G,re=true,$e=r.length,P=(N,q)=>{if(!l)return;G||(G=Array(N).fill(0));let Q=se=>se.reduce((gi,Ws)=>gi+Ws)/N;return se=>{if(!se.isComputable||!re){re=false,l({isComputable:false});return}G[q]=se.value,l({isComputable:true,value:Q(G)});}};return Promise.all(r.map((N,q)=>Xe(N)||zi(N)?vn(N,{publicKey:i,fileName:e,baseURL:t,secureSignature:s,secureExpire:o,store:n,signal:a,onProgress:P($e,q),source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:h,contentType:m,multipartChunkSize:g,baseCDN:w,checkForUrlDuplicates:C,saveUrlForRecurrentUploads:y}).then(Q=>Q.uuid):N)).then(N=>Xo(N,{publicKey:i,baseURL:t,jsonpCallback:E,secureSignature:s,secureExpire:o,signal:a,source:c,integration:u,userAgent:d,retryThrottledRequestMaxTimes:p,retryNetworkErrorMaxTimes:h}).then(q=>new Ui(q,{baseCDN:w})).then(q=>(l&&l({isComputable:true,value:1}),q)))}var We=class{_concurrency=1;_pending=[];_running=0;_resolvers=new Map;_rejectors=new Map;constructor(i){this._concurrency=i;}run(){let i=this._concurrency-this._running;for(let e=0;e<i;e++){let t=this._pending.shift();if(!t)return;let s=this._resolvers.get(t),o=this._rejectors.get(t);if(!s||!o)throw new Error("Unexpected behavior: resolver or rejector is undefined");this._running+=1,t().finally(()=>{this._resolvers.delete(t),this._rejectors.delete(t),this._running-=1,this.run();}).then(n=>s(n)).catch(n=>o(n));}}add(i,{autoRun:e}={autoRun:true}){return new Promise((t,s)=>{this._resolvers.set(i,t),this._rejectors.set(i,s),this._pending.push(i),e&&this.run();})}get pending(){return this._pending.length}get running(){return this._running}set concurrency(i){this._concurrency=i,this.run();}get concurrency(){return this._concurrency}};var Hi=()=>({}),wn=r=>({...Hi(),"*currentActivity":null,"*currentActivityParams":{},"*history":[],"*historyBack":null,"*closeModal":()=>{r.modalManager?.close(r.$["*currentActivity"]),r.pub("*currentActivity",null);}}),Cn=r=>({...wn(r),"*commonProgress":0,"*uploadList":[],"*uploadQueue":new We(1),"*collectionErrors":[],"*collectionState":null,"*groupInfo":null,"*uploadTrigger":new Set}),Bl=r=>({...Cn(r),"*solution":null});var En={button:["toolbar"],checkbox:["toolbar"],menuitem:["menu","menubar"],option:["listbox"],tab:["tablist"]};function ft(r,i){i.tabIndex=0,i.focus(),r.tabIndex=-1;}function ji(r){let i=r.role||r.type||r.tagName;if(!i)return null;let e=En[i.toLowerCase()];if(!e)return null;for(let t of e){let s=r.closest(`[role=${t}]`);if(s)return s}}function Ki(r,i){return i.role==="toolbar"?xn(i):i.querySelectorAll(`[role=${r.role}]`)}function xn(r){return [...r.querySelectorAll("*")].filter(e=>e.role==="button"||e.type==="button"||e.role==="checkbox"||e.type==="checkbox")}function Sn(r){let i=r.getAttribute("aria-orientation");if(i==="vertical")return false;if(i==="horizontal")return true;let e=r.role;return e==="menubar"||e==="tablist"||e==="toolbar"}function ts(r){return i=>{let e=false,t=300,s=0,o="";function n(d){let p=ji(d.target);if(!p){a();return}let h=Ki(d.target,p),m=Array.from(h).indexOf(d.target),g="ArrowDown",w="ArrowUp";if(Sn(p)&&(i.document.dir==="rtl"?(g="ArrowLeft",w="ArrowRight"):(g="ArrowRight",w="ArrowLeft")),d.key===g)d.preventDefault(),ft(d.target,h[m+1]||h[0]);else if(d.key===w)d.preventDefault(),ft(d.target,h[m-1]||h[h.length-1]);else if(d.key==="Home")d.preventDefault(),ft(d.target,h[0]);else if(d.key==="End")d.preventDefault(),ft(d.target,h[h.length-1]);else if(d.key.length===1&&p.role!=="tablist"){let C=Date.now();C-s<=t?o+=d.key.toLowerCase():o=d.key.toLowerCase(),s=C;let y=Array.from(h).find(E=>E.textContent?.trim()?.toLowerCase()?.startsWith(o));y&&(d.preventDefault(),ft(d.target,y));}}function a(){e=false,i.removeEventListener("keydown",n);}function l(d){let p=ji(d.target);if(p){e||(e=true,i.addEventListener("keydown",n));let h=Ki(d.target,p);for(let m of h)m!==d.target&&m.setAttribute("tabindex",-1);}else e&&a();}function c(d){(!d.relatedTarget||d.relatedTarget===i.document)&&a();}function u(d){let p=ji(d.target);if(p){let h=Ki(d.target,p);for(let m of h)m!==d.target&&m.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 is(){return r=>{let i,e;function t(o){if(o.target.getAttribute("aria-hidden")==="true"){i=o.target,i.setAttribute("aria-hidden","false"),e=i.hidden,e&&(i.hidden=false);let n=o.target.querySelector('a, button, select, textarea, input:not([type=radio]), [type=radio]:checked, [tabindex]:not([tabindex="-1"])');n&&(n.tabIndex=0);}}function s(o){i&&i.contains(o.target)&&(!o.relatedTarget||!i.contains(o.relatedTarget))&&(o.target.tabIndex=-1,i.setAttribute("aria-hidden","true"),e&&(i.hidden=true),i=null);}return r.addEventListener("keyuxJump",t),r.addEventListener("focusout",s),()=>{r.removeEventListener("keyuxJump",t),r.removeEventListener("focusout",s);}}}function rs(){return r=>{let i=[];function e(l){let c=r.document.activeElement;c&&c!==r.document.body&&i.push(new WeakRef(c)),l.focus({focusVisible:true});}function t(){let l=i.pop();if(!l){r.document.activeElement.blur();return}let c=l.deref();c&&c.isConnected?c.focus():t();}let s=0,o;function n(l){clearInterval(o);let c=l.getAttribute("aria-controls");o=setInterval(()=>{if(s++>50){clearInterval(o);return}let u=r.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(o),u.dispatchEvent(new r.CustomEvent("keyuxJump",{bubbles:true})),e(d));}},50);}function a(l){l.target.getAttribute("aria-controls")&&l.key==="Enter"&&n(l.target),l.key==="Escape"&&t();}return r.addEventListener("keydown",a),()=>{r.removeEventListener("keydown",a);}}}function ss(r){let i,e=r.split(" "),t;function s(a){a.key==="Enter"&&(a.target.tagName==="BUTTON"||a.target.tagName==="A")&&(o(),a.target.classList.add(...e),i=a.target,t=a.target);}function o(){i&&i.classList.remove(...e),t=null;}function n(a){a.clientX===0&&a.clientY===0&&t!==a.target&&(o(),a.target.classList.add(...e),i=a.target);}return a=>(a.addEventListener("click",n),a.addEventListener("keydown",s),a.addEventListener("keyup",o),()=>{a.removeEventListener("click",n),a.removeEventListener("keydown",s),a.removeEventListener("keyup",o);})}function os(r,i){let e=i.map(t=>t(r));return ()=>{e.forEach(t=>t());}}var Bi=class{constructor(){this._listeners=new Map;this._scope=[];}addEventListener(i,e){let t=s=>{let o=s.target;o instanceof Node&&this._scope.some(n=>n===o||n.contains(o))&&e(s);};this._listeners.set(e,t),window.addEventListener(i,t);}removeEventListener(i,e){let t=this._listeners.get(e);t&&window.removeEventListener(i,t),this._listeners.delete(e);}get CustomEvent(){return window.CustomEvent}get document(){return window.document}get navigator(){return window.navigator}registerScope(i){this._scope.push(i);}destroy(){this._scope=[];for(let i of this._listeners.values())window.removeEventListener("keydown",i),window.removeEventListener("keyup",i);this._listeners.clear();}},Jt=class{constructor(){this._scopedWindow=new Bi,this._destroyKeyUX=os(this._scopedWindow,[ts(),ss("is-pressed"),rs(),is()]);}registerBlock(i){this._scopedWindow.registerScope(i);}destroy(){this._destroyKeyUX?.(),this._scopedWindow.destroy();}};var fe=r=>`*l10n/${r}`,An="en",ei=class extends K{constructor(e){super(e);this._localeName="";for(let[s,o]of Object.entries(dt)){let n=this._ctx.has(fe(s))?!this._ctx.read(fe(s)):true;this._ctx.add(fe(s),o,n);}let t=e.pluginManager;t?.onPluginsChange&&this.addSub(t.onPluginsChange(()=>{this._localeName&&this._applyPluginLocales(this._localeName);})),this.addSub(this._ctx.sub(k("localeName"),async s=>{if(!s)return;this._localeName=s;let o=await $r(s);s!==An&&this._localeName!==s||(this._applyPluginLocales(s),this._applyOverrides(s,o));})),this.addSub(this._ctx.sub(k("localeDefinitionOverride"),s=>{if(!s)return;let o=s[this._localeName];o&&this._applyOverrides(this._localeName,o);}));}_applyOverrides(e,t){let s=this._cfg.localeDefinitionOverride?.[e];for(let[o,n]of Object.entries(t)){let a=s?.[o];this._ctx.add(fe(o),a??n,true);}}_applyPluginLocales(e){let t=this._sharedInstancesBag.pluginManager;if(!t)return;let s=t.snapshot();for(let o of s.i18n){let{pluginId:n,...a}=o,l=a[e];if(l)for(let[c,u]of Object.entries(l))u!==void 0&&this._ctx.add(fe(c),u,true);}}};var ti=class{constructor(){this._definitions=new Map;}register(i,e){if(this._definitions.has(e.name)){console.warn(`[CustomConfig] Config option "${e.name}" is already registered`);return}let t={attribute:true,...e,pluginId:i};this._definitions.set(e.name,t);}unregister(i){this._definitions.delete(i);}unregisterByPlugin(i){for(let[e,t]of this._definitions)t.pluginId===i&&this._definitions.delete(e);}get(i){return this._definitions.get(i)}getAll(){return new Map(this._definitions)}};var ii=class extends K{constructor(e){super(e);this._plugins=new Map;this._sources=[];this._activities=[];this._fileActions=[];this._icons=[];this._i18n=[];this._subscribers=new Set;this._pluginsUpdate=Promise.resolve();this.configRegistry=new ti;this.addSub(this._ctx.sub(k("plugins"),t=>{this._pluginsUpdate=this._pluginsUpdate.then(()=>this._syncPlugins(t));}));}onPluginsChange(e){return this._subscribers.add(e),()=>{this._subscribers.delete(e);}}async _syncPlugins(e){let t=new Set(this._plugins.keys()),s=new Set;for(let o of e){if(s.has(o.id)){this._debugPrint(`Plugin "${o.id}" is already in the list, skipping duplicate`);continue}s.add(o.id);let n=this._plugins.get(o.id);if(!n||n.plugin!==o)try{await this._registerPlugin(o);}catch(a){this._purgeRegistrations(o.id),this._notifySubscribers(),this._debugPrint(`Plugin "${o.id}" setup failed`,a);}t.delete(o.id);}for(let o of t)this._unregisterPlugin(o);}async _registerPlugin(e){this._plugins.has(e.id)&&this._unregisterPlugin(e.id);let t={sources:[],activities:[],fileActions:[],icons:[],i18n:[]},s=[],l={registry:{registerSource:d=>this._register(this._sources,t.sources,e.id,d),registerActivity:d=>this._register(this._activities,t.activities,e.id,d),registerFileAction:d=>this._register(this._fileActions,t.fileActions,e.id,d),registerIcon:d=>this._register(this._icons,t.icons,e.id,d),registerI18n:d=>this._register(this._i18n,t.i18n,e.id,d),registerConfig:d=>{this.configRegistry.register(e.id,d);}},config:{get:d=>{let p=k(d);return this._ctx.read(p)},subscribe:(d,p)=>{let h=k(d),m=this._ctx.sub(h,g=>{p(g);});return s.push(m),m}},activity:{getParams:()=>this._ctx.read("*currentActivityParams"),subscribeToParams:d=>{let p=this._ctx.sub("*currentActivityParams",h=>{d(h);});return s.push(p),p}}},c=this._sharedInstancesBag.api,u=await e.setup({pluginApi:l,uploaderApi:c})??void 0;this._plugins.set(e.id,{plugin:e,exports:u,registrations:t,configSubscriptions:s}),this._notifySubscribers();}_unregisterPlugin(e){let t=this._plugins.get(e);if(t){this._purgeRegistrations(e);for(let s of t.configSubscriptions)try{s();}catch(o){this._debugPrint("Failed to unsubscribe config listener",o);}t.exports?.dispose?.(),this._plugins.delete(e),this._notifySubscribers();}}snapshot(){return {sources:[...this._sources],activities:[...this._activities],fileActions:[...this._fileActions],icons:[...this._icons],i18n:[...this._i18n]}}destroy(){for(let e of Array.from(this._plugins.keys()))this._unregisterPlugin(e);super.destroy();}_register(e,t,s,o){let n={...o,pluginId:s};return e.push(n),t.push(n),o}_purgeRegistrations(e){this._sources=this._sources.filter(t=>t.pluginId!==e),this._activities=this._activities.filter(t=>t.pluginId!==e),this._fileActions=this._fileActions.filter(t=>t.pluginId!==e),this._icons=this._icons.filter(t=>t.pluginId!==e),this._i18n=this._i18n.filter(t=>t.pluginId!==e),this.configRegistry.unregisterByPlugin(e);}_notifySubscribers(){for(let e of this._subscribers)try{e();}catch{}}};function In(r){return r.replace(/[A-Z]/g,i=>`_${i.toLowerCase()}`).replace(/__/g,"_")}function qi(r){return Array.isArray(r)?r.map(i=>typeof i=="object"&&i!==null?qi(i):i):typeof r!="object"||r===null?r:Object.fromEntries(Object.entries(r).map(([i,e])=>{let t=In(i);return typeof e=="object"&&e!==null?[t,qi(e)]:[t,e]}))}function Rn(r){return {ok:true,value:r}}function Gi(r){return {ok:false,error:r}}var $n="https://tlm.uploadcare.com/api/",Wi=class{constructor(i=$n){this.baseUrl=i;}async base(i,e={}){let t=`${this.baseUrl}${i}`;try{let s=await fetch(t,e);if(!s.ok)return Gi(new Error(`Got non-200 response from "${t}". Status: ${s.status.toString()}`));try{let o=await s.json();return Rn(o)}catch(o){return Gi(new Error(`Error parsing JSON from "${t}". Error: ${o}`))}}catch(s){return Gi(new Error(`Error fetching data from "${t}". Error: ${s}`))}}async post(i,e,t={}){return await this.base(i,{...t,method:"POST",body:JSON.stringify(qi(e)),headers:{"Content-Type":"application/json",...t.headers||{}}})}async get(i,e={}){return await this.base(i,{method:"GET",...e})}},kn=async(r,i)=>({success:true,data:i}),Pn=async r=>kn(void 0,r),ri=class extends Wi{constructor(){super();}async sendEvent(i,e){let t=await Pn(i);if(!t.success)throw console.error("TelemetryAPIService: events: body is invalid",t.error),new Error("TelemetryAPIService: events: body is invalid");return this.post("v1/events",i,e)}};var On=20,me=Object.freeze({INIT_SOLUTION:"init-solution",CHANGE_CONFIG:"change-config",ACTION_EVENT:"action-event",ERROR_EVENT:"error-event"}),ge=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"}),si=class extends K{constructor(){super(...arguments);this._timeoutStore=new Map;this._targets=new Set;}bindTarget(e){return this._targets.add(e),()=>{this._targets.delete(e);}}_dispatch(e,t){for(let s of this._targets)s.dispatchEvent(new CustomEvent(e,{detail:t}));this._debugPrint?.(()=>{let s=t&&typeof t=="object"?{...t}:t;return [`event "${e}"`,s]});}emit(e,t,s={}){let{debounce:o}=s;if(typeof o!="number"&&!o){this._dispatch(e,typeof t=="function"?t():t);return}this._timeoutStore.has(e)&&window.clearTimeout(this._timeoutStore.get(e));let n=typeof o=="number"?o:On,a=window.setTimeout(()=>{try{let l=typeof t=="function"?t():t;this._dispatch(e,l),this._timeoutStore.delete(e);}catch(l){this._debugPrint?.(()=>`Error while getting payload for event "${e}"`,l);}},n);this._timeoutStore.set(e,a);}destroy(){for(let e of this._timeoutStore.values())window.clearTimeout(e);this._targets.clear();}};var oi=class extends K{constructor(e){super(e);this._sessionId=ye.generateRandomUUID();this._config=structuredClone(ue);this._initialized=false;this._lastPayload=null;this._isEnabled=false;this._telemetryInstance=new ri,this._queue=new We(10),this.addSub(this._ctx.sub(k("qualityInsights"),t=>{this._isEnabled=!!t;}));for(let t of Object.keys(this._config))this.addSub(this._ctx.sub(k(t),s=>{this._isEnabled&&(this._initialized&&this._config[t]!==s&&this.sendEvent({eventType:me.CHANGE_CONFIG}),this._setConfig(t,s));}));}_init(e){e===me.INIT_SOLUTION&&!this._initialized&&(this._initialized=true);}_setConfig(e,t){this._config[e]!==t&&(this._config[e]=t);}_formattingPayload(e){let t=e.payload?{...e.payload}:{};t.activity&&(t.activity=void 0);let s={...e};return (e.eventType===me.INIT_SOLUTION||e.eventType===me.CHANGE_CONFIG)&&(s.config=this._config),{...s,appVersion:Ge,appName:Be,sessionId:this._sessionId,component:this._solution,activity:this._activity,projectPubkey:this._config.pubkey,userAgent:navigator.userAgent,eventType:s.eventType??"",eventTimestamp:this._timestamp,payload:{location:this._location,...t}}}_excludedEvents(e){return !!(e&&[ge.CHANGE,ge.COMMON_UPLOAD_PROGRESS,ge.FILE_ADDED,ge.FILE_REMOVED,ge.FILE_UPLOAD_START,ge.FILE_UPLOAD_PROGRESS,ge.FILE_UPLOAD_SUCCESS,ge.FILE_UPLOAD_FAILED].includes(e))}sendEvent(e){if(!this._isEnabled)return;let t=this._formattingPayload({eventType:e.eventType,payload:e.payload,config:e.config});this._init(e.eventType),!(this._excludedEvents(e.eventType)||this._lastPayload&&this._checkObj(this._lastPayload,t))&&this._queue.add(async()=>{this._lastPayload=t,await this._telemetryInstance.sendEvent(t);});}sendEventError(e,t="unknown"){this.sendEvent({eventType:me.ERROR_EVENT,payload:{metadata:{event:"error",text:`Error in ${t}`,error:e.message}}});}sendEventCloudImageEditor(e,t,s={}){this.sendEvent({eventType:me.ACTION_EVENT,payload:{metadata:{tabId:t,node:e.currentTarget?.tagName,event:e.type,...s}}});}_checkObj(e,t){if(JSON.stringify(e)===JSON.stringify(t))return true;if(typeof e!="object"||typeof t!="object"||e==null||t==null)return false;let s=Object.keys(e),o=Object.keys(t);if(s.length!==o.length)return false;for(let n of s)if(!Object.hasOwn(t,n)||!this._checkObj(e[n],t[n]))return false;return true}get _timestamp(){return Date.now()}get _solution(){if(!this._ctx.has("*solution"))return null;let e=this._ctx.read("*solution");return e?e.toLowerCase():null}get _activity(){return this._ctx.has("*currentActivity")?this._ctx.read("*currentActivity"):null}get _location(){return location.origin}};var ns=r=>{let i=new Intl.Locale(r),e="ltr",t=i.getTextInfo?.().direction;return t?e=t:i.textInfo?.direction&&(e=i.textInfo.direction),e};var Mn=r=>r;var as="plural:";function ni(r,i={},e={}){let{openToken:t="{{",closeToken:s="}}",transform:o=Mn}=e;for(let n in i){let a=i[n],l=a?.toString(),c=typeof l=="string"?o(l):String(l);r=r.replaceAll(t+n+s,c);}return r}function ls(r){let i=[],e=r.indexOf("{{");for(;e!==-1;){let t=r.indexOf("}}",e);if(t===-1)break;let s=r.substring(e+2,t);if(s.startsWith(as)){let o=r.substring(e+2,t).replace(as,""),n=o.substring(0,o.indexOf("(")),a=o.substring(o.indexOf("(")+1,o.indexOf(")"));i.push({variable:s,pluralKey:n,countVariable:a});}e=r.indexOf("{{",t);}return i}function z(r,i){let e,t=((...s)=>{e&&clearTimeout(e),e=setTimeout(()=>r(...s),i);});return t.cancel=()=>{e&&clearTimeout(e);},t}var cs="--uploadcare-blocks-window-height",mt=class r{static{this.clientsRegistry=new Set;}static{this.flush=z(()=>{document.documentElement.style.setProperty(cs,`${window.innerHeight}px`);},100);}static registerClient(i){r.clientsRegistry.size===0&&r.attachTracker(),r.clientsRegistry.add(i);}static unregisterClient(i){r.clientsRegistry.delete(i),r.clientsRegistry.size===0&&r.detachTracker();}static attachTracker(){window.addEventListener("resize",r.flush,{passive:true,capture:true}),r.flush();}static detachTracker(){window.removeEventListener("resize",r.flush,{capture:true}),document.documentElement.style.removeProperty(cs);}};var Ln=/\\([0-9a-fA-F]{1,6} ?)/g;function Nn(r){return r.length<2?false:(r[0]==='"'||r[0]==="'")&&(r[r.length-1]==='"'||r[r.length-1]==="'")}function Un(r){let i=r;return (i[0]==='"'||i[0]==="'")&&(i=i.slice(1)),(i[i.length-1]==='"'||i[i.length-1]==="'")&&(i=i.slice(0,-1)),i}function Dn(r){let i="",e="";for(let t=0;t<r.length;t++){let s=r[t+1];r[t]==="\\"&&s==='"'?(i+='\\"',t++):r[t]==='"'&&e!=="\\"?i+='\\"':i+=r[t],e=r[t]??"";}return i}function ds(r){let i=r;Nn(r)&&(i=Un(i),i=i.replace(Ln,(e,t)=>String.fromCodePoint(parseInt(t.trim(),16))),i=i.replaceAll(`\\ `,"\\n"),i=Dn(i),i='"'+i+'"');try{return JSON.parse(i)}catch{return}}function us(r){class i extends r{constructor(){super(...arguments);this._cssDataCache=null;this._computedStyle=null;}getCssData(s,o=false){let n=this._cssDataCache??Object.create(null);if(!Object.keys(n).includes(s)||!n[s]){this._computedStyle||(this._computedStyle=window.getComputedStyle(this));let a=this._computedStyle.getPropertyValue(s).trim();try{n[s]=ds(a);}catch(l){o||console.warn(`CSS Data error: ${s}`,l),n[s]=null;}}return this._cssDataCache=n,n[s]}}return i}function ps(r){class i extends r{constructor(){super(...arguments);this.willYield=true;this._slotsMap={};this._initialLightDomChildren=null;this._hasAdoptedChildren=false;}createRenderRoot(){return this}connectedCallback(){this._initialLightDomChildren||(this._initialLightDomChildren=Array.from(this.childNodes)),super.connectedCallback();}_adoptChildren(){if(this._hasAdoptedChildren)return;this._hasAdoptedChildren=true,this._slotsMap={};let s=Array.from(this.childNodes),o=s.length?s:this._initialLightDomChildren??[];for(let n of o){let a=this._getSlotNameForChild(n),l=this._slotsMap[a]??[];n instanceof Element&&(n.removeAttribute("slot"),n.removeAttribute("content-for")),l.push(n),this._slotsMap[a]=l;}this._initialLightDomChildren=null;}_getSlotNameForChild(s){return s instanceof Comment&&s.nextSibling instanceof Element?this._getSlotNameForChild(s.nextSibling):"contentFor"in s?s.contentFor||"":s instanceof Element&&s.hasAttribute("content-for")&&s.getAttribute("content-for")||""}_isTextNodeEmpty(s){return !s.textContent||!s.textContent.trim()}_isSlotEmpty(s){let o=this._slotsMap[s];return !o||o.every(n=>n instanceof Comment||n instanceof Text&&this._isTextNodeEmpty(n))}update(s){!this.hasUpdated&&this.willYield&&this._adoptChildren(),super.update(s);}yield(s,o){if(s===""&&!this._slotsMap[s]&&!this._hasAdoptedChildren&&this._initialLightDomChildren?.length){let a=[];for(let l of this._initialLightDomChildren)l instanceof Element&&(l.removeAttribute("slot"),l.removeAttribute("content-for")),a.push(l);this._slotsMap[s]=a,this._hasAdoptedChildren=true,this._initialLightDomChildren=null;}let n=this._slotsMap[s];return v` ${n} ${this._isSlotEmpty(s)?o:void 0} `}}return i}var hs=(r,i)=>new Intl.PluralRules(r).select(i);var Fn=r=>(i,e)=>{let t=r(),s=t("locale-id")||"en",o=hs(s,e);return t(`${i}__${o}`)},fs=r=>{let i=Fn(()=>e),e=(t,s={})=>{if(!t)return "";let n=r().read(fe(t))||t,a=ls(n);for(let c of a)s[c.variable]=i(c.pluralKey,Number(s[c.countVariable]));return ni(n,s)};return e};function ms(r){class i extends r{static reg(t){let s=this,o=window.customElements.get(t);if(o){o!==s&&console.warn([`Element with tag name "${t}" 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(t,s);}}return i}var Ce=class extends Event{constructor(i,e,t,s){super("context-request",{bubbles:true,composed:true}),this.context=i,this.contextTarget=e,this.callback=t,this.subscribe=s??false;}};var Ye=class{constructor(i,e,t,s){if(this.subscribe=false,this.provided=false,this.value=void 0,this.t=(o,n)=>{this.unsubscribe&&(this.unsubscribe!==n&&(this.provided=false,this.unsubscribe()),this.subscribe||this.unsubscribe()),this.value=o,this.host.requestUpdate(),this.provided&&!this.subscribe||(this.provided=true,this.callback&&this.callback(o,n)),this.unsubscribe=n;},this.host=i,e.context!==void 0){let o=e;this.context=o.context,this.callback=o.callback,this.subscribe=o.subscribe??false;}else this.context=e,this.callback=t,this.subscribe=s??false;this.host.addController(this);}hostConnected(){this.dispatchRequest();}hostDisconnected(){this.unsubscribe&&(this.unsubscribe(),this.unsubscribe=void 0);}dispatchRequest(){this.host.dispatchEvent(new Ce(this.context,this.host,this.t,this.subscribe));}};var ai=class{get value(){return this.o}set value(i){this.setValue(i);}setValue(i,e=false){let t=e||!Object.is(i,this.o);this.o=i,t&&this.updateObservers();}constructor(i){this.subscriptions=new Map,this.updateObservers=()=>{for(let[e,{disposer:t}]of this.subscriptions)e(this.o,t);},i!==void 0&&(this.value=i);}addCallback(i,e,t){if(!t)return void i(this.value);this.subscriptions.has(i)||this.subscriptions.set(i,{disposer:()=>{this.subscriptions.delete(i);},consumerHost:e});let{disposer:s}=this.subscriptions.get(i);i(this.value,s);}clearCallbacks(){this.subscriptions.clear();}};var Xi=class extends Event{constructor(i,e){super("context-provider",{bubbles:true,composed:true}),this.context=i,this.contextTarget=e;}},Ze=class extends ai{constructor(i,e,t){super(e.context!==void 0?e.initialValue:t),this.onContextRequest=s=>{if(s.context!==this.context)return;let o=s.contextTarget??s.composedPath()[0];o!==this.host&&(s.stopPropagation(),this.addCallback(s.callback,o,s.subscribe));},this.onProviderRequest=s=>{if(s.context!==this.context||(s.contextTarget??s.composedPath()[0])===this.host)return;let o=new Set;for(let[n,{consumerHost:a}]of this.subscriptions)o.has(n)||(o.add(n),a.dispatchEvent(new Ce(this.context,a,n,true)));s.stopPropagation();},this.host=i,e.context!==void 0?this.context=e.context:this.context=e,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 Xi(this.context,this.host));}};var gs="ctx-name-context";function vs(){return function(r){class i extends r{constructor(...s){super(...s);this._symbioteSharedPubSub=null;this._symbioteFirstUpdated=false;this._needsReconnectInit=false;this._ctxNameProvider=void 0;this._pendingSharedAdds=new Map;this._symbioteSubscriptions=new Set;this.init$={};this.ctxOwner=false;this._ctxNameAttrValue=void 0;this._pendingCtxInitOnConnect=false;this.ctxName=this._effectiveCtxName;this._isInitialized=false;this._ctxNameAttrValue=this.getAttribute("ctx-name")||void 0,this.ctxName=this._effectiveCtxName,this._ctxNameConsumer=new Ye(this,{context:gs,callback:o=>{if(!o){console.error("SymbioteMixin: Received invalid ctx-name from context");return}this._ctxNameFromContext=o,this._handleCtxNameSourceChange();},subscribe:true});}static set template(s){console.error("Caution: static 'template' property is deprecated and has no effect. See https://github.com/uploadcare/file-uploader/releases/tag/v1.25.0 for details.");}get _ctxNameAttr(){return this._ctxNameAttrValue}set _ctxNameAttr(s){let o=s??void 0;this._ctxNameAttrValue!==o&&(this._ctxNameAttrValue=o,this._handleCtxNameSourceChange());}shouldUpdate(s){return this._isInitialized?super.shouldUpdate(s):false}get _effectiveCtxName(){return this._ctxNameAttr||this._ctxNameFromContext||void 0}_handleCtxNameSourceChange(){if(this.ctxName=this._effectiveCtxName,!(!this.ctxName||this._symbioteFirstUpdated)){if(this.isConnected){this._performInitialization();return}this._pendingCtxInitOnConnect=true;}}willUpdate(s){super.willUpdate(s),this.ctxName=this._effectiveCtxName,this.ctxName&&(this._ctxNameProvider?this._ctxNameProvider.setValue(this.ctxName):this._ctxNameProvider=new Ze(this,{context:gs,initialValue:this.ctxName}));}_applyPendingSharedAdds(){if(!(!this._symbioteSharedPubSub||this._pendingSharedAdds.size===0)){for(let[s,{value:o,rewrite:n}]of this._pendingSharedAdds)this._symbioteSharedPubSub.add(s,o,n);this._pendingSharedAdds.clear();}}_getSharedPubSub(){return !this._symbioteSharedPubSub&&this._effectiveCtxName&&this._initSharedContext(),this._symbioteSharedPubSub&&this._applyPendingSharedAdds(),this._symbioteSharedPubSub}_requireSharedPubSub(){let s=this._getSharedPubSub();if(!s)throw new Error("SymbioteMixin: Shared context is not initialized.");return s}_initSharedContext(){let s=this.init$,o=this._effectiveCtxName;if(!o){console.error("SymbioteMixin: ctx-name is required for components with shared properties (*)");return}if(!this._symbioteSharedPubSub){this._symbioteSharedPubSub=ke.getCtx(o)??ke.registerCtx(s,o);for(let[n,a]of Object.entries(this.init$))this._symbioteSharedPubSub.add(n,a,this.ctxOwner);this._applyPendingSharedAdds();}}get $(){return this._effectiveCtxName&&this._initSharedContext(),new Proxy({},{get:(s,o)=>{if(typeof o=="string")return this._symbioteSharedPubSub?.read(o)},set:(s,o,n)=>(typeof o!="string"||this._symbioteSharedPubSub?.pub(o,n),true)})}sub(s,o,n=true){let a=this._requireSharedPubSub().sub(s,o,n);if(!a||typeof a!="function")return ()=>{};let l=a.bind(a),c=false,u=()=>{c||(c=true,l(),this._symbioteSubscriptions.delete(u));};return this._symbioteSubscriptions.add(u),u}pub(s,o){this._requireSharedPubSub().pub(s,o);}set$(s){for(let[o,n]of Object.entries(s))this.pub(o,n);}get sharedCtx(){return this._requireSharedPubSub()}has(s){return this._symbioteSharedPubSub?.has(s)??false}add(s,o,n=false){let a=this._getSharedPubSub();if(!a){if(!n&&this._pendingSharedAdds.has(s))return;this._pendingSharedAdds.set(s,{value:o,rewrite:n});return}this._pendingSharedAdds.delete(s),a.add(s,o,n);}add$(s,o=false){for(let[n,a]of Object.entries(s))this.add(n,a,o);}connectedCallback(){super.connectedCallback(),this._symbioteFirstUpdated?this._isInitialized&&this._needsReconnectInit&&(this._needsReconnectInit=false,this.initCallback()):this.ctxName?(this._pendingCtxInitOnConnect=false,this._performInitialization()):this._pendingCtxInitOnConnect&&this._effectiveCtxName&&(this._pendingCtxInitOnConnect=false,this._performInitialization());}_performInitialization(){if(this._symbioteFirstUpdated)return;this._symbioteFirstUpdated=true,this._initSharedContext();let s=this.init$;if(Object.keys(s).length>0){let o=this._requireSharedPubSub();for(let[n,a]of Object.entries(s))o.read(n)===void 0&&o.pub(n,a),this.sub(n,z(async()=>{this.isConnected&&(await this.updateComplete,this.requestUpdate());},0),false);}this.initCallback(),this._isInitialized=true,this.requestUpdate();}firstUpdated(s){super.firstUpdated(s);}disconnectedCallback(){this._cleanupSymbioteSubscriptions(),super.disconnectedCallback(),this._symbioteFirstUpdated&&(this._needsReconnectInit=true);}_cleanupSymbioteSubscriptions(){if(this._symbioteSubscriptions.size!==0){for(let s of [...this._symbioteSubscriptions])s();this._symbioteSubscriptions.clear();}}initCallback(){}}return a([_({type:String,attribute:"ctx-name",noAccessor:true})],i.prototype,"_ctxNameAttr",1),a([b()],i.prototype,"_ctxNameFromContext",2),a([b()],i.prototype,"ctxName",2),a([b()],i.prototype,"_isInitialized",2),i}}var zn=r=>r.tagName?.includes("-")??false,li=class{constructor(i){this._trackedElements=new Set;this._originalValues=new Map;this._enabled=false;this._host=i,this._host.addController(this);}hostDisconnected(){this._unsubscribe?.(),this._unsubscribe=void 0,this._trackedElements.clear(),this._originalValues.clear();}hostUpdated(){if(!this._unsubscribe&&this._host.has(k("testMode"))){let i=this._host.subConfigValue("testMode",e=>{this._enabled=!!e,this._applyTestMode();});this._unsubscribe=i;}this._collectElements(),this._applyTestMode();}_collectElements(){let i=this._host,e=i.renderRoot??i;if(!e)return;let t=this._host,s=t.tagName?.toLowerCase(),o=Array.from(e.querySelectorAll("[data-testid]")).filter(n=>!zn(n));for(let n of o)if(!(s&&n.closest(s)!==t)&&!this._trackedElements.has(n)){let a=n.getAttribute("data-testid");if(!a)continue;this._trackedElements.add(n),this._originalValues.set(n,a);}for(let n of Array.from(this._trackedElements))(!n.isConnected||s&&n.closest(s)!==t)&&(this._trackedElements.delete(n),this._originalValues.delete(n));}_applyTestMode(){if(!this._trackedElements.size)return;let i=this._host.testId||"";for(let e of this._trackedElements){let t=this._originalValues.get(e);t&&(this._enabled?e.setAttribute("data-testid",`${i}--${t}`):e.removeAttribute("data-testid"));}}};var Hn=ms(vs()(us(ps(be)))),A=class extends Hn{constructor(){super();this.activityType=null;this.init$=Hi();this.l10n=fs(()=>this.sharedCtx);this.debugPrint=Kt(()=>this.sharedCtx,this.constructor.name);this._sharedInstancesBag=zr(()=>this.sharedCtx);new li(this);}static{this.styleAttrs=[];}emit(e,t,s){let o=this.has("*eventEmitter")?this.$["*eventEmitter"]:void 0;if(!o)return;o.emit(e,t,s);let n=typeof t=="function"?t():t;this.telemetryManager.sendEvent({eventType:e,payload:n??void 0});}hasBlockInCtx(e){for(let t of this.blocksRegistry)if(e(t))return true;return false}connectedCallback(){this.constructor.styleAttrs.forEach(t=>{this.setAttribute(t,"");}),super.connectedCallback(),mt.registerClient(this);}initCallback(){this._addSharedContextInstance("*blocksRegistry",()=>new Set),this._addSharedContextInstance("*pluginManager",e=>new ii(e)),this._addSharedContextInstance("*eventEmitter",e=>new si(e)),this._addSharedContextInstance("*localeManager",e=>new ei(e)),this._addSharedContextInstance("*modalManager",e=>new Bt(e)),this._addSharedContextInstance("*a11y",()=>new Jt),this._addSharedContextInstance("*telemetryManager",e=>new oi(e)),this.sub(fe("locale-id"),e=>{let t=ns(e);this.style.direction=t==="ltr"?"":t,this.requestUpdate();}),this.subConfigValue("testMode",e=>{if(!e||!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._getSharedContextInstance("*modalManager",false)}get telemetryManager(){return this._getSharedContextInstance("*telemetryManager")}get localeManager(){return this._getSharedContextInstance("*localeManager")}get a11y(){return this._getSharedContextInstance("*a11y")}get blocksRegistry(){return this._getSharedContextInstance("*blocksRegistry")}get eventEmitter(){return this._getSharedContextInstance("*eventEmitter")}disconnectedCallback(){super.disconnectedCallback(),mt.unregisterClient(this);let e=this.blocksRegistry;e?.delete(this),e?.size===0&&setTimeout(()=>{this.isConnected||e?.size>0||this.destroyCtxCallback();},0);}destroyCtxCallback(){this._destroySharedContextInstances(),ke.deleteCtx(this.ctxName);}_getSharedContextInstances(){let e="*sharedContextInstances";if(!this.has(e)||!this.$[e]){let t=new Map;this.add(e,t,true);}return this.$[e]}_addSharedContextInstance(e,t){let s=this._getSharedContextInstances();if(!s.has(e)&&(!this.has(e)||!this.$[e])){let o=t(this._sharedInstancesBag);this.add(e,o,true),s.set(e,o);return}}_destroySharedContextInstances(){let e=this._getSharedContextInstances();for(let[t,s]of e.entries())s?.destroy?.(),this.pub(t,null);e.clear();}_getSharedContextInstance(e,t=true){if(this.has(e)&&this.$[e])return this.$[e];if(!t)return this.$[e];throw new Error(`Unexpected error: context manager for key "${String(e)}" is not available`)}async proxyUrl(e){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(e,{uuid:Ht(e),cdnUrlModifiers:Ii(e),fileName:zt(e)})}catch(t){return console.error("Failed to resolve secure delivery proxy URL. Falling back to the default URL.",t),this.telemetryManager.sendEventError(t,"secureDeliveryProxyUrlResolver. Failed to resolve secure delivery proxy URL. Falling back to the default URL."),e}return this.cfg.secureDeliveryProxy?ni(this.cfg.secureDeliveryProxy,{previewUrl:e},{transform:t=>window.encodeURIComponent(t)}):e}get cfg(){if(!this._cfgProxy){let e={};this._cfgProxy=new Proxy(e,{set:(t,s,o)=>{if(typeof s!="string"||!(s in ue))return false;let n=s,a=k(n);return this.has(a)||this.add(a,ue[n]),this.$[a]=o,true},get:(t,s)=>{let o=k(s);return this.has(o)||this.add(o,ue[s]),this.$[o]}});}return this._cfgProxy}subConfigValue(e,t){let s=k(e);return this.has(s)||this.add(s,ue[e]),this.sub(s,t)}};var Ee={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Z=r=>(...i)=>({_$litDirective$:r,values:i}),J=class{constructor(i){}get _$AU(){return this._$AM._$AU}_$AT(i,e,t){this._$Ct=i,this._$AM=e,this._$Ci=t;}_$AS(i,e){return this.update(i,e)}update(i,e){return this.render(...e)}};var Fe=class extends J{constructor(i){if(super(i),this.it=S,i.type!==Ee.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(i){if(i===S||i==null)return this._t=void 0,this.it=i;if(i===F)return i;if(typeof i!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(i===this.it)return this._t;this.it=i;let e=[i];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};Fe.directiveName="unsafeHTML",Fe.resultType=1;var gt=class extends Fe{};gt.directiveName="unsafeSVG",gt.resultType=2;var ci=Z(gt);var vt=class extends A{constructor(){super(...arguments);this.name="";this._resolvedHref="";this._pluginSvg=null;this._iconHrefResolver=null;}initCallback(){super.initCallback(),this.setAttribute("aria-hidden","true"),this.subConfigValue("iconHrefResolver",t=>{this._iconHrefResolver=t,this._updateResolvedHref();});let e=this._sharedInstancesBag.pluginManager;e?.onPluginsChange&&(this._unsubscribePlugins=e.onPluginsChange(()=>this._updateResolvedHref()));}willUpdate(e){super.willUpdate(e),e.has("name")&&this._updateResolvedHref();}_updateResolvedHref(){if(!this.name){this._resolvedHref="",this._pluginSvg=null;return}let t=this._sharedInstancesBag.pluginManager?.snapshot().icons.find(n=>n.name===this.name);if(t){this._pluginSvg=t.svg,this._resolvedHref="";return}this._pluginSvg=null;let s=`#uc-icon-${this.name}`,o=this._iconHrefResolver?.(this.name);this._resolvedHref=o??s;}render(){return this._pluginSvg?v`${this.yield("",v`${ci(this._pluginSvg)}`)}`:v` ${this.yield("",v`<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><use href=${this._resolvedHref}></use></svg>`)} `}disconnectedCallback(){this._unsubscribePlugins?.(),this._unsubscribePlugins=void 0,super.disconnectedCallback();}};a([_({type:String})],vt.prototype,"name",2),a([b()],vt.prototype,"_resolvedHref",2),a([b()],vt.prototype,"_pluginSvg",2);function bs(...r){return r.reduce((i,e)=>{if(typeof e=="string")return i[e]=true,i;for(let t of Object.keys(e))i[t]=e[t];return i},{})}function H(...r){let i=bs(...r);return Object.keys(i).reduce((e,t)=>(i[t]&&e.push(t),e),[]).join(" ")}function ys(r,...i){let e=bs(...i);for(let t of Object.keys(e))r.classList.toggle(t,!!e[t]);}var Ve={transition:"uc-transition",visible:"uc-visible",hidden:"uc-hidden"},di=class extends A{constructor(){super(...arguments);this._visible=false;this._styles=Ve;this._visibleStyle=Ve.visible;this._hiddenStyle=Ve.hidden;this._externalTransitions=false;this._initialRenderComplete=false;}set visible(e){this._visible=e,this._handleVisible();}get visible(){return this._visible}set styles(e){this._styles=e,this._externalTransitions=true,this._visibleStyle=e.visible??Ve.visible,this._hiddenStyle=e.hidden??Ve.hidden;}get styles(){return this._styles}_handleVisible(){this.style.visibility=this._visible?"inherit":"hidden",ys(this,{[Ve.transition]:!this._externalTransitions,[this._visibleStyle]:this._visible,[this._hiddenStyle]:!this._visible}),this.toggleAttribute("inert",!this._visible);}_dispatchInitialRenderEvent(){this._initialRenderComplete||(this._initialRenderComplete=true,this.dispatchEvent(new CustomEvent("initial-render",{bubbles:true,composed:true})));}initCallback(){super.initCallback(),this.classList.toggle("uc-initial",true),this._externalTransitions||this.classList.add(Ve.transition),this._handleVisible(),setTimeout(()=>{this.classList.toggle("uc-initial",false),this._dispatchInitialRenderEvent();},0);}};a([_({type:Boolean})],di.prototype,"visible",1),a([_({attribute:false})],di.prototype,"styles",1);var{I:jn}=_r,_s=r=>r;var ws=r=>r.strings===void 0,Ts=()=>document.createComment(""),_u=(r,i,e)=>{let t=r._$AA.parentNode,s=i===void 0?r._$AB:i._$AA;if(e===void 0){let o=t.insertBefore(Ts(),s),n=t.insertBefore(Ts(),s);e=new jn(o,n,r,r.options);}else {let o=e._$AB.nextSibling,n=e._$AM,a=n!==r;if(a){let l;e._$AQ?.(r),e._$AM=r,e._$AP!==void 0&&(l=r._$AU)!==n._$AU&&e._$AP(l);}if(o!==s||a){let l=e._$AA;for(;l!==o;){let c=_s(l).nextSibling;_s(t).insertBefore(l,s),l=c;}}}return e},Tu=(r,i,e=r)=>(r._$AI(i,e),r),Kn={},wu=(r,i=Kn)=>r._$AH=i,Cu=r=>r._$AH,Eu=r=>{r._$AR(),r._$AA.remove();};var bt=(r,i)=>{let e=r._$AN;if(e===void 0)return false;for(let t of e)t._$AO?.(i,false),bt(t,i);return true},ui=r=>{let i,e;do{if((i=r._$AM)===void 0)break;e=i._$AN,e.delete(r),r=i;}while(e?.size===0)},Cs=r=>{for(let i;i=r._$AM;r=i){let e=i._$AN;if(e===void 0)i._$AN=e=new Set;else if(e.has(r))break;e.add(r),qn(i);}};function Bn(r){this._$AN!==void 0?(ui(this),this._$AM=r,Cs(this)):this._$AM=r;}function Gn(r,i=false,e=0){let t=this._$AH,s=this._$AN;if(s!==void 0&&s.size!==0)if(i)if(Array.isArray(t))for(let o=e;o<t.length;o++)bt(t[o],false),ui(t[o]);else t!=null&&(bt(t,false),ui(t));else bt(this,r);}var qn=r=>{r.type==Ee.CHILD&&(r._$AP??=Gn,r._$AQ??=Bn);},pi=class extends J{constructor(){super(...arguments),this._$AN=void 0;}_$AT(i,e,t){super._$AT(i,e,t),Cs(this),this.isConnected=i._$AU;}_$AO(i,e=true){i!==this.isConnected&&(this.isConnected=i,i?this.reconnected?.():this.disconnected?.()),e&&(bt(this,i),ui(this));}setValue(i){if(ws(this._$Ct))this._$Ct._$AI(i,this);else {let e=[...this._$Ct._$AH];e[this._$Ci]=i,this._$Ct._$AI(e,this,0);}}disconnected(){}reconnected(){}};var I=()=>new Zi,Zi=class{},Yi=new WeakMap,$=Z(class extends pi{render(r){return S}update(r,[i]){let e=i!==this.G;return e&&this.G!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.G=i,this.ht=r.options?.host,this.rt(this.ct=r.element)),S}rt(r){if(this.isConnected||(r=void 0),typeof this.G=="function"){let i=this.ht??globalThis,e=Yi.get(i);e===void 0&&(e=new WeakMap,Yi.set(i,e)),e.get(this.G)!==void 0&&this.G.call(this.ht,void 0),e.set(this.G,r),r!==void 0&&this.G.call(this.ht,r);}else this.G.value=r;}get lt(){return typeof this.G=="function"?Yi.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 Qi=class extends A{constructor(){super(...arguments);this.active=false;this._lineRef=I();this._isAnimating=false;this._handleTransitionEndRight=()=>{let e=this._lineRef.value;e&&(this._resetLine(e),this._isAnimating&&this.active&&this._start());};}firstUpdated(e){super.firstUpdated(e),this.active&&this._start();}updated(e){super.updated(e),e.has("active")&&(this.active?this._start():this._stop());}_start(){let e=this._lineRef.value;if(!e)return;this._isAnimating=true;let{width:t}=this.getBoundingClientRect();e.removeEventListener("transitionend",this._handleTransitionEndRight),e.style.transition="transform 1s",e.style.opacity="1",e.style.transform=`translateX(${t}px)`,e.addEventListener("transitionend",this._handleTransitionEndRight,{once:true});}_stop(){let e=this._lineRef.value;e&&(this._isAnimating=false,e.removeEventListener("transitionend",this._handleTransitionEndRight),this._resetLine(e));}_resetLine(e){e.style.transition="initial",e.style.opacity="0",e.style.transform="translateX(-101%)";}render(){return v`<div class="uc-inner"><div class="uc-line" ${$(this._lineRef)}></div></div>`}};a([_({type:Boolean,reflect:true})],Qi.prototype,"active",2);var O=r=>r??S;var xe=Z(class extends J{constructor(r){if(super(r),r.type!==Ee.ATTRIBUTE||r.name!=="class"||r.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(r){return " "+Object.keys(r).filter(i=>r[i]).join(" ")+" "}update(r,[i]){if(this.st===void 0){this.st=new Set,r.strings!==void 0&&(this.nt=new Set(r.strings.join(" ").split(/\s/).filter(t=>t!=="")));for(let t in i)i[t]&&!this.nt?.has(t)&&this.st.add(t);return this.render(i)}let e=r.element.classList;for(let t of this.st)t in i||(e.remove(t),this.st.delete(t));for(let t in i){let s=!!i[t];s===this.st.has(t)||this.nt?.has(t)||(s?(e.add(t),this.st.add(t)):(e.remove(t),this.st.delete(t)));}return F}});var ee=class extends A{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(e){super.firstUpdated(e),this._applyReverse(),this._applyThemeClass();}updated(e){super.updated(e),e.has("reverse")&&this._applyReverse(),e.has("theme")&&this._applyThemeClass();}_applyReverse(){this.style.flexDirection=this.reverse?"row-reverse":"";}_applyThemeClass(){this.theme&&this.theme!=="custom"&&(this.className=`uc-${this.theme}`);}get _iconClassMap(){let e=this._computedIconHidden;return {"uc-icon":true,"uc-icon_left":!this.reverse,"uc-icon_right":this.reverse,"uc-icon_hidden":e,"uc-icon_single":this._computedIconSingle}}get _computedIconHidden(){return !this.icon}get _computedIconSingle(){return !this.text&&!this._computedIconHidden}render(){return v`<button type="button" role=${O(this.ariaRole||void 0)} aria-controls=${O(this.ariaControls||void 0)} aria-label=${O(this.l10n(this.titleProp))} title=${O(this.l10n(this.titleProp))} ><uc-icon class=${xe(this._iconClassMap)} name=${O(this.icon||void 0)} ?hidden=${this._computedIconHidden} ></uc-icon><div class="uc-text">${this.text}</div></button>`}};a([_({type:String})],ee.prototype,"text",2),a([_({type:String})],ee.prototype,"icon",2),a([_({type:Boolean,reflect:true})],ee.prototype,"reverse",2),a([_({type:String,reflect:true})],ee.prototype,"theme",2),a([_({attribute:"aria-role"})],ee.prototype,"ariaRole",2),a([_({attribute:"aria-controls"})],ee.prototype,"ariaControls",2),a([_({attribute:"title-prop"})],ee.prototype,"titleProp",2),a([_({type:Boolean,noAccessor:true})],ee.prototype,"active",2);var yt=33.333333333333336,T=1,Ji=24,Es=6;function Se(r,i){for(let[e,t]of Object.entries(i))r.setAttributeNS(null,e,t.toString());}function j(r,i={}){let e=document.createElementNS("http://www.w3.org/2000/svg",r);return Se(e,i),e}function xs(r,i,e){let{x:t,y:s,width:o,height:n}=r,a=i.includes("w")?0:1,l=i.includes("n")?0:1,c=a===0?-1:1,u=l===0?-1:1,d=[t+a*o+1.5*c,s+l*n+1.5*u-24*e*u],p=[t+a*o+1.5*c,s+l*n+1.5*u],h=[t+a*o-24*e*c+1.5*c,s+l*n+1.5*u],m=`M ${d[0]} ${d[1]} L ${p[0]} ${p[1]} L ${h[0]} ${h[1]}`,g=[p[0],p[1]];return {d:m,center:g}}function Ss(r,i,e){let{x:t,y:s,width:o,height:n}=r,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,p=i==="n"?-1:i==="s"?1:0,h,m;a?(h=[t+c*o-34*e/2,s+u*n+1.5*p],m=[t+c*o+34*e/2,s+u*n+1.5*p]):(h=[t+c*o+1.5*d,s+u*n-34*e/2],m=[t+c*o+1.5*d,s+u*n+34*e/2]);let g=`M ${h[0]} ${h[1]} L ${m[0]} ${m[1]}`,w=[(h[0]+m[0])/2,(h[1]+m[1])/2];return {d:g,center:w}}function As(r){return r===""?"move":["e","w"].includes(r)?"ew-resize":["n","s"].includes(r)?"ns-resize":["nw","se"].includes(r)?"nwse-resize":"nesw-resize"}function Is({rect:r,delta:[i,e],imageBox:t}){return Je({...r,x:r.x+i,y:r.y+e},t)}function Je(r,i){let{x:e}=r,{y:t}=r;return r.x<i.x?e=i.x:r.x+r.width>i.x+i.width&&(e=i.x+i.width-r.width),r.y<i.y?t=i.y:r.y+r.height>i.y+i.height&&(t=i.y+i.height-r.height),{...r,x:e,y:t}}function Wn({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[,s]=i,{y:o,width:n,height:a}=r;o+=s,a-=s,e&&(n=a*e);let l=r.x+r.width/2-n/2;return o<=t.y&&(o=t.y,a=r.y+r.height-o,e&&(n=a*e,l=r.x+r.width/2-n/2)),l<=t.x&&(l=t.x,o=r.y+r.height-a),l+n>=t.x+t.width&&(l=Math.max(t.x,t.x+t.width-n),n=t.x+t.width-l,e&&(a=n/e),o=r.y+r.height-a),a<T&&(a=T,e&&(n=a*e,l=r.x+r.width/2-n/2),o=r.y+r.height-a),n<T&&(n=T,e&&(a=n/e,l=r.x+r.width/2-n/2),o=r.y+r.height-a),{x:l,y:o,width:n,height:a}}function Xn({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[s]=i,{x:o,width:n,height:a}=r;o+=s,n-=s,e&&(a=n/e);let l=r.y+r.height/2-a/2;return o<=t.x&&(o=t.x,n=r.x+r.width-o,e&&(a=n/e,l=r.y+r.height/2-a/2)),l<=t.y&&(l=t.y,o=r.x+r.width-n),l+a>=t.y+t.height&&(l=Math.max(t.y,t.y+t.height-a),a=t.y+t.height-l,e&&(n=a*e),o=r.x+r.width-n),a<T&&(a=T,e&&(n=a*e),l=r.y+r.height/2-a/2,o=r.x+r.width-n),n<T&&(n=T,e&&(a=n/e),l=r.y+r.height/2-a/2,o=r.x+r.width-n),{x:o,y:l,width:n,height:a}}function Yn({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[,s]=i,{y:o,width:n,height:a}=r;a+=s,e&&(n=a*e);let l=r.x+r.width/2-n/2;return o+a>=t.y+t.height&&(a=t.y+t.height-o,e&&(n=a*e),l=r.x+r.width/2-n/2),l<=t.x&&(l=t.x,o=r.y),l+n>=t.x+t.width&&(l=Math.max(t.x,t.x+t.width-n),n=t.x+t.width-l,e&&(a=n/e),o=r.y),a<T&&(a=T,e&&(n=a*e),l=r.x+r.width/2-n/2),n<T&&(n=T,e&&(a=n/e),l=r.x+r.width/2-n/2),{x:l,y:o,width:n,height:a}}function Zn({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[s]=i,{x:o,width:n,height:a}=r;n+=s,e&&(a=n/e);let l=r.y+r.height/2-a/2;return o+n>=t.x+t.width&&(n=t.x+t.width-o,e&&(a=n/e),l=r.y+r.height/2-a/2),l<=t.y&&(l=t.y,o=r.x),l+a>=t.y+t.height&&(l=Math.max(t.y,t.y+t.height-a),a=t.y+t.height-l,e&&(n=a*e),o=r.x),a<T&&(a=T,e&&(n=a*e),l=r.y+r.height/2-a/2),n<T&&(n=T,e&&(a=n/e),l=r.y+r.height/2-a/2),{x:o,y:l,width:n,height:a}}function Qn({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[s,o]=i,{x:n,y:a,width:l,height:c}=r;return n+s<t.x&&(s=t.x-n),a+o<t.y&&(o=t.y-a),n+=s,l-=s,a+=o,c-=o,e&&Math.abs(l/c)>e?(o=l/e-c,c+=o,a-=o,a<=t.y&&(c=c-(t.y-a),l=c*e,n=r.x+r.width-l,a=t.y)):e&&(s=c*e-l,l=l+s,n-=s,n<=t.x&&(l=l-(t.x-n),c=l/e,n=t.x,a=r.y+r.height-c)),c<T&&(c=T,e&&(l=c*e),n=r.x+r.width-l,a=r.y+r.height-c),l<T&&(l=T,e&&(c=l/e),n=r.x+r.width-l,a=r.y+r.height-c),{x:n,y:a,width:l,height:c}}function Jn({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[s,o]=i,{x:n,y:a,width:l,height:c}=r;return n+l+s>t.x+t.width&&(s=t.x+t.width-n-l),a+o<t.y&&(o=t.y-a),l+=s,a+=o,c-=o,e&&Math.abs(l/c)>e?(o=l/e-c,c+=o,a-=o,a<=t.y&&(c=c-(t.y-a),l=c*e,n=r.x,a=t.y)):e&&(s=c*e-l,l+=s,n+l>=t.x+t.width&&(l=t.x+t.width-n,c=l/e,n=t.x+t.width-l,a=r.y+r.height-c)),c<T&&(c=T,e&&(l=c*e),a=r.y+r.height-c),l<T&&(l=T,e&&(c=l/e),a=r.y+r.height-c),{x:n,y:a,width:l,height:c}}function ea({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[s,o]=i,{x:n,y:a,width:l,height:c}=r;return n+s<t.x&&(s=t.x-n),a+c+o>t.y+t.height&&(o=t.y+t.height-a-c),n+=s,l-=s,c+=o,e&&Math.abs(l/c)>e?(o=l/e-c,c+=o,a+c>=t.y+t.height&&(c=t.y+t.height-a,l=c*e,n=r.x+r.width-l,a=t.y+t.height-c)):e&&(s=c*e-l,l+=s,n-=s,n<=t.x&&(l=l-(t.x-n),c=l/e,n=t.x,a=r.y)),c<T&&(c=T,e&&(l=c*e),n=r.x+r.width-l),l<T&&(l=T,e&&(c=l/e),n=r.x+r.width-l),{x:n,y:a,width:l,height:c}}function ta({rect:r,delta:i,aspectRatio:e,imageBox:t}){let[s,o]=i,{x:n,y:a,width:l,height:c}=r;return n+l+s>t.x+t.width&&(s=t.x+t.width-n-l),a+c+o>t.y+t.height&&(o=t.y+t.height-a-c),l+=s,c+=o,e&&Math.abs(l/c)>e?(o=l/e-c,c+=o,a+c>=t.y+t.height&&(c=t.y+t.height-a,l=c*e,n=r.x,a=t.y+t.height-c)):e&&(s=c*e-l,l+=s,n+l>=t.x+t.width&&(l=t.x+t.width-n,c=l/e,n=t.x+t.width-l,a=r.y)),c<T&&(c=T,e&&(l=c*e)),l<T&&(l=T,e&&(c=l/e)),{x:n,y:a,width:l,height:c}}function Rs({direction:r,...i}){switch(r){case "n":return Wn(i);case "w":return Xn(i);case "s":return Yn(i);case "e":return Zn(i);case "nw":return Qn(i);case "ne":return Jn(i);case "sw":return ea(i);case "se":return ta(i);default:return i.rect}}function $s(r,[i,e]){return r.x<=i&&i<=r.x+r.width&&r.y<=e&&e<=r.y+r.height}function ks(r,i){return r.x>=i.x&&r.y>=i.y&&r.x+r.width<=i.x+i.width&&r.y+r.height<=i.y+i.height}function Ps(r,i){return Math.abs(r.width/r.height-i)<.1}function et({width:r,height:i},e){let t=e/90%2!==0;return {width:t?i:r,height:t?r:i}}function lp(r,i,e){let t=r/i,s,o;t>e?(s=Math.round(i*e),o=i):(s=r,o=Math.round(r/e));let n=Math.round((r-s)/2),a=Math.round((i-o)/2);return n+s>r&&(s=r-n),a+o>i&&(o=i-a),{x:n,y:a,width:s,height:o}}function tt(r){return {x:Math.round(r.x),y:Math.round(r.y),width:Math.round(r.width),height:Math.round(r.height)}}function Ae(r,i,e){return Math.min(Math.max(r,i),e)}var er=class extends A{constructor(){super(...arguments);this._backdropMaskId=`uc-backdrop-mask-${ye.generateFastUid()}`;this._guidesHidden=false;this._draggingValue=false;this._svgRef=I();this._svgReady=false;this._pendingMaskHref=null;this._handlePointerUp=e=>{this._updateCursor(),this._dragging&&(e.stopPropagation(),e.preventDefault(),this._dragging=false);};this._handlePointerMove=e=>{if(!this._dragging||!this._dragStartPoint||!this._draggingThumb)return;e.stopPropagation(),e.preventDefault();let t=this._svgElement;if(!t)return;let{x:s,y:o}=t.getBoundingClientRect(),n=e.x-s,a=e.y-o,l=n-this._dragStartPoint[0],c=a-this._dragStartPoint[1],{direction:u}=this._draggingThumb,d=this._calcCropBox(u,[l,c]);d&&(this.$["*cropBox"]=d);};this._handleSvgPointerMove=e=>{if(!this._frameThumbs)return;let t=Object.values(this._frameThumbs).find(s=>{if(!s||this._shouldThumbBeDisabled(s.direction))return false;let n=s.interactionNode.getBoundingClientRect(),a={x:n.x,y:n.y,width:n.width,height:n.height};return $s(a,[e.x,e.y])});this._hoverThumb=t,this._updateCursor();};}get _svgElement(){return this._svgRef.value??null}get _dragging(){return this._draggingValue}set _dragging(e){this._draggingValue!==e&&(this._draggingValue=e,this._applyGuidesDragState());}_applyGuidesDragState(){this._frameGuides&&this._frameGuides.setAttribute("class",H({"uc-guides--hidden":this._guidesHidden,"uc-guides--visible":!this._guidesHidden&&this._draggingValue,"uc-guides--semi-hidden":!this._guidesHidden&&!this._draggingValue}));}_shouldThumbBeDisabled(e){let t=this.$["*imageBox"];if(!t)return false;if(e===""&&t.height<=T&&t.width<=T)return true;let s=t.height<=T&&(e.includes("n")||e.includes("s")),o=t.width<=T&&(e.includes("e")||e.includes("w"));return s||o}_createBackdrop(){let e=this.$["*cropBox"];if(!e)return;let{x:t,y:s,width:o,height:n}=e,a=this._svgElement;if(!a)return;let l=j("mask",{id:this._backdropMaskId}),c=j("rect",{x:0,y:0,width:"100%",height:"100%",fill:"white"}),u=j("rect",{x:t,y:s,width:o,height:n,fill:"black"});l.appendChild(c),l.appendChild(u);let d=j("rect",{x:0,y:0,width:"100%",height:"100%",fill:"var(--color-image-background)","fill-opacity":.85,mask:`url(#${this._backdropMaskId})`});a.appendChild(d),a.appendChild(l),this._backdropMask=l,this._backdropMaskInner=u;}_resizeBackdrop(){this._backdropMask&&(this._backdropMask.style.display="none",window.requestAnimationFrame(()=>{this._backdropMask&&(this._backdropMask.style.display="block");}));}_updateBackdrop(){let e=this.$["*cropBox"];if(!e)return;let{x:t,y:s,width:o,height:n}=e;this._backdropMaskInner&&Se(this._backdropMaskInner,{x:t,y:s,width:o,height:n});}_updateFrame(){let e=this.$["*cropBox"];if(!(!e||!this._frameGuides||!this._frameThumbs)){for(let t of Object.values(this._frameThumbs)){if(!t)continue;let{direction:s,pathNode:o,interactionNode:n,groupNode:a}=t,l=s==="",c=s.length===2,{x:u,y:d,width:p,height:h}=e;if(l)Se(n,{x:u,y:d,width:p,height:h});else {let g=Ae(Math.min(p,h)/82/2,0,1),w=c?xs(e,s,g):Ss(e,s,g),C=w.center;if(!C)continue;let y=Math.max(Ji*Ae(Math.min(p,h)/Ji/3,0,1),Es);Se(n,{x:C[0]-y,y:C[1]-y,width:y*2,height:y*2}),Se(o,{d:w.d});}let m=this._shouldThumbBeDisabled(s);a.setAttribute("class",H("uc-thumb",{"uc-thumb--hidden":m,"uc-thumb--visible":!m}));}Se(this._frameGuides,{x:e.x-1*.5,y:e.y-1*.5,width:e.width+1,height:e.height+1});}}_createThumb(e,t){let s=j("g");s.classList.add("uc-thumb"),s.setAttribute("with-effects","");let o=j("rect",{fill:"transparent"}),n=j("path",{stroke:"currentColor",fill:"none","stroke-width":3});s.appendChild(n),s.appendChild(o),e[t]={direction:t,pathNode:n,interactionNode:o,groupNode:s},t===""&&(s.style.cursor="move"),o.addEventListener("pointerdown",this._handlePointerDown.bind(this,t));}_createThumbs(){let e={};for(let t=0;t<3;t++)for(let s=0;s<3;s++){let o=`${["n","","s"][t]}${["w","","e"][s]}`;o!==""&&this._createThumb(e,o);}return this._createThumb(e,""),e}_createGuides(){let e=j("svg"),t=j("rect",{x:0,y:0,width:"100%",height:"100%",fill:"none",stroke:"currentColor","stroke-width":1,"stroke-opacity":.5});e.appendChild(t);for(let s=1;s<=2;s++){let o=j("line",{x1:`${yt*s}%`,y1:"0%",x2:`${yt*s}%`,y2:"100%",stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});e.appendChild(o);}for(let s=1;s<=2;s++){let o=j("line",{x1:"0%",y1:`${yt*s}%`,x2:"100%",y2:`${yt*s}%`,stroke:"currentColor","stroke-width":1,"stroke-opacity":.3});e.appendChild(o);}return e.classList.add("uc-guides","uc-guides--semi-hidden"),e}_createFrame(){let e=this._svgElement;if(!e)return;let t=document.createDocumentFragment(),s=this._createGuides();t.appendChild(s);let o=this._createThumbs();for(let{groupNode:n}of Object.values(o))t.appendChild(n);e.appendChild(t),this._frameThumbs=o,this._frameGuides=s,this._applyGuidesDragState();}_handlePointerDown(e,t){if(!this._frameThumbs)return;let s=this._frameThumbs[e];if(!s||this._shouldThumbBeDisabled(e))return;let o=this.$["*cropBox"],n=this._svgElement;if(!n)return;let{x:a,y:l}=n.getBoundingClientRect(),c=t.x-a,u=t.y-l;this._dragging=true,this._draggingThumb=s,this._dragStartPoint=[c,u],this._dragStartCrop={...o};}_calcCropBox(e,t){let[s,o]=t,n=this.$["*imageBox"],a=this._dragStartCrop??this.$["*cropBox"],l=this.$["*currentAspectRatio"],c=l?l.width/l.height:void 0;if(e===""?a=Is({rect:a,delta:[s,o],imageBox:n}):a=Rs({rect:a,delta:[s,o],direction:e,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 Je(tt(a),n)}_updateCursor(){let e=this._hoverThumb,t=this._svgElement;t&&(t.style.cursor=e?As(e.direction):"initial");}_createMask(e){if(this._frameImage){this._frameImage.setAttribute("href",e);return}let t=this._svgElement;if(!t){this._pendingMaskHref=e;return}this._pendingMaskHref=null;let s=document.createDocumentFragment(),o=j("image",{href:e});o.setAttribute("class","uc-cloud-mask"),s.appendChild(o),t.appendChild(s),this._frameImage=o;}_updateMask(){let e=this.$["*cropBox"];if(!e||!this._frameImage)return;let{x:t,y:s,width:o,height:n}=e;Se(this._frameImage,{x:t,y:s,height:n,width:o});}_render(){this._svgReady&&(this._updateBackdrop(),this._updateFrame(),this._updateMask());}toggleThumbs(e){if(this._frameThumbs)for(let t of Object.values(this._frameThumbs)){if(!t)continue;let{groupNode:s}=t;s.setAttribute("class",H("uc-thumb",{"uc-thumb--hidden":!e,"uc-thumb--visible":e}));}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._resizeBackdrop(),this._svgReady&&window.requestAnimationFrame(()=>{this._render();});}),this.sub("*cropBox",e=>{e&&(this._guidesHidden=e.height<=T||e.width<=T,this._applyGuidesDragState(),this._svgReady&&window.requestAnimationFrame(()=>{this._render();}));}),this.subConfigValue("cloudImageEditorMaskHref",e=>{e&&this._createMask(e);}),document.addEventListener("pointermove",this._handlePointerMove,true),document.addEventListener("pointerup",this._handlePointerUp,true);}firstUpdated(e){super.firstUpdated(e),this._initializeSvg();}_initializeSvg(){let e=this._svgElement;if(!(!e||this._svgReady)){if(this._createBackdrop(),this._createFrame(),this._svgReady=true,e.addEventListener("pointermove",this._handleSvgPointerMove,true),this._pendingMaskHref){let t=this._pendingMaskHref;this._pendingMaskHref=null,this._createMask(t);}this._render();}}disconnectedCallback(){super.disconnectedCallback(),this._svgElement?.removeEventListener("pointermove",this._handleSvgPointerMove,true),document.removeEventListener("pointermove",this._handlePointerMove,true),document.removeEventListener("pointerup",this._handlePointerUp,true);}render(){return v`<svg class="uc-svg" xmlns="http://www.w3.org/2000/svg" ${$(this._svgRef)}></svg>`}};a([b()],er.prototype,"_draggingValue",2);var Ie="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNkYAAAAAYAAjCB0C8AAAAASUVORK5CYII=";function _t(r){let i=new Image;return {promise:new Promise((s,o)=>{i.src=r,i.onload=()=>s(),i.onerror=n=>o(n);}),image:i,cancel:()=>{i.naturalWidth===0&&(i.src=Ie);}}}function Tt(r){let i=[];for(let o of r){let n=_t(o);i.push(n);}let e=i.map(o=>o.image);return {promise:Promise.allSettled(i.map(o=>o.promise)),images:e,cancel:()=>{i.forEach(o=>{o.cancel();});}}}var Os=(r,i)=>{let e=false,t,s=0,o=((...n)=>{e?(t&&clearTimeout(t),t=setTimeout(()=>{Date.now()-s>=i&&(r(...n),s=Date.now());},Math.max(i-(Date.now()-s),0))):(r(...n),s=Date.now(),e=true);});return Object.defineProperty(o,"cancel",{configurable:false,writable:false,enumerable:false,value:()=>{t&&clearTimeout(t);}}),o};function Ms(r,i){let e={};for(let t of i){let s=r[t];(Object.hasOwn(r,t)||s!==void 0)&&(e[t]=s);}return e}function it(r,i,e){let s=window.devicePixelRatio,o=Math.min(Math.ceil(i*s),3e3),n=s>=2?"lightest":"normal";return le(r,ae(jt,_e(e),`quality/${n}`,`stretch/off/-/resize/${o}x`,`@clib/${Be}/${Ge}/uc-cloud-image-editor/`))}function ra(r){return r?[({dimensions:e,coords:t})=>[...e,...t].every(s=>Number.isInteger(s)&&Number.isFinite(s)),({dimensions:e,coords:t})=>e.every(s=>s>0)&&t.every(s=>s>=0)].every(e=>e(r)):true}var tr=class extends A{constructor(){super();this.ctxOwner=true;this._imageSize={width:0,height:0};this._ctx=null;this._isActive=false;this._image=null;this._canvasRef=I();this._frameRef=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._commitDebounced=z(this._commit.bind(this),300),this._handleResizeThrottled=Os(()=>{!this.isConnected||!this._isActive||(this._initCanvas(),this._syncTransformations(),this._alignImage(),this._alignCrop(),this._draw());},100);}firstUpdated(e){super.firstUpdated(e),this._initCanvas();}_syncTransformations(){let e=this.$["*editorTransformations"],t=Ms(e,Object.keys(this.$["*operations"])),s={...this.$["*operations"],...t};this.$["*operations"]=s;}_initCanvas(){let e=this._canvasRef.value;if(!e)return;let t=e.getContext("2d"),s=this.offsetWidth,o=this.offsetHeight,n=window.devicePixelRatio;e.style.width=`${s}px`,e.style.height=`${o}px`,e.width=s*n,e.height=o*n,t?.scale(n,n),this._canvas=e,this._ctx=t;}_alignImage(){if(!this._isActive||!this._image)return;let e=this._image,t=this.$["*padding"],s=this.$["*operations"],{rotate:o}=s,n={width:this.offsetWidth,height:this.offsetHeight},a=et({width:e.naturalWidth,height:e.naturalHeight},o),l;if(a.width>n.width-t*2||a.height>n.height-t*2){let c=a.width/a.height,u=n.width/n.height;if(c>u){let d=n.width-t*2,p=d/c,h=0+t,m=t+(n.height-t*2)/2-p/2;l={x:h,y:m,width:d,height:p};}else {let d=n.height-t*2,p=d*c,h=t+(n.width-t*2)/2-p/2,m=0+t;l={x:h,y:m,width:p,height:d};}}else {let{width:c,height:u}=a,d=t+(n.width-t*2)/2-c/2,p=t+(n.height-t*2)/2-u/2;l={x:d,y:p,width:c,height:u};}this.$["*imageBox"]=tt(l);}_alignCrop(){let e=this.$["*cropBox"],t=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,n=this.$["*editorTransformations"].crop,{width:a,x:l,y:c}=t;if(n){let{dimensions:[p,h],coords:[m,g]}=n,{width:w}=et(this._imageSize,o),C=a/w;e=Je(tt({x:l+m*C,y:c+g*C,width:p*C,height:h*C}),t);}let u=this.$["*currentAspectRatio"],d=u?u.width/u.height:void 0;if(!ks(e,t)||d&&!Ps(e,d)){let p=t.width/t.height,h=t.width,m=t.height;d&&(p>d?h=Math.min(t.height*d,t.width):m=Math.min(t.width/d,t.height)),e={x:t.x+t.width/2-h/2,y:t.y+t.height/2-m/2,width:h,height:m};}this.$["*cropBox"]=Je(tt(e),t);}_drawImage(){let e=this._ctx;if(!e)return;let t=this._image;if(!t)return;let s=this.$["*imageBox"],o=this.$["*operations"],{mirror:n,flip:a,rotate:l}=o,c=et({width:s.width,height:s.height},l);e.save(),e.translate(s.x+s.width/2,s.y+s.height/2),e.rotate(l*Math.PI*-1/180),e.scale(n?-1:1,a?-1:1),e.drawImage(t,-c.width/2,-c.height/2,c.width,c.height),e.restore();}_draw(){if(!this._isActive||!this._image||!this._canvas||!this._ctx)return;let e=this._canvas;this._ctx.clearRect(0,0,e.width,e.height),this._drawImage();}_animateIn({fromViewer:e}){this._image&&(this._frameRef.value?.toggleThumbs(true),this._transitionToImage(),setTimeout(()=>{this.className=H({"uc-active_from_viewer":e,"uc-active_from_editor":!e,"uc-inactive_to_editor":false});}));}_getCropDimensions(){let e=this.$["*cropBox"],t=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,{width:n,height:a}=t,{width:l,height:c}=et(this._imageSize,o),{width:u,height:d}=e,p=n/l,h=a/c;return [Ae(Math.round(u/p),1,l),Ae(Math.round(d/h),1,c)]}_getCropTransformation(){let e=this.$["*cropBox"],t=this.$["*imageBox"],s=this.$["*operations"],{rotate:o}=s,{width:n,height:a,x:l,y:c}=t,{width:u,height:d}=et(this._imageSize,o),{x:p,y:h}=e,m=n/u,g=a/d,w=this._getCropDimensions(),C={dimensions:w,coords:[Ae(Math.round((p-l)/m),0,u-w[0]),Ae(Math.round((h-c)/g),0,d-w[1])]};if(!ra(C)){console.error("Cropper is trying to create invalid crop object",{payload:C});return}if(!(w[0]===u&&w[1]===d))return C}_commit(){if(!this.isConnected||!this._imageSize)return;let e=this.$["*operations"],{rotate:t,mirror:s,flip:o}=e,n=this._getCropTransformation(),l={...this.$["*editorTransformations"],crop:n,rotate:t,mirror:s,flip:o};this.$["*editorTransformations"]=l;}setValue(e,t){this.$["*operations"]={...this.$["*operations"],[e]:t},this._isActive&&(this._alignImage(),this._alignCrop(),this._draw());}getValue(e){return this.$["*operations"][e]}async activate(e,{fromViewer:t}={}){if(!this._isActive){this._isActive=true,await this.updateComplete,this._initCanvas(),this._imageSize=e,this.removeEventListener("transitionend",this._reset);try{let s=this.$["*originalUrl"],o=this.$["*editorTransformations"];this._image=await this._waitForImage(s,o),this._syncTransformations(),this._handleResizeThrottled(),this._animateIn({fromViewer:t});}catch(s){console.error("Failed to activate cropper",{error:s}),this.telemetryManager.sendEventError(s,"cloud editor image. Failed to activate cropper");}this._observer=new ResizeObserver(s=>{let[o]=s;if(!o)return;o.contentRect.width>0&&o.contentRect.height>0&&this._isActive&&this._image&&this._handleResizeThrottled();}),this._observer.observe(this);}}deactivate({reset:e=false}={}){this._isActive&&(!e&&this._commit(),this._isActive=false,this._transitionToCrop(),this.className=H({"uc-active_from_viewer":false,"uc-active_from_editor":false,"uc-inactive_to_editor":true}),this._frameRef.value?.toggleThumbs(false),this.addEventListener("transitionend",this._reset,{once:true}),this._observer?.disconnect());}_transitionToCrop(){let e=this._getCropDimensions(),t=this.$["*cropBox"],s=Math.min(this.offsetWidth,e[0])/t.width,o=Math.min(this.offsetHeight,e[1])/t.height,n=Math.min(s,o),a=t.x+t.width/2,l=t.y+t.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`;}_transitionToImage(){let e=this.$["*cropBox"],t=e.x+e.width/2,s=e.y+e.height/2;this.style.transform="scale(1)",this.style.transformOrigin=`${t}px ${s}px`;}_reset(){this._isActive||(this._image=null);}async _waitForImage(e,t){let s=this.offsetWidth;t={...t,crop:void 0,rotate:void 0,flip:void 0,mirror:void 0};let o=await this.proxyUrl(it(e,s,t)),{promise:n,cancel:a,image:l}=_t(o),c=this._handleImageLoading(o);return l.addEventListener("load",c,{once:true}),l.addEventListener("error",c,{once:true}),this._cancelPreload?.(),this._cancelPreload=a,n.then(()=>l).catch(u=>(console.error("Failed to load image",{error:u}),this.$["*networkProblems"]=true,l))}_handleImageLoading(e){let t="crop",s=this.$["*loadingOperations"],o=s.get(t);return o||(o=new Map,s.set(t,o)),o.get(e)||(o.set(e,true),this.$["*loadingOperations"]=s),()=>{let n=s.get(t);n?.has(e)&&(n.delete(e),this.$["*loadingOperations"]=s);}}initCallback(){super.initCallback(),this.sub("*imageBox",()=>{this._draw();}),this.sub("*cropBox",()=>{this._image&&this._commitDebounced();}),this.sub("*currentAspectRatio",()=>{this._alignCrop();}),setTimeout(()=>{this.sub("*networkProblems",e=>{e||this._isActive&&this._imageSize&&this.activate(this._imageSize,{fromViewer:false});});},0);}disconnectedCallback(){super.disconnectedCallback(),this._observer?.disconnect(),this._image&&(this._image=null);}render(){return v`<canvas class="uc-canvas" ${$(this._canvasRef)}></canvas><uc-crop-frame ${$(this._frameRef)}></uc-crop-frame>`}};a([b()],tr.prototype,"_image",2);function ir(r,i,e){let t=e,s=e-1,o=new Array(t);for(let n=s;n>=0;n-=1)o[n]=Math.ceil((n*i+(s-n)*r)/s);return o}function sa(r){return typeof r=="string"&&r in X}function oa(r){let i=[];for(let e=0;e<r.length-1;e+=1){let t=r[e],s=r[e+1];typeof t=="number"&&typeof s=="number"&&i.push([t,s]);}return i}function na(r,i,e){let t=oa(r).find(([n,a])=>n<=i&&i<=a);if(!t)return r.map(()=>0);let[s,o]=t;return r.map(n=>{let a=Math.abs(s-o)||1,l=Math.abs(i-s)/a;return s===n?i>e?1:1-l:o===n?i>=e?l:1:0})}function aa(r,i){return r.map((e,t)=>e<i?r.length-t:t)}function Ls(r,i){let e=X[r].keypointsNumber,{range:t,zero:s}=X[r];return [...new Set([...ir(t[0],s,e+1),...ir(s,t[1],e+1),s,i])].sort((o,n)=>o-n)}var Ns=class extends A{constructor(){super();this._isActive=false;this._hidden=true;this._operation="initial";this._transformations={};this._keypoints=[];this._raf=0;this._previewHostRef=I();this._layersHostRef=I();this.classList.add("uc-inactive_to_cropper"),this._addKeypointDebounced=z(async(e,t,s)=>{let o=()=>!this._isSame(e,t)||this._value!==s||!!this._keypoints.find(c=>c.value===s);if(o())return;let n=await this._constructKeypoint(e,s),a=new Image;a.src=n.src;let l=this._handleImageLoading(n.src);a.addEventListener("load",l,{once:true}),a.addEventListener("error",l,{once:true}),n.image=a,a.classList.add("uc-fader-image"),a.addEventListener("load",()=>{if(o())return;let c=this._keypoints,u=c.findIndex(m=>m.value>s);u===-1&&(u=c.length);let p=c[u]?.image,h=this._layersHostRef.value;!h||p&&!h.contains(p)||(c.splice(u,0,n),p?h.insertBefore(a,p):h.appendChild(a),this._update(e,s));},{once:true}),a.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});},600);}_handleImageLoading(e){let t=this._operation,s=this.$["*loadingOperations"];s.has(t)||s.set(t,new Map);let o=s.get(t);return o&&!o.get(e)&&(o.set(e,true),this.$["*loadingOperations"]=s),()=>{let n=s.get(t);n?.has(e)&&(n.delete(e),this.$["*loadingOperations"]=s);}}_flush(){window.cancelAnimationFrame(this._raf),this._raf=window.requestAnimationFrame(()=>{for(let e of this._keypoints){let{image:t}=e;t&&(t.style.opacity=e.opacity.toString(),t.style.zIndex=e.zIndex.toString());}});}_imageSrc({url:e=this._url,filter:t=this._filter??void 0,operation:s,value:o}={}){if(!e)throw new Error("URL is not defined");let n={...this._transformations};s&&(s==="filter"?t&&typeof o=="number"&&(n.filter={name:t,amount:o}):typeof o=="number"&&(n[s]=o));let a=this.offsetWidth;return this.proxyUrl(it(e,a,n))}async _constructKeypoint(e,t){return {src:await this._imageSrc({operation:e,value:t}),image:void 0,opacity:0,zIndex:0,value:t}}_isSame(e,t){return this._operation===e&&this._filter===t}set(e){let t=typeof e=="string"?parseInt(e,10):e;!sa(this._operation)||!Number.isFinite(t)||(this._update(this._operation,t),this._addKeypointDebounced(this._operation,this._filter,t));}_update(e,t){this._operation=e,this._value=t;let{zero:s}=X[e],o=this._keypoints.map(l=>l.value),n=na(o,t,s),a=aa(o,s);this._keypoints.forEach((l,c)=>{let u=n[c],d=a[c];typeof u=="number"&&(l.opacity=u),typeof d=="number"&&(l.zIndex=d);}),this._flush();}_createPreviewImage(){let e=new Image;return e.classList.add("uc-fader-image","uc-fader-image--preview"),e.style.opacity="0",e}async _initNodes(){this._previewImage=this._previewImage||this._createPreviewImage();let e=this._previewImage;e&&this._ensurePreviewAttached(e);let t=this._keypoints.map(c=>c.src),{images:s,promise:o,cancel:n}=Tt(t);s.forEach(c=>{let u=this._handleImageLoading(c.src);c.addEventListener("load",u),c.addEventListener("error",u);}),this._cancelLastImages=()=>{n(),this._cancelLastImages=void 0;};let a=this._operation,l=this._filter;if(await o,this._isActive&&this._isSame(a,l)){let c=this._layersHostRef.value;if(!c)return;c.replaceChildren(),this._keypoints.forEach((u,d)=>{let p=s[d];p&&(p.classList.add("uc-fader-image"),u.image=p,c.appendChild(p));}),this._flush();}}async setTransformations(e){if(this._transformations=e,this._previewImage){let t=await this._imageSrc(),s=this._handleImageLoading(t);this._previewImage.src=t,this._previewImage.addEventListener("load",s,{once:true}),this._previewImage.addEventListener("error",s,{once:true}),this._previewImage.style.opacity="1",this._previewImage.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}}async preload({url:e,filter:t,operation:s,value:o}){if(!s||typeof o!="number")return;this._cancelBatchPreload?.();let n=Ls(s,o),a=await Promise.all(n.map(c=>this._imageSrc({url:e,filter:t,operation:s,value:c}))),{cancel:l}=Tt(a);this._cancelBatchPreload=l;}_setOriginalSrc(e){let t=this._previewImage||this._createPreviewImage();if(this._ensurePreviewAttached(t),this._previewImage=t,t.src===e){t.style.opacity="1",t.style.transform="scale(1)",this.className=H({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":false});return}t.style.opacity="0";let s=this._handleImageLoading(e);t.addEventListener("error",s,{once:true}),t.src=e,t.addEventListener("load",()=>{s(),t&&(t.style.opacity="1",t.style.transform="scale(1)",this.className=H({"uc-active_from_viewer":this._fromViewer,"uc-active_from_cropper":!this._fromViewer,"uc-inactive_to_cropper":false}));},{once:true}),t.addEventListener("error",()=>{this.$["*networkProblems"]=true;},{once:true});}async activate({url:e,operation:t,value:s,filter:o,fromViewer:n}){if(this._isActive=true,this._hidden=false,await this.updateComplete,this._url=e,this._operation=t??"initial",this._value=s,this._filter=o,this._fromViewer=n,typeof s!="number"&&!o){let l=await this._imageSrc({operation:t,value:s});this._setOriginalSrc(l),this._clearLayersHost();return}!t||typeof s!="number"||(this._keypoints=await Promise.all(Ls(t,s).map(l=>this._constructKeypoint(t,l))),this._update(t,s),this._initNodes());}deactivate({hide:e=true}={}){this._isActive=false,this._cancelLastImages?.(),this._cancelBatchPreload?.(),e&&!this._hidden?(this._hidden=true,this._previewImage&&(this._previewImage.style.transform="scale(1)"),this.className=H({"uc-active_from_viewer":false,"uc-active_from_cropper":false,"uc-inactive_to_cropper":true}),this.addEventListener("transitionend",()=>{this._clearLayersHost();},{once:true})):this._clearLayersHost();}_ensurePreviewAttached(e){let t=this._previewHostRef.value;t&&(t.contains(e)||t.appendChild(e));}_clearLayersHost(){this._layersHostRef.value?.replaceChildren();}render(){return v`<div class="uc-fader-preview-host" ${$(this._previewHostRef)}></div><div class="uc-fader-layers-host" ${$(this._layersHostRef)}></div>`}};var Re=class extends A{constructor(){super();this._thumbSize=0;this._inputRef=I();this._thumbRef=I();this._stepsRef=I();this.disabled=false;this.min=0;this.max=100;this.defaultValue=0;this.zero=0;this._currentValue=0;this._handleSliderInput=e=>{e.stopPropagation();let t=this._extractEventValue(e);t!==null&&(this._setCurrentValue(t),this._emitSliderEvent("slider-input",t));};this._handleSliderChange=e=>{e.stopPropagation();let t=this._extractEventValue(e);t!==null&&this._setCurrentValue(t);};this._handleInputFocus=()=>{this.style.setProperty("--color-effect","var(--hover-color-rgb)");};this._handleInputBlur=()=>{this.style.setProperty("--color-effect","var(--idle-color-rgb)");};this.setAttribute("with-effects","");}_emitSliderEvent(e,t){this.dispatchEvent(new CustomEvent(e,{detail:{value:t},bubbles:true,composed:true}));}firstUpdated(e){super.firstUpdated(e),this._thumbSize=Number.parseInt(window.getComputedStyle(this).getPropertyValue("--l-thumb-size"),10)||0,this._syncInputValue(this._currentValue),this._updateSteps(),this._observer=new ResizeObserver(()=>{this._updateSteps(),this._updateValue(this._currentValue);}),this._observer.observe(this);let t=this._inputRef.value;t?.addEventListener("focus",this._handleInputFocus),t?.addEventListener("blur",this._handleInputBlur),window.setTimeout(()=>{this._updateValue(this._currentValue);},0);}willUpdate(e){super.willUpdate(e),e.has("defaultValue")&&this.defaultValue!==this._currentValue&&this._setCurrentValue(this.defaultValue),(e.has("min")||e.has("max"))&&this.hasUpdated&&(this._updateSteps(),this._updateValue(this._currentValue)),e.has("zero")&&this.hasUpdated&&this._updateZeroDot(this._currentValue);}_updateValue(e){this._updateZeroDot(e);let t=this.max-this.min;if(t===0)return;let{width:s}=this.getBoundingClientRect(),a=100/t*(e-this.min)*(s-this._thumbSize)/100;window.requestAnimationFrame(()=>{let l=this._thumbRef.value;l&&(l.style.transform=`translateX(${a}px)`);});}_updateZeroDot(e){if(!this._zeroDotEl)return;let t=this.max-this.min;if(t===0)return;this._zeroDotEl.style.opacity=e===this.zero?"0":"1";let{width:s}=this.getBoundingClientRect(),a=100/t*(this.zero-this.min)*(s-this._thumbSize)/100;window.requestAnimationFrame(()=>{this._zeroDotEl&&(this._zeroDotEl.style.transform=`translateX(${a}px)`);});}_updateSteps(){let t=this._stepsRef.value;if(!t)return;let{width:s}=t.getBoundingClientRect(),o=Math.ceil(s/2),n=Math.ceil(o/15)-2;if(this._stepsCount===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._zeroDotEl=u,t.innerHTML="",t.appendChild(a),this._stepsCount=n;}disconnectedCallback(){super.disconnectedCallback();let e=this._inputRef.value;e?.removeEventListener("focus",this._handleInputFocus),e?.removeEventListener("blur",this._handleInputBlur),this._observer?.disconnect(),this._observer=void 0;}_setCurrentValue(e){Number.isFinite(e)&&(this._currentValue=e,this.hasUpdated&&(this._syncInputValue(e),this._updateValue(e)));}_syncInputValue(e){let t=this._inputRef.value;t&&(t.value=String(e));}_extractEventValue(e){let t=e.currentTarget;if(!t)return null;let s=Number.parseInt(t.value,10);return Number.isFinite(s)?s:null}render(){return v`<div class="uc-steps" ${$(this._stepsRef)}></div><div class="uc-thumb" ${$(this._thumbRef)}></div><input class="uc-input" type="range" ${$(this._inputRef)} .min=${String(this.min)} .max=${String(this.max)} .value=${String(this._currentValue)} ?disabled=${this.disabled} @input=${this._handleSliderInput} @change=${this._handleSliderChange} />`}};a([_({type:Boolean,reflect:true})],Re.prototype,"disabled",2),a([_({type:Number})],Re.prototype,"min",2),a([_({type:Number})],Re.prototype,"max",2),a([_({type:Number,attribute:false})],Re.prototype,"defaultValue",2),a([_({type:Number})],Re.prototype,"zero",2),a([b()],Re.prototype,"_currentValue",2);var ie="original",rr=class extends A{constructor(){super(...arguments);this.state={operation:"filter",filter:void 0,originalUrl:"",disabled:false,min:0,max:100,value:0,defaultValue:0,zero:0};this._handleInput=e=>{let{value:t}=e.detail;this.$["*faderEl"]?.set(t),this.state={...this.state,value:t};};}setOperation(e,t){this.state={...this.state,operation:e,filter:t},this._initializeValues();let s=this.$["*faderEl"],o=this.state.originalUrl||this.$["*originalUrl"];s&&o&&s.activate({url:o,operation:this.state.operation,value:this.state.filter===ie?void 0:this.state.value,filter:this.state.filter===ie?void 0:this.state.filter,fromViewer:false});}_initializeValues(){let e=this.state.operation,{range:t,zero:s}=X[e],[o,n]=t;this.state={...this.state,min:o,max:n,zero:s};let l=this.$["*editorTransformations"][e];if(e==="filter"){let u=Number(n),d=l;if(d){let{name:p,amount:h}=d;u=p===this.state.filter?h:n;}this.state={...this.state,value:u,defaultValue:u};return}let c=typeof l<"u"?l:s;this.state={...this.state,value:c,defaultValue:c};}apply(){let t={...this.$["*editorTransformations"]};this.state.operation==="filter"?!this.state.filter||this.state.filter===ie?delete t.filter:t.filter={name:this.state.filter,amount:this.state.value}:t[this.state.operation]=this.state.value,this.$["*editorTransformations"]=t;}cancel(){this.$["*faderEl"]?.deactivate({hide:false});}initCallback(){super.initCallback(),this.sub("*originalUrl",e=>{e&&(this.state={...this.state,originalUrl:e});});}updated(e){if(super.updated(e),e.has("state")){let t=`${this.state.filter??this.state.operation} ${this.state.value}`;this.$["*operationTooltip"]=t;}}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._handleInput} ></uc-slider-ui>`}};a([b()],rr.prototype,"state",2);var L=class extends A{constructor(){super(...arguments);this.active=false;this.title="";this.icon="";this.titleProp="";}get buttonClasses(){let e=this.active;return {"uc-active":e,"uc-not_active":!e}}_updateHostStateClasses(){let e=this.buttonClasses;for(let[t,s]of Object.entries(e))this.classList.toggle(t,s);}onClick(e){}connectedCallback(){super.connectedCallback(),this._updateHostStateClasses();}updated(e){super.updated(e),e.has("active")&&this._updateHostStateClasses();}render(){let e=this.onClick,t=this.title;return v`<button role="option" type="button" aria-label=${O(this.titleProp)} title=${O(this.titleProp)} @click=${e} ><uc-icon name=${this.icon}></uc-icon><div class="uc-title" ?hidden=${!t}>${t}</div></button>`}};a([b()],L.prototype,"active",2),a([b()],L.prototype,"title",2),a([b()],L.prototype,"icon",2),a([b()],L.prototype,"titleProp",2);var fi=12,mi=16,la=r=>{let i=12,e=12;return r.width/r.height>=1?(i=fi,e=Math.round(fi*r.height/r.width)):(e=fi,i=Math.round(fi*r.width/r.height)),{width:i,height:e}},Us=class extends L{initCallback(){super.initCallback(),this.icon="arrow-dropdown",this.sub("*currentAspectRatio",i=>{let e=this._computeTitle(i);this.title=e,this.titleProp=e;});}onClick(){this.$["*showListAspectRatio"]=true;}_computeTitle(i){return i?i.hasFreeform?this.l10n("freeform-crop"):this.l10n("crop-to-shape",{value:`${i.width}:${i.height}`}):""}render(){let i=this.onClick,e=this.title;return v`<button role="option" type="button" class=${xe(this.buttonClasses)} aria-label=${O(this.titleProp)} title=${O(this.titleProp)} @click=${i} ><div class="uc-title" ?hidden=${!e}>${e}</div><uc-icon name=${this.icon}></uc-icon></button>`}},sr=class extends L{constructor(){super(...arguments);this._aspectRatio=null;}get aspectRatio(){return this._aspectRatio}set aspectRatio(e){if(this._aspectRatio===e)return;let t=this._aspectRatio;this._aspectRatio=e,this.requestUpdate("aspectRatio",t),e?this._updateAspectRatioPresentation(e):(this.removeAttribute("uc-aspect-ratio-freeform"),this.title="",this.titleProp="");}initCallback(){super.initCallback(),this._aspectRatio&&this._updateAspectRatioPresentation(this._aspectRatio),this.sub("*currentAspectRatio",e=>{this.active=e&&e.id===this._aspectRatio?.id||e?.width===this._aspectRatio?.width&&e?.height===this._aspectRatio?.height;});}onClick(){this.$["*currentAspectRatio"]?.id!==this._aspectRatio?.id&&(this.$["*currentAspectRatio"]=this._aspectRatio);}_updateAspectRatioPresentation(e){if(!this.isConnected)return;let t=!!e.hasFreeform;this.toggleAttribute("uc-aspect-ratio-freeform",t);let s=()=>{let n=t?this.l10n("custom"):`${e.width}:${e.height}`;return this.title=n,n},o=()=>{let n=this.l10n("a11y-cloud-editor-apply-aspect-ratio",{name:t?this.l10n("custom").toLowerCase():this.l10n("crop-to-shape",{value:`${e.width}:${e.height}`}).toLowerCase(),value:""});return this.titleProp=n,n};s(),o(),t||this.requestUpdate();}_renderIcon(){let e=this._aspectRatio;if(!e||e.hasFreeform)return v`<uc-icon name=${this.icon}></uc-icon>`;let{width:t,height:s}=la(e),o=(mi-t)/2,n=(mi-s)/2;return v`<uc-icon><svg viewBox="0 0 ${mi} ${mi}" aria-hidden="true" focusable="false" ><rect x=${o} y=${n} width=${t} height=${s} rx="2" fill="none" stroke="currentColor" stroke-width="1.2" stroke-linejoin="round" ></rect></svg></uc-icon>`}render(){let e=this.onClick,t=this.title;return v`<button role="option" type="button" class=${xe(this.buttonClasses)} aria-label=${O(this.titleProp)} title=${O(this.titleProp)} @click=${e} >${this._renderIcon()}<div class="uc-title" ?hidden=${!t}>${t}</div></button>`}};a([_({attribute:false})],sr.prototype,"aspectRatio",1);function ca(r){let i=r+90;return i=i>=360?0:i,i}function da(r,i){if(r==="rotate")return ca(typeof i=="number"?i:0);if(r==="mirror"||r==="flip")return !i;throw new Error(`Unsupported operation: ${r}`)}var or=class extends L{constructor(){super(...arguments);this.operation=void 0;}willUpdate(e){super.willUpdate(e),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(e){if(!this.operation)return;let t=this.$["*cropperEl"],s=t.getValue(this.operation),o=da(this.operation,s);this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{operation:this.operation,next:o,prev:s}),t.setValue(this.operation,o);}};a([_({type:String})],or.prototype,"operation",2);var Ds="important",ua=" !"+Ds,wt=Z(class extends J{constructor(r){if(super(r),r.type!==Ee.ATTRIBUTE||r.name!=="style"||r.strings?.length>2)throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.")}render(r){return Object.keys(r).reduce((i,e)=>{let t=r[e];return t==null?i:i+`${e=e.includes("-")?e:e.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g,"-$&").toLowerCase()}:${t};`},"")}update(r,[i]){let{style:e}=r.element;if(this.ft===void 0)return this.ft=new Set(Object.keys(i)),this.render(i);for(let t of this.ft)i[t]==null&&(this.ft.delete(t),t.includes("-")?e.removeProperty(t):e[t]=null);for(let t in i){let s=i[t];if(s!=null){this.ft.add(t);let o=typeof s=="string"&&s.endsWith(ua);t.includes("-")||o?e.setProperty(t,o?s.slice(0,-11):s,o?Ds:""):e[t]=s;}}return F}});function rt(r){if(!r)return null;let i=r.match(/^([A-Za-z]+)\s+(\d+)$/);if(!i)return null;let[,e,t]=i;return !e||typeof t>"u"?null:{filter:e,value:Number(t)}}var He=class extends L{constructor(){super(...arguments);this._operation="";this._filter="";this._originalUrl="";this._lastPreviewRequestId=0;this._previewImage=null;this._previewLoaded=false;this.isOriginal=false;this._iconSize=20;}get filter(){return this._filter}set filter(e){let t=e??"";if(this._filter===t)return;let s=this._filter;this._filter=t,this._operation="filter",this.isOriginal=t===ie,this.icon=this.isOriginal?"original":"slider",this._iconSize=this.isOriginal?40:20,this.requestUpdate("filter",s),this.isConnected&&this._updateFilterLabels(t);}onClick(e){if(this.active)this.isOriginal||(this.$["*sliderEl"].setOperation(this._operation,this._filter),this.$["*showSlider"]=true);else {let t=this.$["*sliderEl"];t.setOperation(this._operation,this._filter),t.apply();}this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{operation:rt(this.$["*operationTooltip"])}),this.$["*currentFilter"]=this._filter;}_previewSrc(){let e=parseInt(window.getComputedStyle(this).getPropertyValue("--l-base-min-width"),10),t=Number.isFinite(e)&&e>0?e:this._iconSize||32,s=window.devicePixelRatio,o=Math.ceil(s*t),n=s>=2?"lightest":"normal",a=100,l={...this.$["*editorTransformations"]};return l[this._operation]=this._filter!==ie?{name:this._filter,amount:a}:void 0,le(this._originalUrl,ae(jt,_e(l),`quality/${n}`,`scale_crop/${o}x${o}/center`,`@clib/${Be}/${Ge}/uc-cloud-image-editor/`))}async _observerCallback(e,t){e[0]?.isIntersecting?await this._loadPreview(t):this._cancelPreload?.();}initCallback(){super.initCallback(),this._observer=new window.IntersectionObserver(this._observerCallback.bind(this),{threshold:[0,1]});let e=this.$["*originalUrl"];this._originalUrl=e??"",this.sub("*originalUrl",t=>{this._originalUrl=t??"",!this.isOriginal&&this._originalUrl&&this.isConnected&&!this._previewImage&&(this._observer?.observe(this),this._schedulePreviewVisibilityCheck());}),this.isOriginal||(this._observer?.observe(this),this._schedulePreviewVisibilityCheck()),this._filter&&this._updateFilterLabels(this._filter),this.sub("*currentFilter",t=>{this.active=!!(t&&t===this._filter);}),this.sub("*networkProblems",async t=>{t||(this._previewImage?await this._loadPreview():this._schedulePreviewVisibilityCheck());});}disconnectedCallback(){super.disconnectedCallback(),this._observer?.disconnect(),this._cancelPreload?.(),this._clearPreviewVisibilityChecks();}updated(e){super.updated(e),e.has("isOriginal")&&(this.isOriginal?this._observer?.unobserve(this):(this._observer?.observe(this),this._schedulePreviewVisibilityCheck()));}_updateFilterLabels(e){if(!e){this.titleProp="";return}let t=this.l10n("a11y-cloud-editor-apply-filter",{name:e.toLowerCase()});this.titleProp=t;}async _loadPreview(e){if(!this.isConnected){e?.unobserve(this),this._cancelPreload?.(),this._cancelPreload=void 0;return}if(!this._originalUrl){!this._previewVisibilityCheckTimeout&&!this._previewVisibilityCheckRaf&&this._schedulePreviewVisibilityCheck();return}let t=++this._lastPreviewRequestId,s="";try{s=await this.proxyUrl(this._previewSrc());}catch(a){this.$["*networkProblems"]=true,console.error("Failed to resolve preview URL",{error:a});return}this._previewLoaded=false,this._cancelPreload?.();let{promise:o,cancel:n}=_t(s);this._cancelPreload=()=>{n(),this._lastPreviewRequestId===t&&(this._cancelPreload=void 0);};try{if(await o,this._lastPreviewRequestId!==t||!this.isConnected)return;this._previewImage=s,this._previewLoaded=!0,this._clearPreviewVisibilityChecks(),(e??this._observer)?.unobserve(this);}catch(a){this.$["*networkProblems"]=true,console.error("Failed to load image",{error:a}),this._schedulePreviewVisibilityCheck();}finally{this._lastPreviewRequestId===t&&(this._cancelPreload=void 0);}}_schedulePreviewVisibilityCheck(){if(!this.isConnected||this._previewImage||this._previewLoaded||this.isOriginal||this.$["*networkProblems"]){this._clearPreviewVisibilityChecks();return}this._previewVisibilityCheckRaf&&cancelAnimationFrame(this._previewVisibilityCheckRaf),this._previewVisibilityCheckRaf=requestAnimationFrame(()=>{if(this._previewVisibilityCheckRaf=void 0,!this.isConnected||this._previewImage||this._previewLoaded||this.isOriginal){this._clearPreviewVisibilityChecks();return}let e=this.getBoundingClientRect(),t=e.width>0&&e.height>0,s=window.innerWidth||document.documentElement.clientWidth,o=window.innerHeight||document.documentElement.clientHeight;if(t&&e.bottom>0&&e.right>0&&e.top<o&&e.left<s){this._loadPreview();return}this._previewVisibilityCheckTimeout=window.setTimeout(()=>{this._previewVisibilityCheckTimeout=void 0,this._schedulePreviewVisibilityCheck();},500);});}_clearPreviewVisibilityChecks(){this._previewVisibilityCheckRaf&&(cancelAnimationFrame(this._previewVisibilityCheckRaf),this._previewVisibilityCheckRaf=void 0),this._previewVisibilityCheckTimeout&&(window.clearTimeout(this._previewVisibilityCheckTimeout),this._previewVisibilityCheckTimeout=void 0);}get _shouldShowPreview(){return !!(this._previewLoaded&&!this.active&&!this.isOriginal)}render(){let e=this.onClick,t={opacity:this._shouldShowPreview?"1":"0"};this._previewImage&&(t.backgroundImage=`url(${this._previewImage})`);let s={opacity:this.active||this.isOriginal?"1":"0"};return v`<button role="option" type="button" class=${xe(this.buttonClasses)} aria-label=${O(this.titleProp)} title=${O(this.titleProp)} @click=${e} ><div class="uc-preview" ?data-loaded=${this._previewLoaded} style=${wt(t)}></div><uc-icon class=${xe({"uc-original-icon":this.isOriginal})} name=${this.icon} style=${wt(s)} ></uc-icon></button>`}};a([b()],He.prototype,"_previewImage",2),a([b()],He.prototype,"_previewLoaded",2),a([b()],He.prototype,"isOriginal",2),a([b()],He.prototype,"_iconSize",2),a([_({type:String})],He.prototype,"filter",1);var nr=class extends L{constructor(){super(...arguments);this._operation="";}get operation(){return this._operation}set operation(e){let t=e??"";if(this._operation===t)return;let s=this._operation;this._operation=t,this.requestUpdate("operation",s),this.isConnected&&t&&this._updateOperationMetadata(t);}_updateOperationMetadata(e){this.icon=e;let t=()=>{let o=this.l10n("a11y-cloud-editor-apply-tuning",{name:this.l10n(e).toLowerCase()});return this.titleProp=o,o},s=()=>{let o=this.l10n(e);return this.title=o,o};t(),s();}initCallback(){super.initCallback(),this._operation&&this._updateOperationMetadata(this._operation),this.sub("*editorTransformations",e=>{if(!this._operation)return;let{zero:t}=X[this._operation],s=e[this._operation],o=typeof s<"u"?s!==t:false;this.active=o;});}onClick(e){this.$["*sliderEl"]?.setOperation(this._operation),this.$["*showSlider"]=true,this.$["*currentOperation"]=this._operation,this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{operation:rt(this.$["*operationTooltip"])});}};a([_({type:String})],nr.prototype,"operation",1);var pa=1,Fs=()=>{},ar=class extends A{constructor(){super(...arguments);this.hiddenScrollbar=false;this._handleWheel=e=>{e.preventDefault();let{deltaY:t,deltaX:s}=e;if(Math.abs(s)>pa){this.scrollLeft+=s;return}this.scrollLeft+=t;};}connectedCallback(){super.connectedCallback(),this.addEventListener("wheel",this._handleWheel,{passive:false}),this.addEventListener("scroll",Fs,{passive:true});}disconnectedCallback(){this.removeEventListener("wheel",this._handleWheel),this.removeEventListener("scroll",Fs),super.disconnectedCallback();}};a([_({type:Boolean,noAccessor:true,attribute:"hidden-scrollbar"})],ar.prototype,"hiddenScrollbar",2);function Ct(r,i,e){return r?i(r):e?.(r)}var B=class extends A{constructor(){super(...arguments);this._showLoader=false;this.showMainToolbar=true;this.showSubToolbar=false;this._showTabToggles=true;this.tabList=[...M];this.activeTab=R.CROP;this._useSliderPanel=true;this._tooltipVisible=false;this._operationTooltip=null;this._tabIndicatorOffset=0;this._tabIndicatorWidth=0;this._sliderRef=I();this._tabIndicatorRef=I();this.tabToggleRefs={[R.CROP]:I(),[R.TUNING]:I(),[R.FILTERS]:I()};this._handleWindowResize=()=>{this._syncTabIndicator();};this._cropPresets=[];this._debouncedShowLoader=z(e=>{this._showLoader=e;},500);this._updateInfoTooltip=z(()=>{let e=this.$["*editorTransformations"],t=this.$["*currentOperation"],s="",o=false;if(this.$["*tabId"]===R.FILTERS)if(o=true,this.$["*currentFilter"]&&e?.filter?.name===this.$["*currentFilter"]){let n=e?.filter?.amount||100;s=`${this.$["*currentFilter"]} ${n}`;}else s=this.l10n(ie);else if(this.showSubToolbar&&this.$["*tabId"]===R.TUNING&&t){o=true;let n=e?.[t]||X[t].zero;s=`${this.l10n(t)} ${n}`;}o&&(this.$["*operationTooltip"]=s),this._tooltipVisible=o;},0);this._subTopToolbarStyles={hidden:"uc-sub-toolbar--top-hidden",visible:"uc-sub-toolbar--visible"};this._subBottomToolbarStyles={hidden:"uc-sub-toolbar--bottom-hidden",visible:"uc-sub-toolbar--visible"};this._tabToggleStyles={hidden:"uc-tab-toggle--hidden",visible:"uc-tab-toggle--visible"};this._tabTogglesStyles={hidden:"uc-tab-toggles--hidden",visible:"uc-tab-toggles--visible"};this.init$={...this.init$,"*sliderEl":null,"*showSlider":false,"*showListAspectRatio":false,"*currentFilter":ie,"*currentOperation":null,"*operationTooltip":null};this._handleCancel=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"cancel"}),this._cancelPreload?.();let t=this.$["*on.cancel"];t?.();};this._handleApply=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"apply"});let t=this.$["*on.apply"];t?.(this.$["*editorTransformations"]);};this._handleApplySlider=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"apply-slider",operation:rt(this.$["*operationTooltip"])}),this._sliderRef.value?.apply(),this._onSliderClose();};this._handleCancelSlider=e=>{this.telemetryManager.sendEventCloudImageEditor(e,this.$["*tabId"],{action:"cancel-slider"}),this._sliderRef.value?.cancel(),this._onSliderClose();};this._handleTabClick=e=>{let s=e.currentTarget?.getAttribute("data-id");s&&(this.telemetryManager.sendEventCloudImageEditor(e,s),this._activateTab(s,{fromViewer:false}));};}_onSliderClose(){this.$["*showSlider"]=false,this.$["*tabId"]===R.CROP&&(this.$["*showListAspectRatio"]=false),this.$["*tabId"]===R.TUNING&&(this._tooltipVisible=false);}_activateTab(e,{fromViewer:t=false,force:s=false}={}){this.$["*tabId"]!==e&&(this.$["*tabId"]=e),this._applyTabState(e,{fromViewer:t,force:s});}_applyTabState(e,{fromViewer:t,force:s=false}){if(!s&&this.activeTab===e){this._syncTabIndicator();return}this.activeTab=e;let o=this.$["*faderEl"],n=this.$["*cropperEl"];e===R.CROP?(o?.deactivate(),this.$["*imageSize"]&&n?.activate(this.$["*imageSize"],{fromViewer:t})):(o?.activate({url:this.$["*originalUrl"],fromViewer:t}),n?.deactivate());for(let a of M){let l=a===e,u=this.tabToggleRefs[a]?.value;u&&(u.active=l),l&&this._syncTabIndicator();}}_syncTabIndicator(){let t=this.tabToggleRefs[this.activeTab]?.value,s=this._tabIndicatorRef.value;if(!t||!s)return;let o=t.offsetLeft,n=t.offsetWidth||Number(getComputedStyle(t).width.replace("px",""));(this._tabIndicatorOffset!==o||this._tabIndicatorWidth!==n)&&(this._tabIndicatorOffset=o,this._tabIndicatorWidth=n,s.style.transform=`translateX(${o}px)`,s.style.width=`${n}px`);}get _hasAspectRatioPicker(){return this._cropPresets.length>=3}_renderControlsByTab(e){switch(e){case R.CROP:return this._renderCropTabControls();case R.FILTERS:return this._renderFilterTabControls();case R.TUNING:return this._renderTuningTabControls();default:return []}}_renderCropTabControls(){let e=[];if(this._hasAspectRatioPicker)e.push(()=>this._renderFreeformControl());else for(let t of this._cropPresets)e.push(()=>this._renderAspectRatioControl(t));for(let t of Vr)e.push(()=>this._renderCropOperationControl(t));return this._renderControlGroup(e)}_renderFilterTabControls(){let t=[ie,...Fr].map(s=>()=>this._renderFilterControl(s));return this._renderControlGroup(t)}_renderTuningTabControls(){let e=Dr.map(t=>()=>this._renderOperationControl(t));return this._renderControlGroup(e)}_renderControlGroup(e){return e.length?e.map(s=>s()):[]}_renderFreeformControl(){return v`<uc-editor-freeform-button-control></uc-editor-freeform-button-control>`}_renderAspectRatioControl(e){return v`<uc-editor-aspect-ratio-button-control .aspectRatio=${e}></uc-editor-aspect-ratio-button-control>`}_renderCropOperationControl(e){return v`<uc-editor-crop-button-control .operation=${e}></uc-editor-crop-button-control>`}_renderFilterControl(e){return v`<uc-editor-filter-control .filter=${e}></uc-editor-filter-control>`}_renderOperationControl(e){return v`<uc-editor-operation-control .operation=${e}></uc-editor-operation-control>`}_renderAspectRatioList(){return this._hasAspectRatioPicker?this._cropPresets.map(e=>this._renderAspectRatioControl(e)):[]}async _preloadEditedImage(){if(this.$["*imgContainerEl"]&&this.$["*originalUrl"]){let e=this.$["*imgContainerEl"].offsetWidth,t=await this.proxyUrl(it(this.$["*originalUrl"],e,this.$["*editorTransformations"]));this._cancelPreload?.();let{cancel:s}=Tt([t]);this._cancelPreload=()=>{s(),this._cancelPreload=void 0;};}}initCallback(){super.initCallback();let e=this.$["*cropPresetList"]??[];this._cropPresets=[...e],this.sub("*cropPresetList",t=>{this._cropPresets=[...t??[]];}),this.sub("*imageSize",t=>{t&&setTimeout(()=>{this._activateTab(this.$["*tabId"],{fromViewer:true});},0);}),this.sub("*editorTransformations",t=>{let s=t?.filter?.name;this.$["*currentFilter"]!==s&&(this.$["*currentFilter"]=s??"");}),this.sub("*currentFilter",()=>{this._updateInfoTooltip();}),this.sub("*currentOperation",()=>{this._updateInfoTooltip();}),this.sub("*tabId",t=>{this._applyTabState(t,{fromViewer:false,force:true}),this._updateInfoTooltip();}),this.sub("*originalUrl",()=>{this.$["*faderEl"]?.deactivate();}),this.sub("*editorTransformations",t=>{this._preloadEditedImage(),this.$["*faderEl"]?.setTransformations(t);}),this.sub("*loadingOperations",t=>{let s=false;for(let[,o]of t.entries()){if(s)break;for(let[,n]of o.entries())if(n){s=true;break}}this._debouncedShowLoader(s);}),this.sub("*showSlider",t=>{t?(this.showSubToolbar=true,this.showMainToolbar=false,this._useSliderPanel=true):this.$["*showListAspectRatio"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*showListAspectRatio",t=>{t?(this.showSubToolbar=true,this.showMainToolbar=false,this._useSliderPanel=false):this.$["*showSlider"]||(this.showSubToolbar=false,this.showMainToolbar=true);}),this.sub("*tabList",t=>{if(this.tabList=t,this._showTabToggles=t.length>1,!t.includes(this.$["*tabId"])&&t.length>0){let[s]=t;s&&this._activateTab(s,{fromViewer:false});return}this._syncTabIndicator();}),this.sub("*operationTooltip",t=>{this._operationTooltip=t;}),this._updateInfoTooltip();}connectedCallback(){super.connectedCallback(),window.addEventListener("resize",this._handleWindowResize);}firstUpdated(e){super.firstUpdated(e),this._assignSharedElements(),this._syncTabIndicator();}updated(e){super.updated(e),(e.has("activeTab")||e.has("tabList"))&&this.updateComplete.then(()=>this._syncTabIndicator()),(e.has("showSubToolbar")||e.has("showMainToolbar"))&&this._assignSharedElements();}disconnectedCallback(){window.removeEventListener("resize",this._handleWindowResize),super.disconnectedCallback(),this.$["*showSlider"]=false,this.$["*showListAspectRatio"]=false;}_assignSharedElements(){let e=this._sliderRef.value;e&&(this.$["*sliderEl"]=e);}_renderTabToggle(e){let t=this.tabList.includes(e),s=this.activeTab===e,o=this.tabList.indexOf(e),n=o>=0?wt({gridColumn:`${o+1}`}):S;return v`<uc-presence-toggle class="uc-tab-toggle" .visible=${t} .styles=${this._tabToggleStyles}><uc-btn-ui theme="tab" data-id=${e} icon=${e} role="tab" aria-controls=${`tab_${e}`} aria-selected=${s?"true":"false"} title-prop=${`a11y-editor-tab-${e}`} .active=${s} style=${n} @click=${this._handleTabClick} ${$(this.tabToggleRefs[e])} ></uc-btn-ui></uc-presence-toggle>`}_renderTabContent(e){let t=this._renderControlsByTab(e);return v`<div id=${`tab_${e}`} 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">${t.length?t:S}</div></div></uc-editor-scroller></div>`}render(){let e=["uc-info-tooltip",this._tooltipVisible?"uc-info-tooltip_visible":"uc-info-tooltip_hidden"].join(" "),t=this._hasAspectRatioPicker;return v`<uc-line-loader-ui .active=${this._showLoader}></uc-line-loader-ui><div class="uc-info-tooltip_container"><div class="uc-info-tooltip_wrapper"><div class=${e}>${this._operationTooltip??""}</div></div></div><div class="uc-toolbar-container"><uc-presence-toggle role="tablist" class="uc-sub-toolbar" .visible=${this.showMainToolbar} .styles=${this._subTopToolbarStyles} ><div class="uc-tab-content-row">${M.map(s=>Ct(this.activeTab===s,()=>this._renderTabContent(s)))}</div><div class="uc-controls-row"><uc-presence-toggle class="uc-tab-toggles" .visible=${this._showTabToggles} .styles=${this._tabTogglesStyles} @initial-render=${()=>this._syncTabIndicator()} ><div class="uc-tab-toggles_indicator" ${$(this._tabIndicatorRef)} ></div>${M.map(s=>this._renderTabToggle(s))}</uc-presence-toggle><uc-btn-ui style="order: -1" theme="secondary-icon" icon="closeMax" title-prop="cancel" @click=${this._handleCancel} ></uc-btn-ui><uc-btn-ui theme="primary-icon" icon="done" title-prop="apply" @click=${this._handleApply}></uc-btn-ui></div></uc-presence-toggle><uc-presence-toggle class="uc-sub-toolbar" .visible=${this.showSubToolbar} .styles=${this._subBottomToolbarStyles}><div class="uc-slider" ?hidden=${!this._useSliderPanel}><uc-editor-slider ${$(this._sliderRef)}></uc-editor-slider></div><div class="uc-list-aspect-ratio-container" ?hidden=${this._useSliderPanel||!t}>${t?v`<div class="uc-list-aspect-ratio">${this._renderAspectRatioList()}</div>`:S}</div><div class="uc-controls-row"><uc-btn-ui theme="secondary" @click=${this._handleCancelSlider} text=${this.l10n("cancel")}></uc-btn-ui><uc-btn-ui theme="primary" @click=${this._handleApplySlider} text=${this.l10n("apply")}></uc-btn-ui></div></uc-presence-toggle></div>`}};a([b()],B.prototype,"_showLoader",2),a([b()],B.prototype,"showMainToolbar",2),a([b()],B.prototype,"showSubToolbar",2),a([b()],B.prototype,"_showTabToggles",2),a([b()],B.prototype,"tabList",2),a([b()],B.prototype,"activeTab",2),a([b()],B.prototype,"_useSliderPanel",2),a([b()],B.prototype,"_tooltipVisible",2),a([b()],B.prototype,"_operationTooltip",2),a([b()],B.prototype,"_cropPresets",2);var Et=["free"],Vs=r=>{let i=ut(r);if(!i||i.length===0)return [];let e=[];for(let t of i){let s=t.trim();if(!s)continue;let o=s.indexOf(":");if(o===-1&&!Et.includes(s)){console.warn(`Invalid crop preset: ${s}`);continue}let n=Number(s.slice(0,o)),a=Number(s.slice(o+1));if((!Number.isFinite(n)||!Number.isFinite(a)||n<=0||a<=0)&&!Et.includes(s)){console.warn(`Invalid crop preset: ${s}`);continue}e.push({id:ye.generateFastUid(),type:"aspect-ratio",width:Et.includes(s)?0:n,height:Et.includes(s)?0:a,hasFreeform:Et.includes(s)});}return e},zs=(r,i,e,t=.1)=>{let s=r/i,o=null,n=1/0;for(let a of e){let[l,c]=[a.width,a.height],u=l/c,d=Math.abs(s-u);d<n&&(n=d,o=a);}if(o){let[a,l]=[o.width,o.height],c=a/l;if(Math.abs(s-c)/c>t)return null}return o};var ha=r=>M.includes(r),Hs=r=>{if(!r)return M;let i=kr(r).filter(ha);return i.length===0?M:i};function js(r){return {"*originalUrl":null,"*loadingOperations":new Map,"*faderEl":null,"*cropperEl":null,"*imgEl":null,"*imgContainerEl":null,"*networkProblems":false,"*imageSize":null,"*editorTransformations":{},"*cropPresetList":[],"*currentAspectRatio":null,"*tabList":M,"*tabId":R.CROP,"*on.retryNetwork":()=>{let i=r.querySelectorAll("img");for(let e of i){let t=e.src;e.src=Ie,e.src=t;}r.$["*networkProblems"]=false;},"*on.apply":i=>{if(!i)return;let e=r.$["*originalUrl"];if(!e){console.warn("Original URL is null, cannot apply transformations");return}let t=ae(_e(i),"preview"),s=le(e,t),o={originalUrl:e,cdnUrlModifiers:t,cdnUrl:s,transformations:i};r.dispatchEvent(new CustomEvent("apply",{detail:o,bubbles:true,composed:true})),r.remove();},"*on.cancel":()=>{r.remove(),r.dispatchEvent(new CustomEvent("cancel",{bubbles:true,composed:true}));}}}var Ks="<svg width='0' height='0' style='position:absolute'><symbol fill='none' viewBox='0 0 9 6' id='uc-icon-arrow-dropdown' xmlns='http://www.w3.org/2000/svg'><path stroke='currentColor' d='m1.5 1.667 3 2.666 3-2.666' opacity='.5'/></symbol><symbol viewBox='0 0 24 24' id='uc-icon-aspect-ratio' xmlns='http://www.w3.org/2000/svg'/><symbol viewBox='0 0 20 20' id='uc-icon-brightness' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M15 10a5 5 0 0 1-5 5m5-5a5 5 0 0 0-5-5m5 5h-5m0 5a5 5 0 0 1 0-10m0 10V5m0 15v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05m-.626 2.45H10m4.324 5H10'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-closeMax' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M8.232 10 3.585 5.353l1.768-1.768L10 8.232l4.648-4.647 1.767 1.768L11.768 10l4.647 4.648-1.767 1.767L10 11.768l-4.647 4.647-1.768-1.767L8.232 10Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-contrast' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 10a8 8 0 1 0 16 0 8 8 0 1 0-16 0m8-8v16m8-8h-8m7.598 2.5H10m6.24 2.5H10m7.6-7.5H10M16.242 5H10'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-crop' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M20 14H7.005C6.45 14 6 13.55 6 12.995V0M0 6h13.067c.515 0 .933.418.933.933V20M14.5.4 13 2l1.5 1.6M13 2h2a3 3 0 0 1 3 3v2M5.5 19.6 7 18l-1.5-1.6M7 18H5a3 3 0 0 1-3-3v-2'/></symbol><symbol fill='currentColor' viewBox='0 0 20 20' id='uc-icon-done' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='m18.057 6.333-9.365 9.125a1.25 1.25 0 0 1-1.768-.023L1.92 10.296l1.791-1.744 4.132 4.243 8.47-8.253 1.744 1.79Z' clip-rule='evenodd'/></symbol><symbol fill='currentColor' viewBox='0 0 25 24' id='uc-icon-edit-file' xmlns='http://www.w3.org/2000/svg'><path fill-rule='evenodd' d='M18.558 2.804a.78.78 0 0 0-.557.235l-.008.007-2.472 2.46 3.847 3.848 2.46-2.473.004-.003a.78.78 0 0 0 0-1.108l-.004-.003-2.712-2.728a.78.78 0 0 0-.558-.235Zm-.248 7.613-3.852-3.852-8.93 8.887-1.516 5.41 5.41-1.515 8.888-8.93Zm-.636-8.934a2.28 2.28 0 0 1 2.512.505l2.702 2.717.002.002a2.278 2.278 0 0 1 0 3.234l-.002.002-12.541 12.602a.75.75 0 0 1-.33.193l-6.884 1.928a.75.75 0 0 1-.925-.924l1.928-6.885a.75.75 0 0 1 .193-.33l12.603-12.54a2.28 2.28 0 0 1 .742-.504Z' clip-rule='evenodd'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-enhance' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19 13h-2m0 0a4 4 0 0 1-4-4m4 4a4 4 0 0 0-4 4m0-8V7m0 2a4 4 0 0 1-4 4m-2 0h2m0 0a4 4 0 0 1 4 4m0 0v2M8 8.5H6.5m0 0a2 2 0 0 1-2-2m2 2a2 2 0 0 0-2 2m0-4V5m0 1.5a2 2 0 0 1-2 2M1 8.5h1.5m0 0a2 2 0 0 1 2 2m0 0V12M12 3h-1m0 0a1 1 0 0 1-1-1m1 1a1 1 0 0 0-1 1m0-2V1m0 1a1 1 0 0 1-1 1M8 3h1m0 0a1 1 0 0 1 1 1m0 0v1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-exposure' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M10 20v-3M2.93 2.929 5.05 5.05M0 10h3m-.07 7.071 2.12-2.121M10 0v3m7.07 14.071-2.12-2.121M20 10h-3m.07-7.071L14.95 5.05M5 10a5 5 0 1 0 10 0 5 5 0 1 0-10 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-filters' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M4.5 6.5a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m-3.5 6a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0m7 0a5.5 5.5 0 1 0 11 0 5.5 5.5 0 1 0-11 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-flip' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M19.6 5 18 3.5 16.4 5m3.2 10L18 16.5 16.4 15M18 3.523v12.954M3.3 8.5h10.654c.301 0 .415-.395.159-.554L3.459 1.286A.3.3 0 0 0 3 1.542V8.2a.3.3 0 0 0 .3.3zm0 3h10.654c.301 0 .415.395.159.554l-10.654 6.66A.3.3 0 0 1 3 18.458v-6.66a.3.3 0 0 1 .3-.3z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-gamma' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M17 3C9 6 2.5 11.5 2.5 17.5m0 0h1m-1 0v-1m14 1h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3 0h1m-3-14v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1m0 3v-1'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-mirror' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M5 .4 3.5 2 5 3.6M15 .4 16.5 2 15 3.6M3.52 2h12.957M8.5 16.7V6.046c0-.301-.394-.415-.554-.159L1.287 16.541a.3.3 0 0 0 .255.459H8.2a.3.3 0 0 0 .3-.3zm3 0V6.046c0-.301.395-.415.555-.159l6.659 10.654a.3.3 0 0 1-.255.459H11.8a.3.3 0 0 1-.3-.3z'/></symbol><symbol viewBox='0 0 40 40' id='uc-icon-original' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.5' d='M0 40 40 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-rotate' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M13.5.4 12 2l1.5 1.6M12.023 2H14.4A3.6 3.6 0 0 1 18 5.6V8M4 17h9a1 1 0 0 0 1-1V7a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v9a1 1 0 0 0 1 1z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-sad' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M2 17c4.418-4 11.582-4 16 0M16.5 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zm-11 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0z'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-saturation' xmlns='http://www.w3.org/2000/svg'><defs><linearGradient id='ruc-icon-id__a' x1='10.001' y1='1' x2='10.001' y2='19' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs><circle cx='10.001' cy='10' r='9' transform='rotate(90 10 10)' fill='url(#ruc-icon-id__a)'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-slider' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M0 10h11m0 0a2 2 0 1 0 4 0m-4 0a2 2 0 1 1 4 0m0 0h5'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-tuning' xmlns='http://www.w3.org/2000/svg'><path stroke-linejoin='round' fill='none' stroke='currentColor' stroke-width='1.2' d='M8 10h11M1 10h4M1 4.5h11m3 0h4m-18 11h11m3 0h4m-7-11a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0M5 10a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0m7 5.5a1.5 1.5 0 1 0 3 0 1.5 1.5 0 1 0-3 0'/></symbol><symbol viewBox='0 0 20 20' id='uc-icon-vibrance' xmlns='http://www.w3.org/2000/svg'><path d='M2.125 5.64A8.96 8.96 0 0 0 1.001 10a8.96 8.96 0 0 0 1.124 4.36V5.64z' fill='url(#uuc-icon-id__a)'/><path d='M2.875 15.499V4.502a9.053 9.053 0 0 1 1.75-1.72v14.437a9.05 9.05 0 0 1-1.75-1.72z' fill='url(#uuc-icon-id__b)'/><path d='M5.375 17.722c.548.33 1.134.601 1.75.809V1.469a8.956 8.956 0 0 0-1.75.81v15.443z' fill='url(#uuc-icon-id__c)'/><path d='M7.875 1.253v17.495c.564.136 1.15.22 1.75.244V1.008a9 9 0 0 0-1.75.245z' fill='url(#uuc-icon-id__d)'/><path d='M10.375 1.008v17.984a9 9 0 0 0 1.75-.244V1.252a9 9 0 0 0-1.75-.244z' fill='url(#uuc-icon-id__e)'/><path d='M12.875 1.469V18.53a8.957 8.957 0 0 0 1.75-.808V2.277a8.957 8.957 0 0 0-1.75-.808z' fill='url(#uuc-icon-id__f)'/><path d='M15.375 2.78v14.44a9.053 9.053 0 0 0 1.75-1.72v-11a9.054 9.054 0 0 0-1.75-1.72z' fill='url(#uuc-icon-id__g)'/><path d='M17.875 5.638v8.724A8.959 8.959 0 0 0 19.001 10a8.96 8.96 0 0 0-1.126-4.362z' fill='url(#uuc-icon-id__h)'/><defs><linearGradient id='uuc-icon-id__a' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__b' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__c' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__d' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__e' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__f' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__g' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient><linearGradient id='uuc-icon-id__h' x1='19.001' y1='10' x2='1.001' y2='10' gradientUnits='userSpaceOnUse'><stop stop-color='#DE15FF'/><stop offset='.203' stop-color='#0029FF'/><stop offset='.479' stop-color='#2AE4F0'/><stop offset='.604' stop-color='#15EF11'/><stop offset='.75' stop-color='#FAE528'/><stop offset='1' stop-color='#EB2A2A'/></linearGradient></defs></symbol><symbol viewBox='0 0 20 20' id='uc-icon-warmth' xmlns='http://www.w3.org/2000/svg'><path d='m7.5 13.05.429.42.171-.175v-.244h-.6zm5 0h-.6v.245l.172.175.428-.42zM8.1 3.5c0-1.05.85-1.9 1.9-1.9V.4a3.1 3.1 0 0 0-3.1 3.1h1.2zm0 9.55V3.5H6.9v9.55h1.2zm-1 2.45c0-.79.315-1.506.829-2.03l-.858-.84A4.088 4.088 0 0 0 5.9 15.5h1.2zm2.9 2.9a2.9 2.9 0 0 1-2.9-2.9H5.9a4.1 4.1 0 0 0 4.1 4.1v-1.2zm2.9-2.9a2.9 2.9 0 0 1-2.9 2.9v1.2a4.1 4.1 0 0 0 4.1-4.1h-1.2zm-.829-2.03c.514.524.829 1.24.829 2.03h1.2c0-1.117-.447-2.13-1.171-2.87l-.858.84zM11.9 3.5v9.55h1.2V3.5h-1.2zM10 1.6c1.05 0 1.9.85 1.9 1.9h1.2A3.1 3.1 0 0 0 10 .4v1.2z' fill='currentColor'/><path d='M10 14V8' stroke='currentColor' stroke-width='1.2' stroke-linecap='round'/><path d='M14 3h3m-3 3h3m-3 3h3m-8 6.5a1 1 0 1 0 2 0 1 1 0 1 0-2 0' stroke='currentColor' stroke-width='1.2'/></symbol></svg>";var Bs=Ft([...M]),D=class extends A{constructor(){super(...arguments);this.ctxOwner=true;this._statusMessage="";this._imageSrc=Ie;this._fileType="";this._showLoader=false;this.uuid=null;this.cdnUrl=null;this.cropPreset="";this.tabs=Bs;this._hasNetworkProblems=false;this._isInitialized=false;this._pendingInitUpdate=null;this._debouncedShowLoader=z(e=>{this._showLoader=e;},300);this._imgRef=I();this._cropperRef=I();this._faderRef=I();this._imgContainerRef=I();this._handleImageLoad=()=>{this._debouncedShowLoader(false),this._imageSrc!==Ie&&(this.$["*networkProblems"]=false);};this._handleImageError=()=>{this._debouncedShowLoader(false),this.$["*networkProblems"]=true;};this._handleRetryNetwork=()=>{let e=this.$["*on.retryNetwork"];e?.();};this.init$={...this.init$,...js(this)};}static{this.styleAttrs=["uc-cloud-image-editor"];}_scheduleInitialization(){this._isInitialized||this._pendingInitUpdate||(this._pendingInitUpdate=this.updateComplete.then(()=>{this._pendingInitUpdate=null,this._isInitialized=true;}));}initCallback(){super.initCallback(),this._syncTabListFromProp(),this._syncCropPresetState();}_assignSharedElements(){let e=this._faderRef.value;e&&(this.$["*faderEl"]=e);let t=this._cropperRef.value;t&&(this.$["*cropperEl"]=t);let s=this._imgContainerRef.value;s&&(this.$["*imgContainerEl"]=s);let o=this._imgRef.value;o&&(this.$["*imgEl"]=o);}_attachImageListeners(){let e=this._imgRef.value;e&&(e.addEventListener("load",this._handleImageLoad),e.addEventListener("error",this._handleImageError));}_detachImageListeners(){let e=this._imgRef.value;e&&(e.removeEventListener("load",this._handleImageLoad),e.removeEventListener("error",this._handleImageError));}get _imageClassName(){let e=this.$["*tabId"];return H("uc-image",{"uc-image_hidden_to_cropper":e===R.CROP,"uc-image_hidden_effects":e!==R.CROP})}_waitForSize(){return new Promise((t,s)=>{let o=window.setTimeout(()=>{s(new Error("[cloud-image-editor] timeout waiting for non-zero container size"));},3e3),n=new ResizeObserver(a=>{let[l]=a;l&&l.contentRect.width>0&&l.contentRect.height>0&&(window.clearTimeout(o),n.disconnect(),window.setTimeout(()=>t(),0));});n.observe(this);})}firstUpdated(e){super.firstUpdated(e),this._assignSharedElements(),this._attachImageListeners(),this.initEditor();let t=!!(this.uuid||this.cdnUrl),s=e.has("uuid")||e.has("cdnUrl");t&&!s&&this.updateImage();}disconnectedCallback(){this._detachImageListeners(),super.disconnectedCallback();}render(){let e=this._fileType??"",t=this._statusMessage??"",s=this._imageSrc||Ie,o=this._showLoader,n=this._hasNetworkProblems;return v` ${ci(Ks)}<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._handleRetryNetwork}></uc-btn-ui></div></uc-presence-toggle><div class="uc-viewport"><div class="uc-file_type_outer"><div class="uc-file_type">${e}</div></div><div class="uc-image_container" ${$(this._imgContainerRef)}><img src=${s} class=${this._imageClassName} ${$(this._imgRef)} />${Ct(this._isInitialized,()=>v`<uc-editor-image-cropper ${$(this._cropperRef)}></uc-editor-image-cropper>`)}<uc-editor-image-fader ${$(this._faderRef)}></uc-editor-image-fader></div><div class="uc-info_pan">${t}</div></div><div class="uc-toolbar"><uc-line-loader-ui .active=${o}></uc-line-loader-ui><div class="uc-toolbar_content uc-toolbar_content__editor">${Ct(this._isInitialized,()=>v`<uc-editor-toolbar></uc-editor-toolbar>`)}</div></div></div>`}updated(e){super.updated(e),e.has("uuid")&&this.uuid&&this.updateImage(),e.has("cdnUrl")&&this.cdnUrl&&this.updateImage(),e.has("tabs")&&this._syncTabListFromProp(),(e.has("cropPreset")||e.has("cdnUrl"))&&this._syncCropPresetState();}_syncTabListFromProp(){let e=this.tabs||Bs;this.$["*tabList"]=Hs(e);}_syncCropPresetState(){let e=Vs(this.cropPreset??""),t=null;if(this.cdnUrl){let s=Ri(this.cdnUrl),o=ki(s);if(Array.isArray(o?.crop?.dimensions)){let[n,a]=o.crop.dimensions;t=zs(n,a,e,.1);}}this.$["*cropPresetList"]=e,this.$["*currentAspectRatio"]=t??e?.[0]??null;}async updateImage(){if(this.isConnected){if(await this._waitForSize(),this.cdnUrl){let e=this.cdnUrl,t=Ht(e),s=$i(e,t);if(s===this.$["*originalUrl"])return;this.$["*originalUrl"]=s;let o=Ri(e),n=ki(o);this.$["*editorTransformations"]=n;}else if(this.uuid){let e=$i(this.cfg.cdnCname,this.uuid);if(e===this.$["*originalUrl"])return;this.$["*originalUrl"]=e,Object.keys(this.$["*editorTransformations"]).length>0&&(this.$["*editorTransformations"]={});}else throw new Error("No UUID nor CDN URL provided");this.$["*tabId"]===R.CROP?this.$["*cropperEl"]?.deactivate({reset:true}):this.$["*faderEl"]?.deactivate();try{let e=this.$["*originalUrl"],t=await this.proxyUrl(le(e,ae("json"))),s=await fetch(t).then(a=>a.json()),{width:o,height:n}=s;this.$["*imageSize"]={width:o,height:n},this.$["*tabId"]===R.CROP?this.$["*cropperEl"]?.activate(this.$["*imageSize"]):this.$["*faderEl"]?.activate({url:e});}catch(e){e&&(this.telemetryManager.sendEventError(e,"cloud editor image. Failed to load image info"),console.error("Failed to load image info",e));}this._scheduleInitialization();}}async initEditor(){try{await this._waitForSize();}catch(e){this.isConnected&&console.error(e.message);return}this.classList.add("uc-editor_ON"),this.sub("*networkProblems",e=>{let t=!!e;this._hasNetworkProblems=t;}),this.sub("*editorTransformations",e=>{if(Object.keys(e).length===0)return;let t=this.$["*originalUrl"],s=ae(_e(e),"preview"),o=le(t,s),n={originalUrl:t,cdnUrlModifiers:s,cdnUrl:o,transformations:e};this.dispatchEvent(new CustomEvent("change",{detail:n,bubbles:true,composed:true}));},false);}};a([b()],D.prototype,"_statusMessage",2),a([b()],D.prototype,"_imageSrc",2),a([b()],D.prototype,"_fileType",2),a([b()],D.prototype,"_showLoader",2),a([_({type:String,reflect:true})],D.prototype,"uuid",2),a([_({type:String,attribute:"cdn-url",reflect:true})],D.prototype,"cdnUrl",2),a([_({type:String,attribute:"crop-preset",reflect:true})],D.prototype,"cropPreset",2),a([_({type:String,reflect:true})],D.prototype,"tabs",2),a([b()],D.prototype,"_hasNetworkProblems",2),a([b()],D.prototype,"_isInitialized",2);var Gs=class extends D{static{this.styleAttrs=[...super.styleAttrs,"uc-wgt-common"];}constructor(){super(),this.init$={...this.init$,"*solution":this.tagName};}initCallback(){super.initCallback(),this.telemetryManager.sendEvent({eventType:me.INIT_SOLUTION}),this.a11y?.registerBlock(this);}};var sm=Object.freeze({PHOTO:"photo",VIDEO:"video"}),om=Object.freeze({IDLE:"idle",SHOT:"shot",PLAY:"play",PAUSE:"pause",RESUME:"resume",STOP:"stop",RETAKE:"retake",ACCEPT:"accept"});var qs=new Set;function am(r){qs.has(r)||(qs.add(r),console.warn(r));}/*! For license information please see chunk-SX25NGUM.js.LEGAL.txt */
8
+ export{vt as $,ht as A,B as Aa,Gt as B,D as Ba,qe as C,Gs as Ca,V as D,vn as E,Hl as F,We as G,wn as H,Cn as I,Bl as J,me as K,ge as L,Be as M,Ge as N,ni as O,hs as P,fs as Q,A as R,Ee as S,Z as T,J as U,ci as V,sm as W,om as X,am as Y,lp as Z,Vs as _,ke as a,_u as aa,v as b,Tu as ba,F as c,wu as ca,S as d,Cu as da,be as e,Eu as ea,us as f,I as fa,ps as g,$ as ga,ms as h,Ie as ha,_ as i,_t as ia,b as j,Os as ja,z as k,wt as ka,vs as l,di as la,ye as m,Qi as ma,uo as n,O as na,k as o,ee as oa,kr as p,er as pa,Ft as q,tr as qa,ae as r,Ns as ra,le as s,Re as sa,$i as t,rr as ta,ut as u,Us as ua,go as v,sr as va,ue as w,or as wa,K as x,He as xa,Ke as y,nr as ya,So as z,ar as za};
@@ -0,0 +1,70 @@
1
+ Bundled license information:
2
+
3
+ lit-html/lit-html.js:
4
+ @lit/reactive-element/reactive-element.js:
5
+ lit-element/lit-element.js:
6
+ @lit/reactive-element/decorators/property.js:
7
+ @lit/reactive-element/decorators/state.js:
8
+ @lit/reactive-element/decorators/custom-element.js:
9
+ @lit/reactive-element/decorators/event-options.js:
10
+ @lit/reactive-element/decorators/base.js:
11
+ @lit/reactive-element/decorators/query.js:
12
+ @lit/reactive-element/decorators/query-all.js:
13
+ @lit/reactive-element/decorators/query-async.js:
14
+ @lit/reactive-element/decorators/query-assigned-nodes.js:
15
+ @lit/context/lib/decorators/provide.js:
16
+ lit-html/directive.js:
17
+ lit-html/directives/unsafe-html.js:
18
+ lit-html/directives/unsafe-svg.js:
19
+ lit-html/async-directive.js:
20
+ /**
21
+ * @license
22
+ * Copyright 2017 Google LLC
23
+ * SPDX-License-Identifier: BSD-3-Clause
24
+ */
25
+
26
+ @lit/reactive-element/css-tag.js:
27
+ /**
28
+ * @license
29
+ * Copyright 2019 Google LLC
30
+ * SPDX-License-Identifier: BSD-3-Clause
31
+ */
32
+
33
+ lit-html/is-server.js:
34
+ @lit/context/lib/decorators/consume.js:
35
+ /**
36
+ * @license
37
+ * Copyright 2022 Google LLC
38
+ * SPDX-License-Identifier: BSD-3-Clause
39
+ */
40
+
41
+ @lit/reactive-element/decorators/query-assigned-elements.js:
42
+ @lit/context/lib/context-request-event.js:
43
+ @lit/context/lib/create-context.js:
44
+ @lit/context/lib/controllers/context-consumer.js:
45
+ @lit/context/lib/value-notifier.js:
46
+ @lit/context/lib/controllers/context-provider.js:
47
+ @lit/context/lib/context-root.js:
48
+ lit-html/directives/when.js:
49
+ /**
50
+ * @license
51
+ * Copyright 2021 Google LLC
52
+ * SPDX-License-Identifier: BSD-3-Clause
53
+ */
54
+
55
+ lit-html/directive-helpers.js:
56
+ lit-html/directives/ref.js:
57
+ /**
58
+ * @license
59
+ * Copyright 2020 Google LLC
60
+ * SPDX-License-Identifier: BSD-3-Clause
61
+ */
62
+
63
+ lit-html/directives/if-defined.js:
64
+ lit-html/directives/class-map.js:
65
+ lit-html/directives/style-map.js:
66
+ /**
67
+ * @license
68
+ * Copyright 2018 Google LLC
69
+ * SPDX-License-Identifier: BSD-3-Clause
70
+ */
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @license
3
- * Package: @uploadcare/file-uploader@1.27.0-alpha.0 (MIT)
3
+ * Package: @uploadcare/file-uploader@1.27.0-alpha.1 (MIT)
4
4
  * License: https://github.com/uploadcare/blob/main/LICENSE
5
- * Built: 2026-02-17T11:57:25.085Z
5
+ * Built: 2026-02-17T12:21:36.712Z
6
6
  */
7
7
  var t=Object.freeze({START_FROM:"start-from",CAMERA:"camera",DRAW:"draw",UPLOAD_LIST:"upload-list",URL:"url",CLOUD_IMG_EDIT:"cloud-image-edit",EXTERNAL:"external"});export{t as a};