@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
package/web/uc-img.min.js CHANGED
@@ -1,8 +1,8 @@
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:44.543Z
5
+ * Built: 2026-02-17T12:21:56.018Z
6
6
  */
7
- var zt=n=>{if(typeof n!="string"||!n)return "";let t=n.trim();return t.startsWith("-/")?t=t.slice(2):t.startsWith("/")&&(t=t.slice(1)),t.endsWith("/")&&(t=t.slice(0,t.length-1)),t},Bt=(...n)=>n.filter(t=>typeof t=="string"&&!!t).map(t=>zt(t)).join("/-/"),lt=(...n)=>{let t=Bt(...n);return t?`-/${t}/`:""};function ct(n){let t=new URL(n),e=t.pathname+t.search+t.hash,s=e.lastIndexOf("http"),i=e.lastIndexOf("/"),r="";return s>=0?r=e.slice(s):i>=0&&(r=e.slice(i+1)),r}function Vt(n){let t=new URL(n),e=ct(n),s=ht(e)?pt(e).pathname:e;return t.pathname=t.pathname.replace(s,""),t.search="",t.hash="",t.toString()}function ht(n){return n.startsWith("http")}function pt(n){let t=new URL(n);return {pathname:`${t.origin}${t.pathname??""}`,search:t.search??"",hash:t.hash??""}}var S=(n,t,e)=>{let s=new URL(Vt(n)),i=e??ct(n),r=t??"";if(s.pathname.startsWith("//")&&(s.pathname=s.pathname.replace("//","/")),i&&ht(i)){let o=pt(i);s.pathname=`${s.pathname}${r}${o.pathname||""}`,s.search=o.search,s.hash=o.hash;}else s.pathname=`${s.pathname}${r}${i||""}`;return s.toString()},H=(n,t)=>{let e=new URL(n);return e.pathname=`${t}/`,e.toString()};var dt=(n,t=",")=>n.trim().split(t).map(e=>e.trim()).filter(e=>e.length>0);var Ht=n=>n;function ut(n,t={},e={}){let{openToken:s="{{",closeToken:i="}}",transform:r=Ht}=e;for(let o in t){let l=t[o],a=l?.toString(),h=typeof a=="string"?r(a):String(a);n=n.replaceAll(s+o+i,h);}return n}var mt=n=>[...new Set(n)];var b="--uc-img-",W="unresolved";var F=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),Q=3e3,q=5e3,G=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var j=globalThis,k=j.ShadowRoot&&(j.ShadyCSS===void 0||j.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,gt=Symbol(),ft=new WeakMap,L=class{constructor(t,e,s){if(this.St=true,s!==gt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o,e=this.t;if(k&&t===void 0){let s=e!==void 0&&e.length===1;s&&(t=ft.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&ft.set(e,t));}return t}toString(){return this.cssText}},yt=n=>new L(typeof n=="string"?n:n+"",void 0,gt);var bt=(n,t)=>{if(k)n.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let s=document.createElement("style"),i=j.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,n.appendChild(s);}},J=k?n=>n:n=>n instanceof CSSStyleSheet?(t=>{let e="";for(let s of t.cssRules)e+=s.cssText;return yt(e)})(n):n;var{is:Wt,defineProperty:Ft,getOwnPropertyDescriptor:Qt,getOwnPropertyNames:qt,getOwnPropertySymbols:Gt,getPrototypeOf:Jt}=Object,N=globalThis,vt=N.trustedTypes,Xt=vt?vt.emptyScript:"",Zt=N.reactiveElementPolyfillSupport,$=(n,t)=>n,X={toAttribute(n,t){switch(t){case Boolean:n=n?Xt:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n);}return n},fromAttribute(n,t){let e=n;switch(t){case Boolean:e=n!==null;break;case Number:e=n===null?null:Number(n);break;case Object:case Array:try{e=JSON.parse(n);}catch{e=null;}}return e}},wt=(n,t)=>!Wt(n,t),xt={attribute:true,type:String,converter:X,reflect:false,useDefault:false,hasChanged:wt};Symbol.metadata??=Symbol("metadata"),N.litPropertyMetadata??=new WeakMap;var m=class extends HTMLElement{static addInitializer(t){this.G(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this.S&&[...this.S.keys()]}static createProperty(t,e=xt){if(e.state&&(e.attribute=false),this.G(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=true),this.elementProperties.set(t,e),!e.noAccessor){let s=Symbol(),i=this.getPropertyDescriptor(t,s,e);i!==void 0&&Ft(this.prototype,t,i);}}static getPropertyDescriptor(t,e,s){let{get:i,set:r}=Qt(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o;}};return {get:i,set(o){let l=i?.call(this);r?.call(this,o),this.requestUpdate(t,l,s);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??xt}static G(){if(this.hasOwnProperty($("elementProperties")))return;let t=Jt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty($("finalized")))return;if(this.finalized=true,this.G(),this.hasOwnProperty($("properties"))){let e=this.properties,s=[...qt(e),...Gt(e)];for(let i of s)this.createProperty(i,e[i]);}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[s,i]of e)this.elementProperties.set(s,i);}this.S=new Map;for(let[e,s]of this.elementProperties){let i=this.J(e,s);i!==void 0&&this.S.set(i,e);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let s=new Set(t.flat(1/0).reverse());for(let i of s)e.unshift(J(i));}else t!==void 0&&e.push(J(t));return e}static J(t,e){let s=e.attribute;return s===false?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.f=null,this.Ct();}Ct(){this.X=new Promise(t=>this.enableUpdating=t),this.c=new Map,this.Tt(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this));}addController(t){(this.x??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.();}removeController(t){this.x?.delete(t);}Tt(){let t=new Map,e=this.constructor.elementProperties;for(let s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._=t);}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return bt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.x?.forEach(t=>t.hostConnected?.());}enableUpdating(t){}disconnectedCallback(){this.x?.forEach(t=>t.hostDisconnected?.());}attributeChangedCallback(t,e,s){this.Z(t,s);}Pt(t,e){let s=this.constructor.elementProperties.get(t),i=this.constructor.J(t,s);if(i!==void 0&&s.reflect===true){let r=(s.converter?.toAttribute!==void 0?s.converter:X).toAttribute(e,s.type);this.f=t,r==null?this.removeAttribute(i):this.setAttribute(i,r),this.f=null;}}Z(t,e){let s=this.constructor,i=s.S.get(t);if(i!==void 0&&this.f!==i){let r=s.getPropertyOptions(i),o=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:X;this.f=i;let l=o.fromAttribute(e,r.type);this[i]=l??this.Y?.get(i)??l,this.f=null;}}requestUpdate(t,e,s,i=false,r){if(t!==void 0){let o=this.constructor;if(i===false&&(r=this[t]),s??=o.getPropertyOptions(t),!((s.hasChanged??wt)(r,e)||s.useDefault&&s.reflect&&r===this.Y?.get(t)&&!this.hasAttribute(o.J(t,s))))return;this.C(t,e,s);}this.isUpdatePending===false&&(this.X=this.$t());}C(t,e,{useDefault:s,reflect:i,wrapped:r},o){s&&!(this.Y??=new Map).has(t)&&(this.Y.set(t,o??e??this[t]),r!==true||o!==void 0)||(this.c.has(t)||(this.hasUpdated||s||(e=void 0),this.c.set(t,e)),i===true&&this.f!==t&&(this.lt??=new Set).add(t));}async $t(){this.isUpdatePending=true;try{await this.X;}catch(e){Promise.reject(e);}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._){for(let[i,r]of this._)this[i]=r;this._=void 0;}let s=this.constructor.elementProperties;if(s.size>0)for(let[i,r]of s){let{wrapped:o}=r,l=this[i];o!==true||this.c.has(i)||l===void 0||this.C(i,void 0,r,l);}}let t=false,e=this.c;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this.x?.forEach(s=>s.hostUpdate?.()),this.update(e)):this.tt();}catch(s){throw t=false,this.tt(),s}t&&this.Ot(e);}willUpdate(t){}Ot(t){this.x?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}tt(){this.c=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.X}shouldUpdate(t){return true}update(t){this.lt&&=this.lt.forEach(e=>this.Pt(e,this[e])),this.tt();}updated(t){}firstUpdated(t){}};m.elementStyles=[],m.shadowRootOptions={mode:"open"},m[$("elementProperties")]=new Map,m[$("finalized")]=new Map,Zt?.({ReactiveElement:m}),(N.reactiveElementVersions??=[]).push("2.1.2");var nt=globalThis,Et=n=>n,_=nt.trustedTypes,St=_?_.createPolicy("lit-html",{createHTML:n=>n}):void 0,At="$lit$",g=`lit$${Math.random().toFixed(9).slice(2)}$`,Ut="?"+g,Yt=`<${Ut}>`,w=document,A=()=>w.createComment(""),U=n=>n===null||typeof n!="object"&&typeof n!="function",rt=Array.isArray,te=n=>rt(n)||typeof n?.[Symbol.iterator]=="function",Z=`[ \f\r]`,O=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ct=/-->/g,Tt=/>/g,v=RegExp(`>|${Z}(?:([^\\s"'>=/]+)(${Z}*=${Z}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),Pt=/'/g,$t=/"/g,Rt=/^(?:script|style|textarea|title)$/i,E=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Ot=new WeakMap,x=w.createTreeWalker(w,129);function Mt(n,t){if(!rt(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return St!==void 0?St.createHTML(t):t}var ee=(n,t)=>{let e=n.length-1,s=[],i,r=t===2?"<svg>":t===3?"<math>":"",o=O;for(let l=0;l<e;l++){let a=n[l],h,p,c=-1,u=0;for(;u<a.length&&(o.lastIndex=u,p=o.exec(a),p!==null);)u=o.lastIndex,o===O?p[1]==="!--"?o=Ct:p[1]!==void 0?o=Tt:p[2]!==void 0?(Rt.test(p[2])&&(i=RegExp("</"+p[2],"g")),o=v):p[3]!==void 0&&(o=v):o===v?p[0]===">"?(o=i??O,c=-1):p[1]===void 0?c=-2:(c=o.lastIndex-p[2].length,h=p[1],o=p[3]===void 0?v:p[3]==='"'?$t:Pt):o===$t||o===Pt?o=v:o===Ct||o===Tt?o=O:(o=v,i=void 0);let f=o===v&&n[l+1].startsWith("/>")?" ":"";r+=o===O?a+Yt:c>=0?(s.push(h),a.slice(0,c)+At+a.slice(c)+g+f):a+g+(c===-2?l:f);}return [Mt(n,r+(n[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]},R=class n{constructor({strings:t,et:e},s){let i;this.parts=[];let r=0,o=0,l=t.length-1,a=this.parts,[h,p]=ee(t,e);if(this.el=n.createElement(h,s),x.currentNode=this.el.content,e===2||e===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes);}for(;(i=x.nextNode())!==null&&a.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(let c of i.getAttributeNames())if(c.endsWith(At)){let u=p[o++],f=i.getAttribute(c).split(g),I=/([.?@])?(.*)/.exec(u);a.push({type:1,index:r,name:I[2],strings:f,ctor:I[1]==="."?tt:I[1]==="?"?et:I[1]==="@"?st:T}),i.removeAttribute(c);}else c.startsWith(g)&&(a.push({type:6,index:r}),i.removeAttribute(c));if(Rt.test(i.tagName)){let c=i.textContent.split(g),u=c.length-1;if(u>0){i.textContent=_?_.emptyScript:"";for(let f=0;f<u;f++)i.append(c[f],A()),x.nextNode(),a.push({type:2,index:++r});i.append(c[u],A());}}}else if(i.nodeType===8)if(i.data===Ut)a.push({type:2,index:r});else {let c=-1;for(;(c=i.data.indexOf(g,c+1))!==-1;)a.push({type:7,index:r}),c+=g.length-1;}r++;}}static createElement(t,e){let s=w.createElement("template");return s.innerHTML=t,s}};function C(n,t,e=n,s){if(t===E)return t;let i=s!==void 0?e.At?.[s]:e.Ut,r=U(t)?void 0:t.Kt;return i?.constructor!==r&&(i?.zt?.(false),r===void 0?i=void 0:(i=new r(n),i.Bt(n,e,s)),s!==void 0?(e.At??=[])[s]=i:e.Ut=i),i!==void 0&&(t=C(n,i.Vt(n,t.values),i,s)),t}var Y=class{constructor(t,e){this.ct=[],this.st=void 0,this.ht=t,this.i=e;}get parentNode(){return this.i.parentNode}get d(){return this.i.d}u(t){let{el:{content:e},parts:s}=this.ht,i=(t?.creationScope??w).importNode(e,true);x.currentNode=i;let r=x.nextNode(),o=0,l=0,a=s[0];for(;a!==void 0;){if(o===a.index){let h;a.type===2?h=new M(r,r.nextSibling,this,t):a.type===1?h=new a.ctor(r,a.name,a.strings,this,t):a.type===6&&(h=new it(r,this,t)),this.ct.push(h),a=s[++l];}o!==a?.index&&(r=x.nextNode(),o++);}return x.currentNode=w,i}p(t){let e=0;for(let s of this.ct)s!==void 0&&(s.strings!==void 0?(s.m(t,s,e),e+=s.strings.length-2):s.m(t[e])),e++;}},M=class n{get d(){return this.i?.d??this.pt}constructor(t,e,s,i){this.type=2,this.e=d,this.st=void 0,this.w=t,this.K=e,this.i=s,this.options=i,this.pt=i?.isConnected??true;}get parentNode(){let t=this.w.parentNode,e=this.i;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this.w}get endNode(){return this.K}m(t,e=this){t=C(this,t,e),U(t)?t===d||t==null||t===""?(this.e!==d&&this.z(),this.e=d):t!==this.e&&t!==E&&this.dt(t):t.et!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):te(t)?this.k(t):this.dt(t);}O(t){return this.w.parentNode.insertBefore(t,this.K)}T(t){this.e!==t&&(this.z(),this.e=this.O(t));}dt(t){this.e!==d&&U(this.e)?this.w.nextSibling.data=t:this.T(w.createTextNode(t)),this.e=t;}$(t){let{values:e,et:s}=t,i=typeof s=="number"?this.Rt(t):(s.el===void 0&&(s.el=R.createElement(Mt(s.h,s.h[0]),this.options)),s);if(this.e?.ht===i)this.e.p(e);else {let r=new Y(i,this),o=r.u(this.options);r.p(e),this.T(o),this.e=r;}}Rt(t){let e=Ot.get(t.strings);return e===void 0&&Ot.set(t.strings,e=new R(t)),e}k(t){rt(this.e)||(this.e=[],this.z());let e=this.e,s,i=0;for(let r of t)i===e.length?e.push(s=new n(this.O(A()),this.O(A()),this,this.options)):s=e[i],s.m(r),i++;i<e.length&&(this.z(s&&s.K.nextSibling,i),e.length=i);}z(t=this.w.nextSibling,e){for(this.Mt?.(false,true,e);t!==this.K;){let s=Et(t).nextSibling;Et(t).remove(),t=s;}}setConnected(t){this.i===void 0&&(this.pt=t,this.Mt?.(t));}},T=class{get tagName(){return this.element.tagName}get d(){return this.i.d}constructor(t,e,s,i,r){this.type=1,this.e=d,this.st=void 0,this.element=t,this.name=e,this.i=i,this.options=r,s.length>2||s[0]!==""||s[1]!==""?(this.e=Array(s.length-1).fill(new String),this.strings=s):this.e=d;}m(t,e=this,s,i){let r=this.strings,o=false;if(r===void 0)t=C(this,t,e,0),o=!U(t)||t!==this.e&&t!==E,o&&(this.e=t);else {let l=t,a,h;for(t=r[0],a=0;a<r.length-1;a++)h=C(this,l[s+a],e,a),h===E&&(h=this.e[a]),o||=!U(h)||h!==this.e[a],h===d?t=d:t!==d&&(t+=(h??"")+r[a+1]),this.e[a]=h;}o&&!i&&this.j(t);}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}},tt=class extends T{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===d?void 0:t;}},et=class extends T{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d);}},st=class extends T{constructor(t,e,s,i,r){super(t,e,s,i,r),this.type=5;}m(t,e=this){if((t=C(this,t,e,0)??d)===E)return;let s=this.e,i=t===d&&s!==d||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==d&&(s===d||i);i&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,t),this.e=t;}handleEvent(t){typeof this.e=="function"?this.e.call(this.options?.host??this.element,t):this.e.handleEvent(t);}},it=class{constructor(t,e,s){this.element=t,this.type=6,this.st=void 0,this.i=e,this.options=s;}get d(){return this.i.d}m(t){C(this,t);}};var se=nt.litHtmlPolyfillSupport;se?.(R,M),(nt.litHtmlVersions??=[]).push("3.3.2");var It=(n,t,e)=>{let s=e?.renderBefore??t,i=s.It;if(i===void 0){let r=e?.renderBefore??null;s.It=i=new M(t.insertBefore(A(),r),r,void 0,e??{});}return i.m(n),i};var at=globalThis,y=class extends m{constructor(){super(...arguments),this.renderOptions={host:this},this.it=void 0;}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this.it=It(e,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.it?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.it?.setConnected(false);}render(){return E}};y.Ht=true,y.finalized=true,at.litElementHydrateSupport?.({LitElement:y});var ie=at.litElementPolyfillSupport;ie?.({LitElement:y});(at.litElementVersions??=[]).push("4.2.2");var jt="1.27.0-alpha.0";var Lt="blocks",kt=jt;var re=/\\([0-9a-fA-F]{1,6} ?)/g;function oe(n){return n.length<2?false:(n[0]==='"'||n[0]==="'")&&(n[n.length-1]==='"'||n[n.length-1]==="'")}function ae(n){let t=n;return (t[0]==='"'||t[0]==="'")&&(t=t.slice(1)),(t[t.length-1]==='"'||t[t.length-1]==="'")&&(t=t.slice(0,-1)),t}function le(n){let t="",e="";for(let s=0;s<n.length;s++){let i=n[s+1];n[s]==="\\"&&i==='"'?(t+='\\"',s++):n[s]==='"'&&e!=="\\"?t+='\\"':t+=n[s],e=n[s]??"";}return t}function Nt(n){let t=n;oe(n)&&(t=ae(t),t=t.replace(re,(e,s)=>String.fromCodePoint(parseInt(s.trim(),16))),t=t.replaceAll(`\\ `,"\\n"),t=le(t),t='"'+t+'"');try{return JSON.parse(t)}catch{return}}function _t(n){class t extends n{constructor(){super(...arguments);this.ut=null;this.nt=null;}getCssData(i,r=false){let o=this.ut??Object.create(null);if(!Object.keys(o).includes(i)||!o[i]){this.nt||(this.nt=window.getComputedStyle(this));let l=this.nt.getPropertyValue(i).trim();try{o[i]=Nt(l);}catch(a){r||console.warn(`CSS Data error: ${i}`,a),o[i]=null;}}return this.ut=o,o[i]}}return t}function Dt(n){class t extends n{static reg(s){let i=this,r=window.customElements.get(s);if(r){r!==i&&console.warn([`Element with tag name "${s}" 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(s,i);}}return t}var ce="https://ucarecdn.com",P=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:ce},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});var D=class extends _t(Dt(y)){constructor(){super();this.g={};this.y=new Map;this.b=null;this.W=null;for(let e in P){let s=P[e];this.g[b+e]=s?.default||"";}}createRenderRoot(){return this}$$(e){return this.g[b+e]}set$$(e){for(let s in e){let i=b+s,r=e[s];this.g[i]=r,this.mt(i,r);}}sub$$(e,s){let i=b+e;this.y.has(i)||this.y.set(i,new Set),this.y.get(i)?.add(s);let r=this.g[i];r!==null&&r!==""&&s(r);}mt(e,s){this.y.has(e)&&this.y.get(e)?.forEach(i=>{s===null||s===""||i(s);});}analyticsParams(){return `-/@clib/${Lt}/${kt}/uc-img/`}initAttributes(e){Array.from(this.attributes).forEach(s=>{let i=s;P[i.name]||e.setAttribute(i.name,i.value);});}initIntersection(e,s){let i={root:null,rootMargin:"0px"};this.b=new IntersectionObserver(r=>{r.forEach(o=>{o.isIntersecting&&(s(),this.b?.unobserve(e));});},i),this.b.observe(e),this.W||(this.W=new Set),this.W.add(e);}connectedCallback(){super.connectedCallback(),this.jt();}jt(){for(let e in P){let s=b+e,i=this.getCssData(s,true);i!=null&&(this.g[s]=i);}}disconnectedCallback(){super.disconnectedCallback(),this.b&&(this.W?.forEach(e=>{this.b?.unobserve(e);}),this.b=null),this.y.clear();}static get observedAttributes(){return Object.keys(P)}attributeChangedCallback(e,s,i){window.setTimeout(()=>{let r=b+e;this.g[r]=i,this.mt(r,i);});}};var Kt=n=>Object.entries(n).filter(([t,e])=>e!==void 0&&e!=="").map(([t,e])=>t==="cdn-operations"||t==="analytics"?e:`${t}/${e}`);var B=class extends D{constructor(){super(...arguments);this.r=new Image;this.n=new Image;}ft(e){return !e.includes("//")&&!F&&(e=new URL(e,document.baseURI).href),e}Q(e){if(!e)return;let s=e,i=s.match(/\d+/)?.[0],r=s.match(/[a-zA-Z]+/)?.[0];if(!i||!r)return;let o=parseInt(i,10);return Number(o)>q&&this.gt?q+r:Number(o)>Q&&!this.gt?Q+r:e}Lt(e,s){let i={format:this.rt("format"),quality:this.rt("quality"),resize:this.Q(e),blur:s,"cdn-operations":this.rt("cdn-operations")??void 0,analytics:this.analyticsParams()};return lt(...Kt(i))}rt(e){let s=this.$$(e);if(s==null||typeof s=="string"||typeof s=="number"||typeof s=="boolean")return s}s(e="",s=""){let i=this.$$("src");if(i.startsWith("data:")||i.startsWith("blob:"))return i;if(F&&i&&!i.includes("//"))return this.E(i);let r=this.Lt(e,s),o=this.$$("cdn-cname"),l=o;if(i.startsWith(String(o)))return S(i,r);let a=this.$$("uuid");if(l&&a)return this.E(S(H(l,a),r));if(a)return this.E(S(H(l,a),r));let h=this.$$("proxy-cname");if(h)return this.E(S(h,r,this.ft(i)));let p=this.$$("pubkey");if(p)return this.E(S(`https://${p}.ucr.io/`,r,this.ft(i)))}E(e){let s=this.$$("secure-delivery-proxy");return s?ut(s,{previewUrl:e},{transform:i=>window.encodeURIComponent(i)}):e}v(e,s=1,i=true){let r=e.getBoundingClientRect(),o=s*Math.round(r.width),l=i?"":s*Math.round(r.height);return o||l?`${o||""}x${l||""}`:null}kt(e){let s=r=>{r.stopPropagation();let o=new Event(r.type,r);this.dispatchEvent(o);},i=["load","error"];for(let r of i)e.addEventListener(r,s);}get img(){return this.a||(this.ot({elNode:this.r}),this.appendChild(this.r)),this.r}get q(){return this.a?{type:G.PREVIEW,img:this.n}:{type:G.MAIN,img:this.img}}get a(){return this.$$("is-preview-blur")}get yt(){return this.$$("is-background-for")}get bt(){let e=this.$$("breakpoints");if(e){let s=dt(e);return mt(s.map(i=>parseInt(i,10)))}else return null}get gt(){return this.$$("format").toLowerCase()==="jpeg"}vt(e){let s=new Set;s.add(`url("${this.s(this.v(e))}") 1x`),this.$$("hi-res-support")&&s.add(`url("${this.s(this.v(e,2))}") ${2}x`),this.$$("ultra-res-support")&&s.add(`url("${this.s(this.v(e,3))}") ${3}x`);let i=`image-set(${[...s].join(", ")})`;e.style.setProperty("background-image",i),e.style.setProperty("background-image",`-webkit-${i}`);}xt(){let e=new Set;return this.bt?this.bt.forEach(s=>{e.add(`${this.s(`${s}x`)} ${this.Q(`${s}w`)}`),this.$$("hi-res-support")&&e.add(`${this.s(`${s*2}x`)} ${this.Q(`${s*2}w`)}`),this.$$("ultra-res-support")&&e.add(`${this.s(`${s*3}x`)} ${this.Q(`${s*3}w`)}`);}):(e.add(`${this.s(this.v(this.q.img))} 1x`),this.$$("hi-res-support")&&e.add(`${this.s(this.v(this.q.img,2))} 2x`),this.$$("ultra-res-support")&&e.add(`${this.s(this.v(this.q.img,3))} 3x`)),[...e].join()}wt(){return this.s()}get Et(){return this.s("100x","100")}Nt(){let e=this.yt;[...document.querySelectorAll(e)].forEach(s=>{this.$$("intersection")?this.initIntersection(s,()=>{this.vt(s);}):this.vt(s);});}_t({elNode:e,src:s,srcset:i}){s&&(e.src=s),i&&(e.srcset=i);}ot({elNode:e}){this.kt(e),this.initAttributes(e);}at({src:e,srcset:s,elNode:i}){return new Promise((r,o)=>{this.ot({elNode:i}),i.setAttribute(W,""),i.addEventListener("load",()=>{i.removeAttribute(W),r(i);}),i.addEventListener("error",()=>{o(false);}),this._t({elNode:i,src:e,srcset:s});})}async Dt(){if(this.$$("intersection")){this.a&&(this.ot({elNode:this.n}),this.appendChild(this.n)),this.initIntersection(this.q.img,async()=>{this.a&&(this.n.src=this.Et);try{await this.at({src:this.wt(),srcset:this.xt(),elNode:this.r}),this.a&&await this.n.remove(),this.appendChild(this.r);}catch{this.a&&await this.n?.remove(),this.appendChild(this.r);}});return}try{this.a&&(await this.at({src:this.Et,elNode:this.n}),this.appendChild(this.n)),await this.at({src:this.wt(),srcset:this.xt(),elNode:this.r}),this.a&&await this.n?.remove(),this.appendChild(this.r);}catch{this.a&&await this.n?.remove(),this.appendChild(this.r);}}init(){this.yt?this.Nt():this.Dt();}};var V=class extends B{connectedCallback(){super.connectedCallback(),this.sub$$("src",()=>{this.init();}),this.sub$$("uuid",()=>{this.init();}),this.sub$$("lazy",t=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=t?"lazy":"eager");});}};V.reg("uc-img");/*! For license information please see uc-img.min.js.LEGAL.txt */
7
+ var zt=n=>{if(typeof n!="string"||!n)return "";let t=n.trim();return t.startsWith("-/")?t=t.slice(2):t.startsWith("/")&&(t=t.slice(1)),t.endsWith("/")&&(t=t.slice(0,t.length-1)),t},Bt=(...n)=>n.filter(t=>typeof t=="string"&&!!t).map(t=>zt(t)).join("/-/"),lt=(...n)=>{let t=Bt(...n);return t?`-/${t}/`:""};function ct(n){let t=new URL(n),e=t.pathname+t.search+t.hash,s=e.lastIndexOf("http"),i=e.lastIndexOf("/"),r="";return s>=0?r=e.slice(s):i>=0&&(r=e.slice(i+1)),r}function Vt(n){let t=new URL(n),e=ct(n),s=ht(e)?pt(e).pathname:e;return t.pathname=t.pathname.replace(s,""),t.search="",t.hash="",t.toString()}function ht(n){return n.startsWith("http")}function pt(n){let t=new URL(n);return {pathname:`${t.origin}${t.pathname??""}`,search:t.search??"",hash:t.hash??""}}var S=(n,t,e)=>{let s=new URL(Vt(n)),i=e??ct(n),r=t??"";if(s.pathname.startsWith("//")&&(s.pathname=s.pathname.replace("//","/")),i&&ht(i)){let o=pt(i);s.pathname=`${s.pathname}${r}${o.pathname||""}`,s.search=o.search,s.hash=o.hash;}else s.pathname=`${s.pathname}${r}${i||""}`;return s.toString()},H=(n,t)=>{let e=new URL(n);return e.pathname=`${t}/`,e.toString()};var dt=(n,t=",")=>n.trim().split(t).map(e=>e.trim()).filter(e=>e.length>0);var Ht=n=>n;function ut(n,t={},e={}){let{openToken:s="{{",closeToken:i="}}",transform:r=Ht}=e;for(let o in t){let l=t[o],a=l?.toString(),h=typeof a=="string"?r(a):String(a);n=n.replaceAll(s+o+i,h);}return n}var mt=n=>[...new Set(n)];var b="--uc-img-",W="unresolved";var F=!window.location.host.trim()||window.location.host.includes(":")||window.location.hostname.includes("localhost"),Q=3e3,q=5e3,G=Object.freeze({PREVIEW:"PREVIEW",MAIN:"MAIN"});var j=globalThis,k=j.ShadowRoot&&(j.ShadyCSS===void 0||j.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,gt=Symbol(),ft=new WeakMap,L=class{constructor(t,e,s){if(this.St=true,s!==gt)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e;}get styleSheet(){let t=this.o,e=this.t;if(k&&t===void 0){let s=e!==void 0&&e.length===1;s&&(t=ft.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),s&&ft.set(e,t));}return t}toString(){return this.cssText}},yt=n=>new L(typeof n=="string"?n:n+"",void 0,gt);var bt=(n,t)=>{if(k)n.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let s=document.createElement("style"),i=j.litNonce;i!==void 0&&s.setAttribute("nonce",i),s.textContent=e.cssText,n.appendChild(s);}},J=k?n=>n:n=>n instanceof CSSStyleSheet?(t=>{let e="";for(let s of t.cssRules)e+=s.cssText;return yt(e)})(n):n;var{is:Wt,defineProperty:Ft,getOwnPropertyDescriptor:Qt,getOwnPropertyNames:qt,getOwnPropertySymbols:Gt,getPrototypeOf:Jt}=Object,N=globalThis,vt=N.trustedTypes,Xt=vt?vt.emptyScript:"",Zt=N.reactiveElementPolyfillSupport,$=(n,t)=>n,X={toAttribute(n,t){switch(t){case Boolean:n=n?Xt:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n);}return n},fromAttribute(n,t){let e=n;switch(t){case Boolean:e=n!==null;break;case Number:e=n===null?null:Number(n);break;case Object:case Array:try{e=JSON.parse(n);}catch{e=null;}}return e}},wt=(n,t)=>!Wt(n,t),xt={attribute:true,type:String,converter:X,reflect:false,useDefault:false,hasChanged:wt};Symbol.metadata??=Symbol("metadata"),N.litPropertyMetadata??=new WeakMap;var m=class extends HTMLElement{static addInitializer(t){this.G(),(this.l??=[]).push(t);}static get observedAttributes(){return this.finalize(),this.S&&[...this.S.keys()]}static createProperty(t,e=xt){if(e.state&&(e.attribute=false),this.G(),this.prototype.hasOwnProperty(t)&&((e=Object.create(e)).wrapped=true),this.elementProperties.set(t,e),!e.noAccessor){let s=Symbol(),i=this.getPropertyDescriptor(t,s,e);i!==void 0&&Ft(this.prototype,t,i);}}static getPropertyDescriptor(t,e,s){let{get:i,set:r}=Qt(this.prototype,t)??{get(){return this[e]},set(o){this[e]=o;}};return {get:i,set(o){let l=i?.call(this);r?.call(this,o),this.requestUpdate(t,l,s);},configurable:true,enumerable:true}}static getPropertyOptions(t){return this.elementProperties.get(t)??xt}static G(){if(this.hasOwnProperty($("elementProperties")))return;let t=Jt(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties);}static finalize(){if(this.hasOwnProperty($("finalized")))return;if(this.finalized=true,this.G(),this.hasOwnProperty($("properties"))){let e=this.properties,s=[...qt(e),...Gt(e)];for(let i of s)this.createProperty(i,e[i]);}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[s,i]of e)this.elementProperties.set(s,i);}this.S=new Map;for(let[e,s]of this.elementProperties){let i=this.J(e,s);i!==void 0&&this.S.set(i,e);}this.elementStyles=this.finalizeStyles(this.styles);}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let s=new Set(t.flat(1/0).reverse());for(let i of s)e.unshift(J(i));}else t!==void 0&&e.push(J(t));return e}static J(t,e){let s=e.attribute;return s===false?void 0:typeof s=="string"?s:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._=void 0,this.isUpdatePending=false,this.hasUpdated=false,this.f=null,this.Ct();}Ct(){this.X=new Promise(t=>this.enableUpdating=t),this.c=new Map,this.Tt(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this));}addController(t){(this.x??=new Set).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.();}removeController(t){this.x?.delete(t);}Tt(){let t=new Map,e=this.constructor.elementProperties;for(let s of e.keys())this.hasOwnProperty(s)&&(t.set(s,this[s]),delete this[s]);t.size>0&&(this._=t);}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return bt(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(true),this.x?.forEach(t=>t.hostConnected?.());}enableUpdating(t){}disconnectedCallback(){this.x?.forEach(t=>t.hostDisconnected?.());}attributeChangedCallback(t,e,s){this.Z(t,s);}Pt(t,e){let s=this.constructor.elementProperties.get(t),i=this.constructor.J(t,s);if(i!==void 0&&s.reflect===true){let r=(s.converter?.toAttribute!==void 0?s.converter:X).toAttribute(e,s.type);this.f=t,r==null?this.removeAttribute(i):this.setAttribute(i,r),this.f=null;}}Z(t,e){let s=this.constructor,i=s.S.get(t);if(i!==void 0&&this.f!==i){let r=s.getPropertyOptions(i),o=typeof r.converter=="function"?{fromAttribute:r.converter}:r.converter?.fromAttribute!==void 0?r.converter:X;this.f=i;let l=o.fromAttribute(e,r.type);this[i]=l??this.Y?.get(i)??l,this.f=null;}}requestUpdate(t,e,s,i=false,r){if(t!==void 0){let o=this.constructor;if(i===false&&(r=this[t]),s??=o.getPropertyOptions(t),!((s.hasChanged??wt)(r,e)||s.useDefault&&s.reflect&&r===this.Y?.get(t)&&!this.hasAttribute(o.J(t,s))))return;this.C(t,e,s);}this.isUpdatePending===false&&(this.X=this.$t());}C(t,e,{useDefault:s,reflect:i,wrapped:r},o){s&&!(this.Y??=new Map).has(t)&&(this.Y.set(t,o??e??this[t]),r!==true||o!==void 0)||(this.c.has(t)||(this.hasUpdated||s||(e=void 0),this.c.set(t,e)),i===true&&this.f!==t&&(this.lt??=new Set).add(t));}async $t(){this.isUpdatePending=true;try{await this.X;}catch(e){Promise.reject(e);}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._){for(let[i,r]of this._)this[i]=r;this._=void 0;}let s=this.constructor.elementProperties;if(s.size>0)for(let[i,r]of s){let{wrapped:o}=r,l=this[i];o!==true||this.c.has(i)||l===void 0||this.C(i,void 0,r,l);}}let t=false,e=this.c;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this.x?.forEach(s=>s.hostUpdate?.()),this.update(e)):this.tt();}catch(s){throw t=false,this.tt(),s}t&&this.Ot(e);}willUpdate(t){}Ot(t){this.x?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=true,this.firstUpdated(t)),this.updated(t);}tt(){this.c=new Map,this.isUpdatePending=false;}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this.X}shouldUpdate(t){return true}update(t){this.lt&&=this.lt.forEach(e=>this.Pt(e,this[e])),this.tt();}updated(t){}firstUpdated(t){}};m.elementStyles=[],m.shadowRootOptions={mode:"open"},m[$("elementProperties")]=new Map,m[$("finalized")]=new Map,Zt?.({ReactiveElement:m}),(N.reactiveElementVersions??=[]).push("2.1.2");var nt=globalThis,Et=n=>n,_=nt.trustedTypes,St=_?_.createPolicy("lit-html",{createHTML:n=>n}):void 0,At="$lit$",g=`lit$${Math.random().toFixed(9).slice(2)}$`,Ut="?"+g,Yt=`<${Ut}>`,w=document,A=()=>w.createComment(""),U=n=>n===null||typeof n!="object"&&typeof n!="function",rt=Array.isArray,te=n=>rt(n)||typeof n?.[Symbol.iterator]=="function",Z=`[ \f\r]`,O=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ct=/-->/g,Tt=/>/g,v=RegExp(`>|${Z}(?:([^\\s"'>=/]+)(${Z}*=${Z}*(?:[^ \f\r"'\`<>=]|("|')|))|$)`,"g"),Pt=/'/g,$t=/"/g,Rt=/^(?:script|style|textarea|title)$/i,E=Symbol.for("lit-noChange"),d=Symbol.for("lit-nothing"),Ot=new WeakMap,x=w.createTreeWalker(w,129);function Mt(n,t){if(!rt(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return St!==void 0?St.createHTML(t):t}var ee=(n,t)=>{let e=n.length-1,s=[],i,r=t===2?"<svg>":t===3?"<math>":"",o=O;for(let l=0;l<e;l++){let a=n[l],h,p,c=-1,u=0;for(;u<a.length&&(o.lastIndex=u,p=o.exec(a),p!==null);)u=o.lastIndex,o===O?p[1]==="!--"?o=Ct:p[1]!==void 0?o=Tt:p[2]!==void 0?(Rt.test(p[2])&&(i=RegExp("</"+p[2],"g")),o=v):p[3]!==void 0&&(o=v):o===v?p[0]===">"?(o=i??O,c=-1):p[1]===void 0?c=-2:(c=o.lastIndex-p[2].length,h=p[1],o=p[3]===void 0?v:p[3]==='"'?$t:Pt):o===$t||o===Pt?o=v:o===Ct||o===Tt?o=O:(o=v,i=void 0);let f=o===v&&n[l+1].startsWith("/>")?" ":"";r+=o===O?a+Yt:c>=0?(s.push(h),a.slice(0,c)+At+a.slice(c)+g+f):a+g+(c===-2?l:f);}return [Mt(n,r+(n[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),s]},R=class n{constructor({strings:t,et:e},s){let i;this.parts=[];let r=0,o=0,l=t.length-1,a=this.parts,[h,p]=ee(t,e);if(this.el=n.createElement(h,s),x.currentNode=this.el.content,e===2||e===3){let c=this.el.content.firstChild;c.replaceWith(...c.childNodes);}for(;(i=x.nextNode())!==null&&a.length<l;){if(i.nodeType===1){if(i.hasAttributes())for(let c of i.getAttributeNames())if(c.endsWith(At)){let u=p[o++],f=i.getAttribute(c).split(g),I=/([.?@])?(.*)/.exec(u);a.push({type:1,index:r,name:I[2],strings:f,ctor:I[1]==="."?tt:I[1]==="?"?et:I[1]==="@"?st:T}),i.removeAttribute(c);}else c.startsWith(g)&&(a.push({type:6,index:r}),i.removeAttribute(c));if(Rt.test(i.tagName)){let c=i.textContent.split(g),u=c.length-1;if(u>0){i.textContent=_?_.emptyScript:"";for(let f=0;f<u;f++)i.append(c[f],A()),x.nextNode(),a.push({type:2,index:++r});i.append(c[u],A());}}}else if(i.nodeType===8)if(i.data===Ut)a.push({type:2,index:r});else {let c=-1;for(;(c=i.data.indexOf(g,c+1))!==-1;)a.push({type:7,index:r}),c+=g.length-1;}r++;}}static createElement(t,e){let s=w.createElement("template");return s.innerHTML=t,s}};function C(n,t,e=n,s){if(t===E)return t;let i=s!==void 0?e.At?.[s]:e.Ut,r=U(t)?void 0:t.Kt;return i?.constructor!==r&&(i?.zt?.(false),r===void 0?i=void 0:(i=new r(n),i.Bt(n,e,s)),s!==void 0?(e.At??=[])[s]=i:e.Ut=i),i!==void 0&&(t=C(n,i.Vt(n,t.values),i,s)),t}var Y=class{constructor(t,e){this.ct=[],this.st=void 0,this.ht=t,this.i=e;}get parentNode(){return this.i.parentNode}get d(){return this.i.d}u(t){let{el:{content:e},parts:s}=this.ht,i=(t?.creationScope??w).importNode(e,true);x.currentNode=i;let r=x.nextNode(),o=0,l=0,a=s[0];for(;a!==void 0;){if(o===a.index){let h;a.type===2?h=new M(r,r.nextSibling,this,t):a.type===1?h=new a.ctor(r,a.name,a.strings,this,t):a.type===6&&(h=new it(r,this,t)),this.ct.push(h),a=s[++l];}o!==a?.index&&(r=x.nextNode(),o++);}return x.currentNode=w,i}p(t){let e=0;for(let s of this.ct)s!==void 0&&(s.strings!==void 0?(s.m(t,s,e),e+=s.strings.length-2):s.m(t[e])),e++;}},M=class n{get d(){return this.i?.d??this.pt}constructor(t,e,s,i){this.type=2,this.e=d,this.st=void 0,this.w=t,this.K=e,this.i=s,this.options=i,this.pt=i?.isConnected??true;}get parentNode(){let t=this.w.parentNode,e=this.i;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this.w}get endNode(){return this.K}m(t,e=this){t=C(this,t,e),U(t)?t===d||t==null||t===""?(this.e!==d&&this.z(),this.e=d):t!==this.e&&t!==E&&this.dt(t):t.et!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):te(t)?this.k(t):this.dt(t);}O(t){return this.w.parentNode.insertBefore(t,this.K)}T(t){this.e!==t&&(this.z(),this.e=this.O(t));}dt(t){this.e!==d&&U(this.e)?this.w.nextSibling.data=t:this.T(w.createTextNode(t)),this.e=t;}$(t){let{values:e,et:s}=t,i=typeof s=="number"?this.Rt(t):(s.el===void 0&&(s.el=R.createElement(Mt(s.h,s.h[0]),this.options)),s);if(this.e?.ht===i)this.e.p(e);else {let r=new Y(i,this),o=r.u(this.options);r.p(e),this.T(o),this.e=r;}}Rt(t){let e=Ot.get(t.strings);return e===void 0&&Ot.set(t.strings,e=new R(t)),e}k(t){rt(this.e)||(this.e=[],this.z());let e=this.e,s,i=0;for(let r of t)i===e.length?e.push(s=new n(this.O(A()),this.O(A()),this,this.options)):s=e[i],s.m(r),i++;i<e.length&&(this.z(s&&s.K.nextSibling,i),e.length=i);}z(t=this.w.nextSibling,e){for(this.Mt?.(false,true,e);t!==this.K;){let s=Et(t).nextSibling;Et(t).remove(),t=s;}}setConnected(t){this.i===void 0&&(this.pt=t,this.Mt?.(t));}},T=class{get tagName(){return this.element.tagName}get d(){return this.i.d}constructor(t,e,s,i,r){this.type=1,this.e=d,this.st=void 0,this.element=t,this.name=e,this.i=i,this.options=r,s.length>2||s[0]!==""||s[1]!==""?(this.e=Array(s.length-1).fill(new String),this.strings=s):this.e=d;}m(t,e=this,s,i){let r=this.strings,o=false;if(r===void 0)t=C(this,t,e,0),o=!U(t)||t!==this.e&&t!==E,o&&(this.e=t);else {let l=t,a,h;for(t=r[0],a=0;a<r.length-1;a++)h=C(this,l[s+a],e,a),h===E&&(h=this.e[a]),o||=!U(h)||h!==this.e[a],h===d?t=d:t!==d&&(t+=(h??"")+r[a+1]),this.e[a]=h;}o&&!i&&this.j(t);}j(t){t===d?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"");}},tt=class extends T{constructor(){super(...arguments),this.type=3;}j(t){this.element[this.name]=t===d?void 0:t;}},et=class extends T{constructor(){super(...arguments),this.type=4;}j(t){this.element.toggleAttribute(this.name,!!t&&t!==d);}},st=class extends T{constructor(t,e,s,i,r){super(t,e,s,i,r),this.type=5;}m(t,e=this){if((t=C(this,t,e,0)??d)===E)return;let s=this.e,i=t===d&&s!==d||t.capture!==s.capture||t.once!==s.once||t.passive!==s.passive,r=t!==d&&(s===d||i);i&&this.element.removeEventListener(this.name,this,s),r&&this.element.addEventListener(this.name,this,t),this.e=t;}handleEvent(t){typeof this.e=="function"?this.e.call(this.options?.host??this.element,t):this.e.handleEvent(t);}},it=class{constructor(t,e,s){this.element=t,this.type=6,this.st=void 0,this.i=e,this.options=s;}get d(){return this.i.d}m(t){C(this,t);}};var se=nt.litHtmlPolyfillSupport;se?.(R,M),(nt.litHtmlVersions??=[]).push("3.3.2");var It=(n,t,e)=>{let s=e?.renderBefore??t,i=s.It;if(i===void 0){let r=e?.renderBefore??null;s.It=i=new M(t.insertBefore(A(),r),r,void 0,e??{});}return i.m(n),i};var at=globalThis,y=class extends m{constructor(){super(...arguments),this.renderOptions={host:this},this.it=void 0;}createRenderRoot(){let t=super.createRenderRoot();return this.renderOptions.renderBefore??=t.firstChild,t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this.it=It(e,this.renderRoot,this.renderOptions);}connectedCallback(){super.connectedCallback(),this.it?.setConnected(true);}disconnectedCallback(){super.disconnectedCallback(),this.it?.setConnected(false);}render(){return E}};y.Ht=true,y.finalized=true,at.litElementHydrateSupport?.({LitElement:y});var ie=at.litElementPolyfillSupport;ie?.({LitElement:y});(at.litElementVersions??=[]).push("4.2.2");var jt="1.27.0-alpha.1";var Lt="blocks",kt=jt;var re=/\\([0-9a-fA-F]{1,6} ?)/g;function oe(n){return n.length<2?false:(n[0]==='"'||n[0]==="'")&&(n[n.length-1]==='"'||n[n.length-1]==="'")}function ae(n){let t=n;return (t[0]==='"'||t[0]==="'")&&(t=t.slice(1)),(t[t.length-1]==='"'||t[t.length-1]==="'")&&(t=t.slice(0,-1)),t}function le(n){let t="",e="";for(let s=0;s<n.length;s++){let i=n[s+1];n[s]==="\\"&&i==='"'?(t+='\\"',s++):n[s]==='"'&&e!=="\\"?t+='\\"':t+=n[s],e=n[s]??"";}return t}function Nt(n){let t=n;oe(n)&&(t=ae(t),t=t.replace(re,(e,s)=>String.fromCodePoint(parseInt(s.trim(),16))),t=t.replaceAll(`\\ `,"\\n"),t=le(t),t='"'+t+'"');try{return JSON.parse(t)}catch{return}}function _t(n){class t extends n{constructor(){super(...arguments);this.ut=null;this.nt=null;}getCssData(i,r=false){let o=this.ut??Object.create(null);if(!Object.keys(o).includes(i)||!o[i]){this.nt||(this.nt=window.getComputedStyle(this));let l=this.nt.getPropertyValue(i).trim();try{o[i]=Nt(l);}catch(a){r||console.warn(`CSS Data error: ${i}`,a),o[i]=null;}}return this.ut=o,o[i]}}return t}function Dt(n){class t extends n{static reg(s){let i=this,r=window.customElements.get(s);if(r){r!==i&&console.warn([`Element with tag name "${s}" 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(s,i);}}return t}var ce="https://ucarecdn.com",P=Object.freeze({"dev-mode":{},pubkey:{},uuid:{},src:{},lazy:{default:1},intersection:{},breakpoints:{},"cdn-cname":{default:ce},"proxy-cname":{},"secure-delivery-proxy":{},"hi-res-support":{default:1},"ultra-res-support":{},format:{},"cdn-operations":{},progressive:{},quality:{},"is-background-for":{},"is-preview-blur":{default:1}});var D=class extends _t(Dt(y)){constructor(){super();this.g={};this.y=new Map;this.b=null;this.W=null;for(let e in P){let s=P[e];this.g[b+e]=s?.default||"";}}createRenderRoot(){return this}$$(e){return this.g[b+e]}set$$(e){for(let s in e){let i=b+s,r=e[s];this.g[i]=r,this.mt(i,r);}}sub$$(e,s){let i=b+e;this.y.has(i)||this.y.set(i,new Set),this.y.get(i)?.add(s);let r=this.g[i];r!==null&&r!==""&&s(r);}mt(e,s){this.y.has(e)&&this.y.get(e)?.forEach(i=>{s===null||s===""||i(s);});}analyticsParams(){return `-/@clib/${Lt}/${kt}/uc-img/`}initAttributes(e){Array.from(this.attributes).forEach(s=>{let i=s;P[i.name]||e.setAttribute(i.name,i.value);});}initIntersection(e,s){let i={root:null,rootMargin:"0px"};this.b=new IntersectionObserver(r=>{r.forEach(o=>{o.isIntersecting&&(s(),this.b?.unobserve(e));});},i),this.b.observe(e),this.W||(this.W=new Set),this.W.add(e);}connectedCallback(){super.connectedCallback(),this.jt();}jt(){for(let e in P){let s=b+e,i=this.getCssData(s,true);i!=null&&(this.g[s]=i);}}disconnectedCallback(){super.disconnectedCallback(),this.b&&(this.W?.forEach(e=>{this.b?.unobserve(e);}),this.b=null),this.y.clear();}static get observedAttributes(){return Object.keys(P)}attributeChangedCallback(e,s,i){window.setTimeout(()=>{let r=b+e;this.g[r]=i,this.mt(r,i);});}};var Kt=n=>Object.entries(n).filter(([t,e])=>e!==void 0&&e!=="").map(([t,e])=>t==="cdn-operations"||t==="analytics"?e:`${t}/${e}`);var B=class extends D{constructor(){super(...arguments);this.r=new Image;this.n=new Image;}ft(e){return !e.includes("//")&&!F&&(e=new URL(e,document.baseURI).href),e}Q(e){if(!e)return;let s=e,i=s.match(/\d+/)?.[0],r=s.match(/[a-zA-Z]+/)?.[0];if(!i||!r)return;let o=parseInt(i,10);return Number(o)>q&&this.gt?q+r:Number(o)>Q&&!this.gt?Q+r:e}Lt(e,s){let i={format:this.rt("format"),quality:this.rt("quality"),resize:this.Q(e),blur:s,"cdn-operations":this.rt("cdn-operations")??void 0,analytics:this.analyticsParams()};return lt(...Kt(i))}rt(e){let s=this.$$(e);if(s==null||typeof s=="string"||typeof s=="number"||typeof s=="boolean")return s}s(e="",s=""){let i=this.$$("src");if(i.startsWith("data:")||i.startsWith("blob:"))return i;if(F&&i&&!i.includes("//"))return this.E(i);let r=this.Lt(e,s),o=this.$$("cdn-cname"),l=o;if(i.startsWith(String(o)))return S(i,r);let a=this.$$("uuid");if(l&&a)return this.E(S(H(l,a),r));if(a)return this.E(S(H(l,a),r));let h=this.$$("proxy-cname");if(h)return this.E(S(h,r,this.ft(i)));let p=this.$$("pubkey");if(p)return this.E(S(`https://${p}.ucr.io/`,r,this.ft(i)))}E(e){let s=this.$$("secure-delivery-proxy");return s?ut(s,{previewUrl:e},{transform:i=>window.encodeURIComponent(i)}):e}v(e,s=1,i=true){let r=e.getBoundingClientRect(),o=s*Math.round(r.width),l=i?"":s*Math.round(r.height);return o||l?`${o||""}x${l||""}`:null}kt(e){let s=r=>{r.stopPropagation();let o=new Event(r.type,r);this.dispatchEvent(o);},i=["load","error"];for(let r of i)e.addEventListener(r,s);}get img(){return this.a||(this.ot({elNode:this.r}),this.appendChild(this.r)),this.r}get q(){return this.a?{type:G.PREVIEW,img:this.n}:{type:G.MAIN,img:this.img}}get a(){return this.$$("is-preview-blur")}get yt(){return this.$$("is-background-for")}get bt(){let e=this.$$("breakpoints");if(e){let s=dt(e);return mt(s.map(i=>parseInt(i,10)))}else return null}get gt(){return this.$$("format").toLowerCase()==="jpeg"}vt(e){let s=new Set;s.add(`url("${this.s(this.v(e))}") 1x`),this.$$("hi-res-support")&&s.add(`url("${this.s(this.v(e,2))}") ${2}x`),this.$$("ultra-res-support")&&s.add(`url("${this.s(this.v(e,3))}") ${3}x`);let i=`image-set(${[...s].join(", ")})`;e.style.setProperty("background-image",i),e.style.setProperty("background-image",`-webkit-${i}`);}xt(){let e=new Set;return this.bt?this.bt.forEach(s=>{e.add(`${this.s(`${s}x`)} ${this.Q(`${s}w`)}`),this.$$("hi-res-support")&&e.add(`${this.s(`${s*2}x`)} ${this.Q(`${s*2}w`)}`),this.$$("ultra-res-support")&&e.add(`${this.s(`${s*3}x`)} ${this.Q(`${s*3}w`)}`);}):(e.add(`${this.s(this.v(this.q.img))} 1x`),this.$$("hi-res-support")&&e.add(`${this.s(this.v(this.q.img,2))} 2x`),this.$$("ultra-res-support")&&e.add(`${this.s(this.v(this.q.img,3))} 3x`)),[...e].join()}wt(){return this.s()}get Et(){return this.s("100x","100")}Nt(){let e=this.yt;[...document.querySelectorAll(e)].forEach(s=>{this.$$("intersection")?this.initIntersection(s,()=>{this.vt(s);}):this.vt(s);});}_t({elNode:e,src:s,srcset:i}){s&&(e.src=s),i&&(e.srcset=i);}ot({elNode:e}){this.kt(e),this.initAttributes(e);}at({src:e,srcset:s,elNode:i}){return new Promise((r,o)=>{this.ot({elNode:i}),i.setAttribute(W,""),i.addEventListener("load",()=>{i.removeAttribute(W),r(i);}),i.addEventListener("error",()=>{o(false);}),this._t({elNode:i,src:e,srcset:s});})}async Dt(){if(this.$$("intersection")){this.a&&(this.ot({elNode:this.n}),this.appendChild(this.n)),this.initIntersection(this.q.img,async()=>{this.a&&(this.n.src=this.Et);try{await this.at({src:this.wt(),srcset:this.xt(),elNode:this.r}),this.a&&await this.n.remove(),this.appendChild(this.r);}catch{this.a&&await this.n?.remove(),this.appendChild(this.r);}});return}try{this.a&&(await this.at({src:this.Et,elNode:this.n}),this.appendChild(this.n)),await this.at({src:this.wt(),srcset:this.xt(),elNode:this.r}),this.a&&await this.n?.remove(),this.appendChild(this.r);}catch{this.a&&await this.n?.remove(),this.appendChild(this.r);}}init(){this.yt?this.Nt():this.Dt();}};var V=class extends B{connectedCallback(){super.connectedCallback(),this.sub$$("src",()=>{this.init();}),this.sub$$("uuid",()=>{this.init();}),this.sub$$("lazy",t=>{!this.$$("is-background-for")&&!this.$$("is-preview-blur")&&(this.img.loading=t?"lazy":"eager");});}};V.reg("uc-img");/*! For license information please see uc-img.min.js.LEGAL.txt */
8
8
  export{V as Img};
@@ -1 +0,0 @@
1
- export{h as CloudImageEditorActivity}from'./chunk-5OA6ZVWQ.js';import'./chunk-NJ77GRVX.js';import'./chunk-LNXFGGSC.js';import'./chunk-TVCYFFRR.js';
@@ -1,7 +0,0 @@
1
- import {t,e,x as x$1,D,u,a as a$2,I as I$1,H as H$1,l,m,g as g$1,r,i,C,k as k$1,j as j$1,E,o,z,y,p as p$1,B as B$1,G}from'./chunk-NJ77GRVX.js';import {a}from'./chunk-LNXFGGSC.js';import {a as a$1}from'./chunk-TVCYFFRR.js';import {nothing,html}from'lit';import {state}from'lit/decorators.js';import {ifDefined}from'lit/directives/if-defined.js';import {uploadFileGroup,Queue,getUserAgent,UploadError,NetworkError}from'@uploadcare/upload-client';/**
2
- * @license
3
- * Package: @uploadcare/file-uploader@1.27.0-alpha.0 (MIT)
4
- * License: https://github.com/uploadcare/blob/main/LICENSE
5
- * Built: 2026-02-17T11:57:25.085Z
6
- */
7
- var _t="active",O="___ACTIVITY_IS_ACTIVE___",Ct,p=class a extends(Ct=D,Ct){constructor(){super(...arguments);this.historyTracked=false;this.init$=t(this);this._debouncedHistoryFlush=e(this._historyFlush.bind(this),10);}_deactivate(){let t=a._activityCallbacks.get(this);this[O]=false,this.removeAttribute(_t),t?.deactivateCallback?.();}_activate(){let t=a._activityCallbacks.get(this);this.$["*historyBack"]=this.historyBack.bind(this),this[O]=true,this.setAttribute(_t,""),t?.activateCallback?.(),this._debouncedHistoryFlush(),this.emit(x$1.ACTIVITY_CHANGE,{activity:this.activityType});}initCallback(){super.initCallback(),this.activityType&&(this.hasAttribute("activity")||this.setAttribute("activity",this.activityType),this.sub("*currentActivity",t=>{try{this.activityType!==t&&this[O]?this._deactivate():this.activityType===t&&!this[O]&&this._activate();}catch(e){this.telemetryManager.sendEventError(e,`activity "${this.activityType}"`),console.error(`Error in activity "${this.activityType}". `,e);let r=this.$["*history"][this.$["*history"].length-1];this.$["*currentActivity"]=r??null;}t||(this.$["*history"]=[]);}));}_historyFlush(){let t=this.$["*history"];t&&(t.length>10&&(t=t.slice(t.length-11,t.length-1)),this.historyTracked&&t[t.length-1]!==this.activityType&&t.push(this.activityType),this.$["*history"]=t);}_isActivityRegistered(){return !!this.activityType&&a._activityCallbacks.has(this)}static{this._activityCallbacks=new Map;}get isActivityActive(){return !!this[O]}get couldOpenActivity(){return true}registerActivity(t,e={}){let{onActivate:r,onDeactivate:o}=e;a._activityCallbacks.set(this,{activateCallback:r,deactivateCallback:o});}_unregisterActivity(){this.isActivityActive&&this._deactivate(),a._activityCallbacks.delete(this);}disconnectedCallback(){super.disconnectedCallback(),this._isActivityRegistered()&&this._unregisterActivity();let t=this.$["*currentActivity"];this.blocksRegistry&&([...this.blocksRegistry].find(r=>r instanceof a&&r.activityType===t)||(this.$["*currentActivity"]=null,this.modalManager?.closeAll()));}get activityParams(){return this.$["*currentActivityParams"]}get initActivity(){return this.getCssData("--cfg-init-activity")??null}get doneActivity(){return this.getCssData("--cfg-done-activity")??null}historyBack(){let t=this.$["*history"];if(t){let e=t.pop();for(;e===this.activityType;)e=t.pop();let r=!!e;e&&(r=[...this.blocksRegistry].find(s=>s.activityType===e)?.couldOpenActivity??false),e=r?e:void 0,this.$["*currentActivity"]=e??null,e&&this.modalManager?.open(e),this.$["*history"]=t,e||this.modalManager?.closeAll();}}};p.activities=a;var bt=a=>typeof a!="number"?0:Math.floor(a/1e3),Tt=(a,{threshold:i})=>{let{secureExpire:t}=a,e=bt(Date.now()),r=Number(t),o=bt(i);return e+o>=r};var k=class extends r{constructor(){super(...arguments);this._secureToken=null;}async getSecureToken(){let{secureSignature:t,secureExpire:e,secureUploadsSignatureResolver:r,secureUploadsExpireThreshold:o}=this._cfg;if((t||e)&&r&&console.warn("Both secureSignature/secureExpire and secureUploadsSignatureResolver are set. secureUploadsSignatureResolver will be used."),r){if(!this._secureToken||Tt(this._secureToken,{threshold:o})){this._secureToken?this._debugPrint("Secure signature is expired. Resolving a new one..."):this._debugPrint("Secure signature is not set yet.");try{let s=await r();s?!s.secureSignature||!s.secureExpire?console.error("Secure signature resolver returned an invalid result:",s):(this._debugPrint("Secure signature resolved:",s),this._debugPrint("Secure signature will expire in",new Date(Number(s.secureExpire)*1e3).toISOString()),this._secureToken=s):(this._debugPrint("Secure signature resolver returned nothing."),this._secureToken=null);}catch(s){console.error("Secure signature resolving failed. Falling back to the previous one.",s),this._sharedInstancesBag.telemetryManager.sendEventError(s,"secureUploadsSignatureResolver. Secure signature resolving failed. Falling back to the previous one.");}}return this._secureToken}return t&&e?(this._debugPrint("Secure signature and expire are set. Using them...",{secureSignature:t,secureExpire:e}),{secureSignature:t,secureExpire:e}):null}destroy(){super.destroy(),this._secureToken=null;}};var H=(a,i)=>{if(a.failedCount>0)return {type:"SOME_FILES_HAS_ERRORS",message:i.l10n("some-files-were-not-uploaded")}};var j=(a,i)=>{let t=a.totalCount,e=i.cfg.multiple?i.cfg.multipleMin:0,r=i.cfg.multiple?i.cfg.multipleMax:1;if(e&&t<e)return {type:"TOO_FEW_FILES",message:i.l10n("files-count-limit-error-too-few",{min:e,max:r,total:t}),payload:{total:t,min:e,max:r}};if(r&&t>r)return {type:"TOO_MANY_FILES",message:i.l10n("files-count-limit-error-too-many",{min:e,max:r,total:t}),payload:{total:t,min:e,max:r}}};var Lt=()=>{let a=navigator.userAgent;return /Macintosh|Windows/.test(a)&&/Version\/[\d.]+.*Safari/.test(a)&&!/Chrome|Chromium|Edg|OPR/.test(a)},Bt=()=>"capture"in document.createElement("input"),$t=()=>({safariDesktop:Lt()}),Nt=()=>({htmlMediaCapture:Bt()}),Et=$t(),Ot=Nt();var S="image/*",W="video/*",Gt=["image/heif","image/heif-sequence","image/heic","image/heic-sequence","image/avif","image/avif-sequence",".heif",".heifs",".heic",".heics",".avif",".avifs"],zt=()=>Et.safariDesktop?[S]:[S,...Gt],U=zt(),P=a=>a?a.filter(i=>typeof i=="string").flatMap(i=>o(i)):[],Q=(a,i)=>i.some(t=>{if(t.endsWith("*")){let e=t.replace("*","");return a.startsWith(e)}return a===t}),It=(a,i)=>i.some(t=>t.startsWith(".")?a.toLowerCase().endsWith(t.toLowerCase()):false),At=a=>{let i=a?.type;return i?Q(i,U):false};var q=(a,i)=>{let t=i.cfg.imgOnly,e=i.cfg.accept,r=P([...t?U:[],e]);if(!r.length)return;let o=a.mimeType,s=a.name;if(!o||!s)return;let n=Q(o,r),l=It(s,r);if(!n&&!l)return {type:"FORBIDDEN_FILE_TYPE",message:i.l10n("file-type-not-allowed"),payload:{entry:a}}};var Y=(a,i)=>{let t=i.cfg.imgOnly,e=a.isImage;if(!(!t||e)&&!(!a.fileInfo&&a.externalUrl)&&!(!a.fileInfo&&!a.mimeType))return {type:"NOT_AN_IMAGE",message:i.l10n("images-only-accepted"),payload:{entry:a}}};var f=1e3,b=Object.freeze({AUTO:"auto",BYTE:"byte",KB:"kb",MB:"mb",GB:"gb",TB:"tb",PB:"pb"}),x=a=>Math.ceil(a*100)/100,St=(a,i=b.AUTO)=>{let t=i===b.AUTO;if(i===b.BYTE||t&&a<f**1){let r=B$1("en-US",a)==="one"?"byte":"bytes";return `${a} ${r}`}return i===b.KB||t&&a<f**2?`${x(a/f**1)} KB`:i===b.MB||t&&a<f**3?`${x(a/f**2)} MB`:i===b.GB||t&&a<f**4?`${x(a/f**3)} GB`:i===b.TB||t&&a<f**5?`${x(a/f**4)} TB`:`${x(a/f**5)} PB`};var X=(a,i)=>{let t=i.cfg.maxLocalFileSizeBytes,e=a.size;if(t&&e&&e>t)return {type:"FILE_SIZE_EXCEEDED",message:i.l10n("files-max-size-limit-error",{maxFileSize:St(t)}),payload:{entry:a}}};var J=(a,i)=>{let{internalId:t}=a;if(!i._uploadCollection.hasItem(t))return;let r=i._uploadCollection.read(t)?.getValue("uploadError");if(!r)return;if(r instanceof UploadError)return {type:"UPLOAD_ERROR",message:r.message,payload:{entry:a,error:r}};if(r instanceof NetworkError)return {type:"NETWORK_ERROR",message:r.message,payload:{entry:a,error:r}};let o=r instanceof Error?r:new Error("Unknown error",{cause:r});return {type:"UNKNOWN_ERROR",message:o.message,payload:{entry:a,error:o}}};var I={FILE_VALIDATION_FAILED:"File validator execution has failed",FILE_VALIDATION_TIMEOUT:"File validator execution has timed out",COLLECTION_VALIDATION_FAILED:"Collection validator execution has failed",MISSING_ERROR_MESSAGE:"Missing message. We recommend adding message: value."},Wt=a=>typeof a=="function"?{runOn:"change",validator:a}:a,R=class extends r{constructor(t){super(t);this._commonFileValidators=[Y,q,X,J];this._commonCollectionValidators=[j,H];this._queue=new Queue(20);this._runQueueDebounced=e(()=>{this._queue.run();},500);this._isDestroyed=false;this._entryValidationState=new Map;let e$1=e(()=>{this.runFileValidators("change"),this.runCollectionValidators();},0);this.addSub(this._ctx.sub(i("maxLocalFileSizeBytes"),e$1)),this.addSub(this._ctx.sub(i("multipleMin"),e$1)),this.addSub(this._ctx.sub(i("multipleMax"),e$1)),this.addSub(this._ctx.sub(i("multiple"),e$1)),this.addSub(this._ctx.sub(i("imgOnly"),e$1)),this.addSub(this._ctx.sub(i("accept"),e$1)),this.addSub(this._ctx.sub(i("validationConcurrency"),r=>{this._queue.concurrency=r;}));}get _uploadCollection(){return this._sharedInstancesBag.uploadCollection}runFileValidators(t,e){if(this._isDestroyed)return;let r=e??this._uploadCollection.items();for(let o of r){let s=this._uploadCollection.read(o);s&&this._runFileValidatorsForEntry(s,t);}}runCollectionValidators(){if(this._isDestroyed)return;let t=this._sharedInstancesBag.api,e=t.getOutputCollectionState(),r=[],o=this._cfg.collectionValidators;for(let s of [...this._commonCollectionValidators,...o])try{let n=s(e,t);if(!n)continue;n&&(r.push(this._addCustomTypeToValidationError(n)),n.message||console.warn(I.MISSING_ERROR_MESSAGE));}catch(n){console.warn(I.COLLECTION_VALIDATION_FAILED,n);}this._ctx.pub("*collectionErrors",r),r.length>0&&this._sharedInstancesBag.eventEmitter.emit(x$1.COMMON_UPLOAD_FAILED,()=>t.getOutputCollectionState(),{debounce:true});}cleanupValidationForEntry(t){let e=this._entryValidationState.get(t.uid);e&&(e.abortController?.abort(),this._entryValidationState.delete(t.uid));}async _runFileValidatorsForEntry(t,e){if(this._isDestroyed)return;let r=this._sharedInstancesBag.api,o=this._getEntryValidationState(t),s=o.promise??Promise.resolve(),n=(async()=>{if(this._isDestroyed||(await s,this._isDestroyed))return;let l=this._getValidatorDescriptorsForEntry(t,e);if(l.length===0||!this._uploadCollection.hasItem(t.uid))return;t.setMultipleValues({isQueuedForValidation:true,isValidationPending:true});let _=r.getOutputItem(t.uid),m=new AbortController;o.abortController=m;let F=this._cfg.validationTimeout,M=this._getValidatorDescriptors(),G=new Set(l.map(u=>u.validator)),z=[];for(let u of M)if(!G.has(u.validator)){let D=o.lastErrorThrownByValidator.get(u.validator);D&&z.push(D);}let Rt=l.map(u=>async()=>{if(this._isDestroyed)return;let D=setTimeout(()=>{o.skippedValidators.add(u.validator),m.abort(),console.warn(I.FILE_VALIDATION_TIMEOUT);},F);try{let T=await u.validator(_,r,{signal:m.signal});if(!T||m.signal.aborted){o.lastErrorThrownByValidator.set(u.validator,void 0);return}let rt=this._addCustomTypeToValidationError(T);o.lastErrorThrownByValidator.set(u.validator,rt),z.push(rt),T.message||console.warn(I.MISSING_ERROR_MESSAGE);}catch(T){m.signal.aborted||(o.skippedValidators.add(u.validator),console.warn(I.FILE_VALIDATION_FAILED,T),this._sharedInstancesBag.telemetryManager.sendEventError(T,`file validator. ${I.FILE_VALIDATION_FAILED}`));}finally{clearTimeout(D),u.runOn!=="change"&&o.skippedValidators.add(u.validator);}});if(this._runQueueDebounced(),await this._queue.add(async()=>{this._isDestroyed||(t.setValue("isQueuedForValidation",false),await Promise.all(Rt.map(u=>u())).catch(()=>{}));},{autoRun:false}),m.signal.aborted){t.setMultipleValues({isQueuedForValidation:false,isValidationPending:false});return}t.setMultipleValues({isValidationPending:false,isQueuedForValidation:false,errors:z});})();o.promise=n;try{await n;}finally{o.promise===n&&(o.promise=void 0);}}_addCustomTypeToValidationError(t){return {...t,type:t.type??"CUSTOM_ERROR"}}_getEntryValidationState(t){let e=this._entryValidationState.get(t.uid);if(e)return e;let r={abortController:void 0,skippedValidators:new WeakSet,promise:void 0,lastErrorThrownByValidator:new WeakMap};return this._entryValidationState.set(t.uid,r),r}_getValidatorDescriptors(){let t=this._cfg.fileValidators;return [...this._commonFileValidators,...t].map(Wt)}_getValidatorDescriptorsForEntry(t,e){let r=this._getEntryValidationState(t);return this._getValidatorDescriptors().filter(o=>!r.skippedValidators.has(o.validator)).filter(o=>o.runOn===e)}destroy(){this._isDestroyed=true,this._runQueueDebounced.cancel();for(let t of this._entryValidationState.values())t.abortController?.abort(),t.promise=void 0;this._entryValidationState.clear();}};var Ut="[Typed State] Wrong property name: ",L=class{constructor(i){this._ctxId=g$1.generateFastUid(),this._data=a$2.registerCtx(i,this._ctxId);}get uid(){return this._ctxId}setValue(i,t){if(!this._data.has(i)){console.warn(`${Ut}${String(i)}`);return}this._data.read(i)!==t&&this._data.pub(i,t);}setMultipleValues(i){for(let[t,e]of Object.entries(i))this.setValue(t,e);}getValue(i){return this._data.has(i)||console.warn(`${Ut}${String(i)}`),this._data.read(i)}subscribe(i,t){return this._data.sub(i,t)}destroy(){a$2.deleteCtx(this._ctxId);}};var B=class a{constructor(i){this._subsMap=Object.create(null);this._propertyObservers=new Set;this._collectionObservers=new Set;this._items=new Set;this._removed=new Set;this._added=new Set;this._markedToDestroy=new Set;this._initialValue=i.initialValue,this._ctxId=g$1.generateFastUid(),this._data=a$2.registerCtx({},this._ctxId),this._watchList=i.watchList||[];let t=Object.create(null);this._notifyObservers=(e,r)=>{this._observeTimeout&&window.clearTimeout(this._observeTimeout),t[e]||(t[e]=new Set),t[e].add(r),this._observeTimeout=window.setTimeout(()=>{Object.keys(t).length!==0&&(this._propertyObservers.forEach(o=>{o({...t});}),t=Object.create(null));}),this._scheduleDestroyMarkedItems();},i.handler&&this.observeCollection(i.handler);}static{this._destroyDelayMs=1e4;}_notify(){this._notifyTimeout&&window.clearTimeout(this._notifyTimeout),this._notifyTimeout=window.setTimeout(()=>{let i=new Set(this._added),t=new Set(this._removed);this._added.clear(),this._removed.clear();for(let e of this._collectionObservers)e?.([...this._items],i,t);this._scheduleDestroyMarkedItems();});}_scheduleDestroyMarkedItems(){this._markedToDestroy.size!==0&&(this._destroyTimeout&&window.clearTimeout(this._destroyTimeout),this._destroyTimeout=window.setTimeout(()=>{let i=[...this._markedToDestroy];this._markedToDestroy.clear();for(let t of i)t.destroy();},a._destroyDelayMs));}observeCollection(i){return this._collectionObservers.add(i),this._items.size>0&&this._notify(),()=>{this.unobserveCollection(i);}}unobserveCollection(i){this._collectionObservers.delete(i);}add(i){let t=new L(this._initialValue);for(let[e,r]of Object.entries(i))t.setValue(e,r);return this._items.add(t.uid),this._notify(),this._data.add(t.uid,t),this._added.add(t),this._watchList.forEach(e=>{this._subsMap[t.uid]||(this._subsMap[t.uid]=[]),this._subsMap[t.uid]?.push(t.subscribe(e,()=>{this._notifyObservers(e,t.uid);}));}),t.uid}hasItem(i){return this._items.has(i)}read(i){return this._data.read(i)??null}readProp(i,t){let e=this.read(i);if(!e)throw new Error(`TypedCollection#readProp: Item with id ${i} not found`);return e.getValue(t)}publishProp(i,t,e){let r=this.read(i);if(!r)throw new Error(`TypedCollection#publishProp: Item with id ${i} not found`);r.setValue(t,e);}remove(i){let t=this.read(i);t&&(this._removed.add(t),this._markedToDestroy.add(t)),this._items.delete(i),this._notify(),this._data.pub(i,void 0),this._subsMap[i]?.forEach(e=>{e();}),delete this._subsMap[i];}clearAll(){this._items.forEach(i=>{this.remove(i);});}observeProperties(i){return this._propertyObservers.add(i),()=>{this.unobserveProperties(i);}}unobserveProperties(i){this._propertyObservers.delete(i);}findItems(i){let t=[];return this._items.forEach(e=>{let r=this.read(e);r&&i(r)&&t.push(e);}),t}items(){return [...this._items]}get size(){return this._items.size}destroy(){this._observeTimeout&&window.clearTimeout(this._observeTimeout),this._notifyTimeout&&window.clearTimeout(this._notifyTimeout),this._destroyTimeout&&window.clearTimeout(this._destroyTimeout);for(let i of this._markedToDestroy)i.destroy();this._markedToDestroy.clear(),a$2.deleteCtx(this._ctxId),this._propertyObservers=new Set,this._collectionObservers=new Set;for(let i of Object.keys(this._subsMap))this._subsMap[i]?.forEach(t=>{t();}),delete this._subsMap[i];}};var Z=a=>({isVideoRecordingEnabled:j$1(a.cameraModes).includes(E.VIDEO),isPhotoEnabled:j$1(a.cameraModes).includes(E.PHOTO)});var tt=(a,i)=>{for(let t of a)if(i(t))return t};var xt=(a,i)=>{for(let t of a)if(i(t))return true;return false};function Ft(a,i){for(let t in i)t.includes("-")?a.style.setProperty(t,String(i[t])):a.style[t]=String(i[t]);}var Qt=/[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}/i,qt=new RegExp(`^/?(${Qt.source})(?:/(-/(?:[^/]+/)+)?([^/]*))?$`,"i"),Mt=({url:a,cdnBase:i})=>{let t=new URL(i),e=new URL(p$1),r=new URL(a);if(t.host!==r.host&&e.host!==r.host)return null;let o=qt.exec(r.pathname);if(!o)return null;let[,s,n,l]=o;return s?{uuid:s,cdnUrlModifiers:n||"",filename:l||null}:null};var et=Object.freeze({FACEBOOK:"facebook",DROPBOX:"dropbox",GDRIVE:"gdrive",GPHOTOS:"gphotos",FLICKR:"flickr",VK:"vk",EVERNOTE:"evernote",BOX:"box",ONEDRIVE:"onedrive",HUDDLE:"huddle"}),Yt=Object.freeze({MOBILE_VIDEO_CAMERA:"mobile-video-camera",MOBILE_PHOTO_CAMERA:"mobile-photo-camera"}),g=Object.freeze({LOCAL:"local",DROP_AREA:"drop-area",CAMERA:"camera",EXTERNAL:"external",API:"js-api",URL:"url",DRAW:"draw",...Yt,...et});var $=a=>a.uploadCollection.items().map(e=>a.api.getOutputItem(e));function Dt(a){let i=new Map;return (...e)=>{let r=JSON.stringify(e);if(i.has(r))return i.get(r);let o=a(...e);return i.set(r,o),o}}function Xt(a){let i=false;return setTimeout(()=>{i=true;},0),e=>((...r)=>(i&&G(a),e(...r)))}function Vt(a){let i={},t=a.ctx,e={progress:()=>t.read("*commonProgress"),errors:()=>t.read("*collectionErrors"),group:()=>t.read("*groupInfo"),totalCount:()=>a.uploadCollection.size,failedCount:()=>i.failedEntries.length,successCount:()=>i.successEntries.length,uploadingCount:()=>i.uploadingEntries.length,status:()=>i.isFailed?"failed":i.isUploading?"uploading":i.isSuccess?"success":"idle",isSuccess:()=>i.allEntries.length>0&&i.errors.length===0&&i.successEntries.length===i.allEntries.length,isUploading:()=>i.allEntries.some(o=>o.status==="uploading"),isFailed:()=>i.errors.length>0||i.failedEntries.length>0,allEntries:()=>$(a),successEntries:()=>i.allEntries.filter(o=>o.status==="success"),failedEntries:()=>i.allEntries.filter(o=>o.status==="failed"),uploadingEntries:()=>i.allEntries.filter(o=>o.status==="uploading"),idleEntries:()=>i.allEntries.filter(o=>o.status==="idle")},r=Xt("You're trying to access the OutputCollectionState asynchronously. In this case, the data you retrieve will be newer than it was when the OutputCollectionState was created or when the event was dispatched. If you want to retain the state at a specific moment in time, you should use the spread operator like this: `{...outputCollectionState}` or `{...e.detail}`");for(let[o,s]of Object.entries(e)){let n=o,_=Dt(r(s));Object.defineProperty(i,n,{get:_,enumerable:true});}return i}var N=class extends r{constructor(){super(...arguments);this._l10n=C(()=>this._ctx);this.addFileFromUrl=(t,{silent:e,fileName:r,source:o}={})=>{let s=this._uploadCollection.add({externalUrl:t,fileName:r??null,silent:e??false,source:o??g.API});return this.getOutputItem(s)};this.addFileFromUuid=(t,{silent:e,fileName:r,source:o}={})=>{let s=this._uploadCollection.add({uuid:t,fileName:r??null,silent:e??false,source:o??g.API});return this.getOutputItem(s)};this.addFileFromCdnUrl=(t,{silent:e,fileName:r,source:o}={})=>{let s=Mt({url:t,cdnBase:this.cfg.cdnCname});if(!s)throw new Error("Invalid CDN URL");let n=this._uploadCollection.add({uuid:s.uuid,cdnUrl:t,cdnUrlModifiers:s.cdnUrlModifiers,fileName:r??s.filename??null,silent:e??false,source:o??g.API});return this.getOutputItem(n)};this.addFileFromObject=(t,{silent:e,fileName:r,source:o,fullPath:s}={})=>{let n=this._uploadCollection.add({file:t,isImage:At(t),mimeType:t.type,fileName:r??t.name,fileSize:t.size,silent:e??false,source:o??g.API,fullPath:s??null});return this.getOutputItem(n)};this.removeFileByInternalId=t=>{if(!this._uploadCollection.read(t))throw new Error(`File with internalId ${t} not found`);this._uploadCollection.remove(t);};this.uploadAll=()=>{let t=this._uploadCollection.items().filter(e=>{let r=this._uploadCollection.read(e);return r?!r.getValue("isRemoved")&&!r.getValue("isUploading")&&!r.getValue("fileInfo")&&r.getValue("errors").length===0&&!r.getValue("isValidationPending")&&!r.getValue("isQueuedForValidation"):false});t.length!==0&&(this._ctx.pub("*uploadTrigger",new Set(t)),this._sharedInstancesBag.eventEmitter.emit(x$1.COMMON_UPLOAD_START,this.getOutputCollectionState()));};this.openSystemDialog=(t={})=>{let e=k$1(P([this.cfg.accept??"",...this.cfg.imgOnly?U:[]])),r="uploadcare-file-input",o=document.createElement("input");if(o.setAttribute(r,""),Ft(o,{opacity:0,height:0,width:0,visibility:"hidden",position:"absolute",top:0,left:0}),o.type="file",o.multiple=this.cfg.multiple,t.captureCamera){o.capture=this.cfg.cameraCapture;let{isPhotoEnabled:s,isVideoRecordingEnabled:n}=Z(this.cfg);t.modeCamera===E.PHOTO&&s?o.accept=S:t.modeCamera===E.VIDEO&&n?o.accept=W:o.accept=[S,n&&W].filter(Boolean).join(",");}else o.accept=e;o.addEventListener("change",()=>{o.files&&([...o.files].forEach(s=>{this.addFileFromObject(s,{source:t.captureCamera?g.CAMERA:g.LOCAL});}),this._ctx.pub("*currentActivity",a.UPLOAD_LIST),this._sharedInstancesBag.modalManager?.open(a.UPLOAD_LIST),o.remove());},{once:true}),document.querySelectorAll(`[${r}]`).forEach(s=>{s.remove();}),document.body.appendChild(o),o.dispatchEvent(new MouseEvent("click"));};this.initFlow=(t=false)=>{if(this._uploadCollection.size>0&&!t)this._ctx.pub("*currentActivity",a.UPLOAD_LIST),this._sharedInstancesBag.modalManager?.open(a.UPLOAD_LIST);else if(this._sourceList?.length===1){let e=this._sourceList[0];if(e==="local"){this._ctx.pub("*currentActivity",a.UPLOAD_LIST),this.openSystemDialog();return}if(e==="camera"&&Ot.htmlMediaCapture){let{isPhotoEnabled:n,isVideoRecordingEnabled:l}=Z(this.cfg);if(n&&l){this._ctx.pub("*currentActivity",a.START_FROM);return}else if(n||l){this.openSystemDialog({captureCamera:true,modeCamera:n?E.PHOTO:E.VIDEO});return}else this.openSystemDialog({captureCamera:true,modeCamera:E.PHOTO});}let r=this._sharedInstancesBag.blocksRegistry;tt(r,n=>"type"in n&&n.type===e)?.activate(),this._ctx.read("*currentActivity")&&this._sharedInstancesBag.modalManager?.open(this._ctx.read("*currentActivity"));}else this._ctx.pub("*currentActivity",a.START_FROM),this._sharedInstancesBag.modalManager?.open(a.START_FROM);};this.doneFlow=()=>{let t=tt(this._sharedInstancesBag.blocksRegistry,e=>"doneActivity"in e);t&&(this._ctx.pub("*currentActivity",t.doneActivity),this._ctx.pub("*history",t.doneActivity?[t.doneActivity]:[]),this._ctx.read("*currentActivity")||this._sharedInstancesBag.modalManager?.closeAll());};this.setCurrentActivity=(t,...e)=>{setTimeout(()=>{if(xt(this._sharedInstancesBag.blocksRegistry,r=>r.activityType===t)){this._ctx.pub("*currentActivityParams",e[0]??{}),this._ctx.pub("*currentActivity",t);return}console.warn(`Activity type "${t}" not found in the context`);});};this.getCurrentActivity=()=>this._ctx.read("*currentActivity");this.setModalState=t=>{setTimeout(()=>{if(t&&!this._ctx.read("*currentActivity")){console.warn(`Can't open modal without current activity. Please use "setCurrentActivity" method first.`);return}t?this._sharedInstancesBag.modalManager?.open(this._ctx.read("*currentActivity")):(this._sharedInstancesBag.modalManager?.close(this._ctx.read("*currentActivity")),this._ctx.pub("*currentActivity",null));});};}get _uploadCollection(){return this._sharedInstancesBag.uploadCollection}get cfg(){return this._cfg}get l10n(){return this._l10n}removeAllFiles(){this._uploadCollection.clearAll();}getOutputItem(t){let e=a$2.getCtx(t);if(!e)throw new Error(`UploaderPublicApi#getOutputItem: Entry with ID "${t}" not found in the upload collection`);let r=e.store,o=r.fileInfo,s=r.isRemoved?"removed":r.errors.length>0?"failed":r.fileInfo?"success":r.isUploading?"uploading":"idle";return {uuid:o?.uuid??r.uuid??null,internalId:t,name:o?.originalFilename??r.fileName,size:o?.size??r.fileSize,isImage:o?.isImage??r.isImage,mimeType:o?.mimeType??r.mimeType,file:r.file,externalUrl:r.externalUrl,cdnUrlModifiers:r.cdnUrlModifiers,cdnUrl:r.cdnUrl??o?.cdnUrl??null,fullPath:r.fullPath,uploadProgress:r.uploadProgress,fileInfo:o??null,metadata:r.metadata??o?.metadata??null,isSuccess:s==="success",isUploading:s==="uploading",isFailed:s==="failed",isRemoved:s==="removed",isValidationPending:r.isValidationPending,errors:r.errors,status:s,source:r?.source}}getOutputCollectionState(){return Vt(this._sharedInstancesBag)}get _sourceList(){let t=[];return this.cfg.sourceList&&(t=o(this.cfg.sourceList)),t}};var wt={file:null,externalUrl:null,fileName:null,fileSize:null,lastModified:Date.now(),uploadProgress:0,uuid:null,isImage:false,mimeType:null,ctxName:null,cdnUrl:null,cdnUrlModifiers:null,fileInfo:null,isUploading:false,abortController:null,thumbUrl:null,silent:false,source:null,fullPath:null,metadata:null,errors:[],uploadError:null,isRemoved:false,isQueuedForUploading:false,isValidationPending:false,isQueuedForValidation:false};function kt(a){return getUserAgent({...a,libraryName:y,libraryVersion:z})}var A=class a extends p{constructor(){super(...arguments);this.couldBeCtxOwner=false;this._isCtxOwner=false;this.init$=u(this);this._flushOutputItems=e(async()=>{if(this.getOutputData().length!==this.uploadCollection.size)return;let e=this.api.getOutputCollectionState();this.$["*collectionState"]=e,this.emit(x$1.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.cfg.groupOutput&&e.totalCount>0&&e.status==="success"&&this._createGroup(e);},300);this._handleCollectionUpdate=(t,e,r)=>{if(this.isConnected){(e.size||r.size)&&(this.$["*groupInfo"]=null),this.validationManager.runFileValidators("add",[...e].map(o=>o.uid));for(let o of e)o.getValue("silent")||this.emit(x$1.FILE_ADDED,this.api.getOutputItem(o.uid));this.validationManager.runCollectionValidators();for(let o of r){this.$["*uploadTrigger"].delete(o.uid),this.validationManager.cleanupValidationForEntry(o),o.getValue("abortController")?.abort(),o.setMultipleValues({isRemoved:true,abortController:null,isUploading:false,uploadProgress:0});let s=o?.getValue("thumbUrl");s&&URL.revokeObjectURL(s),this.emit(x$1.FILE_REMOVED,this.api.getOutputItem(o.uid));}this.$["*uploadList"]=t.map(o=>({uid:o})),this._flushCommonUploadProgress(),this._flushOutputItems();}};this._handleCollectionPropertiesUpdate=t=>{if(!this.isConnected)return;this._flushOutputItems();let e=this.uploadCollection,r=[...new Set(Object.entries(t).filter(([o])=>["uploadError","fileInfo","cdnUrl","cdnUrlModifiers"].includes(o)).flatMap(([,o])=>[...o]))];if(r.length>0&&setTimeout(()=>{if(!this.isConnected)return;let o=r.filter(s=>t.fileInfo?.has(s)&&!!a$2.getCtx(s)?.store.fileInfo);o.length>0&&this.validationManager.runFileValidators("upload",o),this.validationManager.runFileValidators("change",r);}),t.uploadProgress){for(let o of t.uploadProgress){let s=a$2.getCtx(o);if(!s)continue;let{isUploading:n,silent:l}=s.store;n&&!l&&this.emit(x$1.FILE_UPLOAD_PROGRESS,this.api.getOutputItem(o));}this._flushCommonUploadProgress();}if(t.isUploading)for(let o of t.isUploading){let s=a$2.getCtx(o);if(!s)continue;let{isUploading:n,silent:l}=s.store;n&&!l&&this.emit(x$1.FILE_UPLOAD_START,this.api.getOutputItem(o));}if(t.fileInfo){for(let o of t.fileInfo){let s=a$2.getCtx(o);if(!s)continue;let{fileInfo:n,silent:l}=s.store;n&&!l&&this.emit(x$1.FILE_UPLOAD_SUCCESS,this.api.getOutputItem(o));}this.cfg.cropPreset&&this._setInitialCrop(),this.cfg.cloudImageEditorAutoOpen&&this._openCloudImageEditor();}if(t.errors){this.validationManager.runCollectionValidators();for(let n of t.errors){let l=a$2.getCtx(n);if(!l)continue;let{errors:_}=l.store;_.length>0&&(this.emit(x$1.FILE_UPLOAD_FAILED,this.api.getOutputItem(n)),this.emit(x$1.COMMON_UPLOAD_FAILED,()=>this.api.getOutputCollectionState(),{debounce:true}));}let o=e.findItems(n=>!!n.getValue("fileInfo")),s=e.findItems(n=>n.getValue("errors").length>0);e.size>0&&s.length===0&&e.size===o.length&&this.$["*collectionErrors"].length===0&&this.emit(x$1.COMMON_UPLOAD_SUCCESS,this.api.getOutputCollectionState());}t.cdnUrl&&([...t.cdnUrl].filter(s=>!!this.uploadCollection.read(s)?.getValue("cdnUrl")).forEach(s=>{this.emit(x$1.FILE_URL_CHANGED,this.api.getOutputItem(s));}),this.$["*groupInfo"]=null);};this._flushCommonUploadProgress=()=>{let t=0,r=[...this.$["*uploadTrigger"]].filter(s=>!!this.uploadCollection.read(s));r.forEach(s=>{let n=this.uploadCollection.readProp(s,"uploadProgress");typeof n=="number"&&(t+=n);});let o=r.length?Math.round(t/r.length):0;this.$["*commonProgress"]!==o&&(this.$["*commonProgress"]=o,this.emit(x$1.COMMON_UPLOAD_PROGRESS,this.api.getOutputCollectionState()));};}get _hasCtxOwner(){return this.hasBlockInCtx(t=>t instanceof a?t._isCtxOwner&&t.isConnected&&t!==this:false)}initCallback(){super.initCallback(),this._addSharedContextInstance("*uploadCollection",()=>new B({initialValue:wt,watchList:["uploadProgress","uploadError","fileInfo","errors","cdnUrl","isUploading","isValidationPending"]})),this._addSharedContextInstance("*secureUploadsManager",t=>new k(t)),this._addSharedContextInstance("*validationManager",t=>new R(t)),this._addSharedContextInstance("*publicApi",t=>new N(t)),!this._hasCtxOwner&&this.couldBeCtxOwner&&this._initCtxOwner();}getAPI(){return this.api}get validationManager(){return this._getSharedContextInstance("*validationManager")}get api(){return this._getSharedContextInstance("*publicApi")}get uploadCollection(){return this._getSharedContextInstance("*uploadCollection")}get secureUploadsManager(){return this._getSharedContextInstance("*secureUploadsManager")}disconnectedCallback(){super.disconnectedCallback(),this._isCtxOwner&&this._unobserveUploadCollection(),this._flushOutputItems.cancel();}connectedCallback(){super.connectedCallback(),this._isCtxOwner&&this._observeUploadCollection();}_initCtxOwner(){this._isCtxOwner=true,this._observeUploadCollection(),this.subConfigValue("maxConcurrentRequests",t=>{this.$["*uploadQueue"].concurrency=Number(t)||1;});}_observeUploadCollection(){this._unobserveUploadCollection(),this._unobserveCollection=this.uploadCollection.observeCollection(this._handleCollectionUpdate),this._unobserveCollectionProperties=this.uploadCollection.observeProperties(this._handleCollectionPropertiesUpdate);}_unobserveUploadCollection(){this._unobserveCollectionProperties?.(),this._unobserveCollection?.(),this._unobserveCollectionProperties=void 0,this._unobserveCollection=void 0;}async _createGroup(t){let e=await this.getUploadClientOptions(),r=t.allEntries.map(l=>l.uuid+(l.cdnUrlModifiers?`/${l.cdnUrlModifiers}`:"")),o=new AbortController,s=await uploadFileGroup(r,{...e,signal:o.signal});if(this.$["*collectionState"]!==t){o.abort();return}this.$["*groupInfo"]=s;let n=this.api.getOutputCollectionState();this.emit(x$1.GROUP_CREATED,n),this.emit(x$1.CHANGE,()=>this.api.getOutputCollectionState(),{debounce:true}),this.$["*collectionState"]=n;}_openCloudImageEditor(){let[t]=this.uploadCollection.findItems(e=>!!e.getValue("fileInfo")&&e.getValue("isImage")).map(e=>this.uploadCollection.read(e));t&&this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(e=>e.activityType===p.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:t.uid},this.$["*currentActivity"]=p.activities.CLOUD_IMG_EDIT,this.modalManager?.open(p.activities.CLOUD_IMG_EDIT));}_setInitialCrop(){let t=I$1(this.cfg.cropPreset);if(t){let[e]=t,r=this.uploadCollection.findItems(o=>!!o.getValue("fileInfo")&&o.getValue("isImage")&&!o.getValue("cdnUrlModifiers")?.includes("/crop/")).map(o=>this.uploadCollection.read(o)).filter(Boolean);for(let o of r){let s=o.getValue("fileInfo");if(!s||!s.imageInfo){console.warn("Failed to get image info for entry",o.uid);continue}let{width:n,height:l$1}=s.imageInfo,_=typeof e?.width=="number"&&typeof e?.height=="number"&&e.width>0&&e.height>0?e.width/e.height:1,m$1=H$1(n,l$1,_),F=l(`crop/${m$1.width}x${m$1.height}/${m$1.x},${m$1.y}`,"preview"),M=o.getValue("cdnUrl");if(!M){console.warn("Failed to get cdnUrl for entry",o.uid);continue}o.setMultipleValues({cdnUrlModifiers:F,cdnUrl:m(M,F)}),this.uploadCollection.size===1&&this.cfg.useCloudImageEditor&&this.hasBlockInCtx(G=>G.activityType===p.activities.CLOUD_IMG_EDIT)&&(this.$["*currentActivityParams"]={internalId:o.uid},this.$["*currentActivity"]=p.activities.CLOUD_IMG_EDIT,this.modalManager?.open(p.activities.CLOUD_IMG_EDIT));}}}async getMetadataFor(t){let e=this.cfg.metadata||void 0;if(typeof e=="function"){let r=this.api.getOutputItem(t);return await e(r)}return e}async getUploadClientOptions(){let t=await this.secureUploadsManager.getSecureToken().catch(()=>null);return {store:this.cfg.store,publicKey:this.cfg.pubkey,baseCDN:this.cfg.cdnCname,baseURL:this.cfg.baseUrl,userAgent:kt,integration:this.cfg.userAgentIntegration,secureSignature:t?.secureSignature,secureExpire:t?.secureExpire,retryThrottledRequestMaxTimes:this.cfg.retryThrottledRequestMaxTimes,retryNetworkErrorMaxTimes:this.cfg.retryNetworkErrorMaxTimes,multipartMinFileSize:this.cfg.multipartMinFileSize,multipartChunkSize:this.cfg.multipartChunkSize,maxConcurrentRequests:this.cfg.multipartMaxConcurrentRequests,multipartMaxAttempts:this.cfg.multipartMaxAttempts,checkForUrlDuplicates:!!this.cfg.checkForUrlDuplicates,saveUrlForRecurrentUploads:!!this.cfg.saveUrlForRecurrentUploads}}getOutputData(){return $(this._sharedInstancesBag)}};A.extSrcList=Object.freeze({...et});A.sourceTypes=Object.freeze({...g});var it=class extends A{constructor(){super(...arguments);this._editorConfig=null;}get activityParams(){let t=super.activityParams;if("internalId"in t)return t;throw new Error("Cloud Image Editor activity params not found")}initCallback(){super.initCallback(),this.subConfigValue("cropPreset",t=>{this._editorConfig&&this._editorConfig.cropPreset!==t&&(this._editorConfig={...this._editorConfig,cropPreset:t});}),this.subConfigValue("cloudImageEditorTabs",t=>{this._editorConfig&&this._editorConfig.tabs!==t&&(this._editorConfig={...this._editorConfig,tabs:t});}),this._mountEditor();}disconnectedCallback(){super.disconnectedCallback(),this._unmountEditor();}_handleApply(t){if(!this._entry)return;this.debugPrint('editor event "apply"',t.detail);let e=t.detail;this._entry.setMultipleValues({cdnUrl:e.cdnUrl,cdnUrlModifiers:e.cdnUrlModifiers}),this.modalManager?.close(p.activities.CLOUD_IMG_EDIT),this.historyBack();}_handleCancel(t){let e=t instanceof CustomEvent?t.detail:void 0;this.debugPrint('editor event "cancel"',e),this.modalManager?.close(p.activities.CLOUD_IMG_EDIT),this.historyBack();}handleChange(t){this.debugPrint('editor event "change"',t.detail);}_mountEditor(){let{internalId:t}=this.activityParams,e=this.uploadCollection.read(t);if(!e)throw new Error(`Entry with internalId "${t}" not found`);this._entry=e;let r=this._entry.getValue("cdnUrl");if(!r)throw new Error(`Entry with internalId "${t}" hasn't uploaded yet`);this._editorConfig=this._createEditorConfig(r);}_unmountEditor(){this._entry=void 0,this._editorConfig=null;}render(){if(!this._editorConfig)return nothing;let{cdnUrl:t,cropPreset:e,tabs:r}=this._editorConfig;return html`<uc-cloud-image-editor cdn-url=${t} crop-preset=${ifDefined(e)} tabs=${ifDefined(r)} @apply=${this._handleApply} @cancel=${this._handleCancel} @change=${this.handleChange} ></uc-cloud-image-editor>`}_createEditorConfig(t){return {cdnUrl:t,cropPreset:this.cfg.cropPreset,tabs:this.cfg.cloudImageEditorTabs}}};a$1([state()],it.prototype,"_editorConfig",2);export{Ot as a,Ft as b,et as c,Yt as d,g as e,p as f,A as g,it as h};
@@ -1,7 +0,0 @@
1
- import {e,G,q as q$1,D as D$1,i,E as E$1,j as j$1,k,p}from'./chunk-NJ77GRVX.js';import {getPrefixedCdnBaseAsync,isPrefixedCdnBase}from'@uploadcare/cname-prefix/async';/**
2
- * @license
3
- * Package: @uploadcare/file-uploader@1.27.0-alpha.0 (MIT)
4
- * License: https://github.com/uploadcare/blob/main/LICENSE
5
- * Built: 2026-02-17T11:57:25.085Z
6
- */
7
- var w=e=>e.match(/[A-Z]{2,}(?=[A-Z][a-z]+[0-9]*|\b)|[A-Z]?[a-z]+[0-9]*|[A-Z]|[0-9]+/g)?.map(i=>i.toLowerCase()).join("-");var z=[{test:e=>!!e.accept&&!!e.imgOnly,message:"There could be a mistake.\nBoth `accept` and `imgOnly` parameters are set.\nThe value of `accept` will be concatenated with the internal image mime types list."},{test:e=>e.enableVideoRecording!==null,message:"The `enableVideoRecording` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."},{test:e=>e.defaultCameraMode!==null,message:"The `defaultCameraMode` parameter is deprecated and will be removed in the next major release.\nPlease use the `cameraModes` parameter instead."}],V=e(e=>{for(let{test:i,message:t}of z)i(e)&&G(t);},0);var D=e=>e instanceof Promise||!!(e&&typeof e=="object"&&"then"in e&&typeof e.then=="function");var C=e=>e,q=[C({key:"cameraModes",deps:["enableVideoRecording"],fn:({cameraModes:e,enableVideoRecording:i})=>{if(i===null)return e;let t=j$1(e);return i&&!t.includes("video")?t=t.concat("video"):i||(t=t.filter(r=>r!=="video")),k(t)}}),C({key:"cameraModes",deps:["defaultCameraMode"],fn:({cameraModes:e,defaultCameraMode:i})=>{if(i===null)return e;let t=j$1(e);return t=t.sort((r,o)=>r===i?-1:o===i?1:0),k(t)}}),C({key:"cdnCname",deps:["pubkey","cdnCnamePrefixed"],fn:({pubkey:e,cdnCname:i,cdnCnamePrefixed:t})=>e&&(i===p||isPrefixedCdnBase(i,t))?getPrefixedCdnBaseAsync(e,t):i}),C({key:"plugins",deps:["useCloudImageEditor"],fn:async({plugins:e,useCloudImageEditor:i},{signal:t})=>{let r="cloud-image-editor",o=Array.isArray(e)?e.filter(n=>n?.id!==r):[];if(!i)return o;try{let n=await import('./cloudImageEditorPlugin-BE5HU2W4.js');if(t.aborted)return o;let a=n.cloudImageEditorPlugin??n.default;return a?o.some(c=>c.id===a.id)?o:[...o,a]:(console.warn("[CloudImageEditorPlugin] Plugin module did not export a plugin"),o)}catch(n){return t.aborted||console.warn("[CloudImageEditorPlugin] Failed to load plugin",n),o}}})],E=({key:e,setValue:i,getValue:t,computationControllers:r})=>{for(let o of q)if(o.deps.includes(e)){let n={[o.key]:t(o.key)};for(let l of o.deps)n[l]=t(l);let a=new AbortController;r.get(o.key)?.abort(),r.set(o.key,a);let c;try{c=o.fn(n,{signal:a.signal});}catch(l){r.get(o.key)===a&&r.delete(o.key),console.error(`Failed to compute value for "${o.key}"`,l);return}D(c)?c.then(l=>{a.signal.aborted||i(o.key,l);}).catch(l=>{a.signal.aborted||console.error(`Failed to compute value for "${o.key}"`,l);}).finally(()=>{r.get(o.key)===a&&r.delete(o.key);}):i(o.key,c);}};var s=e=>String(e),f=e=>{let i=Number(e);if(Number.isNaN(i))throw new Error(`Invalid number: "${e}"`);return i},u=e=>{if(typeof e>"u"||e===null)return false;if(typeof e=="boolean")return e;if(e==="true"||e==="")return true;if(e==="false")return false;throw new Error(`Invalid boolean: "${e}"`)},I=e=>e==="auto"?e:u(e),R=e=>{let i=s(e);if(i!=="user"&&i!=="environment"&&i!=="")throw new Error(`Invalid value: "${i}"`);return i},U=e=>{let i=s(e);if(!Object.values(E$1).includes(i))throw new Error(`Invalid value: "${i}"`);return i},N=e=>{let i=s(e),t=j$1(i);if(t.some(r=>!Object.values(E$1).includes(r)))throw new Error(`Invalid value: "${JSON.stringify(t)}"`);return i},$=e=>{if(typeof e=="object"&&!Array.isArray(e)||typeof e=="function")return e;throw new Error("Invalid metadata value. Must be an object or function.")},_=e=>{if(typeof e=="object")return e;throw new Error("Invalid value. Must be an object.")},b=e=>{if(typeof e=="function")return e;throw new Error("Invalid value. Must be a function.")},h=e=>{if(Array.isArray(e))return e;throw new Error("Must be an array.")},j=e=>{let i=s(e);if(["grid","list"].includes(i))return i;throw new Error(`Invalid value: "${i}"`)};var Z={pubkey:s,multiple:u,multipleMin:f,multipleMax:f,confirmUpload:u,imgOnly:u,accept:s,externalSourcesPreferredTypes:s,externalSourcesEmbedCss:s,store:I,cameraMirror:u,cameraCapture:R,sourceList:s,topLevelOrigin:s,maxLocalFileSizeBytes:f,thumbSize:f,showEmptyList:u,useLocalImageEditor:u,useCloudImageEditor:u,cloudImageEditorTabs:s,removeCopyright:u,cropPreset:s,imageShrink:s,modalScrollLock:u,modalBackdropStrokes:u,sourceListWrap:u,remoteTabSessionKey:s,cdnCname:s,cdnCnamePrefixed:s,baseUrl:s,socialBaseUrl:s,secureSignature:s,secureExpire:s,secureDeliveryProxy:s,retryThrottledRequestMaxTimes:f,retryNetworkErrorMaxTimes:f,multipartMinFileSize:f,multipartChunkSize:f,maxConcurrentRequests:f,multipartMaxConcurrentRequests:f,multipartMaxAttempts:f,checkForUrlDuplicates:u,saveUrlForRecurrentUploads:u,groupOutput:u,userAgentIntegration:s,debug:u,localeName:s,metadata:$,secureUploadsExpireThreshold:f,localeDefinitionOverride:e=>_(e),secureUploadsSignatureResolver:e=>b(e),secureDeliveryProxyUrlResolver:e=>b(e),iconHrefResolver:e=>b(e),plugins:e=>h(e),fileValidators:h,collectionValidators:h,validationTimeout:f,validationConcurrency:f,cameraModes:N,defaultCameraMode:U,enableAudioRecording:u,enableVideoRecording:u,mediaRecorderOptions:_,maxVideoRecordingDuration:f,filesViewMode:j,gridShowFileNames:u,cloudImageEditorAutoOpen:u,cloudImageEditorMaskHref:s,testMode:u,qualityInsights:u},L=(e,i)=>{if(!(typeof i>"u"||i===null))try{return Z[e](i)}catch(t){return console.error(`Invalid value for config key "${e}".`,t),q$1[e]}};var T=[...new Set(["debug",...Object.keys(q$1)])],J=["metadata","plugins","localeDefinitionOverride","secureUploadsSignatureResolver","secureDeliveryProxyUrlResolver","iconHrefResolver","fileValidators","collectionValidators","mediaRecorderOptions"],B=e=>J.includes(e),M=T.filter(e=>!B(e)),K={...Object.fromEntries(M.map(e=>[w(e),e])),...Object.fromEntries(M.map(e=>[e.toLowerCase(),e]))},F=e=>`__${e}`,P=class extends D$1{constructor(){super(...arguments);this.init$={...this.init$,...Object.fromEntries(Object.entries(q$1).map(([t,r])=>[i(t),r]))};this._computationControllers=new Map;this._customAttrKeyMapping={};this._customConfigKeys=new Set;this._customConfigSubscriptions=new Map;}_isCustomConfig(t){return this._customConfigKeys.has(t)}_getCustomConfigDefinition(t){let r=this._sharedInstancesBag.pluginManager;if(r)return r.configRegistry.get(t)}_getAttributeNames(t){return [...new Set([w(t),t.toLowerCase()])]}_flushValueToAttribute(t,r){if(B(t)||this._isCustomConfig(t)&&this._getCustomConfigDefinition(t)?.attribute===false)return;let o=this._getAttributeNames(t);for(let n of o)typeof r>"u"||r===null?this.removeAttribute(n):this.getAttribute(n)!==r.toString()&&this.setAttribute(n,r.toString());}_flushValueToState(t,r){let o=i(t);if(this.$[o]!==r)if(typeof r>"u"||r===null){let n=q$1[t];this.$[o]=n!==void 0?n:r;}else this.$[o]=r;}_setValue(t,r){let o;this._isCustomConfig(t)?o=this._getCustomConfigDefinition(t)?.normalize?.(r)??r:o=L(t,r);let n=this,a=F(t);n[a]!==o&&(this._assertSameValueDifferentReference(t,n[a],o),n[a]=o,this._flushValueToAttribute(t,o),this._flushValueToState(t,o),this.debugPrint(`"${t}"`,o),this._isCustomConfig(t)||V(this.cfg));}_getValue(t){let r=this,o=F(t);return r[o]??this.$[i(t)]}_assertSameValueDifferentReference(t,r,o){this.cfg.debug&&o!==r&&typeof o=="object"&&typeof r=="object"&&JSON.stringify(o)===JSON.stringify(r)&&(console.warn(`[uc-config] Option "${t}" value is the same as the previous one but the reference is different`),console.warn("[uc-config] You should avoid changing the reference of the object to prevent unnecessary calculations"),console.warn(`[uc-config] "${t}" previous value:`,r),console.warn(`[uc-config] "${t}" new value:`,o));}_processCustomConfigs(t){let r=t.configRegistry.getAll();this._customAttrKeyMapping={},this._customConfigKeys=new Set(r.keys());for(let[o,n]of this._customConfigSubscriptions)r.has(o)||(n(),this._customConfigSubscriptions.delete(o));for(let[o,n]of r){let c=i(o);if(n.attribute){let p=this._getAttributeNames(o);for(let m of p)this._customAttrKeyMapping[m]=o;}this.sharedCtx.has(c)||this.sharedCtx.add(c,n.defaultValue);let l=Object.getOwnPropertyDescriptor(this,o);if((!l||!l.set||!l.get)&&Object.defineProperty(this,o,{set:p=>{this._setValue(o,p);},get:()=>this._getValue(o),enumerable:true,configurable:true}),!this._customConfigSubscriptions.has(o)){let p=this.sub(c,m=>{this._setValue(o,m);},false);this._customConfigSubscriptions.set(o,p);}}}_setupCustomConfigs(){this._sharedInstancesBag.when("pluginManager",t=>{this._processCustomConfigs(t),this._pluginChangeUnsubscribe=t.onPluginsChange(()=>{this._processCustomConfigs(t);});});}_setupMutationObserver(){this._mutationObserver=new MutationObserver(t=>{for(let r of t)if(r.type==="attributes"&&r.attributeName){let o=r.attributeName,n=r.oldValue,a=this.getAttribute(o);if(n===a||o in K)continue;o in this._customAttrKeyMapping&&this.attributeChangedCallback(o,n??"",a??"");}}),this._mutationObserver.observe(this,{attributes:true,attributeOldValue:true});}initCallback(){super.initCallback();let t=this;this._setupCustomConfigs(),this._setupMutationObserver();for(let r of M)this.sub(i(r),o=>{this._setValue(r,o);},false);for(let r of T){let o=t[r]??this.$[i(r)];o!==q$1[r]&&this._setValue(r,o);let n=Object.getOwnPropertyDescriptor(this,r);(!n||!n.set||!n.get)&&Object.defineProperty(this,r,{set:a=>{this._setValue(r,a);},get:()=>this._getValue(r)});}for(let r of T)this.sub(i(r),()=>{E({key:r,setValue:this._setValue.bind(this),getValue:this._getValue.bind(this),computationControllers:this._computationControllers});});}attributeChangedCallback(t,r,o){if(super.attributeChangedCallback(t,r,o),r===o)return;let n=this,a=K[t];a?n[a]=o:this._sharedInstancesBag.when("pluginManager",c=>{if(this.getAttribute(t)!==o)return;let l=this._customAttrKeyMapping[t],p=l?c.configRegistry.get(l):void 0;if(l&&p){let m=p.fromAttribute?p.fromAttribute(o):o;if(this._getValue(l)===m)return;this._setValue(l,m);}});}disconnectedCallback(){super.disconnectedCallback(),this._pluginChangeUnsubscribe&&(this._pluginChangeUnsubscribe(),this._pluginChangeUnsubscribe=void 0),this._mutationObserver&&(this._mutationObserver.disconnect(),this._mutationObserver=void 0);for(let t of this._customConfigSubscriptions.values())t();this._customConfigSubscriptions.clear();}static get observedAttributes(){let t=super.observedAttributes,r=Object.keys(K);return [...t,...r]}};for(let e of T)P.prototype[e]=void 0;export{w as a,P as b};